AGENTS.md instructions for /Users/thomi/Projects/entire-graph
This repository is Entire Graph (entire-graph), an Entire CLI plugin that
provides entity-level checkpoint context and a local-only semantic provider.
The binary is invoked through Entire as entire graph <command>.
The plugin manifest (entire-plugin.yml) registers the subcommand name
graph, so users type entire graph ....
The project was previously named entire-sem; do not reintroduce the old
name. References to Entire Brain (entire-brain) are intentional — that
is the separate downstream consumer that owns persistence, indexing, and
query, not an old name for this project.
Build, Test, Lint
Tasks are defined in mise.toml:
sh
mise run build # go build -o entire-graph ./cmd/entire-graph
mise run test # go test ./...
mise run test:ci # go test -race ./...
mise run fmt # gofmt -s -w .
mise run vet # go vet ./...
mise run check # fmt + vet + race tests + build
CI (.github/workflows/test.yml) runs vet, gofmt checks, build, and tests on
Linux, macOS, and Windows with Go 1.24. Building requires CGO because
tree-sitter grammars are native.
Using the plugin from an agent session
entire graph search --repo . --query "..." — ranked source regions with
bounded snippets (16 KiB serialized context budget by default). Reads the
working tree by default so dirty edits are visible; --head switches to
committed-tree semantics.
entire graph commit HEAD --json / entire graph diff --base A --head B --json —
entity-level semantic diff for judging whether a change is safe to keep.
entire graph checkpoint <id> --json — resolves the commit carrying an
Entire-Checkpoint: <id> trailer and diffs it against its first parent.
entire graph snapshot|symbols|edges --repo . --format ndjson — streamed
machine-readable graph records (schema 1.x, frozen GA contract; see
docs/adr/0001-ga-schema-contract.md).
entire graph capabilities --json / entire graph doctor --json — feature
detection and environment verification. All commands are local-only:
no network egress, no hosted model calls, no telemetry.
This repository also configures agent harnesses directly: .claude/settings.json
and .codex/ wire Entire session hooks into Claude Code and Codex, and both
define an entire-search subagent for checkpoint history search via
entire search --json.
Repository layout
cmd/entire-graph/ — thin main; all logic lives in internal/.
internal/cli/ — hand-rolled command dispatch and flag parsing (no CLI
framework by design). Keep new commands consistent with this style.
internal/sem/ — tree-sitter parsing, provider snapshots, semantic diff,
and hybrid search. This is the only package that should know about grammars.
internal/bench/, cmd/graph-bench/, bench/ — pinned-corpus benchmark
harness with throughput and RSS guardrails.
docs/ — provider requirements, v2 roadmap, language support matrix,
benchmarks, and the GA schema ADR.
Contract rules that agents must not break
Schema 1.x is a frozen GA contract: minor versions are additive-only;
breaking wire-format changes require a major bump (docs/adr/0001-ga-schema-contract.md).
The provider is no-egress: never add code that fetches remote sources,
calls hosted APIs, uploads telemetry, or downloads grammars at runtime.
compound-v1 symbol IDs must remain stable across ordinary body and
signature edits.
Unsupported or unparseable files must surface as machine-readable partial
failures, never silent drops.
Inventory-only languages must not be presented as semantically parsed
(docs/language-support.md).
I’ll load the trail through Entire, reconstruct its commits and intent, then inspect the resulting diff for correctness, regressions, and contract violations. I’ll report only actionable findings, with precise file/line references.
Assistant
The local checkout is already on the trail’s branch (fix/corpus-parse-errors), but the trail metadata endpoint reports that the CLI is not authenticated. I’ll continue from the checked-out branch and its upstream diff while checking whether the local Entire session has another usable trail-access path.
Assistant
The checkpoint context is available locally even though the hosted trail view requires login. It confirms this is a corpus-driven parser-mask patch: SQL, TS/TSX, and Bash syntax are rewritten position-preservingly to compensate for grammar gaps. I’m now testing the masks against adversarial inputs, especially comments/strings, token boundaries, and cases where byte-preserving rewrites can silently alter extracted symbols.
Assistant
The adversarial probes have reproduced two concrete regressions and one coverage hole: a valid TSX runtime import is turned into a syntax error, SQL text containing a comma-list DROP can corrupt surrounding DDL, and valid multi-name DROP TYPE/DROP MATERIALIZED VIEW statements remain unhandled. I’m cleaning up the probes and running the repository’s normal verification so the review distinguishes branch failures from unrelated test failures.
Assistant
Found three actionable issues in trail 8 (bd230b4, checkpoint fa3c8337b5a4):
typeof import(resolveSpecifier()) is valid runtime TypeScript, but the regex stops at the inner ) and masks it into:
ts
return any )
This produces E_PARSE_ERROR. It becomes a regression because this patch newly applies the common mask to .tsx. Restrict the rewrite to actual import-type syntax, preferably with syntax-aware matching or at least a quoted module specifier.
[P2] The DROP-list mask matches inside SQL strings.parser.go
Given valid SQL such as:
sql
CREATE TABLE templates (
body text DEFAULT 'DROP TABLE a, b'
);
CREATE TABLE survivor (id int);
the pattern begins inside the string and consumes through the statement semicolon, removing the closing quote and parenthesis. The result reports E_PARSE_ERROR and loses both table entities. Statement masks need a search view with quoted strings blanked, or a lexical statement-start check.
[P2] Multi-name DROP support excludes valid common forms.parser.go
DROP TYPE IF EXISTS mood, status; and DROP MATERIALIZED VIEW IF EXISTS a, b; still produce parse errors. Other omitted list-capable kinds include foreign tables, collations, and statistics. The new mask currently covers only seven object kinds despite describing general multi-name DROP handling.
The committed suite still passes: mise run test:ci and mise run vet both succeeded. I reproduced the findings with temporary regression probes and removed them; the worktree is clean.
::code-comment{title="[P2] Runtime import corrupted by type mask" body="This regex also matches valid runtime expressions such as typeof import(resolveSpecifier()). Because it stops at the first closing parenthesis, the mask leaves a stray and introduces an E_PARSE_ERROR in TSX files. Restrict matching to genuine import-type syntax, ideally using a syntax-aware scanner or at least a quoted module specifier." file="/Users/thomi/Projects/entire-graph/internal/sem/parser.go" start=458 priority=2}
I’ll implement the fixes at the masking layer and add regression tests for each reproduced case: nested runtime typeof import(...), SQL strings containing DDL text, and additional PostgreSQL multi-name DROP variants. Then I’ll run the race suite, vet, and build.
Assistant
The code and regression tests are in place. A direct go test hit a local toolchain mismatch (go1.26.1 driver against go1.24.13 standard-library artifacts), so I’m switching verification to the repository’s mise-pinned Go 1.24 environment rather than treating that infrastructure error as a code failure.
Assistant
All seven targeted regressions now pass, including the original corpus cases. The fixes are deliberately narrow: quoted module-specifier matching for TypeScript type queries, a position-preserving SQL literal search view, and the complete set of simple PostgreSQL comma-list DROP object kinds. I’m reviewing the diff for offset stability before the full suite.
Assistant
The full semantic package passes, including its existing regression corpus. I’m at the final verification stage now: repository-wide race tests, vet, and a build under the pinned Go toolchain.
Assistant
Race testing is still running in the large internal/sem package; all completed packages are green so far. The only output is the repository’s existing tree-sitter/Apple linker warnings, not test failures.
Assistant
Fixed all three findings.
TS/TSX type-import masking now ignores runtime typeof import(resolve()) expressions and preserves multiline offsets.
SQL statement masks now ignore ordinary, escaped, and dollar-quoted literal contents.
Multi-name DROP handling now covers types, materialized views, foreign tables, collations, and statistics.
Regression coverage was added in TypeScript tests and PostgreSQL tests.
Verification passed:
mise run test:ci
mise run vet
mise run build
git diff --check
Three files are modified and uncommitted.
User
Did you push them?
Assistant
No. The fixes are only in the local working tree—uncommitted and unpushed.
User
Well then, you know what to do
Assistant
I’ll use the GitHub publishing workflow to review the exact diff, commit the three fixes intentionally, and push the current branch. I’ll avoid creating a duplicate PR if this branch already has one.
Assistant
Scope is clean: only the three parser/test files from this fix are modified. The branch already has draft PR #50, so I’ll add a focused follow-up commit and push it to that existing PR rather than opening another one.
Assistant
Pushed.
Commit: 27da664 — fix(sem): harden parser masks against false matches
::code-comment{title="[P2] DROP text in strings corrupts DDL" body="The pattern runs against a view that removes comments and dollar-quoted bodies but retains ordinary string literals. A string containing DROP TABLE a, b can therefore start a match that consumes the enclosing statement terminator, removing its closing quote/parenthesis and causing E_PARSE_ERROR plus missing later entities." file="/Users/thomi/Projects/entire-graph/internal/sem/parser.go" start=5080 priority=2}
::code-comment{title="[P2] Multi-name DROP coverage is incomplete" body="Valid list-capable forms such as DROP TYPE IF EXISTS mood, status and DROP MATERIALIZED VIEW IF EXISTS a, b remain unmasked and still produce parse errors. Extend the object-kind handling beyond the currently enumerated subset." file="/Users/thomi/Projects/entire-graph/internal/sem/parser.go" start=5078 end=5080 priority=2}