peaks-cli 1.3.3 → 1.3.4

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.
Files changed (35) hide show
  1. package/dist/src/cli/commands/core-artifact-commands.js +6 -3
  2. package/dist/src/cli/commands/project-commands.js +8 -4
  3. package/dist/src/cli/commands/workflow-commands.js +2 -1
  4. package/dist/src/services/dashboard/project-dashboard-service.d.ts +23 -0
  5. package/dist/src/services/dashboard/project-dashboard-service.js +21 -0
  6. package/dist/src/services/ide/adapters/claude-code-adapter.js +27 -0
  7. package/dist/src/services/ide/adapters/trae-adapter.d.ts +19 -11
  8. package/dist/src/services/ide/adapters/trae-adapter.js +43 -15
  9. package/dist/src/services/ide/hook-protocol.d.ts +7 -4
  10. package/dist/src/services/ide/hook-protocol.js +7 -4
  11. package/dist/src/services/ide/ide-types.d.ts +60 -0
  12. package/dist/src/services/ide/resource-profile.d.ts +52 -0
  13. package/dist/src/services/ide/resource-profile.js +33 -0
  14. package/dist/src/services/memory/project-context-service.js +2 -1
  15. package/dist/src/services/memory/project-memory-service.js +4 -3
  16. package/dist/src/services/perf/perf-baseline-service.js +2 -1
  17. package/dist/src/services/session/getSessionDir.d.ts +1 -0
  18. package/dist/src/services/session/getSessionDir.js +27 -0
  19. package/dist/src/services/session/index.d.ts +1 -0
  20. package/dist/src/services/session/index.js +1 -0
  21. package/dist/src/services/standards/ide-aware-standards-service.d.ts +94 -0
  22. package/dist/src/services/standards/ide-aware-standards-service.js +89 -0
  23. package/dist/src/services/standards/project-standards-service.d.ts +1 -2
  24. package/dist/src/shared/version.d.ts +1 -1
  25. package/dist/src/shared/version.js +1 -1
  26. package/package.json +1 -1
  27. package/scripts/install-skills.mjs +112 -2
  28. package/skills/peaks-ide/SKILL.md +1 -1
  29. package/skills/peaks-ide/references/audit-log-helper.md +52 -0
  30. package/skills/peaks-qa/SKILL.md +104 -62
  31. package/skills/peaks-rd/SKILL.md +88 -58
  32. package/skills/peaks-solo/SKILL.md +52 -22
  33. package/skills/peaks-solo/references/browser-workflow.md +22 -20
  34. package/skills/peaks-solo/references/sub-agent-dispatch.md +44 -1
  35. package/skills/peaks-ui/SKILL.md +18 -9
@@ -3,6 +3,36 @@ name: peaks-qa
3
3
  description: QA and verification skill for Peaks. Use when a workflow needs unit-test coverage evidence, regression matrices, baseline reports, validation reports, acceptance checks, or refactor verification gates.
4
4
  ---
5
5
 
6
+ ## Two-axis naming convention
7
+
8
+ > **Read once at the top of this file; the rest of the skill is written against it.**
9
+
10
+ The `.peaks/` workspace is partitioned by **two orthogonal axes**. Every path in this SKILL.md uses one of them; mixing them is the original `.peaks/<sid>/` / `.peaks/_runtime/<sid>/` bug class this slice corrects.
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`.
35
+
6
36
  # Peaks-Cli QA
7
37
 
8
38
  Peaks-Cli QA proves that planned changes are protected and accepted.
@@ -11,29 +41,31 @@ Peaks-Cli QA proves that planned changes are protected and accepted.
11
41
 
12
42
  These two contracts are non-negotiable. The previous prose-only phrasing let the LLM skip the browser gate entirely when an auth wall appeared, and let screenshots land in the project root because the LLM forgot to pass `filename`. Both fail modes are blocking violations; the rules below are what a reviewer should hold the skill to.
13
43
 
14
- ### Contract 1 — Screenshot path is mandatory and must land under .peaks/<sid>/qa/screenshots/
44
+ ### Contract 1 — Screenshot path is mandatory and must land under .peaks/_runtime/<sessionId>/qa/screenshots/
15
45
 
16
- Every `mcp__playwright__browser_take_screenshot` call **MUST** pass `filename` whose absolute path is **inside** `.peaks/<session-id>/qa/screenshots/`. Concrete form:
46
+ Every Playwright screenshot tool call (via `peaks mcp call --capability playwright-mcp.browser-validation --tool browser_take_screenshot --args-json '<args>' --json`) **MUST** pass `filename` (in the args object) whose absolute path is **inside** `.peaks/_runtime/<sessionId>/qa/screenshots/`. Concrete form:
17
47
 
18
48
  ```bash
