gentle-pi 2.7.0 → 3.0.0

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 (122) hide show
  1. package/README.md +24 -6
  2. package/assets/agents/gentle-ai-worker.md +5 -1
  3. package/assets/agents/sdd-apply.md +9 -7
  4. package/assets/agents/sdd-archive.md +42 -23
  5. package/assets/agents/sdd-proposal.md +2 -2
  6. package/assets/agents/sdd-remediate.md +4 -4
  7. package/assets/agents/sdd-research.md +20 -48
  8. package/assets/agents/sdd-tasks.md +5 -5
  9. package/assets/agents/sdd-verify.md +6 -28
  10. package/assets/chains/sdd-full.chain.md +4 -22
  11. package/assets/chains/sdd-verify.chain.md +3 -12
  12. package/assets/orchestrator-delegation.md +33 -3
  13. package/assets/orchestrator-memory.md +20 -7
  14. package/assets/orchestrator.md +5 -3
  15. package/assets/sdd-orchestrator-workflow.md +25 -58
  16. package/assets/support/sdd-status-contract.md +9 -12
  17. package/docs/gentle-shell.md +14 -4
  18. package/docs/readme-reference.md +171 -32
  19. package/extensions/codegraph-tools.ts +2 -0
  20. package/extensions/gentle-agents.ts +281 -361
  21. package/extensions/gentle-ai.ts +588 -117
  22. package/extensions/gentle-shell.ts +74 -30
  23. package/extensions/pi-pretty.ts +63 -14
  24. package/extensions/quiet-tools.ts +1 -2
  25. package/extensions/startup-banner.ts +10 -9
  26. package/lib/agent-home.ts +8 -0
  27. package/lib/agent-profile-pin.ts +336 -0
  28. package/lib/agent-profiles.ts +28 -8
  29. package/lib/agents-config.ts +24 -2
  30. package/lib/agents-history.ts +3 -97
  31. package/lib/agents-keys.ts +27 -0
  32. package/lib/agents-protocol.ts +2 -15
  33. package/lib/agents-runner.ts +67 -111
  34. package/lib/agents-session-transport.ts +691 -0
  35. package/lib/command-palette-catalog.ts +87 -0
  36. package/lib/command-palette.ts +346 -0
  37. package/lib/native-choice-list.ts +5 -0
  38. package/lib/native-review-cli.ts +10 -97
  39. package/lib/review-publication-gate.ts +11 -1
  40. package/lib/review-repository.ts +1 -1
  41. package/lib/review-snapshot.ts +1 -0
  42. package/lib/review-transaction.ts +4 -2
  43. package/lib/sdd-preflight.ts +2 -1
  44. package/lib/sdd-research-capabilities.ts +18 -152
  45. package/lib/sdd-status.ts +7 -779
  46. package/lib/session-change-capture.ts +2 -1
  47. package/lib/session-changes.ts +8 -1
  48. package/lib/shell-bar.ts +21 -12
  49. package/lib/shell-card.ts +8 -12
  50. package/lib/shell-changes.ts +3 -2
  51. package/lib/shell-prompt.ts +25 -8
  52. package/lib/shell-sidebar-banner.ts +2 -2
  53. package/lib/shell-sidebar-layout.ts +5 -2
  54. package/lib/windows-session-transport.ts +877 -0
  55. package/package.json +3 -3
  56. package/runtime/native-review-cli.mjs +9 -96
  57. package/runtime/windows-session-transport.ps1 +791 -0
  58. package/scripts/test-packed-runner.mjs +1668 -20
  59. package/scripts/verify-package-files.mjs +0 -1
  60. package/tests/agent-home.test.ts +52 -0
  61. package/tests/agent-profiles.test.ts +30 -1
  62. package/tests/agents-config.test.ts +44 -0
  63. package/tests/agents-history.test.ts +12 -24
  64. package/tests/agents-runner.test.ts +307 -58
  65. package/tests/agents-session-transport-process.test.ts +249 -0
  66. package/tests/agents-session-transport.test.ts +823 -0
  67. package/tests/artifact-language.test.ts +10 -7
  68. package/tests/command-palette.test.ts +378 -0
  69. package/tests/delegated-key-learnings-contract.test.ts +2 -2
  70. package/tests/fixtures/agents-session-transport-process.mjs +108 -0
  71. package/tests/fixtures/legacy/sdd-research-v2.5.0.md +54 -0
  72. package/tests/fixtures/windows-session-bootstrap.ps1 +129 -0
  73. package/tests/fixtures/windows-session-compile.ps1 +110 -0
  74. package/tests/gentle-agents.test.ts +849 -356
  75. package/tests/gentle-ai.test.ts +472 -4
  76. package/tests/gentle-shell.test.ts +201 -8
  77. package/tests/native-choice-list.test.ts +13 -0
  78. package/tests/native-review-cli.test.ts +0 -33
  79. package/tests/odd-routing-contract.test.ts +208 -0
  80. package/tests/orchestrator-budget.test.ts +17 -2
  81. package/tests/package-manifest.test.ts +115 -27
  82. package/tests/persona-single-channel.test.ts +3 -3
  83. package/tests/pi-pretty.test.ts +45 -0
  84. package/tests/profile-pin.test.ts +370 -0
  85. package/tests/quiet-tool-rendering.test.ts +32 -5
  86. package/tests/review-contract-prompt.test.ts +9 -0
  87. package/tests/review-controller.test.ts +0 -44
  88. package/tests/review-session-standing-permission-ipc.test.ts +427 -13
  89. package/tests/runtime-harness.mjs +4 -4
  90. package/tests/sdd-agent-tools.test.ts +15 -36
  91. package/tests/sdd-archive-replay.test.ts +82 -0
  92. package/tests/sdd-classical-continuation.test.ts +74 -0
  93. package/tests/sdd-execution-routing-contract.test.ts +18 -2
  94. package/tests/sdd-managed-runtime-settlement.test.ts +42 -330
  95. package/tests/sdd-native-managed-uptake.test.ts +11 -21
  96. package/tests/sdd-no-attempts-contract.test.ts +15 -0
  97. package/tests/sdd-odd-integration.test.ts +33 -0
  98. package/tests/sdd-optional-research.test.ts +124 -0
  99. package/tests/sdd-planning-routing-contract.test.ts +1 -1
  100. package/tests/sdd-preflight-rpc-input.test.ts +125 -0
  101. package/tests/sdd-preflight.test.ts +1 -1
  102. package/tests/sdd-research-capabilities.test.ts +20 -162
  103. package/tests/sdd-selection-transport.test.ts +180 -88
  104. package/tests/sdd-status.test.ts +5 -778
  105. package/tests/sdd-task-truth.test.ts +43 -0
  106. package/tests/session-change-capture.test.ts +20 -2
  107. package/tests/session-changes.test.ts +11 -0
  108. package/tests/shell-bar.test.ts +21 -0
  109. package/tests/shell-card.test.ts +8 -6
  110. package/tests/shell-changes.test.ts +8 -0
  111. package/tests/shell-prompt.test.ts +41 -7
  112. package/tests/shell-sidebar-banner.test.ts +4 -4
  113. package/tests/shell-sidebar-layout.test.ts +97 -13
  114. package/tests/startup-banner.test.ts +55 -2
  115. package/tests/windows-hidden-processes.test.ts +303 -0
  116. package/tests/windows-session-bootstrap.test.ts +1772 -0
  117. package/tests/windows-session-compile.test.ts +170 -0
  118. package/tests/windows-session-transport.test.ts +754 -0
  119. package/assets/agents/sdd-sync.md +0 -146
  120. package/lib/openspec-guardrails.ts +0 -99
  121. package/tests/native-sdd-attempt-authority.test.ts +0 -240
  122. package/tests/openspec-guardrails.test.ts +0 -71
