peaks-loop 4.0.0-beta → 4.0.0-beta.2
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.
- package/CHANGELOG.md +105 -87
- package/README-en.md +1 -1
- package/README.md +1 -1
- package/dist/src/cli/commands/{solo-commands.d.ts → code-commands.d.ts} +24 -24
- package/dist/src/cli/commands/{solo-commands.js → code-commands.js} +78 -78
- package/dist/src/cli/commands/core/skill-command.js +1 -1
- package/dist/src/cli/commands/dispatch-from-dag.js +1 -1
- package/dist/src/cli/commands/hook-handle.js +7 -7
- package/dist/src/cli/commands/job-commands.js +2 -2
- package/dist/src/cli/commands/session-auto-compact-hook-command.js +2 -2
- package/dist/src/cli/commands/sub-agent-shared.d.ts +1 -1
- package/dist/src/cli/commands/user-touchpoint-commands.d.ts +4 -4
- package/dist/src/cli/commands/user-touchpoint-commands.js +14 -14
- package/dist/src/cli/commands/workflow-commands.js +22 -22
- package/dist/src/cli/program.js +6 -6
- package/dist/src/services/artifacts/repair-cycle-service.js +1 -1
- package/dist/src/services/audit/enforcers/active-skill-resolver.d.ts +1 -1
- package/dist/src/services/audit/enforcers/active-skill-resolver.js +1 -1
- package/dist/src/services/audit/enforcers/{solo-code-ban.d.ts → code-ban.d.ts} +6 -6
- package/dist/src/services/audit/enforcers/{solo-code-ban.js → code-ban.js} +6 -6
- package/dist/src/services/audit/red-line-catalog.d.ts +2 -2
- package/dist/src/services/audit/red-line-catalog.js +5 -5
- package/dist/src/services/audit/types.d.ts +2 -2
- package/dist/src/services/{solo → code}/auto-compact-orchestrator.d.ts +1 -1
- package/dist/src/services/{solo → code}/auto-compact-orchestrator.js +3 -3
- package/dist/src/services/{solo → code}/dag-orchestrator.d.ts +1 -1
- package/dist/src/services/{solo → code}/dag-orchestrator.js +1 -1
- package/dist/src/services/{solo → code}/emit-handoff.d.ts +1 -1
- package/dist/src/services/{solo → code}/emit-handoff.js +1 -1
- package/dist/src/services/{solo → code}/job-shape-decision.d.ts +1 -1
- package/dist/src/services/{solo → code}/job-shape-decision.js +5 -5
- package/dist/src/services/{solo → code}/mode-gate.d.ts +9 -9
- package/dist/src/services/{solo → code}/mode-gate.js +5 -5
- package/dist/src/services/{solo → code}/post-compact-detector.d.ts +3 -3
- package/dist/src/services/{solo → code}/post-compact-detector.js +4 -4
- package/dist/src/services/{solo → code}/step-08-gate.d.ts +4 -4
- package/dist/src/services/{solo → code}/step-08-gate.js +4 -4
- package/dist/src/services/{solo → code}/user-touchpoint-classifier.d.ts +1 -1
- package/dist/src/services/{solo → code}/user-touchpoint-classifier.js +1 -1
- package/dist/src/services/context/auto-compact-dispatcher.d.ts +2 -2
- package/dist/src/services/context/auto-compact-dispatcher.js +2 -2
- package/dist/src/services/context/auto-compact-types.d.ts +1 -1
- package/dist/src/services/dispatch/slice-dag.d.ts +2 -2
- package/dist/src/services/dispatch/test-tool-detection.d.ts +1 -1
- package/dist/src/services/dispatch/test-tool-detection.js +1 -1
- package/dist/src/services/feedback/feedback-promotion-service.js +2 -2
- package/dist/src/services/job/job-progress-store.d.ts +1 -1
- package/dist/src/services/job/job-progress-store.js +1 -1
- package/dist/src/services/preferences/preferences-service.d.ts +1 -1
- package/dist/src/services/preferences/preferences-types.d.ts +1 -1
- package/dist/src/services/rd/standards-diagnostic.d.ts +1 -1
- package/dist/src/services/rd/standards-diagnostic.js +2 -2
- package/dist/src/services/recommendations/capability-seed-items.js +1 -1
- package/dist/src/services/recommendations/capability-seed-mappings.js +1 -1
- package/dist/src/services/recommendations/recommendation-service.js +1 -1
- package/dist/src/services/refactor/refactor-service.d.ts +1 -1
- package/dist/src/services/signal/cancel-handler.js +3 -3
- package/dist/src/services/skill/resume-detector.js +1 -1
- package/dist/src/services/skills/skill-presence-service.d.ts +1 -1
- package/dist/src/services/upgrade/1x-detector-service.js +1 -1
- package/dist/src/services/workflow/pipeline-verify-service.d.ts +1 -1
- package/dist/src/services/workflow/pipeline-verify-service.js +3 -3
- package/dist/src/services/workflow/workflow-autonomous-service.d.ts +3 -3
- package/dist/src/services/workflow/workflow-autonomous-service.js +2 -2
- package/dist/src/services/workflow/workflow-router-service.d.ts +6 -6
- package/dist/src/services/workflow/workflow-router-service.js +33 -33
- package/dist/src/services/workspace/claude-settings-template.d.ts +1 -1
- package/dist/src/services/workspace/claude-settings-template.js +5 -5
- package/dist/src/shared/version.d.ts +1 -1
- package/dist/src/shared/version.js +1 -1
- package/output-styles/peaks-skill-swarm.md +3 -3
- package/package.json +1 -1
- package/skills/bee/peaks-qa/SKILL.md +1 -1
- package/skills/bee/peaks-qa/references/artifact-per-request.md +3 -3
- package/skills/bee/peaks-qa/references/qa-sub-agent-dispatch.md +6 -6
- package/skills/bee/peaks-rd/references/rd-fanout-contracts.md +1 -1
- package/skills/bee/peaks-rd/references/rd-runbook.md +1 -1
- package/skills/bee/peaks-rd/references/rd-sub-agent-dispatch.md +11 -11
- package/skills/bee/peaks-rd/references/rd-transition-gates.md +1 -1
- package/skills/bee/peaks-sc/SKILL.md +1 -1
- package/skills/bee/peaks-txt/SKILL.md +3 -3
- package/skills/bee/peaks-ui/SKILL.md +8 -8
- package/skills/peaks-code/SKILL.md +21 -21
- package/skills/peaks-code/references/anchoring-and-session-info.md +2 -2
- package/skills/peaks-code/references/artifact-contracts.md +1 -1
- package/skills/peaks-code/references/boundaries.md +3 -3
- package/skills/peaks-code/references/codegraph-orchestration.md +1 -1
- package/skills/peaks-code/references/dag-orchestrator.md +7 -7
- package/skills/peaks-code/references/external-references.md +2 -2
- package/skills/peaks-code/references/fanout-mandatory.md +3 -3
- package/skills/peaks-code/references/fast-mode.md +2 -2
- package/skills/peaks-code/references/frontend-only-mode.md +9 -9
- package/skills/peaks-code/references/job-loop.md +1 -1
- package/skills/peaks-code/references/local-artifact-workspace.md +2 -2
- package/skills/peaks-code/references/micro-cycle.md +14 -14
- package/skills/peaks-code/references/mode-selection-with-stale-presence.md +5 -5
- package/skills/peaks-code/references/mode-selection.md +3 -3
- package/skills/peaks-code/references/openspec-workflow.md +16 -16
- package/skills/peaks-code/references/periodic-checkpoint.md +4 -4
- package/skills/peaks-code/references/quality-gate-cheatsheet.md +1 -1
- package/skills/peaks-code/references/refactor-mode.md +1 -1
- package/skills/peaks-code/references/runbook.md +15 -15
- package/skills/peaks-code/references/step-0-55-1x-detection.md +1 -1
- package/skills/peaks-code/references/step-0-8-gate.md +11 -11
- package/skills/peaks-code/references/sub-agent-dispatch.md +8 -8
- package/skills/peaks-code/references/swarm-dispatch-contract.md +17 -17
- package/skills/peaks-code/references/workflow-gates-and-types.md +2 -2
- package/skills/peaks-code/references/workflow.md +5 -5
- package/skills/peaks-resume/SKILL.md +2 -2
- package/skills/peaks-status/SKILL.md +2 -2
- package/skills/peaks-test/SKILL.md +2 -2
- /package/dist/src/services/{solo → code}/batch-heartbeat-poller.d.ts +0 -0
- /package/dist/src/services/{solo → code}/batch-heartbeat-poller.js +0 -0
- /package/dist/src/services/{solo → code}/status-line-renderer.d.ts +0 -0
- /package/dist/src/services/{solo → code}/status-line-renderer.js +0 -0
|
@@ -15,9 +15,9 @@ Every sub-agent dispatch (`peaks-prd`, `peaks-rd`, `peaks-qa`, `peaks-ui`, `peak
|
|
|
15
15
|
|
|
16
16
|
Never create `.peaks/_runtime/<YYYY-MM-DD-*>/` at the top level of `.peaks/`. ALL reviewable artifact dirs live under `.peaks/_runtime/<sessionId>/<role>/...` (gitignored) — never as siblings of `.peaks/_runtime/`. `peaks workspace init` creates only `.peaks/_runtime/<sessionId>/session.json`. If you find yourself about to write a date-prefixed directory directly under `.peaks/`, STOP and reroute under `.peaks/_runtime/<sessionId>/`. The `.gitignore` rule + vitest guard at `tests/unit/workspace/top-level-change-id-guard.test.ts` enforce this.
|
|
17
17
|
|
|
18
|
-
# Peaks-Loop
|
|
18
|
+
# Peaks-Loop Code
|
|
19
19
|
|
|
20
|
-
Peaks-Loop
|
|
20
|
+
Peaks-Loop Code is the orchestration facade for the Peaks-Loop short skill family. Use it to identify the user scenario, recommend an execution mode, coordinate role skills, and produce the final handoff report. Do not collapse role responsibilities into this skill.
|
|
21
21
|
|
|
22
22
|
## 产品定位(2026-06-28 校准)
|
|
23
23
|
|
|
@@ -29,7 +29,7 @@ This skill is the **primary surface**. The `peaks <cmd>` CLI is **auxiliary**
|
|
|
29
29
|
|
|
30
30
|
## Code-Change Red Line (BLOCKING — read before ANY tool call)
|
|
31
31
|
|
|
32
|
-
**Peaks-Loop
|
|
32
|
+
**Peaks-Loop Code is an orchestrator, NOT an implementer. You MUST NOT write, edit, or modify any application source code directly.** Every code change goes through `peaks-code → RD → QA → verdict`. **If you catch yourself about to write code, STOP.** Hand off to RD. Before declaring workflow complete, run `peaks workflow verify-pipeline --rid <rid> --project <repo> --json`.
|
|
33
33
|
|
|
34
34
|
## Peaks-Loop Startup sequence (MANDATORY — execute in order)
|
|
35
35
|
|
|
@@ -43,7 +43,7 @@ When a NEW conversation opens on a session whose `lastActivity` is from today AN
|
|
|
43
43
|
|
|
44
44
|
### Peaks-Loop Step N: Periodic checkpoint (auto-fire, no user action)
|
|
45
45
|
|
|
46
|
-
Proactive context-overflow defense. CLI: `peaks session checkpoint [--reason <r>] [...flags]`. Fire `--reason periodic` every 20 tool calls (G1 hard-coded), `--reason artifact-written` per PRD/RD/QA/TXT write. See `references/periodic-checkpoint.md` (otherwise `tests/unit/
|
|
46
|
+
Proactive context-overflow defense. CLI: `peaks session checkpoint [--reason <r>] [...flags]`. Fire `--reason periodic` every 20 tool calls (G1 hard-coded), `--reason artifact-written` per PRD/RD/QA/TXT write. See `references/periodic-checkpoint.md` (otherwise `tests/unit/code/checkpoint-periodic-frequency.test.ts` fails).
|
|
47
47
|
|
|
48
48
|
### Peaks-Loop Step 0.5: OpenSpec first-run opt-in (conditional)
|
|
49
49
|
|
|
@@ -61,7 +61,7 @@ After autonomous work (RD, QA, security, perf), invoke peaks-final-review for 4-
|
|
|
61
61
|
|
|
62
62
|
### Peaks-Loop Step N+2: Main-session context monitor (D6 + slice 2026-07-02)
|
|
63
63
|
|
|
64
|
-
After every 4th tool call, probe via `peaks
|
|
64
|
+
After every 4th tool call, probe via `peaks code context-now --project <repo> --json`. Thresholds: 50% / **0.85 pre-compact / 0.95 red-line** (v2.13.0). **In Job mode ≥ 0.85 is MANDATORY auto-compact** (not advisory): Code MUST call `peaks session auto-compact --execute --project <repo>` autonomously. Pass `--enforce-job-mode` to force the MANDATORY semantics in single-rid mode too (`job-shape.json` auto-enables it). **≥ 0.95** red line: next Bash/Task call fires `peaks session auto-compact-hook` (PreToolUse), in-band spawning `claude --compact`. **Karpathy §4 exception**: compact red line keeps runner alive → zero-intervention wins; LLM MUST NOT ask user to run `/compact`. Honor `--in-flight-batch` (D6.e).
|
|
65
65
|
|
|
66
66
|
### Peaks-Loop Step 0: Anchor the workflow (MANDATORY FIRST ACTIONS — no bail-out)
|
|
67
67
|
|
|
@@ -79,9 +79,9 @@ Run `peaks workspace init` + `peaks skill presence:set peaks-code` BEFORE any an
|
|
|
79
79
|
|
|
80
80
|
After Step 0, run the resume-detection probe; surface via `AskUserQuestion` if a slice is in flight.
|
|
81
81
|
|
|
82
|
-
**v3.1.2 resume rule:** if `.peaks/_runtime/<sessionId>/job/<jid>/progress.json` exists, read it FIRST and surface `Next: slice #N of M (<currentSlice>)`. `peaks job progress --job-id <jid> [--allow-missing]` is the canonical reader; the same JSON is surfaced by `peaks
|
|
82
|
+
**v3.1.2 resume rule:** if `.peaks/_runtime/<sessionId>/job/<jid>/progress.json` exists, read it FIRST and surface `Next: slice #N of M (<currentSlice>)`. `peaks job progress --job-id <jid> [--allow-missing]` is the canonical reader; the same JSON is surfaced by `peaks code gate-step-08` on every Bash call.
|
|
83
83
|
|
|
84
|
-
**v2.11.0 D7 override:** if user just `/compact`ed, run `peaks
|
|
84
|
+
**v2.11.0 D7 override:** if user just `/compact`ed, run `peaks code post-compact-detect --project <repo> --json` FIRST; `shouldAutoResume: true` skips AskUserQuestion (D7.b). Log to `.peaks/_runtime/<sessionId>/txt/auto-decisions.md`.
|
|
85
85
|
|
|
86
86
|
→ see `references/resume-detection.md`.
|
|
87
87
|
|
|
@@ -91,15 +91,15 @@ After Step 0.7 returns "fresh", run `peaks upgrade --detect-1x --project <root>
|
|
|
91
91
|
|
|
92
92
|
### Peaks-Loop Step 0.8 — Job 启动 (BLOCKING on LLM judgement — v3.1.1 patch + v3.1.2 mechanical gates)
|
|
93
93
|
|
|
94
|
-
The CLI is a **recorder + gate** for job-shape (the LLM judges). LLM calls `peaks
|
|
94
|
+
The CLI is a **recorder + gate** for job-shape (the LLM judges). LLM calls `peaks code detect-job --is-job <bool> --rationale <text> --suggested-job-id <jid> --suggested-strategy <single|rotating> --confidence <high|medium|low>`, which writes `.peaks/_runtime/<sessionId>/job-shape.json`. Downstream steps call `read-job-shape` and refuse if missing.
|
|
95
95
|
|
|
96
|
-
**Hard rule (v3.1.1 red-line #10):** LLM MUST NOT skip `peaks
|
|
96
|
+
**Hard rule (v3.1.1 red-line #10):** LLM MUST NOT skip `peaks code detect-job`. If `read-job-shape` throws `JOB_SHAPE_NOT_DECIDED`, record a decision before proceeding.
|
|
97
97
|
|
|
98
98
|
**v3.1.2 mechanical gates** (recorder-only was bypassed twice):
|
|
99
99
|
|
|
100
|
-
- **PreToolUse hook** — `peaks workspace init` installs the `Bash` matcher `peaks
|
|
101
|
-
- **Size-fear ban** — `peaks
|
|
102
|
-
- **Forced auto-compact** — `peaks
|
|
100
|
+
- **PreToolUse hook** — `peaks workspace init` installs the `Bash` matcher `peaks code gate-step-08 --project .`. Exits 0 when `job-shape.json` exists (also emits `Next: slice #N+1 of M` from `progress.json`); exits 2 BLOCKED when missing AND prompt matches a fail-closed backup regex; otherwise 0 (allow).
|
|
101
|
+
- **Size-fear ban** — `peaks code emit-handoff` refuses a final handoff while `remaining > 0` under Job mode.
|
|
102
|
+
- **Forced auto-compact** — `peaks code context-now --enforce-job-mode` (auto-enabled on `isJob=true`) returns `auto-compact-now` at ≥ 0.85; **In Job mode ≥ 0.85 is MANDATORY auto-compact** (not advisory).
|
|
103
103
|
- **On-disk slice progress** — `peaks job checkpoint --state done` writes `progress.json`; `peaks job progress --job-id <jid> [--allow-missing]` is the canonical reader.
|
|
104
104
|
|
|
105
105
|
Full mechanics (judgement criteria, hook table, backup-regex rationale, hook wiring) at `references/step-0-8-gate.md`.
|
|
@@ -144,7 +144,7 @@ When peaks-code dispatches a sub-agent (peaks-rd, peaks-qa, peaks-ui, peaks-txt,
|
|
|
144
144
|
|
|
145
145
|
## Boundaries
|
|
146
146
|
|
|
147
|
-
Peaks-Loop
|
|
147
|
+
Peaks-Loop Code may: identify scenarios, recommend profiles, coordinate role skills through artifacts, coordinate project memory extraction, request user confirmation at risk/commit boundaries. Peaks-Loop Code must NOT silently install hooks / create agents / enable MCP / modify Claude settings / create GitHub repos / bypass role-skill artifacts. → `references/boundaries.md`.
|
|
148
148
|
|
|
149
149
|
## Peaks-Loop GStack integration
|
|
150
150
|
|
|
@@ -160,7 +160,7 @@ Before handing off to `peaks-rd`, scan the project and record findings to `.peak
|
|
|
160
160
|
|
|
161
161
|
## Peaks-Loop Frontend-only development mode
|
|
162
162
|
|
|
163
|
-
When the project has no live backend (no swagger.json, no API server),
|
|
163
|
+
When the project has no live backend (no swagger.json, no API server), Code must activate frontend-only mode. The CLI is authoritative — read `frontendOnly` and `frontendOnlyReason` from `peaks scan archetype --json`. → `references/frontend-only-mode.md`.
|
|
164
164
|
|
|
165
165
|
## Peaks-Loop Request type classification + Workflow order + Transition verification gates
|
|
166
166
|
|
|
@@ -186,7 +186,7 @@ Write DAG → `.peaks/_runtime/<sessionId>/sc/slice-dag.json`, run `peaks sub-ag
|
|
|
186
186
|
|
|
187
187
|
## Peaks-Loop Mandatory RD QA repair loop (AUTO-PROCEED)
|
|
188
188
|
|
|
189
|
-
After `peaks-rd` finishes,
|
|
189
|
+
After `peaks-rd` finishes, Code MUST auto-route to `peaks-qa` without waiting for confirmation. Cap: 3 cycles; on 3rd failure emit blocked TXT handoff. Full 5-step procedure at `references/micro-cycle.md`.
|
|
190
190
|
|
|
191
191
|
## Default runbook
|
|
192
192
|
|
|
@@ -216,7 +216,7 @@ After final validation, refresh project-local standards via `peaks standards ini
|
|
|
216
216
|
|
|
217
217
|
## Peaks-Loop Step 11: Memory sediment (BLOCKING on workflow complete)
|
|
218
218
|
|
|
219
|
-
> **Hard rule.**
|
|
219
|
+
> **Hard rule.** Code MUST NOT declare a workflow complete until Step 11 has produced ≥ 1 file in `.peaks/memory/` (the durable, LLM-authored memory store) OR the user has explicitly approved a no-sediment outcome via AskUserQuestion. Applies to **all modes** including `assisted` and `strict` — `assisted` previously skipped Step 10 because there was no `[CONFIRM]` gate; Step 11 fixes that.
|
|
220
220
|
|
|
221
221
|
### Substeps (BLOCKING)
|
|
222
222
|
|
|
@@ -228,19 +228,19 @@ After final validation, refresh project-local standards via `peaks standards ini
|
|
|
228
228
|
|
|
229
229
|
**11d — Gate C (zero-write outcome):** If `extractedCount === 0` after 11c, fire AskUserQuestion:
|
|
230
230
|
|
|
231
|
-
> "本次
|
|
231
|
+
> "本次 code 未沉淀任何 `.peaks/memory` 文件。可选: (a) 回去在 handoff.md 嵌入至少 1 个 `peaks-memory:start` block 后重试; (b) 显式接受 no-sediment 并记录为 lesson; (c) 取消完成。"
|
|
232
232
|
|
|
233
|
-
Default option = (a).
|
|
233
|
+
Default option = (a). Code MUST NOT silently accept (b) without user pick. Full bash + flow at `references/runbook.md` §Step 11.
|
|
234
234
|
|
|
235
235
|
**Why this step exists:** audit 2026-07-03 confirmed 2 consecutive sessions produced zero `.peaks/memory/` files despite completing RD + QA + handoff artifacts; `assisted` mode silently skipped runbook Step 10 (no STOP condition). **Why `peaks memory extract` (not `peaks project memories:extract`):** the artifact-scoped extract is canonical; the batch-scoped sibling is for non-handoff flows. Always use `peaks memory extract --apply`.
|
|
236
236
|
|
|
237
237
|
## Peaks-Loop External references and lifecycle
|
|
238
238
|
|
|
239
|
-
3rd-party integrations (codegraph, mattpocock/skills, shadcn/ui, MCPs, Context7) follow Discovery → Reference → Side effect through Peaks CLI only. Run `peaks capabilities` for capability discovery; treat external skills as reference material only. MCP servers (Playwright / Chrome DevTools / Figma) are user-installed — check the tool list for `mcp__<server>__*` entries. Do not execute upstream installer / run upstream commands / persist sensitive examples / install upstream resources directly — funnel side effects through the Peaks CLI surface. Peaks-Loop
|
|
239
|
+
3rd-party integrations (codegraph, mattpocock/skills, shadcn/ui, MCPs, Context7) follow Discovery → Reference → Side effect through Peaks CLI only. Run `peaks capabilities` for capability discovery; treat external skills as reference material only. MCP servers (Playwright / Chrome DevTools / Figma) are user-installed — check the tool list for `mcp__<server>__*` entries. Do not execute upstream installer / run upstream commands / persist sensitive examples / install upstream resources directly — funnel side effects through the Peaks CLI surface. Peaks-Loop Code gates remain authoritative. → `references/external-references.md` + `references/external-skill-invocation.md`.
|
|
240
240
|
|
|
241
241
|
## Codegraph orchestration context
|
|
242
242
|
|
|
243
|
-
`peaks codegraph affected` is an optional project-analysis enhancement (untrusted supporting evidence) for role handoff.
|
|
243
|
+
`peaks codegraph affected` is an optional project-analysis enhancement (untrusted supporting evidence) for role handoff. Code must not treat codegraph output as approval for scope, design, or QA verdict. Never mutate agent settings / hooks from codegraph; do not commit `.codegraph/` artifacts. RD writes `.peaks/_runtime/<sessionId>/rd/codegraph-context.md`; QA / TXT consume the same envelope. → `references/codegraph-orchestration.md`.
|
|
244
244
|
|
|
245
245
|
## Sub-agent context governance (G7 + G7.7 + G8 + G9 — slice #010)
|
|
246
246
|
|
|
@@ -260,7 +260,7 @@ Index of every `references/` file. Read on demand.
|
|
|
260
260
|
| `references/a2a-artifact-mapping.md` | A2A artifact-path mapping. |
|
|
261
261
|
| `references/anchoring-and-session-info.md` | Step 0 + session-conflict. |
|
|
262
262
|
| `references/artifact-contracts.md` | Sub-agent handoff contracts. |
|
|
263
|
-
| `references/boundaries.md` |
|
|
263
|
+
| `references/boundaries.md` | Code's do / don't list. |
|
|
264
264
|
| `references/browser-workflow.md` | Browser workflow (Playwright MCP). |
|
|
265
265
|
| `references/codegraph-orchestration.md` | Codegraph role handoff. |
|
|
266
266
|
| `references/command-migration.md` | Legacy command migration. |
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
# Step 0 — Anchor the workflow
|
|
2
2
|
|
|
3
|
-
> Body of `### Peaks-Loop Step 0: Anchor the workflow`. The instant Peaks-Loop
|
|
3
|
+
> Body of `### Peaks-Loop Step 0: Anchor the workflow`. The instant Peaks-Loop Code is invoked, **before** the mode-selection question, before any analysis, and before you decide whether the request "needs" the full pipeline, you MUST run these two commands and see their output:
|
|
4
4
|
|
|
5
5
|
```bash
|
|
6
6
|
# Session ID is auto-generated when omitted; the command returns it in the JSON output.
|
|
7
7
|
# Do NOT pass --session-id manually — the CLI is the single source of truth for the
|
|
8
8
|
# project session binding. To look up the active session id from a skill / sub-agent,
|
|
9
9
|
# use `peaks session info --active --json` (read-only, no side effects). To avoid
|
|
10
|
-
# the "two sessions in .peaks/" confusion that bites
|
|
10
|
+
# the "two sessions in .peaks/" confusion that bites Code, always omit --session-id
|
|
11
11
|
# here and let the CLI auto-generate.
|
|
12
12
|
peaks workspace init --project <repo> --json
|
|
13
13
|
peaks skill presence:set peaks-code --project <repo> --gate startup
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
Default local artifact root: `.peaks/_runtime/<session-id>/` with role subdirectories `prd/`, `rd/`, `ui/`, `qa/`, `sc/`, and `txt/`.
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
Code coordinates artifact paths and handoff completeness. Keep artifacts local by default. Do not commit, sync, or move them to a git-backed artifact repository unless explicitly authorized.
|
|
6
6
|
|
|
7
7
|
## Artifact file naming conventions
|
|
8
8
|
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
# Boundaries
|
|
2
2
|
|
|
3
|
-
> Body of `## Boundaries`. Peaks-Loop
|
|
3
|
+
> Body of `## Boundaries`. Peaks-Loop Code may:
|
|
4
4
|
|
|
5
5
|
- identify scenarios such as refactor, bugfix, QA hardening, release validation, and incident response;
|
|
6
|
-
- recommend
|
|
6
|
+
- recommend Code, Assisted, Swarm, or Strict profiles;
|
|
7
7
|
- coordinate Peaks-Loop role skills through artifacts;
|
|
8
8
|
- coordinate project memory extraction from stable skill artifact sections;
|
|
9
9
|
- request user confirmation at risk and commit boundaries;
|
|
10
10
|
- read CLI doctor/profile/artifact reports.
|
|
11
11
|
|
|
12
|
-
Peaks-Loop
|
|
12
|
+
Peaks-Loop Code must not silently:
|
|
13
13
|
|
|
14
14
|
- install hooks;
|
|
15
15
|
- create agents;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
# Codegraph orchestration context
|
|
2
2
|
|
|
3
|
-
> Body of `## Codegraph orchestration context`.
|
|
3
|
+
> Body of `## Codegraph orchestration context`. Code treats `peaks codegraph affected --project <path> <changed-files...> --json` as an optional project-analysis enhancement that informs the role handoff between PRD, RD, and QA. The output is untrusted supporting evidence — Code must not treat codegraph output as approval for scope, design, or QA verdict.
|
|
4
4
|
|
|
5
5
|
Do not run upstream installer flows, mutate agent settings, or commit `.codegraph/` artifacts into git. Peaks-Loop gates remain authoritative; codegraph context is a hint, never a substitute for role-skill output.
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
# DAG-aware sub-agent dispatch (2.7.0)
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
to **`runDag(dag, opts)`** in `src/services/
|
|
5
|
-
when a slice's dependency surface is a DAG.
|
|
3
|
+
Code delegates layer-by-layer fan-out + join-barrier + cancel-on-fail
|
|
4
|
+
to **`runDag(dag, opts)`** in `src/services/code/dag-orchestrator.ts`
|
|
5
|
+
when a slice's dependency surface is a DAG. Code MUST NOT re-implement
|
|
6
6
|
these mechanics inline.
|
|
7
7
|
|
|
8
8
|
## When to use `runDag`
|
|
@@ -21,7 +21,7 @@ Use single-role `peaks sub-agent dispatch <role>` for everything else.
|
|
|
21
21
|
## Contract
|
|
22
22
|
|
|
23
23
|
```ts
|
|
24
|
-
import { runDag } from '../services/
|
|
24
|
+
import { runDag } from '../services/code/dag-orchestrator.js';
|
|
25
25
|
const result = await runDag(dag, {
|
|
26
26
|
projectRoot, sessionId, requestId, role, ide,
|
|
27
27
|
dispatch: async (spec) => { /* LLM-side runner executes SubAgentDispatcher.buildToolCall(spec) */ },
|
|
@@ -34,14 +34,14 @@ const result = await runDag(dag, {
|
|
|
34
34
|
## Failure handling
|
|
35
35
|
|
|
36
36
|
Any leaf failure → orchestrator sends `cancel` to in-flight siblings;
|
|
37
|
-
|
|
37
|
+
Code gets partial `DagRunResult`, treats slice as `return-to-rd`,
|
|
38
38
|
re-enters at the failed layer on next repair cycle. Per-IDE timeout:
|
|
39
39
|
trae / trae-cn / cursor 30s, codex 45s, claude-code 60s; uniform
|
|
40
40
|
120_000ms clamp ceiling.
|
|
41
41
|
|
|
42
42
|
## Source-of-truth pointers
|
|
43
43
|
|
|
44
|
-
- Orchestrator: `src/services/
|
|
44
|
+
- Orchestrator: `src/services/code/dag-orchestrator.ts` (`runDag` +
|
|
45
45
|
`buildDispatchSpec` + `formatContractInjection`)
|
|
46
46
|
- DAG model: `src/services/dispatch/slice-dag.ts`
|
|
47
47
|
(`validateDag` / `topologicalLevels` / `sliceReadyToRun` / `hashDag`)
|
|
@@ -50,7 +50,7 @@ trae / trae-cn / cursor 30s, codex 45s, claude-code 60s; uniform
|
|
|
50
50
|
- Contract store: `src/services/dispatch/contract-store.ts`
|
|
51
51
|
- CLI surface: `peaks sub-agent dispatch --from-dag <file> --batch-id <id>`
|
|
52
52
|
and `peaks sub-agent await --batch <id> [--timeout <ms>]`
|
|
53
|
-
- Tests: `tests/unit/
|
|
53
|
+
- Tests: `tests/unit/code/dag-orchestrator.test.ts` (cancel-on-fail),
|
|
54
54
|
`tests/unit/dispatch/run-dag-dogfood-mvp.test.ts` (MVP dogfood),
|
|
55
55
|
`tests/unit/dispatch/slice-dag-dispatcher-5ide-dogfood.test.ts`
|
|
56
56
|
(5 IDE end-to-end).
|
|
@@ -4,13 +4,13 @@
|
|
|
4
4
|
|
|
5
5
|
**Codegraph**: Optional project-analysis before RD handoff. Use `peaks codegraph affected --project <path> <changed-files...> --json` for regression-surface hints. Output as untrusted supporting evidence only; never commit `.codegraph/` artifacts.
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
Code treats `peaks codegraph affected --project <path> <changed-files...> --json` as an optional project-analysis enhancement that informs the role handoff between PRD, RD, and QA. The output is untrusted supporting evidence — Code must not treat codegraph output as approval for scope, design, or QA verdict.
|
|
8
8
|
|
|
9
9
|
Do not run upstream installer flows, mutate agent settings, or commit `.codegraph/` artifacts into git. Peaks-Loop gates remain authoritative; codegraph context is a hint, never a substitute for role-skill output.
|
|
10
10
|
|
|
11
11
|
**External skills**: All external skill references (`mattpocock/skills`, `awesome-design-md`, `taste-skill`, `shadcn/ui`, `Chrome DevTools MCP`, `Figma Context MCP`, `Context7`, etc.) follow the three-stage pattern: capability discovery via `peaks capabilities` before naming, references only (no execute/install/persist), Peaks-Loop CLI for all side effects. Do not execute upstream installers, do not install upstream resources, do not persist sensitive examples — Peaks-Loop gates remain authoritative. External skills inform, they do not approve.
|
|
12
12
|
|
|
13
|
-
**OpenSpec lifecycle**: `render → validate → show → to-rd → validate → archive`.
|
|
13
|
+
**OpenSpec lifecycle**: `render → validate → show → to-rd → validate → archive`. Code's default runbook handles the exit gate (validate → archive after QA pass). Entry-gate validation (to-rd before slicing) is available when `openspec/` exists pre-workflow; Code delegates it to `peaks-rd` during implementation.
|
|
14
14
|
|
|
15
15
|
**MCP lifecycle**: `list → plan → apply --yes → call → rollback`. `apply` backs up settings and refuses non-peaks entries unless `--claim` is passed.
|
|
16
16
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Fan-out is mandatory (slice 2026-06-24-audit-5th-p2)
|
|
2
2
|
|
|
3
|
-
> **Reference contract.** Slice 5 (`feat(
|
|
3
|
+
> **Reference contract.** Slice 5 (`feat(code): default to multi-sub-agent
|
|
4
4
|
> fan-out when DAG has >= 2 same-level leaves`) shipped in 2.8.0 with
|
|
5
5
|
> `'fan-out'` as the default but kept `'serial'` as an opt-out. Slice
|
|
6
6
|
> 2026-06-24-audit-5th-p2 (this slice, 2.8.4) **removes the opt-out** by
|
|
@@ -95,10 +95,10 @@ shape it had pre-slice — the difference is that anything outside
|
|
|
95
95
|
|
|
96
96
|
## Tests
|
|
97
97
|
|
|
98
|
-
- `tests/unit/
|
|
98
|
+
- `tests/unit/code/skills-code-fanout-mandatory.test.ts` — pins that
|
|
99
99
|
SKILL.md still mentions `--from-dag`, does NOT mention `serial`
|
|
100
100
|
opt-out, and references `references/fanout-mandatory.md`.
|
|
101
|
-
- `tests/integration/
|
|
101
|
+
- `tests/integration/code/multi-sub-agent-fanout.test.ts` — pins the
|
|
102
102
|
runtime fan-out behavior; not affected by this slice.
|
|
103
103
|
|
|
104
104
|
## Rollout
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
#
|
|
1
|
+
# Code fast mode (slice 2 — round-trip ≤ 30s)
|
|
2
2
|
|
|
3
3
|
For hot-fix / small-bug slices where the full 5-step workflow is overkill,
|
|
4
|
-
use **fast mode**: `peaks
|
|
4
|
+
use **fast mode**: `peaks code plan --fast <change-id>`. Fast mode skips
|
|
5
5
|
three steps that dominate cold-start cost:
|
|
6
6
|
|
|
7
7
|
| Step | Default | Fast |
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
> Extracted from `skills/peaks-code/SKILL.md` on 2026-06-09 (slice 019 — slim skill files to references) to keep SKILL.md under the 800-line cap from `common/coding-style.md`. The content below is the verbatim Frontend-only development mode section that was previously inline; nothing was paraphrased, just relocated.
|
|
4
4
|
|
|
5
|
-
When the project has no live backend (no swagger.json, no API server),
|
|
5
|
+
When the project has no live backend (no swagger.json, no API server), Code must activate frontend-only mode.
|
|
6
6
|
|
|
7
7
|
### Mode determination (deterministic — CLI is the source of truth)
|
|
8
8
|
|
|
@@ -11,13 +11,13 @@ The CLI decision is authoritative. Read `frontendOnly` and `frontendOnlyReason`
|
|
|
11
11
|
User-stated intent is **only** consulted when it conflicts with the CLI result. The two conflict cases:
|
|
12
12
|
|
|
13
13
|
- **CLI says `frontendOnly=false` but the user says "前端项目 / 没有后端 / 先 mock 数据"**: STOP and `AskUserQuestion` to confirm whether to override the scan (the repo probably contains a backend folder the user wants to ignore). Record the override decision and reason in `project-scan.md`.
|
|
14
|
-
- **CLI says `frontendOnly=true` but the user says "需要做后端 / 加 API"**: STOP and `AskUserQuestion` to confirm whether the request actually targets the missing backend (the user may be confused about repo scope, or there is a separate backend repo
|
|
14
|
+
- **CLI says `frontendOnly=true` but the user says "需要做后端 / 加 API"**: STOP and `AskUserQuestion` to confirm whether the request actually targets the missing backend (the user may be confused about repo scope, or there is a separate backend repo Code should switch to).
|
|
15
15
|
|
|
16
16
|
When there is no conflict, do not ask — the CLI value wins and the workflow proceeds.
|
|
17
17
|
|
|
18
18
|
### Mock data strategy selection
|
|
19
19
|
|
|
20
|
-
|
|
20
|
+
Code records the chosen mock strategy in `.peaks/_runtime/<sessionId>/rd/tech-doc.md` under a `## Mock Data Strategy` section. The choice depends on the project scan results:
|
|
21
21
|
|
|
22
22
|
| Project data-fetching pattern | Recommended mock approach | Rationale |
|
|
23
23
|
|---|---|---|
|
|
@@ -59,15 +59,15 @@ When swagger.json becomes available later, the migration follows this sequence:
|
|
|
59
59
|
3. Remove corresponding mock files.
|
|
60
60
|
4. Run QA regression to verify the real API responses match the mock interface contracts.
|
|
61
61
|
|
|
62
|
-
|
|
62
|
+
Code records the migration readiness in the TXT handoff capsule under a `## API Migration` section listing: mock file paths, the corresponding swagger endpoints (when known), and the migration status for each.
|
|
63
63
|
|
|
64
64
|
### Feishu document access fallback
|
|
65
65
|
|
|
66
66
|
When the PRD source is a Feishu/Lark document that requires authentication:
|
|
67
67
|
|
|
68
|
-
1. **Primary path**: Playwright MCP headed browser → user completes login →
|
|
69
|
-
2. **Fallback A (user cannot login)**: Ask user to copy-paste the document content or export as Markdown/PDF.
|
|
70
|
-
3. **Fallback B (user provides export)**: User drops a `.md` or `.pdf` export into `.peaks/_runtime/<sessionId>/prd/source/`.
|
|
68
|
+
1. **Primary path**: Playwright MCP headed browser → user completes login → Code reads document content via `browser_snapshot`.
|
|
69
|
+
2. **Fallback A (user cannot login)**: Ask user to copy-paste the document content or export as Markdown/PDF. Code creates the PRD artifact from the pasted content.
|
|
70
|
+
3. **Fallback B (user provides export)**: User drops a `.md` or `.pdf` export into `.peaks/_runtime/<sessionId>/prd/source/`. Code reads and processes it.
|
|
71
71
|
4. **Fallback C (none of the above)**: Mark PRD as `blocked` with reason `doc-inaccessible`, list the exact next steps for the user, and pause the workflow.
|
|
72
72
|
|
|
73
73
|
Never silently fall back to unauthenticated `fetch` or `WebFetch` for authenticated documents.
|
|
@@ -76,7 +76,7 @@ Never silently fall back to unauthenticated `fetch` or `WebFetch` for authentica
|
|
|
76
76
|
|
|
77
77
|
### Frontend-only trigger pre-flight
|
|
78
78
|
|
|
79
|
-
> Body of `### Frontend-only trigger pre-flight`. Before computing the swarm plan,
|
|
79
|
+
> Body of `### Frontend-only trigger pre-flight`. Before computing the swarm plan, Code runs the keyword scan deterministically:
|
|
80
80
|
|
|
81
81
|
1. Read `.peaks/_runtime/<sessionId>/prd/requests/<rid>.md` body.
|
|
82
82
|
2. Lowercase + strip markdown; check regex `\b(页面|组件|表单|弹窗|表格|样式|布局|交互|UI|UX|page|component|form|modal|table|styling|layout|interaction|frontend|前端)\b`.
|
|
@@ -84,4 +84,4 @@ Never silently fall back to unauthenticated `fetch` or `WebFetch` for authentica
|
|
|
84
84
|
4. If `frontendOnly` (from project-scan) is `true` and no keyword hit → UI joins anyway (frontend-only project, even non-visual changes may need visual sanity for regressions).
|
|
85
85
|
5. If `frontendOnly` is `false` and no keyword hit → UI skipped.
|
|
86
86
|
|
|
87
|
-
|
|
87
|
+
Code records the pre-flight result in `sc/swarm-plan.json` so the audit trail shows why UI was or was not included.
|
|
@@ -50,13 +50,13 @@ system/ # Existing-system extraction output (visual tokens, conventions
|
|
|
50
50
|
|
|
51
51
|
Files written into these directories during the workflow (not pre-created — they appear as their step runs):
|
|
52
52
|
|
|
53
|
-
- `rd/project-scan.md` (
|
|
53
|
+
- `rd/project-scan.md` (Code step 0.6)
|
|
54
54
|
- `rd/tech-doc.md` (feature/refactor planning; required by `rd → implemented` gate)
|
|
55
55
|
- `rd/bug-analysis.md` (bugfix planning; required by `rd → implemented` gate for `--type bugfix`)
|
|
56
56
|
- `rd/code-review.md`, `rd/security-review.md` (required by `rd → qa-handoff` gate for feature/bugfix/refactor; security-review only for config)
|
|
57
57
|
- `rd/mock-plan.md` (frontend-only mode)
|
|
58
58
|
- `ui/design-draft.md` (UI step)
|
|
59
|
-
- `system/existing-system.md` (
|
|
59
|
+
- `system/existing-system.md` (Code step 0.7; legacy projects only)
|
|
60
60
|
- `qa/test-cases/<rid>.md`, `qa/test-reports/<rid>.md`, `qa/security-findings.md`, `qa/performance-findings.md` (gated per `--type`)
|
|
61
61
|
|
|
62
62
|
## Root pollution prohibition (CRITICAL)
|
|
@@ -171,20 +171,20 @@ verdict=return-to-rd → RD 修 (new slice 内部走 micro-cycle)
|
|
|
171
171
|
>
|
|
172
172
|
> When PRD lands, classify the request type before running `peaks request init` for every role — pass `--type <type>` so the artifact records it and downstream transitions enforce the right gates. Misclassifying a feature as `docs` to skip gates is a workflow violation. If a transition fails with `code: PREREQUISITES_MISSING`, the response lists every missing path — produce them, then re-transition. For one-off exceptions, the escape hatch `--allow-incomplete --reason "<text>"` records the bypass in the artifact transition note.
|
|
173
173
|
|
|
174
|
-
After `peaks-rd` finishes any implementation, repair, or code-output slice, Peaks-Loop
|
|
174
|
+
After `peaks-rd` finishes any implementation, repair, or code-output slice, Peaks-Loop Code MUST automatically route the result to `peaks-qa` without waiting for user confirmation. This is not optional in full-auto mode. Code must not declare the workflow complete, emit a TXT handoff, or stop at RD completion.
|
|
175
175
|
|
|
176
|
-
**How
|
|
176
|
+
**How Code invokes another role (mechanism, not metaphor):**
|
|
177
177
|
|
|
178
|
-
|
|
178
|
+
Code is itself a skill running in the current session. There are **two distinct mechanisms** in this skill, and they MUST NOT be confused:
|
|
179
179
|
|
|
180
180
|
1. **Swarm fan-out (planning side, after PRD confirmed)** — uses `peaks sub-agent dispatch <role>` to launch real concurrent sub-agents. The CLI returns a per-IDE tool-call descriptor that the LLM executes in its environment. See "Peaks-Loop Swarm parallel phase" above for the full contract. Sub-agents do NOT call Skill(...) back into the role; they execute the role's instructions inline from the prompt.
|
|
181
|
-
2. **Sequential handoff (execution side, RD↔QA repair loop)** —
|
|
181
|
+
2. **Sequential handoff (execution side, RD↔QA repair loop)** — Code is the only loop, and after RD or QA finishes (whether as a sub-agent or directly), Code drives the next step from the orchestrator seat. Do NOT use the `Skill` tool to "reactivate" peaks-rd or peaks-qa in the main loop; doing so is the v1.x anti-pattern that masqueraded as "calling the role" but actually just re-prompted the same session. From v1.3 onward, the main loop drives roles via the CLI gate (`peaks request transition`) and reads back artefacts (`peaks request show ... --json`); the actual RD/QA work is either done inline by Code (when Code has just been re-invoked by the user) or by a Task sub-agent (in swarm mode).
|
|
182
182
|
|
|
183
|
-
After RD completes (whether inline or sub-agent),
|
|
183
|
+
After RD completes (whether inline or sub-agent), Code does not stop — it must advance to QA. There is no "RD done, ask the user" state in full-auto mode. The only valid stops are: (a) QA verdict=pass, (b) repair cap hit, (c) explicit user cancel.
|
|
184
184
|
|
|
185
|
-
**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/peaks-rd/SKILL.md` "Parallel review fan-out") and waits for all to return before transitioning to `qa-handoff`.
|
|
185
|
+
**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/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.
|
|
186
186
|
|
|
187
|
-
**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
|
|
187
|
+
**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:
|
|
188
188
|
|
|
189
189
|
```bash
|
|
190
190
|
peaks skill presence:set peaks-code --project <repo> --mode <mode> --gate <current-gate>
|
|
@@ -192,13 +192,13 @@ peaks skill presence:set peaks-code --project <repo> --mode <mode> --gate <curre
|
|
|
192
192
|
|
|
193
193
|
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.
|
|
194
194
|
|
|
195
|
-
**Full-auto auto-proceed rule**: In the `full-auto` profile, when RD transitions to `qa-handoff`,
|
|
195
|
+
**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).
|
|
196
196
|
|
|
197
197
|
A QA report with any failing, blocked, missing, or unverified acceptance item is not a pass.
|
|
198
198
|
|
|
199
|
-
**How
|
|
199
|
+
**How Code routes QA findings back to RD (mechanism, not metaphor):**
|
|
200
200
|
|
|
201
|
-
When `peaks-qa` returns `verdict=return-to-rd`,
|
|
201
|
+
When `peaks-qa` returns `verdict=return-to-rd`, Code does NOT manually rewrite RD artifacts. Instead it follows this exact sequence:
|
|
202
202
|
|
|
203
203
|
1. Read the QA verdict and findings via `peaks request show <rid> --role qa --project <repo> --json`. The findings live in the QA artifact body (failing acceptance items, evidence paths, severity).
|
|
204
204
|
2. Transition the RD artifact back from `qa-handoff` to a working state and record the QA verdict in the transition note:
|
|
@@ -209,13 +209,13 @@ When `peaks-qa` returns `verdict=return-to-rd`, Solo does NOT manually rewrite R
|
|
|
209
209
|
```
|
|
210
210
|
`spec-locked` is the canonical "needs more RD work" state. The reason is mandatory in repair cycles so the artifact history shows the loop.
|
|
211
211
|
3. Re-launch `peaks-rd` work. Two paths, mode-driven:
|
|
212
|
-
- **Swarm / full-auto**: launch a fresh `peaks sub-agent dispatch rd` sub-agent (then execute the returned toolCall) with the same `peaks-rd` body used in the Swarm phase, plus the QA findings path so it can read the failure list.
|
|
213
|
-
- **Assisted / strict / inline-fallback**:
|
|
212
|
+
- **Swarm / full-auto**: launch a fresh `peaks sub-agent dispatch rd` sub-agent (then execute the returned toolCall) with the same `peaks-rd` body used in the Swarm phase, plus the QA findings path so it can read the failure list. Code restores presence after the sub-agent returns.
|
|
213
|
+
- **Assisted / strict / inline-fallback**: Code executes the RD repair steps directly in the main loop, since there is no concurrent fan-out to coordinate.
|
|
214
214
|
In both paths, pass the QA findings path so the repair sees what failed.
|
|
215
215
|
4. peaks-rd fixes the reported issues only (red-line scope: do not modify unrelated surfaces), regenerates code-review and security-review evidence if changes touched reviewed surfaces, then transitions `rd → implemented → qa-handoff` again.
|
|
216
|
-
5.
|
|
216
|
+
5. Code re-runs QA (sub-agent Task in swarm/full-auto, inline in assisted/strict) with the same `<request-id>`. QA re-runs gates against the new diff.
|
|
217
217
|
6. Repeat steps 1-5 until QA returns `verdict=pass`, or the cap below fires.
|
|
218
|
-
**After each repair iteration** (after peaks-rd and peaks-qa both return),
|
|
218
|
+
**After each repair iteration** (after peaks-rd and peaks-qa both return), Code MUST restore presence:
|
|
219
219
|
```bash
|
|
220
220
|
peaks skill presence:set peaks-code --project <repo> --mode <mode> --gate repair-cycle-<N>
|
|
221
221
|
```
|
|
@@ -62,14 +62,14 @@ peaks skill presence --check-stale --project <path> --json
|
|
|
62
62
|
|
|
63
63
|
Returns the same `stale` / `reason` / `currentOuterSessionId` / `recordedOuterSessionId` fields attached to the standard presence envelope. Default `false` (back-compat).
|
|
64
64
|
|
|
65
|
-
## Pause integration via `peaks
|
|
65
|
+
## Pause integration via `peaks code should-pause`
|
|
66
66
|
|
|
67
|
-
`peaks
|
|
67
|
+
`peaks code should-pause --step step-1-mode-select --mode <mode>` now consults `presence:check-stale` automatically. When stale:
|
|
68
68
|
|
|
69
69
|
```json
|
|
70
70
|
{
|
|
71
71
|
"ok": true,
|
|
72
|
-
"command": "
|
|
72
|
+
"command": "code.should-pause",
|
|
73
73
|
"data": {
|
|
74
74
|
"shouldPause": true,
|
|
75
75
|
"reason": "stale-presence — re-ask Step 1 (recorded outer session id does not match current)",
|
|
@@ -79,7 +79,7 @@ Returns the same `stale` / `reason` / `currentOuterSessionId` / `recordedOuterSe
|
|
|
79
79
|
}
|
|
80
80
|
```
|
|
81
81
|
|
|
82
|
-
The hard-pause on `step-1-mode-select` is preserved for ALL modes (defect #1 fix from slice 2026-06-28-
|
|
82
|
+
The hard-pause on `step-1-mode-select` is preserved for ALL modes (defect #1 fix from slice 2026-06-28-code-mode-bypass-fix). Stale-presence is an additional reason — even when the user names a profile explicitly, peaks-code can still surface the staleness for visibility.
|
|
83
83
|
|
|
84
84
|
## Auto-clear on session rotation
|
|
85
85
|
|
|
@@ -108,7 +108,7 @@ peaks workspace init --project . --json
|
|
|
108
108
|
peaks skill presence:check-stale --project . --json
|
|
109
109
|
# → { stale: true, reason: "no-presence", presence: null }
|
|
110
110
|
|
|
111
|
-
peaks
|
|
111
|
+
peaks code should-pause --step step-1-mode-select --mode full-auto --json
|
|
112
112
|
# → { shouldPause: true, reason: "step=step-1-mode-select is a mode/context-selection step → always pause" }
|
|
113
113
|
|
|
114
114
|
# 3. User picks a profile (or repeats "full-auto"). Then:
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
# Step 1 — Mode selection
|
|
2
2
|
|
|
3
|
-
> Body of `### Peaks-Loop Step 1`. After Step 0 has anchored the workspace and presence, when the user invokes Peaks-Loop
|
|
3
|
+
> Body of `### Peaks-Loop Step 1`. After Step 0 has anchored the workspace and presence, when the user invokes Peaks-Loop Code without explicitly naming an execution profile, use `AskUserQuestion` to pick the profile. Present the recommended full-auto path as the first/default option with a practical description for each:
|
|
4
4
|
|
|
5
5
|
1. **Full auto (Recommended)** — Peaks-Loop handles planning, role coordination, validation, and compact handoff end-to-end while preserving required confirmation gates for risky or shared-state actions.
|
|
6
6
|
2. **Assisted** — Peaks-Loop proposes plans, artifacts, and checks, then pauses for user decisions at major workflow boundaries.
|
|
7
7
|
3. **Swarm** — Peaks-Loop maximizes safe parallel role/worker execution for larger RD or QA workloads while keeping reducer validation and artifact boundaries explicit.
|
|
8
8
|
4. **Strict** — Peaks-Loop uses the most conservative gates: explicit confirmations, strict slice specs, coverage evidence, QA acceptance, and commit boundaries before continuing.
|
|
9
9
|
|
|
10
|
-
Map the user's selection to the `--mode` flag value (used by `peaks skill presence:set`; `presence:set --mode` accepts any string, so the name matches the user-facing label rather than overloading "
|
|
10
|
+
Map the user's selection to the `--mode` flag value (used by `peaks skill presence:set`; `presence:set --mode` accepts any string, so the name matches the user-facing label rather than overloading "code" which is also the skill name):
|
|
11
11
|
|
|
12
12
|
| User selects | `--mode` value |
|
|
13
13
|
|---|---|
|
|
@@ -16,6 +16,6 @@ Map the user's selection to the `--mode` flag value (used by `peaks skill presen
|
|
|
16
16
|
| Swarm | `swarm` |
|
|
17
17
|
| Strict | `strict` |
|
|
18
18
|
|
|
19
|
-
> Note: `peaks workflow route --mode
|
|
19
|
+
> Note: `peaks workflow route --mode code|team` is a **different** CLI dimension (code developer vs team flow) and is unrelated to the profile choice here. Do not conflate them.
|
|
20
20
|
|
|
21
21
|
If the user already names a profile in their invocation (e.g. `/peaks-code --full-auto`, "用全自动模式"), skip this question and use the named profile directly.
|