19
- mcp__playwright__browser_take_screenshot \
20
- filename=".peaks/<sid>/qa/screenshots/<state-or-step>.png" \
21
- fullPage=true
49
+ peaks mcp call \
50
+ --capability playwright-mcp.browser-validation \
51
+ --tool browser_take_screenshot \
52
+ --args-json '{"filename":".peaks/_runtime/<session-id>/qa/screenshots/<state-or-step>.png","fullPage":true}' \
53
+ --json
22
54
  ```
23
55
 
24
- The default behaviour of Playwright MCP when `filename` is omitted or points outside that directory is to write a screenshot to the current working directory, which leaves `.png` files scattered at the project root. **This is a workflow violation.** If a screenshot does land outside `.peaks/<sid>/qa/screenshots/` for any reason (e.g. an upstream tool wrote there), QA MUST move it into that directory before declaring the test report complete; do not commit project-root `.png` files. Sanitise before retention: no login URLs, cookies, headers, tokens, storage state, browser traces, or screenshots/logs containing PII or SSO/MFA material.
56
+ The default behaviour of Playwright MCP when `filename` is omitted or points outside that directory is to write a screenshot to the current working directory, which leaves `.png` files scattered at the project root. **This is a workflow violation.** If a screenshot does land outside `.peaks/_runtime/<session-id>/qa/screenshots/` for any reason (e.g. an upstream tool wrote there), QA MUST move it into that directory before declaring the test report complete; do not commit project-root `.png` files. Sanitise before retention: no login URLs, cookies, headers, tokens, storage state, browser traces, or screenshots/logs containing PII or SSO/MFA material.
25
57
 
26
58
  This rule is enforced by a Peaks-Cli preflight check inside this skill:
27
59
 
28
60
  ```bash
29
61
  # After every browser_take_screenshot batch and before declaring the test report complete:
