gentle-pi 2.1.2 → 2.3.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.
- package/README.md +108 -79
- package/assets/agents/gentle-ai-worker.md +7 -3
- package/assets/agents/jd-fix-agent.md +1 -1
- package/assets/agents/jd-judge-a.md +3 -1
- package/assets/agents/jd-judge-b.md +3 -1
- package/assets/agents/review-readability.md +4 -3
- package/assets/agents/review-reliability.md +4 -3
- package/assets/agents/review-resilience.md +4 -3
- package/assets/agents/review-risk.md +4 -3
- package/assets/agents/sdd-apply.md +11 -4
- package/assets/agents/sdd-archive.md +6 -1
- package/assets/agents/sdd-design.md +6 -1
- package/assets/agents/sdd-explore.md +6 -2
- package/assets/agents/sdd-init.md +10 -2
- package/assets/agents/sdd-onboard.md +6 -1
- package/assets/agents/sdd-proposal.md +8 -1
- package/assets/agents/sdd-research.md +54 -0
- package/assets/agents/sdd-spec.md +6 -1
- package/assets/agents/sdd-status.md +10 -5
- package/assets/agents/sdd-sync.md +6 -1
- package/assets/agents/sdd-tasks.md +8 -4
- package/assets/agents/sdd-verify.md +27 -2
- package/assets/chains/4r-review.chain.md +2 -0
- package/assets/chains/sdd-full.chain.md +2 -2
- package/assets/chains/sdd-plan.chain.md +1 -1
- package/assets/chains/sdd-verify.chain.md +2 -2
- package/assets/orchestrator-delegation.md +145 -160
- package/assets/orchestrator-memory.md +2 -0
- package/assets/orchestrator.md +25 -48
- package/assets/sdd-orchestrator-workflow.md +163 -25
- package/assets/support/sdd-status-contract.md +24 -6
- package/contracts/review-integration/v1/fixtures/consent.fixture.json +3 -3
- package/contracts/review-integration/v1/fixtures/start-v2.fixture.json +19 -28
- package/contracts/review-integration/v1/fixtures/start.fixture.json +1 -10
- package/contracts/review-integration/v1/fixtures/status-v2.fixture.json +12 -21
- package/contracts/review-integration/v1/schemas/correction-plan-request.schema.json +49 -0
- package/contracts/review-integration/v1/schemas/operation.schema.json +76 -0
- package/contracts/review-integration/v1/schemas/repair.schema.json +39 -0
- package/contracts/review-integration/v1/schemas/status-v2.schema.json +4 -2
- package/contracts/review-integration/v1/schemas/status.schema.json +4 -2
- package/contracts/review-integration/v1/schemas/transition-execution.schema.json +42 -0
- package/contracts/review-integration/v2/fixtures/consent.fixture.json +1 -1
- package/contracts/review-integration/v2/fixtures/start.fixture.json +1 -10
- package/contracts/review-integration/v2/fixtures/status.fixture.json +1 -10
- package/contracts/review-integration/v2/schemas/failure.schema.json +5 -1
- package/contracts/review-integration/v2/schemas/last-event-closure.schema.json +66 -0
- package/contracts/review-integration/v2/schemas/opencode-provider-role.schema.json +14 -0
- package/contracts/review-integration/v2/schemas/operation.schema.json +6 -1
- package/contracts/review-integration/v2/schemas/repair.schema.json +4 -2
- package/contracts/review-integration/v2/schemas/start.schema.json +5 -2
- package/contracts/review-integration/v2/schemas/status.schema.json +4 -2
- package/contracts/review-provider-contract-mirror/provider-contract.lock.json +30 -0
- package/contracts/review-provider-contract-mirror/v1.1.0/bundle/README.md +12 -0
- package/contracts/review-provider-contract-mirror/v1.1.0/bundle/manifest.json +65 -0
- package/contracts/review-provider-contract-mirror/v1.1.0/bundle/schemas/lens.schema.json +16 -0
- package/contracts/review-provider-contract-mirror/v1.1.0/bundle/schemas/refuter.schema.json +1 -0
- package/contracts/review-provider-contract-mirror/v1.1.0/bundle/schemas/targeted-validator.schema.json +1 -0
- package/contracts/review-provider-contract-mirror/v1.1.0/bundle/vectors/lens.json +1 -0
- package/contracts/review-provider-contract-mirror/v1.1.0/bundle/vectors/refuter.json +1 -0
- package/contracts/review-provider-contract-mirror/v1.1.0/bundle/vectors/targeted-validator.json +1 -0
- package/contracts/review-provider-contract-mirror/v1.1.0/generated/provider-capabilities.baseline.json +15 -0
- package/contracts/review-provider-contract-mirror/v1.1.0/generated/provider-roles.baseline.json +42 -0
- package/docs/native-authority-architecture.md +14 -16
- package/docs/review-integration.md +27 -353
- package/extensions/ask-user-choice.ts +151 -0
- package/extensions/gentle-ai.ts +2710 -3211
- package/extensions/quiet-tools.ts +515 -32
- package/extensions/sdd-init.ts +21 -12
- package/extensions/skill-registry.ts +10 -2
- package/extensions/startup-banner.ts +10 -4
- package/lib/gentle-ai-binary.ts +173 -2
- package/lib/gentle-ai-renderer.ts +70 -0
- package/lib/model-routing-authority.ts +133 -0
- package/lib/native-review-cli.ts +676 -781
- package/lib/opaque-pi-reviewer-adapter.ts +284 -0
- package/lib/provider-contract-bundle.ts +704 -0
- package/lib/review-candidate-view.ts +836 -118
- package/lib/review-compact-contract.ts +59 -248
- package/lib/review-host-relay.ts +578 -0
- package/lib/review-integration-v2.ts +1254 -221
- package/lib/review-last-event-controller.ts +35 -0
- package/lib/review-relay-contract.ts +16 -0
- package/lib/sdd-preflight.ts +230 -67
- package/lib/sdd-status.ts +66 -111
- package/lib/terminal-theme.ts +1 -1
- package/package.json +83 -79
- package/runtime/gentle-ai-binary.mjs +174 -3
- package/runtime/native-review-cli.mjs +610 -715
- package/runtime/review-integration-v2.mjs +1223 -190
- package/runtime/review-relay-contract.mjs +17 -0
- package/scripts/{build-git-commit-transaction-runner.mjs → build-runtime-modules.mjs} +5 -5
- package/scripts/check-provider-contract.mjs +138 -0
- package/scripts/gentle-ai-installer.mjs +85 -22
- package/scripts/maintainer/provider-relay-matrix.mjs +403 -0
- package/scripts/mirror-provider-contract.mjs +143 -0
- package/scripts/test-packed-runner.mjs +20 -9
- package/scripts/verify-package-files.mjs +119 -43
- package/skills/_shared/review-ledger-contract.md +11 -19
- package/skills/chained-pr/SKILL.md +3 -0
- package/skills/cognitive-doc-design/SKILL.md +1 -1
- package/skills/comment-writer/SKILL.md +1 -1
- package/skills/gentle-ai/SKILL.md +7 -74
- package/skills/issue-creation/SKILL.md +94 -168
- package/skills/judgment-day/SKILL.md +9 -5
- package/skills/judgment-day/references/prompts-and-formats.md +2 -0
- package/skills/rdd-defect-workflow/SKILL.md +54 -0
- package/skills/release/SKILL.md +3 -3
- package/skills/skill-registry/SKILL.md +1 -1
- package/skills/work-unit-commits/SKILL.md +3 -1
- package/tests/artifact-language.test.ts +24 -11
- package/tests/ask-user-choice.test.ts +264 -0
- package/tests/background-subagents.test.ts +771 -0
- package/tests/codegraph-tools.test.ts +3 -3
- package/tests/crosslane/cross-lane.mjs +16 -0
- package/tests/delegated-key-learnings-contract.test.ts +240 -0
- package/tests/devbinary/native-review-parity.devtest.ts +167 -250
- package/tests/devbinary/pi-host-relay.devtest.ts +867 -0
- package/tests/fixtures/devbinary/capabilities-v2.1.derived.json +331 -0
- package/tests/fixtures/devbinary/capabilities-v2.2.captured.json +340 -0
- package/tests/fixtures/devbinary/consent-v3.captured.json +37 -0
- package/tests/fixtures/devbinary/failure-v2-capture-evidence.captured.json +16 -0
- package/tests/fixtures/devbinary/last-event-capture-correction-plan.captured.json +10 -0
- package/tests/fixtures/devbinary/last-event-capture-refuter-approved.captured.json +20 -0
- package/tests/fixtures/devbinary/last-event-capture-refuter-correction-required.captured.json +26 -0
- package/tests/fixtures/devbinary/last-event-capture-result-approved.captured.json +8 -0
- package/tests/fixtures/devbinary/last-event-capture-result-correction-required.captured.json +26 -0
- package/tests/fixtures/devbinary/last-event-capture-validation-approved.captured.json +8 -0
- package/tests/fixtures/devbinary/last-event-closure.provenance.md +13 -0
- package/tests/fixtures/devbinary/result-artifact-v2-path.captured.json +12 -0
- package/tests/fixtures/devbinary/result-artifact-v2.captured.json +12 -0
- package/tests/fixtures/devbinary/review-acknowledged-v1.captured.json +9 -0
- package/tests/fixtures/devbinary/review-acknowledged.provenance.md +31 -0
- package/tests/fixtures/devbinary/start-v3-consent-declined.captured.json +19 -0
- package/tests/fixtures/devbinary/start-v3-consent-granted.captured.json +109 -0
- package/tests/fixtures/devbinary/start-v3-zero-lens-closed.captured.json +21 -0
- package/tests/fixtures/devbinary/status-v5-capture-result-submission.captured.json +184 -0
- package/tests/fixtures/devbinary/status-v5-repository-context.captured.json +138 -0
- package/tests/fixtures/devbinary/status-v5.captured.json +88 -0
- package/tests/fixtures/native-review-cli/v2.5.0-rc.1/PROVENANCE.txt +15 -0
- package/tests/fixtures/provider-contract-bundle/v1.1.0/README.md +12 -0
- package/tests/fixtures/provider-contract-bundle/v1.1.0/manifest.json +65 -0
- package/tests/fixtures/provider-contract-bundle/v1.1.0/schemas/lens.schema.json +16 -0
- package/tests/fixtures/provider-contract-bundle/v1.1.0/schemas/refuter.schema.json +1 -0
- package/tests/fixtures/provider-contract-bundle/v1.1.0/schemas/targeted-validator.schema.json +1 -0
- package/tests/fixtures/provider-contract-bundle/v1.1.0/vectors/lens.json +1 -0
- package/tests/fixtures/provider-contract-bundle/v1.1.0/vectors/refuter.json +1 -0
- package/tests/fixtures/provider-contract-bundle/v1.1.0/vectors/targeted-validator.json +1 -0
- package/tests/gentle-ai-binary.test.ts +83 -13
- package/tests/gentle-ai-dev-binary-surfacing.test.ts +195 -0
- package/tests/gentle-ai-dev-binary.test.ts +159 -0
- package/tests/gentle-ai-installer.test.ts +138 -48
- package/tests/gentle-ai.test.ts +820 -131
- package/tests/gentle-theme.test.ts +133 -0
- package/tests/maintainer/provider-relay.maintest.ts +601 -0
- package/tests/model-routing-authority.test.ts +257 -0
- package/tests/native-review-capability-contract.test.ts +75 -2
- package/tests/native-review-cli.test.ts +588 -908
- package/tests/native-review-consent.test.ts +283 -38
- package/tests/native-review-parity-runtime.test.ts +108 -350
- package/tests/native-review-parity.test.ts +684 -732
- package/tests/native-sdd-attempt-authority.test.ts +235 -0
- package/tests/opaque-pi-reviewer-adapter.test.ts +266 -0
- package/tests/orchestrator-budget.test.ts +158 -89
- package/tests/orchestrator-rdd-ownership.test.ts +103 -0
- package/tests/package-manifest.test.ts +128 -100
- package/tests/provider-contract-bundle.test.ts +385 -0
- package/tests/provider-contract-mirror.test.ts +206 -0
- package/tests/provider-defect-handoff.test.ts +252 -0
- package/tests/quiet-tool-rendering.test.ts +1055 -28
- package/tests/review-actor-tool-deny.test.ts +12 -13
- package/tests/review-authority-recovery-docs.test.ts +1 -2
- package/tests/review-candidate-view.test.ts +898 -12
- package/tests/review-compact-contract.test.ts +29 -122
- package/tests/review-controller-lock-status.test.ts +2 -2
- package/tests/review-controller-native-recovery.test.ts +366 -857
- package/tests/review-controller-native-routing.test.ts +1253 -4199
- package/tests/review-controller-retired-ops.test.ts +1 -1
- package/tests/review-controller-workspace-root.test.ts +236 -70
- package/tests/review-controller.test.ts +26 -816
- package/tests/review-corrected-finalize-binding.test.ts +134 -0
- package/tests/review-dispatch-hydration-gap.test.ts +145 -0
- package/tests/review-gate.test.ts +0 -45
- package/tests/review-host-relay-restart-parity.test.ts +360 -0
- package/tests/review-host-relay-routing.test.ts +352 -0
- package/tests/review-host-relay.test.ts +754 -0
- package/tests/review-integration-v2-forward.test.ts +654 -0
- package/tests/review-integration-v2.test.ts +317 -129
- package/tests/review-last-event-closure.test.ts +408 -0
- package/tests/review-ledger-contract.test.ts +106 -60
- package/tests/review-recovered-lineage-routing.test.ts +199 -0
- package/tests/review-relay-transport-agent.test.ts +322 -0
- package/tests/review-snapshot.test.ts +3 -2
- package/tests/runtime-harness.mjs +573 -180
- package/tests/sdd-agent-tools.test.ts +53 -32
- package/tests/sdd-preflight.test.ts +81 -15
- package/tests/sdd-status.test.ts +109 -110
- package/tests/skill-collision-prefixes.test.ts +6 -8
- package/tests/skill-registry.test.ts +50 -1
- package/tests/verify-package-files.test.ts +62 -0
- package/tests/writer-edit-surface-scope.test.ts +230 -0
- package/themes/Gentleman-Cute.json +94 -0
- package/themes/Gentleman-Sexy.json +92 -0
- package/assets/agents/review-refuter.md +0 -40
- package/assets/agents/review-validator.md +0 -23
- package/lib/git-commit-transaction.ts +0 -801
- package/lib/native-review-remediation.ts +0 -49
- package/lib/review-compact.ts +0 -947
- package/lib/review-refuter-adapter.ts +0 -129
- package/lib/review-runtime-contract.ts +0 -68
- package/prompts/gcl.md +0 -54
- package/prompts/gis.md +0 -25
- package/prompts/gpr.md +0 -41
- package/prompts/gwr.md +0 -31
- package/runtime/git-commit-transaction.mjs +0 -802
- package/scripts/run-git-commit-transaction.mjs +0 -35
- package/tests/fixtures/native-review-cli/v2.1.2/bind-sdd.json +0 -25
- package/tests/fixtures/native-review-cli/v2.1.2/finalize.json +0 -8
- package/tests/fixtures/native-review-cli/v2.1.2/sdd-status-engram.json +0 -139
- package/tests/fixtures/native-review-cli/v2.1.2/sdd-status.json +0 -200
- package/tests/fixtures/native-review-cli/v2.1.2/start.json +0 -12
- package/tests/fixtures/native-review-cli/v2.1.2/validate-allow.json +0 -24
- package/tests/fixtures/native-review-cli/v2.1.2/validate-deny-empty-context.json +0 -20
- package/tests/fixtures/native-review-cli/v2.1.2/validate-deny.json +0 -28
- package/tests/fixtures/native-review-cli/v2.1.3/sdd-status-engram.json +0 -139
- package/tests/fixtures/native-review-cli/v2.1.3/sdd-status.json +0 -200
- package/tests/git-commit-transaction.test.ts +0 -302
- package/tests/review-compact.test.ts +0 -243
- package/tests/review-refuter-adapter.test.ts +0 -89
package/assets/orchestrator.md
CHANGED
|
@@ -8,6 +8,8 @@ Defined once in the identity/harness section injected above (the `Current person
|
|
|
8
8
|
|
|
9
9
|
## Core Role
|
|
10
10
|
|
|
11
|
+
Package assets root: `{{GENTLE_PI_ASSETS_ROOT}}`. Lazy asset paths below are relative to this root.
|
|
12
|
+
|
|
11
13
|
You are a COORDINATOR, not the default executor for substantial work. Maintain one thin conversation thread, delegate real phase work to Pi subagents when available, and synthesize results for the user.
|
|
12
14
|
|
|
13
15
|
Keep synthesis short by default: decision, outcome, next action. Expand only when the user asks or the situation requires detail.
|
|
@@ -20,7 +22,7 @@ Generated technical artifacts — whether by the parent inline or by subagents
|
|
|
20
22
|
|
|
21
23
|
Public/contextual comments and replies are different from technical artifacts. When using `comment-writer` or drafting a human-facing GitHub, PR review, Slack, Discord, or async comment, write in the target context language by default. Spanish issue/thread -> Spanish comment. English thread -> English comment. Mixed context -> target message language. Explicit user language or tone override wins. Spanish comments default to neutral/professional Spanish unless the user or target context clearly calls for regional tone.
|
|
22
24
|
|
|
23
|
-
Subagent-facing English delegation and the quote/UI/SDD-artifact exceptions: `
|
|
25
|
+
Subagent-facing English delegation and the quote/UI/SDD-artifact exceptions: `orchestrator-delegation.md`.
|
|
24
26
|
|
|
25
27
|
## Mental Model
|
|
26
28
|
|
|
@@ -38,86 +40,61 @@ Delegation is not optional once complexity appears. If a task crosses the trigge
|
|
|
38
40
|
Route work through the smallest harness that is safe. Three tiers:
|
|
39
41
|
|
|
40
42
|
1. **Inline Direct** — small, mechanical, parent has context (typo, one-file edit, read-only check of 1-3 known files, bash for state). No SDD ceremony; stop when it is no longer small.
|
|
41
|
-
2. **Simple Delegation** — generic non-SDD exploration → `gentle-ai-explore`; bounded implementation → `gentle-ai-worker`; command-running generic non-SDD verification → `gentle-ai-verify`. Try its package role; if missing/unusable, use native `Agent` under the same read-only mapping/verification constraints and report fallback. SDD roles stay inside SDD
|
|
42
|
-
3. **SDD** —
|
|
43
|
+
2. **Simple Delegation** — generic non-SDD exploration → `gentle-ai-explore`; bounded implementation → `gentle-ai-worker`; command-running generic non-SDD verification → `gentle-ai-verify`. Try its package role; if missing/unusable, use native `Agent` under the same read-only mapping/verification constraints and report fallback. SDD roles stay inside SDD.
|
|
44
|
+
3. **SDD (optional)** — selected only by an explicit request (`/gentle-sdd-new`/`/gentle-sdd-ff`/`/gentle-sdd-continue` or a direct ask) or an accepted proposal; size, file count, or risk alone never selects SDD. Suggest it organically when durable proposal/spec/design/tasks would materially reduce substantial ambiguity. Once selected, do not jump to implementation; create artifacts and gate for approval.
|
|
43
45
|
|
|
44
46
|
## Delegation Rules
|
|
45
47
|
|
|
46
48
|
Core question: does this inflate parent context without need?
|
|
47
49
|
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
| Read to explore/understand 4+ files | no | yes |
|
|
52
|
-
| Write atomic one-file mechanical change | yes | no |
|
|
53
|
-
| Write with analysis across multiple files | no | yes |
|
|
54
|
-
| Bash for state (e.g. git status) | yes | no |
|
|
55
|
-
| Bash for execution (tests/builds) | no | yes |
|
|
56
|
-
| Commit/push/PR after code changes | no | no actor; validate the approved receipt and exact target |
|
|
50
|
+
The canonical per-action table is the mirrored gentle-ai canon Delegation Rules table in `orchestrator-delegation.md`.
|
|
51
|
+
|
|
52
|
+
Before launching bounded writer (`gentle-ai-worker` or `worker`), task/context needs nonempty `## Allowed edit surfaces`: narrow repository-relative paths/globs; never `.`, bare repo root, or absolute. Parent derives surfaces, maps unknown targets read-only, shows derived candidates only for genuine scope choices. Do not ask the human to author paths or globs.
|
|
57
53
|
|
|
58
54
|
Mandatory Delegation Triggers — stop rules; once fired, delegate through the best available subagent runtime (prefer `subagent_run`, else Pi's native `Agent`):
|
|
59
55
|
|
|
60
56
|
1. **4-file rule** — 4+ files to understand → delegate a scout/mapping task.
|
|
61
57
|
2. **Multi-file write rule** — 2+ non-trivial files touched → delegate one writer.
|
|
62
|
-
3. **
|
|
63
|
-
4. **
|
|
64
|
-
5. **
|
|
65
|
-
6. **Long-session rule** — ~20 tool calls, 5 exploratory reads, or 2 non-mechanical edits without delegation → pause and delegate.
|
|
66
|
-
7. **Review actor rule** — review lenses run only when selected by ordinary transaction start; explicit Judgment Day uses its two named judges. Lifecycle and SDD boundaries launch zero review actors.
|
|
58
|
+
3. **Incident rule** — diagnose wrong cwd/worktree/git/tooling incidents separately before resuming work.
|
|
59
|
+
4. **Verification rule** — executing/delegating verification commands → `gentle-ai-verify`; only the 1-3-file read-only check stays inline.
|
|
60
|
+
5. **Long-session rule** — ~20 tool calls, 5 exploratory reads, or 2 non-mechanical edits without delegation → pause and delegate.
|
|
67
61
|
|
|
68
|
-
|
|
62
|
+
{{GENTLE_PI_BACKGROUND_POLICY}}; rules: the background-subagents block in the delegation contract.
|
|
63
|
+
|
|
64
|
+
Full table, Work Routing Ladder examples/model-routing detail, Cost and Context Balance, Canonical Workflows, and the mirrored gentle-ai canon (blocking-prompt relays, language, and delegation): `orchestrator-delegation.md`.
|
|
69
65
|
|
|
70
66
|
## SDD Workflow (lazy-loaded)
|
|
71
67
|
|
|
72
68
|
The detailed SDD workflow is intentionally not embedded in this always-on parent prompt. Before handling any `/sdd-*` command, natural-language SDD request, SDD continuation/routing, apply/verify/sync/archive work, or SDD/Judgment-Day phase delegation, read this package asset first:
|
|
73
69
|
|
|
74
|
-
`
|
|
70
|
+
`sdd-orchestrator-workflow.md`
|
|
75
71
|
|
|
76
72
|
That lazy surface contains the SDD phases, native dispatcher rules, status contract, preflight/init guards, artifact-store policy, execution mode, Strict TDD forwarding, phase result contract, and review workload guard.
|
|
77
73
|
|
|
78
|
-
Hard preflight invariant: `openspec/config.yaml`, existing SDD changes, installed `.pi`/global SDD assets, or a todo named "preflight" are not session preflight. Do not mark SDD preflight complete, start `sdd-init`, launch SDD subagents/chains, or move to explore/proposal/spec/design/tasks until this session has
|
|
74
|
+
Hard preflight invariant: `openspec/config.yaml`, existing SDD changes, installed `.pi`/global SDD assets, or a todo named "preflight" are not session preflight. Do not mark SDD preflight complete, start `sdd-init`, launch SDD subagents/chains, or move to explore/proposal/spec/design/tasks until this session has an injected `## SDD Session Preflight` block or a canonical-authority resolution. Defaults and capability constraints may resolve fields without confirmation prompts; preserve unresolved-choice and safety gates.
|
|
79
75
|
|
|
80
76
|
## Memory Contract
|
|
81
77
|
|
|
82
|
-
When
|
|
83
|
-
|
|
84
|
-
### Non-SDD delegation
|
|
85
|
-
|
|
86
|
-
- Read context: the parent/orchestrator searches memory (the injected Engram search tool), selects relevant observations, and passes them into the subagent prompt. The subagent does NOT search memory itself.
|
|
87
|
-
- Write context: the subagent MUST save significant discoveries, decisions, or bug fixes via the injected Engram save tool before returning when memory tools are available.
|
|
88
|
-
- Prompt forwarding: when delegating, add a concrete instruction such as: `If you make important discoveries, decisions, or fix bugs, save them to Engram via the available memory save tool with project: '<project>' before returning.`
|
|
89
|
-
|
|
90
|
-
SDD phase table, artifact keys, and the lifecycle rule: `{{GENTLE_PI_MEMORY_PATH}}`.
|
|
78
|
+
When memory is available, the parent selects context and subagents save significant discoveries before returning. SDD phase table, artifact keys, and persistence guidance: `orchestrator-memory.md`.
|
|
91
79
|
|
|
92
80
|
## Skill Registry Protocol
|
|
93
81
|
|
|
94
|
-
The parent resolves
|
|
82
|
+
The parent resolves matching skill paths once per session and passes them under `## Skills to load before work`. Subagents read those exact `SKILL.md` files before work; if the registry is absent, report that project-specific paths were unavailable.
|
|
95
83
|
|
|
96
|
-
Fallback-report semantics (`paths-injected`/`fallback-registry`/`fallback-path`/`none`) and the SDD-executor skill distinction: `
|
|
84
|
+
Fallback-report semantics (`paths-injected`/`fallback-registry`/`fallback-path`/`none`) and the SDD-executor skill distinction: `orchestrator-skills.md`.
|
|
97
85
|
|
|
98
86
|
## Intent-Driven Skill Discovery
|
|
99
87
|
|
|
100
|
-
For skill-shaped requests, do not treat injected `<available_skills>` as complete; use the registry/filesystem only as a discovery aid, never to override a small request or a user's concrete ask. Discovery order, the common intent-hint table, and fallback behavior when no skill matches: `
|
|
88
|
+
For skill-shaped requests, do not treat injected `<available_skills>` as complete; use the registry/filesystem only as a discovery aid, never to override a small request or a user's concrete ask. Discovery order, the common intent-hint table, and fallback behavior when no skill matches: `orchestrator-skills.md`.
|
|
89
|
+
|
|
90
|
+
## Gentle AI RDD ownership
|
|
91
|
+
|
|
92
|
+
Gentle AI dynamically supplies runtime-specific RDD instructions via generated Pi APPEND_SYSTEM composition. Follow only those exact native instructions; if absent or unsupported, this package does not invent or fall back.
|
|
101
93
|
|
|
102
94
|
## Safety
|
|
103
95
|
|
|
96
|
+
- Relay blocking prompts losslessly; STOP for the human's answer.
|
|
104
97
|
- Never commit unless the user explicitly asks.
|
|
105
98
|
- Ask before destructive git operations, publishing, or irreversible file changes.
|
|
106
99
|
- Keep writes single-threaded unless isolated worktrees are explicitly approved.
|
|
107
100
|
- Preserve human control: user decisions beat agent momentum.
|
|
108
|
-
|
|
109
|
-
## Bounded Review Transactions
|
|
110
|
-
|
|
111
|
-
New ordinary review uses negotiated v1 `gentle_review` `start -> finalize -> validate`. Target status owns one action. START freezes scope, findings, risk, and budget. FINALIZE permits one correction; failure escalates.
|
|
112
|
-
|
|
113
|
-
Compact gates use zero actors and rederive authority, target, and evidence. Pi adds one-shot authorization. Legacy authority is read-only; Judgment Day is separate.
|
|
114
|
-
Release from protected `main` may bypass receipt validation only when its immutable remote SHA and required CI are proven; otherwise native receipt validation applies.
|
|
115
|
-
Major and post-incident releases require explicit extraordinary review even when fast-path checks pass.
|
|
116
|
-
|
|
117
|
-
Dangerous-command safety remains independent and authoritative.
|
|
118
|
-
|
|
119
|
-
SDD completion adds no review or Judgment Day pass.
|
|
120
|
-
|
|
121
|
-
Review/SDD never publish. The durable transaction may create one local commit after native validation and HEAD proof.
|
|
122
|
-
|
|
123
|
-
Controller and actor contract: `{{GENTLE_PI_DELEGATION_PATH}}`.
|
|
@@ -7,21 +7,22 @@ This is the lazy-loaded SDD workflow surface for el Gentleman on Pi. Read this f
|
|
|
7
7
|
SDD phases:
|
|
8
8
|
|
|
9
9
|
```text
|
|
10
|
-
init → explore → proposal → spec → design → tasks → apply → verify → sync → archive
|
|
10
|
+
init → explore → research (optional) → proposal → spec → design → tasks → apply → verify → sync → archive
|
|
11
11
|
```
|
|
12
12
|
|
|
13
13
|
Dependency graph:
|
|
14
14
|
|
|
15
15
|
```text
|
|
16
|
+
explore → research (optional) → proposal
|
|
16
17
|
proposal → spec ─┬→ tasks → apply → verify → sync → archive
|
|
17
18
|
proposal → design ┘
|
|
18
19
|
```
|
|
19
20
|
|
|
20
|
-
`/sdd-status [change]` is the read-only status action for resolving the active change, artifact paths, task progress, dependency readiness, and action context before apply/verify/sync/archive.
|
|
21
|
+
`/gentle-sdd-status [change]` is the read-only status action for resolving the active change, artifact paths, task progress, dependency readiness, and action context before apply/verify/sync/archive.
|
|
21
22
|
|
|
22
23
|
## Native SDD Dispatcher
|
|
23
24
|
|
|
24
|
-
The user expresses intent; they should not have to administer phases manually. For natural-language SDD requests and `/sdd-continue`, the parent/orchestrator must use the native status engine as the state authority, decide the next phase, and delegate only the phase that status marks ready.
|
|
25
|
+
The user expresses intent; they should not have to administer phases manually. For natural-language SDD requests and `/gentle-sdd-continue`, the parent/orchestrator must use the native status engine as the state authority, decide the next phase, and delegate only the phase that status marks ready.
|
|
25
26
|
|
|
26
27
|
Flow:
|
|
27
28
|
|
|
@@ -31,8 +32,8 @@ user intent → preflight/init guard → native status engine → phase decision
|
|
|
31
32
|
|
|
32
33
|
Rules:
|
|
33
34
|
|
|
34
|
-
- `/sdd-status` is a debug/status command, not the main UX.
|
|
35
|
-
- `/sdd-continue` is the native dispatcher command: resolve status, choose the next ready phase, and carry status/instructions into the subagent prompt.
|
|
35
|
+
- `/gentle-sdd-status` is a debug/status command, not the main UX.
|
|
36
|
+
- `/gentle-sdd-continue` is the native dispatcher command: resolve status, choose the next ready phase, and carry status/instructions into the subagent prompt.
|
|
36
37
|
- `sdd-apply`, `sdd-verify`, `sdd-sync`, and `sdd-archive` must obey parent-provided native status; they must not reconstruct readiness from prompt inference when status JSON is present.
|
|
37
38
|
- Do not launch a phase when native status marks that dependency `blocked`.
|
|
38
39
|
- `sdd-archive` cannot proceed unless native status says `dependencies.archive` is `ready` or `all_done` — UNLESS the store carve-out is active (`nextRecommended: "resolve-via-engram"`), in which case resolve archive readiness from Engram instead of treating `not_applicable` as a gate failure.
|
|
@@ -40,7 +41,7 @@ Rules:
|
|
|
40
41
|
|
|
41
42
|
## SDD Status Contract
|
|
42
43
|
|
|
43
|
-
Before `/sdd-continue`, `sdd-apply`, `sdd-verify`, `sdd-sync`, or `sdd-archive`, resolve and carry structured status. Lookup order: parent-provided status, then project override `.pi/gentle-ai/support/sdd-status-contract.md`, then globally installed `~/.pi/agent/gentle-ai/support/sdd-status-contract.md`, then the embedded `sdd-status` prompt contract. Do not use `assets/support/...` as a runtime path; that is only the package source path before installation.
|
|
44
|
+
Before `/gentle-sdd-continue`, `sdd-apply`, `sdd-verify`, `sdd-sync`, or `sdd-archive`, resolve and carry structured status. Lookup order: parent-provided status, then project override `.pi/gentle-ai/support/sdd-status-contract.md`, then globally installed `~/.pi/agent/gentle-ai/support/sdd-status-contract.md`, then the embedded `sdd-status` prompt contract. Do not use `assets/support/...` as a runtime path; that is only the package source path before installation.
|
|
44
45
|
|
|
45
46
|
Status must include:
|
|
46
47
|
|
|
@@ -55,21 +56,17 @@ Do not guess the active change. If change selection is ambiguous, ask the user a
|
|
|
55
56
|
|
|
56
57
|
## Lazy SDD Preflight
|
|
57
58
|
|
|
58
|
-
Do not ask SDD setup questions on session start. The first time the user initiates an SDD process in a Pi session, run the SDD preflight once and keep those choices for the rest of that session. Runtime trigger detection is intentionally deterministic: slash SDD flows and `/sdd-init` run preflight automatically; for natural-language requests, the parent/orchestrator decides semantically whether SDD is needed and must run/reuse `/gentle:sdd-preflight` before continuing.
|
|
59
|
+
Do not ask SDD setup questions on session start. The first time the user initiates an SDD process in a Pi session, run the SDD preflight once and keep those choices for the rest of that session. Runtime trigger detection is intentionally deterministic: slash SDD flows and `/gentle-sdd-init` run preflight automatically; for natural-language requests, the parent/orchestrator decides semantically whether SDD is needed and must run/reuse `/gentle:sdd-preflight` before continuing.
|
|
59
60
|
|
|
60
|
-
**Hard gate:** `openspec/config.yaml`, existing SDD changes, installed `.pi`/global SDD assets, or a todo named "preflight" are not session preflight. They are project context only. Do not mark SDD preflight complete, start `sdd-init`, launch SDD subagents/chains, or move to explore/proposal/spec/design/tasks until this session has
|
|
61
|
+
**Hard gate:** `openspec/config.yaml`, existing SDD changes, installed `.pi`/global SDD assets, or a todo named "preflight" are not session preflight. They are project context only. Do not mark SDD preflight complete, start `sdd-init`, launch SDD subagents/chains, or move to explore/proposal/spec/design/tasks until this session has an injected `## SDD Session Preflight` block or an equivalent resolution from the canonical authority order below.
|
|
61
62
|
|
|
62
|
-
1.
|
|
63
|
-
2. an explicit user answer in the current conversation covering all four preflight choices below.
|
|
63
|
+
Resolve each field in this order: (1) explicit current user/session choice, (2) valid persisted preference, (3) capability or already-selected strategy constraint, (4) canonical documented default, and (5) ask only when the field is genuinely unresolved. If `/gentle:sdd-preflight` cannot be invoked, resolve the same order inline; do not recreate a four-question setup prompt. Missing Engram is a capability constraint that resolves the artifact store to `openspec` unless the user has made an incompatible explicit request, which remains a human decision.
|
|
64
64
|
|
|
65
|
-
|
|
65
|
+
Preflight canonical defaults are execution `auto`, artifact store `openspec`, delivery strategy `ask-on-risk`, and review budget `400`; capability and already-selected constraints may narrow them.
|
|
66
66
|
|
|
67
|
-
|
|
67
|
+
Selectors/inputs appear only for genuinely unresolved fields. Defaulted and one-option fields do not prompt; persisted/session values are reused, and an explicit current choice overrides them when presented. `chain_strategy` remains deferred, and `exception-ok` requires explicit `size:exception` acceptance and is never inferred.
|
|
68
68
|
|
|
69
|
-
-
|
|
70
|
-
- artifact store: `openspec`, `engram`, or `both` when callable memory tools are available;
|
|
71
|
-
- chained PR strategy: `auto-forecast`, `ask-always`, `single-pr-default`, or `force-chained`;
|
|
72
|
-
- review budget in changed lines.
|
|
69
|
+
The exact `delivery_strategy` domain accepted by `sdd-tasks` and `sdd-apply` is `ask-on-risk`, `auto-chain`, `single-pr`, or `exception-ok`; above the review threshold, `auto-chain` resolves without asking again.
|
|
73
70
|
|
|
74
71
|
The package should ensure SDD assets are present as global Pi runtime assets without the user needing to remember per-project setup commands. If assets are missing, install them non-destructively into:
|
|
75
72
|
|
|
@@ -82,15 +79,19 @@ Manual install commands are recovery/debug paths, not the happy path. `/gentle:s
|
|
|
82
79
|
|
|
83
80
|
## Init Guard
|
|
84
81
|
|
|
85
|
-
Before any SDD flow, make sure project context exists.
|
|
82
|
+
Before any SDD flow, make sure project context exists. Where that context lives depends on the session's artifact store, so qualify the check by store before acting on it.
|
|
86
83
|
|
|
87
|
-
|
|
84
|
+
When the store is `openspec` or `both`, the local artifact is:
|
|
88
85
|
|
|
89
86
|
```text
|
|
90
87
|
openspec/config.yaml
|
|
91
88
|
```
|
|
92
89
|
|
|
93
|
-
If it is missing, ask the user for the minimal information needed or run `/sdd-init` if available.
|
|
90
|
+
If it is missing, ask the user for the minimal information needed or run `/gentle-sdd-init` if available.
|
|
91
|
+
|
|
92
|
+
When the store is `engram` or `none`, `/gentle-sdd-init` never writes that file, so its absence is expected and is not a missing init. Never re-trigger `/gentle-sdd-init` over it. Resolve project context from the Engram `sdd-init/{project}` topic for `engram`, or inline from the session for `none`, and ask the user only when that context is genuinely absent.
|
|
93
|
+
|
|
94
|
+
This init guard runs after the session preflight gate above; project config presence or absence never substitutes for session preflight choices. Do not proceed with a substantial SDD flow while pretending project context, testing capability, or session preflight choices are known.
|
|
94
95
|
|
|
95
96
|
## Artifact Store Policy
|
|
96
97
|
|
|
@@ -104,8 +105,10 @@ This package does not provide persistent memory by itself.
|
|
|
104
105
|
|
|
105
106
|
Use the session's SDD preflight choice:
|
|
106
107
|
|
|
107
|
-
- `
|
|
108
|
-
- `
|
|
108
|
+
- `auto`: phases run back-to-back without pausing, but the orchestrator gatekeeper validates after each phase before launching the next.
|
|
109
|
+
- `interactive`: after each phase, show a concise summary and ask whether to adjust or continue.
|
|
110
|
+
|
|
111
|
+
If the user doesn't specify, default to `auto`. After scope approval, expect zero further prompts on the happy path and at most one actionable prompt per recoverable failure; the gatekeeper summarizes phase progress instead of interrupting except on a second consecutive gate failure or a genuine scope/product decision.
|
|
109
112
|
|
|
110
113
|
In interactive mode, between phases:
|
|
111
114
|
|
|
@@ -117,6 +120,40 @@ Interactive approval is phase-scoped. A user response such as "continue", "dale"
|
|
|
117
120
|
|
|
118
121
|
Before `sdd-proposal` in interactive mode, offer the user a proposal question round instead of silently deciding whether the proposal is clear enough. Explain that the questions are meant to improve the PRD/proposal by uncovering business understanding, business rules, implications, impact, edge cases, and product tradeoffs. Prefer 3–5 concrete product questions per round, then summarize the resulting assumptions and ask whether the user wants to correct anything or run a second question round. Cover business/product/PRD decisions: business problem, target users and situations, business rules, product outcome, current-state gap, implications and impact, edge cases, decision gaps, first-slice scope boundaries, non-goals, product constraints, and business tradeoffs. Do not ask about test commands, PR shape, changed-line budget, or other harness mechanics at proposal time unless the user explicitly asks to discuss delivery.
|
|
119
122
|
|
|
123
|
+
## Research and Pre-Proposal Gate
|
|
124
|
+
|
|
125
|
+
This gate is MANDATORY and applies in both execution modes; in interactive mode it runs alongside the proposal question round above, and the two never contradict: the question round shapes the proposal, the gate decides whether `sdd-proposal` may launch at all.
|
|
126
|
+
|
|
127
|
+
- Offer `sdd-research` immediately after `sdd-explore`. Research is optional until selected; selection makes completion mandatory.
|
|
128
|
+
- Before every proposal, invoke `sdd-proposal` only when selected research is `done` or research is unselected, product decisions are `confirmed`, evidence references are valid, and the selected artifact-store state is ready.
|
|
129
|
+
- The orchestrator owns product discovery. In automatic mode, unresolved product choices require one lossless grouped prompt with all context, options, consequences, allowed answers, and exact tokens; the orchestrator MUST persist the pending pre-proposal state before prompting, then STOP without invoking `sdd-proposal`.
|
|
130
|
+
- The proposer receives a confirmed pre-proposal handoff and MUST NOT interview the user or infer consent.
|
|
131
|
+
- Pi's native `gentle-pi.sdd-status` contract remains the sole status contract. Research and pre-proposal state are orchestrator-owned prose and artifacts (`sdd/{change}/research`, `sdd/{change}/preproposal`, `openspec/changes/{change}/research.md`) layered on top — never a native status field.
|
|
132
|
+
|
|
133
|
+
Runtime note: this runtime declares no evidence grants (`documentation=[]; open-web=[]`), so a SELECTED research lane fail-closes to a `blocked` outcome and blocks proposal readiness until the user deselects research or evidence capability arrives. SDD chains treat research as unselected.
|
|
134
|
+
|
|
135
|
+
## Delivery Strategy
|
|
136
|
+
|
|
137
|
+
On the first SDD chain request in a session, resolve the delivery strategy from preflight (or ask once) and cache it:
|
|
138
|
+
|
|
139
|
+
- `ask-on-risk` — default; ask only when the tasks forecast detects review-budget risk.
|
|
140
|
+
- `auto-chain` — automatically split into chained/stacked PR slices when needed.
|
|
141
|
+
- `single-pr` — proceed as one PR only if the size is within budget.
|
|
142
|
+
- `exception-ok` — user accepts `size:exception` when over budget. The preflight menu cannot select this; it is reached only when the user explicitly accepts `size:exception`, either up front or when `ask-on-risk` stops to ask.
|
|
143
|
+
|
|
144
|
+
These four are the whole domain. Pass `delivery_strategy` to `sdd-tasks` and `sdd-apply`.
|
|
145
|
+
|
|
146
|
+
## Chain Strategy
|
|
147
|
+
|
|
148
|
+
When delivery planning yields chained PRs, ask once for chain strategy and cache it:
|
|
149
|
+
|
|
150
|
+
- `stacked-to-main` — each PR targets the previous PR branch or main in sequence.
|
|
151
|
+
- `feature-branch-chain` — PR #1 targets the tracker branch; child PRs target the immediate previous PR branch; only the tracker merges to main.
|
|
152
|
+
|
|
153
|
+
When chained PRs are selected, treat the registry skill `gentle-ai-chained-pr` as a required skill match. Resolve and forward it by registry path to `sdd-tasks` and `sdd-apply`; do not hardcode its path.
|
|
154
|
+
|
|
155
|
+
Pass it as `chain_strategy` to `sdd-tasks` and `sdd-apply` prompts alongside `delivery_strategy`.
|
|
156
|
+
|
|
120
157
|
## Result Contract
|
|
121
158
|
|
|
122
159
|
Every phase result should include:
|
|
@@ -132,6 +169,10 @@ skill_resolution
|
|
|
132
169
|
|
|
133
170
|
The parent should synthesize these envelopes, not paste long raw reports unless needed.
|
|
134
171
|
|
|
172
|
+
### Key Learnings closing block (routing)
|
|
173
|
+
|
|
174
|
+
Every installed SDD phase executor agent (`assets/agents/sdd-*.md`) carries the effective `## Key Learnings Closing` contract in its own loaded prompt; this workflow file documents routing only and is not the executor authority. Each phase executor closes its final report text with a `## Key Learnings` block that the Engram memory provider passively extracts. Generic delegated workers receive the same closing instruction via `assets/orchestrator-delegation.md`.
|
|
175
|
+
|
|
135
176
|
## Automatic Mode Gatekeeper
|
|
136
177
|
|
|
137
178
|
In `auto` execution mode, the parent/orchestrator is the quality gate between SDD phases. After a delegated phase returns and before launching the next phase, validate that the phase actually reached its objective. This validation is autonomous: do not ask the user on the happy path, but stop and report if the gate catches a real problem.
|
|
@@ -146,7 +187,7 @@ Check every phase result against the Result Contract:
|
|
|
146
187
|
|
|
147
188
|
Use cost-aware validation:
|
|
148
189
|
|
|
149
|
-
- For lower-risk phases (`sdd-explore`, `sdd-spec`, `sdd-tasks`, `sdd-sync`, `sdd-archive`), the parent may validate inline by reading artifacts back and checking claims.
|
|
190
|
+
- For lower-risk phases (`sdd-explore`, `sdd-research`, `sdd-spec`, `sdd-tasks`, `sdd-sync`, `sdd-archive`), the parent may validate inline by reading artifacts back and checking claims.
|
|
150
191
|
- For higher-risk phases (`sdd-design`, `sdd-apply`), validate the artifact, declared paths, task state, and focused test evidence directly before continuing because errors there compound downstream.
|
|
151
192
|
- If a gate finds any smell — missing artifact, status mismatch, unresolved path, likely drift, or critical risk — rerun the same SDD phase once with corrective feedback. SDD phase validation does not start ordinary review or Judgment Day.
|
|
152
193
|
|
|
@@ -154,9 +195,83 @@ On gate pass, continue automatically to the next phase. On gate fail, rerun the
|
|
|
154
195
|
|
|
155
196
|
The gatekeeper is additive: it does not relax the Review Workload Guard, Strict TDD Forwarding, native status dependency checks, or mandatory delegation rules. It never creates a post-SDD review pass.
|
|
156
197
|
|
|
198
|
+
## Native Runtime Attempt Authority
|
|
199
|
+
|
|
200
|
+
The package-local Gentle AI runtime owns the Git-common-dir compact SDD attempt ledger. It is the sole attempt and changed-line budget authority for both OpenSpec and Engram flows on Pi. Pi must not implement a local attempt mirror, counter, token store, state machine, or extension interception layer; such code would duplicate provider authority and could not truthfully settle all runs.
|
|
201
|
+
|
|
202
|
+
Before every runtime-bearing `sdd-apply`, `sdd-verify`, or remediation actor/harness launch, the orchestrator MUST call the compact acquire:
|
|
203
|
+
|
|
204
|
+
```text
|
|
205
|
+
gentle-ai sdd-attempt acquire --cwd <repo> --change <change> --request-id <id> --work-unit <label> --evidence-goal <goal> --max-attempts <count> --max-changed-lines <count>
|
|
206
|
+
```
|
|
207
|
+
|
|
208
|
+
Pass `--token` only to continue an active attempt; pass `--remediates-evidence-revision` only for an unmanaged remediation. Do not invent continuation or remediation state the provider has not returned.
|
|
209
|
+
|
|
210
|
+
The provider returns exactly one routing state from `proceed|blocked|complete`:
|
|
211
|
+
|
|
212
|
+
- `proceed`: launch only on `proceed`; retain the opaque token for settle.
|
|
213
|
+
- `blocked`: do not launch; stop and report.
|
|
214
|
+
- `complete`: do not launch; the objective is settled.
|
|
215
|
+
|
|
216
|
+
Never persist caller-authored attempt counters, tokens, or state in OpenSpec artifacts, Engram memory, prompts, or any Pi-owned state.
|
|
217
|
+
|
|
218
|
+
After the external run completes, call the compact settle with a request ID distinct from acquire, reusing an operation's own ID only for idempotent replay of that exact operation:
|
|
219
|
+
|
|
220
|
+
```text
|
|
221
|
+
gentle-ai sdd-attempt settle --cwd <repo> --change <change> --token <token> --request-id <id> --outcome <failed|interrupted|passed> --evidence-revision <sha256:...> --diagnosis <text> --harness-disposition <reused|invalidated> --cleanup-evidence <text> --process-evidence <text>
|
|
222
|
+
```
|
|
223
|
+
|
|
224
|
+
Every settle field is required: `cwd`, `change`, `token`, `request-id`, `outcome`, `evidence-revision`, `diagnosis`, `harness-disposition`, `cleanup-evidence`, and `process-evidence`. `evidence-revision` is never `none`. Pass `--successor-lineage` only for a distinct approved successor; the current/bound lineage remains itself otherwise. Pass `--remediates-evidence-revision` only when repairing a specific failed evidence revision. Settle derives binding and remediation inputs; the orchestrator never invents them.
|
|
225
|
+
|
|
226
|
+
`status`, `begin`, `finish`, and `reset` are diagnostic/compatibility surfaces, not the normal runtime route. Route continuation only from the provider-returned `proceed|blocked|complete`. `reset` is never automatic and requires an explicit maintainer scope decision.
|
|
227
|
+
|
|
228
|
+
### Gatekeeper Reconciliation
|
|
229
|
+
|
|
230
|
+
The Automatic Mode Gatekeeper one-rerun rule above is a quality gate, not a launch authorization. A rerun never bypasses native attempt authority: every rerun still requires a fresh compact acquire, and the rerun must stop immediately if the provider returns `blocked` or `complete`. The gatekeeper quality rule is preserved and remains subordinate to this authority.
|
|
231
|
+
|
|
157
232
|
## SDD Phase Delegation Mode
|
|
158
233
|
|
|
159
|
-
Launch SDD phase subagents with `subagent_run` `mode: "task"` when the parent needs the phase result to route the next step.
|
|
234
|
+
Launch SDD phase subagents with `subagent_run` `mode: "task"` when the parent needs the phase result to route the next step. SDD phases, writers, dependent verify evidence, and archive are foreground-mandatory under the background subagent policy block in the delegation contract; background completion is a notification/history mechanism, not an orchestration resume guarantee.
|
|
235
|
+
|
|
236
|
+
## Model Assignments
|
|
237
|
+
|
|
238
|
+
Read this table before the first SDD/Judgment-Day phase delegation in a session, cache it, and use it only for SDD/Judgment-Day phase agents. If a phase is missing, use the `default` row. If the assigned tier is unavailable, use the runtime's default model and continue.
|
|
239
|
+
|
|
240
|
+
On Pi, phase model routing is user-owned and persisted, not prompt-passed: `/gentle:models` writes `.pi/gentle-ai/models.json`, and the package applies each saved assignment to the installed phase agent definitions (frontmatter `model:`/`thinking:`) or `.pi/settings.json` overrides. The table below is the default capability tier per phase when the user has saved no assignment.
|
|
241
|
+
|
|
242
|
+
**Mandatory phase model gate:** before launching an SDD/Judgment-Day phase agent, confirm the phase resolves through the saved model config or these defaults. Never pass an ad-hoc `model` parameter for SDD/Judgment-Day phases, and never apply this table to generic Pi delegation — generic subagents resolve model/thinking through `pi-subagents` config, and `model` is passed there only on an explicit user override.
|
|
243
|
+
|
|
244
|
+
| Phase | Default tier | Reason |
|
|
245
|
+
| ------------ | -------------- | ------------------------------------------ |
|
|
246
|
+
| sdd-explore | balanced | Reads code, structural - not architectural |
|
|
247
|
+
| sdd-research | balanced | Fail-closed evidence record keeping |
|
|
248
|
+
| sdd-proposal | deep-reasoning | Architectural decisions |
|
|
249
|
+
| sdd-spec | balanced | Structured writing |
|
|
250
|
+
| sdd-design | deep-reasoning | Architecture decisions |
|
|
251
|
+
| sdd-tasks | balanced | Mechanical breakdown |
|
|
252
|
+
| sdd-apply | balanced | Implementation |
|
|
253
|
+
| sdd-verify | balanced | Validation against spec |
|
|
254
|
+
| sdd-sync | fast | Reflect verified state |
|
|
255
|
+
| sdd-archive | fast | Copy and close |
|
|
256
|
+
| jd-judge-a | deep-reasoning | Adversarial review |
|
|
257
|
+
| jd-judge-b | deep-reasoning | Adversarial review |
|
|
258
|
+
| jd-fix-agent | balanced | Surgical confirmed fixes |
|
|
259
|
+
| default | balanced | SDD/JD phase fallback |
|
|
260
|
+
|
|
261
|
+
## Sub-Agent Launch Deduplication
|
|
262
|
+
|
|
263
|
+
Maintain a session-scoped launch log of `(phase, task-fingerprint)` pairs. If the same pair already exists, do NOT launch again. Emit exactly one launch per distinct task and append the pair after launch.
|
|
264
|
+
|
|
265
|
+
## Sub-Agent Launch Protocol
|
|
266
|
+
|
|
267
|
+
Pre-flight before every SDD/Judgment-Day phase launch:
|
|
268
|
+
|
|
269
|
+
1. Identify the phase key (`sdd-apply`, `sdd-verify`, `jd-judge-a`, etc.).
|
|
270
|
+
2. Confirm its model routing per the Model Assignments gate above.
|
|
271
|
+
3. Resolve matching skill paths once per session from the registry and pass exact `SKILL.md` paths under `## Skills to load before work`.
|
|
272
|
+
4. If a delegated result reports `skill_resolution` as `fallback-registry`, `fallback-path`, or `none`, re-read the registry before subsequent delegations.
|
|
273
|
+
|
|
274
|
+
**Key Learnings closing (generic delegations):** when delegating to generic agents (`gentle-ai-explore`, `gentle-ai-worker`, `gentle-ai-verify`, scout/worker roles, or the native `Agent` fallback), apply the rule exactly as stated under "Key Learnings closing block" in `assets/orchestrator-delegation.md`. That file is the single statement of the rule; do not restate or paraphrase it here. SDD phase launch prompts need no such injection: every installed SDD phase executor already carries the effective contract in its own prompt (see "Key Learnings closing block (routing)" above).
|
|
160
275
|
|
|
161
276
|
## Strict TDD Forwarding
|
|
162
277
|
|
|
@@ -170,12 +285,35 @@ STRICT TDD MODE IS ACTIVE. Test runner: <command>. Follow RED, GREEN, TRIANGULAT
|
|
|
170
285
|
|
|
171
286
|
Do not rely on the child agent to discover this independently.
|
|
172
287
|
|
|
288
|
+
## Archive Final-State Handoff
|
|
289
|
+
|
|
290
|
+
When launching `sdd-archive`, forward explicit final-state facts for any work completed after `apply-progress`, `verify-report`, or `sync-report` were persisted — verify warnings fixed in later commits, blockers resolved, tasks finished, updated test or issue counts — with commit or evidence references where available. Those artifacts are intermediate snapshots, valid at the time they were written; the archive report records the state at close, and explicit final-state facts in the `sdd-archive` launch prompt outrank stale snapshot claims.
|
|
291
|
+
|
|
173
292
|
## Review Workload Guard
|
|
174
293
|
|
|
175
|
-
After `sdd-tasks` and before `sdd-apply`, inspect the task output
|
|
294
|
+
After `sdd-tasks` completes and before launching `sdd-apply`, inspect the task output's `Review Workload Forecast`.
|
|
176
295
|
|
|
177
|
-
If
|
|
296
|
+
If it says `Chained PRs recommended: Yes`, `400-line budget risk: High`, estimated changed lines exceed 400, or `Decision needed before apply: Yes`, apply the cached `delivery_strategy`:
|
|
297
|
+
|
|
298
|
+
- `ask-on-risk`: stop and ask whether to split or proceed with `size:exception`.
|
|
299
|
+
- `auto-chain`: split automatically; ask for `chain_strategy` only if missing.
|
|
300
|
+
- `single-pr`: stop and require/record `size:exception` before apply.
|
|
301
|
+
- `exception-ok`: continue and tell `sdd-apply` this run uses `size:exception`.
|
|
302
|
+
|
|
303
|
+
Any other `delivery_strategy` value is invalid. Do NOT pick the nearest branch and do NOT proceed: STOP, report the unrecognised value, and re-collect the delivery strategy before launching `sdd-apply`.
|
|
304
|
+
|
|
305
|
+
Always pass the resolved `delivery_strategy`, `chain_strategy`, and any chosen PR boundary/exception to `sdd-apply` in the launch prompt.
|
|
178
306
|
|
|
179
307
|
Any review transaction explicitly started outside SDD persists through its own artifact-store branch and budget. SDD completion itself launches no review actors and mints no review authority.
|
|
180
308
|
|
|
181
309
|
Automatic mode does not override reviewer burnout protection.
|
|
310
|
+
|
|
311
|
+
## Recovery
|
|
312
|
+
|
|
313
|
+
- `engram` → resolve state with the injected memory search/get tools on the change topic keys (`sdd/{change-name}/...`).
|
|
314
|
+
- `openspec` → read `openspec/changes/<change>/` artifacts and re-derive readiness through the native status engine.
|
|
315
|
+
- `none` → state is not persisted; explain the limitation.
|
|
316
|
+
|
|
317
|
+
## Provider Defect Handoff
|
|
318
|
+
|
|
319
|
+
When an SDD task encounters a possible Gentle AI provider defect, the full contract lives in `assets/orchestrator-delegation.md` under `#### Gentle AI Provider Defect Handoff (MANDATORY)`. This workflow intentionally provides no summary, alternate report route, or RDD lifecycle instruction.
|
|
@@ -13,6 +13,16 @@ Any phase that selects, continues, applies, verifies, syncs, or archives an SDD
|
|
|
13
13
|
- If multiple active changes match or the active change is unclear, ask the user to choose. Do not guess.
|
|
14
14
|
- If no active changes exist, report that no SDD change is active and suggest starting one.
|
|
15
15
|
|
|
16
|
+
## Native Engine
|
|
17
|
+
|
|
18
|
+
- For file-backed `openspec` or `both` sessions with an `openspec/` directory, use Gentle Pi's local SDD status engine as the artifact-state authority. It resolves the local artifact graph without consulting RDD authority or receipts.
|
|
19
|
+
- For non-authoritative stores (`engram`, `none`, and `both` without an `openspec/` directory), do not treat disk status output as authoritative; follow Engine Authority by Store below.
|
|
20
|
+
- Runtime-attempt authority is different from artifact dispatch: normal runtime-bearing OpenSpec and Engram continuations MUST bracket external execution with `gentle-ai sdd-attempt acquire|settle --cwd <repo> --change <change>`. Their bounded result contains only `proceed`, `blocked`, or `complete` plus an opaque continuation token when required, and MAY carry `settle_obligation` on a `proceed`. The Git-common-dir immutable chain remains the sole authority for ordinals, cumulative attempt/line budgets, runtime evidence, and atomic bound remediation.
|
|
21
|
+
- A phase actor launched BY a parent that already holds a `proceed`-state acquire for that exact work unit is a distinct call/process, not a fresh continuation: it MUST NOT `acquire` again blind. Colliding with its own parent's active attempt is not a genuine `blocked: active_attempt` (#2291). It authenticates as that SAME attempt by passing the parent's returned token on its own `acquire --token <token>` call: a token matching the ledger's live active attempt returns `proceed` with that same token and zero mutation, while a non-matching token gets the ordinary `blocked: active_attempt` naming the real active token.
|
|
22
|
+
- When `blockedReasons` is non-empty, do not proceed to terminal, archive, or apply work. Return or report `blockedReasons` and stop unless `nextRecommended` is `verify`, in which case verification may run only to remediate or refresh evidence for the blockers. When `nextRecommended` is `resolve-blockers`, always report `blockedReasons` and stop. When `nextRecommended` is a planning token (`propose`, `spec`, `design`, or `tasks`), launch the corresponding planning phase — missing planning artifacts are the expected output of those phases, not genuine blockers.
|
|
23
|
+
- `nextRecommended` is a bounded machine token for routing, not human prose. Route only by `nextRecommended` and dependency states. Human-readable explanation belongs in `blockedReasons`, not `nextRecommended`.
|
|
24
|
+
- If the binary is unavailable, fall back to this prompt contract and the manual status schema below. Manual fallback status MUST stay shape-compatible with the native status JSON even when values are reconstructed manually.
|
|
25
|
+
|
|
16
26
|
## Status Schema
|
|
17
27
|
|
|
18
28
|
Return status as markdown with these fields, or equivalent JSON when the host supports it:
|
|
@@ -71,13 +81,13 @@ actionContext:
|
|
|
71
81
|
workspaceRoot: <absolute path>
|
|
72
82
|
allowedEditRoots: [<absolute paths>]
|
|
73
83
|
warnings: []
|
|
74
|
-
nextRecommended: <
|
|
84
|
+
nextRecommended: <bounded-machine-token>
|
|
75
85
|
isNonAuthoritative: false # boolean; true when the native engine is not authoritative for the store
|
|
76
86
|
```
|
|
77
87
|
|
|
78
88
|
## Task Ownership
|
|
79
89
|
|
|
80
|
-
|
|
90
|
+
New task checkboxes end with the terminal marker `<!-- sdd-owner: implementation -->`. An unmarked legacy checkbox is implementation-owned. Supported legacy non-implementation rows are informational only. Any line containing `sdd-owner` that is unsupported, duplicated, or non-terminal is malformed: add its exact line to `taskArtifactErrors` and `blockedReasons`, and count it as unresolved implementation work even when checked. `taskProgress` reports implementation work.
|
|
81
91
|
|
|
82
92
|
## Apply State
|
|
83
93
|
|
|
@@ -89,9 +99,9 @@ Each checkbox may end with one terminal marker: `<!-- sdd-owner: implementation
|
|
|
89
99
|
## Dependency States
|
|
90
100
|
|
|
91
101
|
- `apply` is `ready` only when specs, design, and tasks are available and task progress is not all done.
|
|
92
|
-
- `verify` is ready
|
|
102
|
+
- `verify` is ready after implementation completion when tasks are complete or apply-progress exists. RDD authority and receipts never gate the apply -> verify -> sync -> archive route. Unchecked implementation tasks remain CRITICAL blockers for full archive readiness.
|
|
93
103
|
- `sync` is `ready` only when verify-report exists and has no unresolved `FAIL`, `BLOCKED`, `CRITICAL`, or verification blockers. `engram`/`none` modes may mark sync `not_applicable`.
|
|
94
|
-
- `archive` is `ready` only when verify-report exists, sync is complete or not applicable, implementation tasks are complete
|
|
104
|
+
- `archive` is `ready` only when verify-report exists, sync is complete or not applicable, and implementation tasks are complete. CRITICAL verification issues have no override. Explicit recorded exceptions are limited to non-critical partial archives or stale-checkbox reconciliation when apply-progress/verify-report prove completion.
|
|
95
105
|
- `not_applicable`: emitted for non-authoritative stores (engram, none, and both when no `openspec/` directory exists) when `nextRecommended: "resolve-via-engram"` is active. `not_applicable` is NOT a gate failure — readiness must be resolved from Engram instead of from these fields.
|
|
96
106
|
|
|
97
107
|
## Action Context Guard
|
|
@@ -104,8 +114,16 @@ The orchestrator MUST carry `actionContext` into any phase launch.
|
|
|
104
114
|
|
|
105
115
|
## Engine Authority by Store
|
|
106
116
|
|
|
107
|
-
- `openspec` and `both` (when `openspec/` directory exists): the
|
|
108
|
-
- `engram`, `none`, and `both` (when `openspec/` directory does NOT exist): the
|
|
117
|
+
- `openspec` and `both` (when `openspec/` directory exists): the local SDD status engine resolves artifact state from disk and is authoritative. Phase executors must obey it.
|
|
118
|
+
- `engram`, `none`, and `both` (when `openspec/` directory does NOT exist): the local engine cannot read Engram artifacts. It returns `nextRecommended: "resolve-via-engram"` and empty `blockedReasons`. This output is **non-authoritative**. The orchestrator must resolve readiness directly from Engram using the Engram memory tools injected by the memory provider on the change topic keys (`sdd/{change-name}/proposal`, `sdd/{change-name}/spec`, etc.) instead of relying on the engine's dependency states. The `artifactStore` field still reflects the real chosen store value (e.g. `"both"`) and must not be rewritten.
|
|
119
|
+
|
|
120
|
+
## Native Runtime Attempt Authority
|
|
121
|
+
|
|
122
|
+
The compact SDD runtime attempt authority is separate from artifact dispatch and status. It is artifact-store agnostic: the same acquire/settle discipline applies to `openspec`, `engram`, `both`, and `none` stores. Its payload MUST NOT be embedded in the SDD v1 status schema above; status reports artifact state only, never attempt tokens or attempt counters. No OpenSpec or Engram attempt ledger may be created or mirrored by Pi.
|
|
123
|
+
|
|
124
|
+
Before every runtime-bearing `sdd-apply`, `sdd-verify`, or remediation launch, the orchestrator MUST acquire a bounded attempt from the provider compact CLI; after the external run completes it MUST settle. The acquire and settle request IDs are distinct; an operation's own request ID is reused only for idempotent replay of that exact operation. Continuation routes only from the provider-returned `proceed|blocked|complete` — launch only on `proceed`, stop on `blocked` or `complete`. `reset` is never automatic and requires an explicit maintainer scope decision.
|
|
125
|
+
|
|
126
|
+
For the exact compact acquire/settle shapes and the full field semantics, see the `Native Runtime Attempt Authority` section of the lazy-loaded `SDD Orchestrator Workflow` contract. Do not look up `assets/...` paths at runtime; those are package source paths before installation.
|
|
109
127
|
|
|
110
128
|
## Status Output
|
|
111
129
|
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
"operation": "review.start",
|
|
5
5
|
"action": "consent_required",
|
|
6
6
|
"blocking": true,
|
|
7
|
-
"target_identity": "sha256:
|
|
7
|
+
"target_identity": "sha256:04c970c2b0f7c128751ed2b0f7e672a2fe26dc267f018bf10e612096d19cfa04",
|
|
8
8
|
"projection": "workspace",
|
|
9
9
|
"risk_level": "high",
|
|
10
10
|
"changed_files": 1,
|
|
@@ -20,13 +20,13 @@
|
|
|
20
20
|
"answer": "granted",
|
|
21
21
|
"label": "Run the review now",
|
|
22
22
|
"effect": "Reviews this exact frozen candidate now; nothing is granted for later candidates, so each later medium- or high-risk candidate asks again.",
|
|
23
|
-
"invocation": "gentle-ai review start --contract gentle-ai.review-integration/v1 --cwd /repo --target sha256:
|
|
23
|
+
"invocation": "gentle-ai review start --contract gentle-ai.review-integration/v1 --cwd /repo --target sha256:04c970c2b0f7c128751ed2b0f7e672a2fe26dc267f018bf10e612096d19cfa04 --projection workspace --lineage review-consent-fixture --consent granted"
|
|
24
24
|
},
|
|
25
25
|
{
|
|
26
26
|
"answer": "declined",
|
|
27
27
|
"label": "Not now, just this once",
|
|
28
28
|
"effect": "Skips the review for this candidate only; nothing is persisted and the next candidate is asked again. This is not the kill switch.",
|
|
29
|
-
"invocation": "gentle-ai review start --contract gentle-ai.review-integration/v1 --cwd /repo --target sha256:
|
|
29
|
+
"invocation": "gentle-ai review start --contract gentle-ai.review-integration/v1 --cwd /repo --target sha256:04c970c2b0f7c128751ed2b0f7e672a2fe26dc267f018bf10e612096d19cfa04 --projection workspace --lineage review-consent-fixture --consent declined"
|
|
30
30
|
}
|
|
31
31
|
],
|
|
32
32
|
"off_path": {
|