peaks-loop 4.0.32 → 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 (111) hide show
  1. package/CHANGELOG.md +39 -0
  2. package/README-en.md +3 -4
  3. package/README.md +20 -28
  4. package/dist/cli/commands/_register.js +4 -3
  5. package/dist/cli/commands/audit-commands.js +12 -39
  6. package/dist/cli/commands/capability-commands.d.ts +6 -0
  7. package/dist/cli/commands/capability-commands.js +20 -2
  8. package/dist/cli/commands/code-commands.js +2 -0
  9. package/dist/cli/commands/code-mode-gate-commands.js +3 -3
  10. package/dist/cli/commands/code-mode-status-command.d.ts +17 -0
  11. package/dist/cli/commands/code-mode-status-command.js +51 -0
  12. package/dist/cli/commands/code-run-command.js +8 -1
  13. package/dist/cli/commands/code-runtime-commands.js +13 -5
  14. package/dist/cli/commands/core/skill-command.js +1 -1
  15. package/dist/cli/commands/ecc-commands.js +3 -2
  16. package/dist/cli/commands/project-commands.js +1 -1
  17. package/dist/cli/commands/request-commands.js +3 -7
  18. package/dist/cli/commands/session-24h-mode.js +9 -1
  19. package/dist/cli/commands/shadcn-commands.d.ts +32 -0
  20. package/dist/cli/commands/shadcn-commands.js +120 -0
  21. package/dist/cli/commands/slice-commands.js +1 -4
  22. package/dist/services/24h-mode/auto-engage.d.ts +39 -0
  23. package/dist/services/24h-mode/auto-engage.js +46 -0
  24. package/dist/services/24h-mode/decider.d.ts +11 -5
  25. package/dist/services/24h-mode/decider.js +13 -13
  26. package/dist/services/audit/enforcers/active-skill-resolver.d.ts +3 -1
  27. package/dist/services/audit/enforcers/active-skill-resolver.js +3 -5
  28. package/dist/services/audit/static-service.d.ts +1 -1
  29. package/dist/services/audit/static-service.js +1 -1
  30. package/dist/services/code/auto-compact-lifecycle.d.ts +1 -1
  31. package/dist/services/code/auto-compact-lifecycle.js +1 -1
  32. package/dist/services/code/auto-compact-modes.d.ts +1 -1
  33. package/dist/services/code/auto-compact-modes.js +1 -1
  34. package/dist/services/code/auto-compact-orchestrator.js +18 -22
  35. package/dist/services/code/mode-gate.d.ts +6 -2
  36. package/dist/services/code/mode-gate.js +9 -5
  37. package/dist/services/code/orchestrator-can-do.js +2 -2
  38. package/dist/services/code-review/ecc-bridge.d.ts +94 -15
  39. package/dist/services/code-review/ecc-bridge.js +133 -13
  40. package/dist/services/config/config-service.d.ts +17 -0
  41. package/dist/services/config/config-service.js +34 -0
  42. package/dist/services/context/auto-compact-dispatcher.d.ts +2 -2
  43. package/dist/services/context/auto-compact-dispatcher.js +4 -4
  44. package/dist/services/context/auto-compact-reader.js +8 -1
  45. package/dist/services/context/auto-compact-types.d.ts +13 -1
  46. package/dist/services/context/build-dispatch-system-prompt.js +2 -2
  47. package/dist/services/context/context-schema.d.ts +1 -1
  48. package/dist/services/dashboard/project-dashboard-service.d.ts +0 -7
  49. package/dist/services/dashboard/project-dashboard-service.js +1 -9
  50. package/dist/services/hooks/auto-compact-hook-install.d.ts +2 -2
  51. package/dist/services/hooks/auto-compact-hook-install.js +2 -2
  52. package/dist/services/ide/adapters/claude-code-adapter.d.ts +51 -0
  53. package/dist/services/ide/adapters/claude-code-adapter.js +84 -14
  54. package/dist/services/ide/ide-types.d.ts +10 -1
  55. package/dist/services/mode/mode-enforcement.d.ts +4 -1
  56. package/dist/services/mode/mode-enforcement.js +26 -28
  57. package/dist/services/mode/mode-status-service.d.ts +81 -0
  58. package/dist/services/mode/mode-status-service.js +108 -0
  59. package/dist/services/preferences/preferences-types.d.ts +16 -7
  60. package/dist/services/recommendations/capability-seed-items.js +0 -1
  61. package/dist/services/recommendations/installed-capability-detector.d.ts +33 -0
  62. package/dist/services/recommendations/installed-capability-detector.js +76 -0
  63. package/dist/services/scan/orphan-service.js +1 -1
  64. package/dist/services/skills/presence-lease-service.d.ts +21 -0
  65. package/dist/services/skills/presence-lease-service.js +26 -0
  66. package/dist/services/skills/skill-presence-service.d.ts +10 -1
  67. package/dist/services/skills/skill-presence-service.js +32 -4
  68. package/dist/services/skills/skill-statusline-service.js +6 -3
  69. package/dist/services/slice/multi-pass-orchestrator.js +0 -13
  70. package/dist/services/slice/slice-decompose-import-edges.d.ts +2 -2
  71. package/dist/services/slice/slice-decompose-import-edges.js +1 -29
  72. package/dist/services/slice/slice-decompose-runners.d.ts +2 -4
  73. package/dist/services/slice/slice-decompose-runners.js +1 -23
  74. package/dist/services/slice/slice-decompose-service.d.ts +3 -4
  75. package/dist/services/slice/slice-decompose-service.js +10 -29
  76. package/dist/services/slice/slice-decompose-types.d.ts +6 -47
  77. package/dist/services/slice/slice-decompose-types.js +3 -2
  78. package/dist/services/slice/slice-topology-types.d.ts +2 -3
  79. package/package.json +5 -5
  80. package/schemas/decomposition-v1.json +0 -12
  81. package/schemas/decomposition-v2.json +1 -15
  82. package/skills/bee/peaks-prd/SKILL.md +0 -1
  83. package/skills/bee/peaks-rd/SKILL.md +1 -1
  84. package/skills/bee/peaks-rd/references/external-references.md +1 -3
  85. package/skills/bee/peaks-rd/references/parallel-review-fanout.md +7 -2
  86. package/skills/bee/peaks-rd/references/rd-fanout-contracts.md +22 -8
  87. package/skills/bee/peaks-rd/references/rd-runbook.md +0 -2
  88. package/skills/bee/peaks-txt/SKILL.md +0 -12
  89. package/skills/peaks-code/SKILL.md +9 -9
  90. package/skills/peaks-code/references/mode-selection.md +7 -3
  91. package/skills/peaks-code/references/periodic-checkpoint.md +4 -4
  92. package/skills/peaks-code/references/runbook.md +10 -5
  93. package/skills/peaks-code/references/session-overload-signal-index.md +2 -2
  94. package/skills/peaks-code/references/standards-preflight.md +1 -1
  95. package/skills/peaks-code/references/startup-sequence.md +1 -1
  96. package/skills/peaks-code/references/step-0-8-gate.md +1 -1
  97. package/skills/peaks-code/references/swarm-dispatch-contract.md +2 -2
  98. package/skills/peaks-code/references/workflow-gates-and-types.md +1 -1
  99. package/skills/peaks-doctor/SKILL.md +1 -1
  100. package/skills/peaks-slice-decompose/SKILL.md +0 -1
  101. package/skills/peaks-slice-decompose/references/v2-schema.md +1 -12
  102. package/dist/cli/commands/understand-commands.d.ts +0 -3
  103. package/dist/cli/commands/understand-commands.js +0 -148
  104. package/dist/services/understand/hybrid-types.d.ts +0 -32
  105. package/dist/services/understand/hybrid-types.js +0 -1
  106. package/dist/services/understand/understand-hybrid-service.d.ts +0 -10
  107. package/dist/services/understand/understand-hybrid-service.js +0 -100
  108. package/dist/services/understand/understand-scan-service.d.ts +0 -28
  109. package/dist/services/understand/understand-scan-service.js +0 -170
  110. package/dist/services/understand/understand-types.d.ts +0 -50
  111. package/dist/services/understand/understand-types.js +0 -1
