peaks-loop 4.1.18 → 4.1.20

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (169) hide show
  1. package/.claude-plugin/marketplace.json +2 -2
  2. package/CHANGELOG.md +256 -0
  3. package/README-en.md +6 -0
  4. package/README.md +5 -0
  5. package/contracts/test-style-contract.md +14 -5
  6. package/dist/cli/commands/audit-red-lines-runners.js +6 -1
  7. package/dist/cli/commands/best-practice-scan-collision.d.ts +42 -0
  8. package/dist/cli/commands/best-practice-scan-collision.js +115 -0
  9. package/dist/cli/commands/best-practice-scan-command.d.ts +5 -0
  10. package/dist/cli/commands/best-practice-scan-command.js +9 -18
  11. package/dist/cli/commands/best-practice-scan-helpers.d.ts +12 -6
  12. package/dist/cli/commands/best-practice-scan-helpers.js +37 -17
  13. package/dist/cli/commands/code-auto-compact-command.js +26 -18
  14. package/dist/cli/commands/core/skill-generated-config-notice.d.ts +5 -0
  15. package/dist/cli/commands/core/skill-generated-config-notice.js +42 -8
  16. package/dist/cli/commands/core/skill-presence-commands.js +42 -74
  17. package/dist/cli/commands/core/skill-presence-set-command.d.ts +11 -0
  18. package/dist/cli/commands/core/skill-presence-set-command.js +175 -0
  19. package/dist/cli/commands/core/standards-init-command.js +44 -8
  20. package/dist/cli/commands/core/standards-migrate-command.js +5 -4
  21. package/dist/cli/commands/dispatch-dag-runners.d.ts +1 -0
  22. package/dist/cli/commands/dispatch-dag-runners.js +11 -1
  23. package/dist/cli/commands/dispatch-detached-branch.js +19 -1
  24. package/dist/cli/commands/mut-commands-helpers.d.ts +72 -5
  25. package/dist/cli/commands/mut-commands-helpers.js +197 -4
  26. package/dist/cli/commands/mut-commands.d.ts +9 -1
  27. package/dist/cli/commands/mut-commands.js +82 -154
  28. package/dist/cli/commands/preferences-commands.js +27 -2
  29. package/dist/cli/commands/scan-scope-helpers.js +2 -2
  30. package/dist/services/24h-mode/auto-engage.d.ts +11 -3
  31. package/dist/services/24h-mode/auto-engage.js +14 -6
  32. package/dist/services/artifacts/artifact-templates.js +10 -0
  33. package/dist/services/artifacts/backcompat-acceptance.d.ts +8 -1
  34. package/dist/services/artifacts/backcompat-acceptance.js +8 -7
  35. package/dist/services/artifacts/rd-transition-gates.d.ts +32 -5
  36. package/dist/services/artifacts/rd-transition-gates.js +96 -19
  37. package/dist/services/artifacts/request-artifact-service.js +6 -6
  38. package/dist/services/audit/enforcers/lint-output-style.js +14 -2
  39. package/dist/services/audit/enforcers/root-scratch-artifacts.d.ts +46 -0
  40. package/dist/services/audit/enforcers/root-scratch-artifacts.js +97 -0
  41. package/dist/services/audit/static-service.js +4 -4
  42. package/dist/services/code/auto-compact-history.d.ts +6 -1
  43. package/dist/services/code/auto-compact-history.js +6 -1
  44. package/dist/services/code/auto-compact-modes.d.ts +60 -14
  45. package/dist/services/code/auto-compact-modes.js +75 -20
  46. package/dist/services/code/auto-compact-profile.d.ts +23 -0
  47. package/dist/services/code/auto-compact-profile.js +51 -0
  48. package/dist/services/compact-history/compact-history-service.d.ts +6 -1
  49. package/dist/services/compact-history/compact-history-service.js +5 -1
  50. package/dist/services/context/auto-compact-types.d.ts +7 -5
  51. package/dist/services/doctor/doctor-service/checks/l3-runtime-root-census.d.ts +37 -0
  52. package/dist/services/doctor/doctor-service/checks/l3-runtime-root-census.js +100 -0
  53. package/dist/services/doctor/doctor-service/checks/skill-reference-parity.d.ts +11 -3
  54. package/dist/services/doctor/doctor-service/checks/skill-reference-parity.js +48 -29
  55. package/dist/services/doctor/doctor-service/plugin-registry.js +2 -0
  56. package/dist/services/hooks/hook-payload-cwd.d.ts +11 -4
  57. package/dist/services/hooks/hook-payload-cwd.js +11 -4
  58. package/dist/services/hooks/presence-marker-detector.d.ts +3 -0
  59. package/dist/services/hooks/presence-marker-detector.js +21 -19
  60. package/dist/services/ide/adapters/claude-code-adapter.js +6 -8
  61. package/dist/services/ide/adapters/codex-adapter.js +23 -7
  62. package/dist/services/ide/adapters/cursor-adapter.js +23 -7
  63. package/dist/services/mode/mode-status-service.d.ts +26 -27
  64. package/dist/services/mode/mode-status-service.js +36 -60
  65. package/dist/services/preferences/preferences-types.d.ts +30 -0
  66. package/dist/services/preferences/preferences-types.js +13 -0
  67. package/dist/services/scan/acceptance-coverage-service.d.ts +14 -11
  68. package/dist/services/scan/acceptance-coverage-service.js +157 -52
  69. package/dist/services/scan/rid-change-claims.d.ts +15 -0
  70. package/dist/services/scan/rid-change-claims.js +116 -0
  71. package/dist/services/skills/presence-caller-id.d.ts +51 -0
  72. package/dist/services/skills/presence-caller-id.js +43 -0
  73. package/dist/services/skills/presence-gate.d.ts +65 -0
  74. package/dist/services/skills/presence-gate.js +113 -0
  75. package/dist/services/skills/presence-lease-resolver.d.ts +63 -0
  76. package/dist/services/skills/presence-lease-resolver.js +114 -0
  77. package/dist/services/skills/presence-lease-selection.d.ts +91 -0
  78. package/dist/services/skills/presence-lease-selection.js +135 -0
  79. package/dist/services/skills/presence-lease-service.d.ts +3 -11
  80. package/dist/services/skills/presence-lease-service.js +34 -87
  81. package/dist/services/skills/presence-lease-store.d.ts +33 -0
  82. package/dist/services/skills/presence-lease-store.js +94 -0
  83. package/dist/services/skills/presence-lease-types.d.ts +31 -0
  84. package/dist/services/skills/presence-lease-types.js +27 -0
  85. package/dist/services/skills/presence-role.d.ts +35 -0
  86. package/dist/services/skills/presence-role.js +72 -0
  87. package/dist/services/skills/skill-presence-service.d.ts +39 -9
  88. package/dist/services/skills/skill-presence-service.js +143 -174
  89. package/dist/services/skills/skill-presence-write.d.ts +60 -0
  90. package/dist/services/skills/skill-presence-write.js +74 -0
  91. package/dist/services/skills/skill-statusline-service.js +7 -7
  92. package/dist/services/standards/ide-aware-standards-service.d.ts +35 -23
  93. package/dist/services/standards/ide-aware-standards-service.js +45 -20
  94. package/dist/services/standards/migrate-claude-rules-service.d.ts +6 -0
  95. package/dist/services/standards/migrate-claude-rules-service.js +18 -0
  96. package/dist/services/standards/migrate-service.d.ts +1 -1
  97. package/dist/services/standards/migrate-service.js +27 -7
  98. package/dist/services/standards/project-scripts.d.ts +25 -0
  99. package/dist/services/standards/project-scripts.js +116 -0
  100. package/dist/services/standards/project-standards-service.d.ts +23 -15
  101. package/dist/services/standards/project-standards-service.js +176 -243
  102. package/dist/services/standards/standards-constitution.d.ts +89 -0
  103. package/dist/services/standards/standards-constitution.js +199 -0
  104. package/dist/services/standards/standards-files.d.ts +37 -0
  105. package/dist/services/standards/standards-files.js +138 -0
  106. package/dist/services/standards/standards-pointer.d.ts +73 -0
  107. package/dist/services/standards/standards-pointer.js +98 -0
  108. package/dist/services/standards/standards-render-agents.d.ts +34 -0
  109. package/dist/services/standards/standards-render-agents.js +149 -0
  110. package/dist/services/standards/standards-render-common.d.ts +38 -1
  111. package/dist/services/standards/standards-render-common.js +44 -7
  112. package/dist/services/standards/standards-render.d.ts +1 -3
  113. package/dist/services/standards/standards-render.js +6 -87
  114. package/dist/services/workflow/workflow-graph-ensure.d.ts +77 -0
  115. package/dist/services/workflow/workflow-graph-ensure.js +97 -0
  116. package/dist/services/workflow/workflow-presence-lifecycle.js +21 -6
  117. package/dist/services/workspace/generated-artifacts-content.d.ts +46 -0
  118. package/dist/services/workspace/generated-artifacts-content.js +167 -0
  119. package/dist/services/workspace/generated-artifacts-stamp.d.ts +36 -13
  120. package/dist/services/workspace/generated-artifacts-stamp.js +37 -15
  121. package/dist/services/workspace/runtime-layout.d.ts +64 -0
  122. package/dist/services/workspace/runtime-layout.js +62 -0
  123. package/output-styles/peaks-skill-swarm.md +18 -2
  124. package/package.json +9 -9
  125. package/schemas/doctor-report.schema.json +1 -1
  126. package/scripts/canonical-store-report.mjs +84 -0
  127. package/skills/bee/peaks-perf-audit/SKILL.md +3 -1
  128. package/skills/bee/peaks-prd/SKILL.md +5 -3
  129. package/skills/bee/peaks-qa/SKILL.md +4 -2
  130. package/skills/bee/peaks-qa/references/qa-skill-presence.md +1 -1
  131. package/skills/bee/peaks-qa/references/qa-standards-preflight.md +3 -1
  132. package/skills/bee/peaks-qa/references/qa-sub-agent-dispatch.md +2 -2
  133. package/skills/bee/peaks-rd/SKILL.md +4 -2
  134. package/skills/bee/peaks-rd/references/artifact-and-standards-output.md +1 -1
  135. package/skills/bee/peaks-rd/references/rd-runbook.md +11 -2
  136. package/skills/bee/peaks-rd/references/rd-standards-preflight.md +3 -1
  137. package/skills/bee/peaks-rd/references/rd-sub-agent-dispatch.md +4 -4
  138. package/skills/bee/peaks-rd/references/rd-transition-gates.md +49 -5
  139. package/skills/bee/peaks-rd/references/skill-presence-and-title.md +1 -1
  140. package/skills/bee/peaks-reviewer/SKILL.md +3 -1
  141. package/skills/bee/peaks-sc/SKILL.md +4 -2
  142. package/skills/bee/peaks-security-audit/SKILL.md +3 -1
  143. package/skills/bee/peaks-txt/SKILL.md +5 -3
  144. package/skills/bee/peaks-ui/SKILL.md +6 -4
  145. package/skills/peaks-audit/SKILL.md +3 -1
  146. package/skills/peaks-code/SKILL.md +3 -1
  147. package/skills/peaks-code/references/a2a-artifact-mapping.md +3 -3
  148. package/skills/peaks-code/references/completion-handoff.md +1 -1
  149. package/skills/peaks-code/references/local-artifact-workspace.md +10 -11
  150. package/skills/peaks-code/references/micro-cycle.md +2 -2
  151. package/skills/peaks-code/references/mode-selection-with-stale-presence.md +3 -3
  152. package/skills/peaks-code/references/runbook.md +4 -4
  153. package/skills/peaks-code/references/skill-presence-and-title.md +4 -2
  154. package/skills/peaks-code/references/standards-preflight.md +7 -6
  155. package/skills/peaks-code/references/sub-agent-dispatch.md +1 -1
  156. package/skills/peaks-code/references/swarm-dispatch-contract.md +5 -5
  157. package/skills/peaks-code/references/workflow-gates-and-types.md +37 -11
  158. package/skills/peaks-content/SKILL.md +3 -1
  159. package/skills/peaks-doctor/SKILL.md +3 -1
  160. package/skills/peaks-final-review/SKILL.md +3 -1
  161. package/skills/peaks-ide/SKILL.md +3 -1
  162. package/skills/peaks-issue-fix-orchestrator/SKILL.md +5 -3
  163. package/skills/peaks-race-code/SKILL.md +3 -1
  164. package/skills/peaks-resume/SKILL.md +3 -1
  165. package/skills/peaks-slice-decompose/SKILL.md +3 -1
  166. package/skills/peaks-solo/SKILL.md +3 -1
  167. package/skills/peaks-sop/SKILL.md +4 -2
  168. package/skills/peaks-status/SKILL.md +3 -1
  169. package/skills/peaks-test/SKILL.md +3 -1
