本文へ移動
cccskills
無料GitHub で公開

code-graph

Use when a question is about *structure* rather than text - who calls or launches a symbol, where it is defined, what a change would reach, whether something is dead, how a request gets from the API to a kernel. Triggers on "who calls", "who launches this kernel", "where is X defined", "what breaks if I change", "is this still used", "is this dead", "trace the path from X to Y", "blast radius", "what depends on this header". Do NOT use for free-text search (`rg` is better and cheaper) or to open a file whose path you already know.

インストール方法を見る

含まれるファイル(1)

  • SKILL.md5.4 KB

SKILL.md(原文)

インストールする前に、エージェントに与えられる指示の中身を確認できます。

code-graph - ask the index, then verify

imp has a symbol and call graph in .codegraph/codegraph.db (CodeGraph v1.5.0, codegraph on PATH). It answers reverse and scope-resolving questions a text search cannot: which function calls a symbol, who reaches it transitively, what a header change touches.

Hard rules

#RuleEvidence
0codegraph sync before you trust it; it does NOT sync itself and codegraph status prints "up to date" on a stale DB2026-08-19: 16 days / 236 commits behind, empty answer for every symbol added in that window; sync cost 2.8 s (279 files). 2026-09-02: DB dated 2026-08-21, codegraph query gdn_scan_chunkpar = "No results"
1Control symbol before believing a negativerun the same query on a live symbol (codegraph callers write_kv_cache -> 2); if the control is empty too, the DB or the edge kind is missing (docs/audit/SETTLED.md, "control symbol")
2Reverse question -> graph; text question -> rg"who calls / what breaks" ~30 tokens via the graph vs 500-2500 via rg + reading; "which files mention X" is grep territory
3The name in the answer must be the name you askedtrap 1 below
4Kernel-launch and destructor questions are rg questions right nowthe DB has edge kinds calls contains extends imports instantiates references and NO launches edges (checked 2026-09-02); ccg enrich, which materialises them, aborts with sqlite3.IntegrityError: UNIQUE constraint failed: idx_edges_identity (docs/audit/DEBT_LEDGER_2026_08_21.md). Every __global__ kernel reads as uncalled

Commands

codegraph sync                    # first
codegraph query   <name>          # where is it
codegraph callers <symbol>        # who calls it
codegraph callees <symbol>        # what it calls
codegraph node    <symbol>        # source + immediate callers/callees (on a FILE arg: prints the file, NOT dependents)
codegraph impact  <symbol>        # what a change reaches
codegraph explore "<topic>"       # symbols + call paths in one shot

ccg = ~/github.com/kekzl/cplusplus-cuda-graph/ccg: ccg enrich (CUDA launch edges + implicit destructor calls + macro-generated symbols; BROKEN, rule 4), ccg coverage (one-level: a kernel with a dead launcher still counts as covered), ccg kernels, ccg revert.