@@ -4,7 +4,7 @@
4
4
  * The slice-decomposition algorithm is a 6-stage deterministic function
5
5
  * (see `peaks-code/references/slice-algorithm.md` for the full spec):
6
6
  *
7
- * 1. workUnitResolution -- codegraph.query + knowledge_graph.grep
7
+ * 1. workUnitResolution -- codegraph.query
8
8
  * 2. buildDependencyDAG -- real import edges + codegraph.affected fallback
9
9
  * 3. scc + criticalPath -- Tarjan + longest_path on the condensation
10
10
  * 4. minCut -- Stoer-Wagner with semantic-preference weights
@@ -21,7 +21,8 @@
21
21
  * - `peaks-rd` and `peaks-qa` in unit tests
22
22
  * - user inspection via `cat .peaks/sc/slice-decomposition/<rid>.json`
23
23
  *
24
- * Codegraph is local project-analysis evidence; its output is
24
+ * Project analysis is codegraph-first; structural import edges are the
25
+ * fallback. Codegraph is local project-analysis evidence; its output is
25
26
  * **untrusted supporting evidence**, never authoritative for QA verdict.
26
27
  * DecompositionResult fields derived from codegraph are tagged with
27
28
  * `confidence: 'semantic' | 'structural'` so downstream consumers can
@@ -57,9 +58,9 @@ export interface DependencyEdge {
57
58
  weight: number;
58
59
  /** Human-readable evidence: the actual import statement or graph edge. */
59
60
  evidence: string;
60
- /** True iff kind is contains_flow or flow_step (i.e. from understand-anything). */
61
+ /** True iff kind is contains_flow or flow_step (semantic flow edges). */
61
62
  isSemantic: boolean;
62
- /** 'semantic' if the edge came from understand-anything; 'structural' if from import-grep or codegraph. */
63
+ /** 'semantic' for flow edges; 'structural' for import-grep / codegraph edges. */
63
64
  confidence: 'semantic' | 'structural';
64
65
  }
