@axiomantic/garden 0.2.5 → 0.2.6

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.5",
3
+ "version": "0.2.6",
4
4
  "description": "Multi-Agent Swarm Orchestration, Empirical Dialectics & Ceremonies on top of Rhizo & Vine",
5
5
  "main": "bin/run.js",
6
6
  "bin": {
@@ -95,6 +95,113 @@ Upon receiving the operator's responses:
95
95
  5. Register the orchestrator's presence (`rhizo open orchestrator`) and arm the listener.
96
96
  6. Poll or await cluster readiness gate (`rhizo who --json`) before proceeding to Phase 3.
97
97
 
98
+
99
+ ---
100
+
101
+ ## Unified Work Item State Machine (WISM)
102
+
103
+ Rhizo, Garden, and Vine coordinate all multi-agent work through the formal **Work Item State Machine (WISM)**. Every task progresses through 10 deterministic states with atomic Redis transitions, automated DAG unblocking, and Two-Key integration gates.
104
+
105
+ ```mermaid
106
+ stateDiagram-v2
107
+ [*] --> DRAFTED : rhizo task create <id>
108
+ DRAFTED --> BLOCKED : Unmet DAG dependencies (depends_on)
109
+ DRAFTED --> QUEUED : Zero unmet dependencies
110
+ BLOCKED --> QUEUED : Parent task COMPLETED (Auto-promoted by Lua engine)
111
+
112
+ QUEUED --> DELIVERED : Listener pops message (Transport Receipt emitted)
113
+ DELIVERED --> CLAIMED : Worker acknowledges (Acquires monotonic lease)
114
+ DELIVERED --> ORPHANED : Receipt timeout (180s without claim)
115
+
116
+ CLAIMED --> IN_PROGRESS : Worker provisions strand (vine new <id>)
117
+ IN_PROGRESS --> IN_PROGRESS : Progress reported (rhizo task progress, lease extended)
118
+ IN_PROGRESS --> GATE_EVALUATING : Verification initiated (vine gate)
119
+ IN_PROGRESS --> YIELDED : rhizo task yield (Returned to pool)
120
+ IN_PROGRESS --> ORPHANED : Lease expires without progress
121
+
122
+ GATE_EVALUATING --> IN_PROGRESS : Gate failed (Tests red or merge conflict)
123
+ GATE_EVALUATING --> READY_TO_WEAVE : Two-Key Gate PASSED (Cryptographic gate token stamped)
124
+
125
+ READY_TO_WEAVE --> COMPLETED : vine weave && rhizo task complete (Unblocks downstream DAG children)
126
+
127
+ ORPHANED --> QUEUED : Re-queued for retry (attempts < 3)
128
+ ORPHANED --> DEAD_LETTER : Max delivery retries exceeded (attempts >= 3)
129
+ YIELDED --> QUEUED : Returned to pool
130
+
131
+ COMPLETED --> [*]
132
+ DEAD_LETTER --> [*]
133
+ ```
134
+
135
+ ### ASCII State Transition Reference (LLM Fast-Path)
136
+
137
+ ```text
138
+ [rhizo task create]
139
+ │
140
+ ▼
141
+ +---------+ Unmet deps
142
+ | DRAFTED | ──────────────────► [ BLOCKED ]
143
+ +---------+ │
144
+ │ Zero deps │ Parent task COMPLETED
145
+ ▼ ▼
146
+ +---------+ ◄───────────────────────+
147
+ | QUEUED |
148
+ +---------+
149
+ │
150
+ │ rhizo listen pops task (Transport Receipt emitted)
151
+ ▼
152
+ +-----------+ 180s Receipt Timeout
153
+ | DELIVERED | ─────────────────────────────────► [ ORPHANED ]
154
+ +-----------+ │
155
+ │ │ Attempts >= 3
156
+ │ rhizo task claim / rhizo reply ▼
157
+ ▼ [ DEAD_LETTER ]
158
+ +---------+
159
+ | CLAIMED |
160
+ +---------+
161
+ │
162
+ │ vine new <task_id> (Provision strand)
163
+ ▼
164
+ +-------------+ Lease expires
165
+ | IN_PROGRESS | ────────────────────────────────► [ ORPHANED ]
166
+ +-------------+
167
+ │ ▲
168
+ │ vine │ Gate fails
169
+ │ gate │ (Tests red or conflict)
170
+ ▼ │
171
+ +-----------------+
172
+ | GATE_EVALUATING |
173
+ +-----------------+
174
+ │
175
+ │ Two-Key Gate PASSED (Key 1 merge-tree + Key 2 live test suite green)
176
+ ▼
177
+ +----------------+
178
+ | READY_TO_WEAVE |
179
+ +----------------+
180
+ │
181
+ │ vine weave && rhizo task complete
182
+ ▼
183
+ +-----------+
184
+ | COMPLETED | ──► Auto-promotes BLOCKED child tasks to QUEUED!
185
+ +-----------+
186
+ ```
187
+
188
+ ### State Definitions & Invariants
189
+
190
+ | State | CLI Trigger | Atomic Action & Side Effects | Timeout / Failure Escalation |
191
+ | :--- | :--- | :--- | :--- |
192
+ | **`DRAFTED`** | `rhizo task create <id> --title <t>` | Creates immutable task contract hash `task:<id>` in Redis. | N/A |
193
+ | **`BLOCKED`** | Evaluated on create | Stamped if `depends_on` contains incomplete tasks. Workers cannot claim. | N/A |
194
+ | **`QUEUED`** | Auto on create or parent complete | Pushed to queue/inbox. Available for worker consumption. | N/A |
195
+ | **`DELIVERED`** | `rhizo listen` consumes payload | **Atomically moves into `task:<id>` DELIVERED state**. Instant transport receipt emitted to orchestrator. Mirrored to local `~/.config/rhizo/current_task.json` for turn-end hook interlocks. | 180s Receipt Timeout $
196
+ | **`CLAIMED`** | `rhizo task claim <id>` / `rhizo reply` | Worker acquires monotonic fencing lease. Isolated Vine strand provisioned (`vine new <id>`). Turn-end hook blocks until work starts. | Lease expires $
197
+ | **`IN_PROGRESS`** | Worker coding in strand | Enforces single-active-lease invariant. Periodic `rhizo task progress` extends lease. | Lease expires $
198
+ | **`GATE_EVALUATING`**| `vine gate` | Key 1 (mechanical merge-tree) & Key 2 (live compiler/test suite) evaluated. | Exit 1 $
199
+ | **`READY_TO_WEAVE`** | Both keys pass 100% | Cryptographic gate token stamped (`gate_token`). Report sent to orchestrator. | N/A |
200
+ | **`COMPLETED`** | `vine weave && rhizo task complete` | Fast-forward merged into canonical trunk. Strand pruned. Locks released. **Downstream DAG dependencies automatically unblocked (`BLOCKED` $
201
+ | **`ORPHANED`** | Receipt timeout or lease expired | Stalled worker detected. Increments `delivery_attempts`. If $\ge 3
202
+ | **`YIELDED`** | `rhizo task yield <id>` | Worker gracefully steps aside. Task returned to `QUEUED`. | N/A |
203
+ | **`DEAD_LETTER`** | Retries exhausted ($\ge 3$) | Moved to dead-letter queue. Alerts orchestrator and operator. | Requires manual operator triage |
204
+
98
205
  ---
99
206
 
100
207
  ## 3. Core Operational Invariants
@@ -142,3 +142,110 @@ for worker in $(python3 -c "import json; [print(w['name']) for w in json.load(op
142
142
  rhizo close "$worker" 2>/dev/null || true
143
143
  done
144
144
  ```
145
+
146
+ ---
147
+
148
+ ## Unified Work Item State Machine (WISM)
149
+
150
+ Rhizo, Garden, and Vine coordinate all multi-agent work through the formal **Work Item State Machine (WISM)**. Every task progresses through 10 deterministic states with atomic Redis transitions, automated DAG unblocking, and Two-Key integration gates.
151
+
152
+ ```mermaid
153
+ stateDiagram-v2
154
+ [*] --> DRAFTED : rhizo task create <id>
155
+ DRAFTED --> BLOCKED : Unmet DAG dependencies (depends_on)
156
+ DRAFTED --> QUEUED : Zero unmet dependencies
157
+ BLOCKED --> QUEUED : Parent task COMPLETED (Auto-promoted by Lua engine)
158
+
159
+ QUEUED --> DELIVERED : Listener pops message (Transport Receipt emitted)
160
+ DELIVERED --> CLAIMED : Worker acknowledges (Acquires monotonic lease)
161
+ DELIVERED --> ORPHANED : Receipt timeout (180s without claim)
162
+
163
+ CLAIMED --> IN_PROGRESS : Worker provisions strand (vine new <id>)
164
+ IN_PROGRESS --> IN_PROGRESS : Progress reported (rhizo task progress, lease extended)
165
+ IN_PROGRESS --> GATE_EVALUATING : Verification initiated (vine gate)
166
+ IN_PROGRESS --> YIELDED : rhizo task yield (Returned to pool)
167
+ IN_PROGRESS --> ORPHANED : Lease expires without progress
168
+
169
+ GATE_EVALUATING --> IN_PROGRESS : Gate failed (Tests red or merge conflict)
170
+ GATE_EVALUATING --> READY_TO_WEAVE : Two-Key Gate PASSED (Cryptographic gate token stamped)
171
+
172
+ READY_TO_WEAVE --> COMPLETED : vine weave && rhizo task complete (Unblocks downstream DAG children)
173
+
174
+ ORPHANED --> QUEUED : Re-queued for retry (attempts < 3)
175
+ ORPHANED --> DEAD_LETTER : Max delivery retries exceeded (attempts >= 3)
176
+ YIELDED --> QUEUED : Returned to pool
177
+
178
+ COMPLETED --> [*]
179
+ DEAD_LETTER --> [*]
180
+ ```
181
+
182
+ ### ASCII State Transition Reference (LLM Fast-Path)
183
+
184
+ ```text
185
+ [rhizo task create]
186
+ │
187
+ ▼
188
+ +---------+ Unmet deps
189
+ | DRAFTED | ──────────────────► [ BLOCKED ]
190
+ +---------+ │
191
+ │ Zero deps │ Parent task COMPLETED
192
+ ▼ ▼
193
+ +---------+ ◄───────────────────────+
194
+ | QUEUED |
195
+ +---------+
196
+ │
197
+ │ rhizo listen pops task (Transport Receipt emitted)
198
+ ▼
199
+ +-----------+ 180s Receipt Timeout
200
+ | DELIVERED | ─────────────────────────────────► [ ORPHANED ]
201
+ +-----------+ │
202
+ │ │ Attempts >= 3
203
+ │ rhizo task claim / rhizo reply ▼
204
+ ▼ [ DEAD_LETTER ]
205
+ +---------+
206
+ | CLAIMED |
207
+ +---------+
208
+ │
209
+ │ vine new <task_id> (Provision strand)
210
+ ▼
211
+ +-------------+ Lease expires
212
+ | IN_PROGRESS | ────────────────────────────────► [ ORPHANED ]
213
+ +-------------+
214
+ │ ▲
215
+ │ vine │ Gate fails
216
+ │ gate │ (Tests red or conflict)
217
+ ▼ │
218
+ +-----------------+
219
+ | GATE_EVALUATING |
220
+ +-----------------+
221
+ │
222
+ │ Two-Key Gate PASSED (Key 1 merge-tree + Key 2 live test suite green)
223
+ ▼
224
+ +----------------+
225
+ | READY_TO_WEAVE |
226
+ +----------------+
227
+ │
228
+ │ vine weave && rhizo task complete
229
+ ▼
230
+ +-----------+
231
+ | COMPLETED | ──► Auto-promotes BLOCKED child tasks to QUEUED!
232
+ +-----------+
233
+ ```
234
+
235
+ ### State Definitions & Invariants
236
+
237
+ | State | CLI Trigger | Atomic Action & Side Effects | Timeout / Failure Escalation |
238
+ | :--- | :--- | :--- | :--- |
239
+ | **`DRAFTED`** | `rhizo task create <id> --title <t>` | Creates immutable task contract hash `task:<id>` in Redis. | N/A |
240
+ | **`BLOCKED`** | Evaluated on create | Stamped if `depends_on` contains incomplete tasks. Workers cannot claim. | N/A |
241
+ | **`QUEUED`** | Auto on create or parent complete | Pushed to queue/inbox. Available for worker consumption. | N/A |
242
+ | **`DELIVERED`** | `rhizo listen` consumes payload | **Atomically moves into `task:<id>` DELIVERED state**. Instant transport receipt emitted to orchestrator. Mirrored to local `~/.config/rhizo/current_task.json` for turn-end hook interlocks. | 180s Receipt Timeout $
243
+ | **`CLAIMED`** | `rhizo task claim <id>` / `rhizo reply` | Worker acquires monotonic fencing lease. Isolated Vine strand provisioned (`vine new <id>`). Turn-end hook blocks until work starts. | Lease expires $
244
+ | **`IN_PROGRESS`** | Worker coding in strand | Enforces single-active-lease invariant. Periodic `rhizo task progress` extends lease. | Lease expires $
245
+ | **`GATE_EVALUATING`**| `vine gate` | Key 1 (mechanical merge-tree) & Key 2 (live compiler/test suite) evaluated. | Exit 1 $
246
+ | **`READY_TO_WEAVE`** | Both keys pass 100% | Cryptographic gate token stamped (`gate_token`). Report sent to orchestrator. | N/A |
247
+ | **`COMPLETED`** | `vine weave && rhizo task complete` | Fast-forward merged into canonical trunk. Strand pruned. Locks released. **Downstream DAG dependencies automatically unblocked (`BLOCKED` $
248
+ | **`ORPHANED`** | Receipt timeout or lease expired | Stalled worker detected. Increments `delivery_attempts`. If $\ge 3
249
+ | **`YIELDED`** | `rhizo task yield <id>` | Worker gracefully steps aside. Task returned to `QUEUED`. | N/A |
250
+ | **`DEAD_LETTER`** | Retries exhausted ($\ge 3$) | Moved to dead-letter queue. Alerts orchestrator and operator. | Requires manual operator triage |
251
+
@@ -117,25 +117,111 @@ In harnesses supporting `schedule` (e.g. Google Antigravity), arm a debounced wa
117
117
 
118
118
  ---
119
119
 
120
- ## 2. The Runtime Governance Loop
120
+ ## Unified Work Item State Machine (WISM)
121
+
122
+ Rhizo, Garden, and Vine coordinate all multi-agent work through the formal **Work Item State Machine (WISM)**. Every task progresses through 10 deterministic states with atomic Redis transitions, automated DAG unblocking, and Two-Key integration gates.
121
123
 
122
124
  ```mermaid
123
- flowchart TD
124
- Start([Start Task from Plan]) --> Dispatch["Dispatch Task via rhizo send / enqueue"]
125
- Dispatch --> Wait["Wait for Worker rhizo reply (Two-Key Gate Report)"]
126
- Wait --> Decision{Did Worker Pass Two-Key Gate?}
127
- Decision -->|NO / Blocked| Remediate["Dispatch Fix Task to Auditor / Implementer"]
128
- Remediate --> Wait
129
- Decision -->|YES| Weave["Execute vine weave into Canonical Trunk"]
130
- Weave --> Update["Update implementation_plan.md Checkbox & Harness To-Do"]
131
- Update --> CheckAddenda{Emergent Design Addendum Filed?}
132
- CheckAddenda -->|YES| Ratify["Review, Ratify, Update design.md & plan"]
133
- CheckAddenda -->|NO| NextTask{More Tasks in Plan?}
134
- Ratify --> NextTask
135
- NextTask -->|YES| Start
136
- NextTask -->|NO| Finish([Mission Accomplished / Teardown Swarm])
125
+ stateDiagram-v2
126
+ [*] --> DRAFTED : rhizo task create <id>
127
+ DRAFTED --> BLOCKED : Unmet DAG dependencies (depends_on)
128
+ DRAFTED --> QUEUED : Zero unmet dependencies
129
+ BLOCKED --> QUEUED : Parent task COMPLETED (Auto-promoted by Lua engine)
130
+
131
+ QUEUED --> DELIVERED : Listener pops message (Transport Receipt emitted)
132
+ DELIVERED --> CLAIMED : Worker acknowledges (Acquires monotonic lease)
133
+ DELIVERED --> ORPHANED : Receipt timeout (180s without claim)
134
+
135
+ CLAIMED --> IN_PROGRESS : Worker provisions strand (vine new <id>)
136
+ IN_PROGRESS --> IN_PROGRESS : Progress reported (rhizo task progress, lease extended)
137
+ IN_PROGRESS --> GATE_EVALUATING : Verification initiated (vine gate)
138
+ IN_PROGRESS --> YIELDED : rhizo task yield (Returned to pool)
139
+ IN_PROGRESS --> ORPHANED : Lease expires without progress
140
+
141
+ GATE_EVALUATING --> IN_PROGRESS : Gate failed (Tests red or merge conflict)
142
+ GATE_EVALUATING --> READY_TO_WEAVE : Two-Key Gate PASSED (Cryptographic gate token stamped)
143
+
144
+ READY_TO_WEAVE --> COMPLETED : vine weave && rhizo task complete (Unblocks downstream DAG children)
145
+
146
+ ORPHANED --> QUEUED : Re-queued for retry (attempts < 3)
147
+ ORPHANED --> DEAD_LETTER : Max delivery retries exceeded (attempts >= 3)
148
+ YIELDED --> QUEUED : Returned to pool
149
+
150
+ COMPLETED --> [*]
151
+ DEAD_LETTER --> [*]
152
+ ```
153
+
154
+ ### ASCII State Transition Reference (LLM Fast-Path)
155
+
156
+ ```text
157
+ [rhizo task create]
158
+ │
159
+ ▼
160
+ +---------+ Unmet deps
161
+ | DRAFTED | ──────────────────► [ BLOCKED ]
162
+ +---------+ │
163
+ │ Zero deps │ Parent task COMPLETED
164
+ ▼ ▼
165
+ +---------+ ◄───────────────────────+
166
+ | QUEUED |
167
+ +---------+
168
+ │
169
+ │ rhizo listen pops task (Transport Receipt emitted)
170
+ ▼
171
+ +-----------+ 180s Receipt Timeout
172
+ | DELIVERED | ─────────────────────────────────► [ ORPHANED ]
173
+ +-----------+ │
174
+ │ │ Attempts >= 3
175
+ │ rhizo task claim / rhizo reply ▼
176
+ ▼ [ DEAD_LETTER ]
177
+ +---------+
178
+ | CLAIMED |
179
+ +---------+
180
+ │
181
+ │ vine new <task_id> (Provision strand)
182
+ ▼
183
+ +-------------+ Lease expires
184
+ | IN_PROGRESS | ────────────────────────────────► [ ORPHANED ]
185
+ +-------------+
186
+ │ ▲
187
+ │ vine │ Gate fails
188
+ │ gate │ (Tests red or conflict)
189
+ ▼ │
190
+ +-----------------+
191
+ | GATE_EVALUATING |
192
+ +-----------------+
193
+ │
194
+ │ Two-Key Gate PASSED (Key 1 merge-tree + Key 2 live test suite green)
195
+ ▼
196
+ +----------------+
197
+ | READY_TO_WEAVE |
198
+ +----------------+
199
+ │
200
+ │ vine weave && rhizo task complete
201
+ ▼
202
+ +-----------+
203
+ | COMPLETED | ──► Auto-promotes BLOCKED child tasks to QUEUED!
204
+ +-----------+
137
205
  ```
138
206
 
207
+ ### State Definitions & Invariants
208
+
209
+ | State | CLI Trigger | Atomic Action & Side Effects | Timeout / Failure Escalation |
210
+ | :--- | :--- | :--- | :--- |
211
+ | **`DRAFTED`** | `rhizo task create <id> --title <t>` | Creates immutable task contract hash `task:<id>` in Redis. | N/A |
212
+ | **`BLOCKED`** | Evaluated on create | Stamped if `depends_on` contains incomplete tasks. Workers cannot claim. | N/A |
213
+ | **`QUEUED`** | Auto on create or parent complete | Pushed to queue/inbox. Available for worker consumption. | N/A |
214
+ | **`DELIVERED`** | `rhizo listen` consumes payload | **Atomically moves into `task:<id>` DELIVERED state**. Instant transport receipt emitted to orchestrator. Mirrored to local `~/.config/rhizo/current_task.json` for turn-end hook interlocks. | 180s Receipt Timeout $
215
+ | **`CLAIMED`** | `rhizo task claim <id>` / `rhizo reply` | Worker acquires monotonic fencing lease. Isolated Vine strand provisioned (`vine new <id>`). Turn-end hook blocks until work starts. | Lease expires $
216
+ | **`IN_PROGRESS`** | Worker coding in strand | Enforces single-active-lease invariant. Periodic `rhizo task progress` extends lease. | Lease expires $
217
+ | **`GATE_EVALUATING`**| `vine gate` | Key 1 (mechanical merge-tree) & Key 2 (live compiler/test suite) evaluated. | Exit 1 $
218
+ | **`READY_TO_WEAVE`** | Both keys pass 100% | Cryptographic gate token stamped (`gate_token`). Report sent to orchestrator. | N/A |
219
+ | **`COMPLETED`** | `vine weave && rhizo task complete` | Fast-forward merged into canonical trunk. Strand pruned. Locks released. **Downstream DAG dependencies automatically unblocked (`BLOCKED` $
220
+ | **`ORPHANED`** | Receipt timeout or lease expired | Stalled worker detected. Increments `delivery_attempts`. If $\ge 3
221
+ | **`YIELDED`** | `rhizo task yield <id>` | Worker gracefully steps aside. Task returned to `QUEUED`. | N/A |
222
+ | **`DEAD_LETTER`** | Retries exhausted ($\ge 3$) | Moved to dead-letter queue. Alerts orchestrator and operator. | Requires manual operator triage |
223
+
224
+
139
225
  ---
140
226
 
141
227
  ## 3. Standard Operating Procedures