How mayurkhalse/sarthi works
Sarthi is a local MCP quality gate for AI coding agents, with a CLI and Antigravity setup adapter. The principal workflow detects and caches a project stack, supplies relevant engineering standards and workflows to the agent, then verifies project changes and reports whether the completion gate passes. Verification includes deterministic checks and sandboxed test execution. The graph also shows the documented standards-provider and platform-sandbox branches. Some subsystems are represented by their exact tree paths because their source was not sampled; edges without direct evidence are omitted.
Main entry points: verifier.py Verification orchestrator · tools.py MCP tools · context.py Context builder · registry.py Provider registry
Components 25
Agent entry points
- MCP server
src/sarthi/mcp/server.py - MCP tools
src/sarthi/mcp/tools.py - CLI
src/sarthi/cli.py - Antigravity adapter
src/sarthi/adapters/antigravity/adapter.py
Project context
- Context builder
src/sarthi/core/context.py - Stack detection
src/sarthi/core/stack_detector.py - Project config
src/sarthi/core/config.py - Path guard
src/sarthi/core/pathguard.py
Standards knowledge
- Resource selector
src/sarthi/core/resources/selector.py - Provider registry
src/sarthi/core/providers/registry.py - ECC provider
src/sarthi/core/providers/ecc.py - Native standards
src/sarthi/core/providers/native.py - Workspace standards
src/sarthi/core/providers/workspace.py - Resource compiler
src/sarthi/core/resources/compiler.py - Rule loader
src/sarthi/core/rules.py
Verification gate
- Verification orchestrator
src/sarthi/core/verify/verifier.py - Check runners
src/sarthi/core/verify/runners - Findings reporter
src/sarthi/core/verify/reporter.py - Command trust
src/sarthi/core/verify/trust.py - Test runner
src/sarthi/core/verify/runners/tests.py
Execution isolation
- Sandbox manager
src/sarthi/core/sandbox/manager.py - Workspace staging
src/sarthi/core/sandbox/staging.py - Linux backend
src/sarthi/core/sandbox/backends/linux.py - Platform backends
src/sarthi/core/sandbox/backends
Other components
- AI agent
Connections 27
- AI agent → MCP server: uses stdio
README.md - MCP server → MCP tools: registers tools
src/sarthi/mcp/server.py - AI agent → MCP tools: requests standards
README.md - CLI → Context builder: initializes project
src/sarthi/cli.py - Antigravity adapter → MCP server: configures server
src/sarthi/adapters/antigravity/adapter.py - MCP tools → Context builder: builds context
src/sarthi/mcp/tools.py - Context builder → Stack detection: detects stack
src/sarthi/core/context.py - Context builder → Project config: loads config
src/sarthi/core/context.py - Context builder → Path guard: guards paths
src/sarthi/core/context.py - MCP tools → Resource selector: selects standards
src/sarthi/mcp/tools.py - Resource selector → Provider registry: lists resources
src/sarthi/core/resources/selector.py - Provider registry → ECC provider: discovers provider
- Provider registry → Native standards: discovers provider
- Provider registry → Workspace standards: discovers provider
- Resource selector → Resource compiler: compiles resources
- MCP tools → Rule loader: fetches rules
src/sarthi/mcp/tools.py - MCP tools → Verification orchestrator: runs verification
src/sarthi/mcp/tools.py - Verification orchestrator → Context builder: loads context
src/sarthi/core/verify/verifier.py - Verification orchestrator → Rule loader: loads rules
src/sarthi/core/verify/verifier.py - Verification orchestrator → Check runners: dispatches checks
src/sarthi/core/verify/verifier.py - Verification orchestrator → Command trust: checks commands
src/sarthi/core/verify/verifier.py - Verification orchestrator → Findings reporter: reports findings
- Check runners → Test runner: includes test checks
src/sarthi/core/verify/runners/tests.py - Test runner → Sandbox manager: executes in sandbox
src/sarthi/core/verify/runners/tests.py - Sandbox manager → Linux backend: dispatches backend
src/sarthi/core/sandbox/manager.py - Sandbox manager → Platform backends: selects by platform
src/sarthi/core/sandbox/manager.py - Sandbox manager → Workspace staging: stages workspace
src/sarthi/core/sandbox/manager.py