Repository navigation
feat: the discovery walk as a Claude Code plugin (M23) - #53
Merged
Merged
Conversation
The node and dep views had three copies in the docs and none in the code. They get one definition (store/helper-views.ts), created as TEMP views in the connection that asks for them. store/query.ts runs ONE read-only statement over a store: the handle is read-only, and the text must be a single statement that begins with a keyword that reads, because a read-only handle still executes VACUUM INTO. Parameters are bound by name and checked both ways before the statement runs: SQLite binds NULL to a parameter nobody gave, which returns no row and reads as "there are none". Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01PKCVh2essA8PpHntfjvJtH
SQL over a model's store with the SQLite already in the binary, so an ad-hoc question needs no sqlite3 on the machine: codegraph query app.jsonl "SELECT kind, count(*) FROM node GROUP BY 1" codegraph query app.jsonl --file reach.sql --param id=... --json codegraph query --views Rows on stdout as a table, --json (codegraph.queryResult/1) or --csv, cut at --limit (50) with the total on stderr. Every refusal is a usage error (exit 2), SQLite's included; a file that is not a model is exit 3. --param-file NAME=FILE binds a file's whole text, as text: one statement reads the rows another saved with --json (json_each(:NAME, '$.rows')), so a list of ids is never retyped on a command line. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01PKCVh2essA8PpHntfjvJtH
history --report hotspots --model FILE gives each changed file its lines, its cyclomatic complexity, the size of its dependency cycle and its rank in four families: classic (revisions x lines), branchy (x cyclomatic, the default order), tangled (in a cycle), fragile (x fix density). --rank chooses the order. A score of 0 is not ranked: no measured operation is "not measured", never "simple". Each row says who holds the file without a name: the main author's share, that author's row in --report authors, the day last seen. history --report summary --model FILE adds the share of commits that cross a top-level directory of the model. A --model with an invalid line loaded as an empty model, and hidden then answered "none" with exit 0. It is now exit 3 for every report that reads a model. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01PKCVh2essA8PpHntfjvJtH
docs/cli.md and the website's CLI reference gain query and the joined history reports. The discovery pages run their SQL as written, which they did not: a view rendered a wrong id for an anonymous TypeScript function, three queries named Java's kinds and found nothing elsewhere, a sum counted a nested type twice, and printed tables were not their query's rows. Step 3 loses its sqlite3-to-spreadsheet recipe for two commands. Step 4 is rewritten around an inventory of entry points from a table of names, the chain behind each on facts and with candidates, and what nothing reaches. A test holds the three docs copies of the helper views equal to the analyzer's definition. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01PKCVh2essA8PpHntfjvJtH
A Claude Code plugin, plugin/, versioned with the CLI it drives: text and SQL, nothing executable. - discover: the guide (preflight, intake, resume, --tour, routing) - discover-1-structure … discover-4-stimuli: one skill per question - query: a question in words as one saved SELECT - references/: the rhythm of a step, how a finding is written, the state file and its schema, the report, what each language gives, the stack tables of step 4 - queries/: the statements the pages show, one per file What a step learns goes to .codegraph/ in the analyzed repository, hidden through .git/info/exclude; a session resumes from it alone. The tests hold what no compiler does: every command line a skill writes parses with the CLI's own specs, every query runs on the five fixtures and equals an in-memory count, pages and query files hold the same SQL, the state's findings are each page's "Write down" list. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01PKCVh2essA8PpHntfjvJtH
Section 24: the design, the decisions and their rejected alternatives, the validation, the milestone split M23a-M23e, and what was built in M23a, M23b and M23c with what measurement changed. Sections 22 and 23 are M21's and M22's, on their own branches; the milestones and decisions sections take the numbers they will have once those land. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01PKCVh2essA8PpHntfjvJtH
tableCells is what --table prints for each cell, one number of decimals per column; a test pins a page's printed rows to it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01PKCVh2Y278aB9F8ys12uiP
- discover-5-meaning: the consent block, a scope proposed from steps 3 and 4, the explain run in the background and its readings - discover-6-domain: domain-facts, the three readings, the hand-over to Specy's extraction skills - queries purity, chain-position, invariant-evidence - references/consent.md; a complete example state file - the state schema takes findings for steps 5 and 6, each with an origin: explain or session Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01PKCVh2Y278aB9F8ys12uiP
The pages run the commands step 5 and 6 run, with their rows; domain.md loses its planned-change sentence. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01PKCVh2Y278aB9F8ys12uiP
What the live gate measured: the metrics pass changes every explain fingerprint, a scope of types has no module record, --safe-mode drops --plugin-dir skills. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01PKCVh2Y278aB9F8ys12uiP
M22 reached main while the plugin was written. capabilities.md gains Python's column (regenerated; it takes --trace), the preflight looks for codegraph-python, and stacks.md lists Python's frameworks as not covered: no Django, Flask or FastAPI table was checked on a corpus. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01PKCVh2Y278aB9F8ys12uiP
- .claude-plugin/marketplace.json at the root: one plugin, ./plugin; /plugin marketplace add defsquare/codegraph, then /plugin install codegraph@codegraph - plugin.json at 0.4.0, the root's version; a test holds the marketplace entry to it, as claude plugin tag will - the plugin README's install lines; the release step in docs/distribution.md: validate, then claude plugin tag --push Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01PKCVh2Y278aB9F8ys12uiP
Four claude plugin eval cases, one per property of PLAN §24.8 a session-free test cannot hold: the guide chosen to understand a codebase and not for a bug fix, step 5 asking for a yes when told not to, step 2 saying Ruby has no wiring report. No Bash is granted: a case holds what a skill decides and says, and runs without the OS sandbox. The manifest test admits case.yaml, prompt.md, scaffold.sh and graders under evals/ and nothing else; a run's results/ is ignored. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01PKCVh2Y278aB9F8ys12uiP
- how-to/discover-with-claude-code: install, start, resume, what it writes and what it costs - each discover page names its step's skill - query-model-db leads with codegraph query; the views stay verbatim for other clients - README, CLAUDE.md and docs/cli.md name the plugin and its boundary Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01PKCVh2Y278aB9F8ys12uiP
As built: the rebase onto v0.4.0, the marketplace, Python, the evals without Bash, the release step. The smoke run's scores in §24.8: 3 of 4, triggers-on-understand failing on its reply grader. Milestones M23a-e marked. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01PKCVh2Y278aB9F8ys12uiP
Two exit-code tests spawn every case in one loop. Synchronously, each held its worker's event loop for 9 to 14 s once query's eleven cases joined them, and vitest's worker RPC timed out behind it: every test green, the run red. runCliAsync spawns without blocking; the loops await it. Four full runs out of four showed the error before, two of two none after; main showed none in two. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01PKCVh2Y278aB9F8ys12uiP
Deploying with
|
| Status | Name | Latest Commit | Preview URL | Updated (UTC) |
|---|---|---|---|---|
| ✅ Deployment successful! View logs |
codegraph | 78335ca | Commit Preview URL Branch Preview URL |
Nov 26 2026, 10:57 PM |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
M23 (PLAN.md §24): the discovery walk as a Claude Code plugin, plus the CLI it needs. Given a repository, an agent walks a person through six questions in a fixed order: structure, boundaries, activity, stimuli and flows, meaning, domain. It runs each step's commands, shows a few rows at a time, keeps facts and inferences apart, and writes what it found to a hidden
.codegraph/workspace (listed in.git/info/exclude) so a walk stops and resumes.What it adds
CLI
codegraph query <model> "SELECT …"runs one read-only statement over the store. Thenodeanddephelper views are created on every run, and their single definition lives in@codegraph/analyzer. Parameters are bound (--param,--param-file). Output is a table,--csv, or--json(codegraph.queryResult/1). Read-only is enforced twice, by the handle and by a one-statement rule, soVACUUM INTOand a second statement are refused with exit 2.history --report hotspots --model FILE [--rank classic|branchy|tangled|fragile]andhistory --report summary --model FILEjoin the git history with a model.plugin/— text and SQL, nothing executable, imported by nothingdiscover(the guide: preflight, intake, resume,--tour), one skill per step (discover-1-structure…discover-6-domain), andquery.references/: rhythm, evidence, the state schema, the report,capabilities.md(generated from the profiles), and the stack tables for Spring, ASP.NET, NestJS, Phoenix and Rails.queries/*.sql: the statements the discover pages show, held equal to the pages by a test.explainfor free and runs it only after an explicit yes for a stated scope, provider and ceiling. Step 6 hands over to Specy (its side is on specy-ai/skillsmain, 39e87b6).evals/: fourclaude plugin evalcases.Distribution
.claude-plugin/marketplace.jsonat the root. Installing takes two commands:/plugin marketplace add defsquare/codegraph, then/plugin install codegraph@codegraph.plugin.jsonand the marketplace entry carry the root version, and a test enforces it.docs/distribution.md: validate, thenclaude plugin tag plugin --push(codegraph--vX.Y.Z, which doesn't match thev*release trigger).Docs: a how-to (
discover-with-claude-code), a line on each discover page naming its skill,query-model-dbleading withcodegraph query, the discover pages rewritten around the commands and their rows, README, CLAUDE.md,docs/cli.md,docs/sql-cookbook.md, and PLAN §24 with an "As built" block per milestone.Before merging
main. After this merges, the installable plugin needs acodegraphfrom the release after v0.4.0, becausequeryand the joined hotspots aren't in v0.4.0. On an older binary the guide's preflight (codegraph query --views) says so and stops.triggers-on-understandis 0: the guide fires, but the reply grader fails, twice. Three runs per arm and a tour with the installed plugin are owed before the release.Verification
pnpm -r testgreen: CLI 1 891 tests, 533 of them in the plugin suites. The analyzer'sscale.test.tstimes out under a parallel run and passes alone, as M21 recorded.pnpm -r buildgreen, the website included (it needs the Hextra submodule initialized).sea-smoke.mjs.claude plugin validate . --strictpasses.test(cli): await the long e2e loopsfixes a vitest worker-RPC timeout this branch introduced. Every test passed but the run exited 1: two exit-code tests spawned each case synchronously, blocking their worker for 9–14 s. The error appeared in 4 of 4 runs before the fix and 0 of 2 after;mainwas clean in 2 of 2.🤖 Generated with Claude Code
https://claude.ai/code/session_01PKCVh2Y278aB9F8ys12uiP