agentleFS
paoloirrerapaoloirrera/ccgraph/CLAUDE.md

ccgraph

CLAUDE.md1 starsChanged 3 months agoMIT-0View on GitHub

Guidance for Claude Code sessions working in this repository. ccgraph is a CLI that analyzes Claude Code session logs for a repository — a token/cost/time leaderboard across sessions, plus a session → tool → file dependency graph. Rust binary crate, edition 2024, licensed MIT-0. Green gate: every change must leave fmt / clippy / build / test green before it's considered done. Run all four. Prefix every source file with this header (adapt the comment syntax per language): Keep it…

The file

We split this CLAUDE.md into the rules it gives an agent

3 rules. About 0 are common, 1 is distinctive, and 2 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈1

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 2

    Very specific

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

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

    Green gate: every change must leave fmt / clippy / build / test green before it's considered done.

    line 21
  2. Very specific:

    Keep it to ~4 lines. The header is a // comment, so rustdoc never sees it — the real description belongs in the //!

    line 39
  3. Distinctive:

    Prefer one dense paragraph over a bulleted restatement of each field.

    line 61

≈ “Common” is an estimate: at least 1 in 5 of the 26,980 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.md

Guidance for Claude Code sessions working in this repository.

What ccgraph is

ccgraph is a CLI that analyzes Claude Code session logs for a repository — a token/cost/time leaderboard across sessions, plus a session → tool → file dependency graph. Rust binary crate, edition 2024, licensed MIT-0.

Build / test / lint commands

CommandPurpose
cargo buildCompile the crate.
cargo testRun unit + integration tests.
cargo fmt --checkVerify formatting (use cargo fmt to fix).
cargo clippy -- -D warningsLint; warnings are errors.
ccgraph --helpPrint the full flag set.

Green gate: every change must leave fmt / clippy / build / test green before it's considered done. Run all four.

Source file header

Prefix every source file with this header (adapt the comment syntax per language):

// SPDX-License-Identifier: MIT-0
//
//  -- File content -- //
//  one line: what this file is
//
//  -- Dependencies -- //
//  one or two lines: who uses it, what it uses

Keep it to ~4 lines. The header is a // comment, so rustdoc never sees it — the real description belongs in the //! module doc, and duplicating it in both places means two things to keep in sync.

References to anything a reader of the repo alone can't open — design doc §, .local/ paths, task ids — go in the header or a // comment, never in /// docs. ADR numbers are the exception: docs/adr/ is committed, so citing ADR 0004 from a /// doc resolves for everyone. Prefer that over restating a decision's rationale in the code.

Documentation style

Docs explain what the code can't. The signature already states types, ownership, and nullability — don't restate it in prose.

  • Write the non-obvious: invariants, sentinels (e.g. f64::INFINITY for zero-input), why an arm is explicit, failure modes a caller must handle.
  • Skip restatement: no /// The session's UUID. on session_id: String, and no inline comment narrating the line below it.
  • Use # Errors on functions returning Result, and # Panics where a panic is reachable or an unwrap needs justifying. These are the conventional rustdoc headings and clippy can enforce them; Rust has no @param/@return.
  • Prefer one dense paragraph over a bulleted restatement of each field.
  • src/cli.rs is special: clap prints its /// docs as --help, so write those for end users and document every value-enum variant.

Enabled crate-wide in main.rs: missing_docs, rustdoc::all, clippy::doc_markdown. Deliberately not enabled: clippy::missing_docs_in_private_items — it forces a doc on every field and manufactures restatement.

Module map

Architecture per design doc §4 — one responsibility per module:

ModuleResponsibility
cliclap derive CLI: flags, value-enums, arg parsing.
scannerDiscover project dirs & session JSONL paths.
parserJSONL deserialization + validation.
analyzerMetrics (tokens, cost, time, efficiency); per-session tool traces and inefficiency signals.
graphSession → tool → file dependency-graph construction (petgraph).
rendererTable / trace / signal-summary / graph JSON / interactive-HTML output.

Decisions with consequences outside the module that made them are recorded as ADRs in docs/adr/ — pricing (0001), the efficiency metric (0002), the chars/4 context estimate (0003), what makes a signal fire (0004), aggregated graph-node granularity (0005), SVG via the Graphviz dot binary (0006 — superseded; DOT/SVG were replaced by an HTML viewer + JSON), import-edge languages/parsing/resolution (0007), and reading the working tree as-is now for imports (0008). Cite them by number from code rather than restating the rationale inline.

Domain primer

ccgraph reads Claude Code session logs under ~/.claude/projects/<repo-path>/<uuid>.jsonl, where <repo-path> is the absolute repo path with every non-alphanumeric char replaced by - (not just / — . and _ are collapsed too; e.g. /Users/x/my-project → -Users-x-my-project, /Users/x/HR/CV_LdM → -Users-x-HR-CV-LdM). Each session is a UUID-named JSONL file directly inside that directory.

  • Records: one JSON object per line; the type field is the discriminant (assistant, user, mode, system, …). assistant entries are the main data source.
  • Usage: token counts live at message.usage (input/output/cache tokens).
  • Cost: there is no costUSD field — cost is computed from a pricing table keyed by model, not read from the log.
  • Synthetic entries: <synthetic> model entries are filtered out.

Full schema: .local/starter-design-doc.md §3. Note that starter doc is a seed, not the per-story authority — the per-story design lives under .local/user-stories/<story>/design-doc.md.

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.