iosm-cli 0.1.3 → 0.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (132) hide show
  1. package/CHANGELOG.md +27 -0
  2. package/README.md +88 -46
  3. package/dist/core/agent-teams.d.ts.map +1 -1
  4. package/dist/core/agent-teams.js +38 -11
  5. package/dist/core/agent-teams.js.map +1 -1
  6. package/dist/core/blast.d.ts +62 -0
  7. package/dist/core/blast.d.ts.map +1 -0
  8. package/dist/core/blast.js +448 -0
  9. package/dist/core/blast.js.map +1 -0
  10. package/dist/core/contract.d.ts +54 -0
  11. package/dist/core/contract.d.ts.map +1 -0
  12. package/dist/core/contract.js +300 -0
  13. package/dist/core/contract.js.map +1 -0
  14. package/dist/core/failure-retrospective.d.ts +12 -0
  15. package/dist/core/failure-retrospective.d.ts.map +1 -0
  16. package/dist/core/failure-retrospective.js +115 -0
  17. package/dist/core/failure-retrospective.js.map +1 -0
  18. package/dist/core/project-index/index.d.ts +17 -0
  19. package/dist/core/project-index/index.d.ts.map +1 -0
  20. package/dist/core/project-index/index.js +323 -0
  21. package/dist/core/project-index/index.js.map +1 -0
  22. package/dist/core/project-index/types.d.ts +34 -0
  23. package/dist/core/project-index/types.d.ts.map +1 -0
  24. package/dist/core/project-index/types.js +2 -0
  25. package/dist/core/project-index/types.js.map +1 -0
  26. package/dist/core/sdk.d.ts.map +1 -1
  27. package/dist/core/sdk.js +8 -0
  28. package/dist/core/sdk.js.map +1 -1
  29. package/dist/core/semantic/config.d.ts.map +1 -1
  30. package/dist/core/semantic/config.js +5 -0
  31. package/dist/core/semantic/config.js.map +1 -1
  32. package/dist/core/semantic/index.d.ts +1 -1
  33. package/dist/core/semantic/index.d.ts.map +1 -1
  34. package/dist/core/semantic/index.js +1 -1
  35. package/dist/core/semantic/index.js.map +1 -1
  36. package/dist/core/semantic/runtime.d.ts.map +1 -1
  37. package/dist/core/semantic/runtime.js +12 -1
  38. package/dist/core/semantic/runtime.js.map +1 -1
  39. package/dist/core/semantic/types.d.ts +6 -0
  40. package/dist/core/semantic/types.d.ts.map +1 -1
  41. package/dist/core/semantic/types.js +6 -0
  42. package/dist/core/semantic/types.js.map +1 -1
  43. package/dist/core/shadow-guard.d.ts +30 -0
  44. package/dist/core/shadow-guard.d.ts.map +1 -0
  45. package/dist/core/shadow-guard.js +81 -0
  46. package/dist/core/shadow-guard.js.map +1 -0
  47. package/dist/core/shared-memory.d.ts +46 -0
  48. package/dist/core/shared-memory.d.ts.map +1 -0
  49. package/dist/core/shared-memory.js +253 -0
  50. package/dist/core/shared-memory.js.map +1 -0
  51. package/dist/core/singular.d.ts +73 -0
  52. package/dist/core/singular.d.ts.map +1 -0
  53. package/dist/core/singular.js +413 -0
  54. package/dist/core/singular.js.map +1 -0
  55. package/dist/core/slash-commands.d.ts.map +1 -1
  56. package/dist/core/slash-commands.js +14 -2
  57. package/dist/core/slash-commands.js.map +1 -1
  58. package/dist/core/subagents.js +1 -1
  59. package/dist/core/subagents.js.map +1 -1
  60. package/dist/core/swarm/gates.d.ts +9 -0
  61. package/dist/core/swarm/gates.d.ts.map +1 -0
  62. package/dist/core/swarm/gates.js +65 -0
  63. package/dist/core/swarm/gates.js.map +1 -0
  64. package/dist/core/swarm/index.d.ts +9 -0
  65. package/dist/core/swarm/index.d.ts.map +1 -0
  66. package/dist/core/swarm/index.js +9 -0
  67. package/dist/core/swarm/index.js.map +1 -0
  68. package/dist/core/swarm/locks.d.ts +21 -0
  69. package/dist/core/swarm/locks.d.ts.map +1 -0
  70. package/dist/core/swarm/locks.js +93 -0
  71. package/dist/core/swarm/locks.js.map +1 -0
  72. package/dist/core/swarm/planner.d.ts +16 -0
  73. package/dist/core/swarm/planner.d.ts.map +1 -0
  74. package/dist/core/swarm/planner.js +137 -0
  75. package/dist/core/swarm/planner.js.map +1 -0
  76. package/dist/core/swarm/retry.d.ts +16 -0
  77. package/dist/core/swarm/retry.d.ts.map +1 -0
  78. package/dist/core/swarm/retry.js +32 -0
  79. package/dist/core/swarm/retry.js.map +1 -0
  80. package/dist/core/swarm/scheduler.d.ts +48 -0
  81. package/dist/core/swarm/scheduler.d.ts.map +1 -0
  82. package/dist/core/swarm/scheduler.js +554 -0
  83. package/dist/core/swarm/scheduler.js.map +1 -0
  84. package/dist/core/swarm/spawn.d.ts +16 -0
  85. package/dist/core/swarm/spawn.d.ts.map +1 -0
  86. package/dist/core/swarm/spawn.js +42 -0
  87. package/dist/core/swarm/spawn.js.map +1 -0
  88. package/dist/core/swarm/state-store.d.ts +35 -0
  89. package/dist/core/swarm/state-store.d.ts.map +1 -0
  90. package/dist/core/swarm/state-store.js +106 -0
  91. package/dist/core/swarm/state-store.js.map +1 -0
  92. package/dist/core/swarm/types.d.ts +116 -0
  93. package/dist/core/swarm/types.d.ts.map +1 -0
  94. package/dist/core/swarm/types.js +2 -0
  95. package/dist/core/swarm/types.js.map +1 -0
  96. package/dist/core/system-prompt.d.ts.map +1 -1
  97. package/dist/core/system-prompt.js +6 -3
  98. package/dist/core/system-prompt.js.map +1 -1
  99. package/dist/core/tools/semantic-search.d.ts.map +1 -1
  100. package/dist/core/tools/semantic-search.js +1 -0
  101. package/dist/core/tools/semantic-search.js.map +1 -1
  102. package/dist/core/tools/shared-memory.d.ts +23 -0
  103. package/dist/core/tools/shared-memory.d.ts.map +1 -0
  104. package/dist/core/tools/shared-memory.js +134 -0
  105. package/dist/core/tools/shared-memory.js.map +1 -0
  106. package/dist/core/tools/task.d.ts +8 -1
  107. package/dist/core/tools/task.d.ts.map +1 -1
  108. package/dist/core/tools/task.js +664 -123
  109. package/dist/core/tools/task.js.map +1 -1
  110. package/dist/main.d.ts.map +1 -1
  111. package/dist/main.js +8 -1
  112. package/dist/main.js.map +1 -1
  113. package/dist/modes/interactive/components/custom-editor.d.ts +8 -0
  114. package/dist/modes/interactive/components/custom-editor.d.ts.map +1 -1
  115. package/dist/modes/interactive/components/custom-editor.js +70 -1
  116. package/dist/modes/interactive/components/custom-editor.js.map +1 -1
  117. package/dist/modes/interactive/components/login-dialog.d.ts +1 -0
  118. package/dist/modes/interactive/components/login-dialog.d.ts.map +1 -1
  119. package/dist/modes/interactive/components/login-dialog.js +27 -4
  120. package/dist/modes/interactive/components/login-dialog.js.map +1 -1
  121. package/dist/modes/interactive/components/subagent-message.d.ts.map +1 -1
  122. package/dist/modes/interactive/components/subagent-message.js +14 -0
  123. package/dist/modes/interactive/components/subagent-message.js.map +1 -1
  124. package/dist/modes/interactive/interactive-mode.d.ts +81 -0
  125. package/dist/modes/interactive/interactive-mode.d.ts.map +1 -1
  126. package/dist/modes/interactive/interactive-mode.js +3481 -870
  127. package/dist/modes/interactive/interactive-mode.js.map +1 -1
  128. package/docs/cli-reference.md +29 -1
  129. package/docs/configuration.md +5 -0
  130. package/docs/interactive-mode.md +171 -2
  131. package/docs/orchestration-and-subagents.md +96 -169
  132. package/package.json +4 -3
