coograph
CLAUDE.md17 starsChanged 7 months agoMITView on GitHub
π HARD RULE β CODE-GRAPH FIRST. Before any codebase search, navigation, tracing, or exploration you MUST use the code-graph MCP tools first (mcp__code-graph__*). Only fall back to sqlite3 .code-graph/graph.db, and only then to Glob/Grep/Read, if the code-graph DB is genuinely NOT present in the workspace. Convenience is not a valid reason to skip. See "Tool Preferences" below. π HARD RULE β OPENSPEC OR STOP. For any change that modifies 2+ files, touches a spec, alters a public interface, or addsβ¦
In this repository14 other files it gives its agents.
- AGENTS.mdAGENTS.md
- .github/copilot-instructions.mdCopilot instructions
- coograph-initSkill
- coograph-applySkill
- coograph-archiveSkill
- coograph-disable-multi-modelsSkill
- coograph-exploreSkill
- coograph-initSkill
- coograph-new-ticketSkill
- coograph-proposeSkill
- coograph-rebuild-graphSkill
- coograph-retroSkill
- coograph-suggest-multi-modelsSkill
- coograph-ultra-reviewSkill
The file
We split this CLAUDE.md into the rules it gives an agent
12 rules. About 0 are common, 5 are distinctive, and 7 are very specific to this project.
β0
Common Β· estimate
Many files like this have a rule of this kind.
β5
Distinctive Β· estimate
This author's own choices. Worth a look.
7
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 15
Before doing any work, execute this checklist:
- Very specific: line 24
Read .github/copilot-instructions.md at the start of every implementation task.
- Very specific: line 30
Read .github/instructions/brutal-honesty.instructions.md at session start and apply throughout.
- Distinctive: line 59
Feature inventory before editing: Before modifying a container or page, list all existing features (sections, hooks, conditional blocks, β¦
- Very specific: line 75
Before any non-trivial implementation, follow: Plan β Propose β Apply.
- Distinctive: line 86
Skip planning: when review output already exists in conversation, or the user specifies the problem, files, and fix direction.
- Very specific: line 87
Bug reports: Run /coograph-debug. If the fix is a one-line exempt change (per literal list above), apply it.
- Very specific: line 91
Create an OpenSpec in openspec/changes/<date>-<slug>/ with .openspec.yaml, proposal.md, specs/<capability>/spec.md, and tasks.md.
- Distinctive: line 102
Read every file before editing.
- Very specific: line 103
If you hit a non-obvious build error, run /coograph-debug.
- Distinctive: line 135
When the conversation context is compacted, always preserve:
- Very specific: line 148
Never cite your own prior output as evidence: Only fresh read_file / tool output counts.
β βCommonβ is an estimate: at least 1 in 5 of the 12,729 CLAUDE.md files we read have a rule of the same kind, not the same words. βVery specificβ is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Claude Code Instructions
π HARD RULE β CODE-GRAPH FIRST. Before any codebase search, navigation, tracing, or exploration you MUST use the code-graph MCP tools first (
mcp__code-graph__*). Only fall back tosqlite3 .code-graph/graph.db, and only then toGlob/Grep/Read, if the code-graph DB is genuinely NOT present in the workspace. Convenience is not a valid reason to skip. See "Tool Preferences" below.
π HARD RULE β OPENSPEC OR STOP. For any change that modifies 2+ files, touches a spec, alters a public interface, or adds new behavior, you MUST create an OpenSpec in
openspec/changes/<date>-<slug>/and WAIT for user approval BEFORE writing code. Exemptions are narrow and literal:
- Typo fix in a single file
- Comment/docstring-only edit
- Config-value bump the user explicitly dictates (e.g., "set X=2")
- Follow-up fix for an already-approved, in-progress OpenSpec
"Trivial," "obvious," "I already know what to do," "small," and "just one tweak" are NOT exemptions. If in doubt β propose, don't code. See Β§ Implementation Workflow for the full Plan β Propose β Apply flow.
Pre-flight (run on every session start)
Before doing any work, execute this checklist:
- Code-graph availability β call
get_minimal_contextwith a summary of the task. If it succeeds, code-graph is available and MUST be used for all navigation this session. If it fails, note that code-graph is unavailable and grep/glob fallback is permitted for this session. - Read conventions β read
.github/copilot-instructions.md(if not already loaded by the system). - Check in-progress work β look for open OpenSpecs in
openspec/changes/(skiparchive/). If one exists, summarize its status before starting new work. - OpenSpec gate β does this task already have an OpenSpec? If NO and it does not fit the exemption list in the HARD RULE above β STOP. Create the OpenSpec (
proposal.md,specs/<capability>/spec.md,tasks.md) and wait for approval before any code edits.
This checklist primes correct tool usage for the entire session. Do not skip it.
Read .github/copilot-instructions.md at the start of every implementation task. It contains all project conventions, code style, data layer patterns, i18n rules, and agent configuration.
Domain-specific instructions (testing, styling) are in .github/instructions/ and are loaded automatically by VS Code when editing matching files. For Claude Code, read them on demand: check .github/instructions/testing.instructions.md when writing tests, .github/instructions/styling.instructions.md when writing CSS.
Communication Style
Read .github/instructions/brutal-honesty.instructions.md at session start and apply throughout. Direct, evidence-based, concise. No filler, no praise padding, no softening. See also .github/copilot-instructions.md.
Quick Reference
| Task | Command |
| Dev server | _TBD_ |
| Build | _TBD_ |
| Lint | _TBD_ |
| Type-check | _TBD_ |
| Format | _TBD_ |
| Test | _TBD_ |
Branching Strategy
<!-- FILL: e.g. "Feature branches off `main`. Branch naming: `feature/<ticket>-<slug>`, `fix/<ticket>-<slug>`." -->Key Paths
- Source code:
src/ - Shared components:
_TBD_ - API types:
_TBD_ - Translations:
_TBD_ - Navigation index:
_TBD_
Critical Rules (from copilot-instructions β surfaced here because they cause the most damage when missed)
- Regenerate API types using the appropriate command. Editing generated types directly will be overwritten.
- Preserve all existing features unless the ticket explicitly says to remove them. A feature absent from the ticket means "keep it." When in doubt, ask.
- Feature inventory before editing. Before modifying a container or page, list all existing features (sections, hooks, conditional blocks, admin-only UI) and verify each is preserved in the final result.
- No new dependencies without explicit user approval.
Tool Preferences
MANDATORY β Code-graph first, no exceptions. Before ANY codebase navigation, exploration, tracing, or search β including every "what calls X?", "where is Y defined?", "what imports Z?", "find files namedβ¦", "find references toβ¦" β you MUST attempt code-graph tools BEFORE any other search, file-listing, or read tool. This rule is non-negotiable.
- MCP code-graph tools (
mcp__code-graph__get_minimal_context,query_graph,get_impact_radius,get_review_context). ALWAYS start here. sqlite3 .code-graph/graph.dbβ fall back ONLY when the MCP code-graph server is not registered (tools literally do not exist) OR every attempted MCP call returned an error. Use thesqlite3CLI directly, not Python scripts. Example:sqlite3 .code-graph/graph.db "SELECT COUNT(*) FROM nodes;".Glob/Grep/Readchains β fall back ONLY when Step 1 AND Step 2 are both impossible because the code-graph DB is absent from the workspace.
The only valid reason to bypass code-graph is that it is genuinely not present. "Slow", "unwieldy", "less convenient", "I already know the file", or "it's a simple lookup" are NOT valid reasons. Never skip Step 1 for Step 2, and never skip Step 2 for Step 3.
- MCP code-graph tools (
- Retro. Sessions are measured against these rules (see
.github/retro/README.md). When the session-start line saysrun /coograph-retro, mention it to the user once. Never run it unprompted.
Implementation Workflow (MANDATORY)
Before any non-trivial implementation, follow: Plan β Propose β Apply. Never skip straight to writing code. Full rules are in .github/copilot-instructions.md Β§ Workflow β read that section. Summary below.
When the workflow does NOT apply
- Review only β deliver the review and stop.
- Exploration / research β answer the question, not an implementation task.
- Exempt changes (narrow literal list from the OPENSPEC OR STOP HARD RULE above): typo fix in a single file, comment/docstring-only edit, user-dictated config-value bump, follow-up for an already-approved in-progress OpenSpec. "Trivial", "obvious", "small", "just one tweak" are NOT exemptions β when in doubt, propose.
Step 1: Plan
- Run
/coograph-planfor new tickets, unclear requirements, or non-obvious scope. - Skip planning when review output already exists in conversation, or the user specifies the problem, files, and fix direction.
- Bug reports: Run
/coograph-debug. If the fix is a one-line exempt change (per literal list above), apply it. Otherwise go to Step 2.
Step 2: Propose (OpenSpec)
Create an OpenSpec in openspec/changes/<date>-<slug>/ with .openspec.yaml, proposal.md, specs/<capability>/spec.md, and tasks.md.
proposal.md sections: Why, Goals/Non-Goals, Decisions, Impact, Risks.
tasks.md: group by logical unit (not per-file), final group is verification, each task independently verifiable.
See openspec/changes/archive/ for reference. Wait for user approval before implementing.
Step 3: Apply
- Work through
tasks.mdin order. Mark tasks done as you go. - Read every file before editing. Check API spec / generated types before assuming names.
- If you hit a non-obvious build error, run
/coograph-debug. - Mid-implementation requirement changes: update the OpenSpec, then continue.
- Continuing previous work: check
openspec/changes/for in-progress OpenSpec.
After all tasks are done:
- Quality gates β run typecheck, lint, format. Fix until clean.
- Feature inventory β for every modified file, verify all pre-existing features are preserved. For new files, verify against spec.
- Review gate β run
/coograph-review. Fix Critical/Warning findings. Re-run quality gates after fixes. Re-review only if fixes were substantial. For a big change (more than ~15 files, a commit stack going to people for approval, or anything with queue jobs, locks, state transitions, data migrations or cross-service contracts) say that/coograph-ultra-reviewexists β a multi-agent hostile review with adversarial verification, about a million tokens and twenty minutes β and offer to run it. Optional; never run it unasked. - Done: declare completion. Run
python3 .github/retro/retro.py --status; if it exits 0, ask one line:Run /coograph-retro now? (<n> sessions since last retro). If the file is missing, skip silently. Then ask the user for next steps.
Archiving
Move completed OpenSpecs from openspec/changes/<slug>/ to openspec/changes/archive/<slug>/.
Subagent Delegation
| Situation | Command |
| Code review or convention audit | /coograph-review |
| Deep review of a big change before approvals (multi-agent, adversarial; optional, costly) β full PR, fix batch (delta) or a plan before code | /coograph-ultra-review |
| Bug investigation, build errors | /coograph-debug |
| Planning / unclear requirements | /coograph-plan |
| Completion evidence, verification | /coograph-verify |
| Codebase search, research | /coograph-search |
| Guardrail retro, instruction and hook tuning from evidence | /coograph-retro |
Pass the full task description and relevant file paths when delegating.
Context Management
Preservation on compaction
When the conversation context is compacted, always preserve:
- The current task from
tasks.md(if working through an OpenSpec) - The full list of files modified in this session
- Any failing test or build output not yet resolved
- Acceptance criteria for the current task
- Any user decisions or scope changes made during this session
Memory pointer pattern
When intermediate results are large (investigation findings, audit reports, dependency maps), write them to a file in the OpenSpec change directory (e.g., openspec/changes/<name>/notes/<topic>.md) and reference the file path in conversation instead of keeping the full content in context. This prevents context overflow on complex tasks and preserves findings across conversation compaction.
Context hygiene
Long conversations accumulate stale state. To prevent acting on outdated information:
- After every 10+ turns of implementation: re-read all files you've modified from disk. Your memory of their contents may have drifted from reality.
- Never cite your own prior output as evidence. Only fresh
read_file/ tool output counts. If you said "line 42 has X" five turns ago, re-read line 42 before acting on it. - When conversation history contradicts a file on disk, trust the file. The file is the source of truth β conversation history may contain hallucinations that got referenced and compounded.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