@@ -1,12 +1,81 @@
1
1
  # README technical reference
2
2
 
3
- This reference preserves the detailed installation, configuration, SDD/OpenSpec, runtime, and contributor material previously carried by the README. Start with the [README](../README.md) for the product overview; use this document when you need operational detail. Historical compatibility and authority passages remain reference material, not newly endorsed operator instructions.
3
+ This reference preserves the detailed installation, configuration, ODD, optional SDD/OpenSpec, runtime, and contributor material previously carried by the README. Start with the [README](../README.md) for the product overview; use this document when you need operational detail. Historical compatibility and authority passages remain reference material, not newly endorsed operator instructions.
4
+
5
+
6
+ ## Organic Driven Development
7
+
8
+ Organic Driven Development (ODD) keeps explore → implement → proportionate checks as the everyday default, while explicitly selected SDD remains separate. For substantial authorized implementation, the parent automatically tracks feature progress after exploration, without asking for task-tracking or storage permission. Small, understood work creates no durable task artifact; investigation and proposal-only work stay read-only.
9
+
10
+ Choose SDD explicitly when you want separate proposal, spec, design, tasks, and verification artifacts. Its phases and handoffs add coordination; everyday work usually needs the intent and evidence, not that extra workflow. ODD keeps those in one document. Size, ambiguity, and risk alone never select SDD.
11
+
12
+ ### The ODD protocol
13
+
14
+ ODD is the predefined workflow: it runs by default on every request, without the user asking for a workflow, a plan, or task tracking. SDD is a branch inside ODD, entered only by an explicit request or an accepted proposal.
15
+
16
+ 1. **Authorize** — read-only unless implementation is authorized; ask one clarification when intent is ambiguous.
17
+ 2. **Explore** — read existing code and requirements first, proportionately to the request.
18
+ 3. **Resolve uncertainty** — optional research or one focused product question only for a real unresolved decision.
19
+ 4. **Classify** — substantial when exploration yields two or more meaningful implementation steps; small work stays small.
20
+ 5. **Track before the first write** — create the feature document and Engram mirror automatically for substantial work, and tell the user in one line.
21
+ 6. **Implement task by task** — route each task through the smallest safe workflow, with configured TDD and applicable checks.
22
+ 7. **Close** — report the verified outcome, failed/pending checks, and the next step.
23
+
24
+ - **One feature document:** `odd/tasks/<feature-name>.md` holds objective, problem, why, scope, constraints, actionable checklist with stable IDs and acceptance criteria, verification evidence, progress, and next step. Project-scoped Engram topic `odd/<feature-name>/tasks` mirrors the full document and repository-relative locator. Keep concise rationale for meaningful accepted changes here, not a separate plan or exhaustive journal. Accepted user, review, or verification changes update intent and tasks together; preserve valid completed work, add new tasks or reopen invalidated items with reasons. Findings alone do not authorize expansion or acceptance. Routine corrections stay with their tasks; checkoffs require observed proof.
25
+ - **Recovery:** write local progress first and read back both copies; writes are not atomic. Unavailable Engram leaves an explicit pending mirror, not invented success or a block on unrelated safe work. Before implementation or resume, the parent reads full feature memory and the actual task file, reconciles code and evidence, and preserves conflicting versions. Pass the locator and relevant context; workers read the document before edits. The existing Todo UI is a projection, not another authority.
26
+ - **Task size:** about 400 authored changed lines (additions plus deletions) is advisory only, not a cap, acceptance criterion, automatic stop, forced split, or RDD trigger. Keep coherent behavior with tests and docs, explain natural overages, and continue under existing PR policy. Forward this instruction to workers; never remove whitespace, comments, or tests, minify, invent abstractions, or split artificially for cosmetic savings.
27
+ - **Research:** optional research addresses a named uncertainty. Establish problem, intended outcome, constraints, and current evidence; inspect code and adapt depth to consequence, not fixed questionnaires or rounds. The parent asks one focused product question only when needed, then waits; workers return gaps. Use available authorized documentation/web tools, prefer primary sources, and attribute claims to URLs/code locations. Distinguish facts, assumptions, contradictions, freshness, and gaps; return a recommendation, tradeoffs, open questions, and implementation implications. Forward these instructions to an existing fresh general worker, not a specialized agent or `sdd-research`. Unavailable evidence pauses only unsafe dependent decisions. Research stays read-only with no new persistence/readiness machinery; a brief proposal is needed only for a real decision.
28
+ - **Assumptions:** at most one scoped independent read-only challenge for a high-consequence unproven premise, including a small security-critical change. Deterministic failures need fixes, not debate. Native RDD claims stay with its refuter.
29
+ - **TDD:** resolve on/off from existing project/session configuration or explicit user choice; retain source and exact runner in the feature document when present and forward all three on every implementation delegation, refreshing on resume. Test presence does not enable TDD. Enabled requires observed RED before implementation → GREEN → REFACTOR; disabled still requires ordinary functional checks. Unknown/conflicting mode or a missing runner needs only the clarification affecting the next action, never invented precedence, commands, or `sdd-init`.
30
+ - **Checks:** functional checks run per task, not RDD per checkbox. At a meaningful deliverable boundary, enabled RDD uses native candidate risk first via existing `gentle_review` assessment: passive/low stays silent; medium/high relays existing candidate consent and runs the native plan only on grant. Decline follows ordinary policy; unavailable assessment never means low risk. Disabled RDD never starts or prompts. Preserve native continuations and existing delivery gates.
31
+
32
+ ```mermaid
33
+ flowchart TD
34
+ A[Request] --> B{Implementation authorized?}
35
+ B -->|No| C[Read-only exploration; no task artifacts]
36
+ B -->|Yes| D[Explore existing code and requirements]
37
+ D --> E{Named uncertainty and research selected?}
38
+ E -->|Yes| F[Adaptive read-only research with existing workers]
39
+ E -->|No| G[Resolve real product decisions only]
40
+ F --> G
41
+ G --> H{High-consequence unproven premise?}
42
+ H -->|Yes| I[One independent assumption challenge]
43
+ H -->|No| J{Substantial work?}
44
+ I --> J
45
+ J -->|Yes| K[One feature document and full Engram mirror]
46
+ J -->|No| L[Small work without durable tasks]
47
+ K --> TC[Resolve configured TDD, source and runner]
48
+ L --> TC
49
+ TC --> M[Implement next authorized task]
50
+ M --> N[Applicable functional checks]
51
+ N --> O[Record truthful results; update tracked intent, tasks and mirror]
52
+ O --> P{Authorized work remains?}
53
+ P -->|Yes| M
54
+ P -->|No| Q{RDD enabled at deliverable boundary?}
55
+ Q -->|No| R[Ordinary checks and policy]
56
+ Q -->|Yes| S{Native candidate risk}
57
+ S -->|Passive or low| T[Silent structural checks; no reviewer or prompt]
58
+ S -->|Medium or high| U{Existing candidate consent}
59
+ S -->|Unavailable| V[Native continuation; never assume low risk]
60
+ U -->|Granted| W[Native review plan and authority]
61
+ U -->|Declined| R
62
+ R --> X[Existing delivery gates]
63
+ T --> X
64
+ W --> X
65
+ X --> Y[Deliver]
66
+ Z[Resume] --> AA[Full feature memory and actual task file]
67
+ AA --> AB[Reconcile requirements, code, proof and conflicts]
68
+ AB --> TC
69
+ ```
70
+
71
+ This is guidance through existing tools, not a new CLI, phase, state engine, or execution harness. Static prompt tests and scripted hook checks prove instruction delivery, not autonomous model adherence; actual create/update/resume behavior requires observed Pi sessions.
4
72
 
