Build the prompt-skeleton templating/render pipeline #1

Closed
opened 2026-08-19 22:05:55 +00:00 by ben · 1 comment
Owner

Part of the agent-driven install-session arc (Ben, 2026-08-21/22; docs/superpowers/specs/2026-08-21-vendor-command-design.md §Context records the decomposition). Re-scoped 2026-08-22 now the factory dogfoods itself; depends on the policy-layer ticket. ready-for-session: edits the prompt skeletons.

Why

The five *prompt.md at the root are reference copies of Matou/idss's prompts — prompt.md:22,155 and heal-prompt.md:3,19,42 literally say Matou/idss; every consumer carries a hand-edited copy (vendor-exclude). With three consumers the enrichment now exists as three diffs: compare each root skeleton with .sandcastle/<same>.md in this repo, Matou/idss, and Matou/matou-app.

Ruling requested and taken

The render step lives in the factory (onboard.sh render-prompts), outputs land in the consumer's .sandcastle/ as files the consumer commits (so a consumer's prompt is always inspectable bytes, never computed at run time), and re-running it at a pin bump is how prompt fixes propagate. Veto anytime.

Deliverables

  • Placeholder convention in the skeletons: {{REPO_SLUG}}, {{FORGEJO_HOST}}, {{RUNNER_HOST}}, {{HANDOFF_RULES}} (filled by the hand-off ticket), plus named enrichment slots ({{ENRICH:read-first}}, {{ENRICH:rules}}, {{ENRICH:workflow-verify}}) a consumer fills from .sandcastle/prompt-enrichments/<slot>.md.
  • onboard.sh render-prompts <sandcastle-dir>: skeletons at the pinned ref + identity + policy + enrichment files → the five rendered prompts; refuses an unfilled placeholder; prints render-prompts: <file> unchanged|updated.
  • Cutover proof: a fixture test renders idss's current prompts byte-identical from skeleton + idss's enrichment files (extract them from the diff once, commit as the fixture). Same for this repo's own .sandcastle/prompt.md.
  • Skeletons lose every repo name; vendor-exclude keeps the five rendered copies excluded and the skeletons move into the manifest under a prompts/ dir.
  • check-harness-drift.sh gains an advisory line when a rendered prompt is stale against the skeleton at the pin.

Acceptance

  • grep -rn "Matou/" prompts/ is empty; idss's and this repo's rendered prompts are byte-identical to the committed ones; full suite green.
_Part of the agent-driven install-session arc (Ben, 2026-08-21/22; `docs/superpowers/specs/2026-08-21-vendor-command-design.md` §Context records the decomposition). Re-scoped 2026-08-22 now the factory dogfoods itself; **depends on** the policy-layer ticket. `ready-for-session`: edits the prompt skeletons._ ## Why The five `*prompt.md` at the root are reference copies of `Matou/idss`'s prompts — `prompt.md:22,155` and `heal-prompt.md:3,19,42` literally say `Matou/idss`; every consumer carries a hand-edited copy (`vendor-exclude`). With three consumers the enrichment now exists as three diffs: compare each root skeleton with `.sandcastle/<same>.md` in this repo, `Matou/idss`, and `Matou/matou-app`. ## Ruling requested and taken The render step lives in the **factory** (`onboard.sh render-prompts`), outputs land in the consumer's `.sandcastle/` as files the consumer commits (so a consumer's prompt is always inspectable bytes, never computed at run time), and re-running it at a pin bump is how prompt fixes propagate. Veto anytime. ## Deliverables - Placeholder convention in the skeletons: `{{REPO_SLUG}}`, `{{FORGEJO_HOST}}`, `{{RUNNER_HOST}}`, `{{HANDOFF_RULES}}` (filled by the hand-off ticket), plus named **enrichment slots** (`{{ENRICH:read-first}}`, `{{ENRICH:rules}}`, `{{ENRICH:workflow-verify}}`) a consumer fills from `.sandcastle/prompt-enrichments/<slot>.md`. - `onboard.sh render-prompts <sandcastle-dir>`: skeletons at the **pinned ref** + identity + policy + enrichment files → the five rendered prompts; refuses an unfilled placeholder; prints `render-prompts: <file> unchanged|updated`. - **Cutover proof:** a fixture test renders idss's current prompts byte-identical from skeleton + idss's enrichment files (extract them from the diff once, commit as the fixture). Same for this repo's own `.sandcastle/prompt.md`. - Skeletons lose every repo name; `vendor-exclude` keeps the five rendered copies excluded and the skeletons move into the manifest under a `prompts/` dir. - `check-harness-drift.sh` gains an advisory line when a rendered prompt is stale against the skeleton at the pin. ## Acceptance - `grep -rn "Matou/" prompts/` is empty; idss's and this repo's rendered prompts are byte-identical to the committed ones; full suite green.