@@ -196,13 +196,13 @@ After RD completes (whether inline or sub-agent), Code does not stop — it must
196
196
 
197
197
  **RD's internal reviews are already parallelized.** When RD finishes implementation, it issues a 3-way sub-agent fan-out (code-review + security-review + perf-baseline, see `skills/bee/peaks-rd/SKILL.md` "Parallel review fan-out") and waits for all to return before transitioning to `qa-handoff`. Code does NOT need to track three separate RD-side sub-runs; the RD role owns the fan-out lifecycle end-to-end. Code's presence restoration after the swarm converges is the only coordination point.
198
198
 
199
- **Presence restoration after RD/QA work returns (MANDATORY):** In v1.x, role skills called `peaks skill presence:set <role>` internally and stomped on `.peaks/.active-skill.json`. From v1.3 onward, sub-agents in the Swarm path are forbidden from calling `peaks skill presence:set` (see "Sub-agent dispatch" in each role's SKILL.md), so the main loop's presence file is preserved across the fan-out window by construction. The one place Code still has to actively restore presence is **once after the fan-out returns** (gate=swarm-converged) and again **after each RD↔QA repair iteration** (gate=repair-cycle-<N>). Use the same command from Step 2 with the current mode and the gate that has just advanced:
199
+ **Presence restoration after RD/QA work returns (MANDATORY):** In v1.x, role skills called `peaks skill presence:set <role>` internally and stomped on the main loop's presence lease. From v1.3 onward, sub-agents in the Swarm path are forbidden from calling `peaks skill presence:set` (see "Sub-agent dispatch" in each role's SKILL.md), so the main loop's presence lease is preserved across the fan-out window by construction. The one place Code still has to actively restore presence is **once after the fan-out returns** (gate=swarm-converged) and again **after each RD↔QA repair iteration** (gate=repair-cycle-<N>). Use the same command from Step 2 with the current mode and the gate that has just advanced:
200
200
 
