peaks-loop 4.0.33 → 4.0.34

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 (57) hide show
  1. package/CHANGELOG.md +20 -0
  2. package/dist/cli/commands/code-commands.js +2 -0
  3. package/dist/cli/commands/code-mode-gate-commands.js +3 -3
  4. package/dist/cli/commands/code-mode-status-command.d.ts +17 -0
  5. package/dist/cli/commands/code-mode-status-command.js +51 -0
  6. package/dist/cli/commands/code-run-command.js +8 -1
  7. package/dist/cli/commands/code-runtime-commands.js +13 -5
  8. package/dist/cli/commands/core/skill-command.js +1 -1
  9. package/dist/cli/commands/request-commands.js +3 -7
  10. package/dist/cli/commands/session-24h-mode.js +9 -1
  11. package/dist/services/24h-mode/auto-engage.d.ts +39 -0
  12. package/dist/services/24h-mode/auto-engage.js +46 -0
  13. package/dist/services/24h-mode/decider.d.ts +11 -5
  14. package/dist/services/24h-mode/decider.js +13 -13
  15. package/dist/services/audit/enforcers/active-skill-resolver.d.ts +3 -1
  16. package/dist/services/audit/enforcers/active-skill-resolver.js +3 -5
  17. package/dist/services/code/auto-compact-lifecycle.d.ts +1 -1
  18. package/dist/services/code/auto-compact-lifecycle.js +1 -1
  19. package/dist/services/code/auto-compact-modes.d.ts +1 -1
  20. package/dist/services/code/auto-compact-modes.js +1 -1
  21. package/dist/services/code/auto-compact-orchestrator.js +18 -22
  22. package/dist/services/code/mode-gate.d.ts +6 -2
  23. package/dist/services/code/mode-gate.js +9 -5
  24. package/dist/services/code/orchestrator-can-do.js +2 -2
  25. package/dist/services/config/config-service.d.ts +17 -0
  26. package/dist/services/config/config-service.js +34 -0
  27. package/dist/services/context/auto-compact-dispatcher.d.ts +2 -2
  28. package/dist/services/context/auto-compact-dispatcher.js +4 -4
  29. package/dist/services/context/auto-compact-reader.js +8 -1
  30. package/dist/services/context/auto-compact-types.d.ts +13 -1
  31. package/dist/services/context/build-dispatch-system-prompt.js +2 -2
  32. package/dist/services/context/context-schema.d.ts +1 -1
  33. package/dist/services/hooks/auto-compact-hook-install.d.ts +2 -2
  34. package/dist/services/hooks/auto-compact-hook-install.js +2 -2
  35. package/dist/services/ide/adapters/claude-code-adapter.d.ts +51 -0
  36. package/dist/services/ide/adapters/claude-code-adapter.js +84 -14
  37. package/dist/services/ide/ide-types.d.ts +10 -1
  38. package/dist/services/mode/mode-enforcement.d.ts +4 -1
  39. package/dist/services/mode/mode-enforcement.js +26 -28
  40. package/dist/services/mode/mode-status-service.d.ts +81 -0
  41. package/dist/services/mode/mode-status-service.js +108 -0
  42. package/dist/services/skills/presence-lease-service.d.ts +21 -0
  43. package/dist/services/skills/presence-lease-service.js +26 -0
  44. package/dist/services/skills/skill-presence-service.d.ts +10 -1
  45. package/dist/services/skills/skill-presence-service.js +32 -4
  46. package/dist/services/skills/skill-statusline-service.js +6 -3
  47. package/package.json +5 -5
  48. package/skills/peaks-code/SKILL.md +9 -9
  49. package/skills/peaks-code/references/mode-selection.md +7 -3
  50. package/skills/peaks-code/references/periodic-checkpoint.md +4 -4
  51. package/skills/peaks-code/references/runbook.md +10 -5
  52. package/skills/peaks-code/references/session-overload-signal-index.md +2 -2
  53. package/skills/peaks-code/references/standards-preflight.md +1 -1
  54. package/skills/peaks-code/references/startup-sequence.md +1 -1
  55. package/skills/peaks-code/references/step-0-8-gate.md +1 -1
  56. package/skills/peaks-code/references/swarm-dispatch-contract.md +2 -2
  57. package/skills/peaks-code/references/workflow-gates-and-types.md +1 -1
@@ -10,7 +10,9 @@
10
10
 
11
11
  ## Default runbook — CLI sequence
12
12
 