Header dependents (SQL only)

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)
for (p,) in c.execute(\"select n.file_path from edges e join nodes n on n.id=e.source \"
    \"where e.target='file:src/runtime/config.h' and e.kind='imports'\"): print(p)"

Re-derive the count every time (config.h importers: 48 -> 23 -> 32 -> 28 across four measurements as src/core/dispatch_policy.h and src/core/config/*.h split the surface).

Three traps, all confirmed on this repo

  1. A symbol the graph lacks is answered as if it had it. gemv_q6k_q8_1 is token-pasted (IMP_DP4A_QUANT_TYPES(IMP_DEFINE_GEMV_DP4A), src/compute/gemm_dp4a.cu); the query returned dispatch_gemv_fp32 (caller of the DIFFERENT gemv_q6k_q8_1_fp32) with no nearest-match warning. Enrich materialised those 21 symbols once (gemv_q6k_q8_1 -> dispatch_dp4a_gemv, src/exec/executor_kernels.cu); any other macro level or generated header misleads the same way. Name mismatch = stop and rg.
  2. "No callers found" != dead. With enrich, 99% of 423 kernels (468 by 2026-08-27) had a launcher; 74% without; the rest are reached through function-pointer struct fields. Real reachability = BFS over calls/references/instantiates from roots in tools/, tests/, src/api/. Never re-flag: src/exec/gemm_kernel_*.cu (registry table binding), src/core/logging.cpp (IMP_LOG_*), src/memory/alloc_interpose.cpp (default-OFF flag), src/quant/turboquant_fp4.cuh (device inline), destructors. Confirm with rg -n '\bname\b' src/ tools/ tests/ include/ (the residue after that grep found the two dead kernels removed in #1220).
  3. codegraph node <file> prints the file, not its dependents. Use the SQL above.

Destructors

Implicit destructor calls exist only through ccg enrich (85% of ~65-71 destructors had a caller with it, 0% without). With enrich broken, codegraph callers "~PinnedBuffer" returns nothing; rg for holders instead. Destruction through a base pointer is never covered (~HostPinnedAllocator, ~HostRegistrar show no caller and are live).

What it cannot know

No preprocessor (macro-generated functions absent, template instantiations collapse to the primary), no runtime (which try_* dispatch candidate fires: src/compute/dispatch_paths.h lists candidates, src/compute/dispatch_record.h records what ran).

Pairs with codebase-audit (verify before acting) and sm120-cuda-expert (once you know the kernel).

レビュー

まだレビューはありません。使ってみた感想をお寄せください。

同じリポジトリのスキル

概要と使いどころ

Use when adding support for a new model architecture to imp, porting a model family, or debugging a model that loads but produces wrong output - "add support for <model>", "new arch", loader detection, chat template, tokenizer parity, RoPE variant, "outputs garbage", "prompt-blind", "digits scrambled", "NaN logits", "describes a different picture", "does it fit in VRAM". Do NOT use for kernel performance (sm120-cuda-expert) or quant-format questions (quant-formats).

日本語の概要は準備中です。原文の説明を表示しています。

kekzl/imp442026年10月11日 更新

Use when benchmarking, profiling, or A/B-testing CUDA kernels or end-to-end perf in the imp inference engine on RTX 5090 (sm_120), including refreshing tests/perf_baseline.json or publishing numbers to docs/BENCHMARKS.md and the README. Triggers on "benchmark kernel", "profile cuda", "ncu", "nsys", "kernel timing", "kernel sum", "occupancy", "bandwidth bound", "compute bound", "roofline", "perf baseline", "is this regression real", "decode dropped", "aggregate throughput", "two-image A/B", "prefill kernel A/B". Do NOT use for writing/optimizing kernel code (sm120-cuda-expert) or output-quality checks (check-degeneration).

日本語の概要は準備中です。原文の説明を表示しています。

kekzl/imp442026年10月11日 更新

Use when building imp, running its test suite, checking CI status, or debugging build/test failures - "make build", "run the tests", "test-gpu", "verify-fast", GTEST_FILTER, Docker/CUDA toolchain, dependency bumps, "CI is red/blocked", "which gate failed", stale objects / segfault after a header edit, hook edits, docker-entrypoint env vars, determinism or perplexity checks. Do NOT use for benchmarking/profiling (benchmark-cuda) or output-quality batteries (check-degeneration).

日本語の概要は準備中です。原文の説明を表示しています。

kekzl/imp442026年10月11日 更新

Use when verifying that a model in the imp inference engine produces coherent output without repetition loops, token-stuck states, or state corruption across turns or streams. Triggers on "degenerates", "check degeneration", "repetition loop", "own own own", "stuck token", "empty content", "multi-turn regression", "does it still work", "NIAH", and after enabling CUDA graphs / changing forward pass / MoE routing / KV cache or KV dtype / GDN state or scan / sparse attention / PDL / speculation (MTP, n-gram) / ragged prefill / batched-decode kernels (smallm, producer quantize) / FA2 softmax.

日本語の概要は準備中です。原文の説明を表示しています。

kekzl/imp442026年10月11日 更新

Use when auditing the imp codebase for structural debt, dead code, god-objects/files, duplication, flag sprawl, or deciding whether a cleanup is worth shipping - "structure audit", "tech debt", "is this still used", "dead code", "refactor for clarity", "should we split this file", "remove this flag", "file size gate red", "alloc sites gate red". Do NOT use for build/test mechanics (building-and-testing), perf/kernel work (benchmark-cuda / sm120-cuda-expert), or output quality (check-degeneration).

日本語の概要は準備中です。原文の説明を表示しています。

kekzl/imp442026年10月11日 更新

Use when writing, moving or auditing any .md in imp - deciding which file a paragraph belongs in, adding a doc, fixing a stale claim, or when docs_lint.py fails in CI. Covers the four reader layers (L0 README / L1 operators / L2 kernel devs / L3 agents), the HTML-comment metadata header, [PROV:] provenance, the single-source-of-truth map, generated perf blocks, which numbers may appear in prose, plan-doc closure. Triggers on "which doc does this go in", "docs lint failed", "add a doc", "this claim is stale", "update the README", "PROV block", "layer", "STALE.md". Do NOT use for the CHANGELOG or a release body (shipping-prs), or for code-comment accuracy (codebase-audit).

日本語の概要は準備中です。原文の説明を表示しています。

kekzl/imp442026年10月11日 更新

kekzl のスキルをすべて見る

このスキルの問題を報告する