201
201
  ```bash
202
202
  peaks skill presence:set peaks-code --project <repo> --mode <mode> --gate <current-gate>
203
203
  ```
204
204
 
205
- This keeps the CLAUDE.md status header accurate (`Peaks-Loop Skill: peaks-code`) instead of showing a stale role name. Use the current mode and gate values; the gate may have advanced since startup. Skipping this step causes the header to display the last-known gate permanently.
205
+ This keeps the CLAUDE.md status header accurate (`Peaks-Loop Skill: peaks-code | Peaks-Loop Role: <role> | Peaks-Loop Gate: <gate> | Peaks-Loop Context: <ratio%> (<zone>) | Next: <one short action>`) instead of showing a stale role name. `Role` and `Context` are machine facts: copy them from `peaks skill presence --json` (`data.role`, `data.context.ratioPct`, `data.context.action`) — never invent them. Use the current mode and gate values; the gate may have advanced since startup. Skipping this step causes the header to display the last-known gate permanently.
206
206
 
207
207
  **Full-auto auto-proceed rule**: In the `full-auto` profile, when RD transitions to `qa-handoff`, Code immediately drives QA — by launching a `peaks sub-agent dispatch qa` sub-agent carrying the `peaks-qa` body (swarm path), then executing the returned toolCall, or by running QA inline in the main loop (assisted/strict path). Do not pause, do not ask the user, do not summarize RD results as if they were final. The only valid reason to skip QA is when `--type` is `docs` or `chore` (no acceptance surface).
208
208
 
@@ -9,10 +9,10 @@
9
9
  Defect A (from PRD-002, 2026-06-28 session 88b27d):
10
10
 
11
11
  1. session A runs in `full-auto` → `peaks skill presence:set peaks-code --mode full-auto --gate startup` stamps
12
- `.peaks/_runtime/active-skill.json` with `outerSessionId=outer-A`.
12
+ the presence lease (`.peaks/_runtime/<sid>/leases/presence-*.json`) with `outerSessionId=outer-A`.
13
13
  2. session A closes (Claude window quit).
14
14
  3. session B opens (a new Claude window, `outerSessionId=outer-B`).
15
- 4. `peaks skill presence:get --project <path>` still returns `mode=full-auto` because the file is on disk.
15
+ 4. `peaks skill presence:get --project <path>` still returns `mode=full-auto` because the lease is on disk.
16
16
  5. peaks-code Step 1 reads the presence, sees `mode=full-auto`, **skips** AskUserQuestion.
17
17
  6. The user never picked `full-auto` for THIS session — the mode was sticky from the previous one.
18
18
 
@@ -119,6 +119,6 @@ peaks skill presence:set peaks-code --mode full-auto --gate startup
119
119
 
120
120
  ## ACL — what NOT to do
121
121
 
122
- - **NEVER** skip Step 1 just because `.peaks/_runtime/active-skill.json` shows a `mode` field. Run `presence:check-stale` first.
122
+ - **NEVER** skip Step 1 just because `peaks skill presence --json` shows a `mode` field. Run `presence:check-stale` first.
123
123
  - **NEVER** call `peaks skill presence:clear` from peaks-code to "fix" a stale mode. The auto-clear path is `peaks workspace init`'s job; manual clears destroy user-explicit mode choices that may belong to another live outer session.
124
124
  - **NEVER** set the presence `mode` field from inside a sub-agent (peaks-rd, peaks-qa, etc.). Sub-agents may read presence to honour the user's chosen mode but the write authority for Step 1 belongs to the peaks-code driver.
@@ -37,10 +37,10 @@ peaks scan existing-system --project <repo> --json
37
37
 
38
38
  # 1. Peaks-Loop Standards preflight + apply
39
39
  # Run dry-run first to inspect deltas, then APPLY. In full-auto and 24h modes,
40
- # --apply is the default — Standards files (CLAUDE.md, .claude/rules/**) live INSIDE
41
- # the target project and are required for downstream skill preflight, so producing
42
- # them is part of completing the workflow. Assisted/Strict modes pause for [CONFIRM]
43
- # between dry-run and apply (AskUserQuestion → re-run with --confirm; no terminal prompt).
40
+ # --apply is the default — Standards files (AGENTS.md body, optional CLAUDE.md pointer,
41
+ # rules tree under .peaks/standards/** or .claude/rules/**) live INSIDE the target
42
+ # project and are required for downstream skill preflight, so producing them is part of
43
+ # completing the workflow. Assisted/Strict modes pause for [CONFIRM] between dry-run and apply (AskUserQuestion → re-run with --confirm; no terminal prompt).
44
44
  peaks standards init --project <repo> --dry-run --json
45
45
  # or: peaks standards update --project <repo> --dry-run --json
46
46
  peaks standards init --project <repo> --apply --json
@@ -16,9 +16,11 @@ On the first presence:set in a project, ensure the out-of-band status bar is ins
16
16
  peaks statusline install --project <repo> # idempotent; skips if already installed