@@ -112,7 +112,35 @@ iosm semantic query "<text>" [--top-k N]
112
112
 
113
113
  Notes:
114
114
  - If semantic config is missing, the command prints actionable paths and suggests `/semantic setup`.
115
- - `query` auto-refreshes stale indexes incrementally; provider/chunk/filter changes require `rebuild`.
115
+ - `query` auto-refreshes stale indexes only when `semanticSearch.autoIndex=true` (default is `true`).
116
+ - When auto-index is off, run `iosm semantic index` (or `rebuild` for provider/chunk/filter changes).
117
+
118
+ ### Interactive feasibility/contract commands
119
+
120
+ These commands run inside interactive mode (`iosm`), not as top-level CLI subcommands:
121
+
122
+ - `/contract` — interactive engineering contract manager:
123
+ - edit fields one-by-one
124
+ - autosave on `Enter`
125
+ - auto-build `.iosm/contract.json` for project scope
126
+ - `/singular <feature request>` — command-first feasibility analyzer:
127
+ - baseline repository scan + standard agent pass
128
+ - outputs exactly 3 implementation options with recommendation
129
+ - lets user choose option `1/2/3`, then `Start with Swarm` or `Continue without Swarm`
130
+ - `/swarm` — canonical gated execution runtime:
131
+ - `/swarm run <task> [--max-parallel N] [--budget-usd X]`
132
+ - `/swarm from-singular <run-id> --option <1|2|3> [--max-parallel N] [--budget-usd X]`
133
+ - `/swarm watch [run-id]`
134
+ - `/swarm retry <run-id> <task-id> [--reset-brief]`
135
+ - `/swarm resume <run-id>`
136
+ - limits: `--max-parallel` supports `1..20`; delegated intra-task fan-out supports up to `10`
137
+ - consistency model: `Scopes -> Touches -> Locks -> Gates -> Done`
138
+ - built-in scheduler guards: progress heuristic + conflict density guard
139
+ - high-risk spawn candidates are confirmation-gated
140
+
141
+ Migration notes:
142
+ - `/blast` removed in favor of `/singular`
143
+ - `/shadow` removed
116
144
 
