@axiomantic/garden 0.1.0

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.
@@ -0,0 +1,128 @@
1
+ ---
2
+ name: orchestrate-swarm
3
+ description: "Directs live multi-agent swarm execution from the primary chat session acting as Supreme Orchestrator. Dispatches tasks over the Rhizo Redis bus, monitors worker heartbeats with rhizo who, governs task leasing and dead-letter queues, ratifies emergent design addenda, verifies Two-Key Gate reports from workers, executes fast-forward trunk merges via vine weave, and dynamically maintains implementation plan checkboxes and harness To-Do tools. Triggers: 'orchestrate swarm', 'run implementation plan', 'execute swarm tasks', 'manage workers', 'drive plan'."
4
+ ---
5
+
6
+ # `orchestrate-swarm`: Main-Chat Swarm Governance & Trunk Integration
7
+
8
+ > **The Sovereign Conductor of Autonomous Execution**
9
+ > *The Supreme Orchestrator does not write the low-level code lines; it directs the symphony. It dispatches work over Redis, unblocks dependencies, enforces the Two-Key Gate, and weaves clean strands into the trunk.*
10
+
11
+ ---
12
+
13
+ ## 1. The Role of the Supreme Orchestrator
14
+
15
+ The main chat session assumes the role of **Supreme Orchestrator**:
16
+ - **Non-Interference**: Never perform massive multi-file edits directly when workers are active in isolated strands.
17
+ - **Strict Transport Discipline**: All task assignments, handoffs, and cancellation interrupts flow exclusively over the Rhizo Redis bus (`rhizo send`, `rhizo reply`, `rhizo enqueue`).
18
+ - **Gated Integration**: Never run `git merge` directly. Only weave branches that have passed both Key 1 (mechanical merge-tree) and Key 2 (live compiler/tests) inside their Vine strands.
19
+
20
+ ---
21
+
22
+ ## 2. The Runtime Governance Loop
23
+
24
+ ```mermaid
25
+ flowchart TD
26
+ Start([Start Task from Plan]) --> Dispatch["Dispatch Task via rhizo send / enqueue"]
27
+ Dispatch --> Wait["Wait for Worker rhizo reply (Two-Key Gate Report)"]
28
+ Wait --> Decision{Did Worker Pass Two-Key Gate?}
29
+ Decision -->|NO / Blocked| Remediate["Dispatch Fix Task to Auditor / Implementer"]
30
+ Remediate --> Wait
31
+ Decision -->|YES| Weave["Execute vine weave into Canonical Trunk"]
32
+ Weave --> Update["Update implementation_plan.md Checkbox & Harness To-Do"]
33
+ Update --> CheckAddenda{Emergent Design Addendum Filed?}
34
+ CheckAddenda -->|YES| Ratify["Review, Ratify, Update design.md & plan"]
35
+ CheckAddenda -->|NO| NextTask{More Tasks in Plan?}
36
+ Ratify --> NextTask
37
+ NextTask -->|YES| Start
38
+ NextTask -->|NO| Finish([Mission Accomplished / Teardown Swarm])
39
+ ```
40
+
41
+ ---
42
+
43
+ ## 3. Standard Operating Procedures
44
+
45
+ ### SOP 1: Dispatching Tasks to Workers
46
+ Depending on the task distribution model in `implementation_plan.md`:
47
+
48
+ - **Direct Assignment (O2O)**:
49
+ ```bash
50
+ rhizo send --to architect \
51
+ --subject "Task 1.1: Core Data Structures" \
52
+ --body '{"task_id": "task-core-ds", "instructions": "Implement AST node kinds and message serializers. Use vine strand.", "strand": "strand/task-core-ds"}'
53
+ ```
54
+
55
+ - **Competing-Consumers Work Queue**:
56
+ ```bash
57
+ rhizo enqueue queue:myproject:tasks \
58
+ --subject "Task 1.2: Test Harness" \
59
+ --body '{"task_id": "task-test-harness", "strand": "strand/task-test-harness"}'
60
+ ```
61
+
62
+ ### SOP 2: Monitoring Swarm Health & Heartbeats
63
+ Check active workers and ensure no listener has stalled or timed out:
64
+ ```bash
65
+ rhizo who --json
66
+ ```
67
+
68
+ If a worker is waiting for a lease or has held a lock too long, inspect its active tmux pane:
69
+ ```bash
70
+ tmux capture-pane -p -t garden-<project>:1 | tail -n 25
71
+ ```
72
+
73
+ ### SOP 3: Verifying Two-Key Gate & Weaving
74
+ When a worker replies indicating task completion:
75
+ ```json
76
+ {
77
+ "status": "gate_passed",
78
+ "task_id": "task-core-ds",
79
+ "branch": "strand/task-core-ds",
80
+ "strand_path": "/Users/eek/Development/workspaces/myproject/task-core-ds/myproject",
81
+ "key1_mechanical": "PASS",
82
+ "key2_semantic": "PASS"
83
+ }
84
+ ```
85
+
86
+ The Orchestrator verifies and integrates:
87
+ ```bash
88
+ # 1. Weave the verified strand into main
89
+ vine weave
90
+
91
+ # 2. Release any held fencing locks if applicable
92
+ rhizo unlock file:src/types.nim
93
+ ```
94
+
95
+ ### SOP 4: Updating Dynamic Progress Checklists
96
+ Immediately after weaving:
97
+ 1. Update `implementation_plan.md`:
98
+ - Change `- [ ] **Task 1.1: ...**` to `- [x] **Task 1.1: ...**`.
99
+ 2. Update the harness's native To-Do / Task tracking tool (e.g. marking the step completed).
100
+
101
+ ### SOP 5: Handling Emergent Design Addenda
102
+ If an incoming message contains `[DESIGN ADDENDUM]`:
103
+ 1. Read the drafted addendum: `view_file(AbsolutePath="docs/addenda/addendum_<topic>.md")`.
104
+ 2. Evaluate trade-offs (performance, API impact, scope).
105
+ 3. If approved:
106
+ - Append addendum section to `design.md`.
107
+ - Adjust downstream tasks in `implementation_plan.md`.
108
+ - Reply to worker: `rhizo reply --to <worker> --subject "Addendum Approved" --body "Proceed with modified design."`.
109
+ 4. If rejected:
110
+ - Reply with counter-guidance and instruct the worker to remain aligned with original specs.
111
+
112
+ ---
113
+
114
+ ## 4. Swarm Conclusion & Teardown
115
+
116
+ When all checkboxes in `implementation_plan.md` are marked `- [x]`:
117
+ 1. Run final repository-wide test suite and linter on the canonical trunk.
118
+ 2. Gracefully deregister all swarm agents:
119
+ ```bash
120
+ for worker in $(python3 -c "import json; [print(w['name']) for w in json.load(open('garden-swarm.json'))['workers']]"); do
121
+ rhizo close "$worker" 2>/dev/null || true
122
+ done
123
+ ```
124
+ 3. Kill the tmux session:
125
+ ```bash
126
+ tmux kill-session -t garden-<project> 2>/dev/null || true
127
+ ```
128
+ 4. Output the final executive summary to the human operator.
@@ -0,0 +1,129 @@
1
+ ---
2
+ name: plan-implementation
3
+ description: "Generates the ceremonial master implementation plan from a ratified design document. Maps exact task distributions across swarm personas, concurrency and distributed locking schedules using Rhizo monotonic fencing tokens, and workspace virtualization using Vine strands. Establishes dynamic progress tracking via markdown task checklists, synchronization with native coding harness To-Do tools, and the Emergent Design Addendum Protocol. Triggers: 'plan implementation', 'create implementation plan', 'schedule swarm work', 'build execution plan'."
4
+ ---
5
+
6
+ # `plan-implementation`: Ceremonial Implementation Planning & Locking Schedules
7
+
8
+ > **Bridging the Architectural Spec to Synchronized Swarm Execution**
9
+ > *A plan is not a wish list; it is a deterministic state machine. It dictates who works on what, what locks prevent collisions, which branches isolate code, and how progress is tracked in real time.*
10
+
11
+ ---
12
+
13
+ ## 1. Core Principles & Architecture
14
+
15
+ The Orchestrator authors `implementation_plan.md` adhering to four core invariants:
16
+
17
+ 1. **Deterministic Assignment**: Every subtask has exactly one primary persona owner.
18
+ 2. **Resource Fencing Before Mutation**: Any non-mergeable resource (e.g. database schemas, configuration files, migration scripts) must have an explicit `rhizo lock file:<path> --fencing` lease scheduled before modification begins.
19
+ 3. **Workspace Isolation via Vine**: Complex, multi-file changes must occur in isolated APFS CoW strands (`vine new <task_id> --worktree`). Strands cannot be woven until passing the Two-Key Gate (`vine gate`).
20
+ 4. **Zero Silent Architectural Drift**: If an implementer encounters an unforeseen constraint during coding, it cannot unilaterally alter the architecture. It must submit a formal design addendum.
21
+
22
+ ---
23
+
24
+ ## 2. Structure of `implementation_plan.md`
25
+
26
+ The generated implementation plan must follow this exact template:
27
+
28
+ ```markdown
29
+ # Implementation Plan: [Feature / Project Name]
30
+
31
+ ## 1. Swarm Roster & Role Mapping
32
+ | Worker Name | Persona | Role | Assigned Subsystems |
33
+ | :--- | :--- | :--- | :--- |
34
+ | `architect` | Marcus Vance | Staff Systems Architect | Core data structures, API contracts |
35
+ | `auditor` | Caleb Thorne | Refactoring Purist | Unit tests, negative controls, linter |
36
+ | `implementer` | Elena Rostova | DevEx & Implementation Lead | CLI commands, adapters, docs |
37
+
38
+ ---
39
+
40
+ ## 2. Distributed Locking & Concurrency Schedule
41
+ Before modifying any shared or non-mergeable file, the designated worker must obtain an atomic lease:
42
+ - **Lock Target**: `file:src/config.nim`
43
+ - *Owner*: `architect`
44
+ - *Command*: `rhizo lock file:src/config.nim 600 --fencing`
45
+ - *Monotonic Fencing Counter*: Record token in task execution log.
46
+ - **Lock Target**: `file:migrations/001_schema.sql`
47
+ - *Owner*: `implementer`
48
+ - *Command*: `rhizo lock file:migrations/001_schema.sql 300 --fencing`
49
+
50
+ ---
51
+
52
+ ## 3. Vine Strand Lifecycle & Verification Matrix
53
+ For all parallel development tracks:
54
+ 1. **Provision Strand**:
55
+ ```bash
56
+ vine new <task_id> --branch strand/<task_id> --worktree
57
+ ```
58
+ 2. **Execute Work Inside Strand**:
59
+ - Implement code changes.
60
+ - Run local unit tests and formatters.
61
+ 3. **Two-Key Gate Verification**:
62
+ ```bash
63
+ vine gate --json
64
+ ```
65
+ *Must verify exit code 0: Key 1 (in-memory merge-tree) PASS + Key 2 (compiler/test suite) PASS.*
66
+ 4. **Trunk Weaving**:
67
+ *Orchestrator fast-forwards verified branch into main:*
68
+ ```bash
69
+ vine weave
70
+ ```
71
+
72
+ ---
73
+
74
+ ## 4. Phase-by-Phase Task Checklist
75
+
76
+ ### Phase 1: Core Engine Primitives
77
+ - [ ] **Task 1.1: Core Data Structures** (`architect`)
78
+ - *Strand*: `strand/task-core-ds`
79
+ - *Lock*: `rhizo lock file:src/types.nim 300 --fencing`
80
+ - *Actions*: Define AST node kinds and message serializers.
81
+ - *Verification*: `nim c -r tests/test_types.nim`
82
+ - *Weave*: `vine gate && vine weave && rhizo unlock file:src/types.nim`
83
+
84
+ - [ ] **Task 1.2: Test Harness & Negative Controls** (`auditor`)
85
+ - *Strand*: `strand/task-test-harness`
86
+ - *Actions*: Implement negative assertion tests for malformed JSON.
87
+ - *Verification*: `pytest tests/test_harness.py`
88
+ - *Weave*: `vine gate && vine weave`
89
+
90
+ ### Phase 2: High-Level CLI & Integration
91
+ - [ ] **Task 2.1: CLI Subcommand Wiring** (`implementer`)
92
+ - *Dependency*: Task 1.1, Task 1.2
93
+ - *Strand*: `strand/task-cli-wiring`
94
+ - *Actions*: Expose new subcommands in CLI parser.
95
+ - *Verification*: `garden --help` and tripwire tests.
96
+ - *Weave*: `vine gate && vine weave`
97
+
98
+ ---
99
+
100
+ ## 5. Dynamic Progress Tracking & Harness To-Do Protocol
101
+ 1. **Markdown Checkboxes**:
102
+ - As each task begins, the orchestrator updates status notes.
103
+ - When verified woven, the orchestrator changes `- [ ]` to `- [x]`.
104
+ 2. **Harness To-Do Synchronization**:
105
+ - If the runtime harness provides native To-Do tools (e.g. `todo_write`, `manage_tasks`), the orchestrator mirrors the active phase tasks into the harness's To-Do list.
106
+ - Mark items complete in the harness tool at the moment of `vine weave`.
107
+
108
+ ---
109
+
110
+ ## 6. Emergent Design Addendum Protocol
111
+ If a worker discovers that an assumption in `design.md` is flawed or impossible to implement:
112
+ 1. **DO NOT silently diverge code from `design.md`**.
113
+ 2. Draft an addendum document: `docs/addenda/addendum_<topic>.md`:
114
+ - *Problem Statement*: Why the original design cannot work as specified.
115
+ - *Proposed Deviation*: Exact technical changes.
116
+ - *Tradeoff Analysis*: Performance, ergonomics, backwards compatibility.
117
+ 3. Submit notification to Orchestrator via `rhizo send --to orchestrator --subject "Design Addendum: <topic>"`.
118
+ 4. Orchestrator reviews and ratifies the addendum, updates `design.md`, updates `implementation_plan.md`, and replies with approval before implementation resumes.
119
+ ```
120
+
121
+ ---
122
+
123
+ ## 3. Plan Review & Gate Clearance
124
+
125
+ Before handing off to [`orchestrate-swarm`](../orchestrate-swarm/SKILL.md):
126
+ 1. Assert that every task names a concrete persona owner.
127
+ 2. Assert that all shared files have fencing locks scheduled.
128
+ 3. Assert that all tasks requiring branch isolation specify `vine new` and `vine gate`.
129
+ 4. Save file to `implementation_plan.md` in the project root.