Audit, generate, sync, verify, and package repository context files for AI coding agents.
Project description
Agent Context Doctor
One CLI to keep all your AI agent context files in sync.
Zero dependencies · Works offline · No API key needed
Audit, generate, sync, verify, and package repository context files for AI coding agents.
agentctx helps you keep project instructions accurate across tools such as Codex, Claude Code, Gemini CLI, Cursor, and GitHub Copilot. It works locally, uses no LLM API, and has zero runtime dependencies.
Why?
AI coding agents work better when your repository has clear, current, and tool-readable instructions. Many projects now carry several context files:
AGENTS.mdCLAUDE.mdGEMINI.md.github/copilot-instructions.md.cursor/rules/HANDOFF.md
Keeping those files synchronized by hand is easy to forget. Agent Context Doctor scans your repository, reports missing or stale context, generates starter files, safely syncs generated sections, verifies context health in CI, and creates handoff/context packs for the next AI coding session.
Features
- Scan repository context with a readable score and machine-readable JSON.
- Verify in CI with a clear pass/fail command separate from human reports.
- Generate starter files for AGENTS.md, Claude, Gemini, Copilot, Cursor, and handoff notes.
- Safely sync generated sections without deleting user-written content outside markers, including Cursor rules.
- Create handoff summaries from local Git state.
- Package AI-ready context into
PROJECT_CONTEXT.mdor print it with--stdout. - Generate score badges for README files.
- Run safe repairs with
agentctx doctor --fix. - Zero runtime dependencies; Python standard library only.
| Command | What it does |
|---|---|
agentctx scan |
🏥 Score your repo's AI context health (0–100) |
agentctx verify |
✅ CI-friendly pass/fail gate (--min-score, --strict) |
agentctx init |
📋 Generate AGENTS.md, HANDOFF.md & all tool context files |
agentctx sync |
🔄 Propagate AGENTS.md updates across CLAUDE.md, GEMINI.md, Copilot, Cursor |
agentctx doctor --fix |
🩺 Auto-repair all missing/outdated context in one command |
agentctx handoff |
📝 Session handoff summary from local Git state |
agentctx pack |
📦 Bundle everything into PROJECT_CONTEXT.md or --stdout |
agentctx badge |
🏅 Generate a score badge for your README |
Installation
From PyPI, once published:
pip install agent-context-doctor
From source:
git clone https://github.com/lamguo/agent-context-doctor.git
cd agent-context-doctor
python -m pip install -e .
Quick start
# Audit the current repository for humans
agentctx scan
# JSON output for scripts
agentctx scan --json
# CI-friendly verification
agentctx verify --min-score 90
agentctx verify --strict
# Generate AGENTS.md and HANDOFF.md if missing
agentctx init
# Generate all supported context files
agentctx init --all
# Sync AGENTS.md into Claude, Gemini, Copilot, and Cursor instruction files
agentctx sync --from AGENTS.md
# Check whether generated files are in sync
agentctx sync --check
# Generate a handoff file from local Git state
agentctx handoff
# Generate PROJECT_CONTEXT.md for a new AI coding session
agentctx pack
# Print the context pack instead of writing it
agentctx pack --stdout
# Generate a README badge
agentctx badge
# Plan/apply safe context repairs
agentctx doctor
agentctx doctor --fix
Example scan output
Agent Context Doctor
Repository: my-project
Score: 82/100 (Good)
Found:
✅ README.md
✅ AGENTS.md
✅ tests/
Missing:
⚠️ HANDOFF.md
⚠️ GEMINI.md
Problems:
⚠️ Missing HANDOFF.md. Long AI coding sessions are easier to resume with a handoff file.
⚠️ Missing GEMINI.md.
Suggestions:
- Run: agentctx init --all
- Run: agentctx handoff
Commands
agentctx scan
Checks common AI context files, project files, referenced local paths, common project commands, command/config mismatches, AGENTS.md quality sections, and sync markers. It is meant for human-readable reporting and returns zero by default unless --fail-under is used.
agentctx scan
agentctx scan --json
agentctx scan --fail-under 80
agentctx scan --root /path/to/repo
agentctx verify
Runs a CI-friendly verification gate. Unlike scan, this command is intentionally pass/fail.
agentctx verify
agentctx verify --min-score 90
agentctx verify --strict
agentctx verify --json
agentctx init
Creates starter templates. Existing files are skipped by default.
agentctx init
agentctx init --all
agentctx init --dry-run
agentctx init --force
agentctx sync
Copies AGENTS.md into generated sections in tool-specific files. It only replaces content between agentctx markers.
agentctx sync --from AGENTS.md
agentctx sync --to claude --to gemini
agentctx sync --to cursor
agentctx sync --dry-run
agentctx sync --check
agentctx handoff
Creates a handoff file using local Git metadata.
agentctx handoff
agentctx handoff --json
agentctx handoff --output HANDOFF.md
agentctx pack
Creates an AI-ready context package.
agentctx pack
agentctx pack --output PROJECT_CONTEXT.md
agentctx pack --stdout
agentctx badge
Prints a dynamic Markdown badge based on the current context score.
agentctx badge
agentctx badge --style flat-square
agentctx badge --url-only
agentctx badge --json
agentctx doctor
Plans or applies safe automatic repairs. Safe repairs can create missing starter files, generate HANDOFF.md, and create or refresh generated tool files from AGENTS.md. It does not delete files or overwrite user-authored content outside agentctx markers.
agentctx doctor
agentctx doctor --fix
agentctx doctor --json
Generated file safety
agentctx sync uses markers like this:
<!-- agentctx:source AGENTS.md -->
<!-- agentctx:hash abc123 -->
<!-- agentctx:begin -->
Generated content here.
<!-- agentctx:end -->
On later syncs, only the generated block is replaced. Content before or after the markers is preserved.
CI usage
name: CI
on:
push:
pull_request:
workflow_dispatch:
jobs:
context:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: "3.12"
- run: python -m pip install -e .
- run: agentctx verify --min-score 90
- run: agentctx sync --check
GitHub setup
After creating the GitHub repository, set the default branch and Topics in the GitHub UI. See docs/github-setup.md.
Recommended Topics:
ai, coding-agents, agents-md, claude-code, gemini-cli, github-copilot, cursor, developer-tools, cli, python
Development
python -m pip install -e .[dev]
pytest
agentctx scan
agentctx verify --min-score 90
Roadmap
- More stale-path and command validation rules.
- Markdown table output option.
- Optional GitHub Action wrapper.
- Config file support for custom scoring thresholds.
Contributing
See CONTRIBUTING.md.
💖 Support
If Agent Context Doctor saves you time, consider supporting the project:
微信赞赏码
License
MIT
Project details
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 agent_context_doctor-0.3.1.tar.gz.
File metadata
- Download URL: agent_context_doctor-0.3.1.tar.gz
- Upload date:
- Size: 134.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
aafbe34e134b30f8d9816d0e706717da2797c98ea0f01369a7ba470a72cc3b6f
|
|
| MD5 |
266bf2b6d646749ebe76b6cb8bf5db64
|
|
| BLAKE2b-256 |
b3ba37655ea1f54767643b9407574326e1428cac1f597edcd1dbd401954c9c9d
|
File details
Details for the file agent_context_doctor-0.3.1-py3-none-any.whl.
File metadata
- Download URL: agent_context_doctor-0.3.1-py3-none-any.whl
- Upload date:
- Size: 25.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
786240d6203fafe6d7fc182a16a94e55ac5c741932aa88f08d5ee8c589941ccd
|
|
| MD5 |
feb09e7e57545351d3323654651ed6b9
|
|
| BLAKE2b-256 |
afceb4b0fd72a0e2317dd008c42f31069ced3faefa48b0f75fed98db347ec320
|