13
- The end-to-end CLI sequence for the `full-auto` profile. `assisted` and `strict` profiles pause at `[CONFIRM]` markers below. `full-auto` and `swarm` auto-proceed through all gates. See Transition Gates for artifact verification at each stage.
13
+ The end-to-end CLI sequence for the `full-auto` profile. `assisted` and `strict` profiles pause at `[CONFIRM]` markers below. `full-auto` and `24h` auto-proceed through all gates. See Transition Gates for artifact verification at each stage.
14
+
15
+ > **How to resolve a `[CONFIRM]` marker (never a terminal prompt):** the CLI does not read stdin. Without `--confirm` / `--force-confirm` the transition fails with `CONFIRMATION_REQUIRED` and `nextActions`. Code must ask the user via `AskUserQuestion` whether to proceed; if the user approves, re-run the *same* command with `--confirm`. Never wait for a `y/N` prompt — no TTY exists in an LLM-driven session.
14
16
 
15
17
  Canonical single-shot sub-agent dispatch (the `--prompt` flag is required):
16
18
 
@@ -34,11 +36,11 @@ peaks scan existing-system --project <repo> --json
34
36
  # → copy tokens, sources, conventions, inconsistencies into .peaks/_runtime/<session-id>/system/existing-system.md (Peaks-Loop Gate A.5)
35
37
 
36
38
  # 1. Peaks-Loop Standards preflight + apply
37
- # Run dry-run first to inspect deltas, then APPLY. In full-auto and swarm modes,
39
+ # Run dry-run first to inspect deltas, then APPLY. In full-auto and 24h modes,
38
40
  # --apply is the default — Standards files (CLAUDE.md, .claude/rules/**) live INSIDE
39
41
  # the target project and are required for downstream skill preflight, so producing
40
42
  # them is part of completing the workflow. Assisted/Strict modes pause for [CONFIRM]
41
- # between dry-run and apply.
43
+ # between dry-run and apply (AskUserQuestion → re-run with --confirm; no terminal prompt).
42
44
  peaks standards init --project <repo> --dry-run --json
43
45
  # or: peaks standards update --project <repo> --dry-run --json
44
46
  peaks standards init --project <repo> --apply --json
@@ -57,7 +59,8 @@ peaks standards init --project <repo> --apply --json
57
59
  # 若 LLM 看到 peaks-code runbook 里出现老命令(>9 之外的 raw 名字),
58
60
  # 先 `peaks --help` 校验当前 surface,再决定改 runbook 还是改命令。
59
61
 
60
- # 2. Peaks-Loop PRD (Assisted/Strict: [CONFIRM] before confirmed-by-user)
62
+ # 2. Peaks-Loop PRD (Assisted/Strict: [CONFIRM] before confirmed-by-user
63
+ # → AskUserQuestion; on approval re-run the transition with --confirm)
61
64
  # Classify the request type from the PRD: feature | bugfix | refactor | docs | config | chore
62
65
  # This drives RD/QA gate strictness — see "Mandatory RD QA repair loop" for the matrix.
63
66
  peaks request init --role prd --id <rid> --project <repo> --apply --type <type> --json
@@ -139,6 +142,7 @@ ls .peaks/_runtime/<sid>/qa/test-cases/<rid>.md # QA test-cases (
139
142
  ls .peaks/_runtime/<sid>/ui/design-draft.md 2>&1 # non-blocking (Gate B info)
140
143
  # Apply the degradation rules in the main SKILL.md if any artefact is missing.
141
144
  # → Peaks-Loop Gate B convergence check. Assisted/Strict: [CONFIRM]
145
+ # → AskUserQuestion; on approval re-run the transition with --confirm
142
146
 
143
147
  # 4. Peaks-Loop RD planning artifact (the file required by the prerequisite gate)
144
148
  # feature / refactor → write .peaks/_runtime/<id>/rd/tech-doc.md
@@ -163,6 +167,7 @@ peaks request transition <rid> --role qa --state running --project <repo> --json
163
167
  # + .peaks/_runtime/<id>/qa/performance-findings.md (feature/refactor only)
164
168
  peaks request transition <rid> --role qa --state verdict-issued --project <repo> --json
165
169
  # → Peaks-Loop Gate D check. Assisted/Strict: [CONFIRM]
170
+ # → AskUserQuestion; on approval re-run the transition with --confirm
166
171
 
167
172
  # 7. Peaks-Loop RD↔QA repair loop — if verdict is return-to-rd, re-run 4 through 6 until QA passes or blocked TXT.
168
173
  # Before invoking peaks-rd again, check the cycle count so you don't blow past the cap silently:
