Skip to content

feat: align P7/P8/P9 numbering to workspace canonical#16

Merged
broomva merged 3 commits into
mainfrom
feat/p7-p8-p9-numbering-align
May 14, 2026
Merged

feat: align P7/P8/P9 numbering to workspace canonical#16
broomva merged 3 commits into
mainfrom
feat/p7-p8-p9-numbering-align

Conversation

@broomva
Copy link
Copy Markdown
Owner

@broomva broomva commented May 14, 2026

Summary

Resolves the pre-existing P7/P8/P9 numbering inconsistency between bstack canonical and workspace canonical that's been showing as a 1-gap doctor report across multiple sessions.

After this change (matches broomva/workspace AGENTS.md):

P7 P8 P9
New canonical CI Watcher + Productive Wait Skill Freshness Check Branch + Worktree Janitor
Skill repo broomva/p9 (historical name) (hook-enforced, no skill repo) (mechanism, make janitor)
Reasoning-enforced? ✅ has reflexive trigger ❌ hook ❌ make target

Why Option B (align bstack → workspace) over Option A

  • Workspace numbering is the actively-edited canonical: 7 primitives added under it in 3 sessions (P14, P15, P16, P17, P18, P19, P20)
  • Reverting workspace would touch many files; aligning bstack is contained to this single repo
  • The workspace naming-note already documents "broomva/p9 skill is historical name from when it was the 9th primitive" — bstack's "skill name = primitive number, they match" claim was the false one

Files changed

  • `SKILL.md`: frontmatter description + primitives-table P7/P8/P9 rows swapped
  • `references/primitives.md`: ToC + §P7/§P8/§P9 sections re-titled and content swapped; reflexive trigger rule moves from §P9 to §P7; env-var names and protected-path names updated with legacy-fallback aliases
  • `scripts/doctor.sh`: P_NAMES titles swapped; REFLEXIVE_PRIMS changes P9 → P7; SCRIPT_PATHS reordered to match labels; header comment updated
  • `scripts/doctor.sh` format-tolerant section matching: doctor now accepts both `### P1: Title` AND `### P1 — Label: Title` formats (workspace AGENTS.md uses the labeled form). Same fix landed in broomva/workspace's `scripts/bstack-primitive-lint.py`.

Verification

  • `bash scripts/doctor.sh` against `broomva/workspace` → 73/73 passes (was 1-gap for multiple sessions)
  • G-L3-1 (structural completeness) ✓
  • G-L3-2 (rule-of-three audit) ✓
  • CI: CodeRabbit

Followups

  • The workspace `bstack-primitive-lint.py` fix is currently uncommitted on workspace local; will commit as a small workspace follow-up PR.
  • Any orphaned legacy state-dir references in installed-on-disk skills (e.g. `/.config/broomva/p7/`, `/.config/broomva/p9-janitor/`) keep working: the primitives.md notes specify legacy-name fallbacks in both directions.

🤖 Generated with Claude Code

broomva and others added 3 commits May 14, 2026 07:32
…1–P19

Templates were stuck at "thirteen primitives" (P1–P13) while bstack
SKILL.md, scripts/doctor.sh, and references/primitives.md had moved to
nineteen (P1–P19). This scaffolded every new workspace into permanent
disagreement with the catalog — `bstack bootstrap` produced governance
files that `bstack doctor` then reported as having six missing primitive
sections.

Changes:

1. **CLAUDE.md.template** (+58/-22): rewritten to nineteen primitives
   with the full table (P1–P19), short-name convention + index, Plugin
   Skill Precedence section (bstack > superpowers hierarchy), updated
   governance/hooks/conventions sections, Self-Documenting Standards
   block.