65
66
  export interface WorkEstimate {
@@ -77,7 +78,7 @@ export interface SliceCandidate {
77
78
  files: readonly string[];
78
79
  testsAdded?: readonly string[];
79
80
  estimate: WorkEstimate;
80
- /** Domain anchor; "domain:<name>" if understand-anything indexed, else "file:<path>". */
81
+ /** Domain anchor; always "file:<path>" (codegraph / structural evidence). */
81
82
  semanticAnchor: string;
82
83
  }
83
84
  export interface ParallelBatch {
@@ -126,19 +127,11 @@ export interface CodegraphEnvelope {
126
127
  affectedCrossFile: boolean;
127
128
  note: string;
128
129
  }
129
- export interface UnderstandAnythingEnvelope {
130
- kgNodes: number;
131
- kgEdges: number;
132
- available: boolean;
133
- fallback: 'semantic' | 'structural-only';
134
- note: string;
135
- }
136
130
  export interface DecompositionResult {
137
131
  rid: string;
138
132
  /** ISO 8601 UTC, e.g. "2026-06-13T12:00:00.000Z". */
139
133
  generatedAt: string;
140
134
  codegraph: CodegraphEnvelope;
141
- understandAnything: UnderstandAnythingEnvelope;
142
135
  workUnits: readonly WorkUnit[];
143
136
  dependencyDAG: {
144
137
  edges: readonly DependencyEdge[];
@@ -182,11 +175,6 @@ export interface DecomposeOptions {
182
175
  * Tests pass a function-returning-promise fake.
183
176
  */
184
177
  codegraphRunner?: CodegraphRunner;
185
- /**
186
- * Inject an understand-anything shell replacement. Default reads
187
- * `.understand-anything/knowledge-graph.json` if present.
188
- */
189
- understandRunner?: UnderstandRunner;
190
178
  /**
191
179
  * Inject a function that returns the real import-edge set for a list of files.
192
180
  * Default: spawns `git grep` + parses output. Tests pass a synchronous fake.
@@ -218,35 +206,6 @@ export interface CodegraphAffectedResult {
218
206
  affectedTests: readonly string[];
219
207
  totalDependentsTraversed: number;
220
208
  }
221
- export interface UnderstandRunner {
222
- /** Returns the parsed knowledge graph, or null if not indexed. */
223
- read(projectRoot: string): Promise<KnowledgeGraph | null>;
224
- }
225
- export interface KnowledgeGraph {
226
- nodes: readonly KgNode[];
227
- edges: readonly KgEdge[];
228
- layers: readonly {
229
- id: string;
230
- name: string;
231
- nodeIds: readonly string[];
232
- }[];
233
- }
234
- export type KgNodeType = 'file' | 'function' | 'class' | 'module' | 'concept' | 'config' | 'document' | 'service' | 'table' | 'endpoint' | 'pipeline' | 'schema' | 'resource' | 'domain' | 'flow' | 'step';
235
- export interface KgNode {
236
- id: string;
237
- type: KgNodeType;
238
- name: string;
239
- filePath?: string;
240
- summary?: string;
241
- tags: readonly string[];
242
- complexity?: number;
243
- }
244
- export interface KgEdge {
245
- source: string;
246
- target: string;
247
- type: string;
248
- weight?: number;
249
- }
250
209
  export interface ImportEdgeRunner {
251
210
  /**
252
211
  * Returns real static import edges for the given file paths.
@@ -4,7 +4,7 @@
4
4
  * The slice-decomposition algorithm is a 6-stage deterministic function
5
5
  * (see `peaks-code/references/slice-algorithm.md` for the full spec):
6
6
  *
7
- * 1. workUnitResolution -- codegraph.query + knowledge_graph.grep
7
+ * 1. workUnitResolution -- codegraph.query
8
8
  * 2. buildDependencyDAG -- real import edges + codegraph.affected fallback
9
9
  * 3. scc + criticalPath -- Tarjan + longest_path on the condensation
10
10
  * 4. minCut -- Stoer-Wagner with semantic-preference weights
@@ -21,7 +21,8 @@
21
21
  * - `peaks-rd` and `peaks-qa` in unit tests
22
22
  * - user inspection via `cat .peaks/sc/slice-decomposition/<rid>.json`
23
23
  *
24
- * Codegraph is local project-analysis evidence; its output is
24
+ * Project analysis is codegraph-first; structural import edges are the
25
+ * fallback. Codegraph is local project-analysis evidence; its output is
25
26
  * **untrusted supporting evidence**, never authoritative for QA verdict.
26
27
  * DecompositionResult fields derived from codegraph are tagged with
27
28
  * `confidence: 'semantic' | 'structural'` so downstream consumers can
@@ -17,7 +17,7 @@
17
17
  * `'llm'` because LLM-arbitrated edges are neither — they were guessed
18
18
  * by an LLM and must carry the arbitration trace via `arbitratedBy`.
19
19
  */
20
- import type { CodegraphEnvelope, UnderstandAnythingEnvelope } from './slice-decompose-types.js';
20
+ import type { CodegraphEnvelope } from './slice-decompose-types.js';
21
21
  /** Schema discriminator. v1 files do NOT carry a `schemaVersion` field. */
22
22
  export type SchemaVersion = 'v1' | 'v2';
23
23
  /** How coarse a slice is. */
@@ -51,7 +51,7 @@ export interface SliceV2 {
51
51
  readonly loc: number;
52
52
  /** Parent slice id from the previous pass, or null for Pass 1. */
53
53
  readonly parentSliceId: string | null;
54
- /** Domain anchor; "domain:<name>" if understand-anything indexed, else "file:<path>". */
54
+ /** Domain anchor; always "file:<path>" (codegraph / structural evidence). */
55
55
  readonly semanticAnchor: string;
56
56
  }
57
57
  /** Edge connecting two slices within the same pass. */
@@ -109,7 +109,6 @@ export interface DecompositionResultV2 {
109
109
  readonly crossPassEdges: readonly CrossPassEdge[];
110
110
  readonly llmArbitrations: readonly LlmArbitration[];
111
111
  readonly codegraph: CodegraphEnvelope;
112
- readonly understandAnything: UnderstandAnythingEnvelope;
113
112
  /** True iff any pass failed to complete and the result is a partial. */
114
113
  readonly partial: boolean;
115
114
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "peaks-loop",
3
- "version": "4.0.32",
3
+ "version": "4.0.34",
4
4
  "description": "Loop Engineering CLI — workflow primitive / loop guards / evaluators / slice orchestration",
5
5
  "author": "SquabbyZ",
6
6
  "keywords": [
@@ -101,10 +101,10 @@
101
101
  "fzf": "^0.5.2",
102
102
  "yaml": "^2.9.0",
103
103
  "zod": "^4.4.3",
104
- "peaks-loop-internal-runtime": "0.0.17",
105
- "peaks-loop-shared-channel": "0.0.34",
106
- "peaks-loop-mut": "0.1.30",
107
- "peaks-loop-shared": "0.0.66"
104
+ "peaks-loop-internal-runtime": "0.0.19",
105
+ "peaks-loop-shared": "0.0.68",
106
+ "peaks-loop-shared-channel": "0.0.36",
107
+ "peaks-loop-mut": "0.1.32"
108
108
  },
109
109
  "devDependencies": {
110
110
  "@changesets/cli": "2.31.1",
@@ -8,7 +8,6 @@
8
8
  "rid",
9
9
  "generatedAt",
10
10
  "codegraph",
11
- "understandAnything",
12
11
  "workUnits",
13
12
  "dependencyDAG",
14
13
  "sccAnalysis",
@@ -38,17 +37,6 @@
38
37
  "note": { "type": "string" }
39
38
  }
40
39
  },
41
- "understandAnything": {
42
- "type": "object",
43
- "required": ["kgNodes", "kgEdges", "available", "fallback", "note"],
44
- "properties": {
45
- "kgNodes": { "type": "integer", "minimum": 0 },
46
- "kgEdges": { "type": "integer", "minimum": 0 },
47
- "available": { "type": "boolean" },
48
- "fallback": { "type": "string", "enum": ["semantic", "structural-only"] },
49
- "note": { "type": "string" }
50
- }
51
- },
52
40
  "workUnits": {
53
41
  "type": "array",
54
42
  "items": { "$ref": "#/$defs/WorkUnit" }
@@ -12,7 +12,6 @@
12
12
  "crossPassEdges",
13
13
  "llmArbitrations",
14
14
  "codegraph",
15
- "understandAnything",
16
15
  "partial"
17
16
  ],
18
17
  "properties": {
@@ -45,7 +44,6 @@
45
44
  "items": { "$ref": "#/$defs/LlmArbitration" }
46
45
  },
47
46
  "codegraph": { "$ref": "#/$defs/CodegraphEnvelope" },
48
- "understandAnything": { "$ref": "#/$defs/UnderstandAnythingEnvelope" },
49
47
  "partial": {
50
48
  "type": "boolean",
51
49
  "description": "True iff any pass failed to complete and the result is a partial decomposition."
@@ -88,7 +86,7 @@
88
86
  },
89
87
  "semanticAnchor": {
90
88
  "type": "string",
91
- "description": "Domain anchor; \"domain:<name>\" if understand-anything indexed, else \"file:<path>\"."
89
+ "description": "Domain anchor; always \"file:<path>\" (codegraph / structural evidence)."
92
90
  }
93
91
  }
94
92
  },
@@ -176,18 +174,6 @@
176
174
  "affectedCrossFile": { "type": "boolean" },
177
175
  "note": { "type": "string" }
178
176
  }
179
- },
180
- "UnderstandAnythingEnvelope": {
181
- "type": "object",
182
- "description": "Understand-anything knowledge-graph envelope. `available: false` means semantic-only downstream behaviour is disabled.",
183
- "required": ["kgNodes", "kgEdges", "available", "fallback", "note"],
184
- "properties": {
185
- "kgNodes": { "type": "integer", "minimum": 0 },
186
- "kgEdges": { "type": "integer", "minimum": 0 },
187
- "available": { "type": "boolean" },
188
- "fallback": { "type": "string", "enum": ["semantic", "structural-only"] },
189
- "note": { "type": "string" }
190
- }
191
177
  }
192
178
  }
