peaks-cli 1.3.8 → 1.4.0
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/dist/src/cli/commands/core-artifact-commands.js +27 -0
- package/dist/src/cli/commands/project-commands.js +58 -1
- package/dist/src/cli/commands/request-commands.js +93 -3
- package/dist/src/cli/commands/retrospective-commands.d.ts +3 -0
- package/dist/src/cli/commands/retrospective-commands.js +113 -0
- package/dist/src/cli/commands/skill-scope-commands.d.ts +49 -0
- package/dist/src/cli/commands/skill-scope-commands.js +305 -0
- package/dist/src/cli/commands/workflow-commands.js +1 -1
- package/dist/src/cli/commands/workflow-plan-commands.d.ts +39 -0
- package/dist/src/cli/commands/workflow-plan-commands.js +163 -0
- package/dist/src/cli/program.js +8 -0
- package/dist/src/services/doctor/doctor-service.d.ts +40 -0
- package/dist/src/services/doctor/doctor-service.js +160 -0
- package/dist/src/services/hooks/presence-marker-detector.d.ts +16 -0
- package/dist/src/services/hooks/presence-marker-detector.js +105 -0
- package/dist/src/services/memory/project-memory-service.d.ts +19 -0
- package/dist/src/services/memory/project-memory-service.js +33 -0
- package/dist/src/services/retrospective/migrate-from-md.d.ts +37 -0
- package/dist/src/services/retrospective/migrate-from-md.js +528 -0
- package/dist/src/services/retrospective/retrospective-index.d.ts +37 -0
- package/dist/src/services/retrospective/retrospective-index.js +110 -0
- package/dist/src/services/retrospective/retrospective-show.d.ts +40 -0
- package/dist/src/services/retrospective/retrospective-show.js +109 -0
- package/dist/src/services/skill-scope/adapters/_stub-helper.d.ts +39 -0
- package/dist/src/services/skill-scope/adapters/_stub-helper.js +98 -0
- package/dist/src/services/skill-scope/adapters/claude-code.d.ts +59 -0
- package/dist/src/services/skill-scope/adapters/claude-code.js +304 -0
- package/dist/src/services/skill-scope/adapters/codex.d.ts +2 -0
- package/dist/src/services/skill-scope/adapters/codex.js +12 -0
- package/dist/src/services/skill-scope/adapters/cursor.d.ts +2 -0
- package/dist/src/services/skill-scope/adapters/cursor.js +13 -0
- package/dist/src/services/skill-scope/adapters/qoder.d.ts +2 -0
- package/dist/src/services/skill-scope/adapters/qoder.js +13 -0
- package/dist/src/services/skill-scope/adapters/tongyi.d.ts +2 -0
- package/dist/src/services/skill-scope/adapters/tongyi.js +13 -0
- package/dist/src/services/skill-scope/adapters/trae.d.ts +2 -0
- package/dist/src/services/skill-scope/adapters/trae.js +12 -0
- package/dist/src/services/skill-scope/detect.d.ts +75 -0
- package/dist/src/services/skill-scope/detect.js +480 -0
- package/dist/src/services/skill-scope/registry.d.ts +41 -0
- package/dist/src/services/skill-scope/registry.js +83 -0
- package/dist/src/services/skill-scope/source-of-truth.d.ts +44 -0
- package/dist/src/services/skill-scope/source-of-truth.js +118 -0
- package/dist/src/services/skill-scope/types.d.ts +176 -0
- package/dist/src/services/skill-scope/types.js +74 -0
- package/dist/src/services/standards/migrate-service.d.ts +63 -0
- package/dist/src/services/standards/migrate-service.js +193 -0
- package/dist/src/services/standards/project-standards-service.js +1 -23
- package/dist/src/services/workflow/artifact-paths.d.ts +59 -0
- package/dist/src/services/workflow/artifact-paths.js +127 -0
- package/dist/src/services/workflow/pipeline-verify-service.d.ts +6 -0
- package/dist/src/services/workflow/pipeline-verify-service.js +49 -4
- package/dist/src/services/workflow/plan-reader.d.ts +29 -0
- package/dist/src/services/workflow/plan-reader.js +158 -0
- package/dist/src/services/workflow/plan-refresher.d.ts +32 -0
- package/dist/src/services/workflow/plan-refresher.js +353 -0
- package/dist/src/services/workflow/plan-trigger-detector.d.ts +55 -0
- package/dist/src/services/workflow/plan-trigger-detector.js +142 -0
- package/dist/src/shared/format-md-compact.d.ts +32 -0
- package/dist/src/shared/format-md-compact.js +297 -0
- package/dist/src/shared/stale-policy.d.ts +67 -0
- package/dist/src/shared/stale-policy.js +85 -0
- package/dist/src/shared/version.d.ts +1 -1
- package/dist/src/shared/version.js +1 -1
- package/package.json +3 -2
- package/schemas/doctor-report.schema.json +2 -2
- package/skills/peaks-qa/SKILL.md +103 -507
- package/skills/peaks-qa/references/artifact-per-request.md +7 -79
- package/skills/peaks-qa/references/browser-validation-contracts.md +51 -0
- package/skills/peaks-qa/references/codegraph-regression-focus.md +5 -0
- package/skills/peaks-qa/references/external-capability-guidance.md +9 -0
- package/skills/peaks-qa/references/qa-compact-handoff.md +3 -0
- package/skills/peaks-qa/references/qa-context-governance.md +24 -0
- package/skills/peaks-qa/references/qa-fanout-contract.md +8 -0
- package/skills/peaks-qa/references/qa-gstack-integration.md +7 -0
- package/skills/peaks-qa/references/qa-local-artifacts.md +3 -0
- package/skills/peaks-qa/references/qa-matt-pocock-integration.md +9 -0
- package/skills/peaks-qa/references/qa-perf-test-plan.md +67 -0
- package/skills/peaks-qa/references/qa-refactor-role.md +3 -0
- package/skills/peaks-qa/references/qa-runbook.md +74 -0
- package/skills/peaks-qa/references/qa-security-test-plan.md +73 -0
- package/skills/peaks-qa/references/qa-skill-presence.md +22 -0
- package/skills/peaks-qa/references/qa-standards-preflight.md +8 -0
- package/skills/peaks-qa/references/qa-sub-agent-dispatch.md +38 -0
- package/skills/peaks-qa/references/qa-transition-gates.md +83 -0
- package/skills/peaks-qa/references/requirement-boundary-recheck.md +9 -0
- package/skills/peaks-qa/references/test-case-generation.md +27 -0
- package/skills/peaks-qa/references/test-report-output.md +14 -0
- package/skills/peaks-rd/SKILL.md +85 -612
- package/skills/peaks-rd/references/artifact-and-standards-output.md +9 -0
- package/skills/peaks-rd/references/artifact-per-request.md +20 -0
- package/skills/peaks-rd/references/browser-self-test-contracts.md +29 -0
- package/skills/peaks-rd/references/codegraph-project-analysis.md +5 -0
- package/skills/peaks-rd/references/compact-handoff.md +3 -0
- package/skills/peaks-rd/references/external-references.md +11 -0
- package/skills/peaks-rd/references/frontend-project-generation.md +11 -0
- package/skills/peaks-rd/references/library-version-awareness.md +30 -0
- package/skills/peaks-rd/references/mandatory-perf-baseline.md +42 -0
- package/skills/peaks-rd/references/mandatory-tech-doc.md +18 -0
- package/skills/peaks-rd/references/matt-pocock-integration.md +11 -0
- package/skills/peaks-rd/references/mock-data-placement.md +40 -0
- package/skills/peaks-rd/references/parallel-review-fanout.md +81 -0
- package/skills/peaks-rd/references/rd-context-governance.md +36 -0
- package/skills/peaks-rd/references/rd-gstack-integration.md +16 -0
- package/skills/peaks-rd/references/rd-runbook.md +125 -0
- package/skills/peaks-rd/references/rd-standards-preflight.md +8 -0
- package/skills/peaks-rd/references/rd-sub-agent-dispatch.md +39 -0
- package/skills/peaks-rd/references/rd-transition-gates.md +1 -1
- package/skills/peaks-rd/references/skill-presence-and-title.md +22 -0
- package/skills/peaks-solo/SKILL.md +87 -595
- package/skills/peaks-solo/references/anchoring-and-session-info.md +25 -0
- package/skills/peaks-solo/references/boundaries.md +21 -0
- package/skills/peaks-solo/references/codegraph-orchestration.md +5 -0
- package/skills/peaks-solo/references/completion-handoff.md +16 -0
- package/skills/peaks-solo/references/context-governance.md +51 -0
- package/skills/peaks-solo/references/external-references.md +17 -0
- package/skills/peaks-solo/references/frontend-only-mode.md +14 -0
- package/skills/peaks-solo/references/gstack-integration.md +7 -0
- package/skills/peaks-solo/references/local-artifact-workspace.md +79 -0
- package/skills/peaks-solo/references/micro-cycle.md +68 -0
- package/skills/peaks-solo/references/mode-selection.md +21 -0
- package/skills/peaks-solo/references/openspec-workflow.md +43 -0
- package/skills/peaks-solo/references/project-memory-loading.md +17 -0
- package/skills/peaks-solo/references/quality-gate-cheatsheet.md +13 -0
- package/skills/peaks-solo/references/resume-detection.md +63 -0
- package/skills/peaks-solo/references/runbook.md +1 -1
- package/skills/peaks-solo/references/skill-presence-and-title.md +31 -0
- package/skills/peaks-solo/references/standards-preflight.md +23 -0
- package/skills/peaks-solo/references/sub-agent-dispatch.md +46 -0
- package/skills/peaks-solo/references/swarm-dispatch-contract.md +56 -0
|
@@ -1,53 +1,21 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: peaks-solo
|
|
3
|
-
description: Full-auto orchestration facade for the Peaks-Cli skill family. Use when the user asks Peaks-Cli to handle a project workflow end-to-end (端到端/全流程/需求开发), especially from a product document (
|
|
3
|
+
description: Full-auto orchestration facade for the Peaks-Cli skill family. Use when the user asks Peaks-Cli to handle a project workflow end-to-end (端到端/全流程/需求开发), especially from a product document (PRD/飞书文档/Feishu doc) through implementation and validation. Coordinates peaks-prd, peaks-rd, peaks-ui, peaks-qa, peaks-sc, and peaks-txt while preserving user confirmation gates. Triggers on `/peaks-solo`, "peaks solo", "全流程开发", "端到端迭代".
|
|
4
4
|
---
|
|
5
5
|
|
|
6
6
|
## Two-axis naming convention
|
|
7
7
|
|
|
8
8
|
> **Read once at the top of this file; the rest of the skill is written against it.**
|
|
9
9
|
|
|
10
|
-
The `.peaks/` workspace is partitioned by **two orthogonal axes
|
|
11
|
-
|
|
12
|
-
| Axis | Path root | Holds | When to use |
|
|
13
|
-
|---|---|---|---|
|
|
14
|
-
| **change-id axis** (reviewable artifacts) | `.peaks/<changeId>/...` | PRD, RD plan, code-review, security-review, test-cases, handoff capsules, gate targets | The artifact should be reviewable on its own and survives across sessions for the same change. Change-id is the unit of work. |
|
|
15
|
-
| **session-id axis** (ephemeral state) | `.peaks/_runtime/<sessionId>/...` | Session bindings (`.peaks/_runtime/session.json`), live in-flight state, the per-session project-scan and tech-doc scaffold while the session is open | The artifact is session-scoped and only meaningful while the parent session is live. |
|
|
16
|
-
| **sub-agent axis** | `.peaks/_sub_agents/<sessionId>/...` | Sub-agent dispatch records, sub-agent heartbeats, per-sub-agent shared channel entries, sub-agent artifact outputs | A sub-agent ran in a parent session. The axis nests under the parent session-id; sub-agent outputs are flushed into the change-id root on commit. |
|
|
17
|
-
|
|
18
|
-
**Which CLI commands operate on which axis:**
|
|
19
|
-
|
|
20
|
-
- **change-id axis** (reviewable artifacts): `peaks request init`, `peaks request transition`, `peaks request show`, `peaks request lint`, `peaks request repair-status`, `peaks scan diff-vs-scope`, `peaks scan acceptance-coverage`. Inputs reference `.peaks/<changeId>/...`.
|
|
21
|
-
- **session-id axis** (ephemeral state): `peaks session info`, `peaks session start`, `peaks session finish`, `peaks session list`. Reads/writes `.peaks/_runtime/<sessionId>/session.json`.
|
|
22
|
-
- **sub-agent axis** (under parent session-id): `peaks sub-agent dispatch`, `peaks sub-agent heartbeat`, `peaks sub-agent share`, `peaks sub-agent shared-read`. All output paths are under `.peaks/_sub_agents/<sessionId>/...`.
|
|
23
|
-
|
|
24
|
-
**Placeholder convention used in this file:**
|
|
25
|
-
|
|
26
|
-
- `<changeId>` / `<change-id>` — the change-id axis. Use when describing a path that lives at `.peaks/<changeId>/...` (root-level, NOT inside `_runtime/`).
|
|
27
|
-
- `<sessionId>` / `<session-id>` — the session-id axis. Use when describing a path that lives at `.peaks/_runtime/<sessionId>/...` or `.peaks/_sub_agents/<sessionId>/...`. The long form `<session-id>` is used inside bash / shell examples where `<sessionId>` would break parsing.
|
|
28
|
-
- The bare `<sid>` placeholder is **forbidden** in new content — it is ambiguous between the two axes. Legacy occurrences are replaced by this convention; new content must use the right axis label.
|
|
29
|
-
|
|
30
|
-
**Cross-references:**
|
|
31
|
-
|
|
32
|
-
- Slice `2026-06-05-change-id-as-unit-of-work` (commits `48958fc` + `928eb53`) — established the change-id axis as the canonical root for reviewable artifacts (`src/shared/change-id.ts:131,335`, `src/services/scan/acceptance-coverage-service.ts:155`).
|
|
33
|
-
- Slice `005-session-runtime-dir-regression` (commit `178a47e`) — added the `getSessionDir()` resolver at `src/services/session/getSessionDir.ts` and routed 4 stragglers that were constructing `.peaks/${sessionId}` (no `_runtime/`) through the canonical resolver. Defense-in-depth scan: `tests/unit/services/session/session-dir-canonical.test.ts`.
|
|
34
|
-
- Slice `006-5th-writer-changeid-path` (this slice) — disambiguates the SKILL.md placeholders and adds the regression test `tests/unit/skills/skills-skill-md-naming.test.ts` that mechanically enforces (a) zero bare `<sid>`, (b) every `.peaks/<X>/` reference has an axis label, (c) the "Two-axis naming convention" callout is present in `peaks-solo`, `peaks-rd`, `peaks-qa`.
|
|
10
|
+
The `.peaks/` workspace is partitioned by **two orthogonal axes**: **change-id** (reviewable artifacts at `.peaks/<changeId>/...`) and **session-id** (ephemeral state at `.peaks/_runtime/<sessionId>/...`), with a nested **sub-agent axis** under `.peaks/_sub_agents/<sessionId>/...`. Use `<changeId>` / `<sessionId>` placeholders (NEVER bare `<sid>` — ambiguous between axes). CLI axis mapping: change-id → `peaks request *` / `peaks scan *`; session-id → `peaks session *`; sub-agent → `peaks sub-agent *`. Regression test `tests/unit/skills/skills-skill-md-naming.test.ts` enforces (a) zero bare `<sid>`, (b) every `.peaks/<X>/` has an axis label, (c) this callout is present.
|
|
35
11
|
|
|
36
12
|
# Peaks-Cli Solo
|
|
37
13
|
|
|
38
|
-
Peaks-Cli Solo is the orchestration facade for the Peaks-Cli short skill family.
|
|
39
|
-
|
|
40
|
-
Use this skill 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.
|
|
14
|
+
Peaks-Cli Solo is the orchestration facade for the Peaks-Cli 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.
|
|
41
15
|
|
|
42
16
|
## Skill-first architecture note (read once, internalise)
|
|
43
17
|
|
|
44
|
-
This skill is the **primary surface**. The `peaks <cmd>` CLI is **auxiliary** — invoked by the skill prompt when a primitive is the right tool (atomic side effect, machine-enforced gate, structured JSON for a downstream decision, or backstop the LLM cannot skip).
|
|
45
|
-
|
|
46
|
-
- Behaviour that only an LLM in a skill prompt would use (e.g. "scan a handoff for memory blocks", "decide if a stable fact deserves persistence") lives **here in the SKILL.md**, not as a new CLI command.
|
|
47
|
-
- The CLI earns its keep when it is (a) hook- / script- / CI-invokable, (b) the consumer needs a structured JSON envelope to gate a downstream decision, or (c) it is a destructive side effect that needs an explicit `--apply` opt-in.
|
|
48
|
-
- When you reach for `peaks <X> --project <repo> --json` in a runbook step, that command is the **contract** you are calling; the LLM work around it (deciding what to pass, interpreting the response, deciding the next step) is what this skill owns.
|
|
49
|
-
|
|
50
|
-
See `.claude/rules/common/dev-preference.md` for the full dev policy and the decision template. The user-facing consequence: every iteration on this skill and the rest of the peaks-* family is judged first by "is this skill work or CLI work?", and only the latter opens a new command.
|
|
18
|
+
This skill is the **primary surface**. The `peaks <cmd>` CLI is **auxiliary** — invoked by the skill prompt only when a primitive is the right tool (atomic side effect, machine-enforced gate, structured JSON for a downstream decision, or backstop the LLM cannot skip). Behaviour only an LLM in a skill prompt would use lives **here in the SKILL.md**, not as a new CLI command. CLI earns its keep when (a) hook/script/CI-invokable, (b) the consumer needs a structured JSON envelope to gate a decision, or (c) destructive side effect needs explicit `--apply`. See `.claude/rules/common/dev-preference.md` for the decision template.
|
|
51
19
|
|
|
52
20
|
## Code-Change Red Line (BLOCKING — read before ANY tool call)
|
|
53
21
|
|
|
@@ -70,14 +38,7 @@ peaks-solo (orchestrate only)
|
|
|
70
38
|
→ Verdict: pass | return-to-rd | blocked
|
|
71
39
|
```
|
|
72
40
|
|
|
73
|
-
**Mechanism for "RD work" / "QA work" depends on the orchestration mode
|
|
74
|
-
|
|
75
|
-
| Mode | Swarm side (after PRD) | Repair loop side (RD↔QA) |
|
|
76
|
-
|---|---|---|
|
|
77
|
-
| `full-auto` / `swarm` | `peaks sub-agent dispatch <role>` — IDE-agnostic dispatch primitive; CLI returns a tool-call descriptor the LLM executes in its own environment | `peaks sub-agent dispatch <role>` per cycle |
|
|
78
|
-
| `assisted` / `strict` / inline-fallback | Solo executes the role steps inline in the main loop (the `peaks-solo` skill IS the role's owner) | Solo executes inline |
|
|
79
|
-
|
|
80
|
-
In all modes, the work itself follows the same `peaks-rd` and `peaks-qa` contracts. The only difference is whether the role's body is being read by a sub-agent Task prompt or by Solo's own main loop. **Never bypass the role contracts regardless of which path runs.**
|
|
41
|
+
**Mechanism for "RD work" / "QA work" depends on the orchestration mode:** `full-auto`/`swarm` use `peaks sub-agent dispatch <role>` (IDE-agnostic dispatch primitive; CLI returns a tool-call descriptor the LLM executes in its own environment); `assisted`/`strict`/inline-fallback executes inline in the main loop. In all modes, the work itself follows the same `peaks-rd` and `peaks-qa` contracts. **Never bypass the role contracts regardless of which path runs.**
|
|
81
42
|
|
|
82
43
|
**Violations (BLOCKING — Solo must refuse to proceed):**
|
|
83
44
|
|
|
@@ -95,513 +56,107 @@ In all modes, the work itself follows the same `peaks-rd` and `peaks-qa` contrac
|
|
|
95
56
|
|
|
96
57
|
### Peaks-Cli Step 0.5: OpenSpec first-run opt-in (conditional)
|
|
97
58
|
|
|
98
|
-
|
|
99
|
-
the project already has an `openspec/` directory. The lifecycle
|
|
100
|
-
(`render → validate → show → to-rd → validate → archive`) only applies
|
|
101
|
-
when `openspec/` exists; without it, RD/QA/SC silently skip the
|
|
102
|
-
openspec-aware paths and you lose change-proposal tracking, commit
|
|
103
|
-
boundaries from `tasks.md`, and the historical archive.
|
|
104
|
-
|
|
105
|
-
To make that opt-in visible instead of silent, Solo runs:
|
|
106
|
-
|
|
107
|
-
```bash
|
|
108
|
-
# 1. Detect whether the project already has openspec/.
|
|
109
|
-
ls <repo>/openspec/changes 2>&1
|
|
110
|
-
# 2. If absent, ask the user once — only on the first Solo run in this
|
|
111
|
-
# project. The decision is sticky: write it to .peaks/.peaks-openspec-opt-in.json
|
|
112
|
-
# so subsequent Solo invocations do not re-ask.
|
|
113
|
-
test -f <repo>/.peaks/.peaks-openspec-opt-in.json || \
|
|
114
|
-
echo "{\"enabled\": <bool>}" > <repo>/.peaks/.peaks-openspec-opt-in.json
|
|
115
|
-
```
|
|
116
|
-
|
|
117
|
-
**AskUserQuestion** (only when `openspec/` is absent and the opt-in
|
|
118
|
-
file is missing):
|
|
119
|
-
|
|
120
|
-
| Option | What it does |
|
|
121
|
-
|---|---|
|
|
122
|
-
| Enable OpenSpec for this project (Recommended) | Run `peaks openspec init --project <repo> --apply`. After that, every Solo run uses the change-proposal lifecycle for the same project. |
|
|
123
|
-
| Skip for now | Do nothing. Solo proceeds without openspec; the question is re-asked on the next first-run detection. |
|
|
124
|
-
| Never ask again for this project | Write `{enabled: false, sticky: true}`. Solo stops asking. The user can re-enable later by removing `.peaks/.peaks-openspec-opt-in.json` and re-running. |
|
|
125
|
-
|
|
126
|
-
The first option is the recommended default because it gives Solo the
|
|
127
|
-
full change-proposal lifecycle (proposal / tasks / design / specs
|
|
128
|
-
deltas, archive on ship, commit boundaries from `tasks.md`). It costs
|
|
129
|
-
only a single scaffolded directory and pays back the first time the
|
|
130
|
-
project needs a real review trail.
|
|
59
|
+
Run when `openspec/` is absent and `.peaks/.peaks-openspec-opt-in.json` is missing. Asks once and persists the decision.
|
|
131
60
|
|
|
132
|
-
|
|
133
|
-
sure `openspec/changes/` is added to git (it is part of the project
|
|
134
|
-
repo, not a tool-managed artefact). Solo does not run `git add` for
|
|
135
|
-
the user; that is the user's commit boundary.
|
|
61
|
+
→ see `references/openspec-workflow.md` for the full opt-in flow + lifecycle.
|
|
136
62
|
|
|
137
63
|
### Peaks-Cli Step 0: Anchor the workflow (MANDATORY FIRST ACTIONS — no bail-out)
|
|
138
64
|
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
```bash
|
|
142
|
-
# Session ID is auto-generated when omitted; the command returns it in the JSON output.
|
|
143
|
-
# Do NOT pass --session-id manually — the CLI is the single source of truth for the
|
|
144
|
-
# project session binding. To look up the active session id from a skill / sub-agent,
|
|
145
|
-
# use `peaks session info --active --json` (read-only, no side effects). To avoid
|
|
146
|
-
# the "two sessions in .peaks/" confusion that bites Solo, always omit --session-id
|
|
147
|
-
# here and let the CLI auto-generate.
|
|
148
|
-
peaks workspace init --project <repo> --json
|
|
149
|
-
peaks skill presence:set peaks-solo --project <repo> --gate startup
|
|
150
|
-
```
|
|
151
|
-
|
|
152
|
-
> `<repo>` is the **git project root** (the directory containing `.git`). In a monorepo / single-repo-multi-package layout, this is the repo root, NOT a sub-package — `.peaks/` lives at the repo root so every package shares one workspace. If unsure, run `git rev-parse --show-toplevel` and use that path. Never let `.peaks/` land inside a sub-package directory.
|
|
153
|
-
|
|
154
|
-
**There is no request too lightweight to skip this.** "分析下这个项目", "看一下代码", "分析项目", "解释一下架构", a one-line question — all of them still create the workspace and set presence first. The workspace is cheap; a missing `.peaks/` is the #1 reported failure.
|
|
65
|
+
Run `peaks workspace init` + `peaks skill presence:set peaks-solo` BEFORE any analysis, role handoff, or mode-selection question. Even "分析下这个项目" / "看一下代码" / one-line questions anchor first.
|
|
155
66
|
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
**Session conflict resolution (read once, internalise):** If `peaks workspace init` returns `code: "CONFLICTING_SESSION"` with a body like
|
|
159
|
-
`{"existingSessionId":"<Y>","requestedSessionId":"<X>"}`, the project is already bound to a different in-flight session `<Y>` (the one you or a prior run was working on). The fix is **NOT** to pass `--allow-session-rebind` to clobber `<Y>` — that destroys an active session's data. Instead: finish or abandon `<Y>` first (use `peaks session list --json` to see what it is, then `peaks session finish --id <Y>` or `peaks session abandon --id <Y>` — see your session command's help for the exact verbs). Only after `<Y>` is closed should you re-run `peaks workspace init`. The same rule applies to `peaks workspace init --session-id "<manually-forged>"` — do not pre-forge session ids; the CLI's auto-generated value is the binding.
|
|
160
|
-
|
|
161
|
-
`presence:set` accepts no `--mode` here on purpose — mode is unknown until Step 1. It is re-run with the selected mode in Step 2. Setting presence early guarantees the status header/line shows `peaks-solo` from the very first turn even if the user never reaches mode selection.
|
|
67
|
+
→ see `references/anchoring-and-session-info.md` for the full Step 0 contract + session-conflict resolution.
|
|
162
68
|
|
|
163
69
|
### Peaks-Cli Step 0.7: Detect unfinished work and offer resume (BLOCKING on first invocation per session)
|
|
164
70
|
|
|
165
|
-
After Step 0
|
|
166
|
-
|
|
167
|
-
**Why this is a separate step** (per `feedback_peaks_solo_natural_language_primary` — a high-frequency request shape, see also the user's "继续完成刚才为完成的" pattern from session `2026-06-04-session-b60252`): the LLM was previously re-reading 3-5 artifact files to determine workflow state, wasting 3-5k tokens per resume request. This step replaces that work with a single deterministic read.
|
|
168
|
-
|
|
169
|
-
**Detection logic** (all read-only, no side effects; uses only existing CLIs):
|
|
170
|
-
|
|
171
|
-
```bash
|
|
172
|
-
# 1. Confirm the current session id via the read-only CLI primitive
|
|
173
|
-
# (the on-disk binding file is internal — never `cat` it directly)
|
|
174
|
-
sid=$(peaks session info --active --project "$(git rev-parse --show-toplevel)" --json | python3 -c "import sys,json; print(json.load(sys.stdin)['data']['sessionId'])")
|
|
175
|
-
|
|
176
|
-
# 2. Enumerate the session's artifact tree (one `find` call, no new CLI)
|
|
177
|
-
find ".peaks/$sid/" -type f 2>/dev/null | sort
|
|
178
|
-
|
|
179
|
-
# 3. For each role request artifact present, read its `state:` field
|
|
180
|
-
# (one-pass grep; only files that exist)
|
|
181
|
-
for f in .peaks/$sid/prd/requests/*.md .peaks/$sid/rd/requests/*.md .peaks/$sid/qa/requests/*.md; do
|
|
182
|
-
[ -f "$f" ] && echo "$f: $(grep -m1 '^state:' "$f" | awk '{print $2}')"
|
|
183
|
-
done
|
|
184
|
-
|
|
185
|
-
# 4. Compute "deepest completed gate" by file-presence + state mapping
|
|
186
|
-
# (see classification table below)
|
|
187
|
-
```
|
|
188
|
-
|
|
189
|
-
**Classification table** (file-presence + state → "deepest completed gate"):
|
|
71
|
+
After Step 0 anchored the workspace, run the resume-detection probe (one `find` + one `grep` + classification table). Surface resume options via `AskUserQuestion` if a slice is in flight. Never silently auto-resume.
|
|
190
72
|
|
|
191
|
-
|
|
192
|
-
|---|---|---|---|
|
|
193
|
-
| only `.peaks/$sid/.session.json` | (no slice) | (none) | fresh — skip to Step 1 |
|
|
194
|
-
| `prd/requests/<rid>.md` | `state: handed-off` | Gate B (swarm converged) | resume at Step 3 (swarm) — but if swarm already ran and produced `rd/tech-doc.md` / `qa/test-cases/<rid>.md`, drop to deepest |
|
|
195
|
-
| `rd/requests/<rid>.md` | `state: qa-handoff` | Gate C (RD done) | resume at Step 6 (QA validation) |
|
|
196
|
-
| `qa/requests/<rid>.md` | `state: verdict-issued` | Gate D (QA done) | resume at Step 10 (TXT handoff) |
|
|
197
|
-
| `txt/handoff.md` | (any) | Gate E (workflow complete) | this session is closed — user is starting new work |
|
|
198
|
-
|
|
199
|
-
**Other resume triggers** (file-presence, no state read needed):
|
|
200
|
-
|
|
201
|
-
| Missing file | Resume at |
|
|
202
|
-
|---|---|
|
|
203
|
-
| `rd/tech-doc.md` (for `feature`/`refactor`) or `rd/bug-analysis.md` (for `bugfix`) | Step 3b (RD planning) |
|
|
204
|
-
| `rd/code-review.md` or `rd/security-review.md` | Step 5 (RD review fan-out) |
|
|
205
|
-
| `rd/perf-baseline.md` (for `feature`/`refactor`) | Step 5 (perf baseline) |
|
|
206
|
-
| `qa/test-cases/<rid>.md` | Step 6 (QA test-case generation) |
|
|
207
|
-
| `qa/test-reports/<rid>.md` or `qa/security-findings.md` or `qa/performance-findings.md` | Step 6 (QA execution) |
|
|
208
|
-
| `txt/handoff.md` | Step 10 (TXT handoff) |
|
|
209
|
-
|
|
210
|
-
**AskUserQuestion** (only if a resume is detected; default option is "Resume from the deepest missing gate"):
|
|
211
|
-
|
|
212
|
-
| Option | What it does |
|
|
213
|
-
|---|---|
|
|
214
|
-
| Resume from `<gate>` (Recommended) | Skip ahead to the matching step, preserving all existing artifacts. The LLM does NOT re-read the existing artifacts — it trusts the classification and proceeds. |
|
|
215
|
-
| Start a fresh slice | Keep the workspace, treat the current user request as a new slice (new rid). Existing artifacts are preserved but not auto-resumed. |
|
|
216
|
-
| Abandon the in-flight slice | Mark the in-flight slice as `deferred` (`peaks request transition … --state deferred`); start a new one. |
|
|
217
|
-
|
|
218
|
-
**Hard rule: never silently auto-resume.** Resume detection is the discovery; AskUserQuestion is the confirmation. Even if the user's request is "继续完成刚才为完成的" (continue the unfinished work), the skill must run this detection, surface the options, and wait for user confirmation before skipping ahead.
|
|
219
|
-
|
|
220
|
-
**Hard rule: never auto-resume a slice that is mid-implementation.** Resume only when the deepest completed gate is in {B, C, D, E}. For mid-implementation states (RD `state: implemented`, RD `state: running`, RD `state: spec-locked`, QA `state: running`, QA `state: blocked`), the slice is still in flight — the only valid option is "Resume from in-flight gate" (the user must confirm).
|
|
221
|
-
|
|
222
|
-
**Strict quality guarantee (per user's hard rule: "严格要保证不能比当前的效果差")**:
|
|
223
|
-
- If no in-flight slice is detected, this step is a no-op: zero extra commands beyond the existing Step 0 probe, zero extra token cost.
|
|
224
|
-
- If an in-flight slice is detected, the cost is one `find` + one `grep` loop (sub-millisecond) + one `AskUserQuestion` (one round-trip). The savings are 3-5k tokens (the cost of manually re-reading 3-5 artifact files).
|
|
225
|
-
- The dogfood test in `tests/unit/skill-resume-mode.test.ts` (8 cases, bash-fixture shim — the legacy interface used by `skills/peaks-solo-resume`) and `tests/unit/services/skill/resume-detector.test.ts` (24 cases, the canonical TypeScript classifier at `src/services/skill/resume-detector.ts`) together cover: (a) fresh / complete / resume:rd-planning / resume:qa-validation / resume:txt-handoff state-based classifications, (b) the "Other resume triggers" overrides (missing `rd/tech-doc.md` → `rd-planning`; missing `rd/code-review.md` or `rd/security-review.md` → `rd-review-fanout`; missing `qa/test-reports/<rid>.md` → `qa-execution`), (c) the mid-implementation distinction (`spec-locked` / `implemented` / `running` / `blocked` all return `in-flight:<state>`), (d) the primary-vs-abandoned filter (multiple RDs → spec-locked wins; single blocked RD stays primary; 2+ all-abandoned → fresh), (e) the legacy `.peaks/_runtime/<sessionId>/` path fallback, and (f) determinism across two invocations on the same fixture.
|
|
73
|
+
→ see `references/resume-detection.md` for the full detection algorithm + classification table.
|
|
226
74
|
|
|
227
75
|
### Peaks-Cli Step 1: Mode selection
|
|
228
76
|
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
1. **Full auto (Recommended)** — Peaks-Cli handles planning, role coordination, validation, and compact handoff end-to-end while preserving required confirmation gates for risky or shared-state actions.
|
|
232
|
-
2. **Assisted** — Peaks-Cli proposes plans, artifacts, and checks, then pauses for user decisions at major workflow boundaries.
|
|
233
|
-
3. **Swarm** — Peaks-Cli maximizes safe parallel role/worker execution for larger RD or QA workloads while keeping reducer validation and artifact boundaries explicit.
|
|
234
|
-
4. **Strict** — Peaks-Cli uses the most conservative gates: explicit confirmations, strict slice specs, coverage evidence, QA acceptance, and commit boundaries before continuing.
|
|
77
|
+
When the user did not name a profile (`full-auto` / `assisted` / `swarm` / `strict`), use `AskUserQuestion` with `Full auto (Recommended)` as the first option. Map the choice to `--mode` value.
|
|
235
78
|
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
| User selects | `--mode` value |
|
|
239
|
-
|---|---|
|
|
240
|
-
| Full auto | `full-auto` |
|
|
241
|
-
| Assisted | `assisted` |
|
|
242
|
-
| Swarm | `swarm` |
|
|
243
|
-
| Strict | `strict` |
|
|
244
|
-
|
|
245
|
-
> Note: `peaks workflow route --mode solo|team` is a **different** CLI dimension (solo developer vs team flow) and is unrelated to the profile choice here. Do not conflate them.
|
|
246
|
-
|
|
247
|
-
If the user already names a profile in their invocation (e.g. `/peaks-solo --full-auto`, "用全自动模式"), skip this question and use the named profile directly.
|
|
79
|
+
→ see `references/mode-selection.md` for the 4-mode table.
|
|
248
80
|
|
|
249
81
|
### Peaks-Cli Step 2: Re-set skill presence with the chosen mode
|
|
250
82
|
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
```bash
|
|
254
|
-
peaks skill presence:set peaks-solo --project <repo> --mode <mode-value> --gate startup
|
|
255
|
-
```
|
|
256
|
-
|
|
257
|
-
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:
|
|
258
|
-
|
|
259
|
-
```bash
|
|
260
|
-
peaks statusline install --project <repo> # idempotent; skips if already installed
|
|
261
|
-
```
|
|
262
|
-
|
|
263
|
-
Then display the compact status header: `Peaks-Cli Skill: peaks-solo | Peaks-Cli Gate: startup | Next: <one short action>`. Display this header on EVERY turn while the skill is active.
|
|
83
|
+
Re-run `peaks skill presence:set peaks-solo --mode <mode-value> --gate startup` so the status header shows the profile. Install statusline on first run (`peaks statusline install`).
|
|
264
84
|
|
|
265
|
-
|
|
85
|
+
→ see `references/skill-presence-and-title.md` for the full Step 2 contract.
|
|
266
86
|
|
|
267
87
|
### Peaks-Cli Step 2.3: Load project memory (durable, LLM-authored memories)
|
|
268
88
|
|
|
269
|
-
|
|
89
|
+
Run `peaks project memories --project <repo> --json` to read decisions / conventions / modules / rules / lessons from `.peaks/memory`. Use this to understand what exists, what was decided, what to avoid re-litigating.
|
|
270
90
|
|
|
271
|
-
|
|
272
|
-
peaks project memories --project <repo> --json
|
|
273
|
-
```
|
|
274
|
-
|
|
275
|
-
This returns durable memories from `.peaks/memory`, grouped by kind:
|
|
276
|
-
- **module** — code areas touched, with risk and rationale captured by past sessions
|
|
277
|
-
- **decision** — architectural choices, why they were made, what they affect
|
|
278
|
-
- **convention** — discovered project patterns (code style, naming, tooling)
|
|
279
|
-
- **rule** / **reference** / **project** — standing constraints, external pointers, and project context
|
|
280
|
-
|
|
281
|
-
Filter with `--kind <decision|convention|module|rule|reference|project|lesson>` when you only need one slice. Use this to understand what exists, what was decided, and what to avoid re-litigating. Memories are LLM-authored at approved checkpoints via `peaks memory extract`. The `lesson` kind is for LLM-discovered runtime lessons (e.g. "this project's antv6 Drawer uses `size` not `width`"); write them as `<!-- peaks-memory:start kind=lesson -->` blocks in the RD handoff or TXT handoff.
|
|
282
|
-
|
|
283
|
-
`.peaks/PROJECT.md` is a human-readable session timeline only — do NOT use it for LLM context.
|
|
91
|
+
→ see `references/project-memory-loading.md` for the full kind table.
|
|
284
92
|
|
|
285
93
|
### Peaks-Cli Step 2.5: Set session title
|
|
286
94
|
|
|
287
|
-
Extract a short (8-20 Chinese
|
|
288
|
-
|
|
289
|
-
```bash
|
|
290
|
-
peaks session title $(peaks session info --active --project "$(git rev-parse --show-toplevel)" --json | python3 -c "import sys,json; print(json.load(sys.stdin)['data']['sessionId'])") "<title>"
|
|
291
|
-
```
|
|
95
|
+
Extract a short title from the user's first request (8-20 Chinese chars or 4-10 English words). Run `peaks session title` with the active sid. Skip if a title is already set.
|
|
292
96
|
|
|
293
|
-
|
|
97
|
+
→ see `references/skill-presence-and-title.md` (same file as Step 2).
|
|
294
98
|
|
|
295
99
|
## Sub-agent session sharing (MANDATORY — one conversation = one sid)
|
|
296
100
|
|
|
297
|
-
When peaks-solo dispatches a sub-agent (peaks-rd, peaks-qa, peaks-ui, peaks-txt, peaks-sc), the sub-agent prompt MUST include the parent's session id. The sub-agent
|
|
101
|
+
When peaks-solo dispatches a sub-agent (peaks-rd, peaks-qa, peaks-ui, peaks-txt, peaks-sc), the sub-agent prompt MUST include the parent's session id. The sub-agent MUST NOT call `peaks workspace init` — that would orphan the parent's binding.
|
|
298
102
|
|
|
299
|
-
|
|
103
|
+
→ see `references/context-governance.md` for the full G7 / G7.7 / G8 / G9 protocol.
|
|
300
104
|
|
|
301
105
|
## Boundaries
|
|
302
106
|
|
|
303
|
-
Peaks-Cli Solo may:
|
|
304
|
-
|
|
305
|
-
- identify scenarios such as refactor, bugfix, QA hardening, release validation, and incident response;
|
|
306
|
-
- recommend Solo, Assisted, Swarm, or Strict profiles;
|
|
307
|
-
- coordinate Peaks-Cli role skills through artifacts;
|
|
308
|
-
- coordinate project memory extraction from stable skill artifact sections;
|
|
309
|
-
- request user confirmation at risk and commit boundaries;
|
|
310
|
-
- read CLI doctor/profile/artifact reports.
|
|
311
|
-
|
|
312
|
-
Peaks-Cli Solo must not silently:
|
|
107
|
+
Peaks-Cli Solo may: identify scenarios (refactor, bugfix, QA hardening, release validation, incident response); recommend profiles; coordinate role skills through artifacts; coordinate project memory extraction; request user confirmation at risk and commit boundaries.
|
|
313
108
|
|
|
314
|
-
- install hooks
|
|
315
|
-
- create agents;
|
|
316
|
-
- enable MCP servers;
|
|
317
|
-
- modify Claude settings;
|
|
318
|
-
- create GitHub repositories;
|
|
319
|
-
- bypass role-skill artifacts.
|
|
109
|
+
Peaks-Cli Solo must NOT silently: install hooks, create agents, enable MCP servers, modify Claude settings, create GitHub repos, or bypass role-skill artifacts.
|
|
320
110
|
|
|
321
|
-
|
|
111
|
+
→ see `references/boundaries.md` for the full do / don't list.
|
|
322
112
|
|
|
323
113
|
## Peaks-Cli GStack integration
|
|
324
114
|
|
|
325
|
-
Map gstack stages to Peaks-Cli role artifacts; preserve Peaks-Cli confirmation gates. Do not delegate orchestration to gstack commands.
|
|
115
|
+
Map gstack stages to Peaks-Cli role artifacts; preserve Peaks-Cli confirmation gates. Do not delegate orchestration to gstack commands. For frontend workflows, RD and QA use Playwright MCP for real browser E2E.
|
|
326
116
|
|
|
327
|
-
|
|
117
|
+
→ see `references/gstack-integration.md` for the full integration contract and `references/browser-workflow.md` for the browser details.
|
|
328
118
|
|
|
329
119
|
## Peaks-Cli Local intermediate artifact workspace (MANDATORY)
|
|
330
120
|
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
The workspace is created in Step 0 (Startup sequence) as a mandatory first action — before any analysis, role handoff, or artifact write, and regardless of how lightweight the request is. Session IDs are now **auto-generated** with the format `YYYY-MM-DD-session-<6位hex>` (e.g. `2026-05-26-session-a3f8b1`). The user does not provide a session ID — the system creates and persists it in `.peaks/_runtime/session.json` (the canonical home as of slice `2026-06-05-peaks-runtime-layer`; the legacy `.peaks/.session.json` is read-only back-compat for one minor release).
|
|
334
|
-
|
|
335
|
-
When `peaks workspace init` is run without `--session-id`, it automatically generates a new session ID using today's date and a random hex suffix. If a valid session binding exists at `.peaks/_runtime/session.json` (the canonical home, slice 2026-06-05-peaks-runtime-layer; the legacy `.peaks/.session.json` is read-only back-compat for one minor release), the existing session is reused. To read the active session id from a skill or sub-agent, use the `peaks session info --active --json` primitive — never `cat` the on-disk file directly (the path is internal).
|
|
121
|
+
The workspace is created in Step 0 as a mandatory first action. All intermediate artifacts land under `.peaks/_runtime/<sessionId>/`. NEVER write Peaks-Cli intermediate artifacts to the project root directory. Git inclusion or sync requires explicit user confirmation.
|
|
336
122
|
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
```bash
|
|
340
|
-
peaks workspace init --project <repo> --json
|
|
341
|
-
```
|
|
342
|
-
|
|
343
|
-
The workspace initialization creates this structure under `.peaks/`:
|
|
344
|
-
|
|
345
|
-
```
|
|
346
|
-
# Canonical home for all per-project ephemeral state (active-skill
|
|
347
|
-
# marker, session binding, sop-state). All writes go here; reads also
|
|
348
|
-
# tolerate the legacy paths (`.peaks/.active-skill.json`,
|
|
349
|
-
# `.peaks/.session.json` — read-only back-compat for one minor release,
|
|
350
|
-
# `.peaks/sop-state/`) for one minor release so a fresh upgrade does
|
|
351
|
-
# not break in-flight workflows. Older trees are auto-migrated by
|
|
352
|
-
# `peaks workspace reconcile --apply`. Skills and sub-agents MUST
|
|
353
|
-
# NOT `cat` any of these files directly — use `peaks session info
|
|
354
|
-
# --active --json` (and the matching read-only primitives for the
|
|
355
|
-
# other two) to discover session-id / active-skill / sop-state.
|
|
356
|
-
.peaks/_runtime/
|
|
357
|
-
├── active-skill.json # orchestrator presence marker (peaks-solo / -rd / -qa / -ui / -sc / -sop / -txt)
|
|
358
|
-
├── session.json # project → session binding (the only single-session source of truth)
|
|
359
|
-
└── sop-state/ # current phase + history; definitions live globally in ~/.peaks
|
|
360
|
-
|
|
361
|
-
# Per-slice artifact dirs (auto-generated, one per session). Files
|
|
362
|
-
# inside ARE tracked by the 提交中间产物 convention.
|
|
363
|
-
.peaks/_runtime/<sessionId>/
|
|
364
|
-
prd/source/ # PRD source documents (Feishu exports, pasted content)
|
|
365
|
-
prd/requests/ # PRD request artifacts (goals, non-goals, acceptance, frontend delta)
|
|
366
|
-
ui/requests/ # UI request artifacts (visual direction, taste reports)
|
|
367
|
-
rd/requests/ # RD request artifacts (slice specs, coverage, CR findings)
|
|
368
|
-
rd/project-scan.md # Project scan (session-scoped singleton, generated once per session)
|
|
369
|
-
qa/test-cases/ # QA test cases
|
|
370
|
-
qa/test-reports/ # QA test reports (regression matrices, browser evidence)
|
|
371
|
-
qa/requests/ # QA request artifacts
|
|
372
|
-
sc/ # SC artifacts (change-control, impact, retention, boundary)
|
|
373
|
-
txt/ # TXT artifacts (handoff capsules, lessons, memory extraction)
|
|
374
|
-
system/ # Existing-system extraction output (visual tokens, conventions)
|
|
375
|
-
```
|
|
376
|
-
|
|
377
|
-
Files written into these directories during the workflow (not pre-created — they appear as their step runs):
|
|
378
|
-
|
|
379
|
-
- `rd/project-scan.md` (Solo step 0.6)
|
|
380
|
-
- `rd/tech-doc.md` (feature/refactor planning; required by `rd → implemented` gate)
|
|
381
|
-
- `rd/bug-analysis.md` (bugfix planning; required by `rd → implemented` gate for `--type bugfix`)
|
|
382
|
-
- `rd/code-review.md`, `rd/security-review.md` (required by `rd → qa-handoff` gate for feature/bugfix/refactor; security-review only for config)
|
|
383
|
-
- `rd/mock-plan.md` (frontend-only mode)
|
|
384
|
-
- `ui/design-draft.md` (UI step)
|
|
385
|
-
- `system/existing-system.md` (Solo step 0.7; legacy projects only)
|
|
386
|
-
- `qa/test-cases/<rid>.md`, `qa/test-reports/<rid>.md`, `qa/security-findings.md`, `qa/performance-findings.md` (gated per `--type`)
|
|
387
|
-
|
|
388
|
-
### Root pollution prohibition (CRITICAL)
|
|
389
|
-
|
|
390
|
-
**NEVER write Peaks-Cli intermediate artifacts to the project root directory.** Specifically prohibited at root level:
|
|
391
|
-
|
|
392
|
-
- PRD snapshots, document extracts, or requirement notes (`feishu-doc-*.md`, `*-snapshot.md`, etc.)
|
|
393
|
-
- RD tech docs, scan reports, slice specs, or architecture notes
|
|
394
|
-
- QA screenshots, browser evidence, test reports, or validation logs (`.png`, `.jpg`)
|
|
395
|
-
- QA test helper files, mock servers, or fixture scripts (`qa-server.js`, etc.)
|
|
396
|
-
- UI design drafts, taste reports, or visual direction notes
|
|
397
|
-
- TXT handoff capsules or lesson files
|
|
398
|
-
|
|
399
|
-
Legitimate source files (e.g. `jest-setup.ts`, `tailwind.config.js`) belong at root — do not move them.
|
|
400
|
-
|
|
401
|
-
If you are about to Write/Edit an intermediate artifact in the project root, STOP. Create the `.peaks/_runtime/<sessionId>/` workspace first and write to the correct role subdirectory. If existing root-level artifacts from a prior run are discovered, move them into `.peaks/_runtime/<sessionId>/` and note the migration in the TXT handoff.
|
|
402
|
-
|
|
403
|
-
### Git and sync policy
|
|
404
|
-
|
|
405
|
-
Do not default to git-backed storage or automatic commits for intermediate artifacts. Git inclusion or sync requires explicit user confirmation or an active profile that authorizes it.
|
|
123
|
+
→ see `references/local-artifact-workspace.md` for the workspace tree, root pollution prohibition, and git policy.
|
|
406
124
|
|
|
407
125
|
## Peaks-Cli Pre-RD project scan checklist (MANDATORY)
|
|
408
126
|
|
|
409
|
-
Before handing off to `peaks-rd`, scan the project and record findings to `.peaks/_runtime/<sessionId>/rd/project-scan.md`.
|
|
127
|
+
Before handing off to `peaks-rd`, scan the project and record findings to `.peaks/_runtime/<sessionId>/rd/project-scan.md`. The full project-scan checklist (archetype detection, build-tool / component-library / CSS-framework / state-routing-data tables, legacy signals, project-scan artifact template) lives in the references file.
|
|
410
128
|
|
|
411
|
-
|
|
129
|
+
→ see `references/project-scan-checklist.md` for the full checklist.
|
|
412
130
|
|
|
413
131
|
## Peaks-Cli Frontend-only development mode
|
|
414
132
|
|
|
415
|
-
When the project has no live backend (no swagger.json, no API server), Solo must activate frontend-only mode.
|
|
133
|
+
When the project has no live backend (no swagger.json, no API server), Solo must activate frontend-only mode. The CLI is authoritative — read `frontendOnly` and `frontendOnlyReason` from `peaks scan archetype --json`.
|
|
416
134
|
|
|
417
|
-
|
|
135
|
+
→ see `references/frontend-only-mode.md` for the full mode contract, mock-data strategy, and the pre-flight keyword scan.
|
|
418
136
|
|
|
419
137
|
## Peaks-Cli Request type classification + Workflow order + Transition verification gates
|
|
420
138
|
|
|
421
139
|
The full contract for the 6-type classification table, the 11-step workflow order, and the 7 transition verification gates (A through G with their `ls` / `grep` shell snippets) lives in `references/workflow-gates-and-types.md`. The peaks-solo narrative in this SKILL.md references those gate numbers (Gate A through Gate G) — keep both files in lockstep when adding or renaming a gate. The reference file is the canonical contract; SKILL.md keeps the prose.
|
|
422
140
|
|
|
423
|
-
|
|
424
141
|
## Peaks-Cli Swarm parallel phase (sub-agent fan-out, conditional)
|
|
425
142
|
|
|
426
|
-
The Swarm phase is **conditional**, not unconditional.
|
|
427
|
-
|
|
428
|
-
### Swarm gate (decide BEFORE fan-out)
|
|
429
|
-
|
|
430
|
-
Before launching any sub-agent, Solo must compute the **swarm plan** from three signals:
|
|
431
|
-
|
|
432
|
-
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.
|
|
433
|
-
2. **Request type** (`--type` from `peaks request init`):
|
|
434
|
-
- `feature` / `refactor` / `bugfix` → RD(planning) and QA(test-cases) are always in the swarm
|
|
435
|
-
- `config` / `docs` / `chore` → no swarm. RD/QA artefacts are not required by Gates B/C/D for these types. Skip the Swarm phase entirely and proceed to step 4 (RD implementation) with only the PRD in hand.
|
|
436
|
-
3. **Frontend touch** — does the request affect user-visible behavior? This is decided by:
|
|
437
|
-
- Reading `.peaks/_runtime/<sessionId>/rd/project-scan.md` `## Project mode` for `frontendOnly` (project-shape signal)
|
|
438
|
-
- **AND** scanning the PRD body for frontend keywords: 页面 / 组件 / 表单 / 弹窗 / 表格 / 样式 / 布局 / 交互 / UI / UX / page / component / form / modal / table / styling / layout / interaction
|
|
439
|
-
- UI joins the swarm when (a) is `true` OR (b) matches. Both signals required `false` to skip UI.
|
|
143
|
+
The Swarm phase is **conditional**, not unconditional. Solo derives the fan-out set from the PRD type and the request content — never from a default of "always launch three". The swarm gate (PRD state + request type + frontend touch), mode-driven fan-out shape, and degradation rules live in the references file.
|
|
440
144
|
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
```json
|
|
444
|
-
{
|
|
445
|
-
"rid": "<rid>",
|
|
446
|
-
"type": "feature",
|
|
447
|
-
"frontendOnly": true,
|
|
448
|
-
"frontendKeywordHit": true,
|
|
449
|
-
"subAgents": ["ui", "rd-planning", "qa-test-cases"]
|
|
450
|
-
}
|
|
451
|
-
```
|
|
452
|
-
|
|
453
|
-
Sub-agent presence in this list = Solo launched a Task for it. Absence = the role was skipped with documented reason.
|
|
454
|
-
|
|
455
|
-
### Mode-driven fan-out shape
|
|
456
|
-
|
|
457
|
-
| Mode | How the swarm plan is decided | What Solo does |
|
|
458
|
-
|---|---|---|
|
|
459
|
-
| `full-auto` | Compute plan from signals above, no question to user | Auto-launch all sub-agents in the plan in parallel |
|
|
460
|
-
| `swarm` | Same as `full-auto` | Same as `full-auto` (this profile name is historical — behavior is identical) |
|
|
461
|
-
| `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 |
|
|
462
|
-
| `strict` | Same as `assisted` (the question is informational; strict still enforces confirmation gates later) | Same as `assisted` |
|
|
463
|
-
|
|
464
|
-
In all modes, **the plan must be written to `sc/swarm-plan.json` before any Task call.** Solo updates `.peaks/.active-skill.json` to `gate=swarm-fan-out` at this point.
|
|
465
|
-
|
|
466
|
-
### Sub-agent mechanism (IDE-agnostic dispatch, NOT Skill tool)
|
|
467
|
-
|
|
468
|
-
**Solo is itself a skill running in the current session. To invoke a role in the Swarm, Solo 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.
|
|
469
|
-
|
|
470
|
-
Each sub-agent dispatch call looks like:
|
|
471
|
-
|
|
472
|
-
```
|
|
473
|
-
peaks sub-agent dispatch <role> \
|
|
474
|
-
--prompt "<paste peaks-<role>/SKILL.md body, minus the self-presence / Step 0 blocks,
|
|
475
|
-
plus the runtime arguments: project=<repo>, session-id=<session-id>, request-id=<rid>, mode=<mode>,
|
|
476
|
-
plus the explicit output contract: 'Write your artefacts to the paths listed below and
|
|
477
|
-
return only the list of paths. Do not call Skill(...). Do not set presence. Do not
|
|
478
|
-
hand back prose.', plus the heartbeat instruction: 'While running, call
|
|
479
|
-
peaks sub-agent heartbeat --record <dispatchRecordPath> --status <state> --progress <pct> --note \"<text>\"
|
|
480
|
-
at least every 30 seconds.'>" \
|
|
481
|
-
--request-id <rid> --session-id <session-id> --project <repo> --json
|
|
482
|
-
```
|
|
483
|
-
|
|
484
|
-
Then the LLM takes `data.toolCall` from the envelope (a `{name, args}` descriptor), looks up the tool by `name` in its environment, and invokes it with `args` — IDE-private, no SKILL.md hardcoding.
|
|
485
|
-
|
|
486
|
-
The role's required artefact paths (also see peaks-ui/rd/qa SKILL.md and `references/swarm-dispatch-contract.md`):
|
|
487
|
-
|
|
488
|
-
| Role | Writes | Reads (PRD-side) |
|
|
489
|
-
|---|---|---|
|
|
490
|
-
| `ui` | `.peaks/_runtime/<sessionId>/ui/design-draft.md`, `.peaks/_runtime/<sessionId>/ui/requests/<rid>.md` | PRD body, project-scan, archetype |
|
|
491
|
-
| `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 |
|
|
492
|
-
| `qa-test-cases` | `.peaks/_runtime/<sessionId>/qa/test-cases/<rid>.md` | PRD body, RD planning artefact, project-scan, codegraph |
|
|
493
|
-
|
|
494
|
-
**Solo 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; Solo then waits for all to return, runs `ls` checks against the paths above (Peaks-Cli Gate B), and only then advances to RD implementation.
|
|
495
|
-
|
|
496
|
-
**Hard prohibitions on sub-agents** (also passed in each dispatch prompt):
|
|
497
|
-
|
|
498
|
-
- Do NOT call `Skill(skill="...")` — sub-agents must not recursively activate skills, that defeats the fan-out.
|
|
499
|
-
- Do NOT call `peaks skill presence:set` — only the main Solo 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.
|
|
500
|
-
- Do NOT open interactive user prompts. If a sub-agent needs clarification, it must return a `blocked` verdict in its return string and let Solo handle the user message.
|
|
501
|
-
- Do NOT commit, push, install hooks, or apply settings.json mutations. Only Solo holds those permissions.
|
|
502
|
-
- **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.
|
|
503
|
-
|
|
504
|
-
After every sub-agent dispatch returns, Solo **restores presence** once (not per-agent), then continues to Gate B verification:
|
|
505
|
-
|
|
506
|
-
```bash
|
|
507
|
-
peaks skill presence:set peaks-solo --project <repo> --mode <mode> --gate swarm-converged
|
|
508
|
-
```
|
|
509
|
-
|
|
510
|
-
### Degradation when swarm roles fail or are absent
|
|
511
|
-
|
|
512
|
-
| Condition | Solo action | TXT handoff note |
|
|
513
|
-
|---|---|---|
|
|
514
|
-
| UI sub-agent returns blocked/error | RD continues with PRD visual descriptions | `ui-design-missing` |
|
|
515
|
-
| RD planning sub-agent returns blocked/error | RD continues with PRD-derived planning | `tech-doc-missing` |
|
|
516
|
-
| QA test-cases sub-agent returns blocked/error | RD continues; QA backfills test cases before verdict | `qa-test-cases-missing` |
|
|
517
|
-
| Two or more of the above | Fall back to sequential: `peaks request transition rd → spec-locked` then inline RD run, then QA | `swarm-degraded-to-sequential` |
|
|
518
|
-
| All three fail | Pause workflow; surface to user; request confirmation to continue | `swarm-aborted` |
|
|
519
|
-
|
|
520
|
-
Skipping the entire swarm (when `--type` is `config|docs|chore`) is not a degradation — record `swarm-skipped: type=<type>` and proceed.
|
|
521
|
-
|
|
522
|
-
### Frontend-only trigger pre-flight
|
|
523
|
-
|
|
524
|
-
Before computing the swarm plan, Solo runs the keyword scan deterministically:
|
|
525
|
-
|
|
526
|
-
1. Read `.peaks/_runtime/<sessionId>/prd/requests/<rid>.md` body.
|
|
527
|
-
2. Lowercase + strip markdown; check regex `\b(页面|组件|表单|弹窗|表格|样式|布局|交互|UI|UX|page|component|form|modal|table|styling|layout|interaction|frontend|前端)\b`.
|
|
528
|
-
3. If match count ≥ 1 → `frontendKeywordHit=true`.
|
|
529
|
-
4. If `frontendOnly` (from project-scan) is `true` and no keyword hit → UI joins anyway (frontend-only project, even non-visual changes may need visual sanity for regressions).
|
|
530
|
-
5. If `frontendOnly` is `false` and no keyword hit → UI skipped.
|
|
531
|
-
|
|
532
|
-
Solo records the pre-flight result in `sc/swarm-plan.json` so the audit trail shows why UI was or was not included.
|
|
145
|
+
→ see `references/swarm-dispatch-contract.md` for the gate + fan-out shape + degradation tables, and `references/sub-agent-dispatch.md` for the dispatch mechanism (NOT `Skill` tool).
|
|
533
146
|
|
|
534
147
|
## Peaks-Cli Mandatory RD QA repair loop (AUTO-PROCEED)
|
|
535
148
|
|
|
536
|
-
|
|
537
|
-
>
|
|
538
|
-
> - `feature` / `refactor`: full gates (tech-doc, code-review, security-review, test-cases, test-report, security-findings, performance-findings)
|
|
539
|
-
> - `bugfix`: lighter planning (`bug-analysis.md` instead of `tech-doc.md`); still requires code-review + security-review + regression test-cases + security-findings; performance-findings optional unless the bug is performance-related
|
|
540
|
-
> - `config`: only security-review (RD) and security-findings (QA)
|
|
541
|
-
> - `docs` / `chore`: no gates
|
|
542
|
-
>
|
|
543
|
-
> When PRD lands, classify the request type before running `peaks request init` for every role — pass `--type <type>` so the artifact records it and downstream transitions enforce the right gates. Misclassifying a feature as `docs` to skip gates is a workflow violation. If a transition fails with `code: PREREQUISITES_MISSING`, the response lists every missing path — produce them, then re-transition. For one-off exceptions, the escape hatch `--allow-incomplete --reason "<text>"` records the bypass in the artifact transition note.
|
|
544
|
-
|
|
545
|
-
After `peaks-rd` finishes any implementation, repair, or code-output slice, Peaks-Cli Solo MUST automatically route the result to `peaks-qa` without waiting for user confirmation. This is not optional in full-auto mode. Solo must not declare the workflow complete, emit a TXT handoff, or stop at RD completion.
|
|
546
|
-
|
|
547
|
-
**How Solo invokes another role (mechanism, not metaphor):**
|
|
548
|
-
|
|
549
|
-
Solo is itself a skill running in the current session. There are **two distinct mechanisms** in this skill, and they MUST NOT be confused:
|
|
550
|
-
|
|
551
|
-
1. **Swarm fan-out (planning side, after PRD confirmed)** — uses `peaks sub-agent dispatch <role>` to launch real concurrent sub-agents. The CLI returns a per-IDE tool-call descriptor that the LLM executes in its environment. See "Peaks-Cli Swarm parallel phase" above for the full contract. Sub-agents do NOT call Skill(...) back into the role; they execute the role's instructions inline from the prompt.
|
|
552
|
-
2. **Sequential handoff (execution side, RD↔QA repair loop)** — Solo is the only loop, and after RD or QA finishes (whether as a sub-agent or directly), Solo drives the next step from the orchestrator seat. Do NOT use the `Skill` tool to "reactivate" peaks-rd or peaks-qa in the main loop; doing so is the v1.x anti-pattern that masqueraded as "calling the role" but actually just re-prompted the same session. From v1.3 onward, the main loop drives roles via the CLI gate (`peaks request transition`) and reads back artefacts (`peaks request show ... --json`); the actual RD/QA work is either done inline by Solo (when Solo has just been re-invoked by the user) or by a Task sub-agent (in swarm mode).
|
|
553
|
-
|
|
554
|
-
After RD completes (whether inline or sub-agent), Solo does not stop — it must advance to QA. There is no "RD done, ask the user" state in full-auto mode. The only valid stops are: (a) QA verdict=pass, (b) repair cap hit, (c) explicit user cancel.
|
|
555
|
-
|
|
556
|
-
**RD's internal reviews are already parallelized.** When RD finishes implementation, it issues a 3-way sub-agent fan-out (code-review + security-review + perf-baseline, see `skills/peaks-rd/SKILL.md` "Parallel review fan-out") and waits for all to return before transitioning to `qa-handoff`. Solo does NOT need to track three separate RD-side sub-runs; the RD role owns the fan-out lifecycle end-to-end. Solo's presence restoration after the swarm converges is the only coordination point.
|
|
557
|
-
|
|
558
|
-
**Presence restoration after RD/QA work returns (MANDATORY):** In v1.x, role skills called `peaks skill presence:set <role>` internally and stomped on `.peaks/.active-skill.json`. From v1.3 onward, sub-agents in the Swarm path are forbidden from calling `peaks skill presence:set` (see "Sub-agent dispatch" in each role's SKILL.md), so the main loop's presence file is preserved across the fan-out window by construction. The one place Solo still has to actively restore presence is **once after the fan-out returns** (gate=swarm-converged) and again **after each RD↔QA repair iteration** (gate=repair-cycle-<N>). Use the same command from Step 2 with the current mode and the gate that has just advanced:
|
|
559
|
-
|
|
560
|
-
```bash
|
|
561
|
-
peaks skill presence:set peaks-solo --project <repo> --mode <mode> --gate <current-gate>
|
|
562
|
-
```
|
|
563
|
-
|
|
564
|
-
This keeps the CLAUDE.md status header accurate (`Peaks-Cli Skill: peaks-solo`) instead of showing a stale role name. Use the current mode and gate values; the gate may have advanced since startup. Skipping this step causes the header to display the last-known gate permanently.
|
|
565
|
-
|
|
566
|
-
**Full-auto auto-proceed rule**: In the `full-auto` profile, when RD transitions to `qa-handoff`, Solo immediately drives QA — by launching a `peaks sub-agent dispatch qa` sub-agent carrying the `peaks-qa` body (swarm path), then executing the returned toolCall, or by running QA inline in the main loop (assisted/strict path). Do not pause, do not ask the user, do not summarize RD results as if they were final. The only valid reason to skip QA is when `--type` is `docs` or `chore` (no acceptance surface).
|
|
149
|
+
After `peaks-rd` finishes any implementation, repair, or code-output slice, Peaks-Cli Solo MUST automatically route the result to `peaks-qa` without waiting for user confirmation. Repair cap is 3 cycles; after 3 cycles without a passing QA verdict, emit a blocked TXT handoff.
|
|
567
150
|
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
**How Solo routes QA findings back to RD (mechanism, not metaphor):**
|
|
571
|
-
|
|
572
|
-
When `peaks-qa` returns `verdict=return-to-rd`, Solo does NOT manually rewrite RD artifacts. Instead it follows this exact sequence:
|
|
573
|
-
|
|
574
|
-
1. Read the QA verdict and findings via `peaks request show <rid> --role qa --project <repo> --json`. The findings live in the QA artifact body (failing acceptance items, evidence paths, severity).
|
|
575
|
-
2. Transition the RD artifact back from `qa-handoff` to a working state and record the QA verdict in the transition note:
|
|
576
|
-
```bash
|
|
577
|
-
peaks request transition <rid> --role rd --state spec-locked \
|
|
578
|
-
--reason "QA return-to-rd cycle <N>: <one-line summary of failing items; full findings in qa/test-reports/<rid>.md>" \
|
|
579
|
-
--project <repo> --json
|
|
580
|
-
```
|
|
581
|
-
`spec-locked` is the canonical "needs more RD work" state. The reason is mandatory in repair cycles so the artifact history shows the loop.
|
|
582
|
-
3. Re-launch `peaks-rd` work. Two paths, mode-driven:
|
|
583
|
-
- **Swarm / full-auto**: launch a fresh `peaks sub-agent dispatch rd` sub-agent (then execute the returned toolCall) with the same `peaks-rd` body used in the Swarm phase, plus the QA findings path so it can read the failure list. Solo restores presence after the sub-agent returns.
|
|
584
|
-
- **Assisted / strict / inline-fallback**: Solo executes the RD repair steps directly in the main loop, since there is no concurrent fan-out to coordinate.
|
|
585
|
-
In both paths, pass the QA findings path so the repair sees what failed.
|
|
586
|
-
4. peaks-rd fixes the reported issues only (red-line scope: do not modify unrelated surfaces), regenerates code-review and security-review evidence if changes touched reviewed surfaces, then transitions `rd → implemented → qa-handoff` again.
|
|
587
|
-
5. Solo re-runs QA (sub-agent Task in swarm/full-auto, inline in assisted/strict) with the same `<request-id>`. QA re-runs gates against the new diff.
|
|
588
|
-
6. Repeat steps 1-5 until QA returns `verdict=pass`, or the cap below fires.
|
|
589
|
-
**After each repair iteration** (after peaks-rd and peaks-qa both return), Solo MUST restore presence:
|
|
590
|
-
```bash
|
|
591
|
-
peaks skill presence:set peaks-solo --project <repo> --mode <mode> --gate repair-cycle-<N>
|
|
592
|
-
```
|
|
593
|
-
|
|
594
|
-
**Repair cycle cap**: After 3 repair cycles without a passing QA verdict, emit a blocked TXT handoff regardless of remaining issues. Do not loop indefinitely. If a specific issue cannot be resolved within 3 cycles, mark it as a known blocker in the TXT handoff and proceed to the SC phase.
|
|
595
|
-
|
|
596
|
-
In full-auto mode, treat the RD↔QA repair loop as a built-in controller objective: loop through RD→QA until all acceptance items pass (max 3 cycles). Do not exit the loop on a non-passing QA verdict unless the TXT handoff marks the workflow as blocked.
|
|
151
|
+
→ see `references/micro-cycle.md` for the full 5-step procedure (transition, re-launch, fix, re-run, restore presence) + 3-cycle cap.
|
|
597
152
|
|
|
598
153
|
## Default runbook
|
|
599
154
|
|
|
600
|
-
The end-to-end CLI sequence for the `full-auto` profile lives in `references/runbook.md
|
|
155
|
+
The end-to-end CLI sequence for the `full-auto` profile lives in `references/runbook.md`. `assisted` and `strict` profiles pause at `[CONFIRM]` markers in the runbook; `full-auto` and `swarm` auto-proceed through all gates.
|
|
601
156
|
|
|
602
157
|
Maintenance: when adding new CLI commands to the runbook, mirror them into both `references/runbook.md` and the test in `tests/unit/skill-default-runbook.test.ts` (the test falls back to `references/runbook.md` when the SKILL.md section is a pointer).
|
|
603
158
|
|
|
604
|
-
Repair loop details: see `## Mandatory RD QA repair loop` above for the full 5-step procedure and the 3-cycle cap.
|
|
159
|
+
Repair loop details: see `## Mandatory RD QA repair loop` above for the full 5-step procedure and the 3-cycle cap.
|
|
605
160
|
|
|
606
161
|
## RD micro-cycle (TDD small-step rapid-test loop)
|
|
607
162
|
|
|
@@ -614,141 +169,78 @@ Repair loop details: see `## Mandatory RD QA repair loop` above for the full 5-s
|
|
|
614
169
|
|
|
615
170
|
## Peaks-Cli Project standards preflight
|
|
616
171
|
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
- `peaks standards init --project <path> --dry-run`
|
|
620
|
-
- `peaks standards update --project <path> --dry-run`
|
|
621
|
-
|
|
622
|
-
Use `standards init` for first-time creation and `standards update` for existing `CLAUDE.md` append/review behavior. In `full-auto` and `swarm` profiles, `--apply` runs automatically after `--dry-run` succeeds — these files live inside the target project, are required for downstream skill preflight, and producing them is part of finishing the workflow (Peaks-Cli Gate G enforces this). `assisted` and `strict` profiles pause for explicit user confirmation between dry-run and apply.
|
|
623
|
-
|
|
624
|
-
**CRITICAL — Standards must reflect the project scan.** When generating or updating `CLAUDE.md`, the content must reference concrete findings from `.peaks/<changeId>/rd/project-scan.md`: the detected component library (e.g. "This project uses antd 5.x"), CSS solution (e.g. "Uses Less via Umi"), build tool, state management, and routing. Never emit a generic template that says "read .claude/rules/..." without naming the actual project stack. If the project-scan has not been run yet, run it before standards init/update.
|
|
625
|
-
|
|
626
|
-
**Legacy projects additionally** — when archetype ∈ {legacy-frontend, legacy-fullstack, frontend-monorepo}, the `CLAUDE.md` Conventions section MUST extract concrete naming, directory, service-layer, and hooks conventions from `.peaks/<changeId>/system/existing-system.md` and record them as hard constraints for new code. It must also list the `## Legacy constraints` from `project-scan.md` (class components, moment, enzyme, etc.) and instruct that new code in the same module preserves those patterns unless PRD explicitly authorizes modernization. A `CLAUDE.md` for a legacy project that contains only generic rule pointers without naming the actual conventions is a blocking violation — regenerate it.
|
|
627
|
-
|
|
628
|
-
Do not hand-write standards file mutations inside the skill.
|
|
172
|
+
Gather the project standards preflight status via `peaks standards init --project <path> --dry-run` and `peaks standards update --project <path> --dry-run`. Standards must reflect the project scan (component library, CSS, build tool, state, routing) — never emit a generic template.
|
|
629
173
|
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
- whether `CLAUDE.md` is missing, existing, planned, skipped, appended, or review-only;
|
|
633
|
-
- which `.claude/rules/**` files are planned, existing, skipped, appended, or review-only;
|
|
634
|
-
- whether writes were applied or intentionally left as dry-run because authorization or scope was absent;
|
|
635
|
-
- the exact next action if standards should be applied later.
|
|
636
|
-
|
|
637
|
-
If the dry-run output lacks enough detail to explain those deltas, say that the standards increment is unknown and keep standards application blocked until another `peaks standards init/update --dry-run` provides evidence.
|
|
174
|
+
→ see `references/standards-preflight.md` for the full preflight + project-analysis branch contract.
|
|
638
175
|
|
|
639
176
|
## Peaks-Cli Refactor mode
|
|
640
177
|
|
|
641
|
-
Read `references/refactor-mode.md` before handling refactor requests.
|
|
642
|
-
|
|
643
|
-
Default MVP path: `peaks-solo refactor`.
|
|
644
|
-
|
|
645
|
-
It must enforce the shared refactor red lines:
|
|
646
|
-
|
|
647
|
-
1. understand the project before changes;
|
|
648
|
-
2. require UT coverage >= 95%;
|
|
649
|
-
3. treat unknown coverage as failing;
|
|
650
|
-
4. split broad refactors into minimal functional slices;
|
|
651
|
-
5. require strict verifiable specs before each slice;
|
|
652
|
-
6. require 100% acceptance for each slice;
|
|
653
|
-
7. require code changes and sanitized intermediate artifacts to be traceable in local `.peaks/_runtime/<sessionId>/` storage before the next slice; commit or sync sanitized artifacts only when explicitly authorized.
|
|
178
|
+
Read `references/refactor-mode.md` before handling refactor requests. Default MVP path: `peaks-solo refactor`. Enforces shared refactor red lines (understand before changes, ≥95% UT coverage, split broad refactors, strict verifiable specs, 100% acceptance per slice, traceable sanitized artifacts).
|
|
654
179
|
|
|
655
180
|
## Peaks-Cli Quality-gate commands (CLI cheat sheet)
|
|
656
181
|
|
|
657
|
-
|
|
182
|
+
Five CLI commands harden the workflow against silent skips: `peaks request lint`, `peaks request repair-status`, `peaks scan request-type-sanity`, `peaks scan libraries`, `peaks slice check`. Together with `peaks request transition`, they form the runtime quality net.
|
|
658
183
|
|
|
659
|
-
|
|
660
|
-
|---|---|---|---|
|
|
661
|
-
| `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) |
|
|
662
|
-
| `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 |
|
|
663
|
-
| `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 |
|
|
664
|
-
| `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 Solo step 0.6 (alongside `peaks scan archetype`) | Always exits 0 (warnings in JSON envelope; never blocks) |
|
|
665
|
-
| `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 |
|
|
666
|
-
|
|
667
|
-
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.
|
|
184
|
+
→ see `references/quality-gate-cheatsheet.md`.
|
|
668
185
|
|
|
669
186
|
## Peaks-Cli Completion handoff
|
|
670
187
|
|
|
671
|
-
After final validation, refresh project-local standards via `peaks standards init/update` (never hand-write).
|
|
672
|
-
|
|
673
|
-
Use Peaks-Cli TXT for the compact handoff capsule: mode, validated decisions, artifact paths, standards deltas (`CLAUDE.md` and `.claude/rules/**` statuses), open questions, next action. Do not restate the full workflow log.
|
|
674
|
-
|
|
675
|
-
### Workflow completion (no auto-exit)
|
|
188
|
+
After final validation, refresh project-local standards via `peaks standards init/update` (never hand-write). Use Peaks-Cli TXT for the compact handoff capsule: mode, validated decisions, artifact paths, standards deltas, open questions, next action. Do NOT call `peaks skill presence:clear --project <repo>` at workflow end (presence remains active for follow-ups).
|
|
676
189
|
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
Before ending, extract durable memories from this session:
|
|
680
|
-
```bash
|
|
681
|
-
peaks project memories:extract --session-id <session-id> --project <repo> --json
|
|
682
|
-
```
|
|
190
|
+
→ see `references/completion-handoff.md` for the full handoff + "no auto-exit" rule.
|
|
683
191
|
|
|
684
192
|
## Peaks-Cli External references and lifecycle
|
|
685
193
|
|
|
686
|
-
|
|
194
|
+
Inventory of 3rd-party integrations (codegraph, mattpocock/skills, shadcn/ui, MCPs, Context7). Three-stage pattern: capability discovery via `peaks capabilities` → references only → Peaks-Cli CLI for side effects.
|
|
687
195
|
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
Solo 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 — Solo must not treat codegraph output as approval for scope, design, or QA verdict.
|
|
691
|
-
|
|
692
|
-
Do not run upstream installer flows, mutate agent settings, or commit `.codegraph/` artifacts into git. Peaks-Cli gates remain authoritative; codegraph context is a hint, never a substitute for role-skill output.
|
|
196
|
+
→ see `references/external-references.md` for the full inventory + lifecycle rules.
|
|
693
197
|
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
**OpenSpec lifecycle**: `render → validate → show → to-rd → validate → archive`. Solo'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; Solo delegates it to `peaks-rd` during implementation.
|
|
198
|
+
## Codegraph orchestration context
|
|
697
199
|
|
|
698
|
-
|
|
200
|
+
Solo treats `peaks codegraph affected --project <path> <changed-files...> --json` as optional project-analysis enhancement. Output is untrusted supporting evidence — never treat as approval for scope, design, or QA verdict.
|
|
699
201
|
|
|
700
|
-
|
|
202
|
+
→ see `references/codegraph-orchestration.md` for the full contract.
|
|
701
203
|
|
|
702
204
|
## Sub-agent context governance (G7 + G7.7 + G8 + G9 — slice #010)
|
|
703
205
|
|
|
704
|
-
|
|
206
|
+
Layer 3.5 context-governance push for sub-agent dispatch. Main LLM reducer sees metadata-only view (~200 chars/sub-agent); on-demand `Read` for full content. Threshold table: 50% soft warn, 75% `CONTEXT_NEAR_LIMIT`, 80% hard reject (CLI + hook double-guard).
|
|
705
207
|
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
Sub-agent artifacts (rd/tech-doc.md, qa/test-cases/<rid>.md, ui/design-draft.md) MUST NOT be inlined into dispatch records and fed back to the main LLM during reduce.
|
|
709
|
-
|
|
710
|
-
- Sub-agent writes artifact to disk at a known path (path convention: `.peaks/_sub_agents/<sessionId>/artifacts/<rid>-<role>-<idx>.<ext>`).
|
|
711
|
-
- Sub-agent calls `peaks sub-agent dispatch --write-artifact <path>` (or via dispatch CLI flag). The CLI computes sha256 + size + writes `ArtifactMeta` to record.
|
|
712
|
-
- Main LLM reduces the batch and sees ONLY the metadata view (~200 chars per sub-agent, vs ~1MB if content were inlined) — a 3000-5000× reduction.
|
|
713
|
-
- Main LLM decides whether to `Read <path>` for full content (LLM tool call, NOT via peaks CLI).
|
|
714
|
-
|
|
715
|
-
Main LLM view format (G7.4.e):
|
|
716
|
-
```
|
|
717
|
-
[peaks-solo] batch 3/3 done in 47.3s
|
|
718
|
-
- rd → .peaks/_sub_agents/2026-06-06-session-5b1095/artifacts/003-rd-001.md (12KB, sha256:abc123) summary: "wrote RD tech-doc with 4 sub-roles"
|
|
719
|
-
- qa-business → .../artifacts/003-qa-business-001.md (8KB, sha256:def456) summary: "wrote 12 API test cases"
|
|
720
|
-
- qa-perf → .../artifacts/003-qa-perf-001.md (5KB, sha256:ghi789) summary: "p95 latency target ≤ 200ms"
|
|
721
|
-
```
|
|
208
|
+
→ see `references/context-governance.md` for the full protocol.
|
|
722
209
|
|
|
723
|
-
|
|
210
|
+
## References
|
|
724
211
|
|
|
725
|
-
|
|
726
|
-
- Default `false` (G7 remains default).
|
|
727
|
-
- Modes: `balanced` (default) | `aggressive` | `conservative`.
|
|
728
|
-
- Failure: `HEADROOM_UNAVAILABLE` warning + G7 metadata-only fallback (NOT blocking).
|
|
729
|
-
|
|
730
|
-
### G8 — cross sub-agent shared channel (dispatcher-mediated indirect signal)
|
|
731
|
-
|
|
732
|
-
Sub-agent A's completion **immediately** writes a shared entry; sub-agent B (still in flight) can read shared entries from sibling sub-agents. **This is NOT peer-to-peer messaging.** The dispatcher stores, the sub-agents read/write; A and B never directly talk.
|
|
733
|
-
|
|
734
|
-
- Path: `.peaks/_sub_agents/<sessionId>/shared/<batchId>.json`.
|
|
735
|
-
- Two new CLI atoms (NO new top-level CLI): `peaks sub-agent share` + `peaks sub-agent shared-read`.
|
|
736
|
-
- RL-23 strong constraint: when sub-agent calls `peaks sub-agent heartbeat --status done`, it MUST also call `peaks sub-agent share --key "<role>.completed" --value <artifact-meta>`.
|
|
737
|
-
|
|
738
|
-
### G9 — forced compression gate (CLI 兜底 + hook double-guard)
|
|
739
|
-
|
|
740
|
-
Threshold table (256K default context capacity):
|
|
741
|
-
|
|
742
|
-
| Threshold | Prompt size | Behavior |
|
|
743
|
-
|---|---|---|
|
|
744
|
-
| 50% (early warn) | ≥ 128KB | Soft warning, suggest `--use-headroom` |
|
|
745
|
-
| **75% (user red line)** | ≥ 192KB | Soft warn + `warnings: ["CONTEXT_NEAR_LIMIT"]` |
|
|
746
|
-
| **80% (hard reject)** | ≥ 204KB | Hard reject `code: "PROMPT_TOO_LARGE"`; `--force` allowed at CLI |
|
|
747
|
-
| 90% (emergency) | ≥ 230KB | Hard reject + `contextWarning: 'high'` |
|
|
748
|
-
|
|
749
|
-
Two layers:
|
|
750
|
-
- **CLI 兜底** — `peaks sub-agent dispatch` validates prompt size; `--force` allowed.
|
|
751
|
-
- **PreToolUse hook** — `peaks sub-agent-dispatch-guard` re-validates; **NO `--force`** at hook layer (RL-30 strict).
|
|
752
|
-
|
|
753
|
-
The sub-agent prompt template (G8.6 + G9 self-check) is in `references/context-governance.md`.
|
|
212
|
+
Index of every `references/` file. Read on demand.
|
|
754
213
|
|
|
214
|
+
| File | Coverage |
|
|
215
|
+
|---|---|
|
|
216
|
+
| `references/a2a-artifact-mapping.md` | A2A artifact-path mapping. |
|
|
217
|
+
| `references/anchoring-and-session-info.md` | Step 0 anchor + session-conflict resolution. |
|
|
218
|
+
| `references/artifact-contracts.md` | Sub-agent handoff contracts. |
|
|
219
|
+
| `references/boundaries.md` | Solo's do / don't list. |
|
|
220
|
+
| `references/browser-workflow.md` | Browser workflow (Playwright MCP, sanitization). |
|
|
221
|
+
| `references/codegraph-orchestration.md` | Codegraph role handoff context. |
|
|
222
|
+
| `references/command-migration.md` | Legacy command migration map. |
|
|
223
|
+
| `references/completion-handoff.md` | Completion handoff + no auto-exit. |
|
|
224
|
+
| `references/context-governance.md` | G7-G9 sub-agent rules + thresholds. |
|
|
225
|
+
| `references/external-references.md` | 3rd-party inventory + lifecycle. |
|
|
226
|
+
| `references/external-skill-invocation.md` | External skill invocation rules. |
|
|
227
|
+
| `references/existing-system-extraction.md` | Legacy project extraction. |
|
|
228
|
+
| `references/frontend-only-mode.md` | Frontend-only mode + mocks + pre-flight. |
|
|
229
|
+
| `references/gstack-integration.md` | GStack → Peaks mapping. |
|
|
230
|
+
| `references/headroom-integration.md` | Headroom-ai compression modes. |
|
|
231
|
+
| `references/local-artifact-workspace.md` | Workspace tree + root-prohibition. |
|
|
232
|
+
| `references/micro-cycle.md` | RD micro-cycle + repair loop. |
|
|
233
|
+
| `references/mode-selection.md` | Step 1 mode + `--mode` mapping. |
|
|
234
|
+
| `references/openspec-workflow.md` | Step 0.5 OpenSpec opt-in + lifecycle. |
|
|
235
|
+
| `references/project-memory-loading.md` | Step 2.3 durable memories. |
|
|
236
|
+
| `references/project-scan-checklist.md` | Pre-RD scan + artifact template. |
|
|
237
|
+
| `references/quality-gate-cheatsheet.md` | 5 CLI commands vs silent skips. |
|
|
238
|
+
| `references/refactor-mode.md` | Refactor mode + red lines. |
|
|
239
|
+
| `references/resume-detection.md` | Step 0.7 unfinished-work detection. |
|
|
240
|
+
| `references/runbook.md` | End-to-end CLI sequence. |
|
|
241
|
+
| `references/skill-presence-and-title.md` | Step 2 + Step 2.5. |
|
|
242
|
+
| `references/standards-preflight.md` | Standards preflight + analysis branch. |
|
|
243
|
+
| `references/sub-agent-dispatch.md` | IDE-agnostic dispatch (NOT Skill). |
|
|
244
|
+
| `references/swarm-dispatch-contract.md` | Swarm fan-out: gate + shape. |
|
|
245
|
+
| `references/workflow-gates-and-types.md` | Type classification + 7 gates. |
|
|
246
|
+
| `references/workflow.md` | Workflow flow + transitions. |
|