agentleFS
ferdinandobonsferdinandobons/CodeDebrief/.cursor/rules/codedebrief.mdc

CodeDebrief / rules

Cursor rule42 starsChanged 5 months agoApache-2.0View on GitHub

Keep CodeDebrief synchronized

  • Where files are headingNew Cursor rule files have more rules about planning and tracking tasks, and fewer about code style.

    Of the Cursor rule files we read, the 4,157 first seen in the last six months, against the older ones: the kind of rule that gained most share, and the kind that lost most. About files like this in general, not this one, and an estimate, since a kind is a pattern in the words.

  • In this repository2 other files it gives its agents.

The file

Show its rules and text

We split this codedebrief.mdc into the rules it gives an agent

24 rules. About 0 are common, 5 are distinctive, and 19 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.

  • 19

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    Prefer the CodeDebrief MCP agent_context tool before broad file-by-file searches.

    line 13
  2. Very specific:

    Use agent_context for substantial changes, passing changed files, selected code, current file, flow id, symbol, or dependency path when …

    line 14
  3. Very specific:

    When the user asks to show a workflow, flusso, visual flow, canvas, or workflow_slice, prefer the canonical Mermaid visual: render …

    line 17
  4. Very specific:

    Keep CodeDebrief visuals vertical/top-to-bottom by default.

    line 28
  5. Distinctive:

    After the visual, include a short high-level written flow in the user's language, derived only from returned ordered steps, …

    line 33
  6. Very specific:

    If the CodeDebrief result is too large, saved externally, truncated, or missing the exact canonical visual, retry with a smaller …

    line 37
  7. Very specific:

    Do not synthesize a new Mermaid diagram and do not add limits, error codes, branches, or service steps that are absent from the …

    line 41
  8. Very specific:

    Use expand_slice, workflow_path, snapshot_slice, explain_flow, explain_node, or explain_edge only when the first slice needs more precise …

    line 54
  9. Very specific:

    Use codedebrief view ... only when a human wants the manual UI flowchart.

    line 56
  10. Very specific:

    When helping a user set up or learn CodeDebrief:

    line 58
  11. Very specific:

    Start with codedebrief --help, then use codedebrief <command> --help for the specific command you plan to run or recommend.

    line 60
  12. Very specific:

    Use codedebrief doctor when install, dependency, or parser capability issues are unclear.

    line 62
  13. Distinctive:

    Do not ask for LLM provider keys for the primary workflow.

    line 64
  14. Distinctive:

    After code or workflow-relevant changes:

    line 71
  15. Very specific:

    Treat CodeDebrief artifacts as part of done.

    line 73
  16. Very specific:

    Use codedebrief update --full after analyzer upgrades, parser/dependency changes, large refactors, or when cached file models should be …

    line 77
  17. Very specific:

    Run codedebrief validate --check-sync.

    line 79
  18. Distinctive:

    Commit synchronized changes to:

    line 81
  19. Very specific:

    Use CodeDebrief MCP agent_context to inspect affected entry points and callers when explaining or reviewing the change.

    line 85
  20. Very specific:

    Run npm run viewer:typecheck, npm run viewer:test, and npm run viewer:build.

    line 92
  21. Distinctive:

    Check the generated viewer with a cache-buster URL.

    line 95
  22. Very specific:

    Keep examples/Certifexp/ private and untracked.

    line 100
  23. Very specific:

    If examples/Certifexp/ exists locally, run UV_CACHE_DIR=/tmp/codedebrief-uv-cache uv run pytest tests/test_certifexp_local.py as an opt-in …

    line 101
  24. Very specific:

    Do not commit Certifexp source, generated artifacts, caches, nested repository data, or analysis output.

    line 104

≈ “Common” is an estimate: at least 1 in 5 of the 6,668 Cursor rule 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
codedebrief.mdc
---
description: Keep CodeDebrief synchronized
alwaysApply: true
---

<!-- codedebrief:instructions:start -->
## CodeDebrief

This project uses CodeDebrief to keep decision flows synchronized with the source code.

For codebase questions about behavior, decisions, workflow structure, or changed-code context:

1. Prefer the CodeDebrief MCP `agent_context` tool before broad file-by-file searches.
2. Use `agent_context` for substantial changes, passing changed files, selected code,
   current file, flow id, symbol, or dependency path when available; inspect
   its returned `workflow_slice` before answering.