193
179
  }
@@ -157,7 +157,6 @@ peaks openspec list --project <repo> --json
157
157
  peaks openspec show <change-id> --project <repo> --json # when relevant
158
158
 
159
159
  # 4. surface optional project-analysis evidence for the PRD body
160
- peaks understand status --project <repo> --json # Chrome Code plugin output
161
160
  peaks codegraph status --project <repo> # local index status
162
161
 
163
162
  # 5. write goals / non-goals / acceptance into the artifact body, then hand off
@@ -217,7 +217,7 @@ Codegraph is local project-analysis evidence, scoped to red-line scope boundarie
217
217
 
218
218
  ## Matt Pocock skills integration
219
219
 
220
- Matt Pocock skills (`diagnose` / `triage` / `tdd` / `improve-codebase-architecture` / `prototype`): engineering references only. Inspect before applying; Peaks-Loop RD gates remain authoritative. Understand Anything: `peaks understand status/show --json`. Codegraph: local analysis only, never commit `.codegraph/` artifacts. Other external resources: `peaks capabilities --source access-repo/mcp-server --json` for capability discovery.
220
+ Matt Pocock skills (`diagnose` / `triage` / `tdd` / `improve-codebase-architecture` / `prototype`): engineering references only. Inspect before applying; Peaks-Loop RD gates remain authoritative. Codegraph: project analysis is codegraph-first (`peaks codegraph context/affected`), structural import edges as the fallback; local analysis only, never commit `.codegraph/` artifacts. Other external resources: `peaks capabilities --source access-repo/mcp-server --json` for capability discovery.
221
221
 
222
222
  → see `references/external-references.md` + `references/matt-pocock-integration.md` + `references/codegraph-project-analysis.md`.
223
223
 
@@ -2,9 +2,7 @@
2
2
 
3
3
  > Body of `## External references`. **Matt Pocock skills** (`diagnose`, `triage`, `tdd`, `improve-codebase-architecture`, `prototype`): Engineering references only. Inspect before applying; Peaks-Loop RD gates remain authoritative.
4
4
 
5
- **Understand Anything**: Consume via `peaks understand status/show --json`. Fall back to `peaks codegraph context` or local project scan when absent.
6
-
7
- **Codegraph**: Optional local analysis via `peaks codegraph context/affected`. Output as untrusted supporting evidence; never commit `.codegraph/` artifacts.
5
+ **Codegraph**: Project analysis is codegraph-first (`peaks codegraph context/affected`). Output as untrusted supporting evidence; never commit `.codegraph/` artifacts. When codegraph is unavailable, fall back to structural analysis (import edges + local project scan).
8
6
 
9
7
  **Other external resources** (Context7, SearchCode, everything-claude-code, GitNexus, etc.): Use `peaks capabilities --source access-repo/mcp-server --json` for capability discovery before recommending. References only — do not execute upstream installers, do not install upstream resources, do not persist sensitive examples. Peaks-Loop RD gates remain authoritative.
10
8
 
