peaks-cli 1.3.7 → 1.3.9
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 +119 -14
- package/dist/src/cli/commands/project-commands.js +58 -1
- package/dist/src/cli/commands/request-commands.js +124 -4
- 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/program.js +2 -0
- package/dist/src/services/artifacts/request-artifact-service.d.ts +16 -0
- package/dist/src/services/artifacts/request-artifact-service.js +18 -2
- 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/session/caller-binding-service.d.ts +70 -0
- package/dist/src/services/session/caller-binding-service.js +148 -0
- package/dist/src/services/session/caller-id-types.d.ts +77 -0
- package/dist/src/services/session/caller-id-types.js +46 -0
- package/dist/src/services/session/index.d.ts +4 -0
- package/dist/src/services/session/index.js +5 -0
- package/dist/src/services/session/platform-fallbacks.d.ts +31 -0
- package/dist/src/services/session/platform-fallbacks.js +35 -0
- package/dist/src/services/session/resolve-caller-id.d.ts +57 -0
- package/dist/src/services/session/resolve-caller-id.js +88 -0
- package/dist/src/services/skills/skill-presence-service.d.ts +11 -0
- package/dist/src/services/skills/skill-presence-service.js +59 -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 +1 -1
- package/skills/peaks-qa/SKILL.md +86 -515
- 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-refactor-role.md +3 -0
- package/skills/peaks-qa/references/qa-runbook.md +74 -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 +79 -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 -732
- 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 +40 -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 +148 -0
- package/skills/peaks-rd/references/skill-presence-and-title.md +22 -0
- package/skills/peaks-solo/SKILL.md +87 -786
- 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 +87 -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/project-scan-checklist.md +136 -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,704 +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. If you forge a session id with `openssl rand` and pass it
|
|
145
|
-
# via --session-id, peaks workspace init will write it to .peaks/.session.json but
|
|
146
|
-
# the binding only sticks if no prior session is open. To avoid the "two sessions
|
|
147
|
-
# in .peaks/" confusion that bites Solo, always omit --session-id here and let the
|
|
148
|
-
# CLI auto-generate.
|
|
149
|
-
peaks workspace init --project <repo> --json
|
|
150
|
-
peaks skill presence:set peaks-solo --project <repo> --gate startup
|
|
151
|
-
```
|
|
152
|
-
|
|
153
|
-
> `<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.
|
|
154
|
-
|
|
155
|
-
**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.
|
|
156
66
|
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
**Session conflict resolution (read once, internalise):** If `peaks workspace init` returns `code: "CONFLICTING_SESSION"` with a body like
|
|
160
|
-
`{"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.
|
|
161
|
-
|
|
162
|
-
`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.
|
|
163
68
|
|
|
164
69
|
### Peaks-Cli Step 0.7: Detect unfinished work and offer resume (BLOCKING on first invocation per session)
|
|
165
70
|
|
|
166
|
-
After Step 0
|
|
167
|
-
|
|
168
|
-
**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.
|
|
169
|
-
|
|
170
|
-
**Detection logic** (all read-only, no side effects; uses only existing CLIs):
|
|
171
|
-
|
|
172
|
-
```bash
|
|
173
|
-
# 1. Confirm the current session id
|
|
174
|
-
sid=$(cat .peaks/.session.json | python3 -c "import sys,json; print(json.load(sys.stdin)['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
|
|
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.
|
|
178
72
|
|
|
179
|
-
|
|
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"):
|
|
190
|
-
|
|
191
|
-
| Files present | State | Deepest completed gate | Resume point (if any) |
|
|
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
|
-
|
|
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.
|
|
230
78
|
|
|
231
|
-
|
|
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.
|
|
235
|
-
|
|
236
|
-
Map the user's selection to the `--mode` flag value (used by `peaks skill presence:set`; `presence:set --mode` accepts any string, so the name matches the user-facing label rather than overloading "solo" which is also the skill name):
|
|
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
|
|
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.
|
|
288
96
|
|
|
289
|
-
|
|
290
|
-
peaks session title $(cat .peaks/.session.json | python3 -c "import sys,json; print(json.load(sys.stdin)['sessionId'])") "<title>"
|
|
291
|
-
```
|
|
292
|
-
|
|
293
|
-
If the session directory already has a title (check via `peaks session list --json`), skip this step — the title is already set.
|
|
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
|
-
|
|
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.
|
|
332
122
|
|
|
333
|
-
|
|
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` (or the legacy `.peaks/.session.json` for pre-migration trees), the existing session is reused.
|
|
336
|
-
|
|
337
|
-
**Existing old-session cleanup**: If `.peaks/` contains numeric-only or generic session directories from prior runs (e.g. `2026-05-25-auth-system`), create the new correctly-named session, migrate any reusable artifacts into it, and note the migration in the TXT handoff. Delete empty old-session directories.
|
|
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`, `.peaks/sop-state/`) for one minor release
|
|
350
|
-
# so a fresh upgrade does not break in-flight workflows. Older trees
|
|
351
|
-
# are auto-migrated by `peaks workspace reconcile --apply`.
|
|
352
|
-
.peaks/_runtime/
|
|
353
|
-
├── active-skill.json # orchestrator presence marker (peaks-solo / -rd / -qa / -ui / -sc / -sop / -txt)
|
|
354
|
-
├── session.json # project → session binding (the only single-session source of truth)
|
|
355
|
-
└── sop-state/ # current phase + history; definitions live globally in ~/.peaks
|
|
356
|
-
|
|
357
|
-
# Per-slice artifact dirs (auto-generated, one per session). Files
|
|
358
|
-
# inside ARE tracked by the 提交中间产物 convention.
|
|
359
|
-
.peaks/_runtime/<sessionId>/
|
|
360
|
-
prd/source/ # PRD source documents (Feishu exports, pasted content)
|
|
361
|
-
prd/requests/ # PRD request artifacts (goals, non-goals, acceptance, frontend delta)
|
|
362
|
-
ui/requests/ # UI request artifacts (visual direction, taste reports)
|
|
363
|
-
rd/requests/ # RD request artifacts (slice specs, coverage, CR findings)
|
|
364
|
-
rd/project-scan.md # Project scan (session-scoped singleton, generated once per session)
|
|
365
|
-
qa/test-cases/ # QA test cases
|
|
366
|
-
qa/test-reports/ # QA test reports (regression matrices, browser evidence)
|
|
367
|
-
qa/requests/ # QA request artifacts
|
|
368
|
-
sc/ # SC artifacts (change-control, impact, retention, boundary)
|
|
369
|
-
txt/ # TXT artifacts (handoff capsules, lessons, memory extraction)
|
|
370
|
-
system/ # Existing-system extraction output (visual tokens, conventions)
|
|
371
|
-
```
|
|
372
|
-
|
|
373
|
-
Files written into these directories during the workflow (not pre-created — they appear as their step runs):
|
|
374
|
-
|
|
375
|
-
- `rd/project-scan.md` (Solo step 0.6)
|
|
376
|
-
- `rd/tech-doc.md` (feature/refactor planning; required by `rd → implemented` gate)
|
|
377
|
-
- `rd/bug-analysis.md` (bugfix planning; required by `rd → implemented` gate for `--type bugfix`)
|
|
378
|
-
- `rd/code-review.md`, `rd/security-review.md` (required by `rd → qa-handoff` gate for feature/bugfix/refactor; security-review only for config)
|
|
379
|
-
- `rd/mock-plan.md` (frontend-only mode)
|
|
380
|
-
- `ui/design-draft.md` (UI step)
|
|
381
|
-
- `system/existing-system.md` (Solo step 0.7; legacy projects only)
|
|
382
|
-
- `qa/test-cases/<rid>.md`, `qa/test-reports/<rid>.md`, `qa/security-findings.md`, `qa/performance-findings.md` (gated per `--type`)
|
|
383
|
-
|
|
384
|
-
### Root pollution prohibition (CRITICAL)
|
|
385
|
-
|
|
386
|
-
**NEVER write Peaks-Cli intermediate artifacts to the project root directory.** Specifically prohibited at root level:
|
|
387
|
-
|
|
388
|
-
- PRD snapshots, document extracts, or requirement notes (`feishu-doc-*.md`, `*-snapshot.md`, etc.)
|
|
389
|
-
- RD tech docs, scan reports, slice specs, or architecture notes
|
|
390
|
-
- QA screenshots, browser evidence, test reports, or validation logs (`.png`, `.jpg`)
|
|
391
|
-
- QA test helper files, mock servers, or fixture scripts (`qa-server.js`, etc.)
|
|
392
|
-
- UI design drafts, taste reports, or visual direction notes
|
|
393
|
-
- TXT handoff capsules or lesson files
|
|
394
|
-
|
|
395
|
-
Legitimate source files (e.g. `jest-setup.ts`, `tailwind.config.js`) belong at root — do not move them.
|
|
396
|
-
|
|
397
|
-
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.
|
|
398
|
-
|
|
399
|
-
### Git and sync policy
|
|
400
|
-
|
|
401
|
-
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.
|
|
402
124
|
|
|
403
125
|
## Peaks-Cli Pre-RD project scan checklist (MANDATORY)
|
|
404
126
|
|
|
405
|
-
Before handing off to `peaks-rd`, scan the project and record findings to `.peaks/_runtime/<sessionId>/rd/project-scan.md`.
|
|
406
|
-
|
|
407
|
-
### 0. Project archetype detection (MANDATORY — run FIRST, deterministic CLI)
|
|
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.
|
|
408
128
|
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
```bash
|
|
412
|
-
peaks scan archetype --project <repo> --json
|
|
413
|
-
```
|
|
414
|
-
|
|
415
|
-
The command emits a stable JSON envelope with these fields you copy verbatim into `project-scan.md`:
|
|
416
|
-
|
|
417
|
-
- `archetype`: `greenfield | legacy-frontend | legacy-fullstack | frontend-monorepo | unknown`
|
|
418
|
-
- `confidence`: `high | medium | low`
|
|
419
|
-
- `frontendOnly`: `true | false`
|
|
420
|
-
- `frontendOnlyReason`: short string explaining the decision
|
|
421
|
-
- `signals[]`: each signal's name, matched flag, and detail (paste under `## Archetype → Signals matched`)
|
|
422
|
-
- `detected`: raw filesystem facts (package.json presence, backend frameworks, swagger paths, monorepo configs, src file count, lockfile age)
|
|
423
|
-
|
|
424
|
-
If `archetype` is `unknown`, STOP and surface to the user as an open question in the TXT handoff — do NOT guess. If `confidence` is `low`, note the uncertainty in `project-scan.md` and confirm the choice with the user before proceeding.
|
|
425
|
-
|
|
426
|
-
The CLI is the sole source of truth for archetype and frontend-only-mode decisions. Manual heuristics in older versions of this skill are superseded by the CLI output.
|
|
427
|
-
|
|
428
|
-
### 1. Build tool: inspect config files for the framework
|
|
429
|
-
|
|
430
|
-
| Config file | Framework |
|
|
431
|
-
|---|---|
|
|
432
|
-
| `.umirc.ts`, `config/config.ts` | Umi (Ant Design Pro) |
|
|
433
|
-
| `next.config.*` | Next.js |
|
|
434
|
-
| `vite.config.*` | Vite |
|
|
435
|
-
| `rsbuild.config.*` | Rsbuild |
|
|
436
|
-
| `rspack.config.*` | Rspack |
|
|
437
|
-
| `farm.config.*` | Farm |
|
|
438
|
-
| `craco.config.*` | CRA + craco |
|
|
439
|
-
| `webpack.config.*` | Webpack |
|
|
440
|
-
| `gulpfile.*` | Gulp (legacy) |
|
|
441
|
-
| `angular.json` | Angular |
|
|
442
|
-
| Custom `build/` or `scripts/build.*` only | Bespoke pipeline — record as `custom` and capture entry script path |
|
|
443
|
-
|
|
444
|
-
If multiple build configs coexist (e.g. `webpack.config.js` + `vite.config.ts`), record ALL of them and mark `build.mixed: true`. Mixed builds are a constraint, not an error — do not silently pick one.
|
|
445
|
-
|
|
446
|
-
### 2. Component library: check `package.json` dependencies
|
|
447
|
-
|
|
448
|
-
| Package | Library |
|
|
449
|
-
|---|---|
|
|
450
|
-
| `antd` (capture major version: v3/v4/v5) | Ant Design |
|
|
451
|
-
| `@ant-design/pro-components`, `@ant-design/pro-*` | Ant Design Pro suite |
|
|
452
|
-
| `@mui/material` | Material UI |
|
|
453
|
-
| `tailwindcss` + `radix-ui` | shadcn/ui |
|
|
454
|
-
| `element-plus` / `element-ui` | Element UI/Plus |
|
|
455
|
-
| `@arco-design/web-react` | Arco Design |
|
|
456
|
-
| `tdesign-react` / `tdesign-vue-next` | TDesign |
|
|
457
|
-
| `@douyinfe/semi-ui` | Semi Design |
|
|
458
|
-
| `@nextui-org/react` | NextUI |
|
|
459
|
-
| `@chakra-ui/react` | Chakra UI |
|
|
460
|
-
| `vant` | Vant (mobile) |
|
|
461
|
-
| Workspace package (`workspace:*`) or private-registry scope matching internal design system | In-house design system — record package name and entry path |
|
|
462
|
-
|
|
463
|
-
**CRITICAL**: Never add a second component library to a project that already has one. Do not introduce shadcn/ui to an antd project or vice versa. For antd, ALSO record the major version — v3 / v4 / v5 have incompatible APIs and tokens; mixing component code across majors is a blocker.
|
|
464
|
-
|
|
465
|
-
### 3. CSS framework: check for conflicts
|
|
466
|
-
|
|
467
|
-
- **antd + TailwindCSS**: High conflict risk (preflight reset overrides base styles). Resolution:
|
|
468
|
-
- Both already in `package.json` → coexist; use Tailwind for layout, antd for components.
|
|
469
|
-
- Tailwind breaks antd styles → add `corePlugins: { preflight: false }` or `important: '#root'`.
|
|
470
|
-
- Only antd, user wants Tailwind → **Block**; propose antd `ConfigProvider` tokens or CSS Modules.
|
|
471
|
-
- **Less/Sass**: Standard for Umi+antd projects; compatible with CSS Modules.
|
|
472
|
-
- **CSS-in-JS (@emotion, styled-components)**: Check if component library already uses one internally; don't add competing solutions.
|
|
473
|
-
|
|
474
|
-
### 4. State management, routing, data fetching: detect from `package.json`
|
|
475
|
-
|
|
476
|
-
State: `zustand`, `jotai`, `redux`/`@reduxjs/toolkit`, `valtio`, `mobx`, `hox`
|
|
477
|
-
Routing: `react-router-dom`, `@umijs/max`, Next.js file-based, `vue-router`
|
|
478
|
-
Data fetching: `@tanstack/react-query`, `swr`, `ahooks` (`useRequest`), `umi-request`
|
|
479
|
-
|
|
480
|
-
### 5. Legacy signals (legacy-frontend / legacy-fullstack only)
|
|
481
|
-
|
|
482
|
-
Grep `src/` for outdated patterns and list them as constraints in `project-scan.md` under `## Legacy constraints`. RD must preserve these patterns for new code in the same file/module unless PRD explicitly authorizes modernization.
|
|
483
|
-
|
|
484
|
-
| Signal | Detection |
|
|
485
|
-
|---|---|
|
|
486
|
-
| Class components | `extends React.Component` / `extends Component` in `.tsx`/`.jsx` |
|
|
487
|
-
| `moment` instead of dayjs/date-fns | `package.json` dep |
|
|
488
|
-
| Enzyme test suite | `package.json` dep `enzyme*` |
|
|
489
|
-
| redux-saga / redux-thunk | `package.json` dep |
|
|
490
|
-
| HOC-heavy patterns | `withRouter`, `connect()`, `compose(` frequency in `src/` |
|
|
491
|
-
| Legacy lifecycle | `componentWillMount`/`componentWillReceiveProps` occurrences |
|
|
492
|
-
| jQuery / Backbone / Vue 2 | `package.json` dep |
|
|
493
|
-
| Inline styles dominant | `style={{` occurrences ≥ 50 |
|
|
494
|
-
|
|
495
|
-
### 6. Project-scan artifact template
|
|
496
|
-
|
|
497
|
-
```markdown
|
|
498
|
-
# Project Scan: <project-name>
|
|
499
|
-
**Date:** YYYY-MM-DD
|
|
500
|
-
**Session:** <session-id>
|
|
501
|
-
|
|
502
|
-
## Archetype
|
|
503
|
-
- Type: <greenfield | legacy-frontend | legacy-fullstack | frontend-monorepo | unknown>
|
|
504
|
-
- Signals matched: <bullet list of signals that drove the decision>
|
|
505
|
-
|
|
506
|
-
## Project mode
|
|
507
|
-
- Frontend-only: <true | false>
|
|
508
|
-
- Reason: <archetype-derived | user-stated | backend-detected>
|
|
509
|
-
|
|
510
|
-
## Build tool
|
|
511
|
-
- Framework: <name> <version>
|
|
512
|
-
- Config file: <path>
|
|
513
|
-
- Mixed builds: <true | false; list all configs if true>
|
|
514
|
-
|
|
515
|
-
## Component library
|
|
516
|
-
- Library: <name> <version (major matters for antd)>
|
|
517
|
-
- Design-system packages: <list>
|
|
518
|
-
- In-house design system: <package name | none>
|
|
519
|
-
|
|
520
|
-
## CSS solution
|
|
521
|
-
- Primary: <Less/Sass/CSS-in-JS/TailwindCSS/CSS Modules>
|
|
522
|
-
- Conflicts detected: <none | description and recommendation>
|
|
523
|
-
|
|
524
|
-
## State management, routing, data fetching
|
|
525
|
-
- State: <name>
|
|
526
|
-
- Routing: <name>
|
|
527
|
-
- Data fetching: <name>
|
|
528
|
-
|
|
529
|
-
## Library versions
|
|
530
|
-
- Source: output of `peaks scan libraries --project <repo> --json` (see Gate A; cross-check diff imports against `schemas/library-breaking-changes.data.json` in `peaks-rd` preflight)
|
|
531
|
-
- Total: <count from scan.libraries.totalCount>
|
|
532
|
-
- Notable: <bullet list of libraries with major >= a known breaking change in `schemas/library-breaking-changes.data.json`; e.g. "- antd@^5.18.0 (major=5) — see breaking-change rule for antd v4→v5 if any code uses Drawer.width">
|
|
533
|
-
|
|
534
|
-
## Legacy constraints
|
|
535
|
-
- <bullet list of legacy signals from section 5; empty for greenfield>
|
|
536
|
-
```
|
|
129
|
+
→ see `references/project-scan-checklist.md` for the full checklist.
|
|
537
130
|
|
|
538
131
|
## Peaks-Cli Frontend-only development mode
|
|
539
132
|
|
|
540
|
-
When the project has no live backend (no swagger.json, no API server), Solo must activate frontend-only mode.
|
|
541
|
-
|
|
542
|
-
### Mode determination (deterministic — CLI is the source of truth)
|
|
543
|
-
|
|
544
|
-
The CLI decision is authoritative. Read `frontendOnly` and `frontendOnlyReason` directly from the `peaks scan archetype --json` output and copy both into `project-scan.md` under `## Project mode`. Do NOT re-derive the decision from user phrasing.
|
|
545
|
-
|
|
546
|
-
User-stated intent is **only** consulted when it conflicts with the CLI result. The two conflict cases:
|
|
547
|
-
|
|
548
|
-
- **CLI says `frontendOnly=false` but the user says "前端项目 / 没有后端 / 先 mock 数据"**: STOP and `AskUserQuestion` to confirm whether to override the scan (the repo probably contains a backend folder the user wants to ignore). Record the override decision and reason in `project-scan.md`.
|
|
549
|
-
- **CLI says `frontendOnly=true` but the user says "需要做后端 / 加 API"**: STOP and `AskUserQuestion` to confirm whether the request actually targets the missing backend (the user may be confused about repo scope, or there is a separate backend repo Solo should switch to).
|
|
550
|
-
|
|
551
|
-
When there is no conflict, do not ask — the CLI value wins and the workflow proceeds.
|
|
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`.
|
|
552
134
|
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
Solo records the chosen mock strategy in `.peaks/_runtime/<sessionId>/rd/tech-doc.md` under a `## Mock Data Strategy` section. The choice depends on the project scan results:
|
|
556
|
-
|
|
557
|
-
| Project data-fetching pattern | Recommended mock approach | Rationale |
|
|
558
|
-
|---|---|---|
|
|
559
|
-
| Umi + `umi-request` / `@umijs/plugins` request | Umi mock directory (`mock/*.ts`) | Built-in, zero-config, auto-reload on file change |
|
|
560
|
-
| `@tanstack/react-query` + custom fetcher | Service-layer mock with `Promise.resolve()` stubs in the service file | Keeps query hooks unchanged; swap fetcher target later |
|
|
561
|
-
| `ahooks` `useRequest` + service functions | Service-layer mock: replace HTTP call with `Promise.resolve(mockData)` | Matches existing service-function pattern |
|
|
562
|
-
| MSW (Mock Service Worker) already configured | Add new handlers to existing MSW setup | Consistent with project convention |
|
|
563
|
-
| No existing pattern (greenfield) | Service-layer mock with a `mock/` directory and typed fixture files | Clean separation, easy to delete later |
|
|
564
|
-
| Existing `src/services/*` but no fetcher abstraction | Inline mock inside the service file; preserve the function signature | Keeps existing call-sites unchanged |
|
|
565
|
-
| Mixed data-fetching styles (e.g. react-query + raw fetch in legacy files) | Match the style of the most recently added code in the same module | Avoid introducing a third style |
|
|
566
|
-
| Cannot decide from scan alone | STOP and `AskUserQuestion` | Asking once beats picking differently on every run |
|
|
567
|
-
|
|
568
|
-
**Mock data rules:**
|
|
569
|
-
|
|
570
|
-
1. Every mock response must match the shape of the expected real API response. Define a TypeScript interface for the response type first, then create mock data that satisfies it.
|
|
571
|
-
2. Mock data should be realistic (not `"test"`, `"foo"`, `123`) — use plausible Chinese/English content that resembles production data.
|
|
572
|
-
3. Each mock must export its TypeScript interface so RD implementation and QA test-cases can import the same types.
|
|
573
|
-
4. Mark every mock file with a header comment: `// MOCK: Replace with real API call when swagger.json is available`.
|
|
574
|
-
5. Before producing any mock file, register the plan in `.peaks/_runtime/<sessionId>/rd/mock-plan.md` with: chosen strategy (from the table above), planned file paths, and a one-line rationale per file. This file is the source of truth for mock locations across runs — RD must read it before writing code, QA must read it before writing test cases.
|
|
575
|
-
|
|
576
|
-
### API contract placeholder pattern
|
|
577
|
-
|
|
578
|
-
When no swagger.json exists, RD defines API contracts as TypeScript interfaces with a mock-then-real service layer:
|
|
579
|
-
|
|
580
|
-
```
|
|
581
|
-
src/services/types/<feature>-api.types.ts ← API request/response interfaces
|
|
582
|
-
src/services/<feature>-service.ts ← Service functions (mock → real)
|
|
583
|
-
mock/<feature>-mock.ts ← Mock data satisfying interfaces
|
|
584
|
-
```
|
|
585
|
-
|
|
586
|
-
Each service function returns a typed mock response marked with `// MOCK: Replace with real API call when swagger.json is available`.
|
|
587
|
-
|
|
588
|
-
### Mock-to-real migration path
|
|
589
|
-
|
|
590
|
-
When swagger.json becomes available later, the migration follows this sequence:
|
|
591
|
-
|
|
592
|
-
1. Generate typed API client from swagger.json (e.g. via `openapi-typescript` or manual mapping).
|
|
593
|
-
2. Replace mock imports with generated API calls, one service file at a time.
|
|
594
|
-
3. Remove corresponding mock files.
|
|
595
|
-
4. Run QA regression to verify the real API responses match the mock interface contracts.
|
|
596
|
-
|
|
597
|
-
Solo records the migration readiness in the TXT handoff capsule under a `## API Migration` section listing: mock file paths, the corresponding swagger endpoints (when known), and the migration status for each.
|
|
598
|
-
|
|
599
|
-
### Feishu document access fallback
|
|
600
|
-
|
|
601
|
-
When the PRD source is a Feishu/Lark document that requires authentication:
|
|
602
|
-
|
|
603
|
-
1. **Primary path**: Playwright MCP headed browser → user completes login → Solo reads document content via `browser_snapshot`.
|
|
604
|
-
2. **Fallback A (user cannot login)**: Ask user to copy-paste the document content or export as Markdown/PDF. Solo creates the PRD artifact from the pasted content.
|
|
605
|
-
3. **Fallback B (user provides export)**: User drops a `.md` or `.pdf` export into `.peaks/_runtime/<sessionId>/prd/source/`. Solo reads and processes it.
|
|
606
|
-
4. **Fallback C (none of the above)**: Mark PRD as `blocked` with reason `doc-inaccessible`, list the exact next steps for the user, and pause the workflow.
|
|
607
|
-
|
|
608
|
-
Never silently fall back to unauthenticated `fetch` or `WebFetch` for authenticated documents.
|
|
135
|
+
→ see `references/frontend-only-mode.md` for the full mode contract, mock-data strategy, and the pre-flight keyword scan.
|
|
609
136
|
|
|
610
137
|
## Peaks-Cli Request type classification + Workflow order + Transition verification gates
|
|
611
138
|
|
|
612
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.
|
|
613
140
|
|
|
614
|
-
|
|
615
141
|
## Peaks-Cli Swarm parallel phase (sub-agent fan-out, conditional)
|
|
616
142
|
|
|
617
|
-
The Swarm phase is **conditional**, not unconditional.
|
|
618
|
-
|
|
619
|
-
### Swarm gate (decide BEFORE fan-out)
|
|
620
|
-
|
|
621
|
-
Before launching any sub-agent, Solo must compute the **swarm plan** from three signals:
|
|
622
|
-
|
|
623
|
-
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.
|
|
624
|
-
2. **Request type** (`--type` from `peaks request init`):
|
|
625
|
-
- `feature` / `refactor` / `bugfix` → RD(planning) and QA(test-cases) are always in the swarm
|
|
626
|
-
- `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.
|
|
627
|
-
3. **Frontend touch** — does the request affect user-visible behavior? This is decided by:
|
|
628
|
-
- Reading `.peaks/_runtime/<sessionId>/rd/project-scan.md` `## Project mode` for `frontendOnly` (project-shape signal)
|
|
629
|
-
- **AND** scanning the PRD body for frontend keywords: 页面 / 组件 / 表单 / 弹窗 / 表格 / 样式 / 布局 / 交互 / UI / UX / page / component / form / modal / table / styling / layout / interaction
|
|
630
|
-
- UI joins the swarm when (a) is `true` OR (b) matches. Both signals required `false` to skip UI.
|
|
631
|
-
|
|
632
|
-
Solo records the swarm plan in `.peaks/_runtime/<sessionId>/sc/swarm-plan.json` so SC and TXT can audit what was launched:
|
|
633
|
-
|
|
634
|
-
```json
|
|
635
|
-
{
|
|
636
|
-
"rid": "<rid>",
|
|
637
|
-
"type": "feature",
|
|
638
|
-
"frontendOnly": true,
|
|
639
|
-
"frontendKeywordHit": true,
|
|
640
|
-
"subAgents": ["ui", "rd-planning", "qa-test-cases"]
|
|
641
|
-
}
|
|
642
|
-
```
|
|
643
|
-
|
|
644
|
-
Sub-agent presence in this list = Solo launched a Task for it. Absence = the role was skipped with documented reason.
|
|
645
|
-
|
|
646
|
-
### Mode-driven fan-out shape
|
|
647
|
-
|
|
648
|
-
| Mode | How the swarm plan is decided | What Solo does |
|
|
649
|
-
|---|---|---|
|
|
650
|
-
| `full-auto` | Compute plan from signals above, no question to user | Auto-launch all sub-agents in the plan in parallel |
|
|
651
|
-
| `swarm` | Same as `full-auto` | Same as `full-auto` (this profile name is historical — behavior is identical) |
|
|
652
|
-
| `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 |
|
|
653
|
-
| `strict` | Same as `assisted` (the question is informational; strict still enforces confirmation gates later) | Same as `assisted` |
|
|
654
|
-
|
|
655
|
-
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.
|
|
656
|
-
|
|
657
|
-
### Sub-agent mechanism (IDE-agnostic dispatch, NOT Skill tool)
|
|
658
|
-
|
|
659
|
-
**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.
|
|
660
|
-
|
|
661
|
-
Each sub-agent dispatch call looks like:
|
|
662
|
-
|
|
663
|
-
```
|
|
664
|
-
peaks sub-agent dispatch <role> \
|
|
665
|
-
--prompt "<paste peaks-<role>/SKILL.md body, minus the self-presence / Step 0 blocks,
|
|
666
|
-
plus the runtime arguments: project=<repo>, session-id=<session-id>, request-id=<rid>, mode=<mode>,
|
|
667
|
-
plus the explicit output contract: 'Write your artefacts to the paths listed below and
|
|
668
|
-
return only the list of paths. Do not call Skill(...). Do not set presence. Do not
|
|
669
|
-
hand back prose.', plus the heartbeat instruction: 'While running, call
|
|
670
|
-
peaks sub-agent heartbeat --record <dispatchRecordPath> --status <state> --progress <pct> --note \"<text>\"
|
|
671
|
-
at least every 30 seconds.'>" \
|
|
672
|
-
--request-id <rid> --session-id <session-id> --project <repo> --json
|
|
673
|
-
```
|
|
674
|
-
|
|
675
|
-
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.
|
|
676
|
-
|
|
677
|
-
The role's required artefact paths (also see peaks-ui/rd/qa SKILL.md and `references/swarm-dispatch-contract.md`):
|
|
678
|
-
|
|
679
|
-
| Role | Writes | Reads (PRD-side) |
|
|
680
|
-
|---|---|---|
|
|
681
|
-
| `ui` | `.peaks/_runtime/<sessionId>/ui/design-draft.md`, `.peaks/_runtime/<sessionId>/ui/requests/<rid>.md` | PRD body, project-scan, archetype |
|
|
682
|
-
| `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 |
|
|
683
|
-
| `qa-test-cases` | `.peaks/_runtime/<sessionId>/qa/test-cases/<rid>.md` | PRD body, RD planning artefact, project-scan, codegraph |
|
|
684
|
-
|
|
685
|
-
**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.
|
|
686
|
-
|
|
687
|
-
**Hard prohibitions on sub-agents** (also passed in each dispatch prompt):
|
|
688
|
-
|
|
689
|
-
- Do NOT call `Skill(skill="...")` — sub-agents must not recursively activate skills, that defeats the fan-out.
|
|
690
|
-
- 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.
|
|
691
|
-
- 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.
|
|
692
|
-
- Do NOT commit, push, install hooks, or apply settings.json mutations. Only Solo holds those permissions.
|
|
693
|
-
- **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.
|
|
694
|
-
|
|
695
|
-
After every sub-agent dispatch returns, Solo **restores presence** once (not per-agent), then continues to Gate B verification:
|
|
696
|
-
|
|
697
|
-
```bash
|
|
698
|
-
peaks skill presence:set peaks-solo --project <repo> --mode <mode> --gate swarm-converged
|
|
699
|
-
```
|
|
700
|
-
|
|
701
|
-
### Degradation when swarm roles fail or are absent
|
|
702
|
-
|
|
703
|
-
| Condition | Solo action | TXT handoff note |
|
|
704
|
-
|---|---|---|
|
|
705
|
-
| UI sub-agent returns blocked/error | RD continues with PRD visual descriptions | `ui-design-missing` |
|
|
706
|
-
| RD planning sub-agent returns blocked/error | RD continues with PRD-derived planning | `tech-doc-missing` |
|
|
707
|
-
| QA test-cases sub-agent returns blocked/error | RD continues; QA backfills test cases before verdict | `qa-test-cases-missing` |
|
|
708
|
-
| 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` |
|
|
709
|
-
| All three fail | Pause workflow; surface to user; request confirmation to continue | `swarm-aborted` |
|
|
710
|
-
|
|
711
|
-
Skipping the entire swarm (when `--type` is `config|docs|chore`) is not a degradation — record `swarm-skipped: type=<type>` and proceed.
|
|
712
|
-
|
|
713
|
-
### Frontend-only trigger pre-flight
|
|
714
|
-
|
|
715
|
-
Before computing the swarm plan, Solo runs the keyword scan deterministically:
|
|
716
|
-
|
|
717
|
-
1. Read `.peaks/_runtime/<sessionId>/prd/requests/<rid>.md` body.
|
|
718
|
-
2. Lowercase + strip markdown; check regex `\b(页面|组件|表单|弹窗|表格|样式|布局|交互|UI|UX|page|component|form|modal|table|styling|layout|interaction|frontend|前端)\b`.
|
|
719
|
-
3. If match count ≥ 1 → `frontendKeywordHit=true`.
|
|
720
|
-
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).
|
|
721
|
-
5. If `frontendOnly` is `false` and no keyword hit → UI skipped.
|
|
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.
|
|
722
144
|
|
|
723
|
-
|
|
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).
|
|
724
146
|
|
|
725
147
|
## Peaks-Cli Mandatory RD QA repair loop (AUTO-PROCEED)
|
|
726
148
|
|
|
727
|
-
|
|
728
|
-
>
|
|
729
|
-
> - `feature` / `refactor`: full gates (tech-doc, code-review, security-review, test-cases, test-report, security-findings, performance-findings)
|
|
730
|
-
> - `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
|
|
731
|
-
> - `config`: only security-review (RD) and security-findings (QA)
|
|
732
|
-
> - `docs` / `chore`: no gates
|
|
733
|
-
>
|
|
734
|
-
> 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.
|
|
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.
|
|
735
150
|
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
**How Solo invokes another role (mechanism, not metaphor):**
|
|
739
|
-
|
|
740
|
-
Solo is itself a skill running in the current session. There are **two distinct mechanisms** in this skill, and they MUST NOT be confused:
|
|
741
|
-
|
|
742
|
-
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.
|
|
743
|
-
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).
|
|
744
|
-
|
|
745
|
-
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.
|
|
746
|
-
|
|
747
|
-
**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.
|
|
748
|
-
|
|
749
|
-
**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:
|
|
750
|
-
|
|
751
|
-
```bash
|
|
752
|
-
peaks skill presence:set peaks-solo --project <repo> --mode <mode> --gate <current-gate>
|
|
753
|
-
```
|
|
754
|
-
|
|
755
|
-
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.
|
|
756
|
-
|
|
757
|
-
**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).
|
|
758
|
-
|
|
759
|
-
A QA report with any failing, blocked, missing, or unverified acceptance item is not a pass.
|
|
760
|
-
|
|
761
|
-
**How Solo routes QA findings back to RD (mechanism, not metaphor):**
|
|
762
|
-
|
|
763
|
-
When `peaks-qa` returns `verdict=return-to-rd`, Solo does NOT manually rewrite RD artifacts. Instead it follows this exact sequence:
|
|
764
|
-
|
|
765
|
-
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).
|
|
766
|
-
2. Transition the RD artifact back from `qa-handoff` to a working state and record the QA verdict in the transition note:
|
|
767
|
-
```bash
|
|
768
|
-
peaks request transition <rid> --role rd --state spec-locked \
|
|
769
|
-
--reason "QA return-to-rd cycle <N>: <one-line summary of failing items; full findings in qa/test-reports/<rid>.md>" \
|
|
770
|
-
--project <repo> --json
|
|
771
|
-
```
|
|
772
|
-
`spec-locked` is the canonical "needs more RD work" state. The reason is mandatory in repair cycles so the artifact history shows the loop.
|
|
773
|
-
3. Re-launch `peaks-rd` work. Two paths, mode-driven:
|
|
774
|
-
- **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.
|
|
775
|
-
- **Assisted / strict / inline-fallback**: Solo executes the RD repair steps directly in the main loop, since there is no concurrent fan-out to coordinate.
|
|
776
|
-
In both paths, pass the QA findings path so the repair sees what failed.
|
|
777
|
-
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.
|
|
778
|
-
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.
|
|
779
|
-
6. Repeat steps 1-5 until QA returns `verdict=pass`, or the cap below fires.
|
|
780
|
-
**After each repair iteration** (after peaks-rd and peaks-qa both return), Solo MUST restore presence:
|
|
781
|
-
```bash
|
|
782
|
-
peaks skill presence:set peaks-solo --project <repo> --mode <mode> --gate repair-cycle-<N>
|
|
783
|
-
```
|
|
784
|
-
|
|
785
|
-
**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.
|
|
786
|
-
|
|
787
|
-
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.
|
|
788
152
|
|
|
789
153
|
## Default runbook
|
|
790
154
|
|
|
791
|
-
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.
|
|
792
156
|
|
|
793
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).
|
|
794
158
|
|
|
795
|
-
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.
|
|
796
160
|
|
|
797
161
|
## RD micro-cycle (TDD small-step rapid-test loop)
|
|
798
162
|
|
|
@@ -805,141 +169,78 @@ Repair loop details: see `## Mandatory RD QA repair loop` above for the full 5-s
|
|
|
805
169
|
|
|
806
170
|
## Peaks-Cli Project standards preflight
|
|
807
171
|
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
- `peaks standards init --project <path> --dry-run`
|
|
811
|
-
- `peaks standards update --project <path> --dry-run`
|
|
812
|
-
|
|
813
|
-
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.
|
|
814
|
-
|
|
815
|
-
**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.
|
|
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.
|
|
816
173
|
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
Do not hand-write standards file mutations inside the skill.
|
|
820
|
-
|
|
821
|
-
For project-analysis requests such as "分析项目" / "分析下这个项目", Step 0 still applies: the workspace is initialized and `peaks-solo` presence is set before any analysis output. These requests run the lightweight analysis branch (project scan + standards dry-run) rather than the full RD/QA pipeline, but they never skip workspace anchoring or exit the workflow. The handoff must include an explicit **Standards increment** section. Report the current `CLAUDE.md` and `.claude/rules/**` status from the dry-run output as incremental deltas, not just a generic preflight note:
|
|
822
|
-
|
|
823
|
-
- whether `CLAUDE.md` is missing, existing, planned, skipped, appended, or review-only;
|
|
824
|
-
- which `.claude/rules/**` files are planned, existing, skipped, appended, or review-only;
|
|
825
|
-
- whether writes were applied or intentionally left as dry-run because authorization or scope was absent;
|
|
826
|
-
- the exact next action if standards should be applied later.
|
|
827
|
-
|
|
828
|
-
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.
|
|
829
175
|
|
|
830
176
|
## Peaks-Cli Refactor mode
|
|
831
177
|
|
|
832
|
-
Read `references/refactor-mode.md` before handling refactor requests.
|
|
833
|
-
|
|
834
|
-
Default MVP path: `peaks-solo refactor`.
|
|
835
|
-
|
|
836
|
-
It must enforce the shared refactor red lines:
|
|
837
|
-
|
|
838
|
-
1. understand the project before changes;
|
|
839
|
-
2. require UT coverage >= 95%;
|
|
840
|
-
3. treat unknown coverage as failing;
|
|
841
|
-
4. split broad refactors into minimal functional slices;
|
|
842
|
-
5. require strict verifiable specs before each slice;
|
|
843
|
-
6. require 100% acceptance for each slice;
|
|
844
|
-
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).
|
|
845
179
|
|
|
846
180
|
## Peaks-Cli Quality-gate commands (CLI cheat sheet)
|
|
847
181
|
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
| Command | Purpose | When to run | Non-zero exit when |
|
|
851
|
-
|---|---|---|---|
|
|
852
|
-
| `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) |
|
|
853
|
-
| `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 |
|
|
854
|
-
| `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 |
|
|
855
|
-
| `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) |
|
|
856
|
-
| `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 |
|
|
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.
|
|
857
183
|
|
|
858
|
-
|
|
184
|
+
→ see `references/quality-gate-cheatsheet.md`.
|
|
859
185
|
|
|
860
186
|
## Peaks-Cli Completion handoff
|
|
861
187
|
|
|
862
|
-
After final validation, refresh project-local standards via `peaks standards init/update` (never hand-write).
|
|
863
|
-
|
|
864
|
-
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.
|
|
865
|
-
|
|
866
|
-
### 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).
|
|
867
189
|
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
Before ending, extract durable memories from this session:
|
|
871
|
-
```bash
|
|
872
|
-
peaks project memories:extract --session-id <session-id> --project <repo> --json
|
|
873
|
-
```
|
|
190
|
+
→ see `references/completion-handoff.md` for the full handoff + "no auto-exit" rule.
|
|
874
191
|
|
|
875
192
|
## Peaks-Cli External references and lifecycle
|
|
876
193
|
|
|
877
|
-
|
|
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.
|
|
878
195
|
|
|
879
|
-
|
|
196
|
+
→ see `references/external-references.md` for the full inventory + lifecycle rules.
|
|
880
197
|
|
|
881
|
-
|
|
882
|
-
|
|
883
|
-
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.
|
|
884
|
-
|
|
885
|
-
**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-Cli CLI for all side effects. Do not execute upstream installers, do not install upstream resources, do not persist sensitive examples — Peaks-Cli gates remain authoritative. External skills inform, they do not approve.
|
|
886
|
-
|
|
887
|
-
**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
|
|
888
199
|
|
|
889
|
-
|
|
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.
|
|
890
201
|
|
|
891
|
-
|
|
202
|
+
→ see `references/codegraph-orchestration.md` for the full contract.
|
|
892
203
|
|
|
893
204
|
## Sub-agent context governance (G7 + G7.7 + G8 + G9 — slice #010)
|
|
894
205
|
|
|
895
|
-
|
|
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).
|
|
896
207
|
|
|
897
|
-
|
|
208
|
+
→ see `references/context-governance.md` for the full protocol.
|
|
898
209
|
|
|
899
|
-
|
|
210
|
+
## References
|
|
900
211
|
|
|
901
|
-
|
|
902
|
-
- Sub-agent calls `peaks sub-agent dispatch --write-artifact <path>` (or via dispatch CLI flag). The CLI computes sha256 + size + writes `ArtifactMeta` to record.
|
|
903
|
-
- 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.
|
|
904
|
-
- Main LLM decides whether to `Read <path>` for full content (LLM tool call, NOT via peaks CLI).
|
|
905
|
-
|
|
906
|
-
Main LLM view format (G7.4.e):
|
|
907
|
-
```
|
|
908
|
-
[peaks-solo] batch 3/3 done in 47.3s
|
|
909
|
-
- 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"
|
|
910
|
-
- qa-business → .../artifacts/003-qa-business-001.md (8KB, sha256:def456) summary: "wrote 12 API test cases"
|
|
911
|
-
- qa-perf → .../artifacts/003-qa-perf-001.md (5KB, sha256:ghi789) summary: "p95 latency target ≤ 200ms"
|
|
912
|
-
```
|
|
913
|
-
|
|
914
|
-
### G7.7 — headroom-ai integration (opt-in compression)
|
|
915
|
-
|
|
916
|
-
If a sub-agent prompt is too large even after G7 metadata-only (e.g. 1MB artifact description, 5MB mid-prompt analysis), use `--use-headroom`:
|
|
917
|
-
- Default `false` (G7 remains default).
|
|
918
|
-
- Modes: `balanced` (default) | `aggressive` | `conservative`.
|
|
919
|
-
- Failure: `HEADROOM_UNAVAILABLE` warning + G7 metadata-only fallback (NOT blocking).
|
|
920
|
-
|
|
921
|
-
### G8 — cross sub-agent shared channel (dispatcher-mediated indirect signal)
|
|
922
|
-
|
|
923
|
-
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.
|
|
924
|
-
|
|
925
|
-
- Path: `.peaks/_sub_agents/<sessionId>/shared/<batchId>.json`.
|
|
926
|
-
- Two new CLI atoms (NO new top-level CLI): `peaks sub-agent share` + `peaks sub-agent shared-read`.
|
|
927
|
-
- 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>`.
|
|
928
|
-
|
|
929
|
-
### G9 — forced compression gate (CLI 兜底 + hook double-guard)
|
|
930
|
-
|
|
931
|
-
Threshold table (256K default context capacity):
|
|
932
|
-
|
|
933
|
-
| Threshold | Prompt size | Behavior |
|
|
934
|
-
|---|---|---|
|
|
935
|
-
| 50% (early warn) | ≥ 128KB | Soft warning, suggest `--use-headroom` |
|
|
936
|
-
| **75% (user red line)** | ≥ 192KB | Soft warn + `warnings: ["CONTEXT_NEAR_LIMIT"]` |
|
|
937
|
-
| **80% (hard reject)** | ≥ 204KB | Hard reject `code: "PROMPT_TOO_LARGE"`; `--force` allowed at CLI |
|
|
938
|
-
| 90% (emergency) | ≥ 230KB | Hard reject + `contextWarning: 'high'` |
|
|
939
|
-
|
|
940
|
-
Two layers:
|
|
941
|
-
- **CLI 兜底** — `peaks sub-agent dispatch` validates prompt size; `--force` allowed.
|
|
942
|
-
- **PreToolUse hook** — `peaks sub-agent-dispatch-guard` re-validates; **NO `--force`** at hook layer (RL-30 strict).
|
|
943
|
-
|
|
944
|
-
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.
|
|
945
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. |
|