117
145
  ---
118
146
 
@@ -135,6 +135,7 @@ Schema (`semanticSearch` object):
135
135
  {
136
136
  "semanticSearch": {
137
137
  "enabled": true,
138
+ "autoIndex": true,
138
139
  "provider": {
139
140
  "type": "openrouter",
140
141
  "model": "openai/text-embedding-3-small",
@@ -166,6 +167,10 @@ Schema (`semanticSearch` object):
166
167
  }
167
168
  ```
168
169
 
170
+ `autoIndex` controls query-time automatic refresh:
171
+ - `true` (default): `query` automatically refreshes stale index (and rebuilds when required)
172
+ - `false`: stale/missing index must be updated manually via `iosm semantic index` / `rebuild`
173
+
169
174
  Index storage (global cache):
170
175
 
171
176
  ```
@@ -53,7 +53,10 @@ iosm --continue
53
53
  | `/model` | Open provider-first model selector (`provider -> model`) | `/model` |
54
54
  | `/scoped-models` | Manage model rotation | `/scoped-models` |
55
55
  | `/mcp` | Open MCP manager UI and run MCP subcommands | `/mcp` |
56
- | `/semantic` | Open semantic search manager (`setup/status/index/rebuild/query`) | `/semantic` |
56
+ | `/semantic` | Open semantic search manager (`setup/auto-index/status/index/rebuild/query`) | `/semantic` |
57
+ | `/contract` | Interactive engineering contract editor (field-by-field, auto JSON build) | `/contract` |
58
+ | `/singular` | Feature feasibility analyzer with implementation options and recommendation | `/singular add account dashboard` |
59
+ | `/swarm` | Recommended multi-agent orchestration runtime for complex/risky tasks (`run`, `from-singular`, `watch`, `retry`, `resume`) | `/swarm run refactor auth module --max-parallel 3` |
57
60
  | `/memory` | Interactive memory manager (`add/edit/remove/scope/path`) | `/memory` |
58
61
  | `/settings` | View/modify settings | `/settings` |
59
62
  | `/hotkeys` | View keyboard shortcuts | `/hotkeys` |
@@ -74,7 +77,8 @@ iosm --continue
74
77
 
75
78
  | Command | Description | Example |
76
79
  |---------|-------------|---------|
77
- | `/orchestrate` | Launch subagent orchestration | See below |
80
+ | `/swarm` | Swarm-first multi-agent orchestration runtime for complex/risky work | `/swarm run refactor auth and token flow` |
81
+ | `/orchestrate` | Manual legacy multi-agent orchestration (explicit agent splitting) | See below |
78
82
  | `/agents` | Inspect custom/system agents | `/agents` |
79
83
  | `/subagent-runs` | List subagent run history | `/subagent-runs` |
80
84
  | `/subagent-resume` | Resume a subagent run | `/subagent-resume run-123` |
@@ -99,9 +103,174 @@ iosm --continue
99
103
 
100
104
  `/mcp add` without flags starts a guided wizard in the terminal UI.
101
105
  `/semantic` opens an interactive setup/status/index/query manager for embeddings search.
106
+ Manager includes `Automatic indexing` toggle (default `on`) to control query-time auto-refresh.
102
107
  `/semantic setup` now auto-loads model catalogs for OpenRouter (`/api/v1/embeddings/models`) and Ollama (`/api/tags`) with manual fallback.
103
108
  In `/semantic setup`, the headers step is optional: press `Enter` on empty input to skip.
104
109
  `/memory` opens an interactive manager. `/memory <text>` saves a note to `memory.md` and reloads session context. Use `/memory edit <index> <text>` for direct updates.
110
+ `/contract` edits contract fields interactively (`goal`, scope, constraints, quality gates, DoD, risks, etc.), then writes JSON automatically.
111
+ `/singular <request>` runs a two-pass feasibility analysis (baseline scan + standard agent pass), builds concrete implementation options, then prompts `Start with Swarm` / `Continue without Swarm` / `Cancel`.
112
+ `/swarm` enforces `Scopes -> Touches -> Locks -> Gates -> Done`. If effective contract is missing, it blocks execution and opens a bootstrap menu (auto-draft, guided Q&A, or manual `/contract` editor).
113
+ `/blast` and `/shadow` are removed from active interactive workflow.
114
+
115
+ ### `/contract` Detailed Guide
116
+
117
+ `/contract` is a layered contract editor with two sources and one merged output:
118
+
119
+ | Layer | Scope | Persistence | Storage |
120
+ |------|-------|-------------|---------|
121
+ | `project` | Project-wide baseline | Persistent | `.iosm/contract.json` |
122
+ | `session` | Current session override | Temporary | In-memory session overlay |
123
+ | `effective` | `project + session` merged result | Derived | Computed at runtime |
124
+
125
+ Important merge rule:
126
+ - `session` overrides `project` for the same keys.
127
+ - `effective` is what the runtime actually uses.
128
+
129
+ #### Quick Difference: Effective vs Session vs Project
130
+
131
+ - `Open effective contract` is read-only and shows what runtime is enforcing right now.
132
+ - `Edit session contract` changes only this session (temporary overlay, not persisted to disk).
133
+ - `Edit project contract` changes `.iosm/contract.json` (persistent baseline for future sessions).
134
+
135
+ #### Manager Actions
136
+
137
+ | Action | What it does | When to use |
138
+ |------|---------------|-------------|
139
+ | `Open effective contract` | Shows the merged JSON currently enforced by runtime | Verify final active constraints |
140
+ | `Edit session contract` | Edits temporary overrides for current session | Experiments, one-off constraints |
141
+ | `Edit project contract` | Edits persistent project contract file | Team-wide stable defaults |
142
+ | `Copy effective -> session` | Saves merged state into session layer | Freeze current merged state for this run |
143
+ | `Copy effective -> project` | Saves merged state into project file | Promote temporary decisions to baseline |
144
+ | `Delete session contract` | Clears temporary overlay | Reset session overrides |
145
+ | `Delete project contract` | Removes `.iosm/contract.json` | Full baseline reset |
146
+
147
+ #### Field Editor Behavior
148
+
149
+ - Select a field and press `Enter`.
150
+ - Input text (single-line or multi-line list depending on field type).
151
+ - Press `Enter` to submit.
152
+ - Change is saved immediately to selected scope (`session` or `project`).
153
+ - Empty input clears that field.
154
+
155
+ There is no separate "Save" step in field editor mode.
156
+
157
+ #### Common Workflows
158
+
159
+ 1. Temporary tightening for one run:
160
+ - Open `/contract`
161
+ - `Edit session contract`
162
+ - Set `constraints` and `quality_gates`
163
+ - Confirm via `Open effective contract`
164
+
165
+ 2. Promote temporary policy to project baseline:
166
+ - Open `/contract`
167
+ - `Copy effective -> project`
168
+ - Review `.iosm/contract.json` in VCS
169
+
170
+ 3. Recover from aggressive temporary overrides:
171
+ - Open `/contract`
172
+ - `Delete session contract`
173
+ - Re-open `effective` and verify fallback to `project`
174
+
175
+ ### `/singular` Detailed Guide
176
+
177
+ `/singular` is a command-first feasibility mode (no pre-menu).
178
+ Pattern: `/singular <feature request>`
179
+
180
+ Examples:
181
+ - `/singular add account dashboard`
182
+ - `/singular introduce RBAC for API`
183
+ - `/singular redesign billing reconciliation flow`
184
+
185
+ #### What Happens Internally
186
+
187
+ 1. Baseline repository pass:
188
+ - Scans project files and estimates baseline complexity/blast radius.
189
+ - Collects likely impacted files and contract signals.
190
+
191
+ 2. Standard agent feasibility pass:
192
+ - Launches an isolated standard agent run (`plan` profile) with repository tools.
193
+ - Agent inspects real files and returns structured feasibility JSON.
194
+ - Produces recommendation, impact analysis, and implementation variants.
195
+
196
+ 3. Merge + persistence:
197
+ - Agent insights are merged with baseline data.
198
+ - Analysis is saved to `.iosm/singular/<run-id>/analysis.json` (+ `meta.json`).
199
+
200
+ #### Output Shape
201
+
202
+ Each run includes:
203
+ - `recommendation`: `implement_now | implement_incrementally | defer`
204
+ - `reason`: why this recommendation is best for current stage
205
+ - `complexity` and `blast_radius`
206
+ - `stage_fit`: `needed_now | optional_now | later`
207
+ - `impact_analysis`: codebase, delivery, risks, operations
208
+ - `implementation_options` (exactly 3 variants):
209
+ - Option 1: practical/recommended path
210
+ - Option 2: alternative approach
211
+ - Option 3: defer / do not implement now
212
+
213
+ Each option includes:
214
+ - summary and trade-offs (`pros`/`cons`)
215
+ - concrete file targets (`suggested_files`)
216
+ - step-by-step plan (`plan`)
217
+ - `when_to_choose` guidance
218
+
219
+ #### Decision Flow
220
+
221
+ After analysis, selector opens with variants:
222
+ - choose Option 1 / Option 2 / Option 3
223
+ - or close without decision
224
+
225
+ If Option 1 or 2 is selected, execution mode prompt opens:
226
+ - `Start with Swarm (Recommended)` -> runs `/swarm from-singular <run-id> --option <n>`
227
+ - `Continue without Swarm` -> inserts execution draft into editor (ready to run)
228
+ - `Cancel` -> exits without changes
229
+
230
+ If Option 3 is selected, run is explicitly marked as postponed.
231
+
232
+ #### Fallback Behavior
233
+
234
+ If no model is selected (or agent pass fails), `/singular` still returns a heuristic baseline analysis.
235
+ Use `/model` to enable full agent feasibility pass.
236
+
237
+ #### Command Migration
238
+
239
+ - `/singular` is the feasibility command to use.
240
+ - `/blast` is deprecated/removed.
241
+ - `/shadow` is removed.
242
+
243
+ ### `/swarm` Detailed Guide
244
+
245
+ Canonical commands:
246
+ - `/swarm run <task> [--max-parallel N] [--budget-usd X]`
247
+ - `/swarm from-singular <run-id> --option <1|2|3> [--max-parallel N] [--budget-usd X]`
248
+ - `/swarm watch [run-id]`
249
+ - `/swarm retry <run-id> <task-id> [--reset-brief]`
250
+ - `/swarm resume <run-id>`
251
+
252
+ Execution note:
253
+ - Run-level `--max-parallel` supports `1..20`.
254
+ - A single swarm task can use delegated intra-task subagents in parallel (up to 10) when decomposition is beneficial.
255
+ - Shared memory tools (`shared_memory_write` / `shared_memory_read`) are available to tasks/delegates that share a `run_id`.
256
+ - Standalone `task` calls auto-generate internal `run_id/task_id`, so shared-memory collaboration still works for root + delegates.
257
+
258
+ Runtime artifacts:
259
+ - `.iosm/orchestrate/<run-id>/run.json`
260
+ - `.iosm/orchestrate/<run-id>/dag.json`
261
+ - `.iosm/orchestrate/<run-id>/state.json`
262
+ - `.iosm/orchestrate/<run-id>/events.jsonl`
263
+ - `.iosm/orchestrate/<run-id>/checkpoints/latest.json`
264
+ - `.iosm/orchestrate/<run-id>/reports/*`
265
+
266
+ `/swarm watch` includes:
267
+ - current state and task breakdown
268
+ - budget and warning state
269
+ - ETA ticks and throughput
270
+ - critical path and theoretical speedup
271
+ - lock snapshot and bottleneck tasks
272
+
273
+ `/orchestrate --swarm` was removed. Use `/swarm ...` directly.
105
274
 
106
275
  ---
107
276
 
@@ -1,184 +1,152 @@
1
1
  # Orchestration & Subagents
2
2
 
3
- `iosm-cli` supports delegated execution through subagents specialized AI agents that handle task delegation, parallel execution, and multi-agent workflows.
3
+ `iosm-cli` now uses a **swarm-first** execution model for complex/risky changes.
4
4
 
5
- ## Overview
5
+ Canonical path:
6
+ - `/singular` -> choose option
7
+ - effective `/contract` applied (or bootstrap required)
8
+ - `/swarm` execution runtime
9
+ - optional `/iosm` optimization loop
6
10
 
7
- Subagents allow you to:
8
- - **Delegate tasks** to specialized agents with isolated context windows
9
- - **Run agents in parallel** for independent analyses or implementations
10
- - **Orchestrate teams** with dependency ordering and lock-based coordination
11
- - **Track runs** with full transcripts and result aggregation
11
+ Core consistency model:
12
+ - **Scopes -> Touches -> Locks -> Gates -> Done**
12
13
 
13
14
  ---
14
15
 
15
16
  ## User-Level Entry Points
16
17
 
17
- ### 1. Natural Language Delegation
18
+ ### 1. Decision-first flow (recommended)
18
19
 
19
- Simply describe what you want delegated, and the agent handles orchestration:
20
-
21
- ```
22
- You: Launch 3 agents to analyze security, performance, and code quality separately
23
-
24
- Agent: I'll create 3 parallel subagents for each analysis area...
20
+ ```bash
21
+ /singular "Refactor auth and split session handling from token validation"
22
+ # choose Option 1/2/3
23
+ # choose Start with Swarm (Recommended)
25
24
  ```
26
25
 
27
- ### 2. Slash Command Orchestration
28
-
29
- Use `/orchestrate` for explicit control:
26
+ ### 2. Direct swarm execution
30
27
 
31
28
  ```bash
32
- /orchestrate --parallel --agents 3 \
33
- --profiles explore,full,iosm_verifier \
34
- --cwd .,src,.iosm \
35
- Analyze security, optimize performance, verify IOSM compliance
29
+ /swarm run "Refactor auth and reduce integration risk" --max-parallel 3 --budget-usd 12
36
30
  ```
37
31
 
38
- ### 3. Agent Mention
32
+ ### 3. Agent mention / delegated tasks
39
33
 
40
- Reference a specific agent by name:
41
-
42
- ```
34
+ ```text
43
35
  @security-auditor Review the authentication module for vulnerabilities
44
36
  ```
45
37
 
46
38
  ---
47
39
 
48
- ## `/orchestrate` Command
40
+ ## `/swarm` Command Surface
49
41
 
50
42
  ### Syntax
51
43
 
52
44
  ```bash
53
- /orchestrate [flags] <task description>
54
- ```
55
-
56
- ### Execution Flags
45
+ /swarm run <task> [--max-parallel N] [--budget-usd X]
46
+ /swarm from-singular <run-id> --option <1|2|3> [--max-parallel N] [--budget-usd X]
47
+ /swarm watch [run-id]
48
+ /swarm retry <run-id> <task-id> [--reset-brief]
49
+ /swarm resume <run-id>
50
+ /swarm help
51
+ ```
52
+
53
+ ### Notes
54
+
55
+ - `/swarm` will not execute without an effective `/contract`.
56
+ - Run-level `--max-parallel` supports `1..20`.
57
+ - Within a single swarm task, the execution agent can fan out delegated subagents in parallel (up to 10) when the subtask is decomposable.
58
+ - Tasks/delegates with the same `run_id` can exchange intermediate state via `shared_memory_write` / `shared_memory_read`.
59
+ - Standalone `task` calls without explicit `run_id` use an internal run/task id, so shared memory still works inside that task execution (root + delegates).
60
+ - If contract is missing, bootstrap menu is blocking:
61
+ - `Auto-draft from task (Recommended)`
62
+ - `Guided Q&A`
63
+ - `Open manual /contract editor`
64
+ - Medium/large repositories use Project Index planning by default.
65
+ - Semantic index is optional enrichment; when stale/missing, swarm continues with guided recommendations.
66
+ - Scheduler guards are enabled by default:
67
+ - `progress heuristic` (prioritizes high-impact tasks when progress stalls)
68
+ - `conflict density guard` (reduces parallelism under heavy touch overlap)
69
+ - High-risk spawn candidates require confirmation (approve/reject/abort run).
57
70
 
58
- | Flag | Description | Example |
59
- |------|-------------|---------|
60
- | `--parallel` | Run agents concurrently | `--parallel` |
61
- | `--sequential` | Run agents one after another | `--sequential` |
62
- | `--agents <N>` | Number of agents to spawn | `--agents 3` |
63
- | `--max-parallel <N>` | Concurrency limit for parallel runs | `--max-parallel 2` |
64
-
65
- ### Profile & Context Flags
66
-
67
- | Flag | Description | Example |
68
- |------|-------------|---------|
69
- | `--profile <name>` | Single profile for all agents | `--profile explore` |
70
- | `--profiles p1,p2,...` | Per-agent profile assignment | `--profiles explore,full,iosm_verifier` |
71
- | `--cwd path1,path2,...` | Per-agent working directories | `--cwd .,src,test` |
71
+ ---
72
72
 
73
- ### Coordination Flags
73
+ ## Command Separation
74
74
 
75
- | Flag | Description | Example |
76
- |------|-------------|---------|
77
- | `--locks lock1,lock2,...` | Write serialization domains | `--locks db,config` |
78
- | `--depends 2>1,3>2` | Dependency ordering | `--depends 2>1` (agent 2 waits for 1) |
79
- | `--worktree` | Git worktree isolation | `--worktree` |
75
+ - Use direct prompt to the main agent for simple tasks.
76
+ - Use legacy `/orchestrate ...` when you explicitly want manual multi-agent splitting with old team-run semantics.
77
+ - Use canonical `/swarm ...` as multi-agent orchestration runtime for complex/risky work.
78
+ - `/orchestrate --swarm` was removed to avoid command ambiguity.
80
79
 
81
80
  ---
82
81
 
83
- ## Usage Examples
84
-
85
- ### Parallel Independent Analysis
82
+ ## Runtime Artifacts
86
83
 
87
- Three agents analyze different aspects simultaneously:
84
+ Swarm run artifacts are written to:
88
85
 
89
- ```bash
90
- /orchestrate --parallel --agents 3 \
91
- --profiles explore,explore,explore \
92
- --cwd src/auth,src/api,src/data \
93
- Analyze code quality and suggest improvements
86
+ ```text
87
+ .iosm/orchestrate/<run-id>/
88
+ ├── run.json
89
+ ├── dag.json
90
+ ├── state.json
91
+ ├── events.jsonl
92
+ ├── checkpoints/
93
+ │ └── latest.json
94
+ └── reports/
95
+ ├── integration_report.md
96
+ ├── gates.json
97
+ └── shared_context.md
94
98
  ```
95
99
 
96
- ### Sequential Pipeline
100
+ Swarm run history is native to `/swarm` commands (`watch`, `retry`, `resume`), not mirrored into legacy team-run storage.
97
101
 
98
- Agent 2 depends on Agent 1's output:
99
-
100
- ```bash
101
- /orchestrate --sequential --agents 2 \
102
- --depends 2>1 \
103
- First: analyze the codebase architecture. \
104
- Second: propose a refactoring plan based on the analysis.
105
- ```
102
+ ---
106
103
 
107
- ### Parallel with Write Isolation
104
+ ## Visibility & Recovery
108
105
 
109
- For concurrent changes that might conflict:
106
+ ### Watch
110
107
 
111
108
  ```bash
112
- /orchestrate --parallel --worktree --agents 2 \
113
- Agent 1: refactor auth module \
114
- Agent 2: refactor payment module
109
+ /swarm watch [run-id]
115
110
  ```
116
111
 
117
- ### Locked Write Coordination
118
-
119
- Serialize writes to shared resources:
120
-
121
- ```bash
122
- /orchestrate --parallel --agents 3 \
123
- --locks database-schema \
124
- All agents: optimize your assigned module's database queries
125
- ```
112
+ Shows live snapshot fields:
113
+ - run status
114
+ - ready/running/blocked/done/error counts
115
+ - budget usage and 80% warning state
116
+ - locks and current touches map
117
+ - ETA ticks, throughput per tick, critical path estimate, theoretical speedup, and top bottleneck tasks
126
118
 
127
- ### Full Team Orchestration
119
+ ### Retry
128
120
 
129
121
  ```bash
130
- /orchestrate --parallel --agents 4 \
131
- --profiles iosm_analyst,explore,iosm_verifier,full \
132
- --max-parallel 2 \
133
- 1: Collect baseline metrics \
134
- 2: Identify optimization opportunities \
135
- 3: Verify current quality gate compliance \
136
- 4: Implement the top-priority fix
122
+ /swarm retry <run-id> <task-id> [--reset-brief]
137
123
  ```
138
124
 
139
- ---
140
-
141
- ## Visibility & Tracking
125
+ - retries one failed/blocked task under retry taxonomy
126
+ - optional `--reset-brief` lets you edit task brief before retry
142
127
 
143
- ### View Subagent Runs
128
+ ### Resume
144
129
 
145
130
  ```bash
146
- /subagent-runs
131
+ /swarm resume <run-id>
147
132
  ```
148
133
 
149
- Lists all subagent runs with:
150
- - Run ID, status (running/complete/failed)
151
- - Agent profile and task description
152
- - Timestamps and duration
153
-
154
- ### Resume a Subagent Run
155
-
156
- ```bash
157
- /subagent-resume <run-id> [extra instructions]
158
- ```
134
+ Resumes from checkpoint + snapshot state.
159
135
 
160
- Continue or refine a previous subagent's work:
136
+ ---
161
137
 
162
- ```bash
163
- /subagent-resume run-abc123 "Focus more on error handling"
164
- ```
138
+ ## Legacy `/orchestrate` (non-swarm)
165
139
 
166
- ### Team Run Status
140
+ Legacy orchestration remains available for existing workflows:
167
141
 
168
142
  ```bash
169
- /team-runs # List team orchestration runs
170
- /team-status <team-run-id> # Detailed status of a specific team run
143
+ /orchestrate --parallel --agents 3 \
144
+ --profiles explore,full,iosm_verifier \
145
+ --cwd .,src,.iosm \
146
+ Analyze security, optimize performance, verify IOSM compliance
171
147
  ```
172
148
 
173
- ### Artifacts
174
-
175
- Subagent transcripts and team records are stored in:
176
-
177
- ```
178
- .iosm/subagents/
179
- ├── runs/ # Individual subagent transcripts
180
- └── teams/ # Team orchestration records
181
- ```
149
+ Use legacy mode when you explicitly need old team-run semantics.
182
150
 
183
151
  ---
184
152
 
@@ -217,57 +185,16 @@ Always provide:
217
185
 
218
186
  # View all available agents
219
187
  /agents
220
-
221
- # Use in orchestration
222
- /orchestrate --agents 1 --profile security-auditor \
223
- Audit the authentication module
224
188
  ```
225
189
 
226
- ### System Agents
227
-
228
- Built-in system agents available by default include auditor, verifier, and executor roles. View them with `/agents`.
229
-
230
- ---
231
-
232
- ## Parallel Safety Model
233
-
234
- ### When to Use Locks
235
-
236
- Use `lock_key` domains when multiple agents might write to the same files:
237
-
238
- ```bash
239
- /orchestrate --parallel --agents 2 \
240
- --locks "config-files" \
241
- Both modify shared configuration
242
- ```
243
-
244
- ### When to Use Worktrees
245
-
246
- Use `--worktree` for large-scale concurrent edits:
247
-
248
- ```bash
249
- /orchestrate --parallel --worktree --agents 3 \
250
- Each refactor a major module independently
251
- ```
252
-
253
- ### When No Coordination Is Needed
254
-
255
- Keep independent analyses lock-free:
256
-
257
- ```bash
258
- /orchestrate --parallel --agents 3 \
259
- --profiles explore,explore,explore \
260
- Each analyze a different module (read-only)
261
- ```
190
+ Built-in system agents remain available; inspect via `/agents`.
262
191
 
263
192
  ---
264
193
 
265
- ## Best Practices
194
+ ## Safety Guidance
266
195
 
267
- 1. **Keep tasks independent** Each agent works best with a well-defined, independent scope
268
- 2. **Narrow responsibilities** One agent, one clear task
269
- 3. **Use appropriate profiles** Read-only tasks don't need `full` profile
270
- 4. **Aggregate results** The orchestrating agent synthesizes all subagent outputs
271
- 5. **Clarify constraints** Specify boundaries and expected output format
272
- 6. **Monitor progress** — Use `/subagent-runs` and `/team-status` to track execution
273
- 7. **Start small** — Begin with 2-3 agents and scale up as needed
196
+ - Use `/contract` to lock execution scope before running swarm.
197
+ - Prefer `/singular` when scope/impact is unclear.
198
+ - Use `/swarm watch` frequently on medium/high-risk runs.
199
+ - Use `/checkpoint`/`/rollback` before broad refactors.
200
+ - Follow up with `/iosm` for measurable post-change quality improvements.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "iosm-cli",
3
- "version": "0.1.3",
3
+ "version": "0.2.1",
4
4
  "description": "Standalone IOSM CLI with agent tooling, session management, and IOSM artifact orchestration",
5
5
  "type": "module",
6
6
  "iosmConfig": {
@@ -53,7 +53,7 @@
53
53
  "cli-highlight": "^2.1.11",
54
54
  "diff": "^8.0.2",
55
55
  "extract-zip": "^2.0.1",
56
- "file-type": "^21.1.1",
56
+ "file-type": "^21.3.1",
57
57
  "glob": "^13.0.1",
58
58
  "hosted-git-info": "^9.0.2",
59
59
  "ignore": "^7.0.5",
@@ -68,7 +68,8 @@
68
68
  "rimraf": "6.1.2",
69
69
  "gaxios": {
70
70
  "rimraf": "6.1.2"
71
- }
71
+ },
72
+ "hono": "4.12.7"
72
73
  },
73
74
  "optionalDependencies": {
74
75
  "@mariozechner/clipboard": "^0.3.2"