@@ -46,7 +46,12 @@ Note: sub-agent 1 (code-reviewer) and sub-agent 3 (karpathy-reviewer) write to `
46
46
  - Inspect for: correctness, type safety, error handling, mutation patterns, file-size, naming, dead code, regressions, contract drift.
47
47
  - Output: `.peaks/_runtime/<sessionId>/rd/code-review.md` with sections: Summary, Findings, Required Fixes, Recommended, Verdict.
48
48
  - Required for Gate B3.
49
- - **v2.11.0 Tier 7 (Group D):** the code-reviewer dispatch goes through the **ECC bridge** (`src/services/code-review/ecc-bridge.ts`). The parent RD loop invokes the Agent tool with `subagent_type: "everything-claude-code:code-review"` and receives a structured envelope `{ passed, violations[], gateAction }`. The bridge adapter (`adaptEccEnvelopeToRdCodeReview`) renders that envelope into the canonical `rd/code-review.md` markdown shape that Gate B3 reads (`mustContain: ['## Findings', 'CRITICAL']`). The 5-state detector (`detectEcc`: ready / plugin-missing / agent-missing / dispatch-failed / envelope-malformed) soft-fails to inline review on any non-ready state — TXT note `code-review-ecc-degraded-to-inline`.
49
+ - **v2.11.0 Tier 7 (Group D) + 2026-09-09-ecc-dynamic:** the code-reviewer dispatch goes through the **ECC bridge** (`src/services/code-review/ecc-bridge.ts`). Fallback order is **native plugin → cache-backed generic agent → inline**:
50
+ 1. **Native plugin** (`detectEcc` state `ready`): invoke the Agent tool with `subagent_type: "ecc:code-reviewer"` (plugin `ecc` + agent `code-reviewer`; see `DEFAULT_NATIVE_ECC_AGENT_ID`); it returns the structured envelope `{ passed, violations[], gateAction }`.
51
+ 2. **Cache-backed generic agent** (`detectEcc` state `ready-via-cache` — plugin or its review agent absent, but a materialized ECC agent exists under `~/.peaks/agents/ecc/`): resolve the agent's REAL name first — `resolveMaterializedAgentName(['code-reviewer', 'code-review'])` from `peaks-loop-mut` (upstream ships `code-reviewer.md`; a hardcoded `code-review.md` never resolves). Read `~/.peaks/agents/ecc/<resolved>.md`, pass the name through as `detectEcc({ ..., cacheAgentName: resolved })`, build the prompt with `buildCacheBackedEccPrompt({ rid, instructions, diff })` (agent body + diff + `ECC_OUTPUT_CONTRACT`), dispatch a **generic** sub-agent, and validate its reply with `isEccEnvelope`. No ECC plugin required. If the cache is empty, run `peaks ecc install` first (dynamic acquisition); if that fails offline, degrade to inline.
52
+ 3. **Inline** (`detectEcc` states `plugin-missing` / `agent-missing` / `dispatch-failed` / `envelope-malformed`): fall back to inline review — TXT note `code-review-ecc-degraded-to-inline`.
53
+
54
+ In all dispatchable cases the envelope is rendered by the SAME bridge adapter (`adaptEccEnvelopeToRdCodeReview`) into the canonical `rd/code-review.md` markdown shape that Gate B3 reads (`mustContain: ['## Findings', 'CRITICAL']`). The materialized copy lives under `~/.peaks/agents/ecc/` — peaks-loop NEVER writes into `~/.claude/`.
50
55
 
51
56
  **Sub-agent 2 — qa-test-cases-writer (always runs for feature / refactor / bugfix):**
52
57
  - Read the git diff and the PRD acceptance criteria.
@@ -82,7 +87,7 @@ Note: sub-agent 1 (code-reviewer) and sub-agent 3 (karpathy-reviewer) write to `
82
87
 
83
88
  **Degradation when a sub-agent fails or returns blocked:**
84
89
  - code-review sub-agent fails: fall back to inline RD code review. TXT handoff note: `code-review-subagent-degraded-to-inline`.
85
- - code-review sub-agent runs the ECC bridge but ECC is unavailable (plugin-missing / agent-missing / dispatch-failed / envelope-malformed per `detectEcc`): fall back to inline RD code review. TXT handoff note: `code-review-ecc-degraded-to-inline`.
90
+ - code-review sub-agent runs the ECC bridge but neither the native plugin nor the cache-backed path is available (plugin-missing / agent-missing / dispatch-failed / envelope-malformed per `detectEcc`): fall back to inline RD code review. TXT handoff note: `code-review-ecc-degraded-to-inline`.
86
91
  - qa-test-cases sub-agent fails: fall back to inline QA test-case drafting at the start of QA's main loop. TXT note: `qa-test-cases-subagent-degraded-to-inline-qa-draft`.
87
92
  - karpathy-reviewer sub-agent fails: NOT degradeable — its failure blocks qa-handoff. Per karpathy §1 Think Before Coding + §3 Surgical Changes, the file MUST exist with the gate header + at least one guideline marker.
88
93
  - 2 or more fail: do not hand off as clean; transition to `qa-handoff` with `--allow-incomplete --reason "<degradation>"` OR block.
@@ -29,14 +29,28 @@ end of implementation, RD fires 3 sub-agents in parallel via
29
29
  > **Karpathy pointer (Slice 1/6):** Each of the 3 sub-agents below operates under the 4 Karpathy guidelines. The canonical reference is `andrej-karpathy-skills:karpathy-guidelines` (full text) and `peaks-rd/SKILL.md` §"Karpathy enforcement". The dispatch primitive also injects the verbatim context block from `rd-sub-agent-dispatch.md` §"Karpathy-guidelines context" into every sub-agent prompt. Sub-agents MUST NOT silently drop the block.
30
30
 
31
31
  - **Sub-agent 1 — code-reviewer** runs `code-review` against the diff and