3. When the user asks to show a workflow, flusso, visual flow, canvas, or
   `workflow_slice`, prefer the canonical Mermaid visual: render
   `workflow_slice.presentation.canonical_visual.diagram` exactly as returned only when
   the client renders Mermaid inline. If the client cannot render Mermaid inline, or if
   Mermaid would appear as a raw code block, call `snapshot_slice` with
   `include_svg=false` and provide `artifact.mermaid_path`,
   `artifact.mermaid_markdown_path`, or `artifact.mermaid_open_command` as the visual
   result before prose. Do not paste a long Mermaid code block as the primary visual
   unless the user explicitly asks for raw or copyable Mermaid. Do not render
   `snapshot.svg` inline by default; SVG artifacts are for explicit SVG requests or local
   inspection because their layout can differ from Mermaid.
   Keep CodeDebrief visuals vertical/top-to-bottom by default. Use a horizontal layout
   only when the user explicitly asks for a compact horizontal overview.
   Inspect the full returned `workflow_slice` before deciding what to show. Choose the
   first visible depth yourself: show the clearest useful subset, then say that the
   displayed diagram is a bounded summary and can be expanded.
   After the visual, include a short high-level written flow in the user's language,
   derived only from returned ordered steps, primary/supporting flows, decisions, domain
   logic, source ranges, and focused follow-up payloads. Keep it compact and explain the
   happy path first, adding only the branches needed by the request.
   If the CodeDebrief result is too large, saved externally, truncated, or missing the exact
   canonical visual, retry with a smaller `token_budget` and narrower `flow_id`, `symbol`,
   `current_file`, or `scope`; do not recover by listing flows and hand-building a
   diagram.
   Do not synthesize a new Mermaid diagram and do not add limits, error codes, branches,
   or service steps that are absent from the `workflow_slice` payload. Do not read source
   files to rebuild, relabel, or extend the diagram; source reads are only follow-up
   explanation after the deterministic visual is shown and must not change displayed
   nodes, edges, labels, or branches. If neither exact canonical Mermaid nor a returned
   Mermaid artifact can be used, say so and provide `viewer_targets` instead of creating a
   replacement Mermaid diagram. If the user asks for a more language-friendly version,
   rewrite the technical block labels and the high-level written flow in simple wording
   using the language of the user's request. This is allowed only as a separate
   presentation layer derived from returned node, edge, decision, step, and source fields.
   End visual answers with concise options in the user's language: simplify labels and
   written flow, expand omitted nodes/branches/adjacent flows, or explore a related area.
   Show raw JSON or YAML only when explicitly requested.
4. Use `expand_slice`, `workflow_path`, `snapshot_slice`, `explain_flow`, `explain_node`,
   or `explain_edge` only when the first slice needs more precise context.
5. Use `codedebrief view ...` only when a human wants the manual UI flowchart.

When helping a user set up or learn CodeDebrief:

1. Start with `codedebrief --help`, then use `codedebrief <command> --help` for the specific
   command you plan to run or recommend.
2. Use `codedebrief doctor` when install, dependency, or parser capability issues are
   unclear.
3. Do not ask for LLM provider keys for the primary workflow. Language-friendly labels and
   high-level written flows are presentation layers derived from deterministic workflow
   facts.
4. `codedebrief setup <target>` updates only that target's files. Run the command
   separately for each agent surface you want to configure, preserving any target-specific
   frontmatter and local notes.

After code or workflow-relevant changes:

1. Treat CodeDebrief artifacts as part of done. After every meaningful source, route,
   config, or agent-instruction change, run `codedebrief update` before finalizing or
   committing so MCP answers and `codedebrief view` use current graphs. Skip only changes
   that cannot affect the modeled code logic, such as unrelated copy edits or images.
2. Use `codedebrief update --full` after analyzer upgrades, parser/dependency changes,
   large refactors, or when cached file models should be ignored.
3. Run `codedebrief validate --check-sync`; this checks both current-source JSON sync and
   whether `codedebrief-out/codedebrief.md` was rendered from that JSON.
4. Commit synchronized changes to:
   - `codedebrief-out/codedebrief.json`
   - `codedebrief-out/codedebrief.md`
   - `codedebrief-out/codedebrief.hash.json`
5. Use CodeDebrief MCP `agent_context` to inspect affected entry points and callers when
   explaining or reviewing the change.
6. Ground the explanation in the returned `workflow_slice`; expand it through MCP only
   when the initial slice omits relevant callers, callees, domain states, or paths.

For viewer/UI changes:

1. Run `npm run viewer:typecheck`, `npm run viewer:test`, and `npm run viewer:build`.
2. Regenerate HTML artifacts with `codedebrief update` and
   `codedebrief view --render-only --no-open`.
3. Check the generated viewer with a cache-buster URL.

<!-- codedebrief:local-notes:start -->
For local real-world regression checks:

1. Keep `examples/Certifexp/` private and untracked.
2. If `examples/Certifexp/` exists locally, run
   `UV_CACHE_DIR=/tmp/codedebrief-uv-cache uv run pytest tests/test_certifexp_local.py`
   as an opt-in local check.
3. Do not commit Certifexp source, generated artifacts, caches, nested repository data, or
   analysis output.
<!-- codedebrief:local-notes:end -->

CodeDebrief is a comprehension and navigation tool for source-grounded workflows. Use it
to explain modeled logic, not to present possible defects.
<!-- codedebrief:instructions:end -->

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.