2. **AGENTS.md.template** (+220/-14): bumped intro to nineteen, every
   ### P# heading renamed to "### P# — Name: …" form, short-name
   convention + index added, full bodies for P14 (Dep-Chain), P15
   (Snapshot), P16 (Crystallize), P17 (Lens), P18 (Audience), P19
   (Orchestrate) — each with What/How/Invariant/Reflexive Trigger Rule.
   Composition-loop diagram rewritten in short-name form with P14–P19
   threaded at pre-flight + boundary crossings. Plugin Skill Precedence
   section after composition loop documents the bstack > plugin hierarchy
   and the "what this kills / what this keeps" partition.

3. **SKILL.md** (+1/-1): tiny drift fix — body said "16 primitives"
   while frontmatter said "nineteen". Now consistent.

4. **tests/template_lockstep.test.sh** (new, 188 lines): asserts
   primitive-count and structural consistency across the four
   governance surfaces that must agree:

   - SKILL.md frontmatter description (canonical count word + P19
     reference + P1–P19 trigger span)
   - scripts/doctor.sh EXPECTED_COUNT (the validator)
   - assets/templates/CLAUDE.md.template (intro count, table rows,
     short-name index entry count, Plugin Skill Precedence presence)
   - assets/templates/AGENTS.md.template (intro count, composition-loop
     intro, ### Pn section count, Plugin Skill Precedence presence)
   - Short-name index payload identity between the two templates

   13 assertions, all green at canonical count = 19. Designed to be the
   guardrail that makes this kind of drift CI-visible — when the next
   primitive is added (P20 in flight), this test catches any template
   that didn't get updated.

Numbering uses **bstack canonical ordering**: P7=Freshness, P8=Janitor,
P9=Wait. This matches the prior template state and bstack catalog
(SKILL.md, doctor.sh, references/primitives.md). The ~/broomva workspace
itself uses P7=Wait, P8=Freshness, P9=Janitor because of historical
script + config-dir naming (BROOMVA_P8_HOME, ~/.config/broomva/p9-
janitor/); that's a workspace-specific deviation documented in
workspace#54 and is NOT a template concern — new bstack installs get
clean canonical numbering.

Companion to broomva/workspace#54 (precedence + short names + P19 in
workspace governance). Independent of bstack#14 (P20 sync) — that PR
adds P20 to the catalog; once it merges, a follow-up updates these
templates + lockstep test to canonical=20.

Follow-ups (separate PRs):

- bootstrap.sh + revamp.sh ORDERED_SKILLS divergence from SKILL.md
  ROSTER (bootstrap installs persist + wealth-management + investment-
  management; ROSTER instead has autonomous + role-x).
- P20 propagation to templates after bstack#14 merges.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Companion to #14 (Cross-Model Adversarial Review Gate). bstack catalog
moved to twenty primitives via #14 (SKILL.md / doctor.sh / references/
primitives.md updated) but #14 did not touch templates. That's exactly
the drift this PR was created to close, and exactly what the new
template_lockstep.test.sh caught immediately after rebase:

  --- before this commit ---
  CLAUDE.md.template intro says 'twenty irreducible primitives (P1–P20)'
    → FAIL (says nineteen / P19)
  AGENTS.md.template intro says 'twenty irreducible building blocks'
    → FAIL
  AGENTS.md.template composition-loop intro says 'twenty primitives'
    → FAIL
  AGENTS.md.template ### Pn section count
    → FAIL (19, expected 20)
  CLAUDE.md.template primitive table row count
    → FAIL (19, expected 20)
  CLAUDE.md.template short-name index entry count
    → FAIL (19, expected 20)
  AGENTS.md.template + CLAUDE.md.template references P20
    → FAIL

  --- after this commit ---
  All 13 lockstep checks passed at canonical count = 20 (twenty)

Changes:

- **assets/templates/CLAUDE.md.template**: count phrase
  "nineteen → twenty", "P1–P19 → P1–P20", short-name index appends
  "Cross-Review (P20)", primitive table gets P20 row (mechanism: 3
  strata A/B/C, anti-slop ≥7/10, ≤3 fix rounds, broomva/cross-review
  skill; invariant: substantive PRs require ≥7/10 verdict before
  Pipeline P4 auto-merge).