17
17
  ```
18
18
 
19
- Then display the compact status header: `Peaks-Loop Skill: peaks-code | Peaks-Loop Gate: startup | Next: <one short action>`. Display this header on EVERY turn while the skill is active.
19
+ Then display the compact status header: `Peaks-Loop Skill: peaks-code | Peaks-Loop Role: <role> | Peaks-Loop Gate: startup | Peaks-Loop Context: <ratio%> (<zone>) | Next: <one short action>`. `Role` and `Context` are machine facts: copy them from `peaks skill presence --json` (`data.role`, `data.context.ratioPct`, `data.context.action`) — never invent them. Display this header on EVERY turn while the skill is active.
20
20
 
21
- Update with `peaks skill presence:set peaks-code --project <repo> --mode <mode> --gate <gate>` when gates change. The presence file persists across the full workflow lifecycle — clear is owned by workflow terminalize; follow-up workflows re-claim via new workflow init.
21
+ Update with `peaks skill presence:set peaks-code --project <repo> --mode <mode> --gate <gate>` when gates change. The presence lease persists across the full workflow lifecycle — it lives at `.peaks/_runtime/<session-id>/leases/presence-*.json` (the canonical path; the project-level `active-skill.json` single-slot files were removed in 4.0.11) — clear is owned by workflow terminalize; follow-up workflows re-claim via new workflow init.
22
+
23
+ Read the live presence back with `peaks skill presence --json`. It reports the active skill, its mode and its gate, and it resolves the lease across the session trees of the project — when the bound tree holds no lease, another tree's live lease is reported instead. Add `--check-stale` to learn WHY nothing is active (`presenceInactive.reason`: `no-leases`, `all-terminal`, `all-stale`, `terminal-and-stale`).
22
24
 
23
25
  ## Step 2.5a — Set session title
24
26
 
@@ -5,18 +5,19 @@
5
5
  - `peaks standards init --project <path> --dry-run`
6
6
  - `peaks standards update --project <path> --dry-run`
7
7
 
8
- Use `standards init` for first-time creation and `standards update` for existing `CLAUDE.md` append/review behavior. In `full-auto` and `24h` profiles, `--apply` runs automatically after `--dry-run` succeeds — these files live inside the target project, are required for downstream skill preflight, and producing them is part of finishing the workflow (Peaks-Loop Gate G enforces this). `assisted` and `strict` profiles pause for explicit user confirmation between dry-run and apply.
8
+ Use `standards init` for first-time creation and `standards update` for the existing **body** file (`AGENTS.md`) append/review behavior. The bundle the CLI writes has three parts: the **body** `AGENTS.md` (always written), the **pointer** `CLAUDE.md` (written only when the IDE profile needs it — a profile that reads `AGENTS.md` directly, e.g. `--ide codex`, writes no pointer), and the **rules tree** under `.peaks/standards/**` (2.0 canonical layout) or `.claude/rules/**` (legacy 1.x project that still carries a thick `.claude/rules/` tree). In `full-auto` and `24h` profiles, `--apply` runs automatically after `--dry-run` succeeds — these files live inside the target project, are required for downstream skill preflight, and producing them is part of finishing the workflow (Peaks-Loop Gate G enforces this). `assisted` and `strict` profiles pause for explicit user confirmation between dry-run and apply.
9
9
 
10
- **CRITICAL — Standards must reflect the project scan.** When generating or updating `CLAUDE.md`, the content must reference concrete findings from `.peaks/project-scan/project-scan.md`: the detected component library (e.g. "This project uses antd 5.x"), CSS solution (e.g. "Uses Less via Umi"), build tool, state management, and routing. Never emit a generic template that says "read .claude/rules/..." without naming the actual project stack. If the project-scan has not been run yet, run it before standards init/update.
10
+ **CRITICAL — Standards must reflect the project scan.** When generating or updating the standards bundle, the content must reference concrete findings from `.peaks/project-scan/project-scan.md`: the detected component library (e.g. "This project uses antd 5.x"), CSS solution (e.g. "Uses Less via Umi"), build tool, state management, and routing. Those findings belong in the rules-tree files under the project's rules root (`.peaks/standards/**` for the 2.0 layout, `.claude/rules/**` for a legacy 1.x project); the body file `AGENTS.md` carries the command list and points at those files, and `CLAUDE.md` is only the `@AGENTS.md` pointer. Never emit a generic template that says "read <rules-root>/..." without naming the actual project stack. If the project-scan has not been run yet, run it before standards init/update.
11
11
 
12
- **Legacy projects additionally** — when archetype ∈ {legacy-frontend, legacy-fullstack, frontend-monorepo}, the `CLAUDE.md` Conventions section MUST extract concrete naming, directory, service-layer, and hooks conventions from `.peaks/_runtime/<sessionId>/system/existing-system.md` and record them as hard constraints for new code. It must also list the `## Legacy constraints` from `project-scan.md` (class components, moment, enzyme, etc.) and instruct that new code in the same module preserves those patterns unless PRD explicitly authorizes modernization. A `CLAUDE.md` for a legacy project that contains only generic rule pointers without naming the actual conventions is a blocking violation — regenerate it.
12
+ **Legacy projects additionally** — when archetype ∈ {legacy-frontend, legacy-fullstack, frontend-monorepo}, the standards content MUST extract concrete naming, directory, service-layer, and hooks conventions from `.peaks/_runtime/<sessionId>/system/existing-system.md` and record them as hard constraints for new code. It must also list the `## Legacy constraints` from `project-scan.md` (class components, moment, enzyme, etc.) and instruct that new code in the same module preserves those patterns unless PRD explicitly authorizes modernization. A standards bundle for a legacy project that contains only generic rule pointers without naming the actual conventions is a blocking violation — regenerate it.
13
13
 
14
14
  Do not hand-write standards file mutations inside the skill.
15
15
 
16
- For project-analysis requests such as "分析项目" / "分析下这个项目", Step 0 still applies: the workspace is initialized and `peaks-code` presence is set before any analysis output. These requests run the lightweight analysis branch (project scan + standards dry-run) rather than the full RD/QA pipeline, but they never skip workspace anchoring or exit the workflow. The handoff must include an explicit **Standards increment** section. Report the current `CLAUDE.md` and `.claude/rules/**` status from the dry-run output as incremental deltas, not just a generic preflight note:
16
+ For project-analysis requests such as "分析项目" / "分析下这个项目", Step 0 still applies: the workspace is initialized and `peaks-code` presence is set before any analysis output. These requests run the lightweight analysis branch (project scan + standards dry-run) rather than the full RD/QA pipeline, but they never skip workspace anchoring or exit the workflow. The handoff must include an explicit **Standards increment** section. Report the current standards status from the dry-run output as incremental deltas, not just a generic preflight note:
17
17
 
18
- - whether `CLAUDE.md` is missing, existing, planned, skipped, appended, or review-only;
19
- - which `.claude/rules/**` files are planned, existing, skipped, appended, or review-only;
18
+ - the body file (`AGENTS.md`): whether it is missing, existing, planned, skipped, appended, or review-only;
19
+ - the pointer file (`CLAUDE.md`), only when the IDE profile writes one — its absence is not a delta;
20
+ - which rules-tree files are planned, existing, or skipped, under whichever root the project uses (`.peaks/standards/**` for the 2.0 layout, `.claude/rules/**` for a legacy 1.x project) — the rules tree is presence-only in both commands; `appended` / `review` are body-file states;
20
21
  - whether writes were applied or intentionally left as dry-run because authorization or scope was absent;
21
22
  - the exact next action if standards should be applied later.
22
23
 
@@ -418,7 +418,7 @@ The role's required artefact paths (also see peaks-ui/rd/qa SKILL.md and `swarm-
418
418
  **Hard prohibitions on sub-agents** (also passed in each dispatch prompt):
419
419
 
420
420
  - Do NOT call `Skill(skill="...")` — sub-agents must not recursively activate skills, that defeats the fan-out.
421
- - Do NOT call `peaks skill presence:set` — only the main Code loop owns `.peaks/.active-skill.json`. Sub-agents write to a per-agent marker file `.peaks/_runtime/<sessionId>/system/sub-agent-<role>.json` if they need to record state, but never the main presence file.
421
+ - Do NOT call `peaks skill presence:set` — only the main Code loop owns the presence lease. Sub-agents write to a per-agent marker file `.peaks/_runtime/<sessionId>/system/sub-agent-<role>.json` if they need to record state, but never the main presence lease.
422
422
  - Do NOT open interactive user prompts. If a sub-agent needs clarification, it must return a `blocked` verdict in its return string and let Code handle the user message.
423
423
  - Do NOT commit, push, install hooks, or apply settings.json mutations. Only Code holds those permissions.
424
424
  - **Reinforced (2026-06-28 incident):** an RD sub-agent silently auto-committed its own diff during a fix-callerid-leak dispatch (commit `bff4dff`). The orchestrator caught the unauthorized commit on the next turn but the user had to manually re-approve. **Every dispatch prompt MUST copy the verbatim block below into its `--prompt` argument** so the sub-agent sees the rule with full weight:
@@ -37,7 +37,7 @@ Return a compact JSON envelope — do not write prose.
37
37
 
38
38
  ## Hard prohibitions
39
39
  - Do NOT call Skill(skill="..."). You are the role.
40
- - Do NOT call `peaks skill presence:set` — the main loop owns .peaks/.active-skill.json.
40
+ - Do NOT call `peaks skill presence:set` — the main loop owns the presence lease.
41
41
  If you need to record state, write to .peaks/_runtime/<session-id>/system/sub-agent-<role>.json.
42
42
  - Do NOT commit, push, install hooks, or apply settings.json mutations.
43
43
  - Do NOT ask the user interactive questions. If you need clarification, return
@@ -45,7 +45,7 @@ Return a compact JSON envelope — do not write prose.
45
45
 
46
46
  ## Runtime arguments (provided by Code)
47
47
  - project: <repo> (git repo root, NOT a sub-package)
48
- - session-id: <sid> (from .peaks/.active-skill.json or .peaks/.session.json)
48
+ - session-id: <sid> (from `peaks session info --active --json`; the on-disk binding is .peaks/_runtime/session.json)
49
49
  - request-id: <rid> (PRD id)
50
50
  - type: <type> (feature | bugfix | refactor | config | docs | chore)
51
51
  - mode: <mode> (full-auto | assisted | strict | 24h)
@@ -182,9 +182,9 @@ After all sub-agent dispatch calls return and the LLM has invoked the toolCalls,
182
182
 
183
183
  ## 5. Presence restoration (single-shot)
184
184
 
185
- Sub-agents are explicitly forbidden from calling `peaks skill presence:set`. That means `.peaks/.active-skill.json` does not move during the fan-out. Code sets it to `gate=swarm-fan-out` before fan-out and to `gate=swarm-converged` once after all Tasks return. The status header (the `Peaks-Loop Skill: peaks-code | Peaks-Loop Gate: <gate>` line) therefore reads consistently across the fan-out window.
185
+ Sub-agents are explicitly forbidden from calling `peaks skill presence:set`. That means the presence lease does not move during the fan-out. Code sets it to `gate=swarm-fan-out` before fan-out and to `gate=swarm-converged` once after all Tasks return. The status header (the `Peaks-Loop Skill: peaks-code | Peaks-Loop Role: <role> | Peaks-Loop Gate: <gate> | Peaks-Loop Context: <ratio%> (<zone>) | Next: <one short action>` line) therefore reads consistently across the fan-out window. `Role` and `Context` are machine facts: copy them from `peaks skill presence --json` (`data.role`, `data.context.ratioPct`, `data.context.action`) — never invent them.
186
186
 
187
- If a sub-agent is misbehaving and writes to `.peaks/.active-skill.json` anyway, the next Code presence-set (after fan-out) overwrites it — the bug self-heals on the next gate advance, but the swarm-phase display may be off. The hard prohibition is there to prevent this; Code should still treat the file as a single-writer resource.
187
+ If a sub-agent is misbehaving and writes its own presence lease anyway, the next Code presence-set (after fan-out) overwrites it — the bug self-heals on the next gate advance, but the swarm-phase display may be off. The hard prohibition is there to prevent this; Code should still treat the lease as a single-writer resource.
188
188
 
189
189
  ## 6. Why not a `peaks-swarm` skill?
190
190
 
@@ -237,7 +237,7 @@ Sub-agent presence in this list = Code launched a Task for it. Absence = the rol
237
237
  | `assisted` | `AskUserQuestion` with three options: (a) Full — UI + RD(planning) + QA(test-cases); (b) Backend-only — RD(planning) + QA(test-cases); (c) Sequential — run RD first, then QA, skip UI | Use the user's choice as the plan |
238
238
  | `strict` | Same as `assisted` (the question is informational; strict still enforces confirmation gates later) | Same as `assisted` |
239
239
 
240
- In all modes, **the plan must be written to `sc/swarm-plan.json` before any Task call.** Code updates `.peaks/.active-skill.json` to `gate=swarm-fan-out` at this point.
240
+ In all modes, **the plan must be written to `sc/swarm-plan.json` before any Task call.** Code updates the presence lease to `gate=swarm-fan-out` at this point.
241
241
 
242
242
  ### Degradation when swarm roles fail or are absent
243
243
 
@@ -148,7 +148,7 @@ ls .peaks/_runtime/<sessionId>/qa/requests/<rid>.md
148
148
  find .peaks/_runtime/<sessionId>/ -type f | sort
149
149
  # Verify: files from gates A-D all appear in this list.
150
150
  # Any mandatory file missing → NOT complete. Do not emit TXT.
151
- # Peaks-Loop Gate G (CLAUDE.md + .claude/rules/**) must ALSO pass before TXT is emitted.
151
+ # Peaks-Loop Gate G (standards bundle — AGENTS.md body + rules tree) must ALSO pass before TXT is emitted.
152
152
  ```
153
153
 
154
154
  **Peaks-Loop Gate F — Root pollution check (BLOCKING before completion):**
@@ -170,18 +170,44 @@ find . -maxdepth 1 -name "*.png" -o -name "*.jpg" -o -name "qa-*.js" -o -name "m
170
170
 
171
171
  **Peaks-Loop Gate G — Project standards present (BLOCKING before workflow completion):**
172
172
  ```bash
173
- # After `peaks standards init/update --apply`, verify the files actually landed
174
- # at the project root. The CLAUDE.md and rules files are required so that
175
- # subsequent peaks-rd / peaks-qa / peaks-code runs perform the project-local
176
- # preflight described in CLAUDE.md (read coding-style.md, code-review.md, security.md).
177
- ls <repo>/CLAUDE.md
173
+ # After `peaks standards init/update --apply`, verify the files actually landed.
174
+ # The file set is decided by the CLI — never hard-code a rules path here:
175
+ peaks standards init --project <repo> --dry-run --json
176
+ # → data.plannedWrites[] = [{ relativePath, status }, ...]
177
+ # init reports TWO states: planned (absent → will be created) | existing (present on
178
+ # disk — init does not compare content, so a stale file still reads 'existing').
179
+ # The four-state view of the body file comes from
180
+ # `peaks standards update --project <repo> --dry-run --json`:
181
+ # planned | appended (managed block missing) | existing
182
+ # (managed block matches) | review (managed block differs → a human decides; that
183
+ # command exits 1 with code STANDARDS_UPDATE_REVIEW_REQUIRED). The four states cover
184
+ # AGENTS.md and, when the IDE profile writes one, CLAUDE.md; rules-tree files are
185
+ # planned | existing in both commands.
186
+ # → data.skippedFiles[] = the entries already present on disk
187
+ #
188
+ # The bundle has three parts, and only the first has a fixed name:
189
+ # BODY = AGENTS.md — always written, in every layout.
190
+ # POINTER = CLAUDE.md — written ONLY when the IDE profile needs it; a profile that reads
191
+ # AGENTS.md directly (e.g. `--ide codex`) writes no pointer at all, so its ABSENCE
192
+ # from plannedWrites is NOT a failure and must not be reported as BLOCKED.
193
+ # RULES = the rules tree under .peaks/standards/** (2.0 canonical layout) or
194
+ # .claude/rules/** (legacy 1.x project still carrying a thick .claude/rules/ tree).
195
+ # The relativePaths in plannedWrites tell you which one this project uses.
196
+ #
197
+ # Verify the body landed:
198
+ ls <repo>/AGENTS.md
178
199
  # "No such file" → BLOCKED. Run `peaks standards init --project <repo> --apply --json`
179
200
  # (first time) or `peaks standards update --project <repo> --apply --json` (existing).
180
- ls <repo>/.claude/rules/common/coding-style.md \
181
- <repo>/.claude/rules/common/code-review.md \
182
- <repo>/.claude/rules/common/security.md
183
- # Any "No such file" → BLOCKED. The standards apply step did not complete; re-run
184
- # standards init/update with --apply and re-verify.
201
+ #
202
+ # Judge the result from the JSON, not from a hard-coded path list:
203
+ # BLOCKED when plannedWrites is empty, or when any entry has status 'planned'
204
+ # (that required standards file is absent).
205
+ # PASS otherwise. `init` never reports 'appended' / 'review' — when the update
206
+ # dry-run does, report each one as a follow-up:
207
+ # 'appended' → `peaks standards update --project <repo> --apply` adds the managed block;
208
+ # 'review' → the managed block differs; a human decides (see `peaks standards update`).
209
+ #
210
+ # Any 'planned' entry → BLOCKED. Re-run standards init/update with --apply and re-verify.
185
211
  # Skipping Peaks-Loop Gate G (e.g. because the user did not explicitly authorize writes) is
186
212
  # only acceptable in `assisted`/`strict` modes where the user actively declined; in
187
213
  # `full-auto`/`24h` the absence of these files is a workflow violation.
@@ -8,8 +8,10 @@ description: Non-code orchestrator for content workflows (draft / edit / publish
8
8
  ## Loop hygiene (every turn — MANDATORY)
9
9
 
10
10
  **Skill header.** While this skill is active, open every turn with
11
- `Peaks-Loop Skill: <skill> | Peaks-Loop Gate: <gate> | Next: <one short action>`.
11
+ `Peaks-Loop Skill: <skill> | Peaks-Loop Role: <role> | Peaks-Loop Gate: <gate> | Peaks-Loop Context: <ratio%> (<zone>) | Next: <one short action>`.
12
12
  Every turn, not only the first — it is how the user knows which skill is driving.
13
+ `Role` and `Context` are machine facts: copy them from `peaks skill presence --json`
14
+ (`data.role`, `data.context.ratioPct`, `data.context.action`) — never invent them.
13
15
 
14
16
  **Context is this skill's own business.** Run `peaks skill presence --json` every turn and
15
17
  read its `context` block. When `action` is `auto-fire`, `pre-compact`, or `red-line`,
@@ -9,8 +9,10 @@ visibility: internal
9
9
  ## Loop hygiene (every turn — MANDATORY)
10
10
 
11
11
  **Skill header.** While this skill is active, open every turn with
12
- `Peaks-Loop Skill: <skill> | Peaks-Loop Gate: <gate> | Next: <one short action>`.
12
+ `Peaks-Loop Skill: <skill> | Peaks-Loop Role: <role> | Peaks-Loop Gate: <gate> | Peaks-Loop Context: <ratio%> (<zone>) | Next: <one short action>`.
13
13
  Every turn, not only the first — it is how the user knows which skill is driving.
14
+ `Role` and `Context` are machine facts: copy them from `peaks skill presence --json`
15
+ (`data.role`, `data.context.ratioPct`, `data.context.action`) — never invent them.
14
16
 
15
17
  **Context is this skill's own business.** Run `peaks skill presence --json` every turn and
16
18
  read its `context` block. When `action` is `auto-fire`, `pre-compact`, or `red-line`,
@@ -8,8 +8,10 @@ description: Final-review skill for Peaks. Use when a workflow needs to assemble
8
8
  ## Loop hygiene (every turn — MANDATORY)
9
9
 
10
10
  **Skill header.** While this skill is active, open every turn with
11
- `Peaks-Loop Skill: <skill> | Peaks-Loop Gate: <gate> | Next: <one short action>`.
11
+ `Peaks-Loop Skill: <skill> | Peaks-Loop Role: <role> | Peaks-Loop Gate: <gate> | Peaks-Loop Context: <ratio%> (<zone>) | Next: <one short action>`.
12
12
  Every turn, not only the first — it is how the user knows which skill is driving.
13
+ `Role` and `Context` are machine facts: copy them from `peaks skill presence --json`
14
+ (`data.role`, `data.context.ratioPct`, `data.context.action`) — never invent them.
13
15
 
14
16
  **Context is this skill's own business.** Run `peaks skill presence --json` every turn and
15
17
  read its `context` block. When `action` is `auto-fire`, `pre-compact`, or `red-line`,
@@ -9,8 +9,10 @@ visibility: internal
9
9
  ## Loop hygiene (every turn — MANDATORY)
10
10
 
11
11
  **Skill header.** While this skill is active, open every turn with
12
- `Peaks-Loop Skill: <skill> | Peaks-Loop Gate: <gate> | Next: <one short action>`.
12
+ `Peaks-Loop Skill: <skill> | Peaks-Loop Role: <role> | Peaks-Loop Gate: <gate> | Peaks-Loop Context: <ratio%> (<zone>) | Next: <one short action>`.
13
13
  Every turn, not only the first — it is how the user knows which skill is driving.
14
+ `Role` and `Context` are machine facts: copy them from `peaks skill presence --json`
15
+ (`data.role`, `data.context.ratioPct`, `data.context.action`) — never invent them.
14
16
 
15
17
  **Context is this skill's own business.** Run `peaks skill presence --json` every turn and
16
18
  read its `context` block. When `action` is `auto-fire`, `pre-compact`, or `red-line`,
@@ -8,8 +8,10 @@ description: 'End-to-end orchestrator that surveys open issues in a target repo,
8
8
  ## Loop hygiene (every turn — MANDATORY)
9
9
 
10
10
  **Skill header.** While this skill is active, open every turn with
11
- `Peaks-Loop Skill: <skill> | Peaks-Loop Gate: <gate> | Next: <one short action>`.
11
+ `Peaks-Loop Skill: <skill> | Peaks-Loop Role: <role> | Peaks-Loop Gate: <gate> | Peaks-Loop Context: <ratio%> (<zone>) | Next: <one short action>`.
12
12
  Every turn, not only the first — it is how the user knows which skill is driving.
13
+ `Role` and `Context` are machine facts: copy them from `peaks skill presence --json`
14
+ (`data.role`, `data.context.ratioPct`, `data.context.action`) — never invent them.
13
15
 
14
16
  **Context is this skill's own business.** Run `peaks skill presence --json` every turn and
15
17
  read its `context` block. When `action` is `auto-fire`, `pre-compact`, or `red-line`,
@@ -131,7 +133,7 @@ Closes #<NNNNN>
131
133
  ```
132
134
 
133
135
  - **Author identity** = local gitconfig `user.name` / `user.email`. Must NOT be overridden to an AI name.
134
- - **No** `Co-Authored-By: Claude / Anthropic / MiniMax` trailer — CLAUDE.md red rule.
136
+ - **No** `Co-Authored-By: Claude / Anthropic / MiniMax` trailer — AGENTS.md red rule (the repo's root constitution file; `CLAUDE.md` is only the `@AGENTS.md` pointer).
135
137
  - Tests: if the touched area has a test, run it before commit; if not, add one. Capture test output in the per-issue PR body.
136
138
 
137
139
  ### 6. Relocate commits to per-issue branches
@@ -304,7 +306,7 @@ What this skill MUST NOT do:
304
306
  - **Edit upstream history** (no interactive rebase, no `git filter-branch`, no commit signing on someone else's behalf).
305
307
  - **Write to security-critical paths** (OAuth, secrets, agent loop, model router, prompt cache — see RL-2).
306
308
  - **Change the user identity** in git (no `git config user.name "Claude"`, no `git -c user.email=...` override).
307
- - **Add `Co-Authored-By: <AI>` trailers** — CLAUDE.md red rule.
309
+ - **Add `Co-Authored-By: <AI>` trailers** — AGENTS.md red rule (the repo's root constitution file; `CLAUDE.md` is only the `@AGENTS.md` pointer).
308
310
  - **Hand-author JSON or SKILL.md on the user's behalf** when the user is just describing a target.
309
311
  - **Create a `loop_release` / `bee_release` / `crystallization_event`** in peaks-loop's own SkillHub (this is a non-crystallizing orchestrator; see "Loop Engineering role").
310
312
 
@@ -8,8 +8,10 @@ description: Fast lane for code work — this window edits source directly, with
8
8
  ## Loop hygiene (every turn — MANDATORY)
9
9
 
10
10
  **Skill header.** While this skill is active, open every turn with
11
- `Peaks-Loop Skill: <skill> | Peaks-Loop Gate: <gate> | Next: <one short action>`.
11
+ `Peaks-Loop Skill: <skill> | Peaks-Loop Role: <role> | Peaks-Loop Gate: <gate> | Peaks-Loop Context: <ratio%> (<zone>) | Next: <one short action>`.
12
12
  Every turn, not only the first — it is how the user knows which skill is driving.
13
+ `Role` and `Context` are machine facts: copy them from `peaks skill presence --json`
14
+ (`data.role`, `data.context.ratioPct`, `data.context.action`) — never invent them.
13
15
 
14
16
  **Context is this skill's own business.** Run `peaks skill presence --json` every turn and
15
17
  read its `context` block. When `action` is `auto-fire`, `pre-compact`, or `red-line`,
@@ -8,8 +8,10 @@ description: Universal resume primitive for any in-flight Peaks-Loop workflow (o
8
8
  ## Loop hygiene (every turn — MANDATORY)
9
9
 
10
10
  **Skill header.** While this skill is active, open every turn with
11
- `Peaks-Loop Skill: <skill> | Peaks-Loop Gate: <gate> | Next: <one short action>`.
11
+ `Peaks-Loop Skill: <skill> | Peaks-Loop Role: <role> | Peaks-Loop Gate: <gate> | Peaks-Loop Context: <ratio%> (<zone>) | Next: <one short action>`.
12
12
  Every turn, not only the first — it is how the user knows which skill is driving.
13
+ `Role` and `Context` are machine facts: copy them from `peaks skill presence --json`
14
+ (`data.role`, `data.context.ratioPct`, `data.context.action`) — never invent them.
13
15
 
14
16
  **Context is this skill's own business.** Run `peaks skill presence --json` every turn and
15
17
  read its `context` block. When `action` is `auto-fire`, `pre-compact`, or `red-line`,
@@ -8,8 +8,10 @@ description: Run multi-pass slice decomposition on a PRD-ready request and emit
8
8
  ## Loop hygiene (every turn — MANDATORY)
9
9
 
10
10
  **Skill header.** While this skill is active, open every turn with
11
- `Peaks-Loop Skill: <skill> | Peaks-Loop Gate: <gate> | Next: <one short action>`.
11
+ `Peaks-Loop Skill: <skill> | Peaks-Loop Role: <role> | Peaks-Loop Gate: <gate> | Peaks-Loop Context: <ratio%> (<zone>) | Next: <one short action>`.
12
12
  Every turn, not only the first — it is how the user knows which skill is driving.
13
+ `Role` and `Context` are machine facts: copy them from `peaks skill presence --json`
14
+ (`data.role`, `data.context.ratioPct`, `data.context.action`) — never invent them.
13
15
 
14
16
  **Context is this skill's own business.** Run `peaks skill presence --json` every turn and
15
17
  read its `context` block. When `action` is `auto-fire`, `pre-compact`, or `red-line`,
@@ -19,8 +19,10 @@ metadata:
19
19
  ## Loop hygiene (every turn — MANDATORY)
20
20
 
21
21
  **Skill header.** While this skill is active, open every turn with
22
- `Peaks-Loop Skill: <skill> | Peaks-Loop Gate: <gate> | Next: <one short action>`.
22
+ `Peaks-Loop Skill: <skill> | Peaks-Loop Role: <role> | Peaks-Loop Gate: <gate> | Peaks-Loop Context: <ratio%> (<zone>) | Next: <one short action>`.
23
23
  Every turn, not only the first — it is how the user knows which skill is driving.
24
+ `Role` and `Context` are machine facts: copy them from `peaks skill presence --json`
25
+ (`data.role`, `data.context.ratioPct`, `data.context.action`) — never invent them.
24
26
 
25
27
  **Context is this skill's own business.** Run `peaks skill presence --json` every turn and
26
28
  read its `context` block. When `action` is `auto-fire`, `pre-compact`, or `red-line`,
@@ -8,8 +8,10 @@ description: 'Authoring skill for user-defined SOPs (standard operating procedur
8
8
  ## Loop hygiene (every turn — MANDATORY)
9
9
 
10
10
  **Skill header.** While this skill is active, open every turn with
11
- `Peaks-Loop Skill: <skill> | Peaks-Loop Gate: <gate> | Next: <one short action>`.
11
+ `Peaks-Loop Skill: <skill> | Peaks-Loop Role: <role> | Peaks-Loop Gate: <gate> | Peaks-Loop Context: <ratio%> (<zone>) | Next: <one short action>`.
12
12
  Every turn, not only the first — it is how the user knows which skill is driving.
13
+ `Role` and `Context` are machine facts: copy them from `peaks skill presence --json`
14
+ (`data.role`, `data.context.ratioPct`, `data.context.action`) — never invent them.
13
15
 
14
16
  **Context is this skill's own business.** Run `peaks skill presence --json` every turn and
15
17
  read its `context` block. When `action` is `auto-fire`, `pre-compact`, or `red-line`,
@@ -82,7 +84,7 @@ peaks skill presence:set peaks-sop --project <repo> --mode <mode> --gate startup
82
84
  peaks project memories --project <repo> --json
83
85
  ```
84
86
 
85
- Then display: `Peaks-Loop Skill: peaks-sop | Peaks-Loop Gate: startup | Next: <one short action>`. Update gates with `peaks skill presence:set peaks-sop --project <repo> --mode <mode> --gate <gate>` when they change. When the SOP is registered and the user is satisfied, run `peaks skill presence:clear --project <repo>`.
87
+ Then display: `Peaks-Loop Skill: peaks-sop | Peaks-Loop Role: <role> | Peaks-Loop Gate: startup | Peaks-Loop Context: <ratio%> (<zone>) | Next: <one short action>`. `Role` and `Context` are machine facts: copy them from `peaks skill presence --json` (`data.role`, `data.context.ratioPct`, `data.context.action`) — never invent them. Update gates with `peaks skill presence:set peaks-sop --project <repo> --mode <mode> --gate <gate>` when they change. When the SOP is registered and the user is satisfied, run `peaks skill presence:clear --project <repo>`.
86
88
 
87
89
  ## Responsibilities
88
90
 
@@ -8,8 +8,10 @@ description: Universal status primitive for any in-flight Peaks-Loop workflow (o
8
8
  ## Loop hygiene (every turn — MANDATORY)
9
9
 
10
10
  **Skill header.** While this skill is active, open every turn with
11
- `Peaks-Loop Skill: <skill> | Peaks-Loop Gate: <gate> | Next: <one short action>`.
11
+ `Peaks-Loop Skill: <skill> | Peaks-Loop Role: <role> | Peaks-Loop Gate: <gate> | Peaks-Loop Context: <ratio%> (<zone>) | Next: <one short action>`.
12
12
  Every turn, not only the first — it is how the user knows which skill is driving.
13
+ `Role` and `Context` are machine facts: copy them from `peaks skill presence --json`
14
+ (`data.role`, `data.context.ratioPct`, `data.context.action`) — never invent them.
13
15
 
14
16
  **Context is this skill's own business.** Run `peaks skill presence --json` every turn and
15
17
  read its `context` block. When `action` is `auto-fire`, `pre-compact`, or `red-line`,
@@ -8,8 +8,10 @@ description: Universal test-runner primitive for any in-flight Peaks-Loop workfl
8
8
  ## Loop hygiene (every turn — MANDATORY)
9
9
 
10
10
  **Skill header.** While this skill is active, open every turn with
11
- `Peaks-Loop Skill: <skill> | Peaks-Loop Gate: <gate> | Next: <one short action>`.
11
+ `Peaks-Loop Skill: <skill> | Peaks-Loop Role: <role> | Peaks-Loop Gate: <gate> | Peaks-Loop Context: <ratio%> (<zone>) | Next: <one short action>`.
12
12
  Every turn, not only the first — it is how the user knows which skill is driving.
13
+ `Role` and `Context` are machine facts: copy them from `peaks skill presence --json`
14
+ (`data.role`, `data.context.ratioPct`, `data.context.action`) — never invent them.
13
15
 
14
16
  **Context is this skill's own business.** Run `peaks skill presence --json` every turn and
15
17
  read its `context` block. When `action` is `auto-fire`, `pre-compact`, or `red-line`,