Agentic Dev Guardian
Index your codebase into a knowledge graph, then let agents use it to review PRs, red-team risky functions, triage incidents, plan refactors, and write architecture docs.
Install: pip install agentic-dev-guardian · Command: dev-guardian · Source · Issues
Why
Hand a model a diff and it sees the diff. It misses the twelve callers of the function you changed, the subclass overriding it, and the module importing it for a side effect.
Guardian indexes your repository into a call, import, and inheritance graph first. Agents then query that graph for the neighbourhood around each change, so a verdict rests on what your code references instead of on whatever fit in the context window.
Reach for it when you want:
- A PR gate that knows the blast radius.
evaluatesends a diff through a Mixture-of-Agents pipeline and returnsapprove / remediate / rejectwith the impacted call graph attached. - Hardening before anyone files a PR.
auditranks functions by fan-out and red-teams the worst offenders. - On-call help that reads the graph.
incident --traceturns a stack trace into a hotfix blueprint using the call graph around the failing frame. - Migrations someone else plans.
refactortranslates "migrate Pydantic v1 to v2" into Cypher, finds every affected entity, and emits a validated blueprint. - Docs that track the code.
docsnarrates the live graph into aGUARDIAN_WIKI.md. - The same tools in your editor.
serveexposes them over MCP to Cursor, Claude Desktop, or Windsurf.
Quickstart
You need Python 3.11+. Nothing else — the graph and vector stores are embedded and run inside the Guardian process.
pip install agentic-dev-guardian # or: uvx --from agentic-dev-guardian dev-guardian --help
export GUARDIAN_PROVIDER=groq # groq | anthropic | openai | ollama | local | huggingface
export GUARDIAN_GROQ_API_KEY=... # groq key; anthropic/openai use ANTHROPIC_API_KEY / OPENAI_API_KEY instead
dev-guardian index /path/to/your/repo # add --skip-vectors on RAM-constrained machines
dev-guardian evaluate my_feature.diff --repo /path/to/your/repo
Extras: pip install "agentic-dev-guardian[anthropic]" (also openai, viz, tracing, all).
Upgrading from a Docker-backed install: the embedded stores do not read the old container volumes. Re-run
dev-guardian index <path>once per repository, then remove the leftovers withdocker rm -f guardian-memgraph guardian-qdrant. Guardian no longer manages any containers.
Working from a checkout:
git clone https://github.com/SmayanKulkarni/Agentic-Dev-Guardian.git
cd Agentic-Dev-Guardian/backend
python -m venv .venv && source .venv/bin/activate
pip install -e ".[dev]"
How It Works
Guardian runs in two stages.
- Index. Tree-sitter parses the codebase. Kùzu stores the structural edges
(
IMPORTS,CALLS,INHERITS_FROM) and Qdrant stores the semantic index, both under<repo>/.guardian/. - Act. LangGraph pipelines query that graph to evaluate PRs, audit risky functions, triage incidents, plan refactors, or write architecture docs.
Commands
| CLI Command | What It Does |
|---|---|
dev-guardian index <path> |
Parse & ingest a codebase into the embedded stores (streaming, memory-safe) |
dev-guardian evaluate <diff> |
Run a PR diff through the MoA Gatekeeper + Red Team pipeline |
dev-guardian audit <path> |
Find the highest blast-radius functions and red-team them |
dev-guardian incident --trace "..." |
Turn a production stack trace into a targeted hotfix blueprint |
dev-guardian refactor --pattern "..." |
Build a migration blueprint from a pattern or plain English |
dev-guardian docs <path> |
Write a live GUARDIAN_WIKI.md from the AST graph |
dev-guardian serve |
Start the MCP Server for IDE integration (Cursor, Claude Desktop, Windsurf) |
dev-guardian mcp-config |
Print your IDE's MCP JSON block (--client vscode|codex|cursor|...) |
dev-guardian version |
Print the installed version |
Architecture
| Layer | Technology |
|---|---|
| AST Parsing | Tree-sitter with a custom Python walker |
| Knowledge Graph | Kùzu (embedded, file-backed under <repo>/.guardian/kuzu), holding ASTNode relationships (IMPORTS, CALLS, INHERITS_FROM) |
| Semantic Index | Qdrant embedded (<repo>/.guardian/qdrant) + FastEmbed (ONNX; --skip-vectors for RAM-constrained systems) |
| Hybrid Retrieval | HybridRetriever, fusing Cypher graph results with Qdrant vector search |
| Agent Orchestration | LangGraph typed state graphs (GuardianState, SREState, RefactorState) |
| LLM Engine | Groq (llama-3.3-70b-versatile) by default; also Anthropic, OpenAI, Ollama, or any OpenAI-compatible endpoint |
| LLMOps & Tracing | A local SQLite call log always; Langfuse behind the [tracing] extra |
| IDE Integration | MCP Server over stdio or streamable HTTP |
Data Handling
Guardian ships your source code to a third-party LLM provider. Know that before you point it at anything sensitive.
What leaves your machine: the PR diff verbatim, plus the GraphRAG context retrieved from your indexed codebase (function bodies, structural relations). Both go into the prompt as-is.
Where it goes: to whichever provider GUARDIAN_PROVIDER names, so groq by default,
or anthropic or openai. Choosing ollama or local keeps the calls on your own
infrastructure, though the prompts assume a 70B-class model. Smaller local models lose the
most ground on Red Team test generation, Remediation diffs, and text-to-Cypher.
What stays local: the Kùzu AST graph, the Qdrant index, and every deterministic
node, meaning IncidentTriager, RefactorPlanner, BlueprintValidator, and the
supervisor's routing logic. Blast-radius and impact analysis run on your own graph with no
LLM in the loop.
--clearance is not a privacy control. It scopes how much of the graph a Cypher query
pulls back (clearance_level <= $cl). Whatever it does retrieve still reaches the provider,
and the PR diff skips the check.
Agent Pipelines
PR Evaluation (evaluate)
Gatekeeper → Red Team → Remediation → Decision
Reads a .diff file, pulls GraphRAG context for it, then runs a Mixture-of-Agents pipeline
that lands on approve, remediate, or reject.
Proactive Audit (audit)
Kùzu (blast-radius query) → Gatekeeper → Red Team → Markdown Report
Ranks functions by outgoing calls, red-teams the top N without waiting for a PR, and writes
a severity-ranked guardian_audit.md.
Incident Response (incident)
IncidentTriager → SandboxReproducer → HotfixScribe
Parses a raw stack trace, asks Kùzu for the call graph around the failing function, tries to reproduce the failure, and drafts a hotfix blueprint.
Self-Healing Refactor (refactor)
PatternTranslator → RefactorPlanner → MigrationScribe → BlueprintValidator
Takes a registered pattern such as migrate-pydantic-v1-to-v2, or free-form English.
Translates the intent into Cypher, finds every affected entity, and produces a validated
migration blueprint.
Docs Generation (docs)
StructureExplainer → ADRGenerator → WikiBuilder
Queries IMPORTS, CALLS, and INHERITS_FROM edges from the live graph, narrates them into
readable section summaries, and assembles a full GUARDIAN_WIKI.md.
Providers & Configuration
You choose the provider. Guardian never guesses from whichever key happens to sit in your
environment. GUARDIAN_PROVIDER picks the backend and GUARDIAN_MODEL overrides that
backend's default model. A missing key for the provider you selected fails the run instead
of falling back to another one.
| Provider | Key | Notes |
|---|---|---|
groq (default) |
GROQ_API_KEY |
llama-3.3-70b-versatile |
anthropic |
ANTHROPIC_API_KEY |
structured output via forced tool-use; needs the [anthropic] extra |
openai |
OPENAI_API_KEY |
cloud only; needs the [openai] extra |
ollama |
none | http://localhost:11434/v1, defaults to qwen3:8b |
local |
none | any OpenAI-compatible engine; set GUARDIAN_LOCAL_BASE_URL |
huggingface |
HF_TOKEN |
Inference Providers router |
Running a local or self-hosted model? Set GUARDIAN_CONTEXT_TOKENS to that model's real
context size, and GUARDIAN_TPM if your endpoint meters you. Guardian cannot infer either
one.
Environment variables win over everything. Dotenv files exist for convenience and load in
ascending priority: ~/.config/guardian/.env, then backend/.env, then ./.env. Every
setting answers to a GUARDIAN_-prefixed name as well as its plain vendor name, and
Guardian writes no configuration of its own.
MCP Integration
dev-guardian serve starts a stdio MCP server. It exposes 4 bootstrap tools at startup to
keep your IDE's context window lean:
query_guardian_graphruns semantic and structural search over the indexed codebaselist_capabilitiesreports what else you can loadequip_capabilityandunequip_capabilityload and unload a domain's tools on demand
Everything heavier arrives just in time. equip_capability("pr_governance") adds
evaluate_pr_diff, codebase_intelligence adds impact_analysis, index_codebase,
audit_codebase and generate_architecture_docs, and incident_response and
self_healing bring their own. Every CLI command has an MCP equivalent; there is no
infrastructure command left to run. The server fires
notifications/tools/list_changed on each swap, so a client that caches the tool list for
a session picks the new tools up on its next refresh rather than right away.
Why MCP over CLI
The CLI is fire-and-forget. You write code, save a diff, switch to terminal, run dev-guardian evaluate diff.patch, parse the markdown output, and switch back. Each run costs context: initialization overhead, format conversion, re-parsing.
MCP stays in session. Your agent (Claude, in Cursor or Claude Desktop) calls Guardian's tools directly. No round-trip through markdown. No manual parsing. A diff already open in your IDE? Pass it straight to evaluate_pr_diff. Stack trace in a comment? Copy it to incident_response. Results land in-chat, structured.
Token savings add up on multi-turn work. One session, persistent context, batch operations, caching on repeated queries. On a typical PR audit, MCP uses 30% fewer tokens than CLI + conversation.
Generate the exact block for your install, filled in with your resolved settings:
dev-guardian mcp-config # Claude Code / Claude Desktop
dev-guardian mcp-config --client vscode # .vscode/mcp.json
dev-guardian mcp-config --client codex # ~/.codex/config.toml
{
"mcpServers": {
"guardian": {
"command": "uvx",
"args": ["--from", "agentic-dev-guardian", "dev-guardian", "serve"],
"env": { "GUARDIAN_PROVIDER": "groq", "GUARDIAN_GROQ_API_KEY": "<your-api-key>" }
}
}
}
--client takes claude, cursor, windsurf, antigravity, claude-desktop, vscode,
or codex. The shapes are not interchangeable: VS Code keys servers under servers and
Codex reads TOML, while the rest use Claude Desktop's mcpServers. The printed comment
line names the file to paste into, and goes to stderr so you can redirect the block itself.
Guardian runs its own agent pipeline inside the server process against GUARDIAN_PROVIDER,
so evaluate_pr_diff behaves the same in every client — it does not borrow the editor's
model and does not need the editor to spawn sub-agents. It does need its own key, or
GUARDIAN_PROVIDER=ollama for a fully local run.
Index at least one repository before you point an IDE at the server.
Clients that ignore tools/list_changed
JIT equipping assumes your client refreshes its tool list when the server notifies it. If
yours does not, equipped tools never become visible. Set GUARDIAN_PRELOAD_CLUSTERS=all in
the server's env block to register every cluster at startup instead — a fuller context
window in exchange for tools that are there from the first message. A comma-separated list
(pr_governance,codebase_intelligence) preloads only those.
Serving over HTTP
Run one Guardian on the machine holding the indexed codebase and connect from elsewhere, or from several clients, using the streamable-HTTP transport instead of stdio:
dev-guardian serve --transport streamable-http --port 8000 # endpoint: /mcp
It binds to 127.0.0.1 and stays there on purpose. Guardian carries no authentication of
its own and its tools read your indexed codebase, so anything past loopback belongs behind
a reverse proxy that authenticates. Equipped capabilities live in process-global state, so
treat an HTTP server as single-user rather than multi-tenant.
Optional tracing
Langfuse is an extra, not a dependency. Leave it out and every @observe span becomes a
no-op while Guardian runs as usual. The local SQLite call log in harness/logger.py keeps
recording either way.
pip install "agentic-dev-guardian[tracing]"
export LANGFUSE_PUBLIC_KEY=... LANGFUSE_SECRET_KEY=...
GUARDIAN_LANGFUSE_* / LANGFUSE_* in backend/.env also work — core/tracing.py
copies whatever GuardianSettings resolved into os.environ (real exported env vars
still win) before Langfuse's own SDK reads it. Langfuse ignores GuardianSettings
entirely and reads os.environ directly, so without that copy step a .env-only
setup silently no-ops every trace with an auth error nobody sees.
Repository Map
backend/src/dev_guardian/
├── core/ # Config (Pydantic Settings) + structured logging (structlog)
├── parsers/ # Tree-sitter AST parser + ASTNode/ASTEdge data models
├── graphrag/ # Kùzu client, Qdrant client, vector manager, hybrid retriever
├── agents/ # LangGraph nodes, typed state definitions, graph builders
├── capability_clusters/ # Tool groupings (codebase_intelligence, pr_governance, ...)
├── harness/ # Prompt YAML loading + local SQLite LLM call log
├── prompts/ # Versioned prompt templates
├── skills/ # Agent personas (graphrag_engineer, red_team_tester, ...)
├── docs/ # structure_explainer.py, adr_generator.py, wiki_builder.py
├── cli.py # Typer CLI entry point (`dev-guardian` command)
└── mcp_server.py # MCP Server with JIT tool loading for IDE integration
The repo also carries frontend/ (dashboard UI), evaluation/ (benchmark datasets and
scripts), and .agents/ (memory, skills, logs). The PyPI wheel ships none of them. It
contains backend/src/dev_guardian and nothing else.
License
MIT. See LICENSE.
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file agentic_dev_guardian-0.1.2.tar.gz.
File metadata
- Download URL: agentic_dev_guardian-0.1.2.tar.gz
- Upload date:
- Size: 121.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ef55df2bf9fa8021ae91bfd2666f1f8eeec01d754ef73a00da6beeae4ce8fa5d
|
|
| MD5 |
ad05965c9bcf0aa0d9f01f4828c9268f
|
|
| BLAKE2b-256 |
ff06a881f1383d7c711ebd5f61ce794626fe7e8d355a59038b778a08ab3105b6
|
Provenance
The following attestation bundles were made for agentic_dev_guardian-0.1.2.tar.gz:
Publisher:
release.yml on SmayanKulkarni/Agentic-Dev-Guardian
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
agentic_dev_guardian-0.1.2.tar.gz -
Subject digest:
ef55df2bf9fa8021ae91bfd2666f1f8eeec01d754ef73a00da6beeae4ce8fa5d - Sigstore transparency entry: 2417289380
- Sigstore integration time:
-
Permalink:
SmayanKulkarni/Agentic-Dev-Guardian@b021a76c12dabf9aa18a7dc0210fc155f0d27d0b -
Branch / Tag:
refs/tags/v0.1.2 - Owner: https://github.com/SmayanKulkarni
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@b021a76c12dabf9aa18a7dc0210fc155f0d27d0b -
Trigger Event:
push
-
Statement type:
File details
Details for the file agentic_dev_guardian-0.1.2-py3-none-any.whl.
File metadata
- Download URL: agentic_dev_guardian-0.1.2-py3-none-any.whl
- Upload date:
- Size: 132.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d45e4d66f212d174f5ed97ed11202116615568709c09aef56f050579f3f03297
|
|
| MD5 |
30fdaa293a66233d950ec9814cc4ae86
|
|
| BLAKE2b-256 |
d060449ec9acdf8e224f9b12aa81baa3c2921c5d5362a23d8d3b94349a4833e0
|
Provenance
The following attestation bundles were made for agentic_dev_guardian-0.1.2-py3-none-any.whl:
Publisher:
release.yml on SmayanKulkarni/Agentic-Dev-Guardian
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
agentic_dev_guardian-0.1.2-py3-none-any.whl -
Subject digest:
d45e4d66f212d174f5ed97ed11202116615568709c09aef56f050579f3f03297 - Sigstore transparency entry: 2417289440
- Sigstore integration time:
-
Permalink:
SmayanKulkarni/Agentic-Dev-Guardian@b021a76c12dabf9aa18a7dc0210fc155f0d27d0b -
Branch / Tag:
refs/tags/v0.1.2 - Owner: https://github.com/SmayanKulkarni
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@b021a76c12dabf9aa18a7dc0210fc155f0d27d0b -
Trigger Event:
push
-
Statement type: