Context Doctor makes context engineering easier. Describe the agent behavior you want and what is happening instead; it maps the instructions, memory, skills, commands, settings, and hooks around the task, then identifies context that may be helping or interfering.
- Finds contradictory, stale, duplicated, or unexpectedly scoped context.
- Explains how each relevant artifact could affect the behavior you see.
- Distinguishes a discovered file from evidence that a harness actually loaded it.
- Suggests narrow isolation tests and minimal context changes instead of guesswork.
- Produces a reusable context map across Claude Code, Codex, OpenCode, Gemini CLI, and other Agent Skills-compatible harnesses.
The diagnosis is read-only. Project context is examined by default; user-level configuration and memory remain opt-in.
- Start from the requested behavior, not from a provider-specific checklist.
- Treat every discovered artifact as a candidate until load or scope is evidenced.
- Diagnose the current project by default.
- Read user-level configuration and memory only when explicitly requested.
- Never print hook commands, environment values, tokens, or unrelated memories.
- Diagnose first. The doctor does not modify context.
- Node.js 18 or newer
The deterministic inventory command has no runtime dependencies.
After this repository is published:
claude plugin marketplace add DheerG/context-doctor
claude plugin install context-doctor@context-doctor --scope userRestart Claude Code, then invoke:
/context-doctor:diagnose-agent-context The agent keeps rewriting tests when I asked it to diagnose only.
For local development:
claude --plugin-dir ./plugins/context-doctorAfter this repository is published:
codex plugin marketplace add DheerG/context-doctorInstall context-doctor from that marketplace in the Codex plugin UI, then invoke:
$context-doctor:diagnose-agent-context Find context that makes the agent over-format every response.
For local development, add the absolute path to this repository as a local marketplace.
Clone the repository, then install the entry points you need:
node plugins/context-doctor/scripts/install.mjs --harness opencode
node plugins/context-doctor/scripts/install.mjs --harness gemini
node plugins/context-doctor/scripts/install.mjs --harness agentsUse --harness all for all three. Existing targets are preserved unless --force is supplied.
Invoke /diagnose-agent-context <behavior and mismatch> in OpenCode or Gemini CLI. Agent Skills-compatible harnesses can invoke diagnose-agent-context by name.
Link the command during development:
npm linkRun it from the project being diagnosed:
context-doctor self-check
context-doctor inventory
context-doctor inventory --format json
context-doctor inventory --include-global--include-global is an explicit privacy boundary. The command lists candidate paths and limited metadata; it does not emit artifact contents. The agent reads only evidence relevant to the behavior under diagnosis.
The diagnosis is read-only, so it can run during planning:
Use diagnose-agent-context before proposing changes. Compare the behavior I want
with project context, and do not inspect user-level memory without asking.
If remediation is later approved, keep inventory, diagnosis, edits, and verification as separate plan steps.
Findings are classified as:
- direct conflict;
- likely interference;
- conditional or ambiguous;
- complementary.
Each finding should include the path and relevant lines, the affected behavior, a plausible mechanism, confidence, and a narrow confirmation test. “No likely interference found” is a valid result.
npm test
npm run validate
npm run version:checkEvery merge to main receives a SemVer bump, an immutable v<version> tag, and a GitHub Release.
- Apply the
majorlabel to a pull request for a major bump. - Apply the
minorlabel for a minor bump. - With neither label, the workflow applies a patch bump.
Repository setup:
- Create the
majorandminorpull-request labels. - Give GitHub Actions read/write repository permission.
- Permit
github-actions[bot]to push its version-only commit tomain. If branch rules prevent that, add a write-capableDEPLOY_KEYrepository secret.
The workflow keeps package.json, both plugin manifests, and both marketplace entries on the same version. Tags are never moved.
MIT