32
- writes `rd/code-review.md`. **v2.11.0 Tier 7 (Group D):** the dispatch goes
33
- through the **ECC bridge** (`src/services/code-review/ecc-bridge.ts`):
34
- `Agent({ subagent_type: 'everything-claude-code:code-review', ... })` returns
35
- `{ passed, violations[], gateAction }`; `adaptEccEnvelopeToRdCodeReview`
36
- renders it to the canonical markdown. On any non-ready `detectEcc` state
37
- (plugin-missing / agent-missing / dispatch-failed / envelope-malformed) the
38
- parent RD loop falls back to inline review; the `code-review-ecc-degraded-to-inline`
39
- TXT note records the fallback.
32
+ writes `rd/code-review.md`. **v2.11.0 Tier 7 (Group D) + 2026-09-09-ecc-dynamic:**
33
+ the dispatch goes through the **ECC bridge** (`src/services/code-review/ecc-bridge.ts`)
34
+ with fallback order **native plugin → cache-backed generic agent → inline**:
35
+ - `detectEcc` state `ready` → `Agent({ subagent_type: 'ecc:code-reviewer', ... })`
36
+ (`DEFAULT_NATIVE_ECC_AGENT_ID` — plugin `ecc` + agent `code-reviewer`)
37
+ returns `{ passed, violations[], gateAction }`.
38
+ - `detectEcc` state `ready-via-cache` → resolve the materialized agent's REAL
39
+ name with `resolveMaterializedAgentName(['code-reviewer', 'code-review'])`
40
+ (upstream ships `code-reviewer.md`; a hardcoded `code-review.md` never
41
+ resolves), read `~/.peaks/agents/ecc/<resolved>.md`, pass it through as
42
+ `detectEcc({ ..., cacheAgentName: resolved })`, compose the prompt with
43
+ `buildCacheBackedEccPrompt({ rid, instructions, diff })`,
44
+ dispatch a **generic** sub-agent, and validate the reply with `isEccEnvelope`.
45
+ If the cache is empty, run `peaks ecc install` first (dynamic acquisition);
46
+ offline → inline.
47
+ - Any other state (plugin-missing / agent-missing / dispatch-failed /
48
+ envelope-malformed) → inline review; the `code-review-ecc-degraded-to-inline`
49
+ TXT note records the fallback.
50
+
51
+ Every dispatchable envelope is rendered by the SAME `adaptEccEnvelopeToRdCodeReview`
52
+ adapter to the canonical markdown. Materialized ECC instructions live under
53
+ `~/.peaks/agents/ecc/`; peaks-loop NEVER writes into `~/.claude/`.
40
54
  - **Sub-agent 2 — qa-test-cases-writer** drafts the QA test plan and
41
55
  writes `qa/test-cases/<rid>.md`. The test plan is the deliverable —