30
- ls .peaks/<sid>/qa/screenshots/*.png 2>&1
62
+ ls .peaks/_runtime/<session-id>/qa/screenshots/*.png 2>&1
31
63
  # Expected: at least one .png file under the screenshots directory.
32
64
  # "No such file" → BLOCKED. Either the screenshot was never taken, or
33
65
  # it landed in the project root (move it before continuing).
34
66
  find . -maxdepth 1 -name '*.png' 2>&1
35
67
  # Expected: empty. Any .png at the project root is a leak — move it
36
- # to .peaks/<sid>/qa/screenshots/ before completing this skill.
68
+ # to .peaks/_runtime/<session-id>/qa/screenshots/ before completing this skill.
37
69
  ```
38
70
 
39
71
  ### Contract 2 — Login / CAPTCHA / SSO / MFA wall is a hard block, not a skip
@@ -68,23 +100,23 @@ When peaks-qa is the **main loop** (i.e. it is the active skill and is about to
68
100
 
69
101
  ```
70
102
  peaks sub-agent dispatch qa-business \
71
- --prompt "<qa-business contract, plus runtime args project=<repo>, session-id=<sid>, request-id=<rid>>" \
72
- --request-id <rid> --session-id <sid> --project <repo> --json
103
+ --prompt "<qa-business contract, plus runtime args project=<repo>, session-id=<session-id>, request-id=<rid>>" \
104
+ --request-id <rid> --session-id <session-id> --project <repo> --json
73
105
 
74
106
  peaks sub-agent dispatch qa-perf \
75
107
  --prompt "<qa-perf contract, plus runtime args>" \
76
- --request-id <rid> --session-id <sid> --project <repo> --json
108
+ --request-id <rid> --session-id <session-id> --project <repo> --json
77
109
 
78
110
  peaks sub-agent dispatch qa-security \
79
111
  --prompt "<qa-security contract, plus runtime args>" \
80
- --request-id <rid> --session-id <sid> --project <repo> --json
112
+ --request-id <rid> --session-id <session-id> --project <repo> --json
81
113
  ```
82
114
 
83
115
  All three are issued in a single message; the LLM fires all 3 returned toolCalls in parallel; the IDE runs them concurrently; peaks-qa then collects the three envelopes and merges their outputs into:
84
116
 
85
- - `.peaks/<sid>/qa/test-reports/<rid>.md` (business findings)
86
- - `.peaks/<sid>/qa/performance-findings.md` (perf findings)
87
- - `.peaks/<sid>/qa/security-findings.md` (security findings)
117
+ - `.peaks/_runtime/<sessionId>/qa/test-reports/<rid>.md` (business findings)
118
+ - `.peaks/_runtime/<sessionId>/qa/performance-findings.md` (perf findings)
119
+ - `.peaks/_runtime/<sessionId>/qa/security-findings.md` (security findings)
88
120
 
89
121
  ## 业务测试细分 (optional)
90
122
 
@@ -93,7 +125,7 @@ If the PRD or project warrants it, subdivide `qa-business` further into roles li
93
125
  For the full contract (heartbeat instructions for each sub-agent, batch-id discipline, 30s cadence, 100-truncation, 5min stale) see `skills/peaks-qa/references/qa-fanout-contract.md` and `skills/peaks-solo/references/sub-agent-dispatch.md` §G6.
94
126
 
95
127
  - **Session id** — use the parent's sid (read `.peaks/_runtime/session.json` or pass `--session-id <parent-sid>` to any session-creating CLI). Do NOT spawn your own session. The new `peaks session info --active` reads the canonical binding for you.
96
- - **Skill presence (MANDATORY first action)** — do NOT call `peaks skill presence:set peaks-qa`. The sub-agent must not overwrite `.peaks/.active-skill.json`; the main Solo loop owns that file. If you need to mark your own state, write a marker file at `.peaks/<session-id>/system/sub-agent-qa.json` and only that.
128
+ - **Skill presence (MANDATORY first action)** — do NOT call `peaks skill presence:set peaks-qa`. The sub-agent must not overwrite `.peaks/.active-skill.json`; the main Solo loop owns that file. If you need to mark your own state, write a marker file at `.peaks/_runtime/<sessionId>/system/sub-agent-qa.json` and only that.
97
129
  - **Workspace initialization** — Solo has already run `peaks workspace init` before fan-out. Do not re-run it.
98
130
  - **Mode selection** — Solo has already chosen the mode.
99
131
  - **Statusline install** — already done by Solo at session startup.
@@ -103,7 +135,7 @@ What the sub-agent **MUST** still do:
103
135
  0. **Do NOT call `peaks request init`** — Solo has already initialised the request artefact slot in the main loop before fan-out. The sub-agent reads it via `peaks request show <rid> --role qa --project <repo> --json` if it needs to.
104
136
  2. `peaks request show <rid> --role prd --project <repo> --json` (and `--role rd`, `--role ui` if UI is in the swarm plan).
105
137
  3. Standards preflight (dry-run only).
106
- 4. Write `.peaks/<session-id>/qa/test-cases/<rid>.md` with test cases that link to PRD acceptance items.
138
+ 4. Write `.peaks/_runtime/<sessionId>/qa/test-cases/<rid>.md` with test cases that link to PRD acceptance items.
107
139
  5. Return only a compact JSON envelope:
108
140
 
109
141
  ```json
@@ -111,7 +143,7 @@ What the sub-agent **MUST** still do:
111
143
  "role": "qa-test-cases",
112
144
  "rid": "<rid>",
113
145
  "status": "ok" | "blocked" | "skipped",
114
- "artefacts": [".peaks/<sid>/qa/test-cases/<rid>.md"],
146
+ "artefacts": [".peaks/_runtime/<sessionId>/qa/test-cases/<rid>.md"],
115
147
  "warnings": [],
116
148
  "blockedReason": null
117
149
  }
@@ -167,9 +199,9 @@ Every QA invocation — feature, bug, refactor, clarification — must write **t
167
199
 
168
200
  | # | File | Path | Reader | Content |
169
201
  |---|------|------|--------|---------|
170
- | 1 | Test cases | `.peaks/<session-id>/qa/test-cases/<request-id>.md` | RD (before impl), QA | Generated test scenarios with status |
171
- | 2 | Test report | `.peaks/<session-id>/qa/test-reports/<request-id>.md` | QA, SC, Solo | Summary, coverage%, security, perf, risks |
172
- | 3 | Request artifact | `.peaks/<session-id>/qa/requests/<request-id>.md` | Solo, RD↔QA loop | Verdict, boundary check, links to #1 and #2 |
202
+ | 1 | Test cases | `.peaks/_runtime/<sessionId>/qa/test-cases/<request-id>.md` | RD (before impl), QA | Generated test scenarios with status |
203
+ | 2 | Test report | `.peaks/_runtime/<sessionId>/qa/test-reports/<request-id>.md` | QA, SC, Solo | Summary, coverage%, security, perf, risks |
204
+ | 3 | Request artifact | `.peaks/_runtime/<sessionId>/qa/requests/<request-id>.md` | Solo, RD↔QA loop | Verdict, boundary check, links to #1 and #2 |
173
205
 
174
206
  Concrete template and rules: `references/artifact-per-request.md`.
175
207
 
@@ -197,12 +229,12 @@ peaks codegraph affected --project <repo> <changed-files...> --json # regressi
197
229
  peaks openspec validate <change-id> --project <repo> --json
198
230
  peaks openspec validate <change-id> --project <repo> --prefer-external --json # optional
199
231
 
200
- # 4. generate test cases — MANDATORY, write to .peaks/<session-id>/qa/test-cases/<request-id>.md
232
+ # 4. generate test cases — MANDATORY, write to .peaks/_runtime/<sessionId>/qa/test-cases/<request-id>.md
201
233
  # categories: unit, integration, UI regression (frontend only)
202
234
  #
203
235
  # Optimization (slice 004): peaks-rd's parallel fan-out now includes a 4th
204
236
  # sub-agent (`qa-test-cases-writer`) that pre-drafts this file at the
205
- # end of RD implementation. If `.peaks/<sid>/qa/test-cases/<rid>.md`
237
+ # end of RD implementation. If `.peaks/_runtime/<sessionId>/qa/test-cases/<rid>.md`
206
238
  # already exists when QA's main loop reaches this step, **QA does NOT
207
239
  # re-draft it** — it just verifies the file is present and the
208
240
  # per-criterion `ts` snippets are syntactically valid, then proceeds
@@ -213,8 +245,8 @@ peaks openspec validate <change-id> --project <repo> --prefer-external --json
213
245
 
214
246
  # 5. EXECUTE tests against the actual implementation — Peaks-Cli Gate A2
215
247
  # Run the project test command. Record output. Tests on paper are worthless.
216
- # Peaks-Cli Gate A3: Run security review → .peaks/<id>/qa/security-findings.md
217
- # Peaks-Cli Gate A4: Run performance check → .peaks/<id>/qa/performance-findings.md
248
+ # Peaks-Cli Gate A3: Run security review → .peaks/<changeId>/qa/security-findings.md
249
+ # Peaks-Cli Gate A4: Run performance check → .peaks/<changeId>/qa/performance-findings.md
218
250
  # CRITICAL: Peaks-Cli Gate A3 and Peaks-Cli Gate A4 are NON-NEGOTIABLE. You MUST run actual security
219
251
  # and performance checks — not just write a checklist item. These gates exist
220
252
  # because code review alone does not catch: hardcoded secrets, XSS vectors,
@@ -222,7 +254,7 @@ peaks openspec validate <change-id> --project <repo> --prefer-external --json
222
254
  # If you skip A3 or A4, Peaks-Cli Gate C will block the verdict.
223
255
  #
224
256
  # Before running A4, read the RD's perf-baseline at
225
- # .peaks/<id>/rd/perf-baseline.md (if present) and use the
257
+ # .peaks/<changeId>/rd/perf-baseline.md (if present) and use the
226
258
  # captured thresholds as the comparison baseline. The QA stage
227
259
  # is still responsible for running the actual measurement
228
260
  # (lighthouse / k6 / autocannon / project-local bench) and
@@ -234,7 +266,7 @@ peaks openspec validate <change-id> --project <repo> --prefer-external --json
234
266
  # surface that absence in the QA test-report under a
235
267
  # `## Performance baseline` section.
236
268
 
237
- # 6. write test-report — MANDATORY, write to .peaks/<session-id>/qa/test-reports/<request-id>.md
269
+ # 6. write test-report — MANDATORY, write to .peaks/_runtime/<sessionId>/qa/test-reports/<request-id>.md
238
270
  # MUST contain actual execution results (pass/fail counts, coverage %, findings).
239
271
  # A template with placeholder text does not pass Peaks-Cli Gate B.
240
272
 
@@ -257,19 +289,23 @@ peaks mcp apply --capability playwright-mcp.browser-validation --yes --json
257
289
  # and does NOT satisfy Peaks-Cli Gate D. Treating prod build as a fallback is a workflow violation.
258
290
  # 4. After browser validation completes, KILL the dev server. Do not leave it running.
259
291
  # Playwright MCP MUST simulate real user operations — not just take static screenshots.
260
- # The minimum interaction sequence for every frontend page/flow:
261
- # mcp__playwright__browser_navigate → URL (after allow-list), launches headed browser
262
- # mcp__playwright__browser_snapshot → accessibility tree per regression seed
263
- # mcp__playwright__browser_click → click buttons, tabs, links, modals
264
- # mcp__playwright__browser_type → type into form fields, search inputs
265
- # mcp__playwright__browser_select_option → select dropdown values
266
- # mcp__playwright__browser_fill_form → fill complete forms as a user would
267
- # mcp__playwright__browser_take_screenshot → capture each state AFTER interaction
268
- # mcp__playwright__browser_console_messages + browser_network_requests error feedback loop
269
- # mcp__playwright__browser_wait_for → wait for async data to render
270
- # mcp__playwright__browser_close → end the session cleanly
292
+ # The minimum interaction sequence for every frontend page/flow uses the peaks mcp
293
+ # plan/apply/call pattern (skill body NEVER bakes in the bare MCP tool prefix;
294
+ # the prefix is owned by the LLM runtime). The four steps:
295
+ # 1. Detect install: peaks mcp list --json | grep playwright
296
+ # 2. Plan: peaks mcp plan --capability playwright-mcp.browser-validation --json
297
+ # (read envCheck.missing; if non-empty, refuse to apply and ask the user to set the env vars)
298
+ # 3. Apply: peaks mcp apply --capability playwright-mcp.browser-validation --yes --json
299
+ # 4. Call tools: peaks mcp call --capability playwright-mcp.browser-validation \
300
+ # --tool <toolName> --args-json '<argsObject>' --json
301
+ # Tool names (resolved by the LLM from the registered server, NOT hardcoded here):
302
+ # browser_navigate / browser_snapshot / browser_click / browser_type /
303
+ # browser_select_option / browser_fill_form / browser_take_screenshot /
304
+ # browser_console_messages / browser_network_requests / browser_wait_for / browser_close.
271
305
  # Static screenshots without user-interaction simulation do NOT pass this gate.
272
306
  # Block QA pass if Playwright MCP is unavailable.
307
+ # For sub-agents dispatched via `peaks sub-agent dispatch` (where the LLM cannot
308
+ # directly call MCP tools via the bare prefix), use `peaks mcp call` for every MCP operation.
273
309
  #
274
310
  # CLEANUP: After browser validation completes (all screenshots saved, console/network
275
311
  # evidence captured), QA MUST kill every process it started during verification.
@@ -314,8 +350,8 @@ You cannot declare a phase complete from memory. Each gate below is a `ls` or `g
314
350
 
315
351
  **Peaks-Cli Gate A — After test-case generation:**
316
352
  ```bash
317
- ls .peaks/<id>/qa/test-cases/<rid>.md
318
- # Expected output: .peaks/<id>/qa/test-cases/<rid>.md
353
+ ls .peaks/<changeId>/qa/test-cases/<rid>.md
354
+ # Expected output: .peaks/<changeId>/qa/test-cases/<rid>.md
319
355
  # "No such file" → STOP, generate test cases first. Do not proceed to validation.
320
356
  ```
321
357
 
@@ -332,8 +368,8 @@ npx vitest run --reporter=verbose 2>&1 | tail -30
332
368
  **Peaks-Cli Gate A3 — Security test executed (NOT just a checklist item):**
333
369
  ```bash
334
370
  # Run security review against the changed surface. Record findings.
335
- ls .peaks/<id>/qa/security-findings.md 2>&1
336
- # Expected: .peaks/<id>/qa/security-findings.md
371
+ ls .peaks/<changeId>/qa/security-findings.md 2>&1
372
+ # Expected: .peaks/<changeId>/qa/security-findings.md
337
373
  # "No such file" → BLOCKED. Run security review against changed files,
338
374
  # record every finding with severity, then re-check.
339
375
  ```
@@ -341,30 +377,30 @@ ls .peaks/<id>/qa/security-findings.md 2>&1
341
377
  **Peaks-Cli Gate A4 — Performance test executed:**
342
378
  ```bash
343
379
  # Run available performance check against the changed surface. Record findings.
344
- ls .peaks/<id>/qa/performance-findings.md 2>&1
345
- # Expected: .peaks/<id>/qa/performance-findings.md
380
+ ls .peaks/<changeId>/qa/performance-findings.md 2>&1
381
+ # Expected: .peaks/<changeId>/qa/performance-findings.md
346
382
  # "No such file" → BLOCKED. Run performance check (build-size, Lighthouse,
347
383
  # bundle analysis, or project equivalent), record baseline vs. after, then re-check.
348
384
  ```
349
385
 
350
386
  **Peaks-Cli Gate B — After test-report write (MUST contain execution results, not just planned cases):**
351
387
  ```bash
352
- ls .peaks/<id>/qa/test-reports/<rid>.md
353
- # Expected output: .peaks/<id>/qa/test-reports/<rid>.md
388
+ ls .peaks/<changeId>/qa/test-reports/<rid>.md
389
+ # Expected output: .peaks/<changeId>/qa/test-reports/<rid>.md
354
390
  # "No such file" → STOP, write the test report first. Do not issue a verdict.
355
391
  # Additionally verify the report is not a placeholder:
356
- grep -c "pass\|fail\|blocked" .peaks/<id>/qa/test-reports/<rid>.md
392
+ grep -c "pass\|fail\|blocked" .peaks/<changeId>/qa/test-reports/<rid>.md
357
393
  # Expected: non-zero count (report contains actual pass/fail/blocked results)
358
394
  # Zero → the report is empty/template-only. Tests were not executed.
359
395
  ```
360
396
 
361
397
  **Peaks-Cli Gate C — Before issuing verdict:**
362
398
  ```bash
363
- ls .peaks/<id>/qa/test-cases/<rid>.md \
364
- .peaks/<id>/qa/test-reports/<rid>.md \
365
- .peaks/<id>/qa/security-findings.md \
366
- .peaks/<id>/qa/performance-findings.md \
367
- .peaks/<id>/qa/requests/<rid>.md
399
+ ls .peaks/<changeId>/qa/test-cases/<rid>.md \
400
+ .peaks/<changeId>/qa/test-reports/<rid>.md \
401
+ .peaks/<changeId>/qa/security-findings.md \
402
+ .peaks/<changeId>/qa/performance-findings.md \
403
+ .peaks/<changeId>/qa/requests/<rid>.md
368
404
  # All five must exist. Missing any → QA incomplete, verdict blocked.
369
405
  # NOTE: security-findings.md and performance-findings.md are NOT optional.
370
406
  # If you can't run a full security scan, run at minimum: grep for secrets,
@@ -375,7 +411,7 @@ ls .peaks/<id>/qa/test-cases/<rid>.md \
375
411
 
376
412
  **Peaks-Cli Gate E — Acceptance coverage (every PRD acceptance item has a linked test case):**
377
413
  ```bash
378
- peaks scan acceptance-coverage --rid <rid> --project <repo> --session-id <sid> --json
414
+ peaks scan acceptance-coverage --rid <rid> --project <repo> --session-id <session-id> --json
379
415
  # Expected: ok=true. exit 0.
380
416
  # uncovered[] non-empty → BLOCKED. List of acceptance items without test cases is in the output.
381
417
  # Add `- **Acceptance:** A<N>` lines to the matching test cases in qa/test-cases/<rid>.md, then re-run.
@@ -387,7 +423,7 @@ peaks scan acceptance-coverage --rid <rid> --project <repo> --session-id <sid> -
387
423
 
388
424
  **Peaks-Cli Gate F — QA artifact body has no unfilled placeholders:**
389
425
  ```bash
390
- peaks request lint <rid> --role qa --project <repo> --session-id <sid> --json
426
+ peaks request lint <rid> --role qa --project <repo> --session-id <session-id> --json
391
427
  # Expected: ok=true. exit 0.
392
428
  # ok=false → BLOCKED. Lint output lists every <placeholder>, "- ..." stub, and TBD marker.
393
429
  # Fill them in before issuing the verdict.
@@ -397,7 +433,7 @@ peaks request lint <rid> --role qa --project <repo> --session-id <sid> --json
397
433
  ```bash
398
434
  # Verify browser screenshots exist. Screenshots are the only acceptable evidence
399
435
  # that Playwright MCP actually launched and interacted with the running app.
400
- ls .peaks/<id>/qa/screenshots/*.png 2>&1
436
+ ls .peaks/<changeId>/qa/screenshots/*.png 2>&1
401
437
  # Expected: one or more .png files
402
438
  # "No such file" → BLOCKED. Playwright MCP was not used or screenshots not saved.
403
439
  # Screenshots, logs, manual steps, or other tools must NOT substitute for this gate.
@@ -409,7 +445,7 @@ ls .peaks/<id>/qa/screenshots/*.png 2>&1
409
445
  ```
410
446
  ```bash
411
447
  # Verify console and network checks were actually performed
412
- grep -c "browser_console_messages\|browser_network_requests" .peaks/<id>/qa/test-reports/<rid>.md
448
+ grep -c "browser_console_messages\|browser_network_requests" .peaks/<changeId>/qa/test-reports/<rid>.md
413
449
  # Expected: non-zero count (means console/network were checked)
414
450
  # Zero → BLOCKED. Browser error feedback loop was not executed.
415
451
  ```
@@ -447,7 +483,7 @@ Before QA passes or returns work to RD, it must independently recheck the implem
447
483
 
448
484
  ## Mandatory test-case generation
449
485
 
450
- QA must generate test cases, not merely inspect existing ones. Every QA invocation that validates code changes must produce a test-case artifact at `.peaks/<session-id>/qa/test-cases/<request-id>.md`.
486
+ QA must generate test cases, not merely inspect existing ones. Every QA invocation that validates code changes must produce a test-case artifact at `.peaks/_runtime/<sessionId>/qa/test-cases/<request-id>.md`.
451
487
 
452
488
  **Minimum test-case categories:**
453
489
 
@@ -475,7 +511,7 @@ QA must generate test cases, not merely inspect existing ones. Every QA invocati
475
511
 
476
512
  ## Mandatory test-report output
477
513
 
478
- Every QA invocation must produce a test-report artifact at `.peaks/<session-id>/qa/test-reports/<request-id>.md`. This is separate from both the test-case file and the request artifact — do not merge.
514
+ Every QA invocation must produce a test-report artifact at `.peaks/_runtime/<sessionId>/qa/test-reports/<request-id>.md`. This is separate from both the test-case file and the request artifact — do not merge.
479
515
 
480
516
  **Minimum test-report sections:**
481
517
 
@@ -496,7 +532,13 @@ QA cannot pass a change until the report contains evidence for every applicable
496
532
  1. **Test-report** — enforced by Peaks-Cli Gate B.
497
533
  2. **Unit tests** — run the project test command or a focused test command that covers new/changed code. For legacy projects below the target coverage, require coverage for the new or changed code rather than failing on pre-existing uncovered code.
498
534
  3. **API validation** — when the change touches API contracts, data loading, request handling, auth, or integrations, exercise the relevant API path and record request/response evidence or a justified local substitute.
499
- 4. **Frontend browser validation** — when the repository has a frontend or the change affects UI, launch the app and use Playwright MCP for real browser end-to-end validation. This means **simulating real user operations**: clicking buttons, filling forms, selecting dropdowns, navigating between pages, waiting for async data to render, and verifying each resulting state. Static screenshots without interaction are insufficient. Confirm Playwright MCP is installed via `peaks mcp list --json`; install through `peaks mcp plan/apply --capability playwright-mcp.browser-validation --yes` if missing. Use `mcp__playwright__browser_navigate` (launches headed browser), `mcp__playwright__browser_click` (simulate clicks on tabs/buttons/links), `mcp__playwright__browser_type` (type into inputs), `mcp__playwright__browser_select_option` (select dropdowns), `mcp__playwright__browser_fill_form` (fill complete forms), `mcp__playwright__browser_wait_for` (wait for async rendering), and `mcp__playwright__browser_take_screenshot` (capture state after each interaction). If login, CAPTCHA, SSO, or MFA appears, the visible browser is already open; wait for the user to complete login and explicitly confirm completion before continuing. Capture sanitized interaction sequences, sanitized screenshots per state, sanitized console (`browser_console_messages`) and network (`browser_network_requests`) failures. Close with `mcp__playwright__browser_close` when done. (Chrome DevTools MCP is an optional secondary surface for CDP inspection of an already-running Chrome on `:9222`; it does NOT launch a browser and cannot simulate user interaction.)
535
+ 4. **Frontend browser validation** — when the repository has a frontend or the change affects UI, launch the app and use Playwright MCP for real browser end-to-end validation. This means **simulating real user operations**: clicking buttons, filling forms, selecting dropdowns, navigating between pages, waiting for async data to render, and verifying each resulting state. Static screenshots without interaction are insufficient. Confirm Playwright MCP is installed via `peaks mcp list --json`; install through `peaks mcp plan/apply --capability playwright-mcp.browser-validation --yes` if missing. Route every browser interaction through the canonical `peaks mcp call` envelope:
536
+
537
+ ```
538
+ peaks mcp call --capability playwright-mcp.browser-validation --tool <toolName> --args-json '<argsObject>' --json
539
+ ```
540
+
541
+ The Playwright tool names that drive validation are: `browser_navigate` (launches headed browser), `browser_click` (simulate clicks on tabs/buttons/links), `browser_type` (type into inputs), `browser_select_option` (select dropdowns), `browser_fill_form` (fill complete forms), `browser_wait_for` (wait for async rendering), `browser_take_screenshot` (capture state after each interaction), `browser_close` (close the browser when done), `browser_console_messages` (read console failures), and `browser_network_requests` (read network failures). The bare server-and-tool MCP prefix is owned by the LLM runtime, not by the skill body — never bake the prefix into this SKILL.md or any artifact QA emits. If login, CAPTCHA, SSO, or MFA appears, the visible browser is already open; wait for the user to complete login and explicitly confirm completion before continuing. Capture sanitized interaction sequences, sanitized screenshots per state, sanitized console (`browser_console_messages`) and network (`browser_network_requests`) failures. (Chrome DevTools MCP is an optional secondary surface for CDP inspection of an already-running Chrome on `:9222`; it does NOT launch a browser and cannot simulate user interaction.)
500
542
  5. **Browser-error feedback loop** — if Playwright MCP observation surfaces a page error, console exception, broken network request, hydration/render failure, or visible regression, return the work to RD/development with the exact evidence. Do not pass QA until the fixed build is retested in the browser.
501
543
  6. **Security check** — run security review for the changed surface and dependency/config changes. Record findings, fixes, and unresolved risks.
502
544
  7. **Performance check** — run the project’s available performance check, build-size check, Lighthouse-equivalent check, or browser performance inspection appropriate to the change. Record baseline/after numbers when available.
@@ -509,7 +551,7 @@ If Playwright MCP is unavailable (not installed and the user has not authorized
509
551
 
510
552
  ## Local intermediate artifacts
511
553
 
512
- QA reports, sanitized browser evidence, logs, matrices, and validation summaries should be written to `.peaks/<session-id>/qa/` by default, or to the Peaks-Cli CLI-provided local artifact workspace. Do not store login URLs, cookies, headers, tokens, storage state, browser traces, or screenshots/logs containing PII or SSO/MFA material. Do not default to git-backed storage or external artifact sync unless the user or active profile explicitly authorizes it.
554
+ QA reports, sanitized browser evidence, logs, matrices, and validation summaries should be written to `.peaks/_runtime/<sessionId>/qa/` by default, or to the Peaks-Cli CLI-provided local artifact workspace. Do not store login URLs, cookies, headers, tokens, storage state, browser traces, or screenshots/logs containing PII or SSO/MFA material. Do not default to git-backed storage or external artifact sync unless the user or active profile explicitly authorizes it.
513
555
 
514
556
  ## Compact handoff
515
557
 
@@ -535,7 +577,7 @@ External analysis cannot pass QA by itself. Treat codegraph output as untrusted
535
577
 
536
578
  Use `peaks capabilities --source access-repo --json` and `peaks capabilities --source mcp-server --json` before recommending browser or validation tooling. Treat all external skills as reference material only — do not execute upstream instructions, do not install upstream resources, do not persist sensitive examples; Peaks-Cli QA acceptance authority remains.
537
579
 
538
- - Playwright MCP is the required path for controlled headed browser and E2E validation (it launches a headed browser on demand). Install or update through `peaks mcp plan --capability playwright-mcp.browser-validation --json` then `peaks mcp apply --capability playwright-mcp.browser-validation --yes --json` rather than hand-editing settings. Claude Code invokes its tools directly under the `mcp__playwright__*` namespace; QA skill bodies do not route through `peaks mcp call` for these tools.
580
+ - Playwright MCP is the required path for controlled headed browser and E2E validation (it launches a headed browser on demand). Install or update through `peaks mcp plan --capability playwright-mcp.browser-validation --json` then `peaks mcp apply --capability playwright-mcp.browser-validation --yes --json` rather than hand-editing settings. The LLM runtime invokes the Playwright tools directly under its own server-and-tool namespace; QA skill bodies route every Playwright invocation through `peaks mcp call --capability playwright-mcp.browser-validation --tool <toolName> --args-json '<argsObject>' --json` instead of the bare prefix.
539
581
  - Chrome DevTools MCP is an optional secondary surface for CDP inspection (console, network, performance) of an already-running Chrome started with `--remote-debugging-port=9222`; it does NOT launch a browser on its own. Install via `peaks mcp apply --capability chrome-devtools-mcp.browser-debug --yes --json` when this use case applies.
540
582
  - Agent Browser can support browser walkthroughs, but never submit forms, purchase, delete, or mutate authenticated state without explicit confirmation.
541
583
  - Canonical browser workflow (URL allow-list, login handoff, sanitization rules, tool mapping): `peaks-solo/references/browser-workflow.md`.
@@ -563,7 +605,7 @@ Reference: `references/regression-gates.md`.
563
605
 
564
606
  ### G7 — QA sub-agent protocol
565
607
 
566
- 1. Write test cases / perf baseline / security review to `.peaks/_sub_agents/<sid>/artifacts/<rid>-<role>-001.md` (path convention mandatory).
608
+ 1. Write test cases / perf baseline / security review to `.peaks/_sub_agents/<sessionId>/artifacts/<rid>-<role>-001.md` (path convention mandatory).
567
609
  2. Call `peaks sub-agent dispatch --write-artifact <path>` to register ArtifactMeta.
568
610
  3. Main LLM sees metadata-only view (~200 chars/QA sub-agent).
569
611