agentleFS
kekzlkekzl/cplusplus-cuda-graph/skill/SKILL.md

code-graph

Skill0 starsChanged 4 months agoMITView on GitHub

Use when you need to know where a symbol lives, who calls or launches it, what a change would break, or how a request reaches a CUDA kernel — in a C/C++/CUDA repo that has a CodeGraph index. Triggers on "who calls", "who launches this kernel", "where is X defined", "what breaks if I change", "is this dead code", "what does this file depend on", "trace the call path", "blast radius". Do NOT use to read a file you already have the path for, or to search free text (use grep for that).

4 other projects use a version of this.

Adopted by

Most recently taken up by

  • Other versions4 projects use a version of this.

    Word for word · 0

    None found.

    Edited · 0

    None found.

    Wrote their own version · 4

    1. alinaqi/maggy★ 707same name
    2. kekzl/imp★ 44same name
    3. aniruddha-adhikary/skills★ 7same name
    4. yugasun/aiops★ 4same name

    How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.

The file

We split this skill into the rules it gives an agent

2 rules. 0 are common, 0 are distinctive, and 2 are very specific to this project.

  • 0

    Common

    Most of the 4 edited versions we read keep these.

  • 0

    Distinctive

    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:

    Add --json for machine-readable output.

    line 26
  2. Very specific:

    Before declaring anything dead, rg -n '\bname\b' across src/ tools/ tests/.

    line 49

“Common” is measured: kept by at least 6 in 10 of the 4 edited versions of this file we could read. “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
SKILL.md

Querying the code graph

The repo has a pre-built symbol and call graph in .codegraph/. Query it before reaching for grep-and-read: one query costs a few hundred tokens, the grep-then-read-two-files path costs thousands, and the graph already knows the answer.

The failure mode is not asking. If you catch yourself about to grep -rn "foo(" across the repo, or opening a 2,000-line file to find one function, query the graph first.

Commands

codegraph query   <name>     # where is it — fuzzy search across symbols
codegraph node    <symbol>   # its source + immediate callers and callees
codegraph callers <symbol>   # who calls / launches it
codegraph callees <symbol>   # what it calls
codegraph impact  <symbol>   # what a change to it would reach
codegraph explore <question> # relevant symbols + call paths for a topic, one shot

Add --json for machine-readable output.

When to use which

questioncommand
"where is foo defined?"codegraph query foo
"who launches attention_kernel?"codegraph callers attention_kernel
"what does the decode path touch?"codegraph explore "decode path"
"is this flag/function dead?"codegraph callers X — then grep to confirm (see below)
"what breaks if I change this?"codegraph impact X
"what depends on this header?"see Include graph below

Three traps — read these before trusting an answer

1. A query for a symbol the graph lacks answers about a different one. There is no "no exact match" warning: asked for gemv_q6k_q8_1 — generated by token pasting — it silently reported the callers of gemv_q6k_q8_1_fp32. ccg enrich materialises X-macro symbols, which removes that particular class, but not the behaviour. Always check that the name in the answer is the name you asked about; if it isn't, grep instead.

2. "No callers found" is not proof of dead code. Kernels launched through a wrapper, a macro, or a dispatch table can be missing their edge. Before declaring anything dead, rg -n '\bname\b' across src/ tools/ tests/. ccg enrich recovers most of them, but a kernel held in a function-pointer struct field still shows none.

3. codegraph node <file> prints the file's source, not its dependents. For "what depends on this header", the include edges are exact but only reachable by SQL:

docker run --rm -v "$PWD/.codegraph:/db:ro" python:3.12-slim python -c "
import sqlite3; c = sqlite3.connect('file:/db/codegraph.db?immutable=1', uri=True)
fid = 'file:src/runtime/config.h'
for (p,) in c.execute(\"select n.file_path from edges e join nodes n on n.id=e.source \"
                      \"where e.target=? and e.kind='imports'\", (fid,)): print(p)"

Destructors

ccg enrich recovers implicit destructor calls — scope exit, members, bases, owning containers — so codegraph callers "~Foo" works. Without it every destructor has zero callers and looks dead. Destruction through a base pointer is still invisible, so a virtual destructor with no callers is not evidence of anything.

Keeping it fresh

The graph syncs on file change. After a rebuild (codegraph index), re-run ccg enrich to restore the CUDA launch edges — an index drops them.

What the graph is not

It has no preprocessor. Functions produced by macro token pasting do not exist in it, template instantiations are collapsed to the primary template, and which branch of a dispatch chain actually fires at runtime is not something a static graph can tell you. For those, read the code.

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.