agentleFS
paullukicpaullukic/coograph/CLAUDE.md

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…

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
  1. Distinctive:

    Before doing any work, execute this checklist:

    line 15
  2. Very specific:

    Read .github/copilot-instructions.md at the start of every implementation task.

    line 24
  3. Very specific:

    Read .github/instructions/brutal-honesty.instructions.md at session start and apply throughout.

    line 30
  4. Distinctive:

    Feature inventory before editing: Before modifying a container or page, list all existing features (sections, hooks, conditional blocks, …

    line 59
  5. Very specific:

    Before any non-trivial implementation, follow: Plan β†’ Propose β†’ Apply.

    line 75
  6. Distinctive:

    Skip planning: when review output already exists in conversation, or the user specifies the problem, files, and fix direction.

    line 86
  7. Very specific:

    Bug reports: Run /coograph-debug. If the fix is a one-line exempt change (per literal list above), apply it.

    line 87
  8. Very specific:

    Create an OpenSpec in openspec/changes/<date>-<slug>/ with .openspec.yaml, proposal.md, specs/<capability>/spec.md, and tasks.md.

    line 91
  9. Distinctive:

    Read every file before editing.

    line 102
  10. Very specific:

    If you hit a non-obvious build error, run /coograph-debug.

    line 103
  11. Distinctive:

    When the conversation context is compacted, always preserve:

    line 135
  12. Very specific:

    Never cite your own prior output as evidence: Only fresh read_file / tool output counts.

    line 148

β‰ˆ β€œ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.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
CLAUDE.md

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 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 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:

  1. Code-graph availability β€” call get_minimal_context with 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.
  2. Read conventions β€” read .github/copilot-instructions.md (if not already loaded by the system).
  3. Check in-progress work β€” look for open OpenSpecs in openspec/changes/ (skip archive/). If one exists, summarize its status before starting new work.
  4. 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

TaskCommand
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.

    1. MCP code-graph tools (mcp__code-graph__get_minimal_context, query_graph, get_impact_radius, get_review_context). ALWAYS start here.
    2. 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 the sqlite3 CLI directly, not Python scripts. Example: sqlite3 .code-graph/graph.db "SELECT COUNT(*) FROM nodes;".
    3. Glob / Grep / Read chains β€” 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.

  • Retro. Sessions are measured against these rules (see .github/retro/README.md). When the session-start line says run /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-plan for 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.md in 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:

  1. Quality gates β€” run typecheck, lint, format. Fix until clean.
  2. Feature inventory β€” for every modified file, verify all pre-existing features are preserved. For new files, verify against spec.
  3. 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-review exists β€” 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.
  4. 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

SituationCommand
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.

Download now (ZIP)

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
What did you use it for? e.g. Reviewing pull requests in a Rails app

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.