P2C: derive disciplines/wiki-format docs from vendored prompt (wj-cuz)#6
Merged
Conversation
Add scripts/build-disciplines.mjs, a dev/CI-only Node generator (the one dependency-free-bash exception, never run by users) that derives references/disciplines.md and references/wiki-format.md from the vendored OpenWiki system prompt (vendor/openwiki/src/agent/prompt.ts) via a documented tool-vocabulary translation: DeepAgents virtual filesystem to Claude Code Read/Grep/Glob/Write/Edit/Bash, the task tool to Task + wiki-scout, /openwiki/... to openwiki/.... OpenWiki's out-of-scope CLI-flag section is dropped, and the Root-instruction section is adapted to delegate to inject-pointer.sh. Reverse-engineered output-format literals (## Source map, the Git evidence: 7-char-hash bullet, no-frontmatter and quickstart-heading rules) are carried as a labelled generator constant since they come from OpenWiki's rendered output rather than its prompt. tests/build-disciplines.test.ts drift-locks the committed docs to a fresh regenerate (so an upstream prompt change fails CI until re-derived), and separately guards residual untranslated vocabulary, the parity SHA pin, and the state-schema field set against the vendored UpdateMetadata type. This replaces the former manual "prompt review" parity check with an executable one. Error-path tests for the generator's own guards (residual-vocab trip, SHA-pin mismatch) are deferred to a follow-up. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
…cuz) Update PARITY.md's discipline row to point at the new drift-locked generator instead of manual "prompt review", and extend the re-validation procedure with the regenerate step. Note the change in CHANGELOG.md and add an architecture pointer in CLAUDE.md so future edits target the generator, never the generated reference files directly. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
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.
Summary
scripts/build-disciplines.mjs, a dev/CI-only Node generator (no deps)that derives
references/disciplines.mdandreferences/wiki-format.mdfrom the vendored OpenWiki system prompt
(
vendor/openwiki/src/agent/prompt.ts) via a documented tool-vocabularytranslation: DeepAgents virtual filesystem → Claude Code
Read/Grep/Glob/Write/Edit/Bash, thetasktool →Task+wiki-scout,/openwiki/…→openwiki/…. OpenWiki's out-of-scope CLI-flagsection is dropped, and the Root-instruction section is adapted to delegate
to
inject-pointer.sh. Reverse-engineered output-format literals (## Source map, theGit evidence:7-char-hash bullet, no-frontmatter andquickstart-heading rules) are carried as a labelled generator constant,
since they come from OpenWiki's rendered output rather than its prompt.
tests/build-disciplines.test.tsdrift-locks the committed docs: itregenerates and diffs against what's checked in, so an upstream prompt
change fails CI until re-derived. It also guards residual untranslated
vocabulary, the parity SHA pin, and the state-schema field set against the
vendored
UpdateMetadatatype. This replaces the former manual "promptreview" parity check with an executable one.
PARITY.md,CHANGELOG.md, andCLAUDE.mdare updated to document thedrift-lock mechanism and point future edits at the generator, never at the
generated reference files directly.
Quality
tests green, shellcheck clean — two non-blocking Q5/Q8 test-quality
warnings tracked as a separate follow-up, not blocking) and an independent
Fable-5 review for correctness and intent.
SHA-pin mismatch) are deferred to a follow-up — not covered in this PR.
Merge policy
Per this repo's Agent Config,
pr_merge_strategyis squash + deletebranch. Not merging here — leaving that to CI/review per project policy.
Test plan
npm test— 90/90 passingnpm run lint— shellcheck clean🤖 Generated with Claude Code