@axiomantic/garden 0.2.10 → 0.2.12

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,8 +5,8 @@
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
- [![Rhizo](https://img.shields.io/badge/Rhizo-0.2.11%2B-red.svg)](https://github.com/axiomantic/rhizo)
9
- [![Vine](https://img.shields.io/badge/Vine-0.2.3%2B-purple.svg)](https://github.com/axiomantic/vine)
8
+ [![Rhizo](https://img.shields.io/badge/Rhizo-0.2.13%2B-red.svg)](https://github.com/axiomantic/rhizo)
9
+ [![Vine](https://img.shields.io/badge/Vine-0.2.4%2B-purple.svg)](https://github.com/axiomantic/vine)
10
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
 
@@ -27,7 +27,7 @@
27
27
  > ```text
28
28
  > "garden: I want to build [feature/system/project]"
29
29
  > ```
30
- > The session automatically acts as the **Lead Orchestrator**. It conducts a brief interactive intake interview to calibrate your desired team balance, coding harnesses, and model tiers. It then configures your project (`garden.toml` & `garden-swarm.json`) and prints ready-to-copy prompt cards wrapped in **10 backticks** (` ``````````markdown `). You paste these cards into separate terminal tabs or coding harnesses, and Garden coordinates the entire swarm over Rhizo (local Redis message bus) and Vine (isolated Rift copy-on-write workspaces)!
30
+ > The session automatically acts as the **Lead Orchestrator**. It auto-detects your coding harness and conducts a single-question intake interview to calibrate your desired team shape and session-default models. It then configures your project (`garden.toml` & `garden-swarm.json`) and prints ready-to-copy prompt cards wrapped in **10 backticks** (` ``````````markdown `). You paste these cards into separate terminal tabs or coding harnesses, and Garden coordinates the entire swarm over Rhizo (local Redis message bus) and Vine (isolated Rift copy-on-write workspaces)!
31
31
 
32
32
  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 Rift copy-on-write strands verified by Vine's Two-Key Gate.
33
33
 
@@ -76,6 +76,22 @@ Garden is organized into a clean, batteries-included catalog of self-explanatory
76
76
  | **[`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. |
77
77
  | **[`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`. |
78
78
 
79
+ ---
80
+
81
+ ## Documentation for Humans & AI Agents
82
+
83
+ Garden provides comprehensive ceremony, manifest, and protocol specifications:
84
+
85
+ ### Ceremonies & Methodology
86
+ * **[Ceremony Lifecycle Specification](docs/ceremony_lifecycle.md)**: The 6 sequential ceremony phases, quality gates, and sovereign session bootstrapping.
87
+ * **[Swarm Manifest Schema](docs/swarm_manifest_schema.md)**: JSON/TOML specification for `garden-swarm.json` and `garden.toml`.
88
+ * **[Dialectical Pump Protocol](docs/dialectical_pump_protocol.md)**: Grounded multi-perspective debate, Stage 1-3 deliverables, and the Emergent Design Addendum Protocol.
89
+ * **[CLI Reference Manual](docs/cli_reference.md)**: Complete catalog of Garden commands (`init`, `prompts`, `launch`, `status`, `teardown`).
90
+ * **[Configuration Architecture](docs/configuration.md)**: Project-level configuration, strand options, and test runner configurations.
91
+ * **[Agent Constitution & Invariants (AGENTS.md)](AGENTS.md)**: Coordination invariants, sovereign session rules, and listener discipline.
92
+
93
+ ---
94
+
79
95
  ## Standalone Yet Designed for the Axiomantic Triad
80
96
 
81
97
  Garden is completely standalone and can direct multi-agent dialectics, persona selection, and prompt-bootstrapped worker swarms on any codebase.
@@ -148,8 +164,6 @@ garden guide install
148
164
  ```bash
149
165
  brew install redis && brew services start redis
150
166
  ```
151
- 4. **`tmux`** (Optional):
152
- Only required if explicitly running legacy headless panes via `garden launch --tmux`.
153
167
 
154
168
  ---
155
169
 
@@ -162,22 +176,24 @@ In your primary AI coding assistant (Antigravity, Claude Code, OpenCode):
162
176
  User: "garden: Implement high-throughput batch claim leases with Redis pipeline support"
163
177
  ```
164
178
 
165
- ### 2. Interactive Project Intake Interview (Phase 0)
166
- The Orchestrator asks 4 quick interactive questions via `ask_question`:
167
- 1. **Execution Mode**: Multi-Agent Swarm (Recommended) vs Single Session.
168
- 2. **Team Sizing**: Standard Triad (3 Workers) vs Focused Duo (2 Workers) vs Custom.
169
- 3. **Available Harnesses**: Claude Code CLI, OpenCode, Antigravity, Pi, Cursor, Terminal.
170
- 4. **Model Preferences & Equivalents**:
171
- - Systems Architect (`@architect`) $\to$ **Antigravity** or **OpenCode** | **Gemini 3.8 Flash** or **Claude 3.5 Sonnet**
172
- - Adversarial Auditor (`@auditor`) $\to$ **Claude Code CLI** | **Claude 3.5 Sonnet** or **Claude 3 Opus**
173
- - DevEx & Implementation Lead (`@implementer`) $\to$ **Antigravity** or **OpenCode** | **Gemini 3.8 Flash**
179
+ ### 2. Project Intake & Calibration (Phase 0)
180
+
181
+ Garden utilizes the **Active Swarm Fast-Path (First-Look Invariant)**:
182
+ - **Existing Cluster Online**: Before asking intake questions, Garden runs `rhizo who --json`. If active, healthy workers already exist on the cluster, Garden skips all setup questions and prompt cards, automatically attaching to the active workers to proceed straight to task planning or execution!
183
+ - **Cold Start (Zero Active Workers)**: If no workers are online, the Orchestrator auto-detects the active coding harness (`ANTIGRAVITY_APP_DIR`, `CLAUDE_CODE`, `OPENCODE_SESSION_ID`, `CODEX_SESSION_ID`, `PI_SESSION_ID`) and conducts a **single-question intake interview**:
184
+ 1. **Execution Mode & Swarm Shape in <Detected Harness>**: Multi-Agent Swarm (Balanced Triad or Focused Duo in the detected harness) vs Single-Agent Inline.
185
+
186
+ > [!IMPORTANT]
187
+ > **Universal Sovereign Sessions & Model Inheritance**:
188
+ > - **Sovereign Sessions Only (Universal Subagent & Tmux Prohibition)**: Swarm workers are strictly independent sessions (separate terminal tabs or IDE windows) bootstrapped via 10-backtick prompt cards. Harness-internal subagents (e.g. Antigravity's `invoke_subagent`, Claude Code's `Task`, OpenCode subtasks) and terminal multiplexers (`tmux`) are **strictly prohibited**.
189
+ > - **Session-Native Model Inheritance**: Swarm workers inherit whatever foundation model is active in that harness window (`Session Default (active in window/tab)`). Disconnected model pairing quizzes are eliminated.
174
190
 
175
191
  ### 3. Prompt-Based Swarm Bootstrapping (`launch-workers`)
176
192
  Garden writes `garden-swarm.json` and runs `garden prompts` to emit raw markdown prompt cards wrapped in **10 backticks** (` ``````````markdown `):
177
- - The Orchestrator tells the operator:
178
- 1. Open **Tab 1**: Launch `claude` (Claude 3.5 Sonnet) $\to$ Paste Prompt 1 (`@auditor`)
179
- 2. Open **Tab 2**: Launch `opencode` $\to$ Paste Prompt 2 (`@architect`)
180
- 3. Open **Tab 3**: Launch `antigravity` (Gemini 3.8 Flash) $\to$ Paste Prompt 3 (`@implementer`)
193
+ - The Orchestrator presents ready-to-paste prompt cards to the operator:
194
+ 1. Open **Tab 1 / Window 1**: Launch your preferred harness session $\to$ Paste Prompt 1 (`@auditor`)
195
+ 2. Open **Tab 2 / Window 2**: Launch your preferred harness session $\to$ Paste Prompt 2 (`@architect`)
196
+ 3. Open **Tab 3 / Window 3**: Launch your preferred harness session $\to$ Paste Prompt 3 (`@implementer`)
181
197
  - Each session enters the project directory, exports `RHIZO_AGENT_NAME`, registers on the Redis bus (`rhizo open`), and arms its single-shot listener (`rhizo listen`).
182
198
  - The Orchestrator confirms all workers are live via `rhizo who --json` before dispatching tasks!
183
199
 
@@ -203,10 +219,10 @@ The main chat orchestrator dispatches work over Redis. Workers code in isolated
203
219
  | Command | Arguments | Description |
204
220
  | :--- | :--- | :--- |
205
221
  | `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. |
206
- | `garden launch` | `[--worker <name>] [--write [file]] [--json] [--tmux] [--session-name <name>]` | Bootstrap swarm worker sessions (defaults to generating prompt cards). |
207
- | `garden status` | `[--json] [--session-name <name>]` | Telemetry query across active Rhizo agents, listener status, and Vine strands. |
222
+ | `garden launch` | `[--worker <name>] [--write [file]] [--json] [--project-dir <dir>] [--swarm-file <file>]` | Bootstrap swarm worker sessions (defaults to generating prompt cards). |
223
+ | `garden status` | `[--json]` | Telemetry query across active Rhizo agents, listener status, and Vine strands. |
208
224
  | `garden init` | `[<target_dir>] [--force]` | Initialize `garden.toml`, docs scaffold, and install guide in `AGENTS.md`. |
209
- | `garden teardown`| `[--session-name <name>] [--swarm-file <file>]` | Gracefully close registered swarm agents on the Redis bus. |
225
+ | `garden teardown`| `[--swarm-file <file>]` | Gracefully close registered swarm agents on the Redis bus. |
210
226
  | `garden guide` | `<install\|check\|uninstall> [path]` | Install or manage Garden Multi-Agent Swarm Guide in `AGENTS.md`. |
211
227
 
212
228
  ---
@@ -223,7 +239,6 @@ The main chat orchestrator dispatches work over Redis. Workers code in isolated
223
239
  | `GARDEN_SWARM_FILE` | Path | `garden-swarm.json` | Explicit path to swarm manifest JSON file. |
224
240
  | `GARDEN_CONFIG` | Path | `garden.toml` | Explicit path to project `garden.toml`. |
225
241
  | `GARDEN_PROJECT_DIR`| Path | *Auto-detected* | Target repository root directory. |
226
- | `GARDEN_TERMINAL_APP`| String | `auto` | Preferred terminal viewer for tmux sessions (`Ghostty`, `Terminal`, `iTerm`, `none`). |
227
242
 
228
243
  ### Example `garden-swarm.json`
229
244
 
@@ -235,7 +250,7 @@ The main chat orchestrator dispatches work over Redis. Workers code in isolated
235
250
  "workers": [
236
251
  {
237
252
  "name": "architect",
238
- "persona": "Dr. Marcus Vance (Systems Architect)",
253
+ "persona": "Bramblestitch (Systems Architect)",
239
254
  "role": "Systems Architect & Formal Invariant Specifier",
240
255
  "harness": "Claude Code",
241
256
  "model": "claude-3-5-sonnet",
@@ -244,7 +259,7 @@ The main chat orchestrator dispatches work over Redis. Workers code in isolated
244
259
  },
245
260
  {
246
261
  "name": "auditor",
247
- "persona": "Lyra Sterling (Adversarial Quality Auditor)",
262
+ "persona": "Prickle-Thistle (Adversarial Quality Auditor)",
248
263
  "role": "Adversarial Code Reviewer & Security Auditor",
249
264
  "harness": "OpenCode",
250
265
  "model": "gemini-3.8-flash",
@@ -253,7 +268,7 @@ The main chat orchestrator dispatches work over Redis. Workers code in isolated
253
268
  },
254
269
  {
255
270
  "name": "implementer",
256
- "persona": "Elena Rostova (Lead Implementation Engineer)",
271
+ "persona": "Moss-Weaver (Lead Implementation Engineer)",
257
272
  "role": "Polyglot Systems & Performance Engineer",
258
273
  "harness": "Antigravity",
259
274
  "model": "claude-3-5-sonnet",
package/SKILL.md CHANGED
@@ -52,8 +52,8 @@ Execute phases sequentially. Never skip phases or invert the order.
52
52
 
53
53
  | Phase | Sub-Skill / Step | Action | Quality Gate to Proceed |
54
54
  | :--- | :--- | :--- | :--- |
55
- | **Phase 0** | **Intake Gate** | Conduct interactive interview via `ask_question`: execution mode, swarm size, harnesses, and models. | Operator submits preferences. |
56
- | **Phase 1** | [`choose-personas`](../choose-personas/SKILL.md) | Synthesize and write `garden-swarm.json` reflecting the interview. | Valid JSON written to repo root. |
55
+ | **Phase 0** | **Intake Gate** | Fast-path check (`rhizo who --json`) or single-question intake via `ask_question` calibrated to detected harness. | Active cluster workers confirmed or operator submits choice. |
56
+ | **Phase 1** | [`choose-personas`](../choose-personas/SKILL.md) | Synthesize and write `garden-swarm.json` reflecting detected harness and chosen shape. | Valid JSON written to repo root. |
57
57
  | **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. |
58
58
  | **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`. |
59
59
  | **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. |
@@ -63,36 +63,42 @@ Execute phases sequentially. Never skip phases or invert the order.
63
63
 
64
64
  ### Phase 0: Interactive Project Intake & Swarm Calibration
65
65
 
66
- When an operator initiates a project or requests multi-agent coordination, the session MUST NOT silently guess configuration or begin writing code directly. It immediately invokes `ask_question` to conduct the **Interactive Intake Interview**:
67
-
68
- 1. **Question 1: Execution Mode**:
69
- - *Option 1 (Recommended)*: Multi-Agent Swarm (Dedicated terminal tabs/coding harnesses over Rhizo & Vine).
70
- - *Option 2*: Single-Agent Inline (Sequential execution within current chat session).
71
- 2. **Question 2: Swarm Composition & Team Sizing**:
72
- - *Option 1 (Recommended)*: Balanced Triad (3 Workers: Systems Architect `@<project>-architect`, Adversarial Auditor `@<project>-auditor`, DevEx Lead `@<project>-implementer`).
73
- - *Option 2*: Focused Duo (2 Workers: Implementation Lead `@<project>-implementer`, Adversarial Auditor `@<project>-auditor`).
74
- - *Option 3*: Custom Swarm (Operator specifies custom roles and headcount).
75
- 3. **Question 3: Available AI Coding Harnesses**:
76
- - The operator specifies which coding environments they will open dedicated tabs/windows for (Claude Code CLI, OpenCode, Antigravity, Pi, Cursor, Headless Terminal).
77
- <CRITICAL>
78
- Sovereign Sessions Only (Universal Subagent Prohibition):
79
- Swarm workers are ALWAYS sovereign, independent interactive sessions (dedicated terminal tabs, CLI windows, or IDE sessions) bootstrapped via copy-paste prompt cards. Harness-internal subagents (e.g. Antigravity's `invoke_subagent`, Claude Code's `Task`, OpenCode subtasks, Cursor sub-composers) are STRICTLY PROHIBITED as swarm workers across all harnesses. Internal subagents are ephemeral, cannot maintain continuous background listeners, and cause severe context poisoning. NEVER offer or present "subagents" as an option in Question 3 or any other intake question.
80
- </CRITICAL>
81
- 4. **Question 4: Foundation Model Pairing & Equivalencies**:
82
- - Recommend optimal models with fallback equivalents:
83
- - `@<project>-architect`: Gemini 3.8 Flash / Claude 3.5 Sonnet / GPT-4o (deep architecture comprehension).
84
- - `@<project>-auditor`: Claude 3.5 Sonnet / Claude 3 Opus (strict negative controls, zero sloppy approvals).
85
- - `@<project>-implementer`: Gemini 3.8 Flash / Claude 3.5 Sonnet (rapid, iterative coding velocity).
86
- - *Air-gapped / Local*: Ollama / DeepSeek-R1.
66
+ #### Fast-Path: Re-using an Active / Existing Swarm (First-Look Invariant)
67
+ Before asking ANY intake questions or presenting configuration modals, the orchestrator MUST run `rhizo who --json` to inspect the cluster.
68
+ If active, healthy workers are ALREADY registered and listening on the Rhizo cluster:
69
+ - **DO NOT** ask intake interview questions or prompt the operator for new sessions or models.
70
+ - **DO NOT** display swarm composition or harness questions.
71
+ - Automatically attach to the existing online workers (`@worker-1`, `@worker-2`, ...).
72
+ - Confirm cluster readiness and proceed immediately to Phase 3 (Dialectical Pump / Task Breakdown) or Phase 5 (Task Dispatch).
73
+
74
+ #### Cold-Start Intake Protocol (Zero Active Workers Only)
75
+ When an operator initiates a fresh project or requests multi-agent coordination and NO active cluster workers exist, the session MUST NOT silently guess configuration.
76
+ Because the coding harness is auto-detected from the session environment (`ANTIGRAVITY_APP_DIR` $\to$ Antigravity IDE, `CLAUDE_CODE` $\to$ Claude Code CLI, `OPENCODE_SESSION_ID` $\to$ OpenCode, `CODEX_SESSION_ID` $\to$ ChatGPT Desktop / Codex, `PI_SESSION_ID` $\to$ Pi), the orchestrator invokes `ask_question` to conduct a streamlined **Single-Question Intake Interview**:
77
+
78
+ 1. **Single Question: Execution Mode & Swarm Shape in <Detected Harness>**:
79
+ - *Option 1 (Recommended)*: Multi-Agent Swarm: Balanced Triad in <Detected Harness> (Systems Architect `@<project>-architect`, Adversarial Auditor `@<project>-auditor`, DevEx Lead `@<project>-implementer`).
80
+ - *Option 2*: Multi-Agent Swarm: Focused Duo in <Detected Harness> (Implementation Lead `@<project>-implementer`, Adversarial Auditor `@<project>-auditor`).
81
+ - *Option 3*: Single-Agent Inline (Execute sequentially within current chat session).
82
+ - *Option 4*: Custom Swarm (Operator specifies custom roles or cross-harness distribution).
83
+
84
+ <CRITICAL>
85
+ Sovereign Dedicated Sessions Only (Universal Subagent & Tmux Prohibition):
86
+ Swarm workers are ALWAYS sovereign, independent interactive sessions (dedicated terminal tabs or IDE windows) bootstrapped via copy-paste prompt cards wrapped in 10 backticks. Harness-internal subagents (e.g. Antigravity's `invoke_subagent`, Claude Code's `Task`, OpenCode subtasks, Cursor sub-composers) are STRICTLY PROHIBITED as swarm workers across all harnesses. Internal subagents are ephemeral, cannot maintain continuous background listeners, and cause severe context poisoning. Terminal multiplexers (tmux) are unsupported. NEVER offer or present "subagents" or "tmux" as options during intake.
87
+ </CRITICAL>
88
+
89
+ <CRITICAL>
90
+ Session Default Models (Standalone Model Quizzes Prohibited):
91
+ Swarm workers operate in sovereign interactive sessions and inherit whatever foundation model is active in that harness session (e.g., Gemini in Antigravity, Claude in Claude Code, configured workspace models in OpenCode). NEVER present a separate question asking the operator to choose "Foundation Model Pairings". In `garden-swarm.json` and prompt cards, model configuration defaults to `"Session Default (active in window/tab)"`.
92
+ </CRITICAL>
87
93
 
88
94
  #### Automatic Fulfillment & 10-Backtick Prompt Generation:
89
- Upon receiving the operator's responses:
95
+ Upon receiving the operator's response:
90
96
  1. Run `garden init` if `garden.toml` or `AGENTS.md` is not yet initialized.
91
- 2. Generate `garden-swarm.json` reflecting the chosen workers, roles, harnesses, and models.
97
+ 2. Generate `garden-swarm.json` reflecting the chosen workers, roles, detected harness, and session-default models.
92
98
  3. Run `garden prompts` to generate the raw markdown prompt cards wrapped in **10 backticks** (` ``````````markdown `).
93
99
  4. Present the operator with clear, numbered instructions:
94
100
  ```text
95
- 1. Open X terminal tabs or windows in your selected coding harnesses.
101
+ 1. Open X terminal tabs or windows in your detected coding harness.
96
102
  2. Copy the raw block inside each 10-backtick pre block below and paste it into its corresponding session.
97
103
  3. Once pasted, tell me here (or I will automatically detect them online via `rhizo who`).
98
104
  ```
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.10",
3
+ "version": "0.2.12",
4
4
  "description": "Multi-Agent Swarm Orchestration, Empirical Dialectics & Ceremonies on top of Rhizo & Vine",
5
5
  "main": "bin/run.js",
6
6
  "bin": {
@@ -23,11 +23,14 @@
23
23
  "type": "git",
24
24
  "url": "git+https://github.com/axiomantic/garden.git"
25
25
  },
26
+ "scripts": {
27
+ "test": "nim c -r tests/test_garden.nim",
28
+ "build": "nim c -d:release --threads:on --mm:orc -o:bin/garden src/garden.nim"
29
+ },
26
30
  "keywords": [
27
31
  "multi-agent",
28
32
  "ai-agents",
29
33
  "orchestration",
30
- "tmux",
31
34
  "dialectics",
32
35
  "rhizo",
33
36
  "vine",
@@ -1,9 +1,9 @@
1
1
  ---
2
2
  name: choose-personas
3
- description: "Selects, balances, and configures specialized agent personas for a Garden swarm task. Analyzes codebase context, domain complexity, and task requirements to formulate a triad of complementary personas with opposing priorities. For every persona, explicitly recommends the optimal coding harness (e.g. OpenCode Desktop, Claude Code CLI, Antigravity, OpenAI Codex) and foundation model (e.g. Gemini 3.8 Flash, Claude 3.5 Sonnet, Claude 3 Opus, GPT-4o, local models) aligned with operator preferences. Solicits operator confirmation or edits with candidate alternatives via interactive questions, and outputs garden-swarm.json. Triggers: 'choose personas', 'select personas', 'set up agent team', 'assemble personas for this task', 'recommend agents'."
3
+ description: "Selects, balances, and configures specialized agent personas for a Garden swarm task. Analyzes codebase context, domain complexity, and task requirements to formulate a triad of complementary personas with opposing priorities. Auto-detects the active coding harness and aligns worker harnesses and session-default models with operator preferences via a single intake question. Outputs garden-swarm.json. Triggers: 'choose personas', 'select personas', 'set up agent team', 'assemble personas for this task', 'recommend agents'."
4
4
  ---
5
5
 
6
- # `choose-personas`: Dynamic Swarm Persona Selection & Harness/Model Pairing
6
+ # `choose-personas`: Dynamic Swarm Persona Selection & Auto-Detected Harness Intake
7
7
 
8
8
  > **Calibrate the Minds Before Booting the Hands**
9
9
  > *A multi-agent swarm is only as effective as the diversity, specialization, and cognitive balance of its personas. This skill pairs domain roles with their optimal coding harnesses and foundation models.*
@@ -25,13 +25,13 @@ graph TD
25
25
  C <-->|Coherence Tension| A
26
26
  ```
27
27
 
28
- 1. **The Systems Architect** (e.g., Marcus Vance):
28
+ 1. **The Systems Architect** (e.g., Bramblestitch / Cogswell Pendulum):
29
29
  - **Focus**: Global system topology, invariants, lifecycle management, failure modes, cross-component boundaries.
30
30
  - **Bias**: Prefers structural purity and comprehensive conceptual models.
31
- 2. **The Purist Auditor / Refactoring Specialist** (e.g., Caleb Thorne / Dr. Vance):
31
+ 2. **The Purist Auditor / Refactoring Specialist** (e.g., Prickle-Thistle / Grumblewick Snark):
32
32
  - **Focus**: Single-source of truth (SSOT), ISO standards compliance, dead-code elimination, zero green mirages, edge-case failure proofs.
33
33
  - **Bias**: Adversarial skeptic. Assumes claims are unproven until verified by an automated test or compiler run.
34
- 3. **The DevEx & Implementation Lead** (e.g., Elena Rostova):
34
+ 3. **The DevEx & Implementation Lead** (e.g., Moss-Weaver / Sprocket-Hop):
35
35
  - **Focus**: Developer experience, API ergonomics, ease of adoption, idiomatic conventions, pragmatic delivery.
36
36
  - **Bias**: Champions the human engineer using the tool; eliminates cognitive overhead and unnecessary friction.
37
37
 
@@ -57,6 +57,16 @@ Session Default Models (No Cross-Harness Model Quizzes):
57
57
  Swarm workers operate in sovereign interactive sessions and inherit whatever foundation model is active in that harness session. NEVER present a separate question asking the operator to choose "Foundation Model Pairings", and NEVER present model options that do not correspond to the chosen harness. In `garden-swarm.json` and prompt cards, models default to `"Session Default (active in window/tab)"`.
58
58
  </CRITICAL>
59
59
 
60
+ <CRITICAL>
61
+ Whimsical Personas & Anti-Anchoring Invariant (GVR-017):
62
+ 1. Strict Negative Constraints: Faux-human corporate or academic persona names (e.g. "Marcus Vance", "Elena Rostova", "Caleb Thorne", "Lyra Sterling", "Dr. Jane Doe") are STRICTLY FORBIDDEN. Personas MUST be whimsical, fantastical, mechanical, or botanical entities that could not possibly be confused with real human beings.
63
+ 2. Anti-Anchoring Protocol: When generating or recommending swarm personas, YOU MUST NOT COPY OR REUSE ANY EXAMPLE NAMES FROM THIS SKILL VERBATIM. Do not name agents "Bramblestitch", "Prickle-Thistle", "Cogswell", or "Moss-Weaver". Instead, dynamically INVENT fresh, topical, whimsical names tailored specifically to the target project's character and domain:
64
+ - Botanical / Biological: Briar-Weaver, Sprout-Surge, Root-Tender, Bark-Scraper, Mycelium-Mender
65
+ - Clockwork / Artificer: Gear-Whisperer, Escapement-Caliber, Ratcheteer, Piston-Spark, Clocksmith-Spindle
66
+ - Mythical / Cryptid: Astral-Gryphon, Iron-Basilisk, Forge-Salamander, Chimera-Mason, Gargoyle-Gaze
67
+ - Celestial / Nautical: Nebula-Drifter, Solar-Flare, Coral-Carver, Deep-Current, Tide-Warden
68
+ </CRITICAL>
69
+
60
70
  | Role Mandate | Recommended Harness | Model Alignment | Rationale |
61
71
  | :--- | :--- | :--- | :--- |
62
72
  | **Architectural Design & Systems Modeling** | **Antigravity (Dedicated Window)** or **OpenCode (Dedicated Session)** | Session Default (Native in window) | Fast token throughput, deep reasoning, superior multi-file architectural comprehension, and native background ear support. |
@@ -100,23 +110,30 @@ Run `rhizo who --json` and inspect `garden-swarm.json`. If active, healthy worke
100
110
  - *Greenfield Subsystem*: Prioritize Systems Architect + API Designer.
101
111
  - *Security / Compliance*: Prioritize ISO Compliance Auditor + Security Adversary.
102
112
 
103
- ### Step 2: Formulate Unified Recommendation & Alternatives
104
- Synthesize the primary triad paired with target harness environments:
113
+ ### Step 2: Formulate Recommendation in Detected Harness
114
+ Auto-detect the orchestrator's active harness from environment variables:
115
+ - `ANTIGRAVITY_APP_DIR` $\to$ "Antigravity IDE"
116
+ - `CLAUDE_CODE` $\to$ "Claude Code CLI"
117
+ - `OPENCODE_SESSION_ID` $\to$ "OpenCode"
118
+ - `CODEX_SESSION_ID` $\to$ "ChatGPT Desktop / Codex"
119
+ - `PI_SESSION_ID` $\to$ "Pi"
120
+ - Default fallback $\to$ "Antigravity / Claude Code"
121
+
122
+ Synthesize the primary triad targeting the detected harness with session-default models:
105
123
  - **Primary Triad**:
106
- - Persona 1: Marcus Vance, Staff Systems Architect (Invariants, boundaries, structure)
107
- - Persona 2: Caleb Thorne, Verification & Adversarial Auditor (Negative controls, purism)
108
- - Persona 3: Elena Rostova, DevEx & Implementation Lead (Velocity, ergonomics)
124
+ - Persona 1: Bramblestitch (or invented spirit/automaton), Staff Systems Architect (Invariants, boundaries, structure)
125
+ - Persona 2: Prickle-Thistle (or invented spirit/automaton), Verification & Adversarial Auditor (Negative controls, purism)
126
+ - Persona 3: Moss-Weaver (or invented spirit/automaton), DevEx & Implementation Lead (Velocity, ergonomics)
109
127
 
110
128
  ### Step 3: Interactive Operator Ratification (`ask_question`)
111
- Invoke `ask_question` with unified, selectable options combining team shape and harness:
112
- - Option 1 (Recommended): Balanced Triad in Antigravity IDE (3 dedicated workspace windows, session-native models)
113
- - Option 2: Balanced Triad in Claude Code CLI (3 dedicated terminal tabs)
114
- - Option 3: Balanced Triad in OpenCode (3 dedicated sessions)
115
- - Option 4: Focused Duo (Implementation Lead + Adversarial Auditor in preferred harness)
116
- - Option 5: Custom configuration (allows user write-in).
129
+ Invoke `ask_question` with a SINGLE concise question combining execution mode and swarm shape in the detected harness:
130
+ - Option 1 (Recommended): Multi-Agent Swarm: Balanced Triad in <Detected Harness> (Architect, Auditor, Implementer with session-native models)
131
+ - Option 2: Multi-Agent Swarm: Focused Duo in <Detected Harness> (Implementation Lead + Adversarial Auditor)
132
+ - Option 3: Single-Agent Inline (Execute sequentially within current chat session)
133
+ - Option 4: Custom configuration (allows user write-in).
117
134
 
118
135
  ### Step 4: Generate Swarm Manifest (`garden-swarm.json`)
119
- Once ratified, write `garden-swarm.json` to the target project directory:
136
+ Once ratified, write `garden-swarm.json` to the target project directory with worker harnesses set to the detected harness:
120
137
 
121
138
  ```json
122
139
  {
@@ -127,32 +144,32 @@ Once ratified, write `garden-swarm.json` to the target project directory:
127
144
  "workers": [
128
145
  {
129
146
  "name": "my-project-architect",
130
- "persona": "Marcus Vance",
147
+ "persona": "Bramblestitch",
131
148
  "role": "Staff Systems Architect",
132
- "harness": "Antigravity / Claude Code",
149
+ "harness": "Antigravity IDE",
133
150
  "model": "Session Default (active in window/tab)",
134
151
  "tags": ["my-project", "systems", "architecture", "invariants"],
135
- "system_prompt": "You are Marcus Vance, Staff Systems Architect for project my-project...",
152
+ "system_prompt": "You are Bramblestitch, Staff Systems Architect for project my-project...",
136
153
  "opposing_priority": "Structural purity, invariant guarantees, and long-term maintainability over hasty quick fixes."
137
154
  },
138
155
  {
139
156
  "name": "my-project-auditor",
140
- "persona": "Caleb Thorne",
157
+ "persona": "Prickle-Thistle",
141
158
  "role": "Verification & Adversarial Auditor",
142
159
  "harness": "Claude Code CLI / Antigravity",
143
160
  "model": "Session Default (active in window/tab)",
144
161
  "tags": ["my-project", "qa", "audit", "verifier", "purist"],
145
- "system_prompt": "You are Caleb Thorne, Verification & Adversarial Auditor for project my-project...",
162
+ "system_prompt": "You are Prickle-Thistle, Verification & Adversarial Auditor for project my-project...",
146
163
  "opposing_priority": "Adversarial skepticism, rigorous negative controls, and proof over convenience."
147
164
  },
148
165
  {
149
166
  "name": "my-project-implementer",
150
- "persona": "Elena Rostova",
167
+ "persona": "Moss-Weaver",
151
168
  "role": "DevEx & Implementation Lead",
152
169
  "harness": "Antigravity / OpenCode",
153
170
  "model": "Session Default (active in window/tab)",
154
171
  "tags": ["my-project", "dev", "devex", "build", "implementation"],
155
- "system_prompt": "You are Elena Rostova, DevEx & Implementation Lead for project my-project...",
172
+ "system_prompt": "You are Moss-Weaver, DevEx & Implementation Lead for project my-project...",
156
173
  "opposing_priority": "High-velocity implementation, pragmatic delivery, and developer ergonomics."
157
174
  }
158
175
  ]
@@ -52,8 +52,8 @@ Execute phases sequentially. Never skip phases or invert the order.
52
52
 
53
53
  | Phase | Sub-Skill / Step | Action | Quality Gate to Proceed |
54
54
  | :--- | :--- | :--- | :--- |
55
- | **Phase 0** | **Intake Gate** | Conduct interactive interview via `ask_question`: execution mode, swarm size, harnesses, and models. | Operator submits preferences. |
56
- | **Phase 1** | [`choose-personas`](../choose-personas/SKILL.md) | Synthesize and write `garden-swarm.json` reflecting the interview. | Valid JSON written to repo root. |
55
+ | **Phase 0** | **Intake Gate** | Fast-path check (`rhizo who --json`) or single-question intake via `ask_question` calibrated to detected harness. | Active cluster workers confirmed or operator submits choice. |
56
+ | **Phase 1** | [`choose-personas`](../choose-personas/SKILL.md) | Synthesize and write `garden-swarm.json` reflecting detected harness and chosen shape. | Valid JSON written to repo root. |
57
57
  | **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. |
58
58
  | **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`. |
59
59
  | **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. |
@@ -72,38 +72,33 @@ If active, healthy workers are ALREADY registered and listening on the Rhizo clu
72
72
  - Confirm cluster readiness and proceed immediately to Phase 3 (Dialectical Pump / Task Breakdown) or Phase 5 (Task Dispatch).
73
73
 
74
74
  #### Cold-Start Intake Protocol (Zero Active Workers Only)
75
- When an operator initiates a fresh project or requests multi-agent coordination and NO active cluster workers exist, the session MUST NOT silently guess configuration. It invokes `ask_question` to conduct a streamlined **Interactive Intake Interview** of at most TWO questions:
75
+ When an operator initiates a fresh project or requests multi-agent coordination and NO active cluster workers exist, the session MUST NOT silently guess configuration.
76
+ Because the coding harness is auto-detected from the session environment (`ANTIGRAVITY_APP_DIR` $\to$ Antigravity IDE, `CLAUDE_CODE` $\to$ Claude Code CLI, `OPENCODE_SESSION_ID` $\to$ OpenCode, `CODEX_SESSION_ID` $\to$ ChatGPT Desktop / Codex, `PI_SESSION_ID` $\to$ Pi), the orchestrator invokes `ask_question` to conduct a streamlined **Single-Question Intake Interview**:
76
77
 
77
- 1. **Question 1: Execution Mode**:
78
- - *Option 1 (Recommended)*: Multi-Agent Swarm (Dedicated terminal tabs/coding harnesses over Rhizo & Vine).
79
- - *Option 2*: Single-Agent Inline (Sequential execution within current chat session).
80
-
81
- 2. **Question 2: Swarm Composition & Harness Environment (Unified)**:
82
- Pair team composition directly with the target coding harness in a single decision point:
83
- - *Option 1 (Recommended)*: Balanced Triad in Antigravity IDE (3 dedicated workspace windows, session-native models).
84
- - *Option 2*: Balanced Triad in Claude Code CLI (3 dedicated terminal tabs, Claude models).
85
- - *Option 3*: Balanced Triad in OpenCode (3 dedicated sessions, configured workspace models).
86
- - *Option 4*: Focused Duo (2 Workers: Implementation Lead & Adversarial Auditor in preferred harness).
87
- - *Option 5*: Custom / Mixed Harnesses (Operator specifies custom distribution).
78
+ 1. **Single Question: Execution Mode & Swarm Shape in <Detected Harness>**:
79
+ - *Option 1 (Recommended)*: Multi-Agent Swarm: Balanced Triad in <Detected Harness> (Systems Architect `@<project>-architect`, Adversarial Auditor `@<project>-auditor`, DevEx Lead `@<project>-implementer`).
80
+ - *Option 2*: Multi-Agent Swarm: Focused Duo in <Detected Harness> (Implementation Lead `@<project>-implementer`, Adversarial Auditor `@<project>-auditor`).
81
+ - *Option 3*: Single-Agent Inline (Execute sequentially within current chat session).
82
+ - *Option 4*: Custom Swarm (Operator specifies custom roles or cross-harness distribution).
88
83
 
89
84
  <CRITICAL>
90
- Sovereign Sessions Only (Universal Subagent Prohibition):
91
- Swarm workers are ALWAYS sovereign, independent interactive sessions (dedicated terminal tabs, CLI windows, or IDE sessions) bootstrapped via copy-paste prompt cards. Harness-internal subagents (e.g. Antigravity's `invoke_subagent`, Claude Code's `Task`, OpenCode subtasks, Cursor sub-composers) are STRICTLY PROHIBITED as swarm workers across all harnesses. Internal subagents are ephemeral, cannot maintain continuous background listeners, and cause severe context poisoning. NEVER offer or present "subagents" as an option in Question 2 or any other intake question.
85
+ Sovereign Dedicated Sessions Only (Universal Subagent & Tmux Prohibition):
86
+ Swarm workers are ALWAYS sovereign, independent interactive sessions (dedicated terminal tabs or IDE windows) bootstrapped via copy-paste prompt cards wrapped in 10 backticks. Harness-internal subagents (e.g. Antigravity's `invoke_subagent`, Claude Code's `Task`, OpenCode subtasks, Cursor sub-composers) are STRICTLY PROHIBITED as swarm workers across all harnesses. Internal subagents are ephemeral, cannot maintain continuous background listeners, and cause severe context poisoning. Terminal multiplexers (tmux) are unsupported. NEVER offer or present "subagents" or "tmux" as options during intake.
92
87
  </CRITICAL>
93
88
 
94
89
  <CRITICAL>
95
- Standalone Foundation Model Pairing Quiz Prohibited:
96
- Swarm workers operate in sovereign interactive sessions and inherit whatever foundation model is active in that harness session (e.g., Gemini in Antigravity, Claude in Claude Code, provider settings in OpenCode). NEVER present a separate question asking the operator to choose "Foundation Model Pairings", and NEVER present model options (Claude, GPT, Gemini) that do not correspond to the chosen harness. In `garden-swarm.json` and prompt cards, model configuration defaults to `"Session Default (active in window/tab)"`.
90
+ Session Default Models (Standalone Model Quizzes Prohibited):
91
+ Swarm workers operate in sovereign interactive sessions and inherit whatever foundation model is active in that harness session (e.g., Gemini in Antigravity, Claude in Claude Code, configured workspace models in OpenCode). NEVER present a separate question asking the operator to choose "Foundation Model Pairings". In `garden-swarm.json` and prompt cards, model configuration defaults to `"Session Default (active in window/tab)"`.
97
92
  </CRITICAL>
98
93
 
99
94
  #### Automatic Fulfillment & 10-Backtick Prompt Generation:
100
- Upon receiving the operator's responses:
95
+ Upon receiving the operator's response:
101
96
  1. Run `garden init` if `garden.toml` or `AGENTS.md` is not yet initialized.
102
- 2. Generate `garden-swarm.json` reflecting the chosen workers, roles, harnesses, and models.
97
+ 2. Generate `garden-swarm.json` reflecting the chosen workers, roles, detected harness, and session-default models.
103
98
  3. Run `garden prompts` to generate the raw markdown prompt cards wrapped in **10 backticks** (` ``````````markdown `).
104
99
  4. Present the operator with clear, numbered instructions:
105
100
  ```text
106
- 1. Open X terminal tabs or windows in your selected coding harnesses.
101
+ 1. Open X terminal tabs or windows in your detected coding harness.
107
102
  2. Copy the raw block inside each 10-backtick pre block below and paste it into its corresponding session.
108
103
  3. Once pasted, tell me here (or I will automatically detect them online via `rhizo who`).
109
104
  ```
@@ -12,9 +12,9 @@ description: "Generates and formats X distinct copy-pasteable bootstrap prompts
12
12
 
13
13
  ## 1. System Philosophy & Invariants
14
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).
15
+ 1. **Human-in-the-Loop Sovereign Session Autonomy**:
16
+ - Terminal multiplexers (tmux) are unsupported. We do not blindly spawn tmux background processes or attempt to drive terminal multiplexers with fragile subshell scripting.
17
+ - Workers run in sovereign, independent interactive sessions (dedicated terminal tabs or IDE windows) in the operator's active coding harness.
18
18
  2. **Raw Markdown 10-Backtick Fencing**:
19
19
  <CRITICAL>
20
20
  When outputting prompt cards in stdout, artifacts, or chat, every prompt block MUST be wrapped in exactly 10 backticks:
@@ -84,10 +84,10 @@ garden prompts --write garden-prompts.md
84
84
  garden prompts --worker <project>-architect # (or suffix shorthand: --worker architect)
85
85
  ```
86
86
 
87
- 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:
88
- - `@<project>-architect` (Marcus Vance - Staff Systems Architect)
89
- - `@<project>-auditor` (Caleb Thorne - Verification & Adversarial Auditor)
90
- - `@<project>-implementer` (Elena Rostova - DevEx & Implementation Lead)
87
+ 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 with procedurally generated whimsical entities (e.g. botanical spirits, clockwork automatons, mythical cryptids):
88
+ - `@<project>-architect` (e.g. Bramblestitch / Cogswell Pendulum - Staff Systems Architect)
89
+ - `@<project>-auditor` (e.g. Prickle-Thistle / Grumblewick Snark - Verification & Adversarial Auditor)
90
+ - `@<project>-implementer` (e.g. Moss-Weaver / Sprocket-Hop - DevEx & Implementation Lead)
91
91
 
92
92
  ### Step 2: Present & Paste Prompts into Sessions
93
93
  The Orchestrator presents the generated prompt blocks to the operator with clear, structured guidance:
@@ -111,10 +111,10 @@ The Orchestrator presents the generated prompt blocks to the operator with clear
111
111
  5. **Scheduled Health Check Template (ONLY for OpenAI Codex / ChatGPT CLI)**:
112
112
  In Google Antigravity (using background `run_command`) and OpenCode (using background ear), DO NOT configure scheduled tasks; reactive background process completion handles wakeups natively.
113
113
  In Codex Desktop / CLI where sessions cannot wake from background process exits without external stimulation, prompts include the bulletproof 4-step template:
114
- - STEP 1: Inspect completed subagents/tasks for unhandled delivered tasks and execute them immediately (never stay quiet with pending work).
114
+ - STEP 1: Inspect completed background listener processes / hooks for unhandled delivered tasks and execute them immediately (never stay quiet with pending work).
115
115
  - STEP 2: Inspect active tasks to verify a listener is currently running, and re-arm if missing.
116
116
  - STEP 3: Run `rhizo probe <name> --json` and drain any inbox backlog.
117
- - STEP 4: Stay quiet ONLY when a listener is actively running AND no delivered tasks are pending.
117
+ - STEP 4: Stay quiet ONLY when a background listener process is actively running AND no delivered tasks are pending.
118
118
  6. **Readiness Prompt**:
119
119
  Instruct the operator: *"Once you have pasted these prompts and the sessions are listening, tell me here (or I will automatically detect them online via `rhizo who`), and we will proceed to Phase 3 (Dialectical Deliberation)."*
120
120
 
@@ -31,9 +31,9 @@ The generated implementation plan must follow this exact template:
31
31
  ## 1. Swarm Roster & Role Mapping
32
32
  | Worker Name | Persona | Role | Assigned Subsystems |
33
33
  | :--- | :--- | :--- | :--- |
34
- | `<project>-architect` | Marcus Vance | Staff Systems Architect | Core data structures, API contracts |
35
- | `<project>-auditor` | Caleb Thorne | Refactoring Purist | Unit tests, negative controls, linter |
36
- | `<project>-implementer` | Elena Rostova | DevEx & Implementation Lead | CLI commands, adapters, docs |
34
+ | `<project>-architect` | Bramblestitch (or topical spirit) | Staff Systems Architect | Core data structures, API contracts |
35
+ | `<project>-auditor` | Prickle-Thistle (or topical spirit) | Refactoring Purist | Unit tests, negative controls, linter |
36
+ | `<project>-implementer` | Moss-Weaver (or topical spirit) | DevEx & Implementation Lead | CLI commands, adapters, docs |
37
37
 
38
38
  ---
39
39
 
@@ -1,233 +0,0 @@
1
- #!/usr/bin/env bash
2
- # scripts/launch_tmux_swarm.sh
3
- # Provisions a dedicated tmux session for a Garden worker swarm, registers identities
4
- # on the Rhizo Redis bus, arms listeners, and opens a visible terminal viewer (Ghostty/Terminal.app).
5
-
6
- set -euo pipefail
7
-
8
- usage() {
9
- cat <<EOF
10
- Usage: $(basename "$0") [options]
11
-
12
- Options:
13
- --session-name <name> tmux session name (default: garden-<dirname>)
14
- --project-dir <path> Target project working directory (default: current directory)
15
- --swarm-file <path> Path to garden-swarm.json manifest
16
- --terminal-app <app> Terminal viewer app: Ghostty | Terminal | iTerm | none (default: auto)
17
- --force Kill existing tmux session if running
18
- --help Show this help message
19
- EOF
20
- exit 0
21
- }
22
-
23
- SESSION_NAME=""
24
- PROJECT_DIR="$(pwd)"
25
- SWARM_FILE=""
26
- TERMINAL_APP="auto"
27
- FORCE=0
28
-
29
- while [[ $# -gt 0 ]]; do
30
- case "$1" in
31
- --session-name)
32
- SESSION_NAME="$2"
33
- shift 2
34
- ;;
35
- --project-dir)
36
- PROJECT_DIR="$(cd "$2" && pwd)"
37
- shift 2
38
- ;;
39
- --swarm-file)
40
- SWARM_FILE="$2"
41
- shift 2
42
- ;;
43
- --terminal-app)
44
- TERMINAL_APP="$2"
45
- shift 2
46
- ;;
47
- --force)
48
- FORCE=1
49
- shift
50
- ;;
51
- --help|-h)
52
- usage
53
- ;;
54
- *)
55
- echo "Unknown option: $1" >&2
56
- usage
57
- ;;
58
- esac
59
- done
60
-
61
- # Prerequisite Checks
62
- if ! command -v tmux >/dev/null 2>&1; then
63
- echo "Error: tmux is required but not found in PATH." >&2
64
- echo "Install via Homebrew: brew install tmux" >&2
65
- exit 1
66
- fi
67
-
68
- if ! command -v rhizo >/dev/null 2>&1; then
69
- echo "Error: rhizo is required but not found in PATH." >&2
70
- echo "Install via npm: npm install -g @axiomantic/rhizo" >&2
71
- exit 1
72
- fi
73
-
74
- RHIZO_BIN="rhizo"
75
-
76
- if [[ -z "$SESSION_NAME" ]]; then
77
- PROJECT_BASE="$(basename "$PROJECT_DIR" | tr '[:upper:]' '[:lower:]' | tr -c 'a-z0-9_-' '_')"
78
- SESSION_NAME="garden-${PROJECT_BASE}"
79
- fi
80
-
81
- if tmux has-session -t "$SESSION_NAME" 2>/dev/null; then
82
- if [[ $FORCE -eq 1 ]]; then
83
- echo "[garden] Killing existing tmux session: $SESSION_NAME"
84
- tmux kill-session -t "$SESSION_NAME"
85
- else
86
- echo "Error: tmux session '$SESSION_NAME' already exists. Use --force to recreate." >&2
87
- exit 1
88
- fi
89
- fi
90
-
91
- # Parse swarm workers from JSON manifest or default trio
92
- declare -a WORKER_NAMES=()
93
- declare -a WORKER_TAGS=()
94
- declare -a WORKER_COMMANDS=()
95
-
96
- if [[ -z "$SWARM_FILE" && -f "$PROJECT_DIR/garden-swarm.json" ]]; then
97
- SWARM_FILE="$PROJECT_DIR/garden-swarm.json"
98
- fi
99
-
100
- if [[ -n "$SWARM_FILE" && -f "$SWARM_FILE" ]]; then
101
- if ! command -v jq >/dev/null 2>&1 && ! command -v python3 >/dev/null 2>&1; then
102
- echo "Error: python3 or jq is required to parse $SWARM_FILE" >&2
103
- exit 1
104
- fi
105
-
106
- # Parse JSON using python3 into tab-separated lines: name <tab> tags <tab> command
107
- PARSED_LINES=$(python3 -c "
108
- import json, sys
109
- with open('$SWARM_FILE', 'r') as f:
110
- data = json.load(f)
111
- workers = data.get('workers', [])
112
- for w in workers:
113
- name = w.get('name', 'worker')
114
- tags = ','.join(w.get('tags', []))
115
- cmd = w.get('startup_command', '')
116
- print(f'{name}\t{tags}\t{cmd}')
117
- ")
118
-
119
- while IFS=$'\t' read -r wname wtags wcmd; do
120
- [[ -z "$wname" ]] && continue
121
- WORKER_NAMES+=("$wname")
122
- WORKER_TAGS+=("$wtags")
123
- WORKER_COMMANDS+=("$wcmd")
124
- done <<< "$PARSED_LINES"
125
- fi
126
-
127
- # Fallback default trio if no manifest was provided
128
- if [[ ${#WORKER_NAMES[@]} -eq 0 ]]; then
129
- WORKER_NAMES=("architect" "auditor" "implementer")
130
- WORKER_TAGS=("systems,architecture" "qa,audit,review" "dev,devex,build")
131
- WORKER_COMMANDS=("" "" "")
132
- fi
133
-
134
- echo "[garden] Provisioning tmux session: $SESSION_NAME for project: $PROJECT_DIR"
135
-
136
- # 1. Create first worker window (index 0)
137
- FIRST_NAME="${WORKER_NAMES[0]}"
138
- FIRST_TAGS="${WORKER_TAGS[0]}"
139
- FIRST_CMD="${WORKER_COMMANDS[0]}"
140
-
141
- tmux new-session -d -s "$SESSION_NAME" -n "$FIRST_NAME" -c "$PROJECT_DIR"
142
- tmux send-keys -t "$SESSION_NAME:0" "cd $(printf %q "$PROJECT_DIR")" C-m
143
- tmux send-keys -t "$SESSION_NAME:0" "export RHIZO_AGENT_NAME=$(printf %q "$FIRST_NAME")" C-m
144
- tmux send-keys -t "$SESSION_NAME:0" "$RHIZO_BIN open $(printf %q "$FIRST_NAME") $(printf %q "$FIRST_TAGS")" C-m
145
-
146
- if [[ -n "$FIRST_CMD" ]]; then
147
- tmux send-keys -t "$SESSION_NAME:0" "$FIRST_CMD" C-m
148
- else
149
- tmux send-keys -t "$SESSION_NAME:0" "$RHIZO_BIN listen $(printf %q "$FIRST_NAME")" C-m
150
- fi
151
-
152
- # 2. Create subsequent worker windows
153
- for (( i=1; i<${#WORKER_NAMES[@]}; i++ )); do
154
- WNAME="${WORKER_NAMES[$i]}"
155
- WTAGS="${WORKER_TAGS[$i]}"
156
- WCMD="${WORKER_COMMANDS[$i]}"
157
-
158
- tmux new-window -t "$SESSION_NAME" -n "$WNAME" -c "$PROJECT_DIR"
159
- tmux send-keys -t "$SESSION_NAME:$i" "cd $(printf %q "$PROJECT_DIR")" C-m
160
- tmux send-keys -t "$SESSION_NAME:$i" "export RHIZO_AGENT_NAME=$(printf %q "$WNAME")" C-m
161
- tmux send-keys -t "$SESSION_NAME:$i" "$RHIZO_BIN open $(printf %q "$WNAME") $(printf %q "$WTAGS")" C-m
162
-
163
- if [[ -n "$WCMD" ]]; then
164
- tmux send-keys -t "$SESSION_NAME:$i" "$WCMD" C-m
165
- else
166
- tmux send-keys -t "$SESSION_NAME:$i" "$RHIZO_BIN listen $(printf %q "$WNAME")" C-m
167
- fi
168
- done
169
-
170
- # Select window 0 initially
171
- tmux select-window -t "$SESSION_NAME:0"
172
-
173
- echo "[garden] Spawned ${#WORKER_NAMES[@]} worker windows in tmux session '$SESSION_NAME'."
174
-
175
- # 3. Launch OS-level Terminal Viewer
176
- if [[ "$TERMINAL_APP" == "auto" ]]; then
177
- if [[ -d "/Applications/Ghostty.app" ]]; then
178
- TERMINAL_APP="Ghostty"
179
- elif [[ -d "/Applications/iTerm.app" ]]; then
180
- TERMINAL_APP="iTerm"
181
- elif [[ "$(uname -s)" == "Darwin" ]]; then
182
- TERMINAL_APP="Terminal"
183
- else
184
- TERMINAL_APP="none"
185
- fi
186
- fi
187
-
188
- if [[ "$TERMINAL_APP" != "none" && "$(uname -s)" == "Darwin" ]]; then
189
- echo "[garden] Launching viewer in $TERMINAL_APP..."
190
- case "$TERMINAL_APP" in
191
- Ghostty|ghostty)
192
- # Launch Ghostty with attach command
193
- open -a Ghostty --args -e tmux attach-session -t "$SESSION_NAME" || true
194
- ;;
195
- iTerm|iterm)
196
- osascript -e "
197
- tell application \"iTerm\"
198
- activate
199
- set newWindow to (create window with default profile)
200
- tell current session of newWindow
201
- write text \"tmux attach-session -t $SESSION_NAME\"
202
- end tell
203
- end tell
204
- " >/dev/null 2>&1 || true
205
- ;;
206
- Terminal|terminal)
207
- osascript -e "
208
- tell application \"Terminal\"
209
- activate
210
- do script \"tmux attach-session -t $SESSION_NAME\"
211
- end tell
212
- " >/dev/null 2>&1 || true
213
- ;;
214
- *)
215
- echo "[garden] Unknown terminal app '$TERMINAL_APP'; skipping auto-launch." >&2
216
- ;;
217
- esac
218
- fi
219
-
220
- # Output JSON summary for caller agents / orchestrator
221
- cat <<EOF
222
- {
223
- "status": "ready",
224
- "session_name": "$SESSION_NAME",
225
- "project_dir": "$PROJECT_DIR",
226
- "terminal_app": "$TERMINAL_APP",
227
- "workers": [
228
- $(for (( i=0; i<${#WORKER_NAMES[@]}; i++ )); do
229
- echo " {\"window\": $i, \"name\": \"${WORKER_NAMES[$i]}\", \"tags\": \"${WORKER_TAGS[$i]}\"}$(if [[ $i -lt $((${#WORKER_NAMES[@]} - 1)) ]]; then echo ","; fi)"
230
- done)
231
- ]
232
- }
233
- EOF