This service validates local PRs using a shadow knowledge tree (per-directory metadata) and a shadow diff environment (per-directory diffs). It combines deterministic guards with strict JSON-only LLM prompting for scoped, evidence-based analysis.
- Shadow Knowledge Tree (SKT):
_dir.meta.json,api_exports.json,deps_subgraph.jsonper directory. - Shadow Diff Environment (SDE):
_dir.diff.jsonper directory, withno_changeentries and child links. - Navigator: GET
/shadow/contextprovides bounded, linkable JSON contexts. - Analysis: deterministic guards + shadow-scoped LLM prompts; per-run outputs with rank and score.
- GET
/health - POST
/generate_knowledge{ repo_dir } - POST
/shadow/init{ repo_dir } - POST
/shadow/diff{ base_dir, head_dir } - GET
/shadow/context{ repo_id, [run_id], rel_path, budget } - POST
/local/pr/analyze{ base_dir, head_dir, ticket } - POST
/shadow/file_content{ repo_id, run_id?, rel_path, where, max_bytes } - POST
/policy/evaluate{ report, policies? } - POST
/export/sarif{ report }
Create a .env:
OPENAI_API_KEY=...
OPENAI_MODEL=gpt-4o-mini
python3 -m pip install -r requirements.txt
python3 -c 'from server.app import create_app; app=create_app(); app.run(host="0.0.0.0", port=5057, debug=False)'
curl -X POST localhost:5057/shadow/init -H 'Content-Type: application/json' \
-d '{"repo_dir":"/abs/path/to/repo"}'
curl -X POST localhost:5057/shadow/diff -H 'Content-Type: application/json' \
-d '{"base_dir":"/abs/base","head_dir":"/abs/head"}'
curl -X POST localhost:5057/local/pr/analyze -H 'Content-Type: application/json' -d @ticket_payload.json
Where ticket_payload.json contains:
{
"base_dir": "/abs/base",
"head_dir": "/abs/head",
"ticket": { ... ticket schema ... }
}
results/{repoId}/shadow/— SKTresults/{repoId}/shadow_diff/{runId}/— SDEresults/{repoId}/analysis/{runId}/— report, diff_bundle, feature_summary, dry_run, manifest, report.sarif.jsonprompt_performance/last_*.json— prompt traces
- All artifacts are strict JSON; prompts are instruction-locked and conservative.
- Large directories cap
no_changelists; hunk texts are trimmed per budget.