@axiomantic/garden 0.1.6 → 0.2.1

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 CHANGED
@@ -5,9 +5,9 @@
5
5
  **Multi-Agent Swarm Orchestration, Empirical Dialectics & Ceremonies on top of Rhizo & Vine**
6
6
 
7
7
  [![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](LICENSE)
8
- [![tmux](https://img.shields.io/badge/tmux-3.0%2B-green.svg)](https://github.com/tmux/tmux)
9
- [![Rhizo](https://img.shields.io/badge/Rhizo-0.1.3%2B-red.svg)](https://github.com/axiomantic/rhizo)
10
- [![Vine](https://img.shields.io/badge/Vine-0.1.0%2B-purple.svg)](https://github.com/axiomantic/vine)
8
+ [![Rhizo](https://img.shields.io/badge/Rhizo-0.2.1%2B-red.svg)](https://github.com/axiomantic/rhizo)
9
+ [![Vine](https://img.shields.io/badge/Vine-0.2.0%2B-purple.svg)](https://github.com/axiomantic/vine)
10
+ [![Swarm](https://img.shields.io/badge/Swarm-Prompt--Bootstrapped-brightgreen.svg)](README.md)
11
11
  [![Platform](https://img.shields.io/badge/Platform-macOS%20%7C%20Linux-blue.svg)](README.md)
12
12
 
13
13
  *Where `rhizo` provides inter-agent transport and `vine` provides workspace virtualization, `garden` provides the institutional intellect, empirical deliberation, and synchronized swarm execution.*
@@ -20,7 +20,7 @@
20
20
 
21
21
  **Garden** is an agentic engineering framework and skill library for orchestrating heterogeneous teams of AI coding assistants (Claude Code, OpenCode, Antigravity, Cursor, Codex).
22
22
 
23
- Instead of treating AI agents as isolated single-turn chatbots, Garden provisions **coordinated worker swarms** inside multiplexed `tmux` sessions, balances specialized personas with designated foundation models and harnesses, drives **empirically grounded dialectical deliberation**, schedules distributed fencing mutexes, and integrates code through isolated APFS Copy-on-Write strands verified by Vine's Two-Key Gate.
23
+ Instead of treating AI agents as isolated single-turn chatbots, Garden provisions **prompt-bootstrapped worker swarms** across your favorite AI coding harnesses (Claude Code, OpenCode, Antigravity, Pi, Cursor), balances specialized personas with designated foundation models, drives **empirically grounded dialectical deliberation**, schedules distributed fencing mutexes, and integrates code through isolated APFS Copy-on-Write strands verified by Vine's Two-Key Gate.
24
24
 
25
25
  ```mermaid
26
26
  flowchart TD
@@ -28,7 +28,7 @@ flowchart TD
28
28
  direction TB
29
29
  GardenSkill["garden (Master Entrypoint)"]
30
30
  P1["choose-personas (Team & Models)"]
31
- P2["launch-workers (tmux & Terminal Viewer)"]
31
+ P2["launch-workers (Prompt-Based Session Bootstrapping)"]
32
32
  P3["dialectical-pump (Research ➔ Design ➔ Audit)"]
33
33
  P4["plan-implementation (Locks & Strands)"]
34
34
  P5["orchestrate-swarm (Dispatch & Weave)"]
@@ -62,19 +62,19 @@ Garden is organized into a clean, batteries-included catalog of self-explanatory
62
62
  | :--- | :--- | :--- |
63
63
  | **[`garden`](skills/garden/SKILL.md)** | **Master Entrypoint** | The sovereign ceremony director. Guides orchestrator and operator step-by-step across all phases from initial task to woven code. |
64
64
  | **[`choose-personas`](skills/choose-personas/SKILL.md)** | **Team Calibration** | Formulates a balanced triad of specialized personas (e.g. Architect, Auditor, DevEx Lead) with explicitly recommended **coding harnesses** and **model tiers**, confirmed interactively with the operator. |
65
- | **[`launch-workers`](skills/launch-workers/SKILL.md)** | **Fleet Provisioning** | Boots a structured `tmux` session with named worker panes, injects environment variables, registers identities via `rhizo open`, arms listeners, and pops open your preferred OS terminal viewer (Ghostty / Terminal.app). |
65
+ | **[`launch-workers`](skills/launch-workers/SKILL.md)** | **Session Bootstrapping** | Generates self-contained, 10-backtick raw markdown prompt cards for pasting into separate terminal sessions (Claude Code, OpenCode, Antigravity, Pi). Configures environment variables, registers identities via `rhizo open`, and arms single-shot listeners. |
66
66
  | **[`dialectical-pump`](skills/dialectical-pump/SKILL.md)** | **Empirical Deliberation** | Drives multi-perspective thesis/antithesis/synthesis debates. Strictly prohibits theatrical roleplay: every turn requires tool execution (reading files, running tests, checking ASTs). Produces `understanding.md`, `design.md`, and `audit_report.md`. |
67
67
  | **[`plan-implementation`](skills/plan-implementation/SKILL.md)** | **Master Scheduling** | Authors `implementation_plan.md` defining task assignment matrices, `rhizo` distributed fencing locks, `vine` strand workflows, dynamic markdown checkboxes, harness To-Do integration, and emergent design addenda. |
68
68
  | **[`orchestrate-swarm`](skills/orchestrate-swarm/SKILL.md)** | **Main-Chat Governor** | Governs execution from the primary chat session: dispatches tasks over Redis, tracks heartbeats, ratifies emergent design addenda, verifies Two-Key gate passes, and triggers `vine weave`. |
69
69
 
70
70
  ## Standalone Yet Designed for the Axiomantic Triad
71
71
 
72
- Garden is completely standalone and can direct multi-agent dialectics, persona selection, and tmux worker swarms on any codebase.
72
+ Garden is completely standalone and can direct multi-agent dialectics, persona selection, and prompt-bootstrapped worker swarms on any codebase.
73
73
 
74
74
  However, Garden is designed from the ground up to pair seamlessly with **Rhizo** and **Vine**:
75
75
  - [**Rhizo**](https://github.com/axiomantic/rhizo) (Transport & Concurrency): Inter-agent messaging bus, monotonic fencing locks, and task queues over Redis.
76
76
  - [**Vine**](https://github.com/axiomantic/vine) (Workspaces & Verification): Sub-second APFS Copy-on-Write strands, polyglot build-cache normalization, and the Two-Key integration gate (`git merge-tree` mechanical + compiler/test suite semantic checks).
77
- - **Garden** (Swarm Ceremonies): Tmux worker fleet provisioning, 3-stage empirical dialectical pump (research, architecture, audit), and master ceremonial implementation planning.
77
+ - **Garden** (Swarm Ceremonies): Prompt-based worker session bootstrapping, 3-stage empirical dialectical pump (research, architecture, audit), and master ceremonial implementation planning.
78
78
 
79
79
  ---
80
80
 
@@ -127,22 +127,20 @@ garden guide install
127
127
 
128
128
  ## System Prerequisites
129
129
 
130
- 1. **`tmux`** (3.0+):
131
- ```bash
132
- brew install tmux
133
- ```
134
- 2. **`rhizo`** (Coordination Engine):
130
+ 1. **`rhizo`** (Coordination Engine):
135
131
  ```bash
136
132
  npm install -g @axiomantic/rhizo
137
133
  ```
138
- 3. **`vine`** (Workspace Virtualization Engine):
134
+ 2. **`vine`** (Workspace Virtualization Engine):
139
135
  ```bash
140
- npm install -g @axiomantic/vine
136
+ npm install -g @axiomantic/vine rift-snapshot
141
137
  ```
142
- 4. **Redis or Valkey** (local or remote):
138
+ 3. **Redis or Valkey** (local or remote):
143
139
  ```bash
144
140
  brew install redis && brew services start redis
145
141
  ```
142
+ 4. **`tmux`** (Optional):
143
+ Only required if explicitly running legacy headless panes via `garden launch --tmux`.
146
144
 
147
145
  ---
148
146
 
@@ -163,12 +161,14 @@ Garden inspects your repository and suggests a balanced persona roster with reco
163
161
 
164
162
  Confirm or adjust the roster with a single click.
165
163
 
166
- ### 3. Automatic Fleet Provisioning (`launch-workers`)
167
- Garden executes [`scripts/launch_tmux_swarm.sh`](scripts/launch_tmux_swarm.sh):
168
- - Creates tmux session `garden-<project>` with dedicated panes for each worker.
169
- - Sets environment variables and registers each agent via `rhizo open`.
170
- - Arms background listeners (`rhizo listen`).
171
- - Automatically pops open a visible **Ghostty** or **Terminal.app** window on macOS so you can watch the swarm running live.
164
+ ### 3. Prompt-Based Swarm Bootstrapping (`launch-workers`)
165
+ Garden generates raw markdown prompt cards wrapped in 10 backticks for each worker:
166
+ ```bash
167
+ garden prompts
168
+ ```
169
+ - The operator copies and pastes each prompt block into a separate terminal window or coding harness (Claude Code, OpenCode, Antigravity, Pi, Cursor).
170
+ - Each session enters the project directory, sets `RHIZO_AGENT_NAME`, registers on the bus with `rhizo open`, and arms its single-shot listener with `rhizo listen`.
171
+ - The Orchestrator verifies readiness via `rhizo who --json` before dispatching tasks.
172
172
 
173
173
  ### 4. The Dialectical Pump (`dialectical-pump`)
174
174
  The personas deliberate across three empirical stages:
@@ -187,6 +187,74 @@ The main chat orchestrator dispatches work over Redis. Workers code in isolated
187
187
 
188
188
  ---
189
189
 
190
+ ## CLI Reference
191
+
192
+ | Command | Arguments | Description |
193
+ | :--- | :--- | :--- |
194
+ | `garden prompts` | `[--worker <name>] [--write [file]] [--json] [--project-dir <dir>] [--swarm-file <file>]` | Generate 10-backtick raw markdown prompt cards for pasting into worker sessions. |
195
+ | `garden launch` | `[--worker <name>] [--write [file]] [--json] [--tmux] [--session-name <name>]` | Bootstrap swarm worker sessions (defaults to generating prompt cards). |
196
+ | `garden status` | `[--json] [--session-name <name>]` | Telemetry query across active Rhizo agents, listener status, and Vine strands. |
197
+ | `garden init` | `[<target_dir>] [--force]` | Initialize `garden.toml`, docs scaffold, and install guide in `AGENTS.md`. |
198
+ | `garden teardown`| `[--session-name <name>] [--swarm-file <file>]` | Gracefully close registered swarm agents on the Redis bus. |
199
+ | `garden guide` | `<install\|check\|uninstall> [path]` | Install or manage Garden Multi-Agent Swarm Guide in `AGENTS.md`. |
200
+
201
+ ---
202
+
203
+ ## Configuration & Swarm Manifest Reference
204
+
205
+ > [!TIP]
206
+ > For the complete specification of `garden.toml`, `garden-swarm.json` schemas, and environment variables, see the [Garden Configuration & Swarm Manifest Reference](docs/configuration.md).
207
+
208
+ ### Environment Variables
209
+
210
+ | Variable | Type | Default | Description |
211
+ | :--- | :--- | :--- | :--- |
212
+ | `GARDEN_SWARM_FILE` | Path | `garden-swarm.json` | Explicit path to swarm manifest JSON file. |
213
+ | `GARDEN_CONFIG` | Path | `garden.toml` | Explicit path to project `garden.toml`. |
214
+ | `GARDEN_PROJECT_DIR`| Path | *Auto-detected* | Target repository root directory. |
215
+ | `GARDEN_TERMINAL_APP`| String | `auto` | Preferred terminal viewer for tmux sessions (`Ghostty`, `Terminal`, `iTerm`, `none`). |
216
+
217
+ ### Example `garden-swarm.json`
218
+
219
+ ```json
220
+ {
221
+ "project": "myproject",
222
+ "target_repo": "/Users/developer/Development/myproject",
223
+ "orchestrator": "orchestrator",
224
+ "workers": [
225
+ {
226
+ "name": "architect",
227
+ "persona": "Dr. Marcus Vance (Systems Architect)",
228
+ "role": "Systems Architect & Formal Invariant Specifier",
229
+ "harness": "Claude Code",
230
+ "model": "claude-3-5-sonnet",
231
+ "tags": ["design", "spec"],
232
+ "opposing_priority": "Formal mathematical correctness and zero architectural drift."
233
+ },
234
+ {
235
+ "name": "auditor",
236
+ "persona": "Lyra Sterling (Adversarial Quality Auditor)",
237
+ "role": "Adversarial Code Reviewer & Security Auditor",
238
+ "harness": "OpenCode",
239
+ "model": "gemini-3.8-flash",
240
+ "tags": ["audit", "testing"],
241
+ "opposing_priority": "Aggressive edge-case fault injection and invariant verification."
242
+ },
243
+ {
244
+ "name": "implementer",
245
+ "persona": "Elena Rostova (Lead Implementation Engineer)",
246
+ "role": "Polyglot Systems & Performance Engineer",
247
+ "harness": "Antigravity",
248
+ "model": "claude-3-5-sonnet",
249
+ "tags": ["implementation", "perf"],
250
+ "opposing_priority": "Rapid implementation velocity and minimal dependency footprint."
251
+ }
252
+ ]
253
+ }
254
+ ```
255
+
256
+ ---
257
+
190
258
  ## Core Invariants
191
259
 
192
260
  1. **The Supreme Orchestrator Invariant**:
package/SKILL.md CHANGED
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: garden
3
- description: "Master entrypoint and end-to-end ceremony director for multi-agent swarms operating on top of Rhizo (transport) and Vine (workspace integrator). Guides the user and orchestrator session through the full lifecycle: persona selection with harness/model pairing, tmux worker fleet provisioning with live terminal viewer, 3-stage empirical dialectical pump (research, design, audit), master implementation planning with locking/strand schedules, and live swarm execution with Two-Key gate verification and fast-forward trunk weaving. Triggers: 'garden', 'run garden', 'swarm this project', 'orchestrate with garden', 'start garden swarm', 'run the full garden ceremony'."
3
+ description: "Master entrypoint and end-to-end ceremony director for multi-agent swarms operating on top of Rhizo (transport) and Vine (workspace integrator). Guides the user and orchestrator session through the full lifecycle: persona selection with harness/model pairing, prompt-based worker fleet bootstrapping with 10-backtick copy-paste prompt cards, 3-stage empirical dialectical pump (research, design, audit), master implementation planning with locking/strand schedules, and live swarm execution with Two-Key gate verification and fast-forward trunk weaving. Triggers: 'garden', 'run garden', 'swarm this project', 'orchestrate with garden', 'start garden swarm', 'run the full garden ceremony'."
4
4
  ---
5
5
 
6
6
  # Garden: Multi-Agent Swarm Ceremony & Orchestration Engine
@@ -25,7 +25,7 @@ Garden directs multi-agent swarms using Rhizo for transport and Vine for workspa
25
25
  flowchart TD
26
26
  subgraph Garden["Garden Layer (Methodology & Ceremonies)"]
27
27
  Phase1["Phase 1: choose-personas (Team Selection & Models)"]
28
- Phase2["Phase 2: launch-workers (tmux & Terminal Viewer)"]
28
+ Phase2["Phase 2: launch-workers (Prompt-Based Session Bootstrapping)"]
29
29
  Phase3["Phase 3: dialectical-pump (Research ➔ Design ➔ Audit)"]
30
30
  Phase4["Phase 4: plan-implementation (Locking & Strands)"]
31
31
  Phase5["Phase 5: orchestrate-swarm (Dispatch & Vine Weaving)"]
@@ -52,7 +52,7 @@ Execute all five phases sequentially. Never skip phases or invert the order.
52
52
  | Phase | Sub-Skill | Action | Quality Gate to Proceed |
53
53
  | :--- | :--- | :--- | :--- |
54
54
  | **Phase 1** | [`choose-personas`](../choose-personas/SKILL.md) | Formulate 3 balanced personas with harness/model pairings. | Operator ratifies `garden-swarm.json`. |
55
- | **Phase 2** | [`launch-workers`](../launch-workers/SKILL.md) | Provision tmux session, register agents, launch viewer. | `rhizo who --json` confirms 100% of workers active. |
55
+ | **Phase 2** | [`launch-workers`](../launch-workers/SKILL.md) | Generate 10-backtick worker prompt cards for operator pasting into sessions. | `rhizo who --json` confirms 100% of workers active. |
56
56
  | **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`. |
57
57
  | **Phase 4** | [`plan-implementation`](../plan-implementation/SKILL.md) | Author master implementation plan with locking schedules and strands. | Complete `implementation_plan.md` with task-locking matrix. |
58
58
  | **Phase 5** | [`orchestrate-swarm`](../orchestrate-swarm/SKILL.md) | Main-chat governor: task dispatch, heartbeat monitoring, trunk weaving. | All plan tasks woven via `vine weave` after passing Two-Key Gate. |
@@ -76,3 +76,40 @@ Never merge code into the canonical trunk without a verified Two-Key Gate pass (
76
76
  <FORBIDDEN>
77
77
  Never stage coordination metadata (*.lock, .rhizo.*, .vine.json, workspaces/) into Git. Keep all agent state ignored.
78
78
  </FORBIDDEN>
79
+
80
+ <CRITICAL>
81
+ Compaction Preservation Rider (GVR-010):
82
+ Whenever context summarization or compaction occurs, the coding harness MUST preserve the `SWARM_RUNTIME_STATE` block verbatim in the compacted summary preamble so the agent immediately retains its operational identity, assigned workspace, peers, and active listeners without operator re-prompting.
83
+
84
+ Maintain this exact block in the working context:
85
+ <!-- SWARM_RUNTIME_STATE: DO NOT DISCARD OR ABBREVIATE IN COMPACTION -->
86
+ - AGENT_NAME: <codename> (Role: <role>)
87
+ - WORKSPACE_MODE: Root Trunk | Strand (<path>)
88
+ - ACTIVE_STRAND: <branch> (Parent: <parent_branch>)
89
+ - ACTIVE_PEERS:
90
+ * <peer_codename> (<project>: <current_task_description>)
91
+ - ACTIVE_LISTENER: <task_id_or_pid> (Listening on inbox: <codename>)
92
+ - ACTIVE_FENCING_TOKENS: <lock_key>=<token_int>
93
+ <!-- END_SWARM_RUNTIME_STATE -->
94
+ </CRITICAL>
95
+
96
+ ---
97
+
98
+ ## 4. Responsiveness Watchdog & Operator Escalation Protocol (GVR-011)
99
+
100
+ To prevent silent deadlocks when workers stall, crash, or fail to re-arm listeners:
101
+ 1. **Health Probing**: Run `rhizo probe <agent> [--json]` to inspect listener PID liveness, inbox unread depth, and heartbeat age.
102
+ 2. **Watchdog Window**: If a worker fails to respond within the expected turn window (e.g. 5–10 minutes) and `rhizo probe` reveals `NO_LISTENER` or unread inbox items:
103
+ - **Escalate Immediately**: Prompt the operator via `ask_question` with the diagnostic status.
104
+ - **Actionable Remediation**: Offer options to (1) re-arm the listener in the worker's terminal session (`rhizo listen <worker>`), (2) reboot the agent harness, or (3) reassign the task via `rhizo reroute <worker> <new_worker>`.
105
+
106
+ ---
107
+
108
+ ## 5. Configuration & Swarm Manifest Reference
109
+
110
+ See [`docs/configuration.md`](docs/configuration.md) for full details on:
111
+ - **Environment Variables**: `GARDEN_SWARM_FILE`, `GARDEN_CONFIG`, `GARDEN_PROJECT_DIR`, and `GARDEN_TERMINAL_APP`.
112
+ - **`garden.toml`**: Project-level defaults (`name`, `preferred_terminal`, `session_prefix`, `default_triad`).
113
+ - **`garden-swarm.json`**: Swarm specification schema (`project`, `target_repo`, `orchestrator`, `shared_workspace`, `workers` array: `name`, `persona`, `role`, `harness`, `model`, `tags`, `system_prompt`, `opposing_priority`).
114
+ - **The 10-Backtick Protocol**: Clean raw markdown formatting for copy-paste worker bootstrap prompts.
115
+
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.1.6",
3
+ "version": "0.2.1",
4
4
  "description": "Multi-Agent Swarm Orchestration, Empirical Dialectics & Ceremonies on top of Rhizo & Vine",
5
5
  "main": "bin/run.js",
6
6
  "bin": {
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: garden
3
- description: "Master entrypoint and end-to-end ceremony director for multi-agent swarms operating on top of Rhizo (transport) and Vine (workspace integrator). Guides the user and orchestrator session through the full lifecycle: persona selection with harness/model pairing, tmux worker fleet provisioning with live terminal viewer, 3-stage empirical dialectical pump (research, design, audit), master implementation planning with locking/strand schedules, and live swarm execution with Two-Key gate verification and fast-forward trunk weaving. Triggers: 'garden', 'run garden', 'swarm this project', 'orchestrate with garden', 'start garden swarm', 'run the full garden ceremony'."
3
+ description: "Master entrypoint and end-to-end ceremony director for multi-agent swarms operating on top of Rhizo (transport) and Vine (workspace integrator). Guides the user and orchestrator session through the full lifecycle: persona selection with harness/model pairing, prompt-based worker fleet bootstrapping with 10-backtick copy-paste prompt cards, 3-stage empirical dialectical pump (research, design, audit), master implementation planning with locking/strand schedules, and live swarm execution with Two-Key gate verification and fast-forward trunk weaving. Triggers: 'garden', 'run garden', 'swarm this project', 'orchestrate with garden', 'start garden swarm', 'run the full garden ceremony'."
4
4
  ---
5
5
 
6
6
  # Garden: Multi-Agent Swarm Ceremony & Orchestration Engine
@@ -25,7 +25,7 @@ Garden directs multi-agent swarms using Rhizo for transport and Vine for workspa
25
25
  flowchart TD
26
26
  subgraph Garden["Garden Layer (Methodology & Ceremonies)"]
27
27
  Phase1["Phase 1: choose-personas (Team Selection & Models)"]
28
- Phase2["Phase 2: launch-workers (tmux & Terminal Viewer)"]
28
+ Phase2["Phase 2: launch-workers (Prompt-Based Session Bootstrapping)"]
29
29
  Phase3["Phase 3: dialectical-pump (Research ➔ Design ➔ Audit)"]
30
30
  Phase4["Phase 4: plan-implementation (Locking & Strands)"]
31
31
  Phase5["Phase 5: orchestrate-swarm (Dispatch & Vine Weaving)"]
@@ -52,7 +52,7 @@ Execute all five phases sequentially. Never skip phases or invert the order.
52
52
  | Phase | Sub-Skill | Action | Quality Gate to Proceed |
53
53
  | :--- | :--- | :--- | :--- |
54
54
  | **Phase 1** | [`choose-personas`](../choose-personas/SKILL.md) | Formulate 3 balanced personas with harness/model pairings. | Operator ratifies `garden-swarm.json`. |
55
- | **Phase 2** | [`launch-workers`](../launch-workers/SKILL.md) | Provision tmux session, register agents, launch viewer. | `rhizo who --json` confirms 100% of workers active. |
55
+ | **Phase 2** | [`launch-workers`](../launch-workers/SKILL.md) | Generate 10-backtick worker prompt cards for operator pasting into sessions. | `rhizo who --json` confirms 100% of workers active. |
56
56
  | **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`. |
57
57
  | **Phase 4** | [`plan-implementation`](../plan-implementation/SKILL.md) | Author master implementation plan with locking schedules and strands. | Complete `implementation_plan.md` with task-locking matrix. |
58
58
  | **Phase 5** | [`orchestrate-swarm`](../orchestrate-swarm/SKILL.md) | Main-chat governor: task dispatch, heartbeat monitoring, trunk weaving. | All plan tasks woven via `vine weave` after passing Two-Key Gate. |
@@ -76,3 +76,45 @@ Never merge code into the canonical trunk without a verified Two-Key Gate pass (
76
76
  <FORBIDDEN>
77
77
  Never stage coordination metadata (*.lock, .rhizo.*, .vine.json, workspaces/) into Git. Keep all agent state ignored.
78
78
  </FORBIDDEN>
79
+
80
+ <CRITICAL>
81
+ Compaction Preservation Rider (GVR-010):
82
+ Whenever context summarization or compaction occurs, the coding harness MUST preserve the `SWARM_RUNTIME_STATE` block verbatim in the compacted summary preamble so the agent immediately retains its operational identity, assigned workspace, peers, and active listeners without operator re-prompting.
83
+
84
+ Maintain this exact block in the working context:
85
+ <!-- SWARM_RUNTIME_STATE: DO NOT DISCARD OR ABBREVIATE IN COMPACTION -->
86
+ - AGENT_NAME: <codename> (Role: <role>)
87
+ - WORKSPACE_MODE: Root Trunk | Strand (<path>)
88
+ - ACTIVE_STRAND: <branch> (Parent: <parent_branch>)
89
+ - ACTIVE_PEERS:
90
+ * <peer_codename> (<project>: <current_task_description>)
91
+ - ACTIVE_LISTENER: <task_id_or_pid> (Listening on inbox: <codename>)
92
+ - ACTIVE_FENCING_TOKENS: <lock_key>=<token_int>
93
+ <!-- END_SWARM_RUNTIME_STATE -->
94
+ </CRITICAL>
95
+
96
+ ---
97
+
98
+ ## 4. Responsiveness Watchdog & Operator Escalation Protocol (GVR-011)
99
+
100
+ To prevent silent deadlocks when workers stall, crash, or fail to re-arm listeners:
101
+ 1. **Health Probing**: Run `rhizo probe <agent> [--json]` to inspect listener PID liveness, inbox unread depth, and heartbeat age.
102
+ 2. **Watchdog Window**: If a worker fails to respond within the expected turn window (e.g. 5–10 minutes) and `rhizo probe` reveals `NO_LISTENER` or unread inbox items:
103
+ - **Escalate Immediately**: Prompt the operator via `ask_question` with the diagnostic status.
104
+ - **Actionable Remediation**: Offer options to (1) re-arm the listener in the worker's terminal session (`rhizo listen <worker>`), (2) reboot the agent harness, or (3) reassign the task via `rhizo reroute <worker> <new_worker>`.
105
+ 3. **Orchestrator Self-Audit Watchdog & Debouncer Protocol (GVR-014)**:
106
+ - For harnesses supporting `schedule` (e.g. Antigravity), arm a debounced 15-minute watchdog timer (`schedule(DurationSeconds=900, Prompt="...", TimerCondition="any")`).
107
+ - Debouncer replaces (kills previous timer via `manage_task(Action='kill')` before arming a new one) on task dispatch, worker reports, and plan updates ("early and often"). Arriving worker traffic cancels the timer for free with 0 token overhead.
108
+ - When the timer fires, execute the short check: `rhizo watchdog check --agent <orchestrator> --json`. If `ACTION_REQUIRED: REARM_LISTENER`, revive `rhizo listen` in the background and debounce. When all tasks in the plan are complete (`- [x]`), stand down.
109
+
110
+ ---
111
+
112
+ ## 5. Configuration & Swarm Manifest Reference
113
+
114
+ See [`docs/configuration.md`](../../docs/configuration.md) for full details on:
115
+ - **Environment Variables**: `GARDEN_SWARM_FILE`, `GARDEN_CONFIG`, `GARDEN_PROJECT_DIR`, and `GARDEN_TERMINAL_APP`.
116
+ - **`garden.toml`**: Project-level defaults (`name`, `preferred_terminal`, `session_prefix`, `default_triad`).
117
+ - **`garden-swarm.json`**: Swarm specification schema (`project`, `target_repo`, `orchestrator`, `shared_workspace`, `workers` array: `name`, `persona`, `role`, `harness`, `model`, `tags`, `system_prompt`, `opposing_priority`).
118
+ - **The 10-Backtick Protocol**: Clean raw markdown formatting for copy-paste worker bootstrap prompts.
119
+
120
+
@@ -1,106 +1,118 @@
1
1
  ---
2
2
  name: launch-workers
3
- description: "Provisions an active worker fleet inside a dedicated tmux session and launches an OS-level terminal viewer (Ghostty / Terminal.app). Reads garden-swarm.json, creates named tmux windows/panes for each worker, configures environment variables (RHIZO_AGENT_NAME, project path), registers each agent in Redis with rhizo open, arms background listeners, and runs AppleScript or open commands on macOS to display the live worker windows to the operator. Verifies cluster heartbeat readiness via rhizo who --json before handing off. Triggers: 'launch workers', 'spin up workers', 'start worker swarm', 'open tmux swarm', 'launch fleet'."
3
+ description: "Generates and formats X distinct copy-pasteable bootstrap prompts for new agent sessions (Claude Code, Pi, OpenCode, Antigravity, etc.) to join the Garden work group on Rhizo and Vine. Reads garden-swarm.json, configures identities, environment setup (RHIZO_AGENT_NAME, cd, rhizo open), single-shot listener discipline, task claiming, and Vine strand isolation. Spits out prompt blocks wrapped in 10 backticks for clean, unrendered raw markdown copying, and verifies cluster heartbeat readiness via rhizo who --json before handing off. Triggers: 'launch workers', 'spin up workers', 'start worker swarm', 'generate worker prompts', 'bootstrap swarm', 'launch fleet'."
4
4
  ---
5
5
 
6
- # `launch-workers`: Automated Tmux Swarm Provisioning & Terminal Viewer
6
+ # `launch-workers`: Prompt-Based Swarm Bootstrapping & Work Group Onboarding
7
7
 
8
- > **From Manifest to Live Terminals in Under 2 Seconds**
9
- > *Tmux multiplexes the background worker processes while OS-level desktop scripting opens your preferred terminal app so you can observe the swarm in real time.*
8
+ > **From Manifest to Coordinated Sessions Across Any AI Harness**
9
+ > *Garden generates self-contained, 10-backtick-fenced prompt cards for the human operator to paste into separate terminal tabs or coding harnesses (Claude Code, OpenCode, Antigravity, Pi, Cursor). Each session is immediately grounded in its identity, joins the Rhizo work group, and arms its listener.*
10
10
 
11
11
  ---
12
12
 
13
- ## 1. System Requirements & Invariants
14
-
15
- 1. **`tmux` is Required**:
16
- - `tmux 3.0+` must be installed on the host (`command -v tmux`). If missing, fail fast and instruct the operator to install (`brew install tmux`).
17
- 2. **`rhizo` is Required**:
18
- - Rhizo engine must be present (`npm install -g @axiomantic/rhizo`).
19
- 3. **No Terminal Fallbacks**:
20
- - Workers are strictly managed inside tmux windows/panes. We do not detach headless rogue background processes with `nohup` or `&`.
21
- 4. **Desktop Viewer Priority on macOS**:
22
- - Automatically detects installed terminal emulators:
23
- - **Priority 1: Ghostty** (`/Applications/Ghostty.app`)
24
- - **Priority 2: iTerm2** (`/Applications/iTerm.app`)
25
- - **Priority 3: macOS Terminal** (`/System/Applications/Utilities/Terminal.app`)
26
- - Pops open a visible terminal window running `tmux attach-session -t garden-<project>`.
13
+ ## 1. System Philosophy & Invariants
14
+
15
+ 1. **Human-in-the-Loop Session Autonomy**:
16
+ - We do not blindly spawn tmux background processes or attempt to drive terminal multiplexers with fragile subshell scripting.
17
+ - The operator chooses the harness and model for each worker (e.g. Claude Code CLI in one tab, OpenCode in another, Antigravity in a third).
18
+ 2. **Raw Markdown 10-Backtick Fencing**:
19
+ <CRITICAL>
20
+ When outputting prompt cards in stdout, artifacts, or chat, every prompt block MUST be wrapped in exactly 10 backticks:
21
+ ``````````markdown
22
+ ...
23
+ ``````````
24
+ This guarantees that nested backtick fences (```bash) and internal markdown headers inside the prompts do NOT prematurely terminate the code block or render markdown, preserving pristine raw text for one-click clipboard copying.
25
+ </CRITICAL>
26
+ 3. **Single-Shot Listener Discipline**:
27
+ <CRITICAL>
28
+ Inside worker prompts, `rhizo listen <name>` must always be presented as a single-shot, blocking foreground command with zero timeout (infinite wait).
29
+ NEVER wrap `rhizo listen` in a shell loop (`while true; do rhizo listen; done` or `until rhizo listen; do ...`). Loops trap message payloads inside unmonitored subshell logs and hang coordination.
30
+ </CRITICAL>
31
+ 4. **Zero Dirty Commits**:
32
+ - Never stage coordination state (`.rhizo.*`, `*.lock`, `.vine.json`, `workspaces/`) into Git.
27
33
 
28
34
  ---
29
35
 
30
- ## 2. The Provisioning Flow
36
+ ## 2. The Bootstrapping Flow
31
37
 
32
38
  ```mermaid
33
39
  sequenceDiagram
34
40
  autonumber
35
41
  participant Orch as Main Chat (Orchestrator)
36
- participant Script as launch_tmux_swarm.sh
37
- participant Tmux as tmux Daemon
38
- participant OS as macOS Window Server (Ghostty / Terminal)
42
+ participant Garden as garden prompts / launch
43
+ participant Op as Human Operator
44
+ participant Workers as New Terminal Sessions (Claude, OpenCode, etc.)
39
45
  participant Redis as Rhizo (Redis Bus)
40
46
 
41
- Orch->>Script: Invokes with --swarm-file garden-swarm.json
42
- Script->>Tmux: Creates session garden-<project>
43
- loop For Each Worker in Manifest
44
- Script->>Tmux: Creates named window/pane
45
- Script->>Tmux: Injects RHIZO_AGENT_NAME & cd <project>
46
- Script->>Tmux: Sends rhizo open <name> "<tags>"
47
- Script->>Tmux: Arms listener (rhizo listen or custom startup command)
48
- Tmux->>Redis: Registers heartbeat & listener lock
47
+ Orch->>Garden: Runs garden prompts (or garden launch)
48
+ Garden-->>Orch: Emits X prompt cards wrapped in 10 backticks
49
+ Orch->>Op: Displays formatted prompt blocks to operator
50
+ Op->>Workers: Pastes Prompt #1 into Session 1, Prompt #2 into Session 2...
51
+ loop Each Pasted Worker Session
52
+ Workers->>Workers: Sets RHIZO_AGENT_NAME & enters target directory
53
+ Workers->>Redis: Runs rhizo open <name> "<tags>"
54
+ Workers->>Redis: Runs rhizo listen <name> (blocks waiting for tasks)
49
55
  end
50
- Script->>OS: Opens Ghostty/Terminal attached to tmux session
51
- Script-->>Orch: Returns JSON status
52
- Orch->>Redis: Verifies cluster readiness (rhizo who --json)
56
+ Orch->>Redis: Runs rhizo who --json to verify readiness gate
57
+ Redis-->>Orch: All workers active and listening
58
+ Orch->>Op: Confirms swarm is ready for task dispatch
53
59
  ```
54
60
 
55
61
  ---
56
62
 
57
63
  ## 3. Execution Procedure
58
64
 
59
- ### Step 1: Run the Swarm Provisioner
60
- Execute [`scripts/launch_tmux_swarm.sh`](file:///Users/eek/Development/garden/scripts/launch_tmux_swarm.sh) with the active project path and manifest:
65
+ ### Step 1: Generate Worker Bootstrap Prompts
66
+ Run `garden prompts` (or `garden launch`) from the project root:
61
67
 
62
68
  ```bash
63
- /Users/eek/Development/garden/scripts/launch_tmux_swarm.sh \
64
- --project-dir "$(pwd)" \
65
- --swarm-file "garden-swarm.json" \
66
- --force
69
+ # Output all worker prompts to terminal (and optionally write to file):
70
+ garden prompts --write garden-prompts.md
71
+
72
+ # Or generate for a specific worker:
73
+ garden prompts --worker architect
67
74
  ```
68
75
 
69
- - `--force`: Kills any stale prior session with the same project name before provisioning a clean fleet.
70
- - Automatically launches Ghostty or Terminal.app on macOS attached to the new session.
76
+ If `garden-swarm.json` exists in the repository, Garden uses its configured personas, mandates, harnesses, and models. If missing, Garden automatically synthesizes the standard balanced triad:
77
+ - `@architect` (Marcus Vance - Staff Systems Architect)
78
+ - `@auditor` (Caleb Thorne - Verification & Adversarial Auditor)
79
+ - `@implementer` (Elena Rostova - DevEx & Implementation Lead)
80
+
81
+ ### Step 2: Present & Paste Prompts into Sessions
82
+ The operator opens a separate terminal window, tab, or harness session for each worker, then copies and pastes the corresponding raw block from the 10-backtick pre block.
83
+
84
+ Each prompt immediately instructs the agent to:
85
+ 1. `cd "<project_dir>"`
86
+ 2. `export RHIZO_AGENT_NAME="<name>"`
87
+ 3. `rhizo open "<name>" "<tags>"`
88
+ 4. `rhizo listen "<name>"` (blocking until the Orchestrator delivers a task)
71
89
 
72
- ### Step 2: Verify Cluster Readiness Gate
73
- Before dispatching tasks, verify that every worker from `garden-swarm.json` is actively registered in Redis and displaying valid heartbeats:
90
+ ### Step 3: Verify Cluster Readiness Gate
91
+ Before dispatching tasks, verify that every worker has registered in Redis and is showing active heartbeats:
74
92
 
75
93
  ```bash
76
94
  rhizo who --json
77
95
  ```
78
96
 
79
97
  **Pass Criteria**:
80
- 1. All worker names in `garden-swarm.json` appear in `active_agents`.
98
+ 1. All worker codenames from the manifest appear in `active_agents`.
81
99
  2. Heartbeats have active TTLs (> 0).
82
- 3. Assigned tags match the manifest.
83
-
84
- ### Step 3: Inspect Terminal Buffer (Health Check)
85
- To check the initial logs or output of any worker without leaving your chat:
86
-
87
- ```bash
88
- # Capture last 20 lines of worker 'architect' (window 0)
89
- tmux capture-pane -p -t garden-<project>:0 | tail -n 20
90
- ```
100
+ 3. `rhizo probe <agent>` shows an active listener PID ready to receive work.
91
101
 
92
102
  ---
93
103
 
94
104
  ## 4. Teardown & Swarm Cleanup
95
105
 
96
- When the entire project is completed, or when canceling a run:
106
+ When the swarm mission is completed, or when canceling a run:
97
107
 
98
108
  ```bash
99
109
  # Gracefully deregister all swarm agents from Redis:
110
+ garden teardown
111
+ ```
112
+
113
+ Or manually:
114
+ ```bash
100
115
  for worker in $(python3 -c "import json; [print(w['name']) for w in json.load(open('garden-swarm.json'))['workers']]"); do
101
116
  rhizo close "$worker" 2>/dev/null || true
102
117
  done
103
-
104
- # Terminate the tmux session:
105
- tmux kill-session -t garden-<project> 2>/dev/null || true
106
118
  ```
@@ -17,6 +17,54 @@ The main chat session assumes the role of **Supreme Orchestrator**:
17
17
  - **Strict Transport Discipline**: All task assignments, handoffs, and cancellation interrupts flow exclusively over the Rhizo Redis bus (`rhizo send`, `rhizo reply`, `rhizo enqueue`).
18
18
  - **Gated Integration**: Never run `git merge` directly. Only weave branches that have passed both Key 1 (mechanical merge-tree) and Key 2 (live compiler/tests) inside their Vine strands.
19
19
 
20
+ <CRITICAL>
21
+ Compaction Preservation Rider (GVR-010):
22
+ Whenever context summarization or compaction occurs, the coding harness MUST preserve the `SWARM_RUNTIME_STATE` block verbatim in the compacted summary preamble so the agent immediately retains its operational identity, assigned workspace, peers, and active listeners without operator re-prompting.
23
+
24
+ Maintain this exact block in the working context:
25
+ <!-- SWARM_RUNTIME_STATE: DO NOT DISCARD OR ABBREVIATE IN COMPACTION -->
26
+ - AGENT_NAME: <codename> (Role: Supreme Orchestrator)
27
+ - WORKSPACE_MODE: Root Trunk (/Users/eek/Development/<project>)
28
+ - ACTIVE_STRAND: canonical trunk
29
+ - ACTIVE_PEERS:
30
+ * <peer_codename> (<project>: <current_task_description>)
31
+ - ACTIVE_LISTENER: <task_id_or_pid> (Listening on inbox: <codename>)
32
+ - ACTIVE_FENCING_TOKENS: <lock_key>=<token_int>
33
+ <!-- END_SWARM_RUNTIME_STATE -->
34
+ </CRITICAL>
35
+
36
+ <CRITICAL>
37
+ Orchestrator Turn-End Listener Invariant (GVR-014):
38
+ Coding harnesses (Antigravity, Claude Code, OpenCode) are event-driven: when the model yields a turn with text output, execution is completely suspended. Redis inbox state changes CANNOT wake an idle harness without an active child process registered in the task manager.
39
+
40
+ Whenever the Supreme Orchestrator dispatches a task, broadcasts instructions, or awaits worker responses, THE FINAL ACTION OF THAT TURN MUST BE ARMING A BACKGROUND LISTENER:
41
+ `run_command(CommandLine="rhizo listen <orchestrator>", IsDaemon=false, WaitMsBeforeAsync=500)`
42
+
43
+ FORBIDDEN: Never yield the conversation turn to the operator after dispatching work without an active background listener running. Yielding a turn without a listener severs the swarm's physical lifeline, trapping worker replies in Redis and causing silent swarm stalls.
44
+
45
+ Safety Net (Scheduled Timer Watchdog & Debouncer Protocol):
46
+ In harnesses supporting `schedule` (e.g. Google Antigravity), arm a debounced watchdog timer to ensure an orchestrator session is never abandoned if a listener fails to arm or terminates prematurely.
47
+ - **Cadence**: 15 minutes (`DurationSeconds=900`, range 10m–30m / 600s–1800s). Defaulting to 15m avoids slurping token budgets while guaranteeing a 15m upper bound on any stall.
48
+ - **Replace, Never Stack Invariant**:
49
+ Harnesses prohibit concurrent timers with `TimerCondition="any"`. Before setting a timer, inspect running tasks with `manage_task(Action='list')`. If an existing watchdog task is active (`toolName == "schedule"` or prompt includes `[RHIZO WATCHDOG]`), cancel it via `manage_task(Action='kill', TaskId=...)`.
50
+ - **Debounce Triggers (Early and Often)**:
51
+ Run the debouncer subroutine on:
52
+ 1. Task Dispatch (`rhizo send`, `rhizo enqueue`).
53
+ 2. Worker Message / Gate Report receipt.
54
+ 3. Implementation Plan updates (`implementation_plan.md` checkboxes).
55
+ 4. Watchdog Wakeup turn (if tasks are still in flight).
56
+ - **Stand Down Invariant**:
57
+ When all tasks in `implementation_plan.md` are complete (`- [x]` 100%), kill any running watchdog timer and do not reschedule.
58
+ - **Zero-Token Happy Path**:
59
+ Because `TimerCondition="any"` is set, any arriving worker message or background task completion automatically cancels the timer early before it expires. The timer only fires if the orchestrator was silent and deaf for a full 15 minutes.
60
+ - **The Short Check (When Timer Fires)**:
61
+ Run `rhizo watchdog check --agent <name> --json`.
62
+ * If `ACTION_REQUIRED: REARM_LISTENER`: start `rhizo listen <name>` in background and debounce timer.
63
+ * If `ACTION_REQUIRED: UNREAD_MESSAGES`: drain messages with `rhizo drain 10 <name>`, start listener, and debounce.
64
+ * If `OK: LISTENING`: listener is healthy; debounce timer and return to sleep.
65
+ * If `STAND_DOWN: IDLE`: no tasks in flight; stand down.
66
+ </CRITICAL>
67
+
20
68
  ---
21
69
 
22
70
  ## 2. The Runtime Governance Loop
@@ -59,15 +107,57 @@ Depending on the task distribution model in `implementation_plan.md`:
59
107
  --body '{"task_id": "task-test-harness", "strand": "strand/task-test-harness"}'
60
108
  ```
61
109
 
62
- ### SOP 2: Monitoring Swarm Health & Heartbeats
63
- Check active workers and ensure no listener has stalled or timed out:
110
+ - **Mandatory Turn-End Listener Arming**:
111
+ Immediately after executing `rhizo send` or `rhizo enqueue`, arm your single-shot background listener before completing your turn:
112
+ ```bash
113
+ run_command(CommandLine="rhizo listen orchestrator", IsDaemon=false, WaitMsBeforeAsync=500)
114
+ ```
115
+ *(Never end your turn without this active background task; without it, worker gate reports cannot wake you up).*
116
+
117
+ ### SOP 2: Monitoring Swarm Health, Watchdog & Escalation (GVR-011)
118
+ Check active workers and cluster status:
64
119
  ```bash
65
120
  rhizo who --json
66
121
  ```
67
122
 
68
- If a worker is waiting for a lease or has held a lock too long, inspect its active tmux pane:
123
+ #### Orchestrator Self-Audit Watchdog
124
+ Verify that the orchestrator itself is actively listening while tasks are in-flight:
125
+ ```bash
126
+ rhizo watchdog check [--agent <orchestrator>] [--json]
127
+ ```
128
+ Returns:
129
+ - `status: OK (LISTENING)`: Listener process active and healthy.
130
+ - `status: ACTION_REQUIRED (REARM_LISTENER)`: In-flight tasks exist but listener is dead/missing. Re-arm immediately.
131
+ - `status: ACTION_REQUIRED (UNREAD_MESSAGES)`: Unconsumed inbox messages waiting. Drain immediately.
132
+ - `status: STAND_DOWN (IDLE)`: Zero in-flight tasks and zero unread messages. Stand down.
133
+
134
+ #### Responsiveness Watchdog & Health Probing
135
+ When waiting for a worker to finish an assigned task, run a health probe if no message is received within the expected window (e.g. 5–10 minutes):
136
+ ```bash
137
+ rhizo probe <worker> --json
138
+ ```
139
+ The probe returns:
140
+ - `inbox_depth`: Number of unconsumed messages (if > 0, the worker hasn't picked up the task).
141
+ - `listener`: Whether the listener process PID is active (`LISTENING (pid: N)`) or dead (`NO_LISTENER`).
142
+ - `heartbeat`: Last seen age in seconds and heartbeat TTL.
143
+
144
+ #### Operator Escalation Protocol
145
+ If `rhizo probe` indicates a stalled or dead worker (`NO_LISTENER` or `STALE` with unread inbox messages):
146
+ 1. **Never Hang Silently**: The Supreme Orchestrator must immediately surface an escalation to the operator via `ask_question`.
147
+ 2. **Present Diagnostic**:
148
+ - Alert: `⚠️ SWARM STALL DETECTED: @<worker> has not responded to <subject>`
149
+ - Diagnostic: `Inbox: N unread | Listener: NO_LISTENER | Status: STALE`
150
+ 3. **Select Remediation Action**:
151
+ - Option 1 (Re-arm): Execute `rhizo listen <worker>` in the worker's assigned terminal pane.
152
+ - Option 2 (Reboot): Restart the worker harness process in that pane.
153
+ - Option 3 (Reassign): Re-route the task atomically to another active worker:
154
+ ```bash
155
+ rhizo reroute <stalled_worker> <new_worker> --all
156
+ ```
157
+
158
+ If a worker is waiting for a lease or has held a lock too long, probe its listener and inbox status:
69
159
  ```bash
70
- tmux capture-pane -p -t garden-<project>:1 | tail -n 25
160
+ rhizo probe <worker>
71
161
  ```
72
162
 
73
163
  ### SOP 3: Verifying Two-Key Gate & Weaving
@@ -117,12 +207,6 @@ When all checkboxes in `implementation_plan.md` are marked `- [x]`:
117
207
  1. Run final repository-wide test suite and linter on the canonical trunk.
118
208
  2. Gracefully deregister all swarm agents:
119
209
  ```bash
120
- for worker in $(python3 -c "import json; [print(w['name']) for w in json.load(open('garden-swarm.json'))['workers']]"); do
121
- rhizo close "$worker" 2>/dev/null || true
122
- done
123
- ```
124
- 3. Kill the tmux session:
125
- ```bash
126
- tmux kill-session -t garden-<project> 2>/dev/null || true
210
+ garden teardown
127
211
  ```
128
- 4. Output the final executive summary to the human operator.
212
+ 3. Output the final executive summary to the human operator.