@axiomantic/garden 0.2.9 → 0.2.11
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 +21 -22
- package/SKILL.md +32 -26
- package/bin/binaries/garden-darwin-arm64 +0 -0
- package/bin/binaries/garden-darwin-x64 +0 -0
- package/bin/binaries/garden-linux-arm64 +0 -0
- package/bin/binaries/garden-linux-x64 +0 -0
- package/bin/binaries/garden-win32-x64.exe +0 -0
- package/package.json +5 -2
- package/skills/choose-personas/SKILL.md +60 -34
- package/skills/garden/SKILL.md +32 -26
- package/skills/launch-workers/SKILL.md +9 -9
- package/scripts/launch_tmux_swarm.sh +0 -233
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)
|
|
8
|
-
[](https://github.com/axiomantic/rhizo)
|
|
9
|
+
[](https://github.com/axiomantic/vine)
|
|
10
10
|
[](README.md)
|
|
11
11
|
[](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
|
|
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
|
|
|
@@ -148,8 +148,6 @@ garden guide install
|
|
|
148
148
|
```bash
|
|
149
149
|
brew install redis && brew services start redis
|
|
150
150
|
```
|
|
151
|
-
4. **`tmux`** (Optional):
|
|
152
|
-
Only required if explicitly running legacy headless panes via `garden launch --tmux`.
|
|
153
151
|
|
|
154
152
|
---
|
|
155
153
|
|
|
@@ -162,22 +160,24 @@ In your primary AI coding assistant (Antigravity, Claude Code, OpenCode):
|
|
|
162
160
|
User: "garden: Implement high-throughput batch claim leases with Redis pipeline support"
|
|
163
161
|
```
|
|
164
162
|
|
|
165
|
-
### 2.
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
163
|
+
### 2. Project Intake & Calibration (Phase 0)
|
|
164
|
+
|
|
165
|
+
Garden utilizes the **Active Swarm Fast-Path (First-Look Invariant)**:
|
|
166
|
+
- **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!
|
|
167
|
+
- **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**:
|
|
168
|
+
1. **Execution Mode & Swarm Shape in <Detected Harness>**: Multi-Agent Swarm (Balanced Triad or Focused Duo in the detected harness) vs Single-Agent Inline.
|
|
169
|
+
|
|
170
|
+
> [!IMPORTANT]
|
|
171
|
+
> **Universal Sovereign Sessions & Model Inheritance**:
|
|
172
|
+
> - **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**.
|
|
173
|
+
> - **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
174
|
|
|
175
175
|
### 3. Prompt-Based Swarm Bootstrapping (`launch-workers`)
|
|
176
176
|
Garden writes `garden-swarm.json` and runs `garden prompts` to emit raw markdown prompt cards wrapped in **10 backticks** (` ``````````markdown `):
|
|
177
|
-
- The Orchestrator
|
|
178
|
-
1. Open **Tab 1**: Launch
|
|
179
|
-
2. Open **Tab 2**: Launch
|
|
180
|
-
3. Open **Tab 3**: Launch
|
|
177
|
+
- The Orchestrator presents ready-to-paste prompt cards to the operator:
|
|
178
|
+
1. Open **Tab 1 / Window 1**: Launch your preferred harness session $\to$ Paste Prompt 1 (`@auditor`)
|
|
179
|
+
2. Open **Tab 2 / Window 2**: Launch your preferred harness session $\to$ Paste Prompt 2 (`@architect`)
|
|
180
|
+
3. Open **Tab 3 / Window 3**: Launch your preferred harness session $\to$ Paste Prompt 3 (`@implementer`)
|
|
181
181
|
- 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
182
|
- The Orchestrator confirms all workers are live via `rhizo who --json` before dispatching tasks!
|
|
183
183
|
|
|
@@ -203,10 +203,10 @@ The main chat orchestrator dispatches work over Redis. Workers code in isolated
|
|
|
203
203
|
| Command | Arguments | Description |
|
|
204
204
|
| :--- | :--- | :--- |
|
|
205
205
|
| `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] [--
|
|
207
|
-
| `garden status` | `[--json]
|
|
206
|
+
| `garden launch` | `[--worker <name>] [--write [file]] [--json] [--project-dir <dir>] [--swarm-file <file>]` | Bootstrap swarm worker sessions (defaults to generating prompt cards). |
|
|
207
|
+
| `garden status` | `[--json]` | Telemetry query across active Rhizo agents, listener status, and Vine strands. |
|
|
208
208
|
| `garden init` | `[<target_dir>] [--force]` | Initialize `garden.toml`, docs scaffold, and install guide in `AGENTS.md`. |
|
|
209
|
-
| `garden teardown`| `[--
|
|
209
|
+
| `garden teardown`| `[--swarm-file <file>]` | Gracefully close registered swarm agents on the Redis bus. |
|
|
210
210
|
| `garden guide` | `<install\|check\|uninstall> [path]` | Install or manage Garden Multi-Agent Swarm Guide in `AGENTS.md`. |
|
|
211
211
|
|
|
212
212
|
---
|
|
@@ -223,7 +223,6 @@ The main chat orchestrator dispatches work over Redis. Workers code in isolated
|
|
|
223
223
|
| `GARDEN_SWARM_FILE` | Path | `garden-swarm.json` | Explicit path to swarm manifest JSON file. |
|
|
224
224
|
| `GARDEN_CONFIG` | Path | `garden.toml` | Explicit path to project `garden.toml`. |
|
|
225
225
|
| `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
226
|
|
|
228
227
|
### Example `garden-swarm.json`
|
|
229
228
|
|
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** |
|
|
56
|
-
| **Phase 1** | [`choose-personas`](../choose-personas/SKILL.md) | Synthesize and write `garden-swarm.json` reflecting
|
|
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
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
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
|
|
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,
|
|
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
|
|
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.
|
|
3
|
+
"version": "0.2.11",
|
|
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.
|
|
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
|
|
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.*
|
|
@@ -37,22 +37,32 @@ graph TD
|
|
|
37
37
|
|
|
38
38
|
---
|
|
39
39
|
|
|
40
|
-
## 2. Harness & Model
|
|
40
|
+
## 2. Harness & Model Alignment
|
|
41
41
|
|
|
42
|
-
|
|
42
|
+
Every recommended worker represents an INDEPENDENT, DEDICATED CODING SESSION (separate terminal tab or dedicated IDE window) bootstrapped via Garden 10-backtick prompt cards.
|
|
43
|
+
|
|
44
|
+
Workers inherit whatever foundation model is native or configured in that session:
|
|
45
|
+
- In **Antigravity IDE**: Workers run on Antigravity's active session models (Gemini).
|
|
46
|
+
- In **Claude Code CLI**: Workers run on Claude CLI's active models (Claude 3.7 Sonnet).
|
|
47
|
+
- In **OpenCode Desktop**: Workers run on models configured in `opencode.json`.
|
|
48
|
+
- In **Headless Terminal / Pi**: Workers run on provider CLI configuration.
|
|
43
49
|
|
|
44
50
|
<CRITICAL>
|
|
45
51
|
Sovereign Dedicated Sessions Only (Universal Subagent Prohibition):
|
|
46
|
-
|
|
47
|
-
|
|
52
|
+
Swarm workers are ALWAYS sovereign, independent interactive sessions (separate terminal tabs or dedicated IDE windows) bootstrapped via Garden 10-backtick prompt cards. Harness-internal subagents (e.g. Antigravity's `invoke_subagent`, Claude Code's `Task`, OpenCode subtasks, Cursor sub-composers) are STRICTLY FORBIDDEN from acting as swarm workers. NEVER pair a persona with internal subagents.
|
|
53
|
+
</CRITICAL>
|
|
54
|
+
|
|
55
|
+
<CRITICAL>
|
|
56
|
+
Session Default Models (No Cross-Harness Model Quizzes):
|
|
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)"`.
|
|
48
58
|
</CRITICAL>
|
|
49
59
|
|
|
50
|
-
| Role Mandate | Recommended Harness |
|
|
60
|
+
| Role Mandate | Recommended Harness | Model Alignment | Rationale |
|
|
51
61
|
| :--- | :--- | :--- | :--- |
|
|
52
|
-
| **Architectural Design & Systems Modeling** | **Antigravity (Dedicated Window)** or **OpenCode (Dedicated Session)** |
|
|
53
|
-
| **Adversarial Audit & Code Quality Purism** | **Claude Code CLI (Dedicated Tab)**
|
|
54
|
-
| **DevEx, Rapid Prototyping & Implementation** | **Antigravity (Dedicated Window)**
|
|
55
|
-
| **Hermetic / Local Security Analysis** | **Headless Terminal Worker (Dedicated Tab)** |
|
|
62
|
+
| **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. |
|
|
63
|
+
| **Adversarial Audit & Code Quality Purism** | **Claude Code CLI (Dedicated Tab)** or **Antigravity (Dedicated Window)** | Session Default (Native in tab/window) | Uncompromising adherence to instructions, meticulous attention to negative controls, zero tolerance for superficial green tests. |
|
|
64
|
+
| **DevEx, Rapid Prototyping & Implementation** | **Antigravity (Dedicated Window)** or **OpenCode (Dedicated Session)** | Session Default (Native in window) | Native reactive tool execution (`run_command`), rapid file modification, direct terminal feedback. |
|
|
65
|
+
| **Hermetic / Local Security Analysis** | **Headless Terminal Worker (Dedicated Tab)** | Ollama / Local DeepSeek-R1 | Air-gapped execution for proprietary credentials, licensing checks, or sensitive security audits. |
|
|
56
66
|
|
|
57
67
|
---
|
|
58
68
|
|
|
@@ -62,17 +72,27 @@ Harness-internal subagents (e.g. Antigravity's `invoke_subagent`, Claude Code's
|
|
|
62
72
|
sequenceDiagram
|
|
63
73
|
autonumber
|
|
64
74
|
participant Orch as Orchestrator Chat
|
|
75
|
+
participant Redis as Rhizo Cluster
|
|
65
76
|
participant Repo as Codebase Context
|
|
66
77
|
participant User as Human Operator
|
|
67
78
|
|
|
68
|
-
Orch->>
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
79
|
+
Orch->>Redis: rhizo who --json (Pre-Flight Check)
|
|
80
|
+
alt Active Workers Found
|
|
81
|
+
Redis-->>Orch: Active workers online
|
|
82
|
+
Note over Orch: Bypasses intake; reuses active cluster workers
|
|
83
|
+
else Zero Workers Online
|
|
84
|
+
Orch->>Repo: Inspects project language, repo structure & open issues
|
|
85
|
+
Note over Orch: Formulates primary triad + harness pairing
|
|
86
|
+
Orch->>User: Renders unified ask_question modal (Team shape + Harness)
|
|
87
|
+
User-->>Orch: Submits chosen triad
|
|
88
|
+
Orch->>Repo: Writes garden-swarm.json manifest
|
|
89
|
+
end
|
|
73
90
|
```
|
|
74
91
|
|
|
75
|
-
### Step
|
|
92
|
+
### Step 0: Pre-Flight Cluster Check
|
|
93
|
+
Run `rhizo who --json` and inspect `garden-swarm.json`. If active, healthy workers already exist in the cluster, skip persona selection and reuse the existing workers.
|
|
94
|
+
|
|
95
|
+
### Step 1: Codebase & Task Analysis (Cold Starts Only)
|
|
76
96
|
1. Inspect repository stack (e.g., Nim, Rust, Python, TypeScript, C).
|
|
77
97
|
2. Read project `AGENTS.md` and `README.md` to identify existing conventions.
|
|
78
98
|
3. Determine task scope:
|
|
@@ -80,24 +100,30 @@ sequenceDiagram
|
|
|
80
100
|
- *Greenfield Subsystem*: Prioritize Systems Architect + API Designer.
|
|
81
101
|
- *Security / Compliance*: Prioritize ISO Compliance Auditor + Security Adversary.
|
|
82
102
|
|
|
83
|
-
### Step 2: Formulate Recommendation
|
|
84
|
-
|
|
103
|
+
### Step 2: Formulate Recommendation in Detected Harness
|
|
104
|
+
Auto-detect the orchestrator's active harness from environment variables:
|
|
105
|
+
- `ANTIGRAVITY_APP_DIR` $\to$ "Antigravity IDE"
|
|
106
|
+
- `CLAUDE_CODE` $\to$ "Claude Code CLI"
|
|
107
|
+
- `OPENCODE_SESSION_ID` $\to$ "OpenCode"
|
|
108
|
+
- `CODEX_SESSION_ID` $\to$ "ChatGPT Desktop / Codex"
|
|
109
|
+
- `PI_SESSION_ID` $\to$ "Pi"
|
|
110
|
+
- Default fallback $\to$ "Antigravity / Claude Code"
|
|
111
|
+
|
|
112
|
+
Synthesize the primary triad targeting the detected harness with session-default models:
|
|
85
113
|
- **Primary Triad**:
|
|
86
|
-
- Persona 1:
|
|
87
|
-
- Persona 2:
|
|
88
|
-
- Persona 3:
|
|
89
|
-
- **Alternative Candidates**:
|
|
90
|
-
- Alternate A: e.g. Performance Benchmarking Engineer.
|
|
91
|
-
- Alternate B: e.g. Documentation & Developer Education Lead.
|
|
114
|
+
- Persona 1: Marcus Vance, Staff Systems Architect (Invariants, boundaries, structure)
|
|
115
|
+
- Persona 2: Caleb Thorne, Verification & Adversarial Auditor (Negative controls, purism)
|
|
116
|
+
- Persona 3: Elena Rostova, DevEx & Implementation Lead (Velocity, ergonomics)
|
|
92
117
|
|
|
93
118
|
### Step 3: Interactive Operator Ratification (`ask_question`)
|
|
94
|
-
Invoke `ask_question` with
|
|
95
|
-
- Option 1 (Recommended):
|
|
96
|
-
- Option 2:
|
|
97
|
-
- Option 3:
|
|
119
|
+
Invoke `ask_question` with a SINGLE concise question combining execution mode and swarm shape in the detected harness:
|
|
120
|
+
- Option 1 (Recommended): Multi-Agent Swarm: Balanced Triad in <Detected Harness> (Architect, Auditor, Implementer with session-native models)
|
|
121
|
+
- Option 2: Multi-Agent Swarm: Focused Duo in <Detected Harness> (Implementation Lead + Adversarial Auditor)
|
|
122
|
+
- Option 3: Single-Agent Inline (Execute sequentially within current chat session)
|
|
123
|
+
- Option 4: Custom configuration (allows user write-in).
|
|
98
124
|
|
|
99
125
|
### Step 4: Generate Swarm Manifest (`garden-swarm.json`)
|
|
100
|
-
Once ratified, write `garden-swarm.json` to the target project directory:
|
|
126
|
+
Once ratified, write `garden-swarm.json` to the target project directory with worker harnesses set to the detected harness:
|
|
101
127
|
|
|
102
128
|
```json
|
|
103
129
|
{
|
|
@@ -110,8 +136,8 @@ Once ratified, write `garden-swarm.json` to the target project directory:
|
|
|
110
136
|
"name": "my-project-architect",
|
|
111
137
|
"persona": "Marcus Vance",
|
|
112
138
|
"role": "Staff Systems Architect",
|
|
113
|
-
"harness": "Antigravity
|
|
114
|
-
"model": "
|
|
139
|
+
"harness": "Antigravity IDE",
|
|
140
|
+
"model": "Session Default (active in window/tab)",
|
|
115
141
|
"tags": ["my-project", "systems", "architecture", "invariants"],
|
|
116
142
|
"system_prompt": "You are Marcus Vance, Staff Systems Architect for project my-project...",
|
|
117
143
|
"opposing_priority": "Structural purity, invariant guarantees, and long-term maintainability over hasty quick fixes."
|
|
@@ -121,7 +147,7 @@ Once ratified, write `garden-swarm.json` to the target project directory:
|
|
|
121
147
|
"persona": "Caleb Thorne",
|
|
122
148
|
"role": "Verification & Adversarial Auditor",
|
|
123
149
|
"harness": "Claude Code CLI / Antigravity",
|
|
124
|
-
"model": "
|
|
150
|
+
"model": "Session Default (active in window/tab)",
|
|
125
151
|
"tags": ["my-project", "qa", "audit", "verifier", "purist"],
|
|
126
152
|
"system_prompt": "You are Caleb Thorne, Verification & Adversarial Auditor for project my-project...",
|
|
127
153
|
"opposing_priority": "Adversarial skepticism, rigorous negative controls, and proof over convenience."
|
|
@@ -131,7 +157,7 @@ Once ratified, write `garden-swarm.json` to the target project directory:
|
|
|
131
157
|
"persona": "Elena Rostova",
|
|
132
158
|
"role": "DevEx & Implementation Lead",
|
|
133
159
|
"harness": "Antigravity / OpenCode",
|
|
134
|
-
"model": "
|
|
160
|
+
"model": "Session Default (active in window/tab)",
|
|
135
161
|
"tags": ["my-project", "dev", "devex", "build", "implementation"],
|
|
136
162
|
"system_prompt": "You are Elena Rostova, DevEx & Implementation Lead for project my-project...",
|
|
137
163
|
"opposing_priority": "High-velocity implementation, pragmatic delivery, and developer ergonomics."
|
package/skills/garden/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** |
|
|
56
|
-
| **Phase 1** | [`choose-personas`](../choose-personas/SKILL.md) | Synthesize and write `garden-swarm.json` reflecting
|
|
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
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
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
|
|
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,
|
|
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
|
|
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
|
```
|
|
@@ -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
|
-
-
|
|
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:
|
|
@@ -94,11 +94,11 @@ The Orchestrator presents the generated prompt blocks to the operator with clear
|
|
|
94
94
|
|
|
95
95
|
1. **Numbered Terminal Tab / Session Instructions**:
|
|
96
96
|
Provide a concise setup list instructing the operator on how many sessions to open and which harness/model to configure for each:
|
|
97
|
-
- **Session 1 (@<project>-architect)**: e.g. Antigravity
|
|
98
|
-
- **Session 2 (@<project>-auditor)**: e.g. Claude Code CLI
|
|
99
|
-
- **Session 3 (@<project>-implementer)**: e.g. Antigravity
|
|
97
|
+
- **Session 1 (@<project>-architect)**: e.g. Antigravity IDE (Window 1) or Claude Code CLI (Tab 1) $\to$ Paste Card 1
|
|
98
|
+
- **Session 2 (@<project>-auditor)**: e.g. Claude Code CLI (Tab 2) or Antigravity IDE (Window 2) $\to$ Paste Card 2
|
|
99
|
+
- **Session 3 (@<project>-implementer)**: e.g. Antigravity IDE (Window 3) or OpenCode $\to$ Paste Card 3
|
|
100
100
|
2. **Harness & Model Agnostic Flexibility**:
|
|
101
|
-
Explicitly reassure the operator: *"Workers can run in ANY coding harness (Claude Code, OpenCode,
|
|
101
|
+
Explicitly reassure the operator: *"Workers can run in ANY coding harness (Antigravity, Claude Code, OpenCode, Pi, Cursor) and inherit the active model configured in that window/session. Coordination occurs strictly over Rhizo (local Redis) and Vine (Rift strands)."*
|
|
102
102
|
3. **10-Backtick Raw Markdown Formatting**:
|
|
103
103
|
Ensure every prompt card is displayed inside ` ``````````markdown ` fences so the operator can copy the clean, unrendered text with a single click.
|
|
104
104
|
4. **Immediate Autonomous Onboarding**:
|
|
@@ -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
|
|
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
|
|
|
@@ -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
|