Skip to content

feat(prompts): unify the CLI contract across every prompt surface - #40

Merged
Disdjj merged 2 commits into
mainfrom
prompts/unify-retrieval-contract
Aug 24, 2026
Merged

Disdjj merged 2 commits into
mainfrom
prompts/unify-retrieval-contract

Conversation

@Disdjj

@Disdjj Disdjj commented Aug 24, 2026

Copy link
Copy Markdown
Member

Summary

The retrieval-gate work (#38) and the external-tooling decision (#39) landed on the operating skill and hooks, but never reached the four workflow skills, the two agent contracts, or the generated Codex surface. This PR closes that gap and fixes three contradictions it exposed.

1. One invocation contract

Three forms coexisted:

Surface Before
hooks/hooks.json, skills/llmdoc npx -y @tokenroll/llmdoc
skills/{init,update,prune,upgrade}, agents/* bare npx @tokenroll/llmdoc
.agents/skills/*, .codex/agents/* npx --no-install (15 call sites)

The bare form prompts interactively when the package is missing, which hangs a subagent; --no-install fails outright, the opposite of the "external tooling, fetched into the npm cache, never a project dependency" contract. Everything is now npx -y @tokenroll/llmdoc <cmd>, declared once per surface so individual command references stay short.

2. The Retrieval Gate now reaches both agents

investigator opened with a fixed tree → index → context → search → show sequence and recorder with a seven-command list — both contradicting the gate's "choose one entry point by intent, these are alternatives, not a sequence" rule. Both now apply the gate, and investigator states explicitly where native tools take over for exact facts (source text, line numbers, tests, counts, git state).

3. recorder no longer conflicts with commit

recorder taught validate + fingerprint --update as its finalizer. The workflow skills and llmdoc/workflows/init-and-update.mdx already replaced that with the one-shot commit ("never hand-roll this sequence"). recorder now validates, leaves finalization to the calling workflow, and only fingerprints when the workflow explicitly asks for revisions without a commit.

Smaller fixes

  • operating skill: intent routing table moved ahead of the invocation constraints; description sharpened toward discovery-shaped tasks
  • prune / upgrade: state that the CLI reports and diagnoses rather than rewriting, matching llmdoc/workflows/prune-and-upgrade.mdx
  • upgrade: gained the init-state / commit --all finalizer the other three workflows already had
  • README recipes (en + zh): commit named as the finalizer alongside fingerprint / new / mv

Validation

  • npm test — 36 passed
  • npm run check:prompts — all five skills within budget (llmdoc 1171/1600, was 989)
  • node scripts/check-codex-surface.mjs — ok
  • npm run validate:dogfood — ok
  • skill/agent front matter parses across all 12 canonical and generated files
  • both .codex/agents/*.toml parse and contain no --no-install
  • canonical and generated skill bodies verified byte-identical

Follow-ups, deliberately not in this PR

  • Codex regeneration. .agents/ and .codex/ were synced by hand, replacement style, preserving the ACPlugin front-matter style. The npx-resolved acplugin is 1.1.0, below the 1.6.1 that llmdoc/plugin-packaging/claude-and-codex.mdx requires (older versions regress model: inherit and downgrade hooks), so a regeneration pass should confirm this output rather than being run blind now.
  • Dogfood knowledge. delta reports 5 impacted docs and mode: deep for this change. Running /llmdoc:update after merge is the intended path; leaving the decision to the maintainer follows this repo's own convention.

Disdjj added 2 commits August 24, 2026 09:48
Three invocation forms coexisted after the retrieval-gate work: hooks and the
operating skill used `npx -y`, the four workflow skills and both agents used a
bare `npx` (which prompts interactively when the package is missing, hanging a
subagent), and the generated Codex surface still carried 15 `npx --no-install`
calls that fail outright — the opposite of the external-tooling contract.
Everything now runs as `npx -y @tokenroll/llmdoc <cmd>`, declared once per
surface so command references stay short.

The Retrieval Gate reached only the operating skill. `investigator` and
`recorder` still opened with fixed command sequences, contradicting the gate's
"choose one entry point by intent, not a sequence" rule. Both now apply the
gate, and `investigator` states explicitly where native tools take over.

`recorder` also taught `validate` plus `fingerprint --update` as its finalizer,
which the workflow skills and llmdoc/workflows/init-and-update.mdx already
replaced with the one-shot `commit`. It now validates, leaves finalization to
the calling workflow, and only fingerprints when asked.

Also: put the intent routing table at the top of the operating skill ahead of
the invocation constraints, sharpen its description for discovery-shaped tasks,
note in prune/upgrade that the CLI reports rather than rewrites, and give
upgrade the init-state/commit finalizer the other workflows have.

Codex surfaces under .agents/ and .codex/ were synced by hand, replacement
style, and still need an acplugin regeneration pass; the npx-resolved acplugin
is 1.1.0, below the 1.6.1 the packaging doc requires.
Second review pass over the unified skills:

- upgrade: the finalize step ran `validate` before `init-state`, but validate
  requires the ledger to exist and mirror the tree — a migration that lost
  meta.json could never pass. Seed the ledger first, then validate, then
  `commit --all`.
- update: the report contract still asked for "the fingerprint result or why
  it was skipped" from before `commit` absorbed fingerprinting; it now asks
  for the commit result. Step 4 retitled Finalize accordingly.
- init/prune/upgrade report contracts name both `validate` and `commit`
  results, matching what their workflows actually run.
- operating skill: drop the markdown anchor link (useless in a prompt),
  straighten the gate sentence.

Version: 3.1.1 → 3.2.0 across package.json, cli/package.json, both
lockfiles, .claude-plugin/{plugin,marketplace}.json, .codex-plugin/plugin.json
(the full set the release workflow gates on), plus the README pin examples.
@Disdjj

Disdjj commented Aug 24, 2026

Copy link
Copy Markdown
Member Author

Second pass (faa61ca), after re-reviewing the unified skills:

  • Real ordering bug in upgrade: the finalize step ran validate before init-state, but validate requires meta.json to exist and mirror the tree — a migration that lost the ledger could never pass. Now: seed ledger → validate → commit --all.
  • update report contract still asked for "the fingerprint result or why it was skipped" from before commit absorbed fingerprinting; it now asks for the commit result. init/prune/upgrade report contracts aligned the same way.
  • Minor: dropped a markdown anchor link from the operating skill (useless in a prompt), straightened the gate sentence.
  • Version bump to 3.2.0 across the full set the release workflow gates on: package.json, cli/package.json, both lockfiles, .claude-plugin/plugin.json, .claude-plugin/marketplace.json (acplugin's version source), .codex-plugin/plugin.json, plus the README pin examples.

Codex surfaces re-synced; all checks re-run green (check:prompts — llmdoc 1161/1600, validate:dogfood ok, codex surface ok, TOMLs parse, bodies byte-identical).

@Disdjj
Disdjj merged commit 474a846 into main Aug 24, 2026
5 checks passed
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