@@ -289,7 +294,7 @@ peaks code emit-handoff --project <repo> --job-id <jid> --json
289
294
  # job-shape.json says isJob=true, ≥0.85 is MANDATORY auto-compact.
290
295
  # Code MUST call this without confirmation under Job mode.
291
296
  peaks code context-now --project <repo> --enforce-job-mode --json
292
- peaks compact auto --execute --project <repo> --json
297
+ peaks code auto-compact --project <repo> --json
293
298
 
294
299
  # v3.1.2 PreToolUse gate (installed by `peaks workspace init`):
295
300
  # every Bash tool call runs `peaks code gate-step-08` automatically.
@@ -15,8 +15,8 @@ the lookup table the LLM must consult in lieu of intuition.
15
15
 
16
16
  | # | Signal source | Threshold | File / CLI | LLM action |
17
17
  |---|---|---|---|---|
18
- | 1 | prompt size (main session) | 50% / 75% / 80% / 90% | `src/services/context/threshold.ts`; probe via `peaks code context-now` | soft-warn at 50%; consider compact at 75%; MUST NOT auto-compact mid-batch (D6.e); Job mode ≥ 0.85 ⇒ MANDATORY `peaks compact auto --execute` |
19
- | 2 | auto-compact zone | 0.85 pre-compact / 0.95 red-line | `src/services/code/auto-compact-orchestrator.ts`; `--enforce-job-mode` flag | Auto-fires `peaks compact auto --execute`; LLM MUST NOT prompt user to compact (zero-pause contract v2.13.0) |
18
+ | 1 | prompt size (main session) | 50% / 75% / 80% / 90% | `src/services/context/threshold.ts`; probe via `peaks code context-now` | soft-warn at 50%; consider compact at 75%; MUST NOT auto-compact mid-batch (D6.e); Job mode ≥ 0.85 ⇒ MANDATORY `peaks code auto-compact` |
19
+ | 2 | auto-compact zone | 0.85 pre-compact / 0.95 red-line | `src/services/code/auto-compact-orchestrator.ts`; `--enforce-job-mode` flag | Auto-fires `peaks code auto-compact`; LLM MUST NOT prompt user to compact (zero-pause contract v2.13.0) |
20
20
  | 3 | sub-agent dispatch prompt size | 50% / 75% / 80% | `src/services/context/context-guard.ts`; `peaks sub-agent-dispatch-guard` PreToolUse hook | soft-warn at 50%; CONTEXT_NEAR_LIMIT at 75%; hard-reject at 80% (CLI + hook double-guard) |
21
21
  | 4 | statusline compact bar | visual | `src/services/compact-statusline/compact-statusline-service.ts` | ambient UI; surfaces queued/preparing/compacting/verifying/completed/failed/stalled |
22
22
  | 5 | in-flight batch deferral | D6.e | `src/services/code/auto-compact-modes.ts` | defer compact until batch lands (NOT "new session") |
@@ -5,7 +5,7 @@
5
5
  - `peaks standards init --project <path> --dry-run`
6
6
  - `peaks standards update --project <path> --dry-run`
7
7
 
8
- Use `standards init` for first-time creation and `standards update` for existing `CLAUDE.md` append/review behavior. In `full-auto` and `swarm` profiles, `--apply` runs automatically after `--dry-run` succeeds — these files live inside the target project, are required for downstream skill preflight, and producing them is part of finishing the workflow (Peaks-Loop Gate G enforces this). `assisted` and `strict` profiles pause for explicit user confirmation between dry-run and apply.
8
+ Use `standards init` for first-time creation and `standards update` for existing `CLAUDE.md` append/review behavior. In `full-auto` and `24h` profiles, `--apply` runs automatically after `--dry-run` succeeds — these files live inside the target project, are required for downstream skill preflight, and producing them is part of finishing the workflow (Peaks-Loop Gate G enforces this). `assisted` and `strict` profiles pause for explicit user confirmation between dry-run and apply.
9
9
 
10
10
  **CRITICAL — Standards must reflect the project scan.** When generating or updating `CLAUDE.md`, the content must reference concrete findings from `.peaks/project-scan/project-scan.md`: the detected component library (e.g. "This project uses antd 5.x"), CSS solution (e.g. "Uses Less via Umi"), build tool, state management, and routing. Never emit a generic template that says "read .claude/rules/..." without naming the actual project stack. If the project-scan has not been run yet, run it before standards init/update.
11
11
 
@@ -31,7 +31,7 @@ After autonomous work (RD, QA, security, perf), invoke peaks-final-review for 4-
31
31
 