5
73
  ## Navigation
6
74
 
7
75
  - [Capabilities](#capability-reference)
8
76
  - [Installation and release policy](#install)
9
- - [SDD/OpenSpec and review architecture](#sddopenspec-flow)
77
+ - [ODD workflow and recovery](#organic-driven-development)
78
+ - [Optional SDD/OpenSpec and review architecture](#sddopenspec-flow)
10
79
  - [Configuration, commands, skills, memory, and telemetry](#persona-modes)
11
80
  - [Package contents and development](#package-contents)
12
81
 
@@ -16,11 +85,11 @@ This reference preserves the detailed installation, configuration, SDD/OpenSpec,
16
85
  | ------------------------------ | --------------------------------------------------------------------------------------------------------------------------------------------- |
17
86
  | **el Gentleman persona** | Makes Pi behave like a senior architect and teacher, not a generic chatbot. Spanish responses use Rioplatense voseo by default; neutral mode is saved globally with project overrides. |
18
87
  | **Configurable startup intro** | Adds a rose/text-logo startup intro, compact runtime panel, color presets, and commands to hide or show the decorative parts. |
19
- | **Work routing discipline** | Small tasks stay inline. Context-heavy exploration can be delegated. Large or risky changes go through SDD/OpenSpec. |
20
- | **SDD/OpenSpec assets** | Installs phase agents and chains for `init`, `onboard`, `explore`, `proposal`, `spec`, `design`, `tasks`, `apply`, `verify`, `sync`, and `archive`. |
88
+ | **Work routing discipline** | ODD keeps small tasks inline and delegates context-heavy work. SDD is explicitly selected when its formal artifacts are wanted, not because of size or risk. |
89
+ | **SDD/OpenSpec assets** | Installs phase agents and chains for `init`, `onboard`, `explore`, `proposal`, `spec`, `design`, `tasks`, `apply`, optional `verify` and `archive`. |
21
90
  | **Lazy SDD preflight** | Confirms SDD mode, artifact store, delivery strategy, and review budget on the first SDD invocation of every interactive session, including saved preferences; the parent transports the confirmed block to RPC SDD children. |
22
91
  | **Subagent orchestration** | Keeps one parent session responsible while child agents explore, implement, test, or review with focused context. |
23
- | **Strict TDD support** | When project config declares a test command, apply/verify phases must record RED → GREEN → TRIANGULATE → REFACTOR evidence. |
92
+ | **Strict TDD support** | TDD mode, source, and runner come from configuration or explicit choice in ODD and SDD. Enabled TDD requires observed evidence; a test command alone does not enable it. |
24
93
  | **Closed choice prompts** | Per-option hover/click/wheel in fullscreen; keyboard selection in either TUI mode. |
25
94
  | **Native pointer regions** | Compose hover, press, click, and wheel behavior around public TUI components. |
26
95
  | **Agent overlay close control** | Adds a header close button that adapts to available width. |
@@ -67,7 +136,25 @@ The stable release is [`v2.6.0`](https://github.com/Gentleman-Programming/gentle
67
136
 
68
137
  ### Source checkout
69
138
 
70
- This checkout prepares `gentle-pi` `2.7.0`; it is source state, not a published release. Its package-local native runtime pin is Gentle AI `v2.9.1`, distinct from the published `v2.6.0` pairing.
139
+ This checkout prepares `gentle-pi` `3.0.0`; it is source state, not a published release. Its package-local native runtime pin is Gentle AI `v2.9.1`, distinct from the published `v2.6.0` pairing.
140
+
141
+ The native SDD status consumer accepts both the pinned producer's legacy
142
+ `apply`/`verify`/`remediate`/`archive` instruction record and the classical
143
+ `apply`/`verify`/`archive` record. It preserves the provider's instructions and
144
+ selected route; it does not fabricate a remediation phase for a newer producer.
145
+ Unknown or incomplete instruction records still fail closed.
146
+
147
+ The Pi runtime now uses native status exclusively for SDD and retires standalone
148
+ sync. The full chain follows completed apply to archive, where applicable delta
149
+ specs are composed; verification remains explicitly invokable. With the current
150
+ 2.9.1 pin, native still requires verification and its emitted evidence requirements;
151
+ a plain practical PASS report does not satisfy that legacy native gate. Pi forwards
152
+ those exact instructions without overriding readiness or inventing legacy evidence.
153
+ Classical direct-archive behavior is compatibility-tested with an identified
154
+ upstream development build, not presented as a published fix or version bump.
155
+ The complete classical flow awaits a compatible published native version; this
156
+ change does not bump the pin. Ordinary attempt governance and research/planning simplification remain separate
157
+ work under [SDD parity #1051](https://github.com/Gentleman-Programming/gentle-pi/issues/1051).
71
158
 
72
159
  ### Pi compatibility
73
160
 
@@ -112,7 +199,7 @@ Then start Pi in a project:
112
199
  pi
113
200
  ```
114
201
 
115
- `gentle-pi` installs delegation and review agents at startup. SDD agents, chains, and support are global Pi runtime assets installed on demand, not per-project setup. The first SDD flow in a session runs a one-time SDD preflight for preferences and managed-asset refresh; for natural-language requests, el Gentleman decides when SDD is needed and runs the explicit preflight first.
202
+ `gentle-pi` installs delegation and review agents at startup. SDD agents, chains, and support are global Pi runtime assets installed on demand, not per-project setup. The first SDD flow in a session runs a one-time SDD preflight for preferences and managed-asset refresh; natural-language SDD requests or accepted proposals select that workflow, then run its preflight. Ordinary ODD does not run SDD initialization.
116
203
 
117
204
  ## Quick start
118
205
 
@@ -133,16 +220,16 @@ Typical flow:
133
220
 
134
221
  1. Open Pi in your repo.
135
222
  2. Run `/gentle:status`.
136
- 3. Run `/gentle-sdd-init` once per project, or when test/project capabilities change. This also runs the session SDD preflight.
137
- 4. For a substantial change, ask Pi to use SDD. Natural-language requests are classified by the parent agent, not by brittle runtime regexes.
138
- 5. Review the phase artifacts instead of trusting floating chat context.
223
+ 3. Describe the outcome, for example: "Add CSV export using the existing report filters." ODD explores, implements authorized changes, and checks the result.
224
+ 4. For substantial work, inspect the feature document and evidence; resume reconciles the full file and Engram copy. No SDD initialization is needed.
225
+ 5. If you explicitly choose SDD instead, follow [its preflight and project setup](#sdd-preflight-and-project-files) and review its phase artifacts.
139
226
 
140
227
  ## Core workflow
141
228
 
142
229
  1. **Install and inspect.** Install `gentle-pi`, open Pi in the target repository, then run `/gentle:status` or `/gentle:doctor`.
143
- 2. **Plan when risk justifies it.** Small work stays direct; substantial work uses SDD with Engram, OpenSpec, or both so requirements and decisions survive compaction.
144
- 3. **Build with evidence.** One focused writer implements the approved scope. When Strict TDD is available, apply and verify preserve RED → GREEN → TRIANGULATE → REFACTOR evidence.
145
- 4. **Use runtime-owned RDD when available.** Gentle AI supplies any runtime-specific review instructions; this package does not recreate a lifecycle in documentation or prompts.
230
+ 2. **Use ODD by default.** Explore and clarify proportionately; track substantial work in one feature document with a full Engram recovery copy. Choose SDD only when its separate formal artifacts are explicitly wanted.
231
+ 3. **Build with evidence.** One focused writer implements authorized scope using the forwarded TDD mode/source/runner. Enabled TDD requires observed RED → GREEN → REFACTOR; disabled still runs functional checks. Test presence is not activation.
232
+ 4. **Use runtime-owned RDD only when enabled by the user.** Gentle AI supplies any runtime-specific review instructions; this package does not recreate a lifecycle in documentation or prompts.
146
233
  5. **Deliver through ordinary repository policy.** Review and Judgment Day evidence is informational only; Pi never creates a delivery route, authorization, target rederivation, or receipt gate.
147
234
 
148
235
  > **Trust what the system can derive, not what an agent claims.** Agents analyze the candidate. The package-local Gentle AI runtime owns scope, risk, findings, and review authority. Review outcomes inform delivery; ordinary repository policy decides delivery commands. Dangerous-command safety and destructive-review consent remain independent. See Gentle AI's [review authority threat model](https://github.com/Gentleman-Programming/gentle-ai/blob/main/docs/review-authority-threat-model.md) and [Chapter 21 — Verifiable Trust](https://the-amazing-gentleman-programming-book.vercel.app/en/book/Chapter21_Verifiable-Trust).
@@ -155,13 +242,14 @@ Typical flow:
155
242
  | --------------------------------------------------------------------------- | ---------------------------- |
156
243
  | Small, clear, local edit | Inline direct work. |
157
244
  | Unknown codebase area or context-heavy investigation | Focused subagent delegation. |
158
- | Large, ambiguous, architectural, product-facing, or high-review-risk change | SDD/OpenSpec flow. |
245
+ | Substantial authorized work needing recoverable progress | ODD with a feature document and focused workers. |
246
+ | Explicit request or accepted proposal for formal phase artifacts | Optional SDD/OpenSpec flow. |
159
247
 
160
- The goal is not ceremony. The goal is to avoid accidental chaos. Once a task stops being small, delegation is mandatory.
248
+ Size and uncertainty can call for scoped exploration or delegation within ODD, not automatic SDD enrollment. The delegation triggers below select execution topology, not a different development method.
161
249
 
162
250
  ### Delegation triggers
163
251
 
164
- `gentle-pi` keeps the parent session thin and delegates at the narrowest useful point. When the Pi Subagents extension is installed, the preferred runtime is the `subagent_*` tool family because it runs the user's configured project/global subagent definitions and preserves history/background behavior. With the background policy on, delegations default to background mode: the terminal stays free and each result comes back as a message that starts a new turn; task mode is reserved for delegations that must ask the user something mid-flight. If those tools are unavailable, the parent should fall back to Pi's native `Agent` tool or another available delegation mechanism. The requirement is delegation; the runtime is capability-dependent.
252
+ `gentle-pi` keeps the parent session thin and delegates at the narrowest useful point. When the Pi Subagents extension is installed, the preferred runtime is the `subagent_*` tool family because it runs the user's configured project/global subagent definitions and preserves history/background behavior. With the background policy on, delegations default to background mode: the terminal stays free and each result comes back as a message that starts a new turn; task mode is the bounded print-mode alternative and also supports delegations that must ask the user something mid-flight. Background work requires a live interactive/RPC parent; `subagent_run` and `subagent_continue` reject background mode in `pi -p`, which exits before a later result can be received. If those tools are unavailable, the parent should fall back to Pi's native `Agent` tool or another available delegation mechanism. The requirement is delegation; the runtime is capability-dependent.
165
253
 
166
254
  | Trigger | Required behavior |
167
255
  | --------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------- |
@@ -332,11 +420,13 @@ Adversarial review roles (the refuter and the targeted validator) are never Pi-a
332
420
 
333
421
  ## SDD/OpenSpec flow
334
422
 
423
+ This is the explicitly selected alternative to [everyday ODD](#organic-driven-development), not a requirement for substantial or risky work. Keep the formal phase artifacts when they are part of what you want to review and maintain.
424
+
335
425
  ```text
336
426
  init
337
427
  ↓
338
428
  explore → research (optional) → proposal → spec ─┬→ design ─┐
339
- └─────────┴→ tasks → apply → verify → sync → archive
429
+ └─────────┴→ tasks → apply → archive (verification optional)
340
430
  ```
341
431
 
342
432
  The main loop is intentionally file-backed when you choose `openspec` or `both`:
@@ -344,17 +434,17 @@ The main loop is intentionally file-backed when you choose `openspec` or `both`:
344
434
  ```text
345
435
  planning artifacts implementation evidence canonical update
346
436
  ────────────────── ─────────────────────── ────────────────
347
- proposal/spec/design/tasks → apply-progress/verify-report → sync-report → archive-report
437
+ proposal/spec/design/tasks → apply-progress → optional verify-report → archive-report + canonical update
348
438
  ```
349
439
 
350
- For substantial work, the parent session coordinates the flow and each phase writes artifacts. That gives you:
440
+ For explicitly selected SDD work, the parent session coordinates the flow and each phase writes artifacts. That gives you:
351
441
 
352
442
  - explicit requirements and non-goals;
353
443
  - design decisions that survive compaction;
354
444
  - task plans reviewers can reason about;
355
445
  - implementation evidence;
356
446
  - verification reports;
357
- - sync reports that update canonical specs while keeping the change active;
447
+ - archive-time canonical spec composition with explicit destructive-change consent;
358
448
  - archive notes for future agents.
359
449
 
360
450
  ### OpenSpec artifact model
@@ -374,8 +464,7 @@ openspec/
374
464
  │ ├── design.md
375
465
  │ ├── tasks.md
376
466
  │ ├── apply-progress.md
377
- │ ├── verify-report.md
378
- │ └── sync-report.md
467
+ │ └── verify-report.md # optional
379
468
  └── archive/YYYY-MM-DD-{change}/ # immutable audit trail
380
469
  ```
381
470
 
@@ -384,7 +473,7 @@ Delta flow:
384
473
  ```text
385
474
  openspec/changes/{change}/specs/{domain}/spec.md
386
475
  │
387
- │ sdd-sync applies ADDED / MODIFIED / REMOVED
476
+ │ sdd-archive applies ADDED / MODIFIED / REMOVED
388
477
  ▼
389
478
  openspec/specs/{domain}/spec.md
390
479
  │
@@ -403,13 +492,13 @@ When a canonical spec already exists, change specs use requirement operation sec
403
492
  ## REMOVED Requirements
404
493
  ```
405
494
 
406
- `MODIFIED` requirements must include the full requirement block, including still-valid scenarios, because sync replaces the canonical block by requirement name. `sdd-sync` syncs file-backed deltas into `openspec/specs/{domain}/spec.md` while keeping the change active; `sdd-archive` then moves the synced change to `openspec/changes/archive/YYYY-MM-DD-{change}/`.
495
+ `MODIFIED` requirements must include the full requirement block, including still-valid scenarios, because sync replaces the canonical block by requirement name. `sdd-archive` composes applicable file-backed deltas into `openspec/specs/{domain}/spec.md`, then moves the completed change to `openspec/changes/archive/YYYY-MM-DD-{change}/`.
407
496
 
408
497
  Engram-only mode is different by design: Engram is working memory and does not maintain a canonical spec merge layer. Use `openspec` or `both` (hybrid file + memory persistence) when you need canonical spec evolution.
409
498
 
410
499
  ## SDD preflight and project files
411
500
 
412
- `gentle-pi` does not require SDD agents to be copied into every project. The package installs and refreshes global Pi SDD assets under the Pi agent home on SDD activation, and treats project-local files only as overrides/debug copies. Slash SDD flows such as `/sdd-*`, `/gentle-sdd-init`, and the explicit `/gentle:sdd-preflight` command run a lazy preflight and resolve session-scoped SDD preferences. For natural-language requests, the parent agent decides whether the work should use SDD and must run/reuse `/gentle:sdd-preflight` before continuing.
501
+ `gentle-pi` does not require SDD agents to be copied into every project. The package installs and refreshes global Pi SDD assets under the Pi agent home on SDD activation, and treats project-local files only as overrides/debug copies. Slash SDD flows such as `/sdd-*`, `/gentle-sdd-init`, and the explicit `/gentle:sdd-preflight` command run a lazy preflight and resolve session-scoped SDD preferences. For natural-language requests, SDD requires an explicit user request or accepted proposal; only then does the parent run/reuse `/gentle:sdd-preflight` before continuing. ODD does not use this setup.
413
502
 
414
503
  ```text
415
504
  ~/.pi/agent/agents/sdd-*.md
@@ -574,6 +663,8 @@ Existing project-local `.pi/gentle-ai/models.json` files are still read as a leg
574
663
 
575
664
  Inside `/gentle:models`, press `x` to export the saved routing to `~/.pi/gentle-ai/models.export.json`, or `r` to restore from that file after confirmation. Export uses a versioned envelope and restore writes the normal `models.json` shape before applying routing to agents.
576
665
 
666
+ Press `u` to save exactly like `ctrl+s` and then update the current profile from the routing just saved, the same snapshot `/gentle:profiles` takes with `s` (including the orchestrator currently set in `settings.json`). The panel names the profile `u` targets: the profile this repository pins when a pin wins, otherwise the globally active profile. When no profiles store exists yet, `u` seeds it with a `current` profile the way `/gentle:profiles` does on first open; when the store exists but nothing is active and nothing is pinned, the global save still happens and the panel points you to `/gentle:profiles`.
667
+
577
668
  Config shape (per agent):
578
669
 
579
670
  ```json
@@ -600,14 +691,16 @@ Profiles are named, switchable snapshots of the global agent-model routing from
600
691
 
601
692
  | Key | Action |
602
693
  | ------- | ---------------------------------------------------------------------- |
603
- | `enter` | Apply the selected profile live (writes `models.json`, replaces the routing of every agent, sets the orchestrator when the profile defines one). |
694
+ | `enter` | Apply the selected profile live (writes `models.json`, replaces the routing of every agent, sets the orchestrator when the profile defines one). Inside a pinned repository it stays repository-scoped instead; see **Per-repository pins** below. |
604
695
  | `c` | Create a new, empty profile. |
605
- | `s` | Update the selected profile from the current routing (including the orchestrator currently set in `settings.json`). |
696
+ | `s` | Snapshot the current routing into the selected profile (including the orchestrator currently set in `settings.json`); live routing is unchanged. |
606
697
  | `d` | Duplicate the selected profile. |
607
698
  | `r` | Rename the selected profile (keeps it active if it was active). |
608
699
  | `x` | Delete the selected profile (refuses the active profile). |
609
700
  | `e` | Export the selected profile to `~/.pi/gentle-ai/profiles.export.json`. |
610
701
  | `i` | Import a profile from `~/.pi/gentle-ai/profiles.export.json`. |
702
+ | `p` | Pin the selected profile to this repository: writes the clone-local pin, so this repository's subagent launches use that profile no matter which profile is globally active. Pressing it again on the pinned profile removes the pin. |
703
+ | `P` | Publish or remove the shared repository declaration at `<worktree-root>/.pi/gentle-ai/profile.json`, so the whole team starts from that profile in this repository. |
611
704
  | `j`/`k`, wheel | Scroll the detail pane one line at a time (agents-view style). |
612
705
  | `pgup`/`pgdn`, `ctrl+j`/`ctrl+k` | Scroll the detail pane by a page. |
613
706
  | `esc` | Close. |
@@ -651,6 +744,49 @@ The `profiles` values use the same per-agent shape as `models.json`. Profile nam
651
744
 
652
745
  The store is replaced atomically through a sibling temp file and a rename, so an interrupted write cannot leave truncated JSON behind. Applying a profile writes `profiles.json` first and then materializes routing; if materialization fails, the previous active marker and the previous routing are restored, and anything that could not be restored is named in the warning.
653
746
 
747
+ ### Per-repository pins
748
+
749
+ A profile can be pinned to one repository, so that repository's subagent launches use that profile regardless of which profile is globally active. This is what keeps parallel repositories independent: without a pin, switching the active profile in one repository changes the routing every other repository will use for its next subagent launch.
750
+
751
+ Two pin layers exist, and both hold only a profile name:
752
+
753
+ | Layer | Path | Written by | Git impact |
754
+ | ----- | ---- | ---------- | ---------- |
755
+ | Local pin | `<git-common-dir>/gentle-ai/profile-pin.json` | `p` | Invisible to git; every worktree of the clone shares it. |
756
+ | Repository declaration | `<worktree-root>/.pi/gentle-ai/profile.json` | `P` | An ordinary repository file; commit it to share the pin with the team. |
757
+
758
+ Both use the same shape, and both are a separate artifact from `profiles.json`:
759
+
760
+ ```json
761
+ {
762
+ "kind": "gentle-pi.agent_model_profile_pin",
763
+ "version": 1,
764
+ "profile": "deep-work"
765
+ }
766
+ ```
767
+
768
+ For a given working directory the winner is the local pin, then the repository declaration, then no pin. With no pin at all the repository keeps the behavior described above and follows the globally active profile. `p` and `P` are toggles: pressing one on the profile that already holds that layer removes it, and either key pressed outside a Git worktree writes nothing and says so.
769
+
770
+ In a pinned repository the pinned profile governs subagent launches: the agents it names take its model and effort, and the agents it omits return to inherit (their own definition, then the default model). The globally active profile and writes made through `/gentle:models` do not reach those launches, which `/gentle:models` reports when it runs inside a pinned repository. `enter` follows the same boundary: inside a pinned repository it re-pins that repository instead of writing the global routing, so the panel's main key can never move another repository's routing. The panel states which layer won, names the file that holds it, and marks the profile with `(pinned)`.
771
+
772
+ To share a pin, commit the repository declaration. When `.pi/` is ignored, Git cannot re-include a nested file until its parent directories are visible. The panel therefore prints these ordered root `.gitignore` rules, which keep unrelated `.pi` content ignored while making only the declaration committable:
773
+
774
+ ```gitignore
775
+ !.pi/
776
+ .pi/*
777
+ !.pi/gentle-ai/
778
+ .pi/gentle-ai/*
779
+ !.pi/gentle-ai/profile.json
780
+ ```
781
+
782
+ Renaming the profile that is this repository's local pin rewrites the local pin; a repository declaration is never rewritten behind a commit, and the panel says to press `P` again when it still names the old profile. Deleting a profile is refused while it is the global active profile, this repository's local pin, or this repository's repository declaration. Pins held by other repositories cannot be enumerated from here and are not checked.
783
+
784
+ A pin that cannot be honored never blocks work and is never destroyed by a read. Running outside a Git worktree, an unreadable or unparseable pin file, and a pin naming a profile the global store does not have are reported in the panel, and the repository falls back to the globally active profile. A missing pin layer is the ordinary no-pin state and stays silent.
785
+
786
+ The orchestrator sits deliberately outside the pin. Its `defaultProvider`, `defaultModel`, and `defaultThinkingLevel` live in Pi's global `settings.json`, and a pin never writes them. Pi supports project settings, where `.pi/settings.json` overrides the global file, so a per-repository orchestrator is possible in principle; it is not done here because it would make Pi treat the repository as having project settings and ask for trust at startup, and because it would only affect new sessions.
787
+
788
+ One limitation is worth stating. When a pinned profile omits an agent, that agent's own frontmatter still applies, so a model that an earlier global apply materialized into a user agent's frontmatter can still be inherited. Frontmatter cannot be told apart from content an author wrote, so a pin does not clear it.
789
+
654
790
  ## Commands
655
791
 
656
792
  | Command | What it does |
@@ -658,8 +794,9 @@ The store is replaced atomically through a sibling temp file and a rename, so an
658
794
  | `/gentle:status` | Shows package, SDD asset, OpenSpec, and global model config status. |
659
795
  | `/gentle:doctor` | Runs read-only diagnostics for SDD assets, model/persona config, memory tools, and safety guards. |
660
796
  | `/gentle:sdd-preflight` | Runs or reuses the lazy SDD preflight for this Pi session. |
661
- | `/gentle:models` | Opens global model + effort assignment UI. Press `x` to export and `r` to restore saved routing. |
662
- | `/gentle:profiles` | Opens global agent-model profiles: apply live, create, update, duplicate, rename, delete, export, and import. |
797
+ | `/gentle:models` | Opens global model + effort assignment UI. Press `x` to export, `r` to restore saved routing, and `u` to save and update the current profile. |
798
+ | `/gentle:profiles` | Opens global agent-model profiles: apply live, create, snapshot, duplicate, rename, delete, export, and import. |
799
+ | `/gentle:commands` | Opens the command palette (default `alt+k`): a curated, grouped menu (Configuration, Session, Diagnostics, SDD, Skills) of registered Gentle commands; search and run by label. |
663
800
  | `/gentle:persona` | Switches global persona mode, with project override support. |
664
801
  | `/gentle:background-subagents` | Shows or sets the managed background-subagents policy (`status\|enable\|disable`), naming the source that decided it. |
665
802
  | `/gentle:telemetry` | Shows or changes the local Gentle AI telemetry trigger (`status\|enable\|disable\|preview`). |
@@ -680,6 +817,8 @@ Startup installs and refreshes only delegation and review assets. SDD assets are
680
817
 
681
818
  ### Background subagents policy
682
819
 
820
+ Background delegation requires a live interactive/RPC parent and is rejected in `pi -p`, even when the policy is on. Use task mode for bounded print-mode work.
821
+
683
822
  Background delegation is off unless you turn it on. The policy is user-owned: only an explicit `/gentle:background-subagents enable` or `disable` writes it, and Pi automation never toggles it.
684
823
 
685
824
  ```text
@@ -778,7 +917,7 @@ To opt out:
778
917
  | `extensions/skill-registry.ts` | Maintains `.atl/skill-registry.md` from project/user skills and closes file watchers on shutdown. |
779
918
  | `assets/orchestrator.md` | Parent-session orchestration contract (always-on core). |
780
919
  | `assets/orchestrator-delegation.md` | Lazy-loaded delegation/routing/review detail, including the mirrored gentle-ai canon. |
781
- | `assets/orchestrator-memory.md` | Lazy-loaded SDD memory phase table, artifact keys, and lifecycle rule. |
920
+ | `assets/orchestrator-memory.md` | Lazy-loaded ODD feature continuity plus SDD memory phase table, artifact keys, and lifecycle rule. |
782
921
  | `assets/orchestrator-skills.md` | Lazy-loaded skill registry fallback semantics and intent-driven skill discovery. |
783
922
  | `assets/sdd-orchestrator-workflow.md` | Lazy-loaded SDD workflow surface for the parent orchestrator. |
784
923
  | `assets/agents/` | Delegation, review, and on-demand SDD agents installed as global Pi runtime assets. |
@@ -862,7 +1001,7 @@ Do not run `npm publish` locally for `gentle-pi`. Dispatch the trusted workflow
862
1001
  - Human control over agent momentum.
863
1002
  - Concepts before code.
864
1003
  - Artifacts over floating chat context.
865
- - SDD when risk justifies it.
866
- - Strict TDD when tests exist.
1004
+ - ODD for everyday work; SDD when its formal phase artifacts are explicitly wanted.
1005
+ - TDD from configured mode or explicit choice, not test presence.
867
1006
  - One parent orchestrator, focused subagents.
868
1007
  - Reviewable changes over giant diffs.
@@ -81,6 +81,7 @@ function resolveWorkspaceCwd(cwd: string): string {
81
81
  cwd: resolved,
82
82
  encoding: "utf8",
83
83
  stdio: ["ignore", "pipe", "ignore"],
84
+ windowsHide: true,
84
85
  }).trim());
85
86
  if (root !== resolved) {
86
87
  throw new Error("CodeGraph requires a real Git project root equal to the current workspace.");
@@ -246,6 +247,7 @@ const runCodeGraphCommand: CodeGraphRunner = async (args, options) => {
246
247
  cwd: options.cwd,
247
248
  signal: options.signal,
248
249
  maxBuffer: options.maxBuffer,
250
+ windowsHide: true,
249
251
  };
250
252
  let unavailableError: unknown;
251
253