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
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
# OpenSpec Lifecycle for Peaks
|
|
1
|
+
# OpenSpec Lifecycle for Peaks Code
|
|
2
2
|
|
|
3
|
-
Peaks
|
|
3
|
+
Peaks Code orchestrates RD, QA, and SC. When the target repository uses OpenSpec, Code must drive the full lifecycle through the Peaks CLI so each role works against the same stable surface.
|
|
4
4
|
|
|
5
5
|
> **Slice #016 (2026-06-09)**: this document used to live at `openspec-mcp-workflow.md` and contained a section on the `peaks mcp *` lifecycle. The MCP subsystem was retired in slice #016; that section is gone. The OpenSpec lifecycle described below is unchanged.
|
|
6
6
|
|
|
@@ -8,19 +8,19 @@ Peaks Solo orchestrates RD, QA, and SC. When the target repository uses OpenSpec
|
|
|
8
8
|
|
|
9
9
|
```text
|
|
10
10
|
peaks openspec render → RD authors a change pack (dry-run, then --apply)
|
|
11
|
-
peaks openspec validate →
|
|
11
|
+
peaks openspec validate → Code gates RD output before slicing starts
|
|
12
12
|
peaks openspec show → any role reads parsed proposal/tasks state
|
|
13
13
|
peaks openspec to-rd → RD projects the pack into refactor slice input
|
|
14
14
|
SC projects it into commit boundary candidates
|
|
15
15
|
peaks openspec validate → QA gates the final state before sign-off
|
|
16
|
-
peaks openspec archive →
|
|
16
|
+
peaks openspec archive → Code moves the change under changes/archive/<id>/
|
|
17
17
|
```
|
|
18
18
|
|
|
19
|
-
Rules
|
|
19
|
+
Rules Code applies:
|
|
20
20
|
|
|
21
21
|
- `render --apply` is the only Peaks-managed way to write a change pack. Other roles must not hand-edit `openspec/changes/**`.
|
|
22
22
|
- `validate` is run twice per change in a refactor flow: once before slicing (RD entry gate) and once before archive (QA exit gate). Both must end with `data.valid === true`.
|
|
23
|
-
- `archive --apply` is the lifecycle terminator;
|
|
23
|
+
- `archive --apply` is the lifecycle terminator; Code only invokes it after QA acceptance and SC commit.
|
|
24
24
|
|
|
25
25
|
## Refactor workflow wiring
|
|
26
26
|
|
|
@@ -35,27 +35,27 @@ If the consuming LLM needs an MCP server for docs lookup or research (e.g. Conte
|
|
|
35
35
|
|
|
36
36
|
## Boundary
|
|
37
37
|
|
|
38
|
-
|
|
38
|
+
Code must not write `openspec/changes/**` or `~/.claude/settings.json` directly. Every mutation goes through the CLI commands above. The CLI returns stable envelopes; Code captures them as artifact links rather than re-explaining their content in the handoff.
|
|
39
39
|
|
|
40
40
|
---
|
|
41
41
|
|
|
42
42
|
# Step 0.5 — OpenSpec first-run opt-in (conditional)
|
|
43
43
|
|
|
44
|
-
> Body of `### Peaks-Loop Step 0.5`. After the workspace is anchored, before project scan,
|
|
44
|
+
> Body of `### Peaks-Loop Step 0.5`. After the workspace is anchored, before project scan, Code checks whether
|
|
45
45
|
the project already has an `openspec/` directory. The lifecycle
|
|
46
46
|
(`render → validate → show → to-rd → validate → archive`) only applies
|
|
47
47
|
when `openspec/` exists; without it, RD/QA/SC silently skip the
|
|
48
48
|
openspec-aware paths and you lose change-proposal tracking, commit
|
|
49
49
|
boundaries from `tasks.md`, and the historical archive.
|
|
50
50
|
|
|
51
|
-
To make that opt-in visible instead of silent,
|
|
51
|
+
To make that opt-in visible instead of silent, Code runs:
|
|
52
52
|
|
|
53
53
|
```bash
|
|
54
54
|
# 1. Detect whether the project already has openspec/.
|
|
55
55
|
ls <repo>/openspec/changes 2>&1
|
|
56
|
-
# 2. If absent, ask the user once — only on the first
|
|
56
|
+
# 2. If absent, ask the user once — only on the first Code run in this
|
|
57
57
|
# project. The decision is sticky: write it to .peaks/.peaks-openspec-opt-in.json
|
|
58
|
-
# so subsequent
|
|
58
|
+
# so subsequent Code invocations do not re-ask.
|
|
59
59
|
test -f <repo>/.peaks/.peaks-openspec-opt-in.json || \
|
|
60
60
|
echo "{\"enabled\": <bool>}" > <repo>/.peaks/.peaks-openspec-opt-in.json
|
|
61
61
|
```
|
|
@@ -65,11 +65,11 @@ file is missing):
|
|
|
65
65
|
|
|
66
66
|
| Option | What it does |
|
|
67
67
|
|---|---|
|
|
68
|
-
| Enable OpenSpec for this project (Recommended) | Run `peaks openspec init --project <repo> --apply`. After that, every
|
|
69
|
-
| Skip for now | Do nothing.
|
|
70
|
-
| Never ask again for this project | Write `{enabled: false, sticky: true}`.
|
|
68
|
+
| Enable OpenSpec for this project (Recommended) | Run `peaks openspec init --project <repo> --apply`. After that, every Code run uses the change-proposal lifecycle for the same project. |
|
|
69
|
+
| Skip for now | Do nothing. Code proceeds without openspec; the question is re-asked on the next first-run detection. |
|
|
70
|
+
| Never ask again for this project | Write `{enabled: false, sticky: true}`. Code stops asking. The user can re-enable later by removing `.peaks/.peaks-openspec-opt-in.json` and re-running. |
|
|
71
71
|
|
|
72
|
-
The first option is the recommended default because it gives
|
|
72
|
+
The first option is the recommended default because it gives Code the
|
|
73
73
|
full change-proposal lifecycle (proposal / tasks / design / specs
|
|
74
74
|
deltas, archive on ship, commit boundaries from `tasks.md`). It costs
|
|
75
75
|
only a single scaffolded directory and pays back the first time the
|
|
@@ -77,5 +77,5 @@ project needs a real review trail.
|
|
|
77
77
|
|
|
78
78
|
If the user picks "Enable", the only required follow-up is to make
|
|
79
79
|
sure `openspec/changes/` is added to git (it is part of the project
|
|
80
|
-
repo, not a tool-managed artefact).
|
|
80
|
+
repo, not a tool-managed artefact). Code does not run `git add` for
|
|
81
81
|
the user; that is the user's commit boundary.
|
|
@@ -27,7 +27,7 @@ checkpoint as often as it wants.
|
|
|
27
27
|
> does **not** expose a `--periodic-every <n>` override flag — the
|
|
28
28
|
> cadence is owned by the skill, not the CLI. Any patch that relaxes
|
|
29
29
|
> this must update both files in lockstep or fail the
|
|
30
|
-
> `tests/unit/
|
|
30
|
+
> `tests/unit/code/checkpoint-periodic-frequency.test.ts` guard.
|
|
31
31
|
|
|
32
32
|
## Checkpoint CLI contract
|
|
33
33
|
|
|
@@ -72,10 +72,10 @@ This step is strictly IDE-agnostic. The LLM calls the peaks CLI; no IDE-specific
|
|
|
72
72
|
|
|
73
73
|
## Companion surface — auto-compact (zero-pause)
|
|
74
74
|
|
|
75
|
-
When the runner crosses the v2.13.0 auto-compact thresholds (0.85 pre-compact / 0.95 red-line), `peaks session checkpoint` is NOT enough on its own — the LLM must also fire `peaks
|
|
75
|
+
When the runner crosses the v2.13.0 auto-compact thresholds (0.85 pre-compact / 0.95 red-line), `peaks session checkpoint` is NOT enough on its own — the LLM must also fire `peaks code auto-compact --execute` (or wait for the in-band PreToolUse hook at ratio ≥ 0.95 to compact the runner itself). See:
|
|
76
76
|
|
|
77
|
-
- `peaks
|
|
77
|
+
- `peaks code auto-compact --execute` — orchestrator that writes the convergence plan + dispatches the compact pathway
|
|
78
78
|
- `peaks session auto-compact-hook` — the PreToolUse hook entrypoint fired by `.claude/settings.local.json` (slice 2026-07-02-auto-compact-zero-pause)
|
|
79
79
|
- `.peaks/memory/2026-06-27-auto-compact-design.md` — zero-human-intervention design rationale
|
|
80
80
|
|
|
81
|
-
The two surfaces compose: `peaks session checkpoint` persists the context state, `peaks
|
|
81
|
+
The two surfaces compose: `peaks session checkpoint` persists the context state, `peaks code auto-compact` collapses the runner's window. The LLM fires both in the 0.85–0.95 zone; the hook fires alone at ≥ 0.95.
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
| `peaks request lint <rid> --role <role> --project <path>` | Scan artifact body for unfilled `<placeholder>`, bare `- ...` bullets, TBD/TODO markers | Before every transition out of `draft` / before role handoff | Any `error`-severity finding (unfilled placeholder, bare-dot bullet) |
|
|
8
8
|
| `peaks request repair-status <rid> --project <path>` | Count RD↔QA repair cycles from `--reason` transition notes ("QA cycle N: ...") | Before every RD repair iteration in step 7 | Cycle count reached the 3-cycle cap |
|
|
9
9
|
| `peaks scan request-type-sanity --project <path> --type <type>` | Cross-verify declared `--type` against the actual `git diff` file mix (catches "feature mis-declared as docs" workflow violations) | After PRD type lock-in AND after each RD repair iteration | Declared type disagrees with the file mix |
|
|
10
|
-
| `peaks scan libraries --project <path>` | Enumerate every dependency + devDependency + peerDependency + optionalDependency with parsed major version; output goes to `## Library versions` in `rd/project-scan.md`. Read-only. | At
|
|
10
|
+
| `peaks scan libraries --project <path>` | Enumerate every dependency + devDependency + peerDependency + optionalDependency with parsed major version; output goes to `## Library versions` in `rd/project-scan.md`. Read-only. | At Code step 0.6 (alongside `peaks scan archetype`) | Always exits 0 (warnings in JSON envelope; never blocks) |
|
|
11
11
|
| `peaks slice check [--rid <rid>] [--project <path>]` | 4-stage slice 边界 check (typecheck + unit-tests + review-fanout + gate-verify-pipeline). Aggregate pass/fail; non-zero exit if any stage fails. See "Slice 边界 check" below for usage rules (boundary only, never inside a micro-cycle). | At slice 边界(post-micro-cycle, pre-peaks-qa)| Any stage fails |
|
|
12
12
|
|
|
13
13
|
Together with `peaks request transition` (which already CLI-enforces per-type artifact prerequisites), these five commands form the runtime quality net. SKILL.md prose is descriptive; the CLI is what physically blocks bad workflows.
|
|
@@ -60,7 +60,7 @@ peaks request transition <rid> --role prd --state confirmed-by-user --project <r
|
|
|
60
60
|
peaks request transition <rid> --role prd --state handed-off --project <repo> --json
|
|
61
61
|
|
|
62
62
|
# 3. Peaks-Loop Default sub-agent fan-out (slice 5 contract)
|
|
63
|
-
#
|
|
63
|
+
# Code computes the swarm plan from --type + frontendOnly + frontend-keyword scan,
|
|
64
64
|
# writes it to .peaks/_runtime/<sid>/sc/swarm-plan.json, then writes the slice
|
|
65
65
|
# DAG to .peaks/_runtime/<sid>/sc/slice-dag.json and launches ONE
|
|
66
66
|
# `peaks sub-agent dispatch --from-dag <dag-file>` call. The CLI's
|
|
@@ -75,10 +75,10 @@ peaks request transition <rid> --role prd --state handed-off --project <repo> --
|
|
|
75
75
|
# `peaks sub-agent dispatch <role>` calls in N separate messages when a fan-out
|
|
76
76
|
# shape exists — `--from-dag` is the only path that exercises the orchestrator.
|
|
77
77
|
#
|
|
78
|
-
# 3a. Pre-fan-out:
|
|
78
|
+
# 3a. Pre-fan-out: Code initialises every role's request artefact slot in the main
|
|
79
79
|
# loop so sub-agents find a stable rid <-> artefact binding. Each role's
|
|
80
80
|
# sub-agent may also call peaks request init itself (idempotent on the same rid);
|
|
81
|
-
#
|
|
81
|
+
# Code's call here is the source of truth. Only init roles that are in the
|
|
82
82
|
# swarm plan — roles not in the plan do not get a slot yet.
|
|
83
83
|
peaks skill presence:set peaks-code --project <repo> --mode <mode> --gate swarm-fan-out
|
|
84
84
|
# for each role in swarm-plan.subAgents:
|
|
@@ -88,7 +88,7 @@ peaks skill presence:set peaks-code --project <repo> --mode <mode> --gate swarm-
|
|
|
88
88
|
# e.g. if plan = [ui, rd, qa]: run init for ui, rd, qa.
|
|
89
89
|
# If plan = [rd, qa]: run for rd, qa only.
|
|
90
90
|
# If plan = [] (config|docs|chore skip): no inits here, jump to step 4 directly.
|
|
91
|
-
# 3b.
|
|
91
|
+
# 3b. Code writes the slice DAG to a JSON file then issues ONE
|
|
92
92
|
# `peaks sub-agent dispatch --from-dag <dag-file> --batch-id <id>` call.
|
|
93
93
|
# The CLI envelope returns N parallel buildToolCall descriptors
|
|
94
94
|
# (dispatchCount = len(swarm-plan.subAgents) when the DAG has >= 2
|
|
@@ -98,7 +98,7 @@ peaks skill presence:set peaks-code --project <repo> --mode <mode> --gate swarm-
|
|
|
98
98
|
# concurrently, so wall-time approximates max(per-leaf time), not sum.
|
|
99
99
|
peaks sc build-dag --change-id <cid> --project <repo> --json > .peaks/_runtime/<sid>/sc/slice-dag.json
|
|
100
100
|
peaks sub-agent dispatch --from-dag .peaks/_runtime/<sid>/sc/slice-dag.json --batch-id <id> --project <repo> --json
|
|
101
|
-
# 3c. After fan-out,
|
|
101
|
+
# 3c. After fan-out, Code restores presence once and runs Gate B (ls checks):
|
|
102
102
|
peaks skill presence:set peaks-code --project <repo> --mode <mode> --gate swarm-converged
|
|
103
103
|
ls .peaks/_runtime/<sid>/prd/requests/<rid>.md # PRD artefact must exist (Gate B hard)
|
|
104
104
|
# feature / refactor → ls .peaks/_runtime/<sid>/rd/tech-doc.md
|
|
@@ -174,7 +174,7 @@ peaks workspace reconcile --project <repo> --apply --older-than 7
|
|
|
174
174
|
# (c) Skip for now — blocks stay in the handoff only, no .peaks/memory/ write"
|
|
175
175
|
# If 10a returned 0 AND the session surfaced a stable project fact
|
|
176
176
|
# (decision / convention / approved refactor), STOP — peaks-txt must go
|
|
177
|
-
# back and embed at least one block before
|
|
177
|
+
# back and embed at least one block before Code can advance.
|
|
178
178
|
|
|
179
179
|
# 10c. After the user picks (a) or (b), run:
|
|
180
180
|
peaks memory extract --project <repo> --artifact .peaks/_runtime/<id>/txt/handoff.md --apply --json
|
|
@@ -195,13 +195,13 @@ Repair loop details: see `## Mandatory RD QA repair loop` in SKILL.md for the fu
|
|
|
195
195
|
# Step 0.8 (BLOCKING): LLM judges Job-shape, CLI records it.
|
|
196
196
|
# This is a RECORDER, not a detector. The LLM supplies --is-job + --rationale;
|
|
197
197
|
# the CLI writes .peaks/_runtime/<sid>/job-shape.json. Downstream steps call
|
|
198
|
-
# `peaks
|
|
198
|
+
# `peaks code read-job-shape` to enforce the decision exists.
|
|
199
199
|
|
|
200
200
|
# (The LLM does the semantic judgement, e.g.:)
|
|
201
201
|
# "The user named N=35 parallel app/ subdirs, said 'continue until all done',
|
|
202
202
|
# and disavowed cost. isJob=true, rationale=..., suggestedJobId=app-ut-batch,
|
|
203
203
|
# suggestedStrategy=rotating, confidence=high."
|
|
204
|
-
peaks
|
|
204
|
+
peaks code detect-job \
|
|
205
205
|
--is-job true \
|
|
206
206
|
--rationale "35 parallel app/ subdirs + 'until all done' + '不用考虑费用'" \
|
|
207
207
|
--suggested-job-id app-ut-batch \
|
|
@@ -209,7 +209,7 @@ peaks solo detect-job \
|
|
|
209
209
|
--confidence high
|
|
210
210
|
|
|
211
211
|
# Step 0.81-init: if Job-shaped, init BEFORE Step 1.
|
|
212
|
-
DECISION=$(peaks
|
|
212
|
+
DECISION=$(peaks code read-job-shape --json)
|
|
213
213
|
if [ "$(echo "$DECISION" | jq -r '.data.decision.isJob')" = "true" ]; then
|
|
214
214
|
JID=$(echo "$DECISION" | jq -r '.data.decision.suggestedJobId')
|
|
215
215
|
STRATEGY=$(echo "$DECISION" | jq -r '.data.decision.suggestedStrategy')
|
|
@@ -232,18 +232,18 @@ peaks job subagent-cleanup --job-id <jid> --batch-id <bid> --force # Step 0.87
|
|
|
232
232
|
|
|
233
233
|
# v3.1.2 size-fear ban: refuse to emit a final handoff while remaining > 0.
|
|
234
234
|
# The LLM cannot bypass this; --force-under-job requires explicit user approval.
|
|
235
|
-
peaks
|
|
235
|
+
peaks code emit-handoff --project <repo> --job-id <jid> --json
|
|
236
236
|
|
|
237
237
|
# v3.1.2 forced auto-compact: when --enforce-job-mode is set OR
|
|
238
238
|
# job-shape.json says isJob=true, ≥0.85 is MANDATORY auto-compact.
|
|
239
|
-
#
|
|
240
|
-
peaks
|
|
239
|
+
# Code MUST call this without confirmation under Job mode.
|
|
240
|
+
peaks code context-now --project <repo> --enforce-job-mode --json
|
|
241
241
|
peaks session auto-compact --execute --project <repo> --json
|
|
242
242
|
|
|
243
243
|
# v3.1.2 PreToolUse gate (installed by `peaks workspace init`):
|
|
244
|
-
# every Bash tool call runs `peaks
|
|
244
|
+
# every Bash tool call runs `peaks code gate-step-08` automatically.
|
|
245
245
|
# Exit 0 = allow (with optional Next: slice #N+1 of M line when
|
|
246
246
|
# progress.json exists). Exit 2 = BLOCKED; LLM must call
|
|
247
|
-
# `peaks
|
|
248
|
-
peaks
|
|
247
|
+
# `peaks code detect-job` first.
|
|
248
|
+
peaks code gate-step-08 --project <repo> --json
|
|
249
249
|
```
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
# Peaks-Loop
|
|
1
|
+
# Peaks-Loop Code — Step 0.8 (v3.1.1 + v3.1.2) Gate Deep-Dive
|
|
2
2
|
|
|
3
3
|
> Read alongside `SKILL.md` Step 0.8. The SKILL.md header is the LOCKED CONTRACT; this file is the mechanics.
|
|
4
4
|
|
|
5
|
-
## Recorder contract (`peaks
|
|
5
|
+
## Recorder contract (`peaks code detect-job`)
|
|
6
6
|
|
|
7
|
-
The CLI does NOT judge whether the request is Job-shaped — that is the LLM's job. Keyword regexes are wrong here (too brittle, miss natural-language variants, shift the LLM's semantic understanding into code). The CLI is a **recorder and gate**: the LLM makes the judgement, writes it via `peaks
|
|
7
|
+
The CLI does NOT judge whether the request is Job-shaped — that is the LLM's job. Keyword regexes are wrong here (too brittle, miss natural-language variants, shift the LLM's semantic understanding into code). The CLI is a **recorder and gate**: the LLM makes the judgement, writes it via `peaks code detect-job`, and downstream steps refuse to proceed until the decision file exists.
|
|
8
8
|
|
|
9
9
|
### LLM judgement criteria (read once, then call the recorder)
|
|
10
10
|
|
|
@@ -16,40 +16,40 @@ The CLI does NOT judge whether the request is Job-shaped — that is the LLM's j
|
|
|
16
16
|
### Action sequence
|
|
17
17
|
|
|
18
18
|
1. LLM reads the user prompt and applies judgement → `isJob: boolean + rationale + suggestedJobId + suggestedStrategy + confidence`.
|
|
19
|
-
2. LLM calls `peaks
|
|
19
|
+
2. LLM calls `peaks code detect-job --is-job <bool> --rationale <text> --suggested-job-id <jid> --suggested-strategy <single|rotating> --confidence <high|medium|low> [--force]`.
|
|
20
20
|
3. CLI records to `.peaks/_runtime/<sessionId>/job-shape.json`.
|
|
21
21
|
4. If `isJob: true` → `peaks job init --job-id <jid> --slice-list <...> --main-loop-strategy <strategy> --rotate-every 3` (BEFORE Step 1).
|
|
22
22
|
5. Downstream steps (Step 1, Step 0.81, etc.) call `read-job-shape` to refuse if missing.
|
|
23
23
|
|
|
24
24
|
### Hard rule (v3.1.1 red-line #10)
|
|
25
25
|
|
|
26
|
-
LLM MUST NOT skip `peaks
|
|
26
|
+
LLM MUST NOT skip `peaks code detect-job` even when the trigger is obvious from context. If the next step's `read-job-shape` throws `JOB_SHAPE_NOT_DECIDED`, Code MUST record a decision before proceeding. Keyword-based "I already know it's a Job" is not a substitute.
|
|
27
27
|
|
|
28
28
|
## v3.1.2 mechanical gates
|
|
29
29
|
|
|
30
30
|
The recorder-only design was bypassed twice under load; the gate must be un-bypassable.
|
|
31
31
|
|
|
32
|
-
### 1. PreToolUse hook — `peaks
|
|
32
|
+
### 1. PreToolUse hook — `peaks code gate-step-08`
|
|
33
33
|
|
|
34
|
-
`peaks workspace init` installs the `Bash` matcher `peaks
|
|
34
|
+
`peaks workspace init` installs the `Bash` matcher `peaks code gate-step-08 --project .` in `.claude/settings.local.json` (alongside the existing Write|Edit|MultiEdit matcher). The hook runs before every Bash call:
|
|
35
35
|
|
|
36
36
|
| Condition | Exit | Behaviour |
|
|
37
37
|
|---|---|---|
|
|
38
38
|
| `job-shape.json` exists | 0 (allow) | allow + emit decision; if `progress.json` exists, add `Next: slice #N+1 of M (<currentSlice>)` |
|
|
39
|
-
| `job-shape.json` missing AND prompt matches the fail-closed backup regex | 2 (BLOCKED) | LLM must call `peaks
|
|
39
|
+
| `job-shape.json` missing AND prompt matches the fail-closed backup regex | 2 (BLOCKED) | LLM must call `peaks code detect-job` before retrying |
|
|
40
40
|
| `job-shape.json` missing AND no regex match | 0 (allow) | allow, no Job trigger |
|
|
41
41
|
|
|
42
|
-
### 2. Size-fear ban — `peaks
|
|
42
|
+
### 2. Size-fear ban — `peaks code emit-handoff`
|
|
43
43
|
|
|
44
44
|
Refuses to emit a final handoff while `remaining > 0` under Job mode. Pass `--force-under-job` only with explicit user approval.
|
|
45
45
|
|
|
46
46
|
### 3. Forced auto-compact — `--enforce-job-mode`
|
|
47
47
|
|
|
48
|
-
`peaks
|
|
48
|
+
`peaks code context-now --enforce-job-mode` (auto-enabled when `job-shape.json` says `isJob=true`) returns `action: 'auto-compact-now'` at ≥ 0.85; Code MUST call `peaks session auto-compact --execute` without confirmation.
|
|
49
49
|
|
|
50
50
|
### 4. On-disk slice progress — `progress.json`
|
|
51
51
|
|
|
52
|
-
`peaks job checkpoint --state done` writes `progress.json`. `peaks job progress --job-id <jid> [--allow-missing]` is the canonical reader; `peaks
|
|
52
|
+
`peaks job checkpoint --state done` writes `progress.json`. `peaks job progress --job-id <jid> [--allow-missing]` is the canonical reader; `peaks code gate-step-08` also surfaces it on every Bash call so the LLM cannot "wake up cold".
|
|
53
53
|
|
|
54
54
|
## Backup regex rationale
|
|
55
55
|
|
|
@@ -20,7 +20,7 @@ the skills compose. For sub-agent dispatch the relationship is:
|
|
|
20
20
|
|
|
21
21
|
| Surface | Who owns | What it does | Who calls it |
|
|
22
22
|
|---|---|---|---|
|
|
23
|
-
| SKILL.md (主面) | peaks-code, peaks-rd, peaks-qa | Tells the LLM when and why to dispatch a sub-agent; what prompt to pass; what artifacts to expect back | LLM (during normal
|
|
23
|
+
| SKILL.md (主面) | peaks-code, peaks-rd, peaks-qa | Tells the LLM when and why to dispatch a sub-agent; what prompt to pass; what artifacts to expect back | LLM (during normal Code / RD / QA flow) |
|
|
24
24
|
| CLI (副 / 原子) | `peaks sub-agent dispatch` | Validates the role, looks up the current IDE's `subAgentDispatcher`, returns a per-IDE tool-call descriptor + writes a dispatch record | LLM (read from the SKILL.md) |
|
|
25
25
|
| Dispatcher 抽象 (per-IDE) | `src/services/dispatch/sub-agent-dispatcher.ts` | Encapsulates the IDE-private tool name (claude-code: `Task`, trae: UNVERIFIED placeholder) and arg shape | CLI (called by the CLI) |
|
|
26
26
|
|
|
@@ -278,7 +278,7 @@ When writing a SKILL.md that fans out sub-agents:
|
|
|
278
278
|
|
|
279
279
|
### Sub-agent mechanism (IDE-agnostic dispatch, NOT Skill tool)
|
|
280
280
|
|
|
281
|
-
> Body of `### Sub-agent mechanism`. **
|
|
281
|
+
> Body of `### Sub-agent mechanism`. **Code is itself a skill running in the current session. To invoke a role in the Swarm, Code MUST call the IDE-agnostic dispatch primitive `peaks sub-agent dispatch <role>` — NOT the `Skill` tool, NOT any IDE-private sub-agent literal.** The `Skill` tool is single-stack and blocking; using it for "parallel" work was the v1.x illusion of concurrency. The dispatch CLI is the only mechanism that keeps SKILL.md free of IDE-private tool names and lets the same prompt work on every registered IDE.
|
|
282
282
|
|
|
283
283
|
Each sub-agent dispatch call looks like:
|
|
284
284
|
|
|
@@ -304,21 +304,21 @@ The role's required artefact paths (also see peaks-ui/rd/qa SKILL.md and `refere
|
|
|
304
304
|
| `rd-planning` | `.peaks/_runtime/<sessionId>/rd/tech-doc.md` (feature/refactor) or `.peaks/_runtime/<sessionId>/rd/bug-analysis.md` (bugfix) | PRD body, project-scan, existing-system, codegraph |
|
|
305
305
|
| `qa-test-cases` | `.peaks/_runtime/<sessionId>/qa/test-cases/<rid>.md` | PRD body, RD planning artefact, project-scan, codegraph |
|
|
306
306
|
|
|
307
|
-
**
|
|
307
|
+
**Code launches all sub-agents in the swarm plan in a single message (multiple `peaks sub-agent dispatch` calls in parallel, each followed by execution of the returned toolCall)** — this is what gives real concurrency. Do not sequentialize them. The CLI returns N toolCall descriptors; the LLM fires all N in the same message; the IDE dispatches them concurrently; Code then waits for all to return, runs `ls` checks against the paths above (Peaks-Loop Gate B), and only then advances to RD implementation.
|
|
308
308
|
|
|
309
309
|
**Hard prohibitions on sub-agents** (also passed in each dispatch prompt):
|
|
310
310
|
|
|
311
311
|
- Do NOT call `Skill(skill="...")` — sub-agents must not recursively activate skills, that defeats the fan-out.
|
|
312
|
-
- Do NOT call `peaks skill presence:set` — only the main
|
|
313
|
-
- Do NOT open interactive user prompts. If a sub-agent needs clarification, it must return a `blocked` verdict in its return string and let
|
|
314
|
-
- Do NOT commit, push, install hooks, or apply settings.json mutations. Only
|
|
312
|
+
- 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.
|
|
313
|
+
- 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.
|
|
314
|
+
- Do NOT commit, push, install hooks, or apply settings.json mutations. Only Code holds those permissions.
|
|
315
315
|
- **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:
|
|
316
316
|
|
|
317
317
|
```
|
|
318
318
|
## Commit / push policy (verbatim, mandatory)
|
|
319
319
|
- Do NOT run `git commit`, `git push`, `git tag`, `git checkout -b`, or any
|
|
320
320
|
state-mutating git command. Leave the diff on disk and return the
|
|
321
|
-
diff summary in your final message. The orchestrator (
|
|
321
|
+
diff summary in your final message. The orchestrator (Code) owns the
|
|
322
322
|
commit / push decision; it will run `git status` and `git diff` after
|
|
323
323
|
your return and decide whether to commit.
|
|
324
324
|
- If you believe a commit is urgent (e.g. emergency hotfix), return
|
|
@@ -327,7 +327,7 @@ The role's required artefact paths (also see peaks-ui/rd/qa SKILL.md and `refere
|
|
|
327
327
|
```
|
|
328
328
|
- **Do write heartbeats** — call `peaks sub-agent heartbeat --record <dispatchRecordPath> --status running --progress <pct> --note "<text>"` at least every 30s (see `references/sub-agent-dispatch.md` §G6 for the full contract). The parent Dispatcher uses these to render the live status line during the wait.
|
|
329
329
|
|
|
330
|
-
After every sub-agent dispatch returns,
|
|
330
|
+
After every sub-agent dispatch returns, Code **restores presence** once (not per-agent), then continues to Gate B verification:
|
|
331
331
|
|
|
332
332
|
```bash
|
|
333
333
|
peaks skill presence:set peaks-code --project <repo> --mode <mode> --gate swarm-converged
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Swarm dispatch contract
|
|
2
2
|
|
|
3
|
-
> Reference for `peaks-code` Swarm phase and the role sub-agents (`peaks-ui` / `peaks-rd` planning / `peaks-qa` test-cases). Defines the **mechanism** of fan-out: how
|
|
3
|
+
> Reference for `peaks-code` Swarm phase and the role sub-agents (`peaks-ui` / `peaks-rd` planning / `peaks-qa` test-cases). Defines the **mechanism** of fan-out: how Code launches sub-agents, what the sub-agent prompt must contain, what the sub-agent must return, and how Code reduces the result.
|
|
4
4
|
|
|
5
5
|
## Peaks-Loop Swarm parallel phase (sub-agent fan-out, default)
|
|
6
6
|
|
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
> `references/fanout-mandatory.md`).
|
|
19
19
|
|
|
20
20
|
The Swarm phase is the **default** for any DAG with ≥ 2 leaves at
|
|
21
|
-
the same topological level.
|
|
21
|
+
the same topological level. Code derives the fan-out set from the
|
|
22
22
|
DAG topology — not from a default of "always launch three", and
|
|
23
23
|
not from a strict conditional check. The swarm gate (PRD state +
|
|
24
24
|
request type + frontend touch), mode-driven fan-out shape, and
|
|
@@ -28,7 +28,7 @@ degradation rules live in the references file.
|
|
|
28
28
|
|
|
29
29
|
The previous "Swarm" used `Skill(skill="peaks-rd")` calls. That is **single-stack and blocking** — there is no concurrency. Three sequential `Skill` calls run in order on the same main loop, not in parallel. The "parallel Agent calls" wording in the old SKILL.md was a v1.x illusion.
|
|
30
30
|
|
|
31
|
-
This contract (slice #009) replaces the IDE-private sub-agent literal with the IDE-agnostic primitive `peaks sub-agent dispatch <role>`. The CLI returns a JSON `data.toolCall` descriptor; the LLM executes that tool in its own environment. SKILL.md is now free of IDE-private tool names and the same prompt works on every registered IDE. Real concurrent fan-out is achieved by
|
|
31
|
+
This contract (slice #009) replaces the IDE-private sub-agent literal with the IDE-agnostic primitive `peaks sub-agent dispatch <role>`. The CLI returns a JSON `data.toolCall` descriptor; the LLM executes that tool in its own environment. SKILL.md is now free of IDE-private tool names and the same prompt works on every registered IDE. Real concurrent fan-out is achieved by Code launching N dispatch calls in a single message and the platform scheduling the returned toolCalls concurrently.
|
|
32
32
|
|
|
33
33
|
```
|
|
34
34
|
You are a sub-agent invoked by peaks-code. You are NOT the main Claude session.
|
|
@@ -43,7 +43,7 @@ Return a compact JSON envelope — do not write prose.
|
|
|
43
43
|
- Do NOT ask the user interactive questions. If you need clarification, return
|
|
44
44
|
{"status":"blocked","blockedReason":"<text>"} and let the main loop handle it.
|
|
45
45
|
|
|
46
|
-
## Runtime arguments (provided by
|
|
46
|
+
## Runtime arguments (provided by Code)
|
|
47
47
|
- project: <repo> (git repo root, NOT a sub-package)
|
|
48
48
|
- session-id: <sid> (from .peaks/.active-skill.json or .peaks/.session.json)
|
|
49
49
|
- request-id: <rid> (PRD id)
|
|
@@ -52,7 +52,7 @@ Return a compact JSON envelope — do not write prose.
|
|
|
52
52
|
- project-scan-path: <path> (read this for component library / CSS / build tool)
|
|
53
53
|
- existing-system-path: <path> (legacy projects only)
|
|
54
54
|
- frontendOnly: <bool> (from project-scan)
|
|
55
|
-
- frontendKeywordHit: <bool> (
|
|
55
|
+
- frontendKeywordHit: <bool> (Code's PRD scan result)
|
|
56
56
|
```
|
|
57
57
|
|
|
58
58
|
### 3.2 peaks-ui sub-agent prompt
|
|
@@ -82,7 +82,7 @@ Steps:
|
|
|
82
82
|
}
|
|
83
83
|
|
|
84
84
|
If you determine the request is non-visual (no UI surface, no design impact),
|
|
85
|
-
return {"status":"skipped","reason":"non-frontend-request"} so
|
|
85
|
+
return {"status":"skipped","reason":"non-frontend-request"} so Code can record
|
|
86
86
|
the misfire in sc/swarm-plan.json.
|
|
87
87
|
```
|
|
88
88
|
|
|
@@ -97,7 +97,7 @@ Steps:
|
|
|
97
97
|
1. peaks request init --role rd --id <rid> --project <repo> --apply --type <type> --json
|
|
98
98
|
2. peaks request show <rid> --role prd --project <repo> --json
|
|
99
99
|
3. peaks request show <rid> --role ui --project <repo> --json (if ui in plan)
|
|
100
|
-
4. Read <project-scan-path>. If absent and
|
|
100
|
+
4. Read <project-scan-path>. If absent and Code did not pre-create it, create it
|
|
101
101
|
by running `peaks scan archetype --project <repo> --json` and copying the JSON
|
|
102
102
|
into rd/project-scan.md.
|
|
103
103
|
5. Read <existing-system-path> if archetype is legacy-*.
|
|
@@ -144,9 +144,9 @@ If --type is docs|chore, return {"status":"skipped","reason":"type=<type>"} —
|
|
|
144
144
|
no acceptance surface to plan tests for.
|
|
145
145
|
```
|
|
146
146
|
|
|
147
|
-
## 4. Reducer (
|
|
147
|
+
## 4. Reducer (Code side)
|
|
148
148
|
|
|
149
|
-
After all sub-agent dispatch calls return and the LLM has invoked the toolCalls,
|
|
149
|
+
After all sub-agent dispatch calls return and the LLM has invoked the toolCalls, Code:
|
|
150
150
|
|
|
151
151
|
1. Restores presence ONCE (not per-agent):
|
|
152
152
|
```
|
|
@@ -158,9 +158,9 @@ After all sub-agent dispatch calls return and the LLM has invoked the toolCalls,
|
|
|
158
158
|
|
|
159
159
|
## 5. Presence restoration (single-shot)
|
|
160
160
|
|
|
161
|
-
Sub-agents are explicitly forbidden from calling `peaks skill presence:set`. That means `.peaks/.active-skill.json` does not move during the fan-out.
|
|
161
|
+
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.
|
|
162
162
|
|
|
163
|
-
If a sub-agent is misbehaving and writes to `.peaks/.active-skill.json` anyway, the next
|
|
163
|
+
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.
|
|
164
164
|
|
|
165
165
|
## 6. Why not a `peaks-swarm` skill?
|
|
166
166
|
|
|
@@ -177,7 +177,7 @@ A skill cannot itself trigger sub-agents — the Skill tool runs in the main loo
|
|
|
177
177
|
|
|
178
178
|
### Swarm gate (decide BEFORE fan-out)
|
|
179
179
|
|
|
180
|
-
> Body of `### Swarm gate`. Before launching any sub-agent,
|
|
180
|
+
> Body of `### Swarm gate`. Before launching any sub-agent, Code must compute the **swarm plan** from three signals:
|
|
181
181
|
|
|
182
182
|
1. **PRD state** — `prd/requests/<rid>.md` must be in state `confirmed-by-user` or `handed-off`. If not, STOP. The Swarm is downstream of PRD, not a substitute for it.
|
|
183
183
|
2. **Request type** (`--type` from `peaks request init`):
|
|
@@ -188,7 +188,7 @@ A skill cannot itself trigger sub-agents — the Skill tool runs in the main loo
|
|
|
188
188
|
- **AND** scanning the PRD body for frontend keywords: 页面 / 组件 / 表单 / 弹窗 / 表格 / 样式 / 布局 / 交互 / UI / UX / page / component / form / modal / table / styling / layout / interaction
|
|
189
189
|
- UI joins the swarm when (a) is `true` OR (b) matches. Both signals required `false` to skip UI.
|
|
190
190
|
|
|
191
|
-
|
|
191
|
+
Code records the swarm plan in `.peaks/_runtime/<sessionId>/sc/swarm-plan.json` so SC and TXT can audit what was launched:
|
|
192
192
|
|
|
193
193
|
```json
|
|
194
194
|
{
|
|
@@ -200,26 +200,26 @@ Solo records the swarm plan in `.peaks/_runtime/<sessionId>/sc/swarm-plan.json`
|
|
|
200
200
|
}
|
|
201
201
|
```
|
|
202
202
|
|
|
203
|
-
Sub-agent presence in this list =
|
|
203
|
+
Sub-agent presence in this list = Code launched a Task for it. Absence = the role was skipped with documented reason.
|
|
204
204
|
|
|
205
205
|
### Mode-driven fan-out shape
|
|
206
206
|
|
|
207
207
|
> Body of `### Mode-driven fan-out shape`.
|
|
208
208
|
|
|
209
|
-
| Mode | How the swarm plan is decided | What
|
|
209
|
+
| Mode | How the swarm plan is decided | What Code does |
|
|
210
210
|
|---|---|---|
|
|
211
211
|
| `full-auto` | Compute plan from signals above, no question to user | Auto-launch all sub-agents in the plan in parallel |
|
|
212
212
|
| `swarm` | Same as `full-auto` | Same as `full-auto` (this profile name is historical — behavior is identical) |
|
|
213
213
|
| `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 |
|
|
214
214
|
| `strict` | Same as `assisted` (the question is informational; strict still enforces confirmation gates later) | Same as `assisted` |
|
|
215
215
|
|
|
216
|
-
In all modes, **the plan must be written to `sc/swarm-plan.json` before any Task call.**
|
|
216
|
+
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.
|
|
217
217
|
|
|
218
218
|
### Degradation when swarm roles fail or are absent
|
|
219
219
|
|
|
220
220
|
> Body of `### Degradation when swarm roles fail or are absent`.
|
|
221
221
|
|
|
222
|
-
| Condition |
|
|
222
|
+
| Condition | Code action | TXT handoff note |
|
|
223
223
|
|---|---|---|
|
|
224
224
|
| UI sub-agent returns blocked/error | RD continues with PRD visual descriptions | `ui-design-missing` |
|
|
225
225
|
| RD planning sub-agent returns blocked/error | RD continues with PRD-derived planning | `tech-doc-missing` |
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Peaks-Loop Workflow Order + Request Type Classification + Transition Verification Gates
|
|
2
2
|
|
|
3
|
-
> **Maintenance**: This reference holds the canonical contract for (a) how
|
|
3
|
+
> **Maintenance**: This reference holds the canonical contract for (a) how Code sequences the 11 workflow steps, (b) which `--type` to pass to `peaks request init` for which slice shape, and (c) the executable `ls` / `grep` gate commands that physically block progression. SKILL.md keeps the narrative ("what peaks-code does"); this file keeps the contract.
|
|
4
4
|
>
|
|
5
5
|
> **Why extracted from SKILL.md**: this content is 165 lines of mostly-tabular + bash-block contract — reference data, not orchestration prose. Inlining it bloats SKILL.md past the 800-line cap (per `common/coding-style.md`). The numbers, gate command shapes, and type-classification rules change rarely; the SKILL.md prose around them (orchestration flow, repair-loop intent, swarm fan-out shape) changes more often.
|
|
6
6
|
>
|
|
@@ -25,7 +25,7 @@ Before initializing any role artifact, classify the request into exactly one of
|
|
|
25
25
|
|
|
26
26
|
For ambiguous cases (e.g. "improve login flow"), ask the user to clarify before initializing. The cost of one `AskUserQuestion` round is much lower than running the wrong gate matrix for the whole workflow.
|
|
27
27
|
|
|
28
|
-
When Peaks-Loop
|
|
28
|
+
When Peaks-Loop Code coordinates development in a code repository, keep this order explicit:
|
|
29
29
|
|
|
30
30
|
0. **Peaks-Loop Snapshot** — `peaks doctor` + `peaks project dashboard` to capture baseline state before anything else;
|
|
31
31
|
0.5. **Peaks-Loop Workspace initialization** — `.peaks/_runtime/<session-id>/` created, directory structure verified;
|
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
# Peaks
|
|
1
|
+
# Peaks Code Workflow
|
|
2
2
|
|
|
3
|
-
Peaks
|
|
3
|
+
Peaks Code is a facade over role skills. It keeps the workflow moving without absorbing role-specific responsibility.
|
|
4
4
|
|
|
5
5
|
## Modes
|
|
6
6
|
|
|
7
|
-
-
|
|
7
|
+
- Code: default, single controller with soft gates.
|
|
8
8
|
- Assisted: role skills contribute artifacts without broad swarm execution.
|
|
9
9
|
- Swarm: multiple subagents work in parallel when the CLI-managed profile is enabled.
|
|
10
10
|
- Strict: hook/profile guarded mode for high-risk work.
|
|
11
11
|
|
|
12
12
|
## Required code workflow evidence
|
|
13
13
|
|
|
14
|
-
A code workflow is not complete until
|
|
14
|
+
A code workflow is not complete until Code has linked or summarized:
|
|
15
15
|
|
|
16
16
|
1. standards preflight;
|
|
17
17
|
2. PRD/RD scope and OpenSpec artifacts when required;
|
|
@@ -31,7 +31,7 @@ For legacy repositories with pre-existing low UT coverage, do not require histor
|
|
|
31
31
|
|
|
32
32
|
## RD QA loop
|
|
33
33
|
|
|
34
|
-
Every RD implementation or repair slice must be followed by QA validation. If QA does not fully pass,
|
|
34
|
+
Every RD implementation or repair slice must be followed by QA validation. If QA does not fully pass, Code routes the report back to RD, then repeats RD repair and QA validation until QA is all green or the workflow is blocked. In full-auto mode, Claude Code's `goal` command may be used to keep the controller objective explicit while Peaks artifacts remain authoritative.
|
|
35
35
|
|
|
36
36
|
## Capability discovery
|
|
37
37
|
|
|
@@ -3,9 +3,9 @@ name: peaks-resume
|
|
|
3
3
|
description: Universal resume primitive for any in-flight Peaks-Loop workflow (orchestrator-agnostic). Detects the current session's deepest completed gate and surfaces a resume option via AskUserQuestion. Use when ANY bee (peaks-code, future peaks-research, future peaks-content, …) needs to recover from /compact or session interruption. Triggers on "/peaks-resume", "continue the unfinished work", "继续完成", "把刚才没做完的收尾". (Replaces peaks-resume as a top-level primitive.)
|
|
4
4
|
---
|
|
5
5
|
|
|
6
|
-
# Peaks-Loop
|
|
6
|
+
# Peaks-Loop Code Resume (wrapper)
|
|
7
7
|
|
|
8
|
-
Peaks-Loop
|
|
8
|
+
Peaks-Loop Code Resume is a thin wrapper that handles the **most common high-frequency request shape**: "I was in the middle of something, continue it." It detects the current session's deepest completed gate, surfaces a resume option, then yields to the main `peaks-code` skill (which runs the actual workflow from the matching gate onwards).
|
|
9
9
|
|
|
10
10
|
**This is a transparent wrapper.** The user does not stay in this skill — once the resume option is confirmed, control hands off to `peaks-code`. The wrapper exists only to (a) detect the in-flight slice without the LLM re-reading 3-5 artifact files, and (b) surface the resume option as a `AskUserQuestion` before the main loop skips ahead.
|
|
11
11
|
|
|
@@ -3,9 +3,9 @@ name: peaks-status
|
|
|
3
3
|
description: Universal status primitive for any in-flight Peaks-Loop workflow (orchestrator-agnostic). Reads the existing CLI primitives (peaks skill presence, peaks session list, peaks project dashboard, peaks request show) and renders a 1-screen status table. Use when the user asks "where are we", "现在到哪了", "what's the current state" for ANY bee (peaks-code, future peaks-research, …). Triggers on "/peaks-status", "现在到哪了", "what is the current state", "show me the dashboard". (Replaces peaks-status as a top-level primitive.)
|
|
4
4
|
---
|
|
5
5
|
|
|
6
|
-
# Peaks-Loop
|
|
6
|
+
# Peaks-Loop Code Status (wrapper)
|
|
7
7
|
|
|
8
|
-
Peaks-Loop
|
|
8
|
+
Peaks-Loop Code Status is a thin wrapper that renders a compact status table for the current peaks-code orchestrator state. It is the answer to "I just want to know where we are" — no PRD, no RD, no QA, no full peaks-code orchestration. Just read the existing CLI state and render a 1-screen summary.
|
|
9
9
|
|
|
10
10
|
**This is a transparent wrapper.** The user does not stay in this skill — the status table is rendered, and control hands off (back to the user, or to `peaks-code` if the user wants to act on the status).
|
|
11
11
|
|
|
@@ -3,9 +3,9 @@ name: peaks-test
|
|
|
3
3
|
description: Universal test-runner primitive for any in-flight Peaks-Loop workflow (orchestrator-agnostic). Runs the project's test suite on the current repo and reports results. Use when the user asks "run the tests", "跑一下 test", "跑测试" for ANY bee (peaks-code, future peaks-research, …). Triggers on "/peaks-test", "跑一下 test", "跑测试", "run the tests", "test now". (Replaces peaks-test as a top-level primitive.)
|
|
4
4
|
---
|
|
5
5
|
|
|
6
|
-
# Peaks-Loop
|
|
6
|
+
# Peaks-Loop Code Test (wrapper)
|
|
7
7
|
|
|
8
|
-
Peaks-Loop
|
|
8
|
+
Peaks-Loop Code Test is a thin wrapper that runs the project's test suite on the current repo and reports results. It is the answer to "I just want to see if the tests pass" — no PRD, no RD, no QA, no full peaks-code orchestration. Just `pnpm vitest run` and a compact summary.
|
|
9
9
|
|
|
10
10
|
**This is a transparent wrapper.** The user does not stay in this skill — the test command runs, the result is summarized, and control hands off (back to the user, or to `peaks-code` if the user wants to act on the result).
|
|
11
11
|
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|