32
32
  ### Peaks-Loop Step N+2: Main-session context monitor (D6 + slice 2026-07-02)
33
33
 
34
- After every 4th tool call, probe via `peaks code context-now --project <repo> --json`. Thresholds: 50% / **0.85 pre-compact / 0.95 red-line** (v2.13.0). **In Job mode ≥ 0.85 is MANDATORY auto-compact** (`peaks compact auto --execute`). Pass `--enforce-job-mode` for single-rid. **≥ 0.95** red line: next Bash/Task fires `peaks compact auto`. **Karpathy §4 exception**: compact red line keeps runner alive — zero-intervention wins; LLM MUST NOT ask user to run `/compact`. Honor `--in-flight-batch` (D6.e).
34
+ After every 4th tool call, probe via `peaks code context-now --project <repo> --json`. Thresholds: 50% / **0.85 pre-compact / 0.95 red-line** (v2.13.0). **In Job mode ≥ 0.85 is MANDATORY auto-compact** (`peaks code auto-compact`). Pass `--enforce-job-mode` for single-rid. **≥ 0.95** red line: next Bash/Task fires `peaks code auto-compact`. **Karpathy §4 exception**: compact red line keeps runner alive — zero-intervention wins; LLM MUST NOT ask user to run `/compact`. Honor `--in-flight-batch` (D6.e).
35
35
 
36
36
  ### Peaks-Loop Step 0: Anchor the workflow (MANDATORY FIRST ACTIONS — no bail-out)
37
37
 
@@ -45,7 +45,7 @@ Refuses to emit a final handoff while `remaining > 0` under Job mode. Pass `--fo
45
45
 
46
46
  ### 3. Forced auto-compact — `--enforce-job-mode`
47
47
 
48
- `peaks code context-now --enforce-job-mode` (auto-enabled when `job-shape.json` says `isJob=true`) returns `action: 'auto-compact-now'` at ≥ 0.85; Code MUST call `peaks compact auto --execute` without confirmation.
48
+ `peaks code context-now --enforce-job-mode` (auto-enabled when `job-shape.json` says `isJob=true`) returns `action: 'auto-compact-now'` at ≥ 0.85; Code MUST call `peaks code auto-compact` without confirmation.
49
49
 
50
50
  ### 4. On-disk slice progress — `progress.json`
51
51
 
@@ -48,7 +48,7 @@ Return a compact JSON envelope — do not write prose.
48
48
  - session-id: <sid> (from .peaks/.active-skill.json or .peaks/.session.json)
49
49
  - request-id: <rid> (PRD id)
50
50
  - type: <type> (feature | bugfix | refactor | config | docs | chore)
51
- - mode: <mode> (full-auto | swarm | assisted | strict)
51
+ - mode: <mode> (full-auto | assisted | strict | 24h)
52
52
  - project-scan-path: <path> (read this for component library / CSS / build tool)
53
53
  - existing-system-path: <path> (legacy projects only)
54
54
  - frontendOnly: <bool> (from project-scan)
@@ -209,7 +209,7 @@ Sub-agent presence in this list = Code launched a Task for it. Absence = the rol
209
209
  | Mode | How the swarm plan is decided | What Code does |
210
210
  |---|---|---|
211
211
  | `full-auto` | Compute plan from signals above, no question to user | Auto-launch all sub-agents in the plan in parallel |
212
- | `swarm` | Same as `full-auto` | Same as `full-auto` (this profile name is historical — behavior is identical) |
212
+ | `24h` | Same as `full-auto` | Same as `full-auto` (long-run profile; the fan-out shape is identical, only the auto-compact cadence differs) |
213
213
  | `assisted` | `AskUserQuestion` with three options: (a) Full — UI + RD(planning) + QA(test-cases); (b) Backend-only — RD(planning) + QA(test-cases); (c) Sequential — run RD first, then QA, skip UI | Use the user's choice as the plan |
214
214
  | `strict` | Same as `assisted` (the question is informational; strict still enforces confirmation gates later) | Same as `assisted` |
215
215
 
@@ -182,5 +182,5 @@ ls <repo>/.claude/rules/common/coding-style.md \
182
182
  # standards init/update with --apply and re-verify.
183
183
  # Skipping Peaks-Loop Gate G (e.g. because the user did not explicitly authorize writes) is
184
184
  # only acceptable in `assisted`/`strict` modes where the user actively declined; in
185
- # `full-auto`/`swarm` the absence of these files is a workflow violation.
185
+ # `full-auto`/`24h` the absence of these files is a workflow violation.
186
186
  ```