Close report — advances #1

Ruled by agent under ADR 0174 — veto anytime. Landing the render pipeline as designed in this ticket's "Ruling requested and taken" is a two-way door: every change is a commit plus an offline test against fixture git repos (no network, no live consumer touched), and the render pipeline refuses rather than silently shipping a half-filled prompt.

Landed: commit 26b19e970e5fd61add1e3fb787f129629a0ecf8e on origin/main (pushed after rebase — no conflicts, origin/main hadn't moved).

What changed:

  • prompts/*.md — the five root *prompt.md reference copies became generic skeletons (no repo names/hosts): {{REPO_SLUG}}/{{FORGEJO_HOST}}/{{RUNNER_HOST}} inline placeholders, {{HANDOFF_RULES}} + named {{ENRICH:<slot>}} blocks (task-intro, read-first, rules, workflow-verify in prompt.md; ops-context, classify, repairs in heal-prompt.md).
  • onboard.sh render-prompts <sandcastle-dir> — renders the pinned-ref skeletons through the target's swarm-identity.sh + .sandcastle/prompt-enrichments/<slot>.md into the five .sandcastle/*.md files a consumer commits. Refuses (names the file) on a missing enrichment file or any leftover {{…}} after substitution. Prints render-prompts: <file> unchanged|updated.
  • New shared prompt-render-lib.sh (vendored) backs both the render command and a new check-harness-drift.sh advisory (NOTE — rendered prompt(s) stale…, never a failure).
  • Cutover proof (onboarding/tests/onboard-lib-test.sh): idss's original reference copies (frozen as fixtures before deletion) and this repo's own real, already-committed .sandcastle/*.md both re-render byte-identical from skeleton + each consumer's own enrichment files. grep -rn "Matou/" prompts/ is empty.
  • vendor-manifest/vendor-exclude updated: skeletons are now vendored (prompts/**), the five old root filenames dropped from the exclude list.
  • swarm-identity.sh (root + .sandcastle/) gains a required RUNNER_HOST (no cross-product default).
  • Root scripts that cat their sibling prompt file directly (session-runner.sh, heal.sh, rehearsal-report.sh ×2) gained an overridable *_PROMPT_FILE var (mirroring the existing SWARM_IDENTITY_FILE precedent) — needed because several offline tests invoke these root scripts directly and were silently building Claude prompts from a cat: No such file error while still reporting green via a canned test stub (bash's set -e does not fire on a command-substitution failure used inline as an argument). Fixed to point at the real rendered content; this is a testing-only fix — production always runs from .sandcastle/, which was never missing a prompt file.
  • Found and fixed a real bug while writing the drift-check advisory's test: a bare [ -n "$stale" ] && echo … as check-harness-drift.sh's last statement made a nothing-stale, otherwise fully green run exit 1. docs/GOTCHAS.md #13 records it; tests/check-harness-drift-test.sh T7 pins both the stale and fresh case.
  • STATUS.md, CLAUDE.md, onboarding/README.md updated in the same commit.

Deliberately deferred (named, not silently dropped):

  • {{HANDOFF_RULES}}'s content still comes from a static .sandcastle/prompt-enrichments/handoff-rules.md file, not policy_human_labels — the ticket's own text says that wiring belongs to dependent #14, which is still open. The placeholder + refuse-if-missing contract is in place so #14 only needs to change the fill source, not the render contract.
  • docs/agents/issue-tracker.md's ADR-0174 two-way-door pointer text in this repo's own rendered prompt is unavoidably byte-preserved as-is (.sandcastle/prompt-enrichments/rules.md still says "docs/adr/0174-*.md" — wrong for this repo, which has no such file) because the cutover proof forbids touching rendered prose in this ticket. Filed as a follow-up: #33 (below).

Tests: new tests/prompt-render-lib-test.sh (13 cases); onboarding/tests/onboard-lib-test.sh gains the render/cutover/error-path cases; tests/check-harness-drift-test.sh gains T7; tests/judgement-call-prompts-test.sh re-points at .sandcastle/prompt.md (the live rendered text) instead of the now-skeleton root copy. Full offline suite green:

for t in tests/*.sh onboarding/tests/*.sh; do case "$t" in *fakebin*|*fixtures*) continue;; esac; bash "$t" || echo "FAIL: $t"; done
# 0 failures

Root-only: a human re-vendor (onboarding/onboard.sh vendor .sandcastle <sha>) carries prompts//prompt-render-lib.sh into this repo's own running .sandcastle/ copy; idss and matou-app pick up the pipeline and render their own enrichment files at their next pin bump.

## Close report — advances #1 **Ruled by agent under ADR 0174 — veto anytime.** Landing the render pipeline as designed in this ticket's "Ruling requested and taken" is a two-way door: every change is a commit plus an offline test against fixture git repos (no network, no live consumer touched), and the render pipeline refuses rather than silently shipping a half-filled prompt. **Landed:** commit `26b19e970e5fd61add1e3fb787f129629a0ecf8e` on `origin/main` (pushed after rebase — no conflicts, origin/main hadn't moved). **What changed:** - `prompts/*.md` — the five root `*prompt.md` reference copies became generic skeletons (no repo names/hosts): `{{REPO_SLUG}}`/`{{FORGEJO_HOST}}`/`{{RUNNER_HOST}}` inline placeholders, `{{HANDOFF_RULES}}` + named `{{ENRICH:<slot>}}` blocks (`task-intro`, `read-first`, `rules`, `workflow-verify` in `prompt.md`; `ops-context`, `classify`, `repairs` in `heal-prompt.md`). - `onboard.sh render-prompts <sandcastle-dir>` — renders the pinned-ref skeletons through the target's `swarm-identity.sh` + `.sandcastle/prompt-enrichments/<slot>.md` into the five `.sandcastle/*.md` files a consumer commits. Refuses (names the file) on a missing enrichment file or any leftover `{{…}}` after substitution. Prints `render-prompts: <file> unchanged|updated`. - New shared `prompt-render-lib.sh` (vendored) backs both the render command and a new `check-harness-drift.sh` advisory (`NOTE — rendered prompt(s) stale…`, never a failure). - **Cutover proof** (`onboarding/tests/onboard-lib-test.sh`): idss's original reference copies (frozen as fixtures before deletion) and this repo's own real, already-committed `.sandcastle/*.md` both re-render **byte-identical** from skeleton + each consumer's own enrichment files. `grep -rn "Matou/" prompts/` is empty. - `vendor-manifest`/`vendor-exclude` updated: skeletons are now vendored (`prompts/**`), the five old root filenames dropped from the exclude list. - `swarm-identity.sh` (root + `.sandcastle/`) gains a required `RUNNER_HOST` (no cross-product default). - Root scripts that `cat` their sibling prompt file directly (`session-runner.sh`, `heal.sh`, `rehearsal-report.sh` ×2) gained an overridable `*_PROMPT_FILE` var (mirroring the existing `SWARM_IDENTITY_FILE` precedent) — needed because several offline tests invoke these root scripts directly and were silently building Claude prompts from a `cat: No such file` error while still reporting green via a canned test stub (bash's `set -e` does not fire on a command-substitution failure used inline as an argument). Fixed to point at the real rendered content; this is a testing-only fix — production always runs from `.sandcastle/`, which was never missing a prompt file. - **Found and fixed a real bug** while writing the drift-check advisory's test: a bare `[ -n "$stale" ] && echo …` as `check-harness-drift.sh`'s last statement made a nothing-stale, otherwise fully green run exit 1. `docs/GOTCHAS.md` #13 records it; `tests/check-harness-drift-test.sh` T7 pins both the stale and fresh case. - `STATUS.md`, `CLAUDE.md`, `onboarding/README.md` updated in the same commit. **Deliberately deferred (named, not silently dropped):** - `{{HANDOFF_RULES}}`'s content still comes from a static `.sandcastle/prompt-enrichments/handoff-rules.md` file, not `policy_human_labels` — the ticket's own text says that wiring belongs to dependent **#14**, which is still open. The placeholder + refuse-if-missing contract is in place so #14 only needs to change the fill *source*, not the render contract. - `docs/agents/issue-tracker.md`'s ADR-0174 two-way-door pointer text in this repo's own rendered prompt is unavoidably byte-preserved as-is (`.sandcastle/prompt-enrichments/rules.md` still says "docs/adr/0174-\*.md" — wrong for this repo, which has no such file) because the cutover proof forbids touching rendered prose in this ticket. Filed as a follow-up: **#33** (below). **Tests:** new `tests/prompt-render-lib-test.sh` (13 cases); `onboarding/tests/onboard-lib-test.sh` gains the render/cutover/error-path cases; `tests/check-harness-drift-test.sh` gains T7; `tests/judgement-call-prompts-test.sh` re-points at `.sandcastle/prompt.md` (the live rendered text) instead of the now-skeleton root copy. Full offline suite green: for t in tests/*.sh onboarding/tests/*.sh; do case "$t" in *fakebin*|*fixtures*) continue;; esac; bash "$t" || echo "FAIL: $t"; done # 0 failures **Root-only:** a human re-vendor (`onboarding/onboard.sh vendor .sandcastle <sha>`) carries `prompts/`/`prompt-render-lib.sh` into this repo's own running `.sandcastle/` copy; idss and matou-app pick up the pipeline and render their own enrichment files at their next pin bump.
Sign in to join this conversation.
No milestone
No project
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
Matou/dev-factory#1
No description provided.