Skip to content

install: slim the generated agent guidance to a policy core, move reference to gortex://guide#253

Merged
zzet merged 5 commits into
mainfrom
feat/install-guidance-diet
Jul 5, 2026
Merged

install: slim the generated agent guidance to a policy core, move reference to gortex://guide#253
zzet merged 5 commits into
mainfrom
feat/install-guidance-diet

Conversation

@zzet

@zzet zzet commented Jul 5, 2026

Copy link
Copy Markdown
Owner

What

`gortex install` writes agent guidance (CLAUDE.md sections, skill/sub-agent frontmatters) that had accreted a paragraph per feature and re-stated facts the MCP schema and server instructions already carry. Every agent session pre-paid ~6.8k tokens for it. This PR gives every fact exactly one home:

  • New `gortex://guide` MCP resource + `gortex guide [topic]` CLI verb — the on-demand home for reference content: the provider/`ask` delegation matrix, capabilities tour, token-economy deep-dive, MCP resources list, session-start checklist. Relocated verbatim, never deleted; the analyze/search_ast catalogs stay in `kind:"help"` / `detector:"help"` / `gortex://schema` and the guide points at them.
  • The generated CLAUDE.md section shrinks to the policy core: the mandatory graph-tools mapping table + hooks note, the memory-workflow triggers (their only home), and pointer lines to the guide and `tools_search`. The global and project sections no longer duplicate each other — policy is global; the project block carries only project-specific facts.
  • Skill/sub-agent frontmatters trimmed to one line each (bodies unchanged).
  • Idempotent migration: re-running `gortex install` replaces the old fat section in place, preserving surrounding user content (fixture-tested).
  • Ceiling gates: the generated section (≤6,656 B) and skills eager total (≤2,560 B) are asserted in tests, so the guidance cannot silently regrow — same pattern as the tools/list byte gates.

Numbers (bytes; ~tokens at 4.4 B/tok)

surface before after
global CLAUDE.md section 18,791 B (~4.3k tok) 4,308 B (~1.0k tok)
skills eager frontmatter (21) 9,234 B 2,147 B
sub-agent frontmatter (2) 1,751 B 1,203 B
project CLAUDE.md block 44,773 B 3,254 B
installed eager total ~29.8 KB (~6.8k tok) ~7.7 KB (~1.7k tok)

Verification

Single-home spot-check tests (provider matrix only in the guide; catalogs only in help/schema; wire-format deep-dive only in server instructions); fat→slim migration fixture with user content preserved; render goldens regenerated; skill-drift check, golangci-lint, and `go test -race` green on all changed packages.

Note for reviewers: `TestSchemaParityAudit` (internal/graph) false-fails when run from a checkout under a `/worktrees/` path — its path filter skips the whole tree. It passes on a normal checkout; this branch touches no internal/graph files.

zzet added 5 commits July 5, 2026 17:27
…on-demand reference home

Introduce a single on-demand home for reference detail that the installed
CLAUDE.md section used to pre-pay every session: the LLM-provider matrix, the
non-obvious capabilities catalog, the token-economy content knobs, the MCP
resources list, and section pointers into the analyze / search_ast catalogs
(rendered from the same source that backs kind:"help" / detector:"help").

- gortex://guide MCP resource + gortex://guide/{topic} section template
- `gortex guide [topic]` CLI verb for non-resource clients
- the wire-format deep-dive stays in the server instructions; the guide points
  at it rather than repeating it (single-home invariant, tested)
… core

Rewrite the generated global rule block (gortex install -> ~/.claude/CLAUDE.md)
and the per-project block down to the load-bearing policy: the mandatory
graph-tools mapping (Grep->search_symbols, Read->get_symbol_source/read_file,
callers->get_callers, edit verbs) with the deny-hook note, the behavior-critical
memory-workflow triggers (distill_session / surface_memories / save_note /
store_memory), and pointers to gortex://guide and tools_search.

The relocated reference content — the LLM-provider matrix, the analyze /
search_ast catalogs, and the wire-format deep-dive — now lives in exactly one
home each (gortex://guide, kind:"help"/gortex://schema, and the server
instructions respectively) and is asserted absent from both rule blocks.

Global block 18,791 -> 4,308 bytes; project block 43,783 -> 2,264 bytes. The
memory triggers live fully in the global policy; the project block keeps a
compact pointer so nothing is written to both homes.
…e line

Cut every installed skill and sub-agent description to a single trigger line;
the lazy bodies are unchanged. The eager skill frontmatter total drops from
9,234 to 2,147 bytes; sub-agent frontmatter from 1,751 to 1,203 (the tool
allowlist stays). Regenerate the hermes render golden, which embeds the
descriptions in its toolset manifest.
… migration

Add the permanent measurement gate — the global CLAUDE.md rule block must stay
under 6.5 KiB and the eager skill frontmatter total under 2.5 KiB, actuals
printed — plus a migration gate that re-installs over a fat pre-diet marker
block and asserts the slim block replaces it in place with surrounding user
prose preserved and no duplicate block. The single-home spot-checks (provider
matrix only in the guide, analyze catalog only in help/guide, wire-format
deep-dive only in the server instructions) ride on the rule-block and guide
tests added with the earlier commits.
Add `gortex guide [topic]` to the CLI reference and the gortex://guide +
gortex://guide/{topic} entries to the MCP resources table (16 -> 18).
@zzet zzet merged commit ebb9124 into main Jul 5, 2026
11 checks passed
@zzet zzet deleted the feat/install-guidance-diet branch July 6, 2026 17:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant