@axiomantic/garden 0.2.17 → 0.2.19

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Binary file
Binary file
Binary file
Binary file
Binary file
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@axiomantic/garden",
3
- "version": "0.2.17",
3
+ "version": "0.2.19",
4
4
  "description": "Multi-Agent Swarm Orchestration, Empirical Dialectics & Ceremonies on top of Rhizo & Vine",
5
5
  "main": "bin/run.js",
6
6
  "bin": {
@@ -24,7 +24,7 @@
24
24
  "url": "git+https://github.com/axiomantic/garden.git"
25
25
  },
26
26
  "scripts": {
27
- "test": "nim c -r tests/test_garden.nim && nim c -r tests/test_seed.nim && nim c -r tests/test_germinate.nim",
27
+ "test": "nim c -r tests/test_garden.nim && nim c -r tests/test_seed.nim && nim c -r tests/test_germinate.nim && nim c -r tests/test_update.nim",
28
28
  "build": "nim c -d:release --threads:on --mm:orc -o:bin/garden src/garden.nim"
29
29
  },
30
30
  "keywords": [
@@ -1,12 +1,12 @@
1
1
  ---
2
2
  name: dialectical-pump
3
- description: "Drives empirical multi-perspective deliberation and synthesis across agent personas. Enforces the strict invariant that dialectical exchanges are NOT theatrical dialogue: every turn must be grounded in tool calls (reading file lines, executing tests, running benchmarks, checking git history). Operates across three sequential stages: (1) Research & Understanding Doc with automated Fact-Check Gate, (2) Product & System Architecture Design Doc, and (3) Adversarial Design Review, Audit Report generation, and finding remediation. Triggers: 'dialectical pump', 'run dialectical pump', 'pump perspectives', 'triadic deliberation', 'dialectical research', 'dialectical design', 'dialectical review'."
3
+ description: "Drives empirical multi-perspective deliberation and synthesis across agent personas. Enforces the strict invariant that dialectical exchanges are NOT theatrical dialogue: every turn must be grounded in tool calls (reading file lines, executing tests, running benchmarks, checking git history). Operates across four sequential stages: (1) Research & Understanding Doc with automated Fact-Check Gate, (2) Product & System Architecture Design Doc, (3) Adversarial Design Review and Audit Report remediation, and (4) Pre-Weave Adversarial Code Audit Pump (The Third Key Gate: Shelfware, Heuristic Hand-Waves, Literal Fidelity & Parity, Carcass Purge, Green Mirage elimination, and Delta Re-Pump). Triggers: 'dialectical pump', 'run dialectical pump', 'pump perspectives', 'triadic deliberation', 'adversarial code audit', 'code audit pump', 'pre-weave audit', 'literal fidelity audit'."
4
4
  ---
5
5
 
6
6
  # `dialectical-pump`: Grounded Multi-Persona Deliberation Engine
7
7
 
8
8
  > **Thesis $\times$ Antithesis $\to$ Empirical Synthesis**
9
- > *The Dialectical Pump is an epistemic machine. It prevents hallucinated consensus and green mirages by forcing opposing personas to prove every assertion through real tool execution.*
9
+ > *The Dialectical Pump is an epistemic machine. It prevents hallucinated consensus, superficial approximations, and green mirages by forcing opposing personas to prove every assertion through real tool execution.*
10
10
 
11
11
  ---
12
12
 
@@ -29,36 +29,31 @@ Every turn taken by a persona in the Dialectical Pump must follow the **Empirica
29
29
 
30
30
  ---
31
31
 
32
- ## 2. The Three Dialectical Stages
32
+ ## 2. The Four Dialectical Stages
33
33
 
34
- The Dialectical Pump executes across three distinct stages of a project:
34
+ The Dialectical Pump executes across four distinct project gates:
35
35
 
36
36
  ```mermaid
37
37
  flowchart TD
38
- subgraph Stage1["Stage 1: Grounded Research"]
39
- S1A["1. Triad plans research questions"]
40
- S1B["2. Workers explore code & tests"]
41
- S1C["3. Synthesize understanding.md"]
42
- S1D["4. Automated Fact-Check Gate"]
43
- S1A --> S1B --> S1C --> S1D
38
+ subgraph DesignPhase["Design Dialectics (Pre-Implementation)"]
39
+ Stage1["Stage 1: Grounded Research (understanding.md + Fact-Check Gate)"]
40
+ Stage2["Stage 2: Architecture & Design (design.md)"]
41
+ Stage3["Stage 3: Adversarial Design Audit (audit_report.md)"]
42
+ Stage1 --> Stage2 --> Stage3
44
43
  end
45
44
 
46
- subgraph Stage2["Stage 2: Architecture & Design"]
47
- S2A["1. Systems Architect drafts thesis"]
48
- S2B["2. Purist Auditor attacks failure modes"]
49
- S2C["3. DevEx Lead balances ergonomics"]
50
- S2D["4. Synthesize design.md"]
51
- S2A --> S2B --> S2C --> S2D
45
+ subgraph ImplementationPhase["Implementation Dialectics (Pre-Weave)"]
46
+ Stage4["Stage 4: Adversarial Code Audit Pump (The Third Key Gate)"]
47
+ Stage4A["4.1 Deliverable Claim Bundle (Thesis)"]
48
+ Stage4B["4.2 Presumption of Guilt Audit (Antithesis)"]
49
+ Stage4C["4.3 Remediation inside Strand (Synthesis)"]
50
+ Stage4D["4.4 Delta Re-Pump Loop (Until 0 Findings)"]
51
+ Stage4 --> Stage4A --> Stage4B --> Stage4C --> Stage4D
52
+ Stage4D -.->|"Findings > 0"| Stage4B
52
53
  end
53
54
 
54
- subgraph Stage3["Stage 3: Adversarial Review & Audit"]
55
- S3A["1. Auditor files audit_report.md"]
56
- S3B["2. Personas resolve findings"]
57
- S3C["3. Ratified design.md"]
58
- S3A --> S3B --> S3C
59
- end
60
-
61
- Stage1 --> Stage2 --> Stage3
55
+ Stage3 --> ImplementationPhase
56
+ Stage4D -->|"0 Findings"| Weave["vine weave (Trunk Fast-Forward)"]
62
57
  ```
63
58
 
64
59
  ---
@@ -127,11 +122,141 @@ The triad meets to address every finding in `audit_report.md`:
127
122
 
128
123
  ---
129
124
 
130
- ## 6. Output Artifacts
125
+ ## 6. Stage 4: Pre-Weave Adversarial Code Audit Pump (The Third Key Gate)
126
+
127
+ Before any strand is woven into canonical trunk (`vine weave`), it must pass the **Adversarial Code Audit Pump**. Passing Key 1 (mechanical merge-tree) and Key 2 (semantic test runner) is necessary but insufficient: tests may be green mirages, and code may be disconnected shelfware or heuristic hand-waves.
128
+
129
+ <CRITICAL>
130
+ The Presumption-of-Guilt Invariant:
131
+ The Adversarial Auditor approaches every deliverable with the active operational presumption that the code IS disconnected shelfware, IS a half-baked heuristic hand-wave, DOES contain hollow mocks, DOES rely on loose partial assertions, and FAILS true fidelity until mathematically and empirically disproven through tool execution.
132
+ </CRITICAL>
133
+
134
+ ### Step 4.1: Assembling the Thesis (The Deliverable Claim Bundle)
135
+
136
+ The Thesis in a code review is neither a raw dump of files nor vague conversational prose. The implementer must formulate a structured **Deliverable Claim Bundle**:
137
+
138
+ ```markdown
139
+ # DELIVERABLE CLAIM BUNDLE (Thesis)
140
+ - Task ID: <task-id>
141
+ - Strand Path: <strand-path>
142
+ - Base Commit: origin/main (<sha>)
143
+
144
+ ## 1. Contract & Deliverables
145
+ - Target Deliverables: List of files created/modified
146
+ - Operator Directive: Exact prompt requirements & references
147
+
148
+ ## 2. Closed-Circuit Two-Point Diff
149
+ - Provider: Primary new logic / capability modules
150
+ - Consumer Call-Sites: Live production callers (CLI parser, HTTP router, UI canvas, event loop)
151
+ - Replacement Purge: Explicit list of obsolete files, functions, or fallbacks deleted in this diff
152
+
153
+ ## 3. Test Evidence & Assertion Rigor
154
+ - Test Suite Executed: Exact command and execution time
155
+ - Assertion Style: Complete structural equality (`assert actual == expected`) or tripwire snapshots
156
+ - Negative Controls: List of tests asserting failure under invalid/adversarial inputs
157
+ ```
158
+
159
+ ### Step 4.2: The Five-Pillar Forensic Code Audit (Antithesis)
160
+
161
+ The Auditor executes the following five rigorous checks against the Claim Bundle and the strand diff (`git diff origin/main...HEAD`):
162
+
163
+ #### Pillar 1: Disconnected Shelfware & Closed-Circuit Consumer Audit
164
+ - [ ] **Live Consumer Call-Site Verification**: Does the new capability plug directly into the production entrypoint, router, CLI dispatcher, or UI?
165
+ - [ ] **Import Audit**: Is the provider module imported and exercised outside of its own unit test files?
166
+ - [ ] **Hermetic Shelfware Rejection**: Code tested only by its own unit tests is rejected back to the worker as incomplete shelfware (unless explicitly contracted as `[STAGED - NOT WIRED]` in `implementation_plan.md`).
167
+
168
+ #### Pillar 2: Holistic Integration vs. Heuristic Hand-Waves & Hollow Stubs
169
+ - [ ] **Anti-Stub & Anti-Toy Check**: Does the implementation handle real application state, real network/file I/O, and real concurrent events?
170
+ - [ ] **No Hollow Mocks in Production**: Reject artificial `sleep()` calls, hardcoded success responses, or fake test doubles in production paths.
171
+ - [ ] **Brittle String-Split Hacks**: Reject naive string splits (`str.split(" ")[0]`) pretending to parse structured protocols or payloads; compliant lexers/parsers must be used.
172
+ - [ ] **Swallowed Exceptions**: Reject empty `except: pass` or `catch: discard` blocks that sweep real error conditions under the rug.
173
+
174
+ #### Pillar 3: Literal Fidelity & Reference Parity Mandate (Anti-Approximation)
175
+ <CRITICAL>
176
+ Literal Fidelity & True-Fidelity Mandate:
177
+ When a deliverable is recreating, porting, reverse-engineering, duplicating functionality from an existing reference, or executing an operator directive where fidelity is expected:
178
+ 1. Anti-Approximation Rule: "Approximate", "looks right", "heuristic shortcut", "gist-level", or "good enough for happy paths" implementations are STRICTLY REJECTED.
179
+ 2. Literal Specification Adherence: The implementation must be literally and precisely the thing that was asked for. The auditor must verify compliance against every specified edge case, type boundary, flag interaction, return semantic, and error flow of the original reference or operator prompt.
180
+ 3. Zero Corner-Cutting: Tedious, difficult, or complex cases cannot be hand-waved away or substituted with shallow shortcuts.
181
+ 4. Empirical Parity Testing: Wherever a reference implementation or specification exists, the audit requires characterization tests, golden file outputs, or structural round-trip comparisons proving exact functional parity.
182
+ </CRITICAL>
183
+
184
+ #### Pillar 4: Aggressive Replacement Purge (Zero Dead-Code Carcasses)
185
+ - [ ] **Zero Vestigial Fallbacks**: Any existing code, configurations, or legacy paths meant to be upgraded or superseded by this feature MUST be deleted in the same strand.
186
+ - [ ] **No Zombie Shims**: Commented-out legacy code, dead helper functions, or deprecated fallback branches are strictly prohibited.
187
+
188
+ #### Pillar 5: Green Mirage Elimination & Structural Assertion Rigor
189
+ <CRITICAL>
190
+ Assertion Rigor & Anti-Green-Mirage Mandate:
191
+ 1. Complete Object Equality: Partial or loose assertions ("loosey goosey" tests) are strictly forbidden:
192
+ - ❌ FORBIDDEN: `assert "foo" in response`
193
+ - ❌ FORBIDDEN: `assert len(result) > 0`
194
+ - ❌ FORBIDDEN: `assert obj.status == "ok"` (ignoring payload fields)
195
+ - ✅ MANDATED: `assert actual == expected` comparing the complete expected parent object, schema, or full deterministic string.
196
+ 2. Structural Snapshotting: Prefer Nim's `tripwire` library or Python's `pytest-tripwire` to assert complete structural integrity without brittle manual mocks.
197
+ 3. Mandatory Negative Controls: Tests must explicitly assert that invalid inputs, expired leases, missing files, or corrupted data fail deterministically with expected error codes.
198
+ 4. Zero Happy-Path-Only Testing: Boundary values (empty, 0, 1, max, unicode, timeout, disconnection) must be explicitly exercised.
199
+ </CRITICAL>
200
+
201
+ ### Step 4.3: The Delta Re-Pump Loop (Iterative until Zero Findings)
202
+
203
+ A single review pass is never sufficient. The Adversarial Code Audit executes as an **iterative dialectical pump**:
204
+
205
+ ```mermaid
206
+ sequenceDiagram
207
+ autonumber
208
+ participant W as Worker (Strand)
209
+ participant A as Adversarial Auditor
210
+ participant G as Gate (Vine / Garden)
211
+
212
+ W->>A: Submit Deliverable Claim Bundle (Thesis)
213
+ A->>A: Five-Pillar Presumption-of-Guilt Audit (Antithesis)
214
+
215
+ alt Findings > 0 (CRIT / HIGH / MED)
216
+ A-->>W: Emit audit_report.md with empirical citations
217
+ Note over W: Worker remediates findings inside Strand
218
+ W->>A: Re-pump: Submit Delta Claim Bundle (Fixes + git diff against last audit commit)
219
+ A->>A: Delta Audit: Verify fix + full test regression sweep
220
+ Note over A,W: Loop repeats until 0 open defects
221
+ else Findings == 0
222
+ A->>G: Issue GATE_AUDIT_PASSED token
223
+ G->>G: Execute vine weave (Trunk Fast-Forward)
224
+ end
225
+ ```
226
+
227
+ 1. **Defect Issuance**: The Auditor records findings in `audit_report.md` with defect codes (`CRIT-XX`, `HIGH-XX`, `FIDELITY-XX`, `MIRAGE-XX`), exact file lines, and failure proof.
228
+ 2. **In-Strand Remediation**: The worker fixes findings strictly inside the isolated Vine strand.
229
+ 3. **The Delta Re-Pump**: When resubmitting, the auditor audits the **exact delta** (`git diff <audit_commit>...HEAD`) to ensure fixes do not introduce secondary defects, while re-running the full project test suite (`vine gate`) to guarantee no regressions.
230
+ 4. **Exit Condition**: The pump loops until **ZERO open defects of severity CRIT, HIGH, or MED remain**, and all low/nit items are resolved or empirically justified.
231
+
232
+ ### Step 4.4: Gate Clearance & Cryptographic Token
233
+
234
+ When all findings reach 0, the auditor stamps a verification receipt:
235
+ ```json
236
+ {
237
+ "status": "GATE_AUDIT_PASSED",
238
+ "task_id": "<task-id>",
239
+ "audit_iterations": 2,
240
+ "five_pillars": {
241
+ "closed_circuit": "VERIFIED",
242
+ "holistic_integration": "VERIFIED",
243
+ "literal_fidelity": "VERIFIED",
244
+ "replacement_purge": "VERIFIED",
245
+ "structural_assertions": "VERIFIED"
246
+ },
247
+ "gate_token": "AUDIT_PASS_SHA256_..."
248
+ }
249
+ ```
250
+ Only strands with this verified clearance are permitted to weave into trunk.
251
+
252
+ ---
253
+
254
+ ## 7. Output Artifacts
131
255
 
132
256
  At the conclusion of the Dialectical Pump:
133
- 1. `understanding.md` (Grounded and fact-checked).
134
- 2. `design.md` (Debated, hardened, and synthesized).
135
- 3. `audit_report.md` (All findings addressed and closed).
257
+ 1. `understanding.md` (Stage 1: Grounded and fact-checked).
258
+ 2. `design.md` (Stage 2: Debated, hardened, and synthesized).
259
+ 3. `design_audit_report.md` (Stage 3: Design findings addressed and closed).
260
+ 4. `code_audit_report.md` (Stage 4: Pre-weave Five-Pillar audit cleared with 0 open defects).
136
261
 
137
- Proceed immediately to [`plan-implementation`](../plan-implementation/SKILL.md).
262
+ Proceed to [`orchestrate-swarm`](../orchestrate-swarm/SKILL.md) for trunk weaving.
@@ -91,12 +91,39 @@ Execute phases sequentially. Never skip phases or invert the order.
91
91
  | **Phase 2** | [`launch-workers`](../launch-workers/SKILL.md) | Output 10-backtick raw markdown prompt cards and numbered session instructions. | `rhizo who --json` confirms 100% of workers active & listening. |
92
92
  | **Phase 3** | [`dialectical-pump`](../dialectical-pump/SKILL.md) | Grounded triadic deliberation: research, design, adversarial audit. | Zero open `CRIT` or `BLOCKER` defects in `audit_report.md`. |
93
93
  | **Phase 4** | [`plan-implementation`](../plan-implementation/SKILL.md) | Author master implementation plan with locking schedules, strands, and Two-Point Diff contracts (Provider, Consumer, Replacement deletion). | Complete `implementation_plan.md` with task-locking matrix. |
94
- | **Phase 5** | [`orchestrate-swarm`](../orchestrate-swarm/SKILL.md) | Main-chat governor: task dispatch, heartbeat monitoring, Closed-Circuit & Two-Key gate verification, trunk weaving. | All plan tasks woven via `vine weave` after passing Two-Key Gate. |
94
+ | **Phase 5** | [`orchestrate-swarm`](../orchestrate-swarm/SKILL.md) | Main-chat governor: task dispatch, heartbeat monitoring, Closed-Circuit & Three-Key gate verification, trunk weaving. | All plan tasks woven via `vine weave` after passing Three-Key Gate (Mechanical, Semantic, Adversarial Audit). |
95
95
 
96
96
  ---
97
97
 
98
98
  ### Phase 0: Interactive Project Intake & Swarm Calibration
99
99
 
100
+ #### The Intelligent Concierge Protocol (`garden: <prompt>`)
101
+ When the operator prefixes a request with `garden: <prompt>` (or directs a feature, refactor, or project task to Garden):
102
+ The orchestrator MUST NOT immediately write code, edit files, or unilaterally launch massive multi-file changes.
103
+ Instead, it acts as an **Intelligent Intake Concierge**:
104
+
105
+ 1. **Evaluate Request Scope & Blast Radius**:
106
+ - **High Complexity / Architectural Shifts / New Subsystems / Multi-File Migrations**: The request impacts foundational contracts, multiple modules, or shared abstractions. Requires empirical research, RFC design, adversarial review, and parallel strand isolation. Recommend **Option 1**.
107
+ - **Medium Complexity / Well-Defined Features / Self-Contained Deliverables**: The scope is clear, boundaries are known, and it can be implemented without a 3-stage dialectical design cycle. Recommend **Option 2**.
108
+ - **Low Complexity / Single-File Fixes / Documentation / Scratch Tweaks**: Trivial 1-file patch or config change. Recommend **Option 3**.
109
+
110
+ 2. **Present Interactive Triage Modal (`ask_question`)**:
111
+ The orchestrator invokes `ask_question` with 3 mutually exclusive options clearly explaining the tradeoffs:
112
+ - **Option 1 (Full Ceremony - RFE ➔ RFD ➔ RFC ➔ Swarm)**:
113
+ *Scope*: Architectural shifts, new subsystems, major refactors, or cross-cutting migrations.
114
+ *Process*: Sows the idea as a persistent roadmap seed (`garden plant`), authors the Research/RFD, System Architecture/RFC, and Adversarial Audit documents, schedules monotonic locks and isolated Vine strands, and writes worker prompts to `/tmp/garden-<project>/`.
115
+ - **Option 2 (Direct Swarm Dispatch)**:
116
+ *Scope*: Well-defined, self-contained features, bugfixes, or bounded deliverables.
117
+ *Process*: Bypasses heavy research/design documentation; enqueues tasks straight to cluster work queues (`rhizo enqueue queue:<project>:tasks`) or dispatches directly to active workers (`rhizo send <worker>`).
118
+ - **Option 3 (Inline Execution)**:
119
+ *Scope*: Trivial 1-file fixes, documentation, typo corrections, or quick scratch scripts.
120
+ *Process*: Executes directly within the main session without provisioning worker sessions or cluster overhead.
121
+
122
+ 3. **Execution Branching**:
123
+ - **If Option 1 selected**: Run `garden plant "<prompt>"`, then proceed to Cold-Start Swarm Calibration / Phase 1 `choose-personas` (or attach to active swarm via Fast-Path) and Phase 3 `dialectical-pump`.
124
+ - **If Option 2 selected**: Check `rhizo who --json`. If workers are online, dispatch via `rhizo send` or `rhizo enqueue`. If cold, run Cold-Start Swarm Calibration to spin up workers.
125
+ - **If Option 3 selected**: Execute inline in the current session.
126
+
100
127
  #### Fast-Path: Re-using an Active / Existing Swarm (First-Look Invariant)
101
128
  Before asking ANY intake questions or presenting configuration modals, the orchestrator MUST run `rhizo who --json` to inspect the cluster.
102
129
  If active, healthy workers are ALREADY registered and listening on the Rhizo cluster:
@@ -287,12 +314,18 @@ They MUST immediately transition to active execution: claim the task, enter the
287
314
  </CRITICAL>
288
315
 
289
316
  <CRITICAL>
290
- Closed-Circuit & Holistic Integration Invariant:
291
- Never build isolated code in a vacuum. Every deliverable must exhibit a Two-Point Diff: the Provider (new capability) and the Consumer (live production call-site, router, UI canvas, or CLI entrypoint). Modules that are only imported by their own test suites are strictly prohibited as incomplete shelfware. Furthermore, the implementation must holistically integrate into the live application—it must never be a toy, stub, mock, or hollow heuristic approximation. If the deliverable is intended to replace, upgrade, or obsolete existing code or configuration, the legacy code MUST be deleted immediately in the same strand; hoarding dead code, maintaining vestigial fallbacks, or leaving commented-out logic in the codebase is strictly prohibited.
317
+ Closed-Circuit Two-Point Diff, Literal Fidelity & Holistic Integration Invariant:
318
+ 1. Two-Point Diff Mandate: Never build isolated code in a vacuum. Every deliverable must exhibit a Two-Point Diff: the Provider (new capability) and the Consumer (live production call-site, router, UI canvas, or CLI entrypoint). Modules that are only imported by their own test suites are strictly prohibited as incomplete shelfware.
319
+ 2. Holistic Integration (Anti-Stub / Anti-Toy): The implementation must holistically integrate into the live application—it must never be a toy, stub, mock, or hollow heuristic approximation.
320
+ 3. Literal Fidelity & True-Fidelity Mandate (Anti-Approximation): When recreating, porting, reverse-engineering, duplicating functionality from an existing reference, or executing an operator directive where fidelity is expected:
321
+ - "Approximate", "looks right", "heuristic shortcut", "gist-level", or "good enough for happy paths" implementations are STRICTLY REJECTED.
322
+ - The implementation must be literally and precisely the thing that was asked for, matching all edge cases, type boundaries, flags, and error flows.
323
+ 4. Aggressive Replacement Purge: Any existing code, configurations, or fallbacks meant to be replaced or upgraded MUST BE DELETED immediately in the same strand; hoarding dead code, maintaining vestigial fallbacks, or leaving commented-out logic in the codebase is strictly prohibited.
324
+ 5. Structural Assertion Rigor: Partial or loose assertions ("loosey goosey" tests like `assert 'foo' in bar`) are strictly forbidden. Tests must assert complete object equality (`assert actual == expected`) and cover negative controls.
292
325
  </CRITICAL>
293
326
 
294
327
  <INVARIANT>
295
- Never merge code into the canonical trunk without a verified Two-Key Gate pass ('vine gate' exit code 0) inside an isolated Rift strand.
328
+ Never merge code into the canonical trunk without passing the Three-Key Gate: Key 1 (mechanical merge-tree 'git merge-tree'), Key 2 (semantic test runner 'vine gate'), and Key 3 (Pre-Weave Adversarial Code Audit Pump with 0 open defects under the presumption of guilt) inside an isolated Rift strand.
296
329
  </INVARIANT>
297
330
 
298
331
  <FORBIDDEN>
@@ -26,23 +26,25 @@ Cluster workers operate exclusively in dedicated, sovereign sessions bootstrappe
26
26
  <CRITICAL>
27
27
  Orchestrator Intake Gate & Non-Implementation Invariant (GVR-016):
28
28
  The Lead Orchestrator is a CONDUCTOR, NOT A CODER.
29
- Whenever the operator presents a task, feature request, bugfix, or asks to work on something:
29
+ Whenever the operator presents a task, feature request, bugfix, or asks to work on something (including "garden: <prompt>"):
30
30
  THE ORCHESTRATOR MUST NEVER DIRECTLY JUMP INTO CODE EDITING OR IMPLEMENTATION TOOLS (e.g. `write_to_file`, `replace_file_content`).
31
- Instead, it MUST STOP and ask the operator how they want the work routed using `ask_question`:
32
- - Option 1 (Recommended): Enqueue to Cluster Work Queue (`rhizo enqueue queue:<project>:tasks --subject "..." --body "..."`) for background cluster workers.
33
- - Option 2: Dispatch directly to an active cluster worker (`rhizo send <worker> --subject "..." --body "..."`).
34
- - Option 3: Execute inline in main chat (only if the operator explicitly selects/confirms this option).
31
+ Instead, it acts as an Intelligent Concierge, evaluates request scope, and MUST STOP to ask the operator how they want the work routed using `ask_question`:
32
+ - **Option 1 (Full Ceremony - RFE ➔ RFD ➔ RFC ➔ Swarm)**: For architectural shifts, new subsystems, major refactors, or cross-cutting migrations. Sows the idea as a persistent roadmap seed (`garden plant`), authors the Research/RFD, System Architecture/RFC, and Adversarial Audit documents, schedules monotonic locks and isolated Vine strands, and writes worker prompts to `/tmp/garden-<project>/`.
33
+ - **Option 2 (Direct Swarm Dispatch)**: For well-defined, self-contained features. Bypasses long design ceremonies; enqueues tasks straight to cluster work queues (`rhizo enqueue queue:<project>:tasks`) or dispatches directly to active cluster workers (`rhizo send <worker>`).
34
+ - **Option 3 (Inline Execution)**: For trivial 1-file fixes, documentation, or quick scratch tweaks executed directly in the main session (only if the operator explicitly selects/confirms this option).
35
35
 
36
36
  This intake gate applies to ANY request to "work on X", "build Y", "fix Z", or "implement feature W". Direct inline implementation is prohibited unless the operator explicitly directs the orchestrator to code it inline in the main session.
37
37
  </CRITICAL>
38
38
 
39
39
  <CRITICAL>
40
- Closed-Circuit Call-Site & Replacement Audit Invariant:
41
- The Lead Orchestrator is the final gatekeeper against hermetic shelfware, hollow mocks, and dead code accumulation.
42
- Before executing `vine weave` on any worker strand, the Orchestrator MUST verify:
40
+ Pre-Weave Adversarial Audit & Literal Fidelity Invariant:
41
+ The Lead Orchestrator is the final gatekeeper against hermetic shelfware, hollow mocks, superficial heuristics, and green mirages.
42
+ Before executing `vine weave` on any worker strand, the Orchestrator MUST enforce the Five-Pillar Pre-Weave Adversarial Audit (Key 3 of the Three-Key Gate):
43
43
  1. Two-Point Diff: The branch modifies both a Provider and an active Consumer call-site (live router, CLI command dispatcher, UI, or event loop). Unwired modules tested solely by their own test suites are strictly rejected back to the worker as incomplete shelfware.
44
- 2. Holistic Integration (Anti-Stub / Anti-Toy): Real system behavior, state, and errors must be handled; no placeholder toys, stubs, mocks, or shallow heuristics pretending to be integrated.
45
- 3. Replacement Purge: All legacy or obsolete code targeted for replacement is completely deleted in the strand diff. Preserving dead code as "fallbacks" or leaving commented-out blocks is prohibited.
44
+ 2. Holistic Integration (Anti-Stub / Anti-Toy): Real system behavior, state, and errors must be handled; no placeholder toys, stubs, mocks, naive string splits, or shallow heuristics pretending to be integrated.
45
+ 3. Literal Fidelity & Reference Parity Mandate (Anti-Approximation): If the task ports, reverse-engineers, duplicates functionality from a reference, or executes a specific operator directive, it must exhibit literal, true fidelity. Approximations ("looks right", "good enough for happy paths") are strictly rejected. All edge cases, flags, type boundaries, and error flows must match the specification precisely.
46
+ 4. Replacement Purge: All legacy or obsolete code targeted for replacement is completely deleted in the strand diff. Preserving dead code as "fallbacks" or leaving commented-out blocks is prohibited.
47
+ 5. Structural Assertion Rigor (Anti-Green-Mirage): Reject tests relying on partial/loose assertions (`assert "foo" in bar` or `assert len(x) > 0`). Require full structural equality (`assert actual == expected`) and mandatory negative controls.
46
48
  Contract Exception: Only foundational tasks explicitly contracted as `[STAGED - NOT WIRED]` in `implementation_plan.md` may defer consumer wiring to a scheduled follow-up wiring task in the subsequent wave.
47
49
  </CRITICAL>
48
50
 
@@ -303,8 +305,8 @@ If a worker is waiting for a lease or has held a lock too long, probe its listen
303
305
  rhizo probe <worker>
304
306
  ```
305
307
 
306
- ### SOP 3: Verifying Two-Key Gate & Weaving
307
- When a worker replies indicating task completion:
308
+ ### SOP 3: Verifying the Three-Key Gate & Pre-Weave Adversarial Audit
309
+ When a worker replies indicating Key 1 & Key 2 completion:
308
310
  ```json
309
311
  {
310
312
  "status": "gate_passed",
@@ -316,12 +318,20 @@ When a worker replies indicating task completion:
316
318
  }
317
319
  ```
318
320
 
319
- The Orchestrator conducts the **Closed-Circuit Call-Site & Replacement Audit** before weaving:
320
- 1. **Two-Point Diff Audit**: Inspect the strand diff against `origin/main` (`git -C "$strand_path" diff --name-only origin/main...HEAD`). Confirm that the diff touches BOTH the provider (new module/logic) AND at least one live consumer call-site (application entrypoint, router, CLI dispatcher, UI view). If the diff only contains the new module and unit tests (and was not contracted as `[STAGED - NOT WIRED]`), reject the strand back to the worker:
321
- `rhizo reply --to <worker> --subject "Weave Blocked: Missing Consumer Call-Site" --body "Your deliverable lacks an active consumer call-site. Wire your provider into the live system before requesting weave."`
322
- 2. **Holistic Integration Audit**: Verify that the integration uses real data flow and handles runtime state (no hollow stubs, fake data mocks, or superficial heuristic shortcuts).
323
- 3. **Aggressive Replacement Purge**: Verify that any existing code, obsolete configurations, or vestigial fallbacks meant to be replaced by the feature were deleted in the strand diff.
324
- 4. **Weave & Unlock**:
321
+ The Orchestrator or designated Auditor initiates **Key 3: The Pre-Weave Adversarial Code Audit Pump** under the **Presumption of Guilt**:
322
+
323
+ 1. **Thesis Intake**: Demand the worker's **Deliverable Claim Bundle** (task contract, Two-Point Diff mapping, test evidence, negative controls).
324
+ 2. **Five-Pillar Presumption-of-Guilt Audit**:
325
+ - **Pillar 1 (Closed-Circuit Two-Point Diff)**: Inspect strand diff against `origin/main` (`git -C "$strand_path" diff --name-only origin/main...HEAD`). Confirm both Provider and live Consumer call-sites are modified. Reject hermetic shelfware lacking a live consumer.
326
+ - **Pillar 2 (Holistic Integration)**: Verify real production integration (no hollow mocks, stubs, naive string splits, or swallowed exceptions).
327
+ - **Pillar 3 (Literal Fidelity & Reference Parity)**: When duplicating functionality, porting, or executing specific operator directives, demand literal true fidelity. Reject approximations ("looks right", "good enough for happy paths") and verify edge case parity against reference specifications.
328
+ - **Pillar 4 (Aggressive Replacement Purge)**: Ensure all superseded legacy code, fallbacks, and commented-out blocks are deleted in the strand.
329
+ - **Pillar 5 (Structural Assertion Rigor)**: Reject partial/loose assertions (`assert "foo" in bar`). Mandate complete structural equality (`assert actual == expected`) and negative controls.
330
+ 3. **The Delta Re-Pump Loop**:
331
+ - If findings exist: emit `code_audit_report.md` with empirical citations. Worker fixes them in the strand.
332
+ - The auditor reviews the **git diff delta** against the previous audit commit (`git diff <audit_sha>...HEAD`) and re-runs `vine gate`.
333
+ - The pump repeats until **ZERO open defects of severity CRIT, HIGH, or MED remain**.
334
+ 4. **Weave & Unlock (Only after Key 3 Clearance)**:
325
335
  ```bash
326
336
  # 1. Weave the verified strand into main
327
337
  vine weave