fix(bootstrap): ship+deploy dangling P1/P2/P6/P7 hooks; scaffold METALAYER+schemas; two-flow doc (BRO-1431)#75
Merged
Conversation
…TALAYER+schemas; two-flow doc (BRO-1431)
Safety bug, surfaced while building rcs-template as a gap-discovery probe.
settings.json.snippet wired the P1/P2/P6/P7 hooks at ${BROOMVA_WORKSPACE}/scripts/*.sh
but bstack shipped none of those scripts and bootstrap never copied them — so every
workspace bootstrapped anywhere but the bstack origin had a NON-FUNCTIONAL control
gate (P2): Claude Code invoked a script that did not exist and the safety shield
silently no-op'd. doctor §7 detected it; nothing closed it.
Fix:
- Ship 4 self-contained, $CLAUDE_PROJECT_DIR-portable hook scripts in scripts/:
control-gate-hook.sh (P2), skill-freshness-hook.sh (P7), conversation-bridge-hook.sh
(P1), knowledge-catalog-refresh-hook.sh (P6).
- Deploy them into $WORKSPACE/scripts/ — bootstrap Phase 3.1 + repair deploy_workspace_hooks.
Idempotent (never overwrites an existing workspace hook); set -e-safe (elif cp && chmod).
- Scaffold METALAYER.md + schemas/{state,action,trace,evaluator,egri-event}.schema.json
in bootstrap Phase 2 (templates added under assets/templates/{,schemas/}).
- SKILL.md: document the two-flow bootstrap (structured deterministic scaffold ->
generative agent-authored tailoring -> doctor verify), mirroring the P18 Category-B/C split.
Validation: dogfood on a fresh workspace (no bstack on PATH) — deployed control-gate
blocks `git push --force` (exit 2), allows `git status` (exit 0); deploys 4 hooks;
scaffolds METALAYER + 5 schemas. bstack tests green: template_lockstep 15/15 (count 20),
gitignore-aware-bootstrap 7/7, schema-validation 8/8, repair-merge-hooks 5/5, onboard 8/8.
P20: two independent adversarial reviews, no blockers. Primitive count unchanged (20).
Co-Authored-By: Claude Opus 4.8 (1M context) <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.
BRO-1431 — close bstack bootstrap gaps
Safety bug, surfaced while building
rcs-templateas a gap-discovery probe for bstack's own bootstrap.The bug
assets/templates/settings.json.snippetwired the P1 (conversation-bridge), P2 (control-gate), P6 (knowledge-catalog-refresh), P7 (skill-freshness) hooks at${BROOMVA_WORKSPACE}/scripts/*.sh— but bstack shipped none of those scripts and bootstrap never copied them. Every workspace bootstrapped anywhere but the bstack origin had a non-functional control gate (P2): Claude Code invoked a script that didn't exist, so the safety shield silently no-op'd.doctor §7detected the gap; nothing closed it.The fix
$CLAUDE_PROJECT_DIR-portable hooks inscripts/:control-gate-hook.sh(P2),skill-freshness-hook.sh(P7),conversation-bridge-hook.sh(P1),knowledge-catalog-refresh-hook.sh(P6).$WORKSPACE/scripts/—bootstrapPhase 3.1 +repairdeploy_workspace_hooks. Idempotent (never overwrites an existing workspace hook; preserves the origin's hand-authored copy);set -e-safe (elif cp … 2>/dev/null && chmod … 2>/dev/null; then … else warn).METALAYER.md+schemas/{state,action,trace,evaluator,egri-event}.schema.jsonin Phase 2 (templates added underassets/templates/{,schemas/}).SKILL.md: structured (deterministic scaffold — the floor) → generative (agent-authored tailoring — bespoke) → verify (doctorgates both). Mirrors the P18 Category-B/C split.Test plan / validation
bstack bootstrapon a fresh/tmpworkspace with no bstack on PATH → deployed control-gate blocksgit push --force(exit 2), allowsgit status(exit 0); deploys 4 hooks; scaffolds METALAYER + 5 schemas; settings.json valid + references resolve.template_lockstep15/15 (canonical count 20 unchanged),gitignore-aware-bootstrap7/7,schema-validation8/8,repair-merge-hooks5/5,onboard8/8.bash -n+shellcheck -S warningclean on all 4 new scripts + edits.P20 cross-review
Two independent adversarial reviews (Cato/Strata-B). Both verified path-consistency (
${BROOMVA_WORKSPACE}snippet substitution ==$WORKSPACE_DIR/scripts/deploy target — identical) and found no blocker. The one emergent concern (PreToolUse matcher) verified resolved: control-gate is wired for Bash + Write + Edit. Minor conservative over-block notes (e.g. a path containingcredentials) accepted by-design for a safety gate. Verdict: PASS.Primitive count unchanged (20).
VERSION0.26.0 → 0.27.0.🤖 Generated with Claude Code