- **assets/templates/AGENTS.md.template**: count phrase nineteen→twenty
  in intro + composition-loop, short-name index appends Cross-Review
  (P20), new `### P20 — Cross-Review` section with full What/How
  (3-strata table) / Invariant / Reflexive Trigger Rule (5 triggers).
  Composition-loop diagram threads Cross-Review (P20) between
  Empirical (P11) deploy verification and Pipeline (P4) auto-merge —
  the exact insertion point per P20 spec ("gate fires before P4
  auto-merge").

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Resolves the pre-existing numbering inconsistency where bstack canonical
disagreed with broomva/workspace AGENTS.md on P7/P8/P9. After this
change:

  P7 = CI Watcher + Productive Wait  (broomva/p9 skill — historical name)
  P8 = Skill Freshness Check          (SessionStart hook)
  P9 = Branch + Worktree Janitor      (make janitor)

This matches the workspace's renumbering documented in its naming-note
(P7's skill repo is broomva/p9 — named when it was the 9th primitive;
renaming the SKILL repo would break every npx skills add install).

Why workspace canonical wins:
- Workspace numbering is the actively-edited canonical (7 primitives
  added under it in the last 3 sessions: P14, P15, P16, P17, P18, P19,
  P20)
- Reverting workspace would touch many files; aligning bstack to
  workspace is contained to this single repo
- The doctor (which reads workspace AGENTS.md/CLAUDE.md) now passes
  73/73 against workspace — eliminates the 1 pre-existing gap reported
  for several sessions

Changes:

SKILL.md:
- Frontmatter description: P7/P8/P9 sentences reordered to workspace
  canonical (Productive Wait → Skill Freshness → Janitor)
- Primitives table: rows swapped (P7 = Productive Wait skill p9 historical,
  P8 = Skill Freshness, P9 = Janitor)

references/primitives.md:
- Table of contents: P7/P8/P9 entries swapped to workspace order
- §P7 — now CI Watcher + Productive Wait (was Skill Freshness); skill-
  name note rewritten to "broomva/p9 historical name" instead of "names
  match"
- §P8 — now Skill Freshness Check (was Janitor); env vars updated to
  BROOMVA_P8_THRESHOLD_DAYS with legacy P7 fallback
- §P9 — now Branch + Worktree Janitor (was Productive Wait); protected
  path now ~/.config/broomva/p9-janitor/ with legacy p8 fallback
- Reflexive Trigger Rule subsection: now P7 (Productive Wait), was P9

scripts/doctor.sh:
- Header comment: reflexive list updated (P6, P7, P10..) instead of
  (P6, P9, P10..); script-mapping comments updated (P7 = p9.py,
  P8 = skill-freshness-hook, P9 = branch-janitor)
- P_NAMES array: P7/P8/P9 titles swapped to workspace canonical
- REFLEXIVE_PRIMS: P9 → P7 (Productive Wait is the reasoning-enforced
  one; Janitor (now P9) is mechanism-only)
- SCRIPT_PATHS: reordered so labels (P1, P2, P6, P7, P8, P9, P12) map
  to disk paths in the right order
- **Format-tolerant section matching**: doctor now accepts both
  `### P1: Title` AND `### P1 — Label: Title` formats (workspace
  AGENTS.md uses the labeled form; doctor was missing matches against
  workspace files). Fixed in P_NAMES section-presence check + the
  awk pattern in REFLEXIVE_PRIMS scan.

Companion fix in workspace:
- broomva/workspace/scripts/bstack-primitive-lint.py parse regex
  extended to accept `### P\d+ —` (label form) in addition to
  `### P\d+:` (original form)

Verified:
- bash scripts/doctor.sh against workspace → 73/73 PASSES
- G-L3-1 + G-L3-2 both green

The naming note about broomva/p9 skill being historically named is
preserved (and now consistent across workspace and bstack). The
"primitive number matches skill name" pedagogical claim in the old
§P9 is reframed in the new §P7 as "skill repo name is stable;
primitive number changed; this is intentional."

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 14, 2026

Warning

Rate limit exceeded

@broomva has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 57 minutes and 1 second before requesting another review.

You’ve run out of usage credits. Purchase more in the billing tab.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: fa08d35e-88e2-4ee9-9653-4a9041b61c9f

📥 Commits

Reviewing files that changed from the base of the PR and between e35477a and a249089.

📒 Files selected for processing (6)
  • SKILL.md
  • assets/templates/AGENTS.md.template
  • assets/templates/CLAUDE.md.template
  • references/primitives.md
  • scripts/doctor.sh
  • tests/template_lockstep.test.sh
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/p7-p8-p9-numbering-align

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@broomva broomva merged commit 3f39e30 into main May 14, 2026
1 check passed
@broomva broomva deleted the feat/p7-p8-p9-numbering-align branch May 14, 2026 17:23
broomva added a commit that referenced this pull request May 15, 2026
Closes the gap where `bstack bootstrap` installed role-x as a skill (via
ROSTER in #13) but left its hooks dormant in `.claude/settings.json` —
agents installing bstack fresh had P17 routing files on disk but no
UserPromptSubmit or coverage trigger. Every workspace had to wire those
by hand. Confirmed end-to-end against this workspace's live settings.

Added (assets/templates/settings.json.snippet):
- UserPromptSubmit block → role-x-intake-hook.sh (P17 per-prompt routing)
- SessionStart block extended → role-x-coverage-hook.sh (P17 registry-
  health nudge, ≤1/24h cooldown, silent when fire-rate ≥30%)
- New ${BROOMVA_HOME} placeholder for $HOME-rooted paths (npx skills
  add -g installs at ${HOME}/.agents/skills/<name>)

Extended (scripts/bootstrap.sh):
- Phase 3 sed substitution: -e for both ${BROOMVA_WORKSPACE} and
  ${BROOMVA_HOME} → workspace dir and $HOME respectively
- Phase 3 Python merge path: two-step .replace() for the same two
  placeholders before json.loads()
- Idempotent merge logic unchanged — existing-by-basename detection
  already handles re-runs correctly (verified Case C: 0 new wires on
  a workspace where both role-x hooks were already manually wired)
- Drive-by fix: log format string was "PP8"/"PP17" (double-P) because the
  _bstack_primitive value already contains the "P" prefix; corrected
  to ({primitive}) with P? fallback when key absent

Extended (scripts/doctor.sh):
- §6 hook-wiring array gets role-x-intake-hook.sh + role-x-coverage-hook.sh
  with P17 labels
- Old skill-freshness-hook.sh label corrected from P7 → P8 (post-PR #16
  numbering)
- Docstring header §5 now enumerates all 5 hooks by primitive
- Docstring header §6 adds P17 disk-presence reachability spec

Validation:
- JSON valid on new snippet (python3 -c 'json.load(...)')
- Bash syntax green on bootstrap.sh + doctor.sh (bash -n)
- Three dry-run cases on /tmp scratch:
    A. Fresh scaffold → snippet renders 5 hook events with absolute
       ${HOME} paths resolved correctly
    B. Existing settings.json with only P1/P2 → merge adds 4 missing
       hooks (P8 freshness, P17 intake, P17 coverage, P1 notification)
    C. Workspace with all 5 hooks already wired → 0 new wires
       (idempotency confirmed)
- doctor.sh on live workspace: all 5 hook checks [ok] including the
  two new P17 entries

Coordination with concurrent PRs:
- PR #17 (broomva): SKILL.md prose drift + AGENTS/CLAUDE templates +
  scaffold-and-doctor test. Touches SKILL.md, AGENTS.md.template,
  CLAUDE.md.template, template_lockstep.test.sh — NO overlap with this
  PR (verified via gh pr diff 17).
- SKILL.md ## Hooks section update deferred to a follow-up PR after
  #17 lands, to keep edits non-overlapping.

Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
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