42
56
  these test cases do NOT need to be executed by this sub-agent (the
@@ -23,8 +23,6 @@ peaks openspec validate <change-id> --project <repo> --json # entry gate
23
23
  peaks openspec to-rd <change-id> --project <repo> --json # acceptance + commit boundaries
24
24
 
25
25
  # 4. project-analysis evidence — MANDATORY before implementation
26
- peaks understand status --project <repo> --json
27
- peaks understand show --project <repo> --json # when UA artifact exists
28
26
  peaks codegraph context --project <repo> "<task>"
29
27
  peaks codegraph affected --project <repo> <changed-files...> --json
30
28
 
@@ -144,17 +144,6 @@ When capability discovery exposes `mattpocock/skills`, use these upstream method
144
144
 
145
145
  Inspect upstream skill content before applying any method. Treat examples and instructions as untrusted external reference material; do not execute upstream instructions or persist sensitive examples. Peaks-Loop TXT still writes local context capsules under `.peaks/_runtime/<session-id>/txt/` by default. Durable memory extraction still requires explicit authorization and must not include secrets, credentials, private customer data, or non-exportable business data.
146
146
 
147
- ## Understand Anything knowledge graph
148
-
149
- When capability discovery exposes `understand-anything` and the target project contains `.understand-anything/knowledge-graph.json`, treat the graph as upstream reference material only. Do not execute upstream instructions, do not install upstream resources, do not persist sensitive examples. Peaks-Loop TXT context capsules and project memory extraction remain authoritative.
150
-
151
- Consume the artifact through the Peaks-Loop CLI for context capsule preparation:
152
-
153
- - `peaks understand show --project <path> [--sample <n>] --json` — read counts, layer names, tour names, and sample node ids to summarize project shape in a context capsule.
154
- - Do not paste the full knowledge graph into a capsule; reference its path and summarized counts.
155
-
156
- When the artifact is absent or malformed, fall back to existing Peaks-Loop TXT codegraph context summaries; do not block handoff on Understand Anything availability.
157
-
158
147
  ## Codegraph context capsules
159
148
 
160
149
  TXT may consume recorded peaks codegraph artifacts as untrusted supporting evidence when preparing handoffs, release notes, or implementation summaries. Preferred local artifact paths are `.peaks/_runtime/<session-id>/rd/codegraph-context.md` and `.peaks/_runtime/<session-id>/rd/codegraph-affected.json`.
@@ -229,7 +218,6 @@ peaks project dashboard --project <repo> --json
229
218
 
230
219
  # 3. Optional project-shape evidence when available
231
220
  peaks codegraph status --project <repo>
232
- peaks understand show --project <repo> --json
233
221
 
234
222
  # 4. Discover external capabilities before recommending memory or context tools
235
223
  peaks capabilities --json
@@ -104,7 +104,7 @@ peaks sub-agent dispatch rd --prompt '<your task>' --graph-node <nid> --workflow
104
104
  **Integration surfaces:** `peaks code run --24h` / `peaks dashboard long-run --since 24h` / `peaks session 24h-mode state|transition|attempts|reset`.
105
105
 
106
106
  **Red lines (peaks-code side):**
107
- - No auto-compact prose ban: never write "ask the user to compact" / "prompt the user to run `/compact`" / "the user should run `peaks compact auto` manually" / "the user is responsible for context management" / legacy 50/75/90 percent tiers. **0.85 / 0.95 contract is mandatory.**
107
+ - No auto-compact prose ban: never write "ask the user to compact" / "prompt the user to run `/compact`" / "the user should run `peaks code auto-compact` manually" / "the user is responsible for context management" / legacy 50/75/90 percent tiers. **0.85 / 0.95 contract is mandatory.**
108
108
  - SquabbyZ sole-author rule: no `Co-Authored-By: Claude/Anthropic` trailer.
109
109
  - 24h mode is a flag on `peaks-code`; MUST NOT introduce a sibling `peaks-24h` skill or competing top-level verb.
110
110
 
@@ -151,7 +151,7 @@ Before the first planning action, run `peaks fresh-context preflight --prompt "<
151
151
  1. **PreToolUse hook — `peaks code gate-step-08`.** Installed by `peaks workspace init` on the `Bash` matcher; checks `job-shape.json` presence + fail-closed backup regex. If `job-shape.json` AND `progress.json` exist, surfaces `Next: slice #N of M (<currentSlice>)` so the LLM cannot wake up cold.
152
152
  2. **Size-fear ban — `peaks code emit-handoff`.** Refuses to emit a final handoff while `remaining > 0` under Job mode. Pass `--force-under-job` only with explicit user approval.
153
153
  3. **On-disk slice progress — `peaks job progress`.** `peaks job checkpoint --state done` writes `progress.json`. `peaks job progress --job-id <jid> [--allow-missing]` is the canonical reader.
154
- 4. **Forced auto-compact — `--enforce-job-mode`.** `peaks code context-now --enforce-job-mode` returns `action: 'auto-compact-now'` at ≥ 0.85. **Job mode at ≥ 0.85 is MANDATORY auto-compact** — Code MUST call `peaks compact auto --execute` without confirmation.
154
+ 4. **Forced auto-compact — `--enforce-job-mode`.** `peaks code context-now --enforce-job-mode` returns `action: 'auto-compact-now'` at ≥ 0.85. **Job mode at ≥ 0.85 is MANDATORY auto-compact** — Code MUST call `peaks code auto-compact` without confirmation.
155
155
 
156
156
  **Step 0.7 resume rule (read-FIRST):** on resume, `peaks code gate-step-08` reads `progress.json` first and surfaces `Next: slice #N of M (<currentSlice>)` so the orchestrator picks up at the right slice without re-reading the artifact tree.
157
157
 
@@ -161,26 +161,26 @@ Before the first planning action, run `peaks fresh-context preflight --prompt "<
161
161
 
162
162
  ### Peaks-Loop Step N+2: Auto-compact at the warning line (v2.13.0 zero-pause contract)
163
163
 
164
- > **Zero-pause contract.** When context usage crosses the pre-compact threshold, peaks-loop **automatically fires `peaks compact auto --execute` — the LLM does NOT prompt the user to run `/compact` manually**. Stale prose that says "ask the user to compact" silently stalls the workflow. The v2.13.0 contract makes auto-compact a system responsibility, not a user action.
164
+ > **Zero-pause contract.** When context usage crosses the pre-compact threshold, peaks-loop **automatically fires `peaks code auto-compact` — the LLM does NOT prompt the user to run `/compact` manually**. Stale prose that says "ask the user to compact" silently stalls the workflow. The v2.13.0 contract makes auto-compact a system responsibility, not a user action.
165
165
 
166
166
  **Thresholds (v2.13.0, replacing legacy 50/75/90):**
167
167
 
168
168
  | ratio zone | zone name | action |
169
169
  |---|---|---|
170
170
  | `< 0.85` | normal | skip — LLM keeps working |
171
- | `0.85 ≤ ratio < 0.95` | **pre-compact zone** | `peaks compact auto --execute` fires **automatically** (deferred only when in-flight sub-agent batch is running; fires the moment the batch lands). The LLM does not prompt the user. |
172
- | `ratio ≥ 0.95` | **red-line (Karpathy §4)** | synchronous gate — `peaks compact auto --execute` invoked immediately; `peaks code context-now` returns `action: 'red-line'` and refuses to advance until ratio drops below 0.85. **Karpathy §4 automatic exception** — LLM cannot opt out. |
171
+ | `0.85 ≤ ratio < 0.95` | **pre-compact zone** | `peaks code auto-compact` fires **automatically** (deferred only when in-flight sub-agent batch is running; fires the moment the batch lands). The LLM does not prompt the user. |
172
+ | `ratio ≥ 0.95` | **red-line (Karpathy §4)** | synchronous gate — `peaks code auto-compact` invoked immediately; `peaks code context-now` returns `action: 'red-line'` and refuses to advance until ratio drops below 0.85. **Karpathy §4 automatic exception** — LLM cannot opt out. |
173
173
 
174
- **Probe primitive (single source of truth):** `peaks code context-now --json`. Do NOT use `peaks context check --prompt-size` (deprecated, will silently under-report ratio). Returns `{ ratio, action: 'ok' | 'soft-warn' | 'auto-compact-now' | 'red-line' }` — Code reads `action` and dispatches `peaks compact auto --execute` on `auto-compact-now` or `red-line` without user confirmation.
174
+ **Probe primitive (single source of truth):** `peaks code context-now --json`. Do NOT use `peaks context check --prompt-size` (deprecated, will silently under-report ratio). Returns `{ ratio, action: 'ok' | 'soft-warn' | 'auto-compact-now' | 'red-line' }` — Code reads `action` and dispatches `peaks code auto-compact` on `auto-compact-now` or `red-line` without user confirmation.
175
175
 
176
176
  **Enforcement layers (defense in depth):**
177
177
  1. `src/services/code/auto-compact-orchestrator.ts` — `evaluateAutoCompactDecision` default-returns `shouldCompact: true` for both `pre-compact` and `red-line`. Only deferral is `inFlightBatch.hasInFlightBatch` (D6.e); no LLM/human approval branch.
178
178
  2. `--enforce-job-mode` (v3.1.2) — Job mode elevates ≥0.85 to MANDATORY regardless of in-flight batch.
179
179
  3. `peaks code gate-step-08` (PreToolUse hook) — surfaces `auto-compact-now` on every Bash call when ratio is in the zone, so the LLM cannot wake up cold and forget.
180
- 4. Karpathy §4 exception: `peaks compact auto --execute` is fired *by the orchestrator*, not by the user. If you find yourself about to write "ask the user to compact" / "prompt the user to run `/compact`", STOP — that is the regression.
180
+ 4. Karpathy §4 exception: `peaks code auto-compact` is fired *by the orchestrator*, not by the user. If you find yourself about to write "ask the user to compact" / "prompt the user to run `/compact`", STOP — that is the regression.
181
181
 
182
182
  **Anti-pattern (DO NOT introduce):** any of these strings in skills/* or comments signals the zero-pause contract has been broken:
183
- - "ask the user to compact" / "prompt the user to run `/compact`" / "the user should run `peaks compact auto` manually" / "the user is responsible for context management" / legacy mid/seventy-five/ninety percent tiers (current is 0.85 / 0.95).
183
+ - "ask the user to compact" / "prompt the user to run `/compact`" / "the user should run `peaks code auto-compact` manually" / "the user is responsible for context management" / legacy mid/seventy-five/ninety percent tiers (current is 0.85 / 0.95).
184
184
 
185
185
  If the prose audit (`peaks audit red-lines`) flags any of the above, the slice is **blocked** until the prose is rewritten.
186
186
 
@@ -270,7 +270,7 @@ After `peaks-rd` finishes, Code MUST auto-route to `peaks-qa` without waiting fo
270
270
 
271
271
  ## Default runbook
272
272
 
273
- The end-to-end CLI sequence for `full-auto` lives in `references/runbook.md`. `assisted`/`strict` pause at `[CONFIRM]`; `full-auto`/`swarm` auto-proceed.
273
+ The end-to-end CLI sequence for `full-auto` lives in `references/runbook.md`. `assisted`/`strict` pause at `[CONFIRM]`; `full-auto`/`24h` auto-proceed. At a `[CONFIRM]` gate the CLI never prompts: the transition throws `CONFIRMATION_REQUIRED`, so Code asks the user via `AskUserQuestion` and, on approval, re-runs the same command with `--confirm`. Never expect or ask for a terminal `y/N` prompt.
274
274
 
275
275
  When adding new CLI commands, mirror into `references/runbook.md` and `tests/unit/skill-default-runbook.test.ts` (test falls back to the reference).
276
276
 
@@ -3,8 +3,8 @@
3
3
  > Body of `### Peaks-Loop Step 1`. After Step 0 has anchored the workspace and presence, when the user invokes Peaks-Loop Code without explicitly naming an execution profile, use `AskUserQuestion` to pick the profile. Present the recommended full-auto path as the first/default option with a practical description for each:
4
4
 
5
5
  1. **Full auto (Recommended)** — Peaks-Loop handles planning, role coordination, validation, and compact handoff end-to-end while preserving required confirmation gates for risky or shared-state actions.
6
- 2. **Assisted** — Peaks-Loop proposes plans, artifacts, and checks, then pauses for user decisions at major workflow boundaries.
7
- 3. **Swarm** — Peaks-Loop maximizes safe parallel role/worker execution for larger RD or QA workloads while keeping reducer validation and artifact boundaries explicit.
6
+ 2. **24h** — Long-run autonomy profile: auto-proceed gates, periodic checkpoints, and the partial auto-compact cadence for overnight / multi-hour runs. It may be auto-engaged by the T1–T5 triggers without a pick.
7
+ 3. **Assisted** — Peaks-Loop proposes plans, artifacts, and checks, then pauses for user decisions at major workflow boundaries.
8
8
  4. **Strict** — Peaks-Loop uses the most conservative gates: explicit confirmations, strict slice specs, coverage evidence, QA acceptance, and commit boundaries before continuing.
9
9
 
10
10
  Map the user's selection to the `--mode` flag value (used by `peaks skill presence:set`; `presence:set --mode` accepts any string, so the name matches the user-facing label rather than overloading "code" which is also the skill name):
@@ -12,10 +12,14 @@ Map the user's selection to the `--mode` flag value (used by `peaks skill presen
12
12
  | User selects | `--mode` value |
13
13
  |---|---|
14
14
  | Full auto | `full-auto` |
15
+ | 24h | `24h` |
15
16
  | Assisted | `assisted` |
16
- | Swarm | `swarm` |
17
17
  | Strict | `strict` |
18
18
 
19
+ > Note: in `assisted` / `strict`, a workflow-boundary confirmation is resolved by asking the user via `AskUserQuestion` and, on approval, re-running the same CLI command with `--confirm`. The CLI never opens a terminal prompt (no stdin read, no `y/N`) — an LLM-driven session has no TTY.
20
+
21
+ > Note: parallel role/worker fan-out is the default execution strategy in **every** mode — it is not a mode of its own. The old `swarm` profile was removed; a legacy on-disk `mode: 'swarm'` is read as `full-auto`.
22
+
19
23
  > Note: `peaks workflow route --mode code|team` is a **different** CLI dimension (code developer vs team flow) and is unrelated to the profile choice here. Do not conflate them.
20
24
 
21
25
  If the user already names a profile in their invocation (e.g. `/peaks-code --full-auto`, "用全自动模式"), skip this question and use the named profile directly.
@@ -72,10 +72,10 @@ This step is strictly IDE-agnostic. The LLM calls the peaks CLI; no IDE-specific
72
72
 
73
73
  ## Companion surface — auto-compact (zero-pause)
74
74
 
75
- When the runner crosses the v2.13.0 auto-compact thresholds (0.85 pre-compact / 0.95 red-line), `peaks session checkpoint` is NOT enough on its own — the LLM must also fire `peaks compact auto --execute` (or wait for the in-band PreToolUse hook at ratio ≥ 0.95 to compact the runner itself). See:
75
+ When the runner crosses the v2.13.0 auto-compact thresholds (0.85 pre-compact / 0.95 red-line), `peaks session checkpoint` is NOT enough on its own — the LLM must also fire `peaks code auto-compact` (or wait for the in-band PreToolUse hook at ratio ≥ 0.95 to compact the runner itself). See:
76
76
 
77
- - `peaks compact auto --execute` — orchestrator that writes the convergence plan + dispatches the compact pathway
78
- - `peaks compact auto` — the PreToolUse hook entrypoint fired by `.claude/settings.local.json` (slice 2026-07-02-auto-compact-zero-pause)
77
+ - `peaks code auto-compact` — orchestrator that writes the convergence plan + dispatches the compact pathway
78
+ - `peaks code auto-compact` — the PreToolUse hook entrypoint fired by `.claude/settings.local.json` (slice 2026-07-02-auto-compact-zero-pause)
79
79
  - `.peaks/memory/2026-06-27-auto-compact-design.md` — zero-human-intervention design rationale
80
80
 
81
- The two surfaces compose: `peaks session checkpoint` persists the context state, `peaks compact auto` collapses the runner's window. The LLM fires both in the 0.85–0.95 zone; the hook fires alone at ≥ 0.95.
81
+ The two surfaces compose: `peaks session checkpoint` persists the context state, `peaks code auto-compact` collapses the runner's window. The LLM fires both in the 0.85–0.95 zone; the hook fires alone at ≥ 0.95.
@@ -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