peaks-loop 4.1.18 → 4.1.19
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/.claude-plugin/marketplace.json +2 -2
- package/CHANGELOG.md +126 -0
- package/README-en.md +6 -0
- package/README.md +5 -0
- package/contracts/test-style-contract.md +14 -5
- package/dist/cli/commands/audit-red-lines-runners.js +6 -1
- package/dist/cli/commands/best-practice-scan-collision.d.ts +42 -0
- package/dist/cli/commands/best-practice-scan-collision.js +115 -0
- package/dist/cli/commands/best-practice-scan-command.d.ts +5 -0
- package/dist/cli/commands/best-practice-scan-command.js +9 -18
- package/dist/cli/commands/best-practice-scan-helpers.d.ts +12 -6
- package/dist/cli/commands/best-practice-scan-helpers.js +37 -17
- package/dist/cli/commands/code-auto-compact-command.js +26 -18
- package/dist/cli/commands/core/skill-generated-config-notice.d.ts +5 -0
- package/dist/cli/commands/core/skill-generated-config-notice.js +42 -8
- package/dist/cli/commands/core/skill-presence-commands.js +42 -74
- package/dist/cli/commands/core/skill-presence-set-command.d.ts +11 -0
- package/dist/cli/commands/core/skill-presence-set-command.js +175 -0
- package/dist/cli/commands/core/standards-init-command.js +44 -8
- package/dist/cli/commands/core/standards-migrate-command.js +5 -4
- package/dist/cli/commands/dispatch-dag-runners.d.ts +1 -0
- package/dist/cli/commands/dispatch-dag-runners.js +11 -1
- package/dist/cli/commands/dispatch-detached-branch.js +19 -1
- package/dist/cli/commands/mut-commands-helpers.d.ts +72 -5
- package/dist/cli/commands/mut-commands-helpers.js +197 -4
- package/dist/cli/commands/mut-commands.d.ts +9 -1
- package/dist/cli/commands/mut-commands.js +82 -154
- package/dist/cli/commands/preferences-commands.js +27 -2
- package/dist/cli/commands/scan-scope-helpers.js +2 -2
- package/dist/services/24h-mode/auto-engage.d.ts +11 -3
- package/dist/services/24h-mode/auto-engage.js +14 -6
- package/dist/services/artifacts/artifact-templates.js +10 -0
- package/dist/services/artifacts/backcompat-acceptance.d.ts +8 -1
- package/dist/services/artifacts/backcompat-acceptance.js +8 -7
- package/dist/services/artifacts/rd-transition-gates.d.ts +32 -5
- package/dist/services/artifacts/rd-transition-gates.js +96 -19
- package/dist/services/artifacts/request-artifact-service.js +6 -6
- package/dist/services/audit/enforcers/lint-output-style.js +14 -2
- package/dist/services/audit/enforcers/root-scratch-artifacts.d.ts +46 -0
- package/dist/services/audit/enforcers/root-scratch-artifacts.js +97 -0
- package/dist/services/audit/static-service.js +4 -4
- package/dist/services/code/auto-compact-history.d.ts +6 -1
- package/dist/services/code/auto-compact-history.js +6 -1
- package/dist/services/code/auto-compact-modes.d.ts +60 -14
- package/dist/services/code/auto-compact-modes.js +75 -20
- package/dist/services/code/auto-compact-profile.d.ts +23 -0
- package/dist/services/code/auto-compact-profile.js +51 -0
- package/dist/services/compact-history/compact-history-service.d.ts +6 -1
- package/dist/services/compact-history/compact-history-service.js +5 -1
- package/dist/services/context/auto-compact-types.d.ts +7 -5
- package/dist/services/doctor/doctor-service/checks/l3-runtime-root-census.d.ts +37 -0
- package/dist/services/doctor/doctor-service/checks/l3-runtime-root-census.js +100 -0
- package/dist/services/doctor/doctor-service/checks/skill-reference-parity.d.ts +11 -3
- package/dist/services/doctor/doctor-service/checks/skill-reference-parity.js +48 -29
- package/dist/services/doctor/doctor-service/plugin-registry.js +2 -0
- package/dist/services/hooks/hook-payload-cwd.d.ts +11 -4
- package/dist/services/hooks/hook-payload-cwd.js +11 -4
- package/dist/services/hooks/presence-marker-detector.d.ts +3 -0
- package/dist/services/hooks/presence-marker-detector.js +21 -19
- package/dist/services/ide/adapters/claude-code-adapter.js +6 -8
- package/dist/services/ide/adapters/codex-adapter.js +23 -7
- package/dist/services/ide/adapters/cursor-adapter.js +23 -7
- package/dist/services/mode/mode-status-service.d.ts +26 -27
- package/dist/services/mode/mode-status-service.js +36 -60
- package/dist/services/preferences/preferences-types.d.ts +30 -0
- package/dist/services/preferences/preferences-types.js +13 -0
- package/dist/services/scan/acceptance-coverage-service.d.ts +14 -11
- package/dist/services/scan/acceptance-coverage-service.js +157 -52
- package/dist/services/scan/rid-change-claims.d.ts +15 -0
- package/dist/services/scan/rid-change-claims.js +116 -0
- package/dist/services/skills/presence-caller-id.d.ts +51 -0
- package/dist/services/skills/presence-caller-id.js +43 -0
- package/dist/services/skills/presence-gate.d.ts +65 -0
- package/dist/services/skills/presence-gate.js +113 -0
- package/dist/services/skills/presence-lease-resolver.d.ts +63 -0
- package/dist/services/skills/presence-lease-resolver.js +114 -0
- package/dist/services/skills/presence-lease-selection.d.ts +91 -0
- package/dist/services/skills/presence-lease-selection.js +135 -0
- package/dist/services/skills/presence-lease-service.d.ts +3 -11
- package/dist/services/skills/presence-lease-service.js +34 -87
- package/dist/services/skills/presence-lease-store.d.ts +33 -0
- package/dist/services/skills/presence-lease-store.js +94 -0
- package/dist/services/skills/presence-lease-types.d.ts +31 -0
- package/dist/services/skills/presence-lease-types.js +27 -0
- package/dist/services/skills/presence-role.d.ts +35 -0
- package/dist/services/skills/presence-role.js +72 -0
- package/dist/services/skills/skill-presence-service.d.ts +39 -9
- package/dist/services/skills/skill-presence-service.js +143 -174
- package/dist/services/skills/skill-presence-write.d.ts +60 -0
- package/dist/services/skills/skill-presence-write.js +74 -0
- package/dist/services/skills/skill-statusline-service.js +7 -7
- package/dist/services/standards/ide-aware-standards-service.d.ts +35 -23
- package/dist/services/standards/ide-aware-standards-service.js +45 -20
- package/dist/services/standards/migrate-claude-rules-service.d.ts +6 -0
- package/dist/services/standards/migrate-claude-rules-service.js +18 -0
- package/dist/services/standards/migrate-service.d.ts +1 -1
- package/dist/services/standards/migrate-service.js +27 -7
- package/dist/services/standards/project-scripts.d.ts +25 -0
- package/dist/services/standards/project-scripts.js +116 -0
- package/dist/services/standards/project-standards-service.d.ts +23 -15
- package/dist/services/standards/project-standards-service.js +176 -243
- package/dist/services/standards/standards-constitution.d.ts +89 -0
- package/dist/services/standards/standards-constitution.js +199 -0
- package/dist/services/standards/standards-files.d.ts +37 -0
- package/dist/services/standards/standards-files.js +138 -0
- package/dist/services/standards/standards-pointer.d.ts +73 -0
- package/dist/services/standards/standards-pointer.js +98 -0
- package/dist/services/standards/standards-render-agents.d.ts +34 -0
- package/dist/services/standards/standards-render-agents.js +149 -0
- package/dist/services/standards/standards-render-common.d.ts +38 -1
- package/dist/services/standards/standards-render-common.js +44 -7
- package/dist/services/standards/standards-render.d.ts +1 -3
- package/dist/services/standards/standards-render.js +6 -87
- package/dist/services/workflow/workflow-graph-ensure.d.ts +77 -0
- package/dist/services/workflow/workflow-graph-ensure.js +97 -0
- package/dist/services/workflow/workflow-presence-lifecycle.js +21 -6
- package/dist/services/workspace/generated-artifacts-content.d.ts +46 -0
- package/dist/services/workspace/generated-artifacts-content.js +167 -0
- package/dist/services/workspace/generated-artifacts-stamp.d.ts +36 -13
- package/dist/services/workspace/generated-artifacts-stamp.js +37 -15
- package/dist/services/workspace/runtime-layout.d.ts +64 -0
- package/dist/services/workspace/runtime-layout.js +62 -0
- package/output-styles/peaks-skill-swarm.md +18 -2
- package/package.json +8 -9
- package/schemas/doctor-report.schema.json +1 -1
- package/skills/bee/peaks-perf-audit/SKILL.md +3 -1
- package/skills/bee/peaks-prd/SKILL.md +5 -3
- package/skills/bee/peaks-qa/SKILL.md +4 -2
- package/skills/bee/peaks-qa/references/qa-skill-presence.md +1 -1
- package/skills/bee/peaks-qa/references/qa-standards-preflight.md +3 -1
- package/skills/bee/peaks-qa/references/qa-sub-agent-dispatch.md +2 -2
- package/skills/bee/peaks-rd/SKILL.md +4 -2
- package/skills/bee/peaks-rd/references/artifact-and-standards-output.md +1 -1
- package/skills/bee/peaks-rd/references/rd-runbook.md +11 -2
- package/skills/bee/peaks-rd/references/rd-standards-preflight.md +3 -1
- package/skills/bee/peaks-rd/references/rd-sub-agent-dispatch.md +4 -4
- package/skills/bee/peaks-rd/references/rd-transition-gates.md +49 -5
- package/skills/bee/peaks-rd/references/skill-presence-and-title.md +1 -1
- package/skills/bee/peaks-reviewer/SKILL.md +3 -1
- package/skills/bee/peaks-sc/SKILL.md +4 -2
- package/skills/bee/peaks-security-audit/SKILL.md +3 -1
- package/skills/bee/peaks-txt/SKILL.md +5 -3
- package/skills/bee/peaks-ui/SKILL.md +6 -4
- package/skills/peaks-audit/SKILL.md +3 -1
- package/skills/peaks-code/SKILL.md +3 -1
- package/skills/peaks-code/references/a2a-artifact-mapping.md +3 -3
- package/skills/peaks-code/references/completion-handoff.md +1 -1
- package/skills/peaks-code/references/local-artifact-workspace.md +10 -11
- package/skills/peaks-code/references/micro-cycle.md +2 -2
- package/skills/peaks-code/references/mode-selection-with-stale-presence.md +3 -3
- package/skills/peaks-code/references/runbook.md +4 -4
- package/skills/peaks-code/references/skill-presence-and-title.md +4 -2
- package/skills/peaks-code/references/standards-preflight.md +7 -6
- package/skills/peaks-code/references/sub-agent-dispatch.md +1 -1
- package/skills/peaks-code/references/swarm-dispatch-contract.md +5 -5
- package/skills/peaks-code/references/workflow-gates-and-types.md +37 -11
- package/skills/peaks-content/SKILL.md +3 -1
- package/skills/peaks-doctor/SKILL.md +3 -1
- package/skills/peaks-final-review/SKILL.md +3 -1
- package/skills/peaks-ide/SKILL.md +3 -1
- package/skills/peaks-issue-fix-orchestrator/SKILL.md +5 -3
- package/skills/peaks-race-code/SKILL.md +3 -1
- package/skills/peaks-resume/SKILL.md +3 -1
- package/skills/peaks-slice-decompose/SKILL.md +3 -1
- package/skills/peaks-solo/SKILL.md +3 -1
- package/skills/peaks-sop/SKILL.md +4 -2
- package/skills/peaks-status/SKILL.md +3 -1
- package/skills/peaks-test/SKILL.md +3 -1
|
@@ -13,8 +13,10 @@ visibility: internal
|
|
|
13
13
|
## Loop hygiene (every turn — MANDATORY)
|
|
14
14
|
|
|
15
15
|
**Skill header.** While this skill is active, open every turn with
|
|
16
|
-
`Peaks-Loop Skill: <skill> | Peaks-Loop Gate: <gate> | Next: <one short action>`.
|
|
16
|
+
`Peaks-Loop Skill: <skill> | Peaks-Loop Role: <role> | Peaks-Loop Gate: <gate> | Peaks-Loop Context: <ratio%> (<zone>) | Next: <one short action>`.
|
|
17
17
|
Every turn, not only the first — it is how the user knows which skill is driving.
|
|
18
|
+
`Role` and `Context` are machine facts: copy them from `peaks skill presence --json`
|
|
19
|
+
(`data.role`, `data.context.ratioPct`, `data.context.action`) — never invent them.
|
|
18
20
|
|
|
19
21
|
**Context is this skill's own business.** Run `peaks skill presence --json` every turn and
|
|
20
22
|
read its `context` block. When `action` is `auto-fire`, `pre-compact`, or `red-line`,
|
|
@@ -108,7 +110,7 @@ peaks project memories --project <repo> --json
|
|
|
108
110
|
```
|
|
109
111
|
|
|
110
112
|
This returns durable memories from `.peaks/memory` — decisions, conventions, modules, and rules captured in past sessions. Filter with `--kind <project|decision|convention|rule|reference|feedback|module|lesson|bug|investigation|technical-pattern|project-rule|design|handoff|session-handoff|project-todo|publish-closure|project-closure|slice-closure|slice-pilot-findings|sediment>`. (`.peaks/PROJECT.md` is a human-readable session timeline only.)
|
|
111
|
-
Then display: `Peaks-Loop Skill: peaks-prd | Peaks-Loop Gate: startup | Next: <one short action>`. Update with `peaks skill presence:set peaks-prd --project <repo> --mode <mode> --gate <gate>` when gates change. When the role's work ends, run `peaks skill presence:clear --project <repo>`.
|
|
113
|
+
Then display: `Peaks-Loop Skill: peaks-prd | Peaks-Loop Role: <role> | Peaks-Loop Gate: startup | Peaks-Loop Context: <ratio%> (<zone>) | Next: <one short action>`. `Role` and `Context` are machine facts: copy them from `peaks skill presence --json` (`data.role`, `data.context.ratioPct`, `data.context.action`) — never invent them. Update with `peaks skill presence:set peaks-prd --project <repo> --mode <mode> --gate <gate>` when gates change. When the role's work ends, run `peaks skill presence:clear --project <repo>`.
|
|
112
114
|
|
|
113
115
|
## Responsibilities
|
|
114
116
|
|
|
@@ -308,7 +310,7 @@ PRD must not mark the product artifact ready for RD if the frontend change point
|
|
|
308
310
|
|
|
309
311
|
## Standards dry-run coordination
|
|
310
312
|
|
|
311
|
-
For code repository workflows, PRD may run or consume `peaks standards init --project <path> --dry-run` and `peaks standards update --project <path> --dry-run` so downstream scope can reference the expected `CLAUDE.md` and `.claude/rules/**`
|
|
313
|
+
For code repository workflows, PRD may run or consume `peaks standards init --project <path> --dry-run` and `peaks standards update --project <path> --dry-run` so downstream scope can reference the expected standards state — the `AGENTS.md` body, the optional `CLAUDE.md` pointer (written only when the IDE profile needs it), and the rules tree under `.peaks/standards/**` (2.0 canonical layout) or `.claude/rules/**` (legacy 1.x project). PRD records this as preflight status only. RD remains responsible for applying standards mutations when authorized.
|
|
312
314
|
|
|
313
315
|
## Matt Pocock skills integration
|
|
314
316
|
|
|
@@ -13,8 +13,10 @@ visibility: internal
|
|
|
13
13
|
## Loop hygiene (every turn — MANDATORY)
|
|
14
14
|
|
|
15
15
|
**Skill header.** While this skill is active, open every turn with
|
|
16
|
-
`Peaks-Loop Skill: <skill> | Peaks-Loop Gate: <gate> | Next: <one short action>`.
|
|
16
|
+
`Peaks-Loop Skill: <skill> | Peaks-Loop Role: <role> | Peaks-Loop Gate: <gate> | Peaks-Loop Context: <ratio%> (<zone>) | Next: <one short action>`.
|
|
17
17
|
Every turn, not only the first — it is how the user knows which skill is driving.
|
|
18
|
+
`Role` and `Context` are machine facts: copy them from `peaks skill presence --json`
|
|
19
|
+
(`data.role`, `data.context.ratioPct`, `data.context.action`) — never invent them.
|
|
18
20
|
|
|
19
21
|
**Context is this skill's own business.** Run `peaks skill presence --json` every turn and
|
|
20
22
|
read its `context` block. When `action` is `auto-fire`, `pre-compact`, or `red-line`,
|
|
@@ -154,7 +156,7 @@ Gate index: A (test-cases), A2 (tests executed), A3 (security reference — v2.1
|
|
|
154
156
|
|
|
155
157
|
## Project standards preflight
|
|
156
158
|
|
|
157
|
-
Before QA verification in a code repository, call `peaks standards init --project <path> --dry-run` and `peaks standards update --project <path> --dry-run`. Apply only when write authorization exists.
|
|
159
|
+
Before QA verification in a code repository, call `peaks standards init --project <path> --dry-run` and `peaks standards update --project <path> --dry-run` — the bundle is the `AGENTS.md` body, the optional `CLAUDE.md` pointer (written only when the IDE profile needs it), and the rules tree under `.peaks/standards/**` or `.claude/rules/**`. Apply only when write authorization exists.
|
|
158
160
|
|
|
159
161
|
→ see `references/qa-standards-preflight.md` for the full preflight contract.
|
|
160
162
|
|
|
@@ -19,4 +19,4 @@ peaks project memories --project <repo> --json
|
|
|
19
19
|
```
|
|
20
20
|
|
|
21
21
|
This returns durable memories from `.peaks/memory` — decisions, conventions, modules, and rules captured in past sessions. Filter with `--kind <project|decision|convention|rule|reference|feedback|module|lesson|bug|investigation|technical-pattern|project-rule|design|handoff|session-handoff|project-todo|publish-closure|project-closure|slice-closure|slice-pilot-findings|sediment>`. (`.peaks/PROJECT.md` is a human-readable session timeline only.)
|
|
22
|
-
Then display: `Peaks-Loop Skill: peaks-qa | Peaks-Loop Gate: startup | Next: <one short action>`. Update with `peaks skill presence:set peaks-qa --project <repo> --mode <mode> --gate <gate>` when gates change. When the role's work ends, run `peaks skill presence:clear --project <repo>`.
|
|
22
|
+
Then display: `Peaks-Loop Skill: peaks-qa | Peaks-Loop Role: <role> | Peaks-Loop Gate: startup | Peaks-Loop Context: <ratio%> (<zone>) | Next: <one short action>`. `Role` and `Context` are machine facts: copy them from `peaks skill presence --json` (`data.role`, `data.context.ratioPct`, `data.context.action`) — never invent them. Update with `peaks skill presence:set peaks-qa --project <repo> --mode <mode> --gate <gate>` when gates change. When the role's work ends, run `peaks skill presence:clear --project <repo>`.
|
|
@@ -5,4 +5,6 @@
|
|
|
5
5
|
- `peaks standards init --project <path> --dry-run`
|
|
6
6
|
- `peaks standards update --project <path> --dry-run`
|
|
7
7
|
|
|
8
|
-
|
|
8
|
+
The bundle the CLI writes has three parts: the **body** `AGENTS.md` (always written), the **pointer** `CLAUDE.md` (written only when the IDE profile needs it — a profile that reads `AGENTS.md` directly, e.g. `--ide codex`, writes no pointer), and the **rules tree** under `.peaks/standards/**` (2.0 canonical layout) or `.claude/rules/**` (legacy 1.x project). Judge the preflight from the CLI's own output instead of a hard-coded path: `peaks standards init --project <path> --dry-run --json` reports `data.plannedWrites[]` = `[{ relativePath, status }]`, where `init` reports two states — `planned` (absent → will be created) / `existing` (present on disk; `init` does not compare content, so a stale file still reads `existing`). The four-state view of the body file comes from `peaks standards update --project <path> --dry-run --json`: `planned` (absent) / `appended` (present, managed block missing) / `existing` (present and current) / `review` (present, managed block differs → a human decides; that command exits 1 with code `STANDARDS_UPDATE_REVIEW_REQUIRED`). Those four states cover `AGENTS.md` and, when the IDE profile writes one, `CLAUDE.md`; rules-tree files are `planned` / `existing` in both commands. The `relativePath` values also tell you which rules root this project uses.
|
|
9
|
+
|
|
10
|
+
If the repo needs a first-time standards bundle, treat `standards init` as the creation path. If the body file (`AGENTS.md`) already exists, use `standards update` to decide whether Peaks-Loop can append a managed block or should only return review suggestions. Apply only when write authorization exists; otherwise keep the CLI output as a preflight next action. Do not hand-write standards file mutations inside the skill.
|
|
@@ -25,7 +25,7 @@ If the upstream superpowers chain suggests raw `git worktree add`:
|
|
|
25
25
|
3. Continue with `peaks worktree spawn` (or the auth-grant fallback)
|
|
26
26
|
|
|
27
27
|
- **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.
|
|
28
|
-
- **Skill presence (MANDATORY first action)** — do NOT call `peaks skill presence:set peaks-qa`. The sub-agent must not overwrite
|
|
28
|
+
- **Skill presence (MANDATORY first action)** — do NOT call `peaks skill presence:set peaks-qa`. The sub-agent must not overwrite the main presence lease; the main Code loop owns it. If you need to mark your own state, write a marker file at `.peaks/_runtime/<sessionId>/system/sub-agent-qa.json` and only that.
|
|
29
29
|
- **Workspace initialization** — Code has already run `peaks workspace init` before fan-out. Do not re-run it.
|
|
30
30
|
- **Mode selection** — Code has already chosen the mode.
|
|
31
31
|
- **Statusline install** — already done by Code at session startup.
|
|
@@ -52,7 +52,7 @@ What the sub-agent **MUST** still do:
|
|
|
52
52
|
**Hard prohibitions** (sub-agent context):
|
|
53
53
|
|
|
54
54
|
- Do NOT call `Skill(skill="...")`.
|
|
55
|
-
- Do NOT call `peaks skill presence:set` — Code owns the
|
|
55
|
+
- Do NOT call `peaks skill presence:set` — Code owns the presence lease.
|
|
56
56
|
- Do NOT run the actual test suite, do NOT execute security/perf tools, do NOT open a browser — those are the **QA validation** phase, not the Swarm planning phase.
|
|
57
57
|
- Do NOT commit, push, install hooks, or apply settings.json mutations.
|
|
58
58
|
- Do NOT ask the user interactive questions. If you need clarification, return `{"status":"blocked","blockedReason":"<text>"}`.
|
|
@@ -14,8 +14,10 @@ visibility: internal
|
|
|
14
14
|
## Loop hygiene (every turn — MANDATORY)
|
|
15
15
|
|
|
16
16
|
**Skill header.** While this skill is active, open every turn with
|
|
17
|
-
`Peaks-Loop Skill: <skill> | Peaks-Loop Gate: <gate> | Next: <one short action>`.
|
|
17
|
+
`Peaks-Loop Skill: <skill> | Peaks-Loop Role: <role> | Peaks-Loop Gate: <gate> | Peaks-Loop Context: <ratio%> (<zone>) | Next: <one short action>`.
|
|
18
18
|
Every turn, not only the first — it is how the user knows which skill is driving.
|
|
19
|
+
`Role` and `Context` are machine facts: copy them from `peaks skill presence --json`
|
|
20
|
+
(`data.role`, `data.context.ratioPct`, `data.context.action`) — never invent them.
|
|
19
21
|
|
|
20
22
|
**Context is this skill's own business.** Run `peaks skill presence --json` every turn and
|
|
21
23
|
read its `context` block. When `action` is `auto-fire`, `pre-compact`, or `red-line`,
|
|
@@ -118,7 +120,7 @@ See `references/rd-runbook.md` for the full 9-step runbook (steps #0–#8) with
|
|
|
118
120
|
|
|
119
121
|
You cannot declare a phase complete from memory. Each gate below is a `ls` or `grep` command you **MUST run** and whose output you **MUST see** before proceeding. CLI enforcement: the gates are ALSO enforced by `peaks request transition`, which fails with `code: PREREQUISITES_MISSING` if any are absent.
|
|
120
122
|
|
|
121
|
-
Gate index: A (project-scan), A2 (tech-doc path verification), A3 (
|
|
123
|
+
Gate index: A (project-scan), A2 (tech-doc path verification), A3 (standards files — AGENTS.md body + rules tree; the CLAUDE.md pointer is written only when the IDE profile needs it), B (tech-doc + request artifact), B2 (unit tests on changed surface), B3 (code-review.md), B4 (security-review.md), B5 (lint — no unfilled placeholders + JS/TS ESLint 卡控 via `peaks lint check`. First-time project setup: run `peaks lint baseline` to generate the project-level `.peaks/lint/baseline.json`. Per-slice flow uses `peaks lint check` (= diffOnly: true + baseline waiver + redLineMode: 'baseline-aware'). LLM red-line reference lives at `.peaks/memory/lint-redline-summary.md` (auto-written by `peaks lint check --red-line`); read it BEFORE writing JS/TS so the next slice sees prior sibling-violation context. Project-aware baseline: each project regenerates its own baseline; cross-project reuse is low-value — see `references/jsts-eslint-gate.md` §7), B6 (request-type-sanity), B7 (repair-status — 3-cycle cap), B8 (diff-vs-scope), B9 (perf-baseline).
|
|
122
124
|
|
|
123
125
|
→ see `references/rd-transition-gates.md` for the per-gate contract + `ls` / `grep` shell snippets.
|
|
124
126
|
|
|
@@ -4,6 +4,6 @@
|
|
|
4
4
|
|
|
5
5
|
Do not default to a git-backed artifact repository, external artifact sync, or automatic commits for intermediate artifacts. Git inclusion or sync requires explicit user confirmation or an active profile that clearly authorizes it. Browser evidence must be sanitized before retention: do not store login URLs, cookies, headers, tokens, storage state, browser traces, or screenshots/logs containing PII or SSO/MFA material.
|
|
6
6
|
|
|
7
|
-
When project-local `CLAUDE.md`
|
|
7
|
+
When the project-local standards bundle is created or updated — the `AGENTS.md` body, the optional `CLAUDE.md` pointer (written only when the IDE profile needs it), and the rules tree under `.peaks/standards/**` or `.claude/rules/**` — route the mutation through `peaks standards init` or `peaks standards update`; do not hand-write standards mutations. Derive the content from the current scan results and existing project standards. Keep only the rules that match the project's languages, frameworks, tooling, and repository layout. Do not emit generic templates, copy-pasted boilerplate, or rules unrelated to the current scan evidence. Do not update user-global `~/.claude/rules/**` from this workflow.
|
|
8
8
|
|
|
9
9
|
If the scan results are insufficient to justify a rule, leave it out or surface a review-only suggestion instead of writing it into project standards.
|
|
@@ -161,8 +161,17 @@ peaks codegraph affected --project <repo> <changed-files...> --json
|
|
|
161
161
|
# → `peaks request transition --state qa-handoff` returns `code: PREREQUISITES_MISSING`.
|
|
162
162
|
# Escape hatch (assisted mode): `--allow-incomplete --confirm`.
|
|
163
163
|
|
|
164
|
-
# 6.6 BEFORE implementation: verify
|
|
165
|
-
#
|
|
164
|
+
# 6.6 BEFORE implementation: verify the standards files are in place (Peaks-Loop Gate A3)
|
|
165
|
+
# The file set is decided by the CLI — never hard-code it:
|
|
166
|
+
# peaks standards init --project . --dry-run --json
|
|
167
|
+
# → data.plannedWrites[] = [{relativePath, status}]; status 'planned' = that file is absent.
|
|
168
|
+
# BODY = AGENTS.md (always written).
|
|
169
|
+
# POINTER = CLAUDE.md (written only when the IDE profile needs it; its absence from
|
|
170
|
+
# plannedWrites is NOT a failure).
|
|
171
|
+
# RULES = .peaks/standards/** (2.0 canonical) or .claude/rules/** (legacy 1.x project).
|
|
172
|
+
# BLOCKED when plannedWrites is empty or any status is 'planned'.
|
|
173
|
+
# Missing standards files → run `peaks standards init --project . --apply` (first time)
|
|
174
|
+
# or `peaks standards update --project . --apply` (existing) first, then re-check.
|
|
166
175
|
# Without project rules, security review and code review triggers won't fire.
|
|
167
176
|
|
|
168
177
|
# 7. AFTER implementation, BEFORE QA handoff — RUN THESE GATES:
|
|
@@ -5,4 +5,6 @@
|
|
|
5
5
|
- `peaks standards init --project <path> --dry-run`
|
|
6
6
|
- `peaks standards update --project <path> --dry-run`
|
|
7
7
|
|
|
8
|
-
|
|
8
|
+
The bundle the CLI writes has three parts: the **body** `AGENTS.md` (always written), the **pointer** `CLAUDE.md` (written only when the IDE profile needs it — a profile that reads `AGENTS.md` directly, e.g. `--ide codex`, writes no pointer), and the **rules tree** under `.peaks/standards/**` (2.0 canonical layout) or `.claude/rules/**` (legacy 1.x project). Judge the preflight from the CLI's own output instead of a hard-coded path: `peaks standards init --project <path> --dry-run --json` reports `data.plannedWrites[]` = `[{ relativePath, status }]`, where `init` reports two states — `planned` (absent → will be created) / `existing` (present on disk; `init` does not compare content, so a stale file still reads `existing`). The four-state view of the body file comes from `peaks standards update --project <path> --dry-run --json`: `planned` (absent) / `appended` (present, managed block missing) / `existing` (present and current) / `review` (present, managed block differs → a human decides; that command exits 1 with code `STANDARDS_UPDATE_REVIEW_REQUIRED`). Those four states cover `AGENTS.md` and, when the IDE profile writes one, `CLAUDE.md`; rules-tree files are `planned` / `existing` in both commands. The `relativePath` values also tell you which rules root this project uses.
|
|
9
|
+
|
|
10
|
+
If the body file (`AGENTS.md`) is missing, treat creation as the preferred path. If the body already exists, use `standards update` to decide whether to append a managed index block or surface review-only suggestions. Apply only when write authorization exists; otherwise keep the CLI output as a preflight next action. Do not hand-write standards file mutations inside the skill.
|
|
@@ -59,9 +59,9 @@ If the upstream superpowers chain suggests raw `git worktree add`:
|
|
|
59
59
|
> design — if either changes, update the other.
|
|
60
60
|
|
|
61
61
|
- **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.
|
|
62
|
-
- **Skill presence (MANDATORY first action)** — do NOT call `peaks skill presence:set peaks-rd`. The sub-agent must not overwrite
|
|
62
|
+
- **Skill presence (MANDATORY first action)** — do NOT call `peaks skill presence:set peaks-rd`. The sub-agent must not overwrite the main presence lease; the main Code loop owns it. If you need to mark your own state, write a marker file at `.peaks/_runtime/<sessionId>/system/sub-agent-rd.json` and only that.
|
|
63
63
|
- **Workspace initialization** — Code has already run `peaks workspace init` before fan-out. Do not re-run it.
|
|
64
|
-
- **Mode selection** — Code has already chosen the mode. Read it from the prompt arguments (or from
|
|
64
|
+
- **Mode selection** — Code has already chosen the mode. Read it from the prompt arguments (or from `peaks skill presence --json` if you can, but do not write it).
|
|
65
65
|
- **Statusline install** — already done by Code at session startup; do not re-run.
|
|
66
66
|
|
|
67
67
|
What the sub-agent **MUST** still do, from this skill's contract:
|
|
@@ -89,7 +89,7 @@ What the sub-agent **MUST** still do, from this skill's contract:
|
|
|
89
89
|
**Hard prohibitions** (sub-agent context, in addition to general red lines):
|
|
90
90
|
|
|
91
91
|
- Do NOT call `Skill(skill="...")` from inside the sub-agent — that defeats the fan-out.
|
|
92
|
-
- Do NOT call `peaks skill presence:set` — Code owns the
|
|
92
|
+
- Do NOT call `peaks skill presence:set` — Code owns the presence lease.
|
|
93
93
|
- Do NOT commit, push, install hooks, or apply settings.json mutations.
|
|
94
94
|
- Do NOT ask the user interactive questions. If you need clarification, return `{"status":"blocked","blockedReason":"<text>"}` and let Code handle the user message.
|
|
95
95
|
- Do NOT modify code (the Swarm phase is planning only; code edits happen in the RD implementation phase, which is a separate sub-agent or inline run after Gate B).
|
|
@@ -171,7 +171,7 @@ Corrected 2026-10-13, kept visible rather than edited away: this paragraph used
|
|
|
171
171
|
|
|
172
172
|
When you (the LLM sub-agent) write new or modified unit tests in `tests/unit/**`, every `it()` / `test()` block MUST follow the given-when-then contract:
|
|
173
173
|
|
|
174
|
-
1. The first string-literal argument of `it()` / `test()` MUST describe business behavior
|
|
174
|
+
1. The first string-literal argument of `it()` / `test()` MUST describe business behavior and MUST include either the word "when" (state / pre-condition) or "should" (observable outcome). The idiomatic form `when X, should Y` names both, so prefer it — but it is a preference, not a requirement: a description carrying only "when" or only "should" is compliant.
|
|
175
175
|
2. The body callback (the second argument) MUST start with exactly 3 leading comments:
|
|
176
176
|
```typescript
|
|
177
177
|
// given: <precondition — system / user state>
|
|
@@ -38,13 +38,57 @@ ls <every-single-directory-path-in-tech-doc> 2>&1 | grep -c "No such file"
|
|
|
38
38
|
# breaks the implementation, and forces the user to correct the engineer.
|
|
39
39
|
```
|
|
40
40
|
|
|
41
|
-
**Peaks-Loop Gate A3 — Before implementation: project standards files
|
|
41
|
+
**Peaks-Loop Gate A3 — Before implementation: the project's standards files are in place:**
|
|
42
|
+
|
|
43
|
+
The standards bundle has three parts, and only the first has a fixed name:
|
|
44
|
+
|
|
45
|
+
- `AGENTS.md` — the **body** (the cross-tool constitution). Always written, in every layout.
|
|
46
|
+
- `CLAUDE.md` — the **pointer** (`@AGENTS.md`). Written ONLY when the IDE profile needs it.
|
|
47
|
+
A profile that reads `AGENTS.md` directly (e.g. `--ide codex`) writes no pointer at all,
|
|
48
|
+
so its absence is NOT a failure.
|
|
49
|
+
- the **rules tree** — `.peaks/standards/**` for the 2.0 canonical layout, `.claude/rules/**`
|
|
50
|
+
for a legacy 1.x project that still carries a thick `.claude/rules/` tree.
|
|
51
|
+
|
|
52
|
+
Never hard-code a path in this gate: ask the CLI which files this project actually uses.
|
|
53
|
+
|
|
42
54
|
```bash
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
#
|
|
55
|
+
# 1) The CLI decides the file set. Never hard-code a rules path here.
|
|
56
|
+
peaks standards init --project . --dry-run --json
|
|
57
|
+
# → data.plannedWrites[] = [{ relativePath, status }, ...]
|
|
58
|
+
# init reports TWO states: planned (absent → will be created) | existing (present on
|
|
59
|
+
# disk — init does not compare content, so a stale file still reads 'existing').
|
|
60
|
+
# The four-state view of the body file comes from
|
|
61
|
+
# `peaks standards update --project . --dry-run --json`:
|
|
62
|
+
# planned | appended (managed block missing) | existing (managed
|
|
63
|
+
# block matches) | review (managed block differs → a human decides; that command exits
|
|
64
|
+
# 1 with code STANDARDS_UPDATE_REVIEW_REQUIRED). The four states cover AGENTS.md and,
|
|
65
|
+
# when the IDE profile writes one, CLAUDE.md; rules-tree files are planned | existing
|
|
66
|
+
# in both commands.
|
|
67
|
+
# → data.skippedFiles[] = the entries already present on disk
|
|
68
|
+
#
|
|
69
|
+
# 2) The body file is invariant — it is in plannedWrites in every layout. Verify it landed:
|
|
70
|
+
ls AGENTS.md
|
|
71
|
+
# "No such file" → BLOCKED
|
|
72
|
+
#
|
|
73
|
+
# 3) Judge the rest from the JSON, not from a hard-coded path list:
|
|
74
|
+
# BLOCKED when plannedWrites is empty, or when any entry has status 'planned'
|
|
75
|
+
# (that required standards file is absent).
|
|
76
|
+
# PASS otherwise. `init` never reports 'appended' / 'review' — when the update
|
|
77
|
+
# dry-run does, report each one as a follow-up:
|
|
78
|
+
# 'appended' → `peaks standards update --project . --apply` adds the managed block;
|
|
79
|
+
# 'review' → the managed block differs; a human decides (see `peaks standards update`).
|
|
80
|
+
#
|
|
81
|
+
# The layout is read off the paths themselves:
|
|
82
|
+
# .peaks/standards/** → 2.0 canonical layout
|
|
83
|
+
# .claude/rules/** → legacy 1.x layout
|
|
84
|
+
# CLAUDE.md is listed only when the IDE profile needs a pointer — its ABSENCE from
|
|
85
|
+
# plannedWrites is NOT a failure and must not be reported as BLOCKED.
|
|
86
|
+
#
|
|
87
|
+
# Any 'planned' entry → BLOCKED. Run `peaks standards init --project . --apply` (first
|
|
88
|
+
# time) or `peaks standards update --project . --apply` (existing) FIRST, then re-run the
|
|
89
|
+
# dry-run until no entry is 'planned'.
|
|
46
90
|
# Do not write a single line of implementation code without standards files in place.
|
|
47
|
-
# Without
|
|
91
|
+
# Without the standards body + rules tree, code review and security review triggers won't fire.
|
|
48
92
|
```
|
|
49
93
|
|
|
50
94
|
**Peaks-Loop Gate B — Before QA handoff:**
|
|
@@ -19,4 +19,4 @@ peaks project memories --project <repo> --json
|
|
|
19
19
|
```
|
|
20
20
|
|
|
21
21
|
This returns durable memories from `.peaks/memory` — decisions, conventions, modules, and rules captured in past sessions. Filter with `--kind <project|decision|convention|rule|reference|feedback|module|lesson|bug|investigation|technical-pattern|project-rule|design|handoff|session-handoff|project-todo|publish-closure|project-closure|slice-closure|slice-pilot-findings|sediment>`. (`.peaks/PROJECT.md` is a human-readable session timeline only.)
|
|
22
|
-
Then display: `Peaks-Loop Skill: peaks-rd | Peaks-Loop Gate: startup | Next: <one short action>`. Update with `peaks skill presence:set peaks-rd --project <repo> --mode <mode> --gate <gate>` when gates change. When the role's work ends, run `peaks skill presence:clear --project <repo>`.
|
|
22
|
+
Then display: `Peaks-Loop Skill: peaks-rd | Peaks-Loop Role: <role> | Peaks-Loop Gate: startup | Peaks-Loop Context: <ratio%> (<zone>) | Next: <one short action>`. `Role` and `Context` are machine facts: copy them from `peaks skill presence --json` (`data.role`, `data.context.ratioPct`, `data.context.action`) — never invent them. Update with `peaks skill presence:set peaks-rd --project <repo> --mode <mode> --gate <gate>` when gates change. When the role's work ends, run `peaks skill presence:clear --project <repo>`.
|
|
@@ -9,8 +9,10 @@ description: Third-party independent code-review skill for Peaks. Use as a paral
|
|
|
9
9
|
## Loop hygiene (every turn — MANDATORY)
|
|
10
10
|
|
|
11
11
|
**Skill header.** While this skill is active, open every turn with
|
|
12
|
-
`Peaks-Loop Skill: <skill> | Peaks-Loop Gate: <gate> | Next: <one short action>`.
|
|
12
|
+
`Peaks-Loop Skill: <skill> | Peaks-Loop Role: <role> | Peaks-Loop Gate: <gate> | Peaks-Loop Context: <ratio%> (<zone>) | Next: <one short action>`.
|
|
13
13
|
Every turn, not only the first — it is how the user knows which skill is driving.
|
|
14
|
+
`Role` and `Context` are machine facts: copy them from `peaks skill presence --json`
|
|
15
|
+
(`data.role`, `data.context.ratioPct`, `data.context.action`) — never invent them.
|
|
14
16
|
|
|
15
17
|
**Context is this skill's own business.** Run `peaks skill presence --json` every turn and
|
|
16
18
|
read its `context` block. When `action` is `auto-fire`, `pre-compact`, or `red-line`,
|
|
@@ -13,8 +13,10 @@ visibility: internal
|
|
|
13
13
|
## Loop hygiene (every turn — MANDATORY)
|
|
14
14
|
|
|
15
15
|
**Skill header.** While this skill is active, open every turn with
|
|
16
|
-
`Peaks-Loop Skill: <skill> | Peaks-Loop Gate: <gate> | Next: <one short action>`.
|
|
16
|
+
`Peaks-Loop Skill: <skill> | Peaks-Loop Role: <role> | Peaks-Loop Gate: <gate> | Peaks-Loop Context: <ratio%> (<zone>) | Next: <one short action>`.
|
|
17
17
|
Every turn, not only the first — it is how the user knows which skill is driving.
|
|
18
|
+
`Role` and `Context` are machine facts: copy them from `peaks skill presence --json`
|
|
19
|
+
(`data.role`, `data.context.ratioPct`, `data.context.action`) — never invent them.
|
|
18
20
|
|
|
19
21
|
**Context is this skill's own business.** Run `peaks skill presence --json` every turn and
|
|
20
22
|
read its `context` block. When `action` is `auto-fire`, `pre-compact`, or `red-line`,
|
|
@@ -76,7 +78,7 @@ peaks project memories --project <repo> --json
|
|
|
76
78
|
```
|
|
77
79
|
|
|
78
80
|
This returns durable memories from `.peaks/memory` — decisions, conventions, modules, and rules captured in past sessions. Filter with `--kind <project|decision|convention|rule|reference|feedback|module|lesson|bug|investigation|technical-pattern|project-rule|design|handoff|session-handoff|project-todo|publish-closure|project-closure|slice-closure|slice-pilot-findings|sediment>`. (`.peaks/PROJECT.md` is a human-readable session timeline only.)
|
|
79
|
-
Then display: `Peaks-Loop Skill: peaks-sc | Peaks-Loop Gate: startup | Next: <one short action>`. Update with `peaks skill presence:set peaks-sc --project <repo> --mode <mode> --gate <gate>` when gates change. When the role's work ends, run `peaks skill presence:clear --project <repo>`.
|
|
81
|
+
Then display: `Peaks-Loop Skill: peaks-sc | Peaks-Loop Role: <role> | Peaks-Loop Gate: startup | Peaks-Loop Context: <ratio%> (<zone>) | Next: <one short action>`. `Role` and `Context` are machine facts: copy them from `peaks skill presence --json` (`data.role`, `data.context.ratioPct`, `data.context.action`) — never invent them. Update with `peaks skill presence:set peaks-sc --project <repo> --mode <mode> --gate <gate>` when gates change. When the role's work ends, run `peaks skill presence:clear --project <repo>`.
|
|
80
82
|
|
|
81
83
|
## Responsibilities
|
|
82
84
|
|
|
@@ -17,8 +17,10 @@ metadata:
|
|
|
17
17
|
## Loop hygiene (every turn — MANDATORY)
|
|
18
18
|
|
|
19
19
|
**Skill header.** While this skill is active, open every turn with
|
|
20
|
-
`Peaks-Loop Skill: <skill> | Peaks-Loop Gate: <gate> | Next: <one short action>`.
|
|
20
|
+
`Peaks-Loop Skill: <skill> | Peaks-Loop Role: <role> | Peaks-Loop Gate: <gate> | Peaks-Loop Context: <ratio%> (<zone>) | Next: <one short action>`.
|
|
21
21
|
Every turn, not only the first — it is how the user knows which skill is driving.
|
|
22
|
+
`Role` and `Context` are machine facts: copy them from `peaks skill presence --json`
|
|
23
|
+
(`data.role`, `data.context.ratioPct`, `data.context.action`) — never invent them.
|
|
22
24
|
|
|
23
25
|
**Context is this skill's own business.** Run `peaks skill presence --json` every turn and
|
|
24
26
|
read its `context` block. When `action` is `auto-fire`, `pre-compact`, or `red-line`,
|
|
@@ -13,8 +13,10 @@ visibility: internal
|
|
|
13
13
|
## Loop hygiene (every turn — MANDATORY)
|
|
14
14
|
|
|
15
15
|
**Skill header.** While this skill is active, open every turn with
|
|
16
|
-
`Peaks-Loop Skill: <skill> | Peaks-Loop Gate: <gate> | Next: <one short action>`.
|
|
16
|
+
`Peaks-Loop Skill: <skill> | Peaks-Loop Role: <role> | Peaks-Loop Gate: <gate> | Peaks-Loop Context: <ratio%> (<zone>) | Next: <one short action>`.
|
|
17
17
|
Every turn, not only the first — it is how the user knows which skill is driving.
|
|
18
|
+
`Role` and `Context` are machine facts: copy them from `peaks skill presence --json`
|
|
19
|
+
(`data.role`, `data.context.ratioPct`, `data.context.action`) — never invent them.
|
|
18
20
|
|
|
19
21
|
**Context is this skill's own business.** Run `peaks skill presence --json` every turn and
|
|
20
22
|
read its `context` block. When `action` is `auto-fire`, `pre-compact`, or `red-line`,
|
|
@@ -55,7 +57,7 @@ Before any analysis or tool call, immediately run:
|
|
|
55
57
|
peaks skill presence:set peaks-txt --project <repo> --mode <mode> --gate startup
|
|
56
58
|
```
|
|
57
59
|
|
|
58
|
-
**When invoked as a sub-agent (peaks-code swarm):** do NOT call `peaks skill presence:set` (Code owns the
|
|
60
|
+
**When invoked as a sub-agent (peaks-code swarm):** do NOT call `peaks skill presence:set` (Code owns the presence lease) and do NOT spawn your own session. Use the parent's sid — read `.peaks/_runtime/session.json` or pass `--session-id <parent-sid>` to any session-creating CLI. The new `peaks session info --active` reads the canonical binding for you.
|
|
59
61
|
|
|
60
62
|
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:
|
|
61
63
|
|
|
@@ -70,7 +72,7 @@ peaks project memories --project <repo> --json
|
|
|
70
72
|
```
|
|
71
73
|
|
|
72
74
|
This returns durable memories from `.peaks/memory` — decisions, conventions, modules, and rules captured in past sessions. Filter with `--kind <project|decision|convention|rule|reference|feedback|module|lesson|bug|investigation|technical-pattern|project-rule|design|handoff|session-handoff|project-todo|publish-closure|project-closure|slice-closure|slice-pilot-findings|sediment>`. (`.peaks/PROJECT.md` is a human-readable session timeline only.)
|
|
73
|
-
Then display: `Peaks-Loop Skill: peaks-txt | Peaks-Loop Gate: startup | Next: <one short action>`. Update with `peaks skill presence:set peaks-txt --project <repo> --mode <mode> --gate <gate>` when gates change. When the role's work ends, run `peaks skill presence:clear --project <repo>`.
|
|
75
|
+
Then display: `Peaks-Loop Skill: peaks-txt | Peaks-Loop Role: <role> | Peaks-Loop Gate: startup | Peaks-Loop Context: <ratio%> (<zone>) | Next: <one short action>`. `Role` and `Context` are machine facts: copy them from `peaks skill presence --json` (`data.role`, `data.context.ratioPct`, `data.context.action`) — never invent them. Update with `peaks skill presence:set peaks-txt --project <repo> --mode <mode> --gate <gate>` when gates change. When the role's work ends, run `peaks skill presence:clear --project <repo>`.
|
|
74
76
|
|
|
75
77
|
## Responsibilities
|
|
76
78
|
|
|
@@ -13,8 +13,10 @@ visibility: internal
|
|
|
13
13
|
## Loop hygiene (every turn — MANDATORY)
|
|
14
14
|
|
|
15
15
|
**Skill header.** While this skill is active, open every turn with
|
|
16
|
-
`Peaks-Loop Skill: <skill> | Peaks-Loop Gate: <gate> | Next: <one short action>`.
|
|
16
|
+
`Peaks-Loop Skill: <skill> | Peaks-Loop Role: <role> | Peaks-Loop Gate: <gate> | Peaks-Loop Context: <ratio%> (<zone>) | Next: <one short action>`.
|
|
17
17
|
Every turn, not only the first — it is how the user knows which skill is driving.
|
|
18
|
+
`Role` and `Context` are machine facts: copy them from `peaks skill presence --json`
|
|
19
|
+
(`data.role`, `data.context.ratioPct`, `data.context.action`) — never invent them.
|
|
18
20
|
|
|
19
21
|
**Context is this skill's own business.** Run `peaks skill presence --json` every turn and
|
|
20
22
|
read its `context` block. When `action` is `auto-fire`, `pre-compact`, or `red-line`,
|
|
@@ -71,7 +73,7 @@ UI inherits `peaks-qa`'s hard-block contract: `AskUserQuestion` with three optio
|
|
|
71
73
|
When this skill is launched as a sub-agent via `peaks sub-agent dispatch <role>` from `peaks-code`, these sections are **suspended** for the sub-agent run:
|
|
72
74
|
|
|
73
75
|
- **Session id** — use parent's sid (`.peaks/_runtime/session.json` or `--session-id <parent-sid>`). Do NOT spawn your own session; `peaks session info --active` reads the canonical binding.
|
|
74
|
-
- **Skill presence** — do NOT call `peaks skill presence:set peaks-ui`; Code owns `.peaks
|
|
76
|
+
- **Skill presence** — do NOT call `peaks skill presence:set peaks-ui`; Code owns the presence lease (`.peaks/_runtime/<session-id>/leases/presence-*.json`). Marker file at `.peaks/_runtime/<session-id>/system/sub-agent-ui.json` only.
|
|
75
77
|
- **Workspace initialization** — Code ran `peaks workspace init` before fan-out; do not re-run.
|
|
76
78
|
- **Mode selection** — Code chose the mode.
|
|
77
79
|
- **Statusline install** — done by Code at startup.
|
|
@@ -99,7 +101,7 @@ What the sub-agent **MUST** still do:
|
|
|
99
101
|
**Hard prohibitions** (sub-agent context):
|
|
100
102
|
|
|
101
103
|
- Do NOT call `Skill(skill="...")`.
|
|
102
|
-
- Do NOT call `peaks skill presence:set` — Code owns
|
|
104
|
+
- Do NOT call `peaks skill presence:set` — Code owns the presence lease.
|
|
103
105
|
- Do NOT modify application code. UI is design-direction only.
|
|
104
106
|
- Do NOT install MCP servers. If Playwright MCP is missing and headed browser is required, return `{"status":"blocked","blockedReason":"playwright-mcp-unavailable"}` for Code escalation. (peaks-loop no longer manages MCP install — user runs `claude mcp add playwright -- npx @playwright/mcp@latest` in Claude Code.)
|
|
105
107
|
- Do NOT commit, push, install hooks, or apply settings.json mutations.
|
|
@@ -122,7 +124,7 @@ peaks statusline install --project <repo> # idempotent; skips if already insta
|
|
|
122
124
|
```
|
|
123
125
|
|
|
124
126
|
Read durable project memory via `peaks project memories --project <repo> --json` (decisions / conventions / modules / rules). Filter with `--kind`. (`.peaks/PROJECT.md` is a human-readable timeline only.)
|
|
125
|
-
Then display: `Peaks-Loop Skill: peaks-ui | Peaks-Loop Gate: startup | Next: <one short action>`. Update with `peaks skill presence:set peaks-ui --project <repo> --mode <mode> --gate <gate>` when gates change. When the role's work ends, run `peaks skill presence:clear --project <repo>`.
|
|
127
|
+
Then display: `Peaks-Loop Skill: peaks-ui | Peaks-Loop Role: <role> | Peaks-Loop Gate: startup | Peaks-Loop Context: <ratio%> (<zone>) | Next: <one short action>`. `Role` and `Context` are machine facts: copy them from `peaks skill presence --json` (`data.role`, `data.context.ratioPct`, `data.context.action`) — never invent them. Update with `peaks skill presence:set peaks-ui --project <repo> --mode <mode> --gate <gate>` when gates change. When the role's work ends, run `peaks skill presence:clear --project <repo>`.
|
|
126
128
|
|
|
127
129
|
## Responsibilities
|
|
128
130
|
|
|
@@ -8,8 +8,10 @@ description: Gate autonomous LLM work on a 6-dimension audit + user-accepted goa
|
|
|
8
8
|
## Loop hygiene (every turn — MANDATORY)
|
|
9
9
|
|
|
10
10
|
**Skill header.** While this skill is active, open every turn with
|
|
11
|
-
`Peaks-Loop Skill: <skill> | Peaks-Loop Gate: <gate> | Next: <one short action>`.
|
|
11
|
+
`Peaks-Loop Skill: <skill> | Peaks-Loop Role: <role> | Peaks-Loop Gate: <gate> | Peaks-Loop Context: <ratio%> (<zone>) | Next: <one short action>`.
|
|
12
12
|
Every turn, not only the first — it is how the user knows which skill is driving.
|
|
13
|
+
`Role` and `Context` are machine facts: copy them from `peaks skill presence --json`
|
|
14
|
+
(`data.role`, `data.context.ratioPct`, `data.context.action`) — never invent them.
|
|
13
15
|
|
|
14
16
|
**Context is this skill's own business.** Run `peaks skill presence --json` every turn and
|
|
15
17
|
read its `context` block. When `action` is `auto-fire`, `pre-compact`, or `red-line`,
|
|
@@ -8,8 +8,10 @@ description: Code-domain loop engineering orchestrator for the Peaks-Loop skill
|
|
|
8
8
|
## Loop hygiene (every turn — MANDATORY)
|
|
9
9
|
|
|
10
10
|
**Skill header.** While this skill is active, open every turn with
|
|
11
|
-
`Peaks-Loop Skill: <skill> | Peaks-Loop Gate: <gate> | Next: <one short action>`.
|
|
11
|
+
`Peaks-Loop Skill: <skill> | Peaks-Loop Role: <role> | Peaks-Loop Gate: <gate> | Peaks-Loop Context: <ratio%> (<zone>) | Next: <one short action>`.
|
|
12
12
|
Every turn, not only the first — it is how the user knows which skill is driving.
|
|
13
|
+
`Role` and `Context` are machine facts: copy them from `peaks skill presence --json`
|
|
14
|
+
(`data.role`, `data.context.ratioPct`, `data.context.action`) — never invent them.
|
|
13
15
|
|
|
14
16
|
**Context is this skill's own business.** Run `peaks skill presence --json` every turn and
|
|
15
17
|
read its `context` block. When `action` is `auto-fire`, `pre-compact`, or `red-line`,
|
|
@@ -18,10 +18,10 @@ The mapping below uses peaks's own paths verbatim. Each row also notes where pea
|
|
|
18
18
|
|
|
19
19
|
| A2A concept | peaks artefact | Path (under `.peaks/_runtime/<session-id>/`) | Notes |
|
|
20
20
|
|---|---|---|---|
|
|
21
|
-
| **AgentCard** (capability advertisement) | `peaks-skill-output-style` +
|
|
21
|
+
| **AgentCard** (capability advertisement) | `peaks-skill-output-style` + the presence lease | `.peaks/_runtime/<sid>/leases/presence-*.json`, `.peaks/_runtime/session.json` | peaks is a *local* tool, not a service. The "card" is the presence lease (read it with `peaks skill presence --json`) plus a peek at `.peaks/PROJECT.md` for human-readable history. There is no `/.well-known/agent-card.json` endpoint. |
|
|
22
22
|
| **Task** (stateful unit of work) | `peaks request` state machine for a single `<rid>` | `.peaks/_runtime/<sid>/{prd,rd,qa,ui,sc}/requests/<rid>.md` (the request artefact); `.peaks/_runtime/<sid>/<role>/session.json` (per-session metadata) | peaks's task lifecycle is `prd:confirmed-by-user → handed-off`, then per role `draft → spec-locked → implemented → qa-handoff`, then `qa:running → verdict-issued`. The full state graph is enforced by `peaks request transition`. A2A's Task object is JSON; peaks's task is **a set of files with a `state` field per role**. |
|
|
23
23
|
| **Artifact** (immutable output) | `rd/tech-doc.md`, `rd/code-review-<rid>.md`, `audit/security-<rid>.md`, `qa/test-cases/<rid>.md`, `qa/test-reports/<rid>.md`, `qa/security-findings.md`, `qa/performance-findings.md`, `sc/handoff.md` | as listed | peaks's artefacts are *append-once*, not strictly immutable: a `qa/test-reports/<rid>.md` may be re-emitted on repair cycles. The convention is "newest write wins; the file at the end of the workflow is the truth", which is close enough to A2A's immutable-Artifact semantics for translation purposes. |
|
|
24
|
-
| **Message** (non-artifact communication) | `peaks skill presence` heartbeat + transition `--reason` notes | `.peaks
|
|
24
|
+
| **Message** (non-artifact communication) | `peaks skill presence` heartbeat + transition `--reason` notes | the presence lease (`.peaks/_runtime/<sid>/leases/presence-*.json`, `lastHeartbeat`), transition notes in `.peaks/_runtime/<sid>/<role>/requests/<rid>.md` | peaks does **not** separate Messages from Artifacts at the storage layer; a "message" is anything that is not the artefact body (the `<!-- peaks-memory:start -->` markers, the `state` field, the `--reason` text on a transition). Treat these as inline metadata of the artefact, not as separate objects. |
|
|
25
25
|
| **Part** (atomic content unit) | Markdown sections within an artefact, frontmatter fields | inline within the artefact | peaks's Artifacts are single Markdown files, so the "Part" concept maps to a heading or a frontmatter field. A `Part`'s `kind` in A2A terms is `text` (the prose), `file` (a `<!-- peaks-memory:start -->` block as a structured chunk), or `data` (the frontmatter). A2A's `form` / `iframe` / video `Part` kinds are not produced by peaks. |
|
|
26
26
|
|
|
27
27
|
## 3. Field-level mapping (A2A Part ↔ peaks frontmatter)
|
|
@@ -96,7 +96,7 @@ A consumer wanting to render a single "feature" object in A2A terms picks the `t
|
|
|
96
96
|
|
|
97
97
|
To keep the mapping honest, peaks-loop **does not** currently provide the following A2A primitives, and consumers should not expect them:
|
|
98
98
|
|
|
99
|
-
- A2A **AgentCard** served over HTTP at `/.well-known/agent-card.json`. peaks-loop is a local CLI; its "card" is the
|
|
99
|
+
- A2A **AgentCard** served over HTTP at `/.well-known/agent-card.json`. peaks-loop is a local CLI; its "card" is the presence lease (`peaks skill presence --json`) plus `peaks skill doctor --json`.
|
|
100
100
|
- A2A **streaming** responses (SSE / WebSocket). peaks commands are synchronous and return a single JSON envelope.
|
|
101
101
|
- A2A **identity / auth** (OAuth, OIDC, mTLS). peaks assumes local-machine trust.
|
|
102
102
|
- A2A **cross-vendor discovery**. peaks has no A2A registry entry; MCP-compatible capabilities are discovered by the LLM via its own tool list (the LLM checks for `mcp__<server>__*` entries in its own function schema) and reported back to the user. Slice #016 retired the `peaks mcp *` indirection layer.
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
After final validation, refresh project-local standards via `peaks standards init/update` (never hand-write). Merge scan-backed changes incrementally; preserve hand-maintained content unless user confirms deletion.
|
|
6
6
|
|
|
7
|
-
Use Peaks-Loop TXT for the compact handoff capsule: mode, validated decisions, artifact paths, standards deltas (`CLAUDE.md` and `.claude/rules/**`
|
|
7
|
+
Use Peaks-Loop TXT for the compact handoff capsule: mode, validated decisions, artifact paths, standards deltas (the `AGENTS.md` body, the optional `CLAUDE.md` pointer, and the rules-tree file statuses under `.peaks/standards/**` or `.claude/rules/**`), open questions, next action. Do not restate the full workflow log.
|
|
8
8
|
|
|
9
9
|
## Workflow completion (no auto-exit)
|
|
10
10
|
|
|
@@ -17,24 +17,23 @@ peaks workspace init --project <repo> --json
|
|
|
17
17
|
The workspace initialization creates this structure under `.peaks/`:
|
|
18
18
|
|
|
19
19
|
```
|
|
20
|
-
# Canonical home for all per-project ephemeral state (
|
|
21
|
-
#
|
|
22
|
-
#
|
|
23
|
-
# `.peaks
|
|
24
|
-
#
|
|
25
|
-
#
|
|
26
|
-
# `
|
|
27
|
-
#
|
|
28
|
-
#
|
|
29
|
-
# other two) to discover session-id / active-skill / sop-state.
|
|
20
|
+
# Canonical home for all per-project ephemeral state (presence leases,
|
|
21
|
+
# session binding, sop-state). All writes go here; reads also tolerate
|
|
22
|
+
# the legacy paths (`.peaks/.session.json` — read-only back-compat for
|
|
23
|
+
# one minor release, `.peaks/sop-state/`) so a fresh upgrade does not
|
|
24
|
+
# break in-flight workflows. Older trees are auto-migrated by
|
|
25
|
+
# `peaks workspace reconcile --apply`. Skills and sub-agents MUST NOT
|
|
26
|
+
# `cat` any of these files directly — use `peaks session info --active
|
|
27
|
+
# --json` (and `peaks skill presence --json` for the presence lease) to
|
|
28
|
+
# discover session-id / presence / sop-state.
|
|
30
29
|
.peaks/_runtime/
|
|
31
|
-
├── active-skill.json # orchestrator presence marker (peaks-code / -rd / -qa / -ui / -sc / -sop / -txt)
|
|
32
30
|
├── session.json # project → session binding (the only single-session source of truth)
|
|
33
31
|
└── sop-state/ # current phase + history; definitions live globally in ~/.peaks
|
|
34
32
|
|
|
35
33
|
# Per-slice artifact dirs (auto-generated, one per session). Files
|
|
36
34
|
# inside ARE tracked by the 提交中间产物 convention.
|
|
37
35
|
.peaks/_runtime/<sessionId>/
|
|
36
|
+
leases/ # presence leases (presence-<callerId>-<workflowId>.json) — read with `peaks skill presence --json`
|
|
38
37
|
prd/source/ # PRD source documents (Feishu exports, pasted content)
|
|
39
38
|
prd/requests/ # PRD request artifacts (goals, non-goals, acceptance, frontend delta)
|
|
40
39
|
ui/requests/ # UI request artifacts (visual direction, taste reports)
|
|
@@ -196,13 +196,13 @@ After RD completes (whether inline or sub-agent), Code does not stop — it must
|
|
|
196
196
|
|
|
197
197
|
**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/bee/peaks-rd/SKILL.md` "Parallel review fan-out") and waits for all to return before transitioning to `qa-handoff`. Code does NOT need to track three separate RD-side sub-runs; the RD role owns the fan-out lifecycle end-to-end. Code's presence restoration after the swarm converges is the only coordination point.
|
|
198
198
|
|
|
199
|
-
**Presence restoration after RD/QA work returns (MANDATORY):** In v1.x, role skills called `peaks skill presence:set <role>` internally and stomped on
|
|
199
|
+
**Presence restoration after RD/QA work returns (MANDATORY):** In v1.x, role skills called `peaks skill presence:set <role>` internally and stomped on the main loop's presence lease. 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 lease is preserved across the fan-out window by construction. The one place Code 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:
|
|
200
200
|
|
|
201
201
|
```bash
|
|
202
202
|
peaks skill presence:set peaks-code --project <repo> --mode <mode> --gate <current-gate>
|
|
203
203
|
```
|
|
204
204
|
|
|
205
|
-
This keeps the CLAUDE.md status header accurate (`Peaks-Loop Skill: peaks-code
|
|
205
|
+
This keeps the CLAUDE.md status header accurate (`Peaks-Loop Skill: peaks-code | Peaks-Loop Role: <role> | Peaks-Loop Gate: <gate> | Peaks-Loop Context: <ratio%> (<zone>) | Next: <one short action>`) instead of showing a stale role name. `Role` and `Context` are machine facts: copy them from `peaks skill presence --json` (`data.role`, `data.context.ratioPct`, `data.context.action`) — never invent them. 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.
|
|
206
206
|
|
|
207
207
|
**Full-auto auto-proceed rule**: In the `full-auto` profile, when RD transitions to `qa-handoff`, Code 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).
|
|
208
208
|
|
|
@@ -9,10 +9,10 @@
|
|
|
9
9
|
Defect A (from PRD-002, 2026-06-28 session 88b27d):
|
|
10
10
|
|
|
11
11
|
1. session A runs in `full-auto` → `peaks skill presence:set peaks-code --mode full-auto --gate startup` stamps
|
|
12
|
-
`.peaks/_runtime/
|
|
12
|
+
the presence lease (`.peaks/_runtime/<sid>/leases/presence-*.json`) with `outerSessionId=outer-A`.
|
|
13
13
|
2. session A closes (Claude window quit).
|
|
14
14
|
3. session B opens (a new Claude window, `outerSessionId=outer-B`).
|
|
15
|
-
4. `peaks skill presence:get --project <path>` still returns `mode=full-auto` because the
|
|
15
|
+
4. `peaks skill presence:get --project <path>` still returns `mode=full-auto` because the lease is on disk.
|
|
16
16
|
5. peaks-code Step 1 reads the presence, sees `mode=full-auto`, **skips** AskUserQuestion.
|
|
17
17
|
6. The user never picked `full-auto` for THIS session — the mode was sticky from the previous one.
|
|
18
18
|
|
|
@@ -119,6 +119,6 @@ peaks skill presence:set peaks-code --mode full-auto --gate startup
|
|
|
119
119
|
|
|
120
120
|
## ACL — what NOT to do
|
|
121
121
|
|
|
122
|
-
- **NEVER** skip Step 1 just because
|
|
122
|
+
- **NEVER** skip Step 1 just because `peaks skill presence --json` shows a `mode` field. Run `presence:check-stale` first.
|
|
123
123
|
- **NEVER** call `peaks skill presence:clear` from peaks-code to "fix" a stale mode. The auto-clear path is `peaks workspace init`'s job; manual clears destroy user-explicit mode choices that may belong to another live outer session.
|
|
124
124
|
- **NEVER** set the presence `mode` field from inside a sub-agent (peaks-rd, peaks-qa, etc.). Sub-agents may read presence to honour the user's chosen mode but the write authority for Step 1 belongs to the peaks-code driver.
|
|
@@ -37,10 +37,10 @@ peaks scan existing-system --project <repo> --json
|
|
|
37
37
|
|
|
38
38
|
# 1. Peaks-Loop Standards preflight + apply
|
|
39
39
|
# Run dry-run first to inspect deltas, then APPLY. In full-auto and 24h modes,
|
|
40
|
-
# --apply is the default — Standards files (
|
|
41
|
-
#
|
|
42
|
-
#
|
|
43
|
-
# between dry-run and apply (AskUserQuestion → re-run with --confirm; no terminal prompt).
|
|
40
|
+
# --apply is the default — Standards files (AGENTS.md body, optional CLAUDE.md pointer,
|
|
41
|
+
# rules tree under .peaks/standards/** or .claude/rules/**) live INSIDE the target
|
|
42
|
+
# project and are required for downstream skill preflight, so producing them is part of
|
|
43
|
+
# completing the workflow. Assisted/Strict modes pause for [CONFIRM] between dry-run and apply (AskUserQuestion → re-run with --confirm; no terminal prompt).
|
|
44
44
|
peaks standards init --project <repo> --dry-run --json
|
|
45
45
|
# or: peaks standards update --project <repo> --dry-run --json
|
|
46
46
|
peaks standards init --project <repo> --apply --json
|
|
@@ -16,9 +16,11 @@ On the first presence:set in a project, ensure the out-of-band status bar is ins
|
|
|
16
16
|
peaks statusline install --project <repo> # idempotent; skips if already installed
|
|
17
17
|
```
|
|
18
18
|
|
|
19
|
-
Then display the compact status header: `Peaks-Loop Skill: peaks-code | Peaks-Loop Gate: startup | Next: <one short action>`. Display this header on EVERY turn while the skill is active.
|
|
19
|
+
Then display the compact status header: `Peaks-Loop Skill: peaks-code | Peaks-Loop Role: <role> | Peaks-Loop Gate: startup | Peaks-Loop Context: <ratio%> (<zone>) | Next: <one short action>`. `Role` and `Context` are machine facts: copy them from `peaks skill presence --json` (`data.role`, `data.context.ratioPct`, `data.context.action`) — never invent them. Display this header on EVERY turn while the skill is active.
|
|
20
20
|
|
|
21
|
-
Update with `peaks skill presence:set peaks-code --project <repo> --mode <mode> --gate <gate>` when gates change. The presence
|
|
21
|
+
Update with `peaks skill presence:set peaks-code --project <repo> --mode <mode> --gate <gate>` when gates change. The presence lease persists across the full workflow lifecycle — it lives at `.peaks/_runtime/<session-id>/leases/presence-*.json` (the canonical path; the project-level `active-skill.json` single-slot files were removed in 4.0.11) — clear is owned by workflow terminalize; follow-up workflows re-claim via new workflow init.
|
|
22
|
+
|
|
23
|
+
Read the live presence back with `peaks skill presence --json`. It reports the active skill, its mode and its gate, and it resolves the lease across the session trees of the project — when the bound tree holds no lease, another tree's live lease is reported instead. Add `--check-stale` to learn WHY nothing is active (`presenceInactive.reason`: `no-leases`, `all-terminal`, `all-stale`, `terminal-and-stale`).
|
|
22
24
|
|
|
23
25
|
## Step 2.5a — Set session title
|
|
24
26
|
|