peaks-loop 4.0.0-beta → 4.0.0-beta.3
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 +17 -4
- package/README.md +17 -4
- package/dist/src/cli/commands/asset-commands.d.ts +45 -0
- package/dist/src/cli/commands/asset-commands.js +404 -0
- package/dist/src/cli/commands/bee-commands.d.ts +26 -0
- package/dist/src/cli/commands/bee-commands.js +169 -0
- 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/evolution-commands.d.ts +27 -0
- package/dist/src/cli/commands/evolution-commands.js +393 -0
- 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/loop-commands.d.ts +19 -13
- package/dist/src/cli/commands/loop-commands.js +147 -13
- package/dist/src/cli/commands/sediment-commands.js +9 -0
- package/dist/src/cli/commands/session-auto-compact-hook-command.js +2 -2
- package/dist/src/cli/commands/skill-loop-engineering-readiness-commands.d.ts +67 -0
- package/dist/src/cli/commands/skill-loop-engineering-readiness-commands.js +173 -0
- 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 +23 -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/crystallization/crystallization-service.d.ts +239 -0
- package/dist/src/services/crystallization/crystallization-service.js +397 -0
- package/dist/src/services/crystallization/crystallization-store.d.ts +75 -0
- package/dist/src/services/crystallization/crystallization-store.js +193 -0
- package/dist/src/services/crystallization/crystallization-types.d.ts +313 -0
- package/dist/src/services/crystallization/crystallization-types.js +299 -0
- package/dist/src/services/crystallization/evidence-brief-builder.d.ts +237 -0
- package/dist/src/services/crystallization/evidence-brief-builder.js +240 -0
- 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/evolution/evolution-service.d.ts +137 -0
- package/dist/src/services/evolution/evolution-service.js +281 -0
- package/dist/src/services/evolution/evolution-store.d.ts +57 -0
- package/dist/src/services/evolution/evolution-store.js +232 -0
- package/dist/src/services/evolution/evolution-types.d.ts +706 -0
- package/dist/src/services/evolution/evolution-types.js +286 -0
- package/dist/src/services/evolution/independent-evaluator-runner.d.ts +90 -0
- package/dist/src/services/evolution/independent-evaluator-runner.js +106 -0
- package/dist/src/services/evolution/regression-skeptic-runner.d.ts +64 -0
- package/dist/src/services/evolution/regression-skeptic-runner.js +113 -0
- 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/loop/loop-bee-relation-service.d.ts +107 -0
- package/dist/src/services/loop/loop-bee-relation-service.js +211 -0
- package/dist/src/services/loop/loop-bee-relation-store.d.ts +53 -0
- package/dist/src/services/loop/loop-bee-relation-store.js +130 -0
- package/dist/src/services/loop/loop-bee-relation-types.d.ts +118 -0
- package/dist/src/services/loop/loop-bee-relation-types.js +114 -0
- package/dist/src/services/loop/loop-release-service.d.ts +46 -0
- package/dist/src/services/loop/loop-release-service.js +66 -0
- package/dist/src/services/loop/loop-release-store.d.ts +55 -0
- package/dist/src/services/loop/loop-release-store.js +134 -0
- package/dist/src/services/loop/loop-release-types.d.ts +250 -0
- package/dist/src/services/loop/loop-release-types.js +162 -0
- 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/share/bundle-reader.d.ts +100 -0
- package/dist/src/services/share/bundle-reader.js +434 -0
- package/dist/src/services/share/bundle-types.d.ts +392 -0
- package/dist/src/services/share/bundle-types.js +318 -0
- package/dist/src/services/share/bundle-writer.d.ts +97 -0
- package/dist/src/services/share/bundle-writer.js +429 -0
- package/dist/src/services/share/run-state-contract.d.ts +133 -0
- package/dist/src/services/share/run-state-contract.js +138 -0
- package/dist/src/services/signal/cancel-handler.js +3 -3
- package/dist/src/services/skill/resume-detector.js +1 -1
- package/dist/src/services/skillhub/release-import.js +7 -2
- package/dist/src/services/skillhub/release-retain.js +6 -1
- package/dist/src/services/skillhub/sqlite-store.js +17 -1
- package/dist/src/services/skillhub/types.d.ts +10 -0
- package/dist/src/services/skills/skill-presence-service.d.ts +1 -1
- package/dist/src/services/standards/loop-engineering-lint.d.ts +38 -0
- package/dist/src/services/standards/loop-engineering-lint.js +101 -0
- package/dist/src/services/standards/loop-engineering-readiness-lint.d.ts +111 -0
- package/dist/src/services/standards/loop-engineering-readiness-lint.js +248 -0
- 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/examples/video-demo/README.md +57 -0
- package/examples/video-demo/out/en-closing-960.png +0 -0
- package/examples/video-demo/out/zh-closing-960.png +0 -0
- package/examples/video-demo/preview/peaks-loop-demo-en.mp4 +0 -0
- package/examples/video-demo/preview/peaks-loop-demo.mp4 +0 -0
- package/output-styles/peaks-skill-swarm.md +3 -3
- package/package.json +6 -2
- 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 +34 -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-content/SKILL.md +272 -0
- package/skills/peaks-issue-fix-orchestrator/SKILL.md +307 -0
- 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
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -4,7 +4,7 @@ description: Peaks 专用输出风格:仅在 peaks skills 工作流中用东
|
|
|
4
4
|
keep-coding-instructions: true
|
|
5
5
|
---
|
|
6
6
|
|
|
7
|
-
This output style is self-gated. Apply the sections below only when the current task explicitly invokes or continues a Peaks-Loop skill workflow, including `/peaks-*`, `skills/peaks-*`, Peaks-Loop PRD/RD/QA/UI/SC/TXT/
|
|
7
|
+
This output style is self-gated. Apply the sections below only when the current task explicitly invokes or continues a Peaks-Loop skill workflow, including `/peaks-*`, `skills/peaks-*`, Peaks-Loop PRD/RD/QA/UI/SC/TXT/Code work, or edits to this repository's `skills/` directory. For unrelated tasks, preserve the default Claude Code behavior and keep responses concise.
|
|
8
8
|
|
|
9
9
|
## Peaks-Loop response contract
|
|
10
10
|
|
|
@@ -14,7 +14,7 @@ When active, make the skill transition visually obvious with a light Northeaster
|
|
|
14
14
|
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
15
15
|
Peaks-Loop Skill Active: <skill-name> — 整活开工,但不整虚的
|
|
16
16
|
Peaks-Loop Role Chain: <PRD → RD → QA → SC, or single role>
|
|
17
|
-
Peaks-Loop Mode: <
|
|
17
|
+
Peaks-Loop Mode: <Code | Assisted | Swarm | Strict | Economy>
|
|
18
18
|
Peaks-Loop Current Gate: <confirmation | dry-run | coverage | QA | commit boundary | handoff>
|
|
19
19
|
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
20
20
|
```
|
|
@@ -54,7 +54,7 @@ Peaks-Loop Skill: <skill-name> | Peaks-Loop Gate: <current gate> | Next: <one sh
|
|
|
54
54
|
Structure active Peaks-Loop responses around:
|
|
55
55
|
|
|
56
56
|
1. **Peaks-Loop Role** — name the active Peaks-Loop role or role chain, for example PRD → RD → QA → SC.
|
|
57
|
-
2. **Peaks-Loop Mode** — state whether the workflow is
|
|
57
|
+
2. **Peaks-Loop Mode** — state whether the workflow is Code, Assisted, Swarm, Strict, or Economy.
|
|
58
58
|
3. **Peaks-Loop Current Gate** — show the current required gate: product confirmation, RD dry-run, coverage, QA acceptance, commit boundary, or handoff.
|
|
59
59
|
4. **Action** — describe the immediate next action in one short sentence before tool use.
|
|
60
60
|
5. **Peaks-Loop Evidence** — end with only the evidence that matters: commands, artifacts, changed files, blockers, and next action.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "peaks-loop",
|
|
3
|
-
"version": "4.0.0-beta",
|
|
3
|
+
"version": "4.0.0-beta.3",
|
|
4
4
|
"description": "Loop Engineering CLI — workflow primitive / loop guards / evaluators / slice orchestration",
|
|
5
5
|
"author": "SquabbyZ",
|
|
6
6
|
"license": "MIT",
|
|
@@ -39,7 +39,11 @@
|
|
|
39
39
|
"README.md",
|
|
40
40
|
"README-en.md",
|
|
41
41
|
"CHANGELOG.md",
|
|
42
|
-
"LICENSE"
|
|
42
|
+
"LICENSE",
|
|
43
|
+
"examples/video-demo/preview/peaks-loop-demo.mp4",
|
|
44
|
+
"examples/video-demo/preview/peaks-loop-demo-en.mp4",
|
|
45
|
+
"examples/video-demo/out/zh-closing-960.png",
|
|
46
|
+
"examples/video-demo/out/en-closing-960.png"
|
|
43
47
|
],
|
|
44
48
|
"scripts": {
|
|
45
49
|
"build": "node ./scripts/sync-version.mjs && node ./scripts/clean-dist.mjs && tsc -p tsconfig.json",
|
|
@@ -56,7 +56,7 @@ The canonical scope dir for this request is provided as `envelope.data.scopeDir`
|
|
|
56
56
|
|
|
57
57
|
## Sub-agent dispatch (when launched by peaks-code swarm)
|
|
58
58
|
|
|
59
|
-
When this skill is launched as a sub-agent via `peaks sub-agent dispatch <role>` (then the LLM executes the returned toolCall) from `peaks-code`, the following sections of THIS skill are **suspended** for the sub-agent run: Session id, Skill presence, Workspace initialization, Mode selection, Statusline install. The sub-agent must NOT call `peaks request init` (
|
|
59
|
+
When this skill is launched as a sub-agent via `peaks sub-agent dispatch <role>` (then the LLM executes the returned toolCall) from `peaks-code`, the following sections of THIS skill are **suspended** for the sub-agent run: Session id, Skill presence, Workspace initialization, Mode selection, Statusline install. The sub-agent must NOT call `peaks request init` (Code already initialised the slot), and must write `.peaks/_runtime/<sessionId>/qa/test-cases/<rid>.md` with test cases that link to PRD acceptance items. Return only a compact JSON envelope.
|
|
60
60
|
|
|
61
61
|
> **v2.15.0+ 校准:** 每个 slice 完成,user 必介入做**业务审阅**(4-5 项业务/产品清单:业务流程 / 需求覆盖 / 边界 case / UI 装配 / 能合入下版吗),**不是技术审阅**。业务审过 → 进 final;业务不通过 → 返工。详见 `.peaks/memory/peaks-loop-slice-review-and-qa-perspective.md`。
|
|
62
62
|
|
|
@@ -9,12 +9,12 @@ The three files for any QA invocation land under the active session's `qa/` work
|
|
|
9
9
|
| # | File | Path | Reader | Content |
|
|
10
10
|
|---|------|------|--------|---------|
|
|
11
11
|
| 1 | Test cases | `.peaks/_runtime/<session-id>/qa/test-cases/<request-id>.md` | RD (before impl), QA | Generated test scenarios with status |
|
|
12
|
-
| 2 | Test report | `.peaks/_runtime/<session-id>/qa/test-reports/<request-id>.md` | QA, SC,
|
|
13
|
-
| 3 | Request artifact | `.peaks/_runtime/<session-id>/qa/requests/<request-id>.md` |
|
|
12
|
+
| 2 | Test report | `.peaks/_runtime/<session-id>/qa/test-reports/<request-id>.md` | QA, SC, Code | Summary, coverage%, security, perf, risks |
|
|
13
|
+
| 3 | Request artifact | `.peaks/_runtime/<session-id>/qa/requests/<request-id>.md` | Code, RD↔QA loop | Verdict, boundary check, links to #1 and #2 |
|
|
14
14
|
|
|
15
15
|
## Required content
|
|
16
16
|
|
|
17
|
-
The request artifact is the **verdict carrier** — it must include: QA verdict (`pass` / `return-to-rd` / `blocked`), the red-line audit outcome, links to the test-cases and test-report, the boundary check (acceptance items covered, gaps), and any cross-skill handoff notes for
|
|
17
|
+
The request artifact is the **verdict carrier** — it must include: QA verdict (`pass` / `return-to-rd` / `blocked`), the red-line audit outcome, links to the test-cases and test-report, the boundary check (acceptance items covered, gaps), and any cross-skill handoff notes for Code. The test cases file enumerates every scenario with status; the test report summarises execution and links the security / performance / regression companion files.
|
|
18
18
|
|
|
19
19
|
## Rules
|
|
20
20
|
|
|
@@ -3,14 +3,14 @@
|
|
|
3
3
|
> Body of `## Sub-agent dispatch`. When this skill is launched as a sub-agent via `peaks sub-agent dispatch <role>` (then the LLM executes the returned toolCall) from `peaks-code`, the following sections of THIS skill are **suspended** for the sub-agent run:
|
|
4
4
|
|
|
5
5
|
- **Session id** — use the parent's sid (read `.peaks/_runtime/session.json` or pass `--session-id <parent-sid>` to any session-creating CLI). Do NOT spawn your own session. The new `peaks session info --active` reads the canonical binding for you.
|
|
6
|
-
- **Skill presence (MANDATORY first action)** — do NOT call `peaks skill presence:set peaks-qa`. The sub-agent must not overwrite `.peaks/.active-skill.json`; the main
|
|
7
|
-
- **Workspace initialization** —
|
|
8
|
-
- **Mode selection** —
|
|
9
|
-
- **Statusline install** — already done by
|
|
6
|
+
- **Skill presence (MANDATORY first action)** — do NOT call `peaks skill presence:set peaks-qa`. The sub-agent must not overwrite `.peaks/.active-skill.json`; the main Code loop owns that file. If you need to mark your own state, write a marker file at `.peaks/_runtime/<sessionId>/system/sub-agent-qa.json` and only that.
|
|
7
|
+
- **Workspace initialization** — Code has already run `peaks workspace init` before fan-out. Do not re-run it.
|
|
8
|
+
- **Mode selection** — Code has already chosen the mode.
|
|
9
|
+
- **Statusline install** — already done by Code at session startup.
|
|
10
10
|
|
|
11
11
|
What the sub-agent **MUST** still do:
|
|
12
12
|
|
|
13
|
-
0. **Do NOT call `peaks request init`** —
|
|
13
|
+
0. **Do NOT call `peaks request init`** — Code has already initialised the request artefact slot in the main loop before fan-out. The sub-agent reads it via `peaks request show <rid> --role qa --project <repo> --json` if it needs to.
|
|
14
14
|
2. `peaks request show <rid> --role prd --project <repo> --json` (and `--role rd`, `--role ui` if UI is in the swarm plan).
|
|
15
15
|
3. Standards preflight (dry-run only).
|
|
16
16
|
4. Write `.peaks/_runtime/<sessionId>/qa/test-cases/<rid>.md` with test cases that link to PRD acceptance items.
|
|
@@ -30,7 +30,7 @@ What the sub-agent **MUST** still do:
|
|
|
30
30
|
**Hard prohibitions** (sub-agent context):
|
|
31
31
|
|
|
32
32
|
- Do NOT call `Skill(skill="...")`.
|
|
33
|
-
- Do NOT call `peaks skill presence:set` —
|
|
33
|
+
- Do NOT call `peaks skill presence:set` — Code owns the active-skill file.
|
|
34
34
|
- Do NOT run the actual test suite, do NOT execute security/perf tools, do NOT open a browser — those are the **QA validation** phase, not the Swarm planning phase.
|
|
35
35
|
- Do NOT commit, push, install hooks, or apply settings.json mutations.
|
|
36
36
|
- Do NOT ask the user interactive questions. If you need clarification, return `{"status":"blocked","blockedReason":"<text>"}`.
|
|
@@ -73,7 +73,7 @@ end of implementation, RD fires 3 sub-agents in parallel via
|
|
|
73
73
|
conversation context. They MUST NOT mutate parent settings
|
|
74
74
|
(`peaks skill presence:set`, hooks install, `.claude/settings.json`).
|
|
75
75
|
- Sub-agents MUST NOT call `peaks workflow verify-pipeline` — that is
|
|
76
|
-
|
|
76
|
+
Code's responsibility.
|
|
77
77
|
- Sub-agents MUST NOT modify the request artifact body — they only
|
|
78
78
|
write their respective review artifact.
|
|
79
79
|
- Sub-agents MUST NOT install or persist external material (no
|
|
@@ -28,7 +28,7 @@ peaks understand show --project <repo> --json # when UA artifac
|
|
|
28
28
|
peaks codegraph context --project <repo> "<task>"
|
|
29
29
|
peaks codegraph affected --project <repo> <changed-files...> --json
|
|
30
30
|
|
|
31
|
-
# 4.1 read project-scan from
|
|
31
|
+
# 4.1 read project-scan from Code's pre-RD scan — BLOCKING if missing
|
|
32
32
|
# **STOP if .peaks/_runtime/<sessionId>/rd/project-scan.md does not exist.**
|
|
33
33
|
# **Do not write any code, do not plan any implementation, do not pass go.**
|
|
34
34
|
# **Create the project-scan first, then proceed.**
|
|
@@ -37,21 +37,21 @@
|
|
|
37
37
|
> design — if either changes, update the other.
|
|
38
38
|
|
|
39
39
|
- **Session id** — use the parent's sid (read `.peaks/_runtime/session.json` or pass `--session-id <parent-sid>` to any session-creating CLI). Do NOT spawn your own session. The new `peaks session info --active` reads the canonical binding for you.
|
|
40
|
-
- **Skill presence (MANDATORY first action)** — do NOT call `peaks skill presence:set peaks-rd`. The sub-agent must not overwrite `.peaks/.active-skill.json`; the main
|
|
41
|
-
- **Workspace initialization** —
|
|
42
|
-
- **Mode selection** —
|
|
43
|
-
- **Statusline install** — already done by
|
|
40
|
+
- **Skill presence (MANDATORY first action)** — do NOT call `peaks skill presence:set peaks-rd`. The sub-agent must not overwrite `.peaks/.active-skill.json`; the main Code loop owns that file. If you need to mark your own state, write a marker file at `.peaks/_runtime/<sessionId>/system/sub-agent-rd.json` and only that.
|
|
41
|
+
- **Workspace initialization** — Code has already run `peaks workspace init` before fan-out. Do not re-run it.
|
|
42
|
+
- **Mode selection** — Code has already chosen the mode. Read it from the prompt arguments (or from `.peaks/.active-skill.json` if you can, but do not write it).
|
|
43
|
+
- **Statusline install** — already done by Code at session startup; do not re-run.
|
|
44
44
|
|
|
45
45
|
What the sub-agent **MUST** still do, from this skill's contract:
|
|
46
46
|
|
|
47
|
-
0. **Do NOT call `peaks request init`** —
|
|
47
|
+
0. **Do NOT call `peaks request init`** — Code has already initialised the request artefact slot in the main loop before fan-out (the runbook has the exact `peaks request init --role rd --id <rid> --project <repo> --apply --type <type> --json` call). The sub-agent reads the slot via `peaks request show <rid> --role rd --project <repo> --json` if it needs to. Note: `peaks request init` is **dry-run by default**. Pass `--apply` to actually create the artifact.
|
|
48
48
|
2. `peaks request show <rid> --role prd --project <repo> --json` (and `--role ui` if UI is in the swarm plan).
|
|
49
|
-
3. Standards preflight (dry-run only;
|
|
50
|
-
4. Project-scan read; create `rd/project-scan.md` only if
|
|
49
|
+
3. Standards preflight (dry-run only; Code owns the apply step).
|
|
50
|
+
4. Project-scan read; create `rd/project-scan.md` only if Code flagged it missing in the dispatch prompt.
|
|
51
51
|
5. Write the planning artefact: `rd/requests/<rid>.md` (feature/refactor, per the `artifact-per-request.md` contract) or `rd/bug-analysis.md` (bugfix). If `--type` is `config|docs|chore`, **no planning artefact is required** — return immediately with `{"role":"rd-planning","status":"skipped","reason":"type=<type>"}`.
|
|
52
52
|
|
|
53
53
|
> **v2.11.0 change (Group A):** `rd/tech-doc.md` is removed. The per-slice planning record is the per-request artefact at `rd/requests/<rid>.md`; the slice's source-of-truth architecture is the immutable peaks-prd handoff at `prd/handoff.md` (verify handoff hash = `<dispatched value>` before reading).
|
|
54
|
-
6. Return only a compact JSON envelope —
|
|
54
|
+
6. Return only a compact JSON envelope — Code will run the convergence gate (`ls` checks):
|
|
55
55
|
|
|
56
56
|
```json
|
|
57
57
|
{
|
|
@@ -67,12 +67,12 @@ What the sub-agent **MUST** still do, from this skill's contract:
|
|
|
67
67
|
**Hard prohibitions** (sub-agent context, in addition to general red lines):
|
|
68
68
|
|
|
69
69
|
- Do NOT call `Skill(skill="...")` from inside the sub-agent — that defeats the fan-out.
|
|
70
|
-
- Do NOT call `peaks skill presence:set` —
|
|
70
|
+
- Do NOT call `peaks skill presence:set` — Code owns the active-skill file.
|
|
71
71
|
- Do NOT commit, push, install hooks, or apply settings.json mutations.
|
|
72
|
-
- Do NOT ask the user interactive questions. If you need clarification, return `{"status":"blocked","blockedReason":"<text>"}` and let
|
|
72
|
+
- Do NOT ask the user interactive questions. If you need clarification, return `{"status":"blocked","blockedReason":"<text>"}` and let Code handle the user message.
|
|
73
73
|
- Do NOT modify code (the Swarm phase is planning only; code edits happen in the RD implementation phase, which is a separate sub-agent or inline run after Gate B).
|
|
74
74
|
|
|
75
|
-
After returning,
|
|
75
|
+
After returning, Code re-checks Gate B (`ls .peaks/_runtime/<sessionId>/rd/requests/<rid>.md` etc.) and proceeds to RD implementation, which is a different sub-agent or inline run.
|
|
76
76
|
|
|
77
77
|
## Test Tool Detection (mandatory)
|
|
78
78
|
|
|
@@ -104,7 +104,7 @@ peaks scan request-type-sanity --project <repo> --type <type> --json
|
|
|
104
104
|
peaks request repair-status <rid> --project <repo> --session-id <session-id> --json
|
|
105
105
|
# Expected: atCap=false. exit 0.
|
|
106
106
|
# atCap=true → BLOCKED. Three repair cycles already attempted; emit a blocked TXT
|
|
107
|
-
# handoff via
|
|
107
|
+
# handoff via Code rather than entering a fourth cycle.
|
|
108
108
|
```
|
|
109
109
|
|
|
110
110
|
**Peaks-Loop Gate B8 — Diff stays inside the declared red-line scope:**
|
|
@@ -61,7 +61,7 @@ Every SC invocation must write a change-control record at `.peaks/_runtime/<sess
|
|
|
61
61
|
- validation result (`peaks sc validate` output);
|
|
62
62
|
- boundary record (`peaks sc boundary` output).
|
|
63
63
|
|
|
64
|
-
|
|
64
|
+
Code reads this record before declaring the workflow complete.
|
|
65
65
|
|
|
66
66
|
## Refactor role
|
|
67
67
|
|
|
@@ -21,7 +21,7 @@ Before any analysis or tool call, immediately run:
|
|
|
21
21
|
peaks skill presence:set peaks-txt --project <repo> --mode <mode> --gate startup
|
|
22
22
|
```
|
|
23
23
|
|
|
24
|
-
**When invoked as a sub-agent (peaks-code swarm):** do NOT call `peaks skill presence:set` (
|
|
24
|
+
**When invoked as a sub-agent (peaks-code swarm):** do NOT call `peaks skill presence:set` (Code owns the active-skill marker) and do NOT spawn your own session. Use the parent's sid — read `.peaks/_runtime/session.json` or pass `--session-id <parent-sid>` to any session-creating CLI. The new `peaks session info --active` reads the canonical binding for you.
|
|
25
25
|
|
|
26
26
|
On the first presence:set in a project, ensure the out-of-band status bar is installed so the user can see at a glance that Peaks is orchestrating — it renders the active skill in Claude Code's terminal status line, independent of model output:
|
|
27
27
|
|
|
@@ -68,7 +68,7 @@ When used alone or when a workflow needs portable artifacts that must survive se
|
|
|
68
68
|
|
|
69
69
|
```markdown
|
|
70
70
|
## Handoff: <request-id>
|
|
71
|
-
- **Mode:**
|
|
71
|
+
- **Mode:** code | assisted | swarm | strict
|
|
72
72
|
- **Status:** complete | blocked | return-to-rd
|
|
73
73
|
- **Artifacts:**
|
|
74
74
|
- PRD: .peaks/_runtime/<sessionId>/prd/requests/<rid>.md
|
|
@@ -114,7 +114,7 @@ Each entry should include:
|
|
|
114
114
|
- lesson or rule;
|
|
115
115
|
- why it exists;
|
|
116
116
|
- affected skills;
|
|
117
|
-
- how future PRD/RD/UI/QA/SC/
|
|
117
|
+
- how future PRD/RD/UI/QA/SC/Code workflows should apply it;
|
|
118
118
|
- whether it is stable enough for `.peaks/memory` extraction.
|
|
119
119
|
|
|
120
120
|
## Project memory guidance
|
|
@@ -37,14 +37,14 @@ UI inherits `peaks-qa`'s hard-block contract: `AskUserQuestion` with three optio
|
|
|
37
37
|
When this skill is launched as a sub-agent via `peaks sub-agent dispatch <role>` from `peaks-code`, these sections are **suspended** for the sub-agent run:
|
|
38
38
|
|
|
39
39
|
- **Session id** — use parent's sid (`.peaks/_runtime/session.json` or `--session-id <parent-sid>`). Do NOT spawn your own session; `peaks session info --active` reads the canonical binding.
|
|
40
|
-
- **Skill presence** — do NOT call `peaks skill presence:set peaks-ui`;
|
|
41
|
-
- **Workspace initialization** —
|
|
42
|
-
- **Mode selection** —
|
|
43
|
-
- **Statusline install** — done by
|
|
40
|
+
- **Skill presence** — do NOT call `peaks skill presence:set peaks-ui`; Code owns `.peaks/.active-skill.json`. Marker file at `.peaks/_runtime/<session-id>/system/sub-agent-ui.json` only.
|
|
41
|
+
- **Workspace initialization** — Code ran `peaks workspace init` before fan-out; do not re-run.
|
|
42
|
+
- **Mode selection** — Code chose the mode.
|
|
43
|
+
- **Statusline install** — done by Code at startup.
|
|
44
44
|
|
|
45
45
|
What the sub-agent **MUST** still do:
|
|
46
46
|
|
|
47
|
-
1. **Do NOT call `peaks request init`** —
|
|
47
|
+
1. **Do NOT call `peaks request init`** — Code already initialised the slot. Read via `peaks request show <rid> --role ui --project <repo> --json` if needed.
|
|
48
48
|
2. Read PRD scope via `peaks request show <rid> --role prd --project <repo> --json`.
|
|
49
49
|
3. Read `rd/project-scan.md` for component library / CSS framework / design-system context.
|
|
50
50
|
4. Run the prototype fidelity check (Figma / PRD visuals / headed browser).
|
|
@@ -65,13 +65,13 @@ What the sub-agent **MUST** still do:
|
|
|
65
65
|
**Hard prohibitions** (sub-agent context):
|
|
66
66
|
|
|
67
67
|
- Do NOT call `Skill(skill="...")`.
|
|
68
|
-
- Do NOT call `peaks skill presence:set` —
|
|
68
|
+
- Do NOT call `peaks skill presence:set` — Code owns active-skill.
|
|
69
69
|
- Do NOT modify application code. UI is design-direction only.
|
|
70
|
-
- Do NOT install MCP servers. If Playwright MCP is missing and headed browser is required, return `{"status":"blocked","blockedReason":"playwright-mcp-unavailable"}` for
|
|
70
|
+
- Do NOT install MCP servers. If Playwright MCP is missing and headed browser is required, return `{"status":"blocked","blockedReason":"playwright-mcp-unavailable"}` for Code escalation. (peaks-loop no longer manages MCP install — user runs `claude mcp add playwright -- npx @playwright/mcp@latest` in Claude Code.)
|
|
71
71
|
- Do NOT commit, push, install hooks, or apply settings.json mutations.
|
|
72
72
|
- Do NOT ask user questions; return `{"status":"blocked","blockedReason":"<text>"}` if blocked.
|
|
73
73
|
|
|
74
|
-
If the request does not affect user-visible behavior (no frontend keyword hit, `frontendOnly=false`), the swarm plan should not include UI at all —
|
|
74
|
+
If the request does not affect user-visible behavior (no frontend keyword hit, `frontendOnly=false`), the swarm plan should not include UI at all — Code will not launch this sub-agent. But if it does launch you and you determine the work is non-visual, return `{"status":"skipped","reason":"non-frontend-request"}` so Code can record the misfire.
|
|
75
75
|
|
|
76
76
|
## Skill presence (MANDATORY first action — main-loop context only)
|
|
77
77
|
|
|
@@ -3,6 +3,19 @@ name: peaks-code
|
|
|
3
3
|
description: Code-domain loop engineering orchestrator for the Peaks-Loop skill family. Use when the user asks Peaks-Loop to handle a code-repo workflow end-to-end (端到端/全流程/需求开发), especially from a product document (PRD/飞书文档/Feishu doc) through implementation and validation. Coordinates peaks-prd, peaks-rd, peaks-qa, peaks-ui, peaks-sc, and peaks-txt while preserving user confirmation gates. Triggers on `/peaks-code`, "peaks code", "全流程开发", "端到端迭代". General primitives (peaks-resume / peaks-status / peaks-test) are sibling skills, not children.
|
|
4
4
|
---
|
|
5
5
|
|
|
6
|
+
## Scope (RL-8 — red line, locked 2026-07-08)
|
|
7
|
+
|
|
8
|
+
`peaks-code` is a **code-domain long-task loop engineering orchestrator; not a general-purpose orchestrator.**
|
|
9
|
+
|
|
10
|
+
This is RL-8 from the Loop Engineering crystallization design
|
|
11
|
+
(`docs/superpowers/specs/2026-07-07-peaks-loop-loop-engineering-crystallization-design.md` §0.4 and §10 RL-8).
|
|
12
|
+
The boundary is closed under this slice:
|
|
13
|
+
|
|
14
|
+
- **In scope:** end-to-end code-domain workflows — repository scanning, RD planning, code implementation via RD, QA verification, UI changes inside a code repo, source-control handoff, and code-repo context packaging. Coordinated role skills: `peaks-prd`, `peaks-rd`, `peaks-qa`, `peaks-ui`, `peaks-sc`, `peaks-txt`.
|
|
15
|
+
- **Out of scope:** research / content / product / medical / non-code domains. Each of those ships as an independent `peaks-*` skill that imports `.peaks/standards/loop-engineering-guidelines.md` and passes `peaks skill lint --category loop-engineering-readiness`. They are **not** subclasses or variants of `peaks-code`.
|
|
16
|
+
- **Failure modes this rule prevents:** (a) `peaks-code` widening into a general orchestrator; (b) non-code capabilities being smuggled into `peaks-code`; (c) other domains being expressed as "peaks-code variants".
|
|
17
|
+
- **Self-check:** before any new peak-* capability is added here, ask "is this code-domain?" If the answer is no, the right move is a new `peaks-*` skill, not an extension of `peaks-code`.
|
|
18
|
+
|
|
6
19
|
## Single-scope-axis naming convention (2.7.1)
|
|
7
20
|
|
|
8
21
|
The `.peaks/` workspace has a **single scope axis** (session-id) plus a nested **sub-agent axis** under `.peaks/_sub_agents/<sessionId>/...`. Use `<sessionId>` (NEVER bare `<sid>`). Reviewable artifacts live at `.peaks/_runtime/<sessionId>/<role>/...` (gitignored); the change-id is an optional filename slug and does NOT route filesystem writes. CLI: session-id → `peaks session *`; sub-agent → `peaks sub-agent *`. OpenSpec's `openspec/changes/<change-id>/` vocabulary (L4) is preserved. Test `skills-skill-md-naming.test.ts` enforces (a) zero bare `<sid>`, (b) axis labels, (c) this callout.
|
|
@@ -15,9 +28,9 @@ Every sub-agent dispatch (`peaks-prd`, `peaks-rd`, `peaks-qa`, `peaks-ui`, `peak
|
|
|
15
28
|
|
|
16
29
|
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
30
|
|
|
18
|
-
# Peaks-Loop
|
|
31
|
+
# Peaks-Loop Code
|
|
19
32
|
|
|
20
|
-
Peaks-Loop
|
|
33
|
+
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
34
|
|
|
22
35
|
## 产品定位(2026-06-28 校准)
|
|
23
36
|
|
|
@@ -29,7 +42,7 @@ This skill is the **primary surface**. The `peaks <cmd>` CLI is **auxiliary**
|
|
|
29
42
|
|
|
30
43
|
## Code-Change Red Line (BLOCKING — read before ANY tool call)
|
|
31
44
|
|
|
32
|
-
**Peaks-Loop
|
|
45
|
+
**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
46
|
|
|
34
47
|
## Peaks-Loop Startup sequence (MANDATORY — execute in order)
|
|
35
48
|
|
|
@@ -43,7 +56,7 @@ When a NEW conversation opens on a session whose `lastActivity` is from today AN
|
|
|
43
56
|
|
|
44
57
|
### Peaks-Loop Step N: Periodic checkpoint (auto-fire, no user action)
|
|
45
58
|
|
|
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/
|
|
59
|
+
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
60
|
|
|
48
61
|
### Peaks-Loop Step 0.5: OpenSpec first-run opt-in (conditional)
|
|
49
62
|
|
|
@@ -61,7 +74,7 @@ After autonomous work (RD, QA, security, perf), invoke peaks-final-review for 4-
|
|
|
61
74
|
|
|
62
75
|
### Peaks-Loop Step N+2: Main-session context monitor (D6 + slice 2026-07-02)
|
|
63
76
|
|
|
64
|
-
After every 4th tool call, probe via `peaks
|
|
77
|
+
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
78
|
|
|
66
79
|
### Peaks-Loop Step 0: Anchor the workflow (MANDATORY FIRST ACTIONS — no bail-out)
|
|
67
80
|
|
|
@@ -79,9 +92,9 @@ Run `peaks workspace init` + `peaks skill presence:set peaks-code` BEFORE any an
|
|
|
79
92
|
|
|
80
93
|
After Step 0, run the resume-detection probe; surface via `AskUserQuestion` if a slice is in flight.
|
|
81
94
|
|
|
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
|
|
95
|
+
**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
96
|
|
|
84
|
-
**v2.11.0 D7 override:** if user just `/compact`ed, run `peaks
|
|
97
|
+
**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
98
|
|
|
86
99
|
→ see `references/resume-detection.md`.
|
|
87
100
|
|
|
@@ -91,15 +104,15 @@ After Step 0.7 returns "fresh", run `peaks upgrade --detect-1x --project <root>
|
|
|
91
104
|
|
|
92
105
|
### Peaks-Loop Step 0.8 — Job 启动 (BLOCKING on LLM judgement — v3.1.1 patch + v3.1.2 mechanical gates)
|
|
93
106
|
|
|
94
|
-
The CLI is a **recorder + gate** for job-shape (the LLM judges). LLM calls `peaks
|
|
107
|
+
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
108
|
|
|
96
|
-
**Hard rule (v3.1.1 red-line #10):** LLM MUST NOT skip `peaks
|
|
109
|
+
**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
110
|
|
|
98
111
|
**v3.1.2 mechanical gates** (recorder-only was bypassed twice):
|
|
99
112
|
|
|
100
|
-
- **PreToolUse hook** — `peaks workspace init` installs the `Bash` matcher `peaks
|
|
101
|
-
- **Size-fear ban** — `peaks
|
|
102
|
-
- **Forced auto-compact** — `peaks
|
|
113
|
+
- **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).
|
|
114
|
+
- **Size-fear ban** — `peaks code emit-handoff` refuses a final handoff while `remaining > 0` under Job mode.
|
|
115
|
+
- **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
116
|
- **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
117
|
|
|
105
118
|
Full mechanics (judgement criteria, hook table, backup-regex rationale, hook wiring) at `references/step-0-8-gate.md`.
|
|
@@ -144,7 +157,7 @@ When peaks-code dispatches a sub-agent (peaks-rd, peaks-qa, peaks-ui, peaks-txt,
|
|
|
144
157
|
|
|
145
158
|
## Boundaries
|
|
146
159
|
|
|
147
|
-
Peaks-Loop
|
|
160
|
+
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
161
|
|
|
149
162
|
## Peaks-Loop GStack integration
|
|
150
163
|
|
|
@@ -160,7 +173,7 @@ Before handing off to `peaks-rd`, scan the project and record findings to `.peak
|
|
|
160
173
|
|
|
161
174
|
## Peaks-Loop Frontend-only development mode
|
|
162
175
|
|
|
163
|
-
When the project has no live backend (no swagger.json, no API server),
|
|
176
|
+
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
177
|
|
|
165
178
|
## Peaks-Loop Request type classification + Workflow order + Transition verification gates
|
|
166
179
|
|
|
@@ -186,7 +199,7 @@ Write DAG → `.peaks/_runtime/<sessionId>/sc/slice-dag.json`, run `peaks sub-ag
|
|
|
186
199
|
|
|
187
200
|
## Peaks-Loop Mandatory RD QA repair loop (AUTO-PROCEED)
|
|
188
201
|
|
|
189
|
-
After `peaks-rd` finishes,
|
|
202
|
+
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
203
|
|
|
191
204
|
## Default runbook
|
|
192
205
|
|
|
@@ -216,7 +229,7 @@ After final validation, refresh project-local standards via `peaks standards ini
|
|
|
216
229
|
|
|
217
230
|
## Peaks-Loop Step 11: Memory sediment (BLOCKING on workflow complete)
|
|
218
231
|
|
|
219
|
-
> **Hard rule.**
|
|
232
|
+
> **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
233
|
|
|
221
234
|
### Substeps (BLOCKING)
|
|
222
235
|
|
|
@@ -228,19 +241,19 @@ After final validation, refresh project-local standards via `peaks standards ini
|
|
|
228
241
|
|
|
229
242
|
**11d — Gate C (zero-write outcome):** If `extractedCount === 0` after 11c, fire AskUserQuestion:
|
|
230
243
|
|
|
231
|
-
> "本次
|
|
244
|
+
> "本次 code 未沉淀任何 `.peaks/memory` 文件。可选: (a) 回去在 handoff.md 嵌入至少 1 个 `peaks-memory:start` block 后重试; (b) 显式接受 no-sediment 并记录为 lesson; (c) 取消完成。"
|
|
232
245
|
|
|
233
|
-
Default option = (a).
|
|
246
|
+
Default option = (a). Code MUST NOT silently accept (b) without user pick. Full bash + flow at `references/runbook.md` §Step 11.
|
|
234
247
|
|
|
235
248
|
**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
249
|
|
|
237
250
|
## Peaks-Loop External references and lifecycle
|
|
238
251
|
|
|
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
|
|
252
|
+
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
253
|
|
|
241
254
|
## Codegraph orchestration context
|
|
242
255
|
|
|
243
|
-
`peaks codegraph affected` is an optional project-analysis enhancement (untrusted supporting evidence) for role handoff.
|
|
256
|
+
`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
257
|
|
|
245
258
|
## Sub-agent context governance (G7 + G7.7 + G8 + G9 — slice #010)
|
|
246
259
|
|
|
@@ -260,7 +273,7 @@ Index of every `references/` file. Read on demand.
|
|
|
260
273
|
| `references/a2a-artifact-mapping.md` | A2A artifact-path mapping. |
|
|
261
274
|
| `references/anchoring-and-session-info.md` | Step 0 + session-conflict. |
|
|
262
275
|
| `references/artifact-contracts.md` | Sub-agent handoff contracts. |
|
|
263
|
-
| `references/boundaries.md` |
|
|
276
|
+
| `references/boundaries.md` | Code's do / don't list. |
|
|
264
277
|
| `references/browser-workflow.md` | Browser workflow (Playwright MCP). |
|
|
265
278
|
| `references/codegraph-orchestration.md` | Codegraph role handoff. |
|
|
266
279
|
| `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 |
|