[PIR #1011] Deliver framework files via resolver-aware channels (fresh-install class fix)#1015
Draft
amrmelsayed wants to merge 14 commits into
Draft
[PIR #1011] Deliver framework files via resolver-aware channels (fresh-install class fix)#1015amrmelsayed wants to merge 14 commits into
amrmelsayed wants to merge 14 commits into
Conversation
…ctor audit) - Layer 2: drop protocol.md pointer from all 9 builder-prompts; fix roles/builder.md cat example; strip A.3 workflow-reference line from spir/protocol.md (both trees) - Patch 2 (A.2): drop redundant plan-template pointers (spir/aspir); embed notes.md / findings.md into experiment/spike protocol.md under drift-guarded sentinels (both trees) - Layer 3: 'Framework files: never shell-fetch by literal path' convention in AGENTS.md + CLAUDE.md; lib/framework-ref-audit.ts + doctor() section (warn, skeleton-only) - Tests: new framework-ref-audit + skeleton-sweep guards; update Spec 746 baselines and bugfix-619 assertion for the swept builder-prompts
Per dev-approval feedback, replace the static embed/append (stale duplicate) with
fresh-at-delivery placeholders:
- spawn-roles.ts: resolveIncludes() ({{> path}}, recursive) + resolveProtocolReference();
buildPromptFromTemplate fills {{protocol_reference}} from protocol.md read fresh at spawn
- builder-prompts: restore 'Read and internalize...'; reference + {{protocol_reference}}
placeholder under {{#if}} (bugfix renders cleanly with neither)
- experiment/spike protocol.md: {{> ...templates...}} include instead of committed copy
- tests: placeholder + include resolution; drift test asserts include-present/no-embed;
re-sweep Spec 746 baselines to the new ## Protocol line
Per dev-approval feedback: the blanket 'never shell-fetch a framework file by literal path' overreached (role docs can be tier-2 overridden into the workspace) and was advisory-not-load-bearing (the doctor check is the mechanical guard). Scope it to builder-facing prompts/role-docs, acknowledge the override, drop the absolute framing.
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.
Fixes #1011.
Problem
Post-Spec-618, framework files (protocol docs, role docs, templates, resources) live only in the package skeleton and resolve via the four-tier resolver. But various builder-side consumers referenced them by literal
codev/...path (cat/cp, "read this file"), which bypasses the resolver and fails in fresh installs — builders waste turns hunting for files that aren't on disk. #1011 is the class fix.Approach — three layers
Layer 1 — Delivery (fresh-at-spawn, no committed copy).
buildPromptFromTemplatefills a{{protocol_reference}}placeholder by readingprotocol.mdfresh through the resolver at spawn, and resolves{{> path}}include directives inside it (for protocol templates). Nothing is committed into the prompts, so nothing can go stale.{{#if protocol_reference}}keeps protocols without aprotocol.md(e.g. bugfix in a fresh install) rendering cleanly.Layer 2 — Cleanup (sweep).
Removed the literal
protocol.mdpointer from all 9 builder-prompts, fixed thecat codev/protocols/...example inroles/builder.md, dropped the redundant plan-template pointers in spir/aspir plan prompts (those prompts already carry a self-contained### Plan Structure), and stripped theworkflow-reference.mdpointer fromspir/protocol.md.Layer 3 — Enforcement.
A scoped convention note in
CLAUDE.md/AGENTS.md(don't shell-cat/cpframework files in builder-facing prompts) plus a narrowcodev doctoraudit (lib/framework-ref-audit.ts) that flags only shell-fetch verbs readingcodev/(protocols|roles)/..., warn-not-error, skeleton-only.Open questions for reviewers
{{protocol_reference}}, so the existing{{#if}}can conditionally show a "see below" reference and omit it cleanly for protocol-less protocols); templates use a{{> path}}include directive (new, resolved byresolveIncludes, modeled on Handlebars partials). The{{#if}}/{{var}}is existing codev template syntax;{{> }}is new surface. Is the two-mechanism split worth it, or collapse to one (lose the conditional reference, or use a non-Handlebars marker like<!-- include: ... -->)?codev/...mentions, incl. the documented protocol list in templates). Is warn-not-error / skeleton-only the right default?Deferred (not in this PR)
bugfix/protocol.mdis absent from the skeleton (and the local copy is partly stale vs porch); andexperiment/protocol.mdcommits a partial copy of its notes template via a relative ref. Both are doc-hygiene, split out to keep this PR to the delivery plumbing.Scope / tests
packages/codev/src/agent-farm/commands/spawn-roles.ts+packages/codev/src/lib/framework-ref-audit.ts+packages/codev/src/commands/doctor.ts; the rest is skeleton/codev/markdown + tests.npm run build✓, full suite ✓ (3271 passed, 13 pre-existing skips). New unit tests cover the placeholder fill,{{> }}include resolution, the doctor audit (positive + negative), and the skeleton sweep; updated the Spec 746 baselines + a bug: ASPIR builder-prompt references SPIR, spawn --task skips porch init, fragile phases check #619 assertion that the sweep invalidated.{{> }}expands, zero handlebar residue.