iosm-cli 0.2.4 → 0.2.6

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 (66) hide show
  1. package/CHANGELOG.md +60 -0
  2. package/README.md +447 -285
  3. package/dist/core/agent-profiles.d.ts +1 -0
  4. package/dist/core/agent-profiles.d.ts.map +1 -1
  5. package/dist/core/agent-profiles.js +10 -6
  6. package/dist/core/agent-profiles.js.map +1 -1
  7. package/dist/core/agent-session.d.ts +1 -1
  8. package/dist/core/agent-session.d.ts.map +1 -1
  9. package/dist/core/agent-session.js +6 -2
  10. package/dist/core/agent-session.js.map +1 -1
  11. package/dist/core/agent-teams.d.ts.map +1 -1
  12. package/dist/core/agent-teams.js +90 -19
  13. package/dist/core/agent-teams.js.map +1 -1
  14. package/dist/core/footer-data-provider.d.ts +6 -1
  15. package/dist/core/footer-data-provider.d.ts.map +1 -1
  16. package/dist/core/footer-data-provider.js +9 -0
  17. package/dist/core/footer-data-provider.js.map +1 -1
  18. package/dist/core/parallel-task-agent.d.ts +23 -1
  19. package/dist/core/parallel-task-agent.d.ts.map +1 -1
  20. package/dist/core/parallel-task-agent.js +110 -20
  21. package/dist/core/parallel-task-agent.js.map +1 -1
  22. package/dist/core/shared-memory.d.ts +16 -2
  23. package/dist/core/shared-memory.d.ts.map +1 -1
  24. package/dist/core/shared-memory.js +283 -91
  25. package/dist/core/shared-memory.js.map +1 -1
  26. package/dist/core/singular.d.ts.map +1 -1
  27. package/dist/core/singular.js +3 -1
  28. package/dist/core/singular.js.map +1 -1
  29. package/dist/core/subagents.d.ts +1 -1
  30. package/dist/core/subagents.d.ts.map +1 -1
  31. package/dist/core/subagents.js +11 -3
  32. package/dist/core/subagents.js.map +1 -1
  33. package/dist/core/swarm/planner.d.ts.map +1 -1
  34. package/dist/core/swarm/planner.js +200 -12
  35. package/dist/core/swarm/planner.js.map +1 -1
  36. package/dist/core/swarm/scheduler.d.ts +2 -0
  37. package/dist/core/swarm/scheduler.d.ts.map +1 -1
  38. package/dist/core/swarm/scheduler.js +87 -6
  39. package/dist/core/swarm/scheduler.js.map +1 -1
  40. package/dist/core/system-prompt.d.ts.map +1 -1
  41. package/dist/core/system-prompt.js +1 -0
  42. package/dist/core/system-prompt.js.map +1 -1
  43. package/dist/core/tools/ast-grep.d.ts.map +1 -1
  44. package/dist/core/tools/ast-grep.js +2 -0
  45. package/dist/core/tools/ast-grep.js.map +1 -1
  46. package/dist/core/tools/shared-memory.d.ts.map +1 -1
  47. package/dist/core/tools/shared-memory.js +79 -11
  48. package/dist/core/tools/shared-memory.js.map +1 -1
  49. package/dist/core/tools/task.d.ts +12 -1
  50. package/dist/core/tools/task.d.ts.map +1 -1
  51. package/dist/core/tools/task.js +1023 -76
  52. package/dist/core/tools/task.js.map +1 -1
  53. package/dist/core/tools/yq.d.ts.map +1 -1
  54. package/dist/core/tools/yq.js +2 -0
  55. package/dist/core/tools/yq.js.map +1 -1
  56. package/dist/modes/interactive/components/footer.d.ts.map +1 -1
  57. package/dist/modes/interactive/components/footer.js +2 -1
  58. package/dist/modes/interactive/components/footer.js.map +1 -1
  59. package/dist/modes/interactive/interactive-mode.d.ts +13 -0
  60. package/dist/modes/interactive/interactive-mode.d.ts.map +1 -1
  61. package/dist/modes/interactive/interactive-mode.js +881 -74
  62. package/dist/modes/interactive/interactive-mode.js.map +1 -1
  63. package/docs/cli-reference.md +4 -0
  64. package/docs/interactive-mode.md +2 -0
  65. package/docs/orchestration-and-subagents.md +5 -0
  66. package/package.json +1 -1
package/README.md CHANGED
@@ -1,394 +1,556 @@
1
- <h1 align="center">IOSM CLI v0.2.4</h1>
1
+ <div align="center">
2
2
 
3
- <p align="center">
4
- <strong>AI Engineering Runtime for Professional Developers</strong>
5
- </p>
6
- <p align="center">
7
- Interactive coding agent · IOSM methodology · MCP · Semantic Search · Checkpoints · Subagent orchestration · Extensions
8
- </p>
3
+ <h1>IOSM CLI</h1>
4
+
5
+ <p><strong>Terminal-native AI runtime for controlled, measurable engineering work on real codebases.</strong></p>
9
6
 
10
- <p align="center">
11
- <a href="https://www.npmjs.com/package/iosm-cli"><img alt="npm version" src="https://img.shields.io/npm/v/iosm-cli?style=flat-square&color=cb3837"></a>
12
- <a href="https://www.npmjs.com/package/iosm-cli"><img alt="npm downloads" src="https://img.shields.io/npm/dm/iosm-cli?style=flat-square"></a>
7
+ <p>
8
+ <a href="https://www.npmjs.com/package/iosm-cli"><img alt="npm version" src="https://img.shields.io/npm/v/iosm-cli?style=flat-square&color=cb3837&logo=npm"></a>
9
+ <a href="https://www.npmjs.com/package/iosm-cli"><img alt="npm downloads" src="https://img.shields.io/npm/dm/iosm-cli?style=flat-square&logo=npm"></a>
13
10
  <a href="https://opensource.org/licenses/MIT"><img alt="License: MIT" src="https://img.shields.io/badge/license-MIT-blue?style=flat-square"></a>
14
- <img alt="Node.js" src="https://img.shields.io/badge/node-%3E%3D20.6.0-brightgreen?style=flat-square&logo=node.js">
15
- <a href="https://github.com/rokoss21/iosm-cli"><img alt="GitHub" src="https://img.shields.io/badge/github-rokoss21%2Fiosm--cli-black?style=flat-square&logo=github"></a>
11
+ <img alt="Node.js" src="https://img.shields.io/badge/node-%3E%3D20.6.0-brightgreen?style=flat-square&logo=node.js&logoColor=white">
12
+ <a href="https://github.com/rokoss21/iosm-cli"><img alt="GitHub Stars" src="https://img.shields.io/github/stars/rokoss21/iosm-cli?style=flat-square&logo=github"></a>
16
13
  </p>
17
14
 
18
- <p align="center">
19
- <img src="./docs/assets/preview.jpg" alt="IOSM CLI terminal preview">
15
+ <p>
16
+ <a href="#-quick-start">Quick Start</a> ·
17
+ <a href="#-the-iosm-methodology">Methodology</a> ·
18
+ <a href="#-usage-patterns">Usage Patterns</a> ·
19
+ <a href="#-agent-profiles">Profiles</a> ·
20
+ <a href="#-documentation">Documentation</a>
20
21
  </p>
21
22
 
23
+ <img src="./docs/assets/preview.jpg" alt="IOSM CLI terminal preview" width="860">
24
+
25
+ </div>
26
+
27
+ ---
28
+
29
+ Most AI CLIs are optimized for conversation. **IOSM CLI is optimized for controlled engineering execution** — working directly against your filesystem and shell, orchestrating parallel agents across complex tasks, tracking metrics and artifacts over time, and running improvement cycles that can be audited, repeated, and benchmarked.
30
+
31
+ It is not a chat interface. It is a runtime.
32
+
22
33
  ---
23
34
 
24
- **IOSM CLI** (`iosm-cli`) is not a chat wrapper around an LLM.
35
+ ## Table of Contents
36
+
37
+ - [What You Get](#-what-you-get)
38
+ - [The IOSM Methodology](#-the-iosm-methodology)
39
+ - [Quick Start](#-quick-start)
40
+ - [Usage Patterns](#-usage-patterns)
41
+ - [Agent Profiles](#-agent-profiles)
42
+ - [Complex Change Workflow](#-complex-change-workflow)
43
+ - [Integration Modes](#-integration-modes)
44
+ - [Extensibility](#-extensibility)
45
+ - [Configuration](#-configuration)
46
+ - [Architecture](#-architecture)
47
+ - [Documentation](#-documentation)
48
+ - [Development](#-development)
49
+ - [Contributing](#-contributing)
50
+ - [License](#-license)
25
51
 
26
- It is a runtime for production codebases:
27
- - a terminal-native coding agent with direct filesystem and shell tooling
28
- - primary operating profiles: **full** (default), **meta** (orchestration-first), and **iosm** (advanced, methodology-driven engineering cycles)
29
- - swarm-first orchestration for complex tasks: `Scopes -> Touches -> Locks -> Gates -> Done`, continuous dispatch, retries, checkpoints
30
- - built-in semantic embeddings search (`semantic_search` tool + `/semantic` + `iosm semantic`)
31
- - repeatable codebase improvement workflows via **IOSM** (Improve -> Optimize -> Shrink -> Modularize)
32
- - auditable artifact history for cycles, decisions, and metric evolution across runs
33
- - operational controls for safe iteration (`/checkpoint`, `/rollback`, `/doctor`, `/memory`)
34
- - extensibility for teams (MCP + extensions) and embedding (SDK + JSON/RPC modes)
52
+ ---
53
+
54
+ ## What You Get
35
55
 
36
- Adoption path is layered: start in **full** profile for low-friction daily usage, switch to **meta** when tasks benefit from adaptive multi-agent orchestration, then use **iosm** profile when you need advanced IOSM cycles, metrics, and governance.
56
+ | Area | Capability |
57
+ |------|-----------|
58
+ | **Everyday coding** | Interactive terminal session with file, search, edit, and shell tools |
59
+ | **Operational safety** | `/checkpoint`, `/rollback`, `/doctor`, granular permission controls |
60
+ | **Complex changes** | `/contract` → `/singular` → `/swarm` — deterministic execution with locks and gates |
61
+ | **Codebase understanding** | Semantic search, repository-scale indexing, project memory |
62
+ | **Multi-agent work** | Parallel subagents with shared memory and consistency model |
63
+ | **Methodology** | IOSM cycles: measurable improvement with metrics, evidence, and artifact history |
64
+ | **Integrations** | Interactive TUI, print mode, JSON event stream, JSON-RPC server, TypeScript SDK |
65
+ | **Extensibility** | MCP servers, TypeScript extensions, Markdown skills, prompt templates, themes |
37
66
 
38
- ## Why It Exists
67
+ ---
39
68
 
40
- Most AI CLIs optimize for conversation.
41
- **IOSM CLI** optimizes for engineering execution quality.
69
+ ## The IOSM Methodology
42
70
 
43
- | Area | Typical AI CLI | IOSM CLI |
44
- |------|----------------|------------|
45
- | Workflow | Prompt-by-prompt | Structured session + IOSM cycles |
46
- | Safety | Basic confirmations | Checkpoints, rollback, diagnostics, permission policies |
47
- | Context ops | Ad hoc notes | Managed memory with interactive edit/remove |
48
- | Tooling | Built-ins only | Built-ins + MCP + extension tools |
49
- | Integrations | Mostly interactive only | Interactive + print + JSON + JSON-RPC + SDK |
71
+ IOSM **Improve, Optimize, Shrink, Modularize** is an algorithmic methodology for systematic engineering improvement. It transforms ad-hoc refactoring into a reproducible, measurable process.
50
72
 
51
- ## Compared to Other Tools
73
+ **Four mandatory phases executed in strict order:**
52
74
 
53
- This is not a “better/worse” claim. It is a positioning map so teams can choose the right tool for the job.
75
+ ```
76
+ Improve → Optimize → Shrink → Modularize
77
+ ```
54
78
 
55
- | Tool | Typical Strength | Typical Mode | IOSM CLI Difference |
56
- |------|------------------|--------------|------------------------|
57
- | **Claude Code** | Strong conversational coding flow | Terminal conversation | Adds structured IOSM cycles + explicit checkpoint/rollback/doctor workflow |
58
- | **OpenCode** | Lightweight open-source coding assistant | Terminal-first iteration | Emphasizes repeatable engineering process and quality-gated cycles |
59
- | **Cursor** | Excellent IDE-native editing and inline assistance | IDE-first | Keeps workflow in terminal with agent tooling, MCP, and scriptable runtime modes |
60
- | **Gemini CLI** | Fast Gemini-centric command-line assistance | CLI prompts and tasks | Provider-agnostic runtime + IOSM methodology + deeper operational controls |
61
- | **IOSM CLI** | Structured engineering execution | Terminal runtime + methodology | Designed for reproducible refactors, diagnostics, memory, and cycle artifacts |
79
+ | Phase | Focus |
80
+ |-------|-------|
81
+ | **Improve** | Eliminate defects, inconsistencies, and technical debt |
82
+ | **Optimize** | Reduce resource usage, latency, and execution cost |
83
+ | **Shrink** | Minimize code surface delete dead code, compress abstractions |
84
+ | **Modularize** | Extract cohesive components, enforce dependency hygiene |
62
85
 
63
- ## Who It Is For
86
+ **Six canonical metrics** track progress across every phase:
64
87
 
65
- - developers at any level: start in **full** profile and be productive quickly
66
- - teams that need adaptive multi-agent execution with strict verification closure via **meta** profile
67
- - advanced engineers and tech leads using **iosm** mode for high-risk refactors and system-level change
68
- - teams that need auditability, rollback, and repeatable improvement history
69
- - platform/backend teams that operationalize AI coding into reliable workflows
70
- - teams building internal coding automation on top of a CLI runtime
88
+ | Metric | Measures |
89
+ |--------|----------|
90
+ | `semantic` | Code clarity naming, comments, structure readability |
91
+ | `logic` | Correctness test coverage, error handling, invariants |
92
+ | `performance` | Runtime efficiency latency, throughput, resource usage |
93
+ | `simplicity` | Cognitive load cyclomatic complexity, abstraction depth |
94
+ | `modularity` | Dependency health — coupling, cohesion, interface clarity |
95
+ | `flow` | Delivery velocity — CI reliability, deploy frequency, lead time |
71
96
 
72
- ## Install
97
+ Metrics can be derived automatically or attached as evidence during IOSM cycles.
98
+
99
+ **The IOSM-Index** aggregates all six metrics into a single weighted health score. Every cycle produces a baseline, hypothesis cards, evidence trails, and a final report — stored in `.iosm/` for permanent project history.
100
+
101
+ Quality gates after each phase enforce progression: a phase cannot close if any guardrail is breached.
102
+
103
+ > Full specification: [iosm-spec.md](./iosm-spec.md) · Canonical repository: [github.com/rokoss21/IOSM](https://github.com/rokoss21/IOSM)
104
+
105
+ ---
106
+
107
+ ## ✦ Quick Start
108
+
109
+ ### 1. Install
73
110
 
74
111
  ```bash
75
112
  npm install -g iosm-cli
76
113
  iosm --version
77
114
  ```
78
115
 
79
- Requirements:
80
- - Node.js `>=20.6.0`
81
- - provider auth (environment variable API key and/or `/login`)
82
- - `/login` now includes the full `models.dev` provider catalog; `/model` loads available models for authenticated providers
83
-
84
- ### Recommended CLI Toolchain (for maximum efficiency)
85
-
86
- `iosm-cli` ships managed fallback for `rg` and `fd`, but best performance comes from system-installed tooling, especially for large repos.
116
+ **Requirements:** Node.js `>=20.6.0` · at least one authenticated model provider
87
117
 
88
- Tools used by advanced search/analysis workflows:
89
- - `rg`, `fd`, `ast-grep` (`sg`), `comby`, `jq`, `yq`, `semgrep`, `sed`
118
+ No global install? Use `npx`:
90
119
 
91
- macOS (Homebrew):
92
120
  ```bash
93
- brew install ripgrep fd ast-grep comby jq yq semgrep
121
+ npx iosm-cli --version
94
122
  ```
95
123
 
96
- Ubuntu/Debian:
97
- ```bash
98
- sudo apt-get update
99
- sudo apt-get install -y ripgrep fd-find jq yq sed
124
+ ### 2. Configure a provider
125
+
126
+ The fastest path is interactive setup inside the app:
100
127
 
101
- # optional but recommended:
102
- # semgrep: pipx install semgrep
103
- # ast-grep: npm i -g @ast-grep/cli
104
- # comby: see https://comby.dev/docs/installation
128
+ ```
129
+ iosm
130
+ /login ← OAuth or API key (models.dev catalog)
131
+ /model ← pick your model
105
132
  ```
106
133
 
107
- Check availability quickly:
134
+ Or set an environment variable before launching:
135
+
108
136
  ```bash
109
- iosm
110
- /doctor
137
+ export ANTHROPIC_API_KEY="sk-ant-..." # Claude (recommended)
138
+ export OPENAI_API_KEY="sk-..." # GPT models
139
+ export GEMINI_API_KEY="AI..." # Gemini
140
+ export GROQ_API_KEY="gsk_..." # Groq
141
+ # Also supported: OpenRouter, Mistral, xAI, Cerebras, AWS Bedrock
111
142
  ```
112
143
 
113
- ## 60-Second Start
144
+ ### 3. Run your first session
114
145
 
115
146
  ```bash
116
- # 1) Open project and start CLI
117
- cd /path/to/repo
147
+ cd /path/to/your/project
148
+
149
+ # Interactive mode
118
150
  iosm
151
+
152
+ # Or one-shot without entering the TUI
153
+ iosm -p "Summarize the repository architecture"
119
154
  ```
120
155
 
121
- Inside the session (full profile):
122
- ```text
123
- /login # or /auth: configure credentials (OAuth + API key providers from models.dev)
124
- /model # select active provider/model from currently authenticated providers
125
- <your task> # start working immediately
156
+ Inside interactive mode:
157
+ ```
158
+ Review the repository structure and summarize the architecture.
126
159
  ```
127
160
 
128
- When you need advanced IOSM workflow:
129
- ```text
130
- Shift+Tab # switch profile to iosm
131
- /init # bootstrap IOSM workspace
132
- /iosm 0.95 --max-iterations 5
161
+ ### 4. Optional enhanced search toolchain
162
+
163
+ Works without these, but large repositories benefit significantly:
164
+
165
+ ```bash
166
+ # macOS
167
+ brew install ripgrep fd ast-grep comby jq yq semgrep
168
+
169
+ # Ubuntu / Debian
170
+ sudo apt-get install -y ripgrep fd-find jq yq sed
133
171
  ```
134
172
 
135
- Core commands to unlock full runtime value:
136
- - direct prompt to main agent — default for simple tasks (single-agent flow)
137
- - `/orchestrate` — manual legacy multi-agent orchestration (explicit team-run control)
138
- - `/swarm` — recommended multi-agent orchestration runtime for complex/risky changes (`run`, `from-singular`, `watch`, `retry`, `resume`)
139
- - `/init` + `/iosm` — execute measurable IOSM cycles with artifacts and quality gates
140
- - `/mcp` — connect external tool ecosystems in interactive UI
141
- - `/semantic` — configure semantic provider, build/rebuild embeddings index, run meaning-based retrieval
142
- - `/memory` — persist project facts and constraints across sessions
173
+ Run `/doctor` to check your environment at any time.
143
174
 
144
- ## Real-World Example: Swarm-First IOSM Refactor
175
+ ---
145
176
 
146
- ```console
147
- $ iosm
148
- IOSM CLI v0.2.4 [full]
177
+ ## ✦ Usage Patterns
149
178
 
150
- you> /singular Refactor auth and split session handling from token validation
151
- iosm> Option 1 selected
152
- iosm> Start with Swarm (Recommended)
153
- iosm> /swarm from-singular 2026-03-10-210201 --option 1
154
- iosm> Swarm run started: swarm_1741632000000_ab12cd
155
- iosm> status: running (ready/running/blocked/done visible via /swarm watch)
156
- iosm> Touches -> Locks -> Gates pipeline completed
157
- iosm> integration report written to .iosm/orchestrate/swarm_1741632000000_ab12cd/reports/
179
+ ### Daily coding and repository work
158
180
 
159
- iosm> switch profile: iosm (Shift+Tab)
160
- iosm> /init
161
- iosm> IOSM workspace initialized
162
- iosm> /iosm 0.95 --max-iterations 5
181
+ Default `full` profile. Works on any codebase without prior setup.
163
182
 
164
- iosm> Baseline captured
165
- iosm> Planned cycle from team artifacts: simplify auth module
166
- iosm> Running improve -> verify -> optimize loop
167
- iosm> Result: simplicity +18%, modularity +11%, performance +6%
168
- iosm> Artifacts written to .iosm/cycles/2026-03-10-001/
183
+ ```bash
184
+ iosm
169
185
  ```
170
186
 
171
- For plain-language execution without `/singular`:
187
+ Common tasks:
188
+ - implement or refactor features
189
+ - read, search, and edit files with full shell access
190
+ - review architecture or explore unfamiliar modules
191
+ - resume previous sessions: `/resume`, `/fork`, `/tree`
192
+ - keep persistent notes: `/memory`
193
+
194
+ One-shot tasks skip the interactive TUI entirely:
172
195
 
173
196
  ```bash
174
- /swarm run "Refactor auth and reduce integration risk" --max-parallel 3 --budget-usd 12
197
+ iosm -p "Audit src/ for unused exports"
198
+ iosm @README.md @src/main.ts -p "Explain the CLI entry points"
199
+ iosm --tools read,grep,find -p "Find all TODO comments in src/"
175
200
  ```
176
201
 
177
- ## Architecture Overview
202
+ ---
203
+
204
+ ### Read-only planning and review
178
205
 
179
- `IOSM CLI` is layered so execution stays controllable as task complexity grows:
206
+ Use `plan` when you want architecture analysis or code review without any writes.
180
207
 
181
- ```text
182
- Providers (built-ins + full models.dev catalog)
183
-
184
- Auth + Model Selection (/login, /model)
185
-
186
- Agent Runtime (interactive + JSON + JSON-RPC + SDK)
187
-
188
- Tooling Layer (read/edit/bash + search/structural/data/security tools + MCP tools)
189
-
190
- Swarm Runtime (/swarm run|from-singular|watch|retry|resume)
191
-
192
- IOSM Layer (/init, /iosm cycles, metrics, governance)
193
-
194
- Artifacts + Memory (.iosm/cycles/*, checkpoints, /memory state)
208
+ ```bash
209
+ iosm --profile plan
195
210
  ```
196
211
 
197
- ## Design Principles
212
+ The agent is restricted to read-only tools. Nothing can be written to disk. Useful for code review, architecture audits, or exploring a codebase you are unfamiliar with before making changes.
198
213
 
199
- - **AI executes structured engineering loops, not ad hoc chats.** Core flow for risky tasks is ` /singular -> /contract -> /swarm -> /iosm `.
200
- - **Complex work needs controlled execution.** Swarm applies `Scopes -> Touches -> Locks -> Gates -> Done` with continuous dispatch and bounded retries.
201
- - **Refactoring must be measurable.** IOSM cycles capture baseline, hypotheses, and metric deltas instead of untracked edits.
202
- - **Every important run must be auditable.** Artifacts and memory preserve decisions and outcomes across sessions.
203
- - **Adoption should be progressive.** Start in `full` profile for speed, use `meta` for orchestration-first execution, and move to `iosm` for advanced cycles and governance when needed.
214
+ ---
215
+
216
+ ### Complex or risky engineering changes
204
217
 
205
- ## Operating Profiles
218
+ Define constraints → analyze options → execute with guardrails:
206
219
 
207
- `IOSM CLI` has a layered operating model:
220
+ ```
221
+ /contract
222
+ /singular Refactor auth module, split token validation from session management
223
+ ```
208
224
 
209
- | Profile | Best For | What `/init` Does | Advanced Command |
210
- |------|----------|-------------------|------------------|
211
- | **full** (default) | Daily coding for any level | Generates/updates `AGENTS.md` from real repo scan and prepares `.iosm/agents/` | Use `/swarm` (canonical) and built-in tools directly |
212
- | **meta** (orchestration-first) | Adaptive agent/delegate execution with verification gates | Same initialization behavior as full profile | `iosm --profile meta` |
213
- | **iosm** (advanced) | High-risk refactors and system-level engineering loops | Bootstraps full IOSM workspace (`iosm.yaml`, `IOSM.md`, `.iosm/cycles/...`) with optional agent verification | `/iosm [target-index] [--max-iterations N] [--force-init]` |
225
+ `/singular` produces three implementation options with trade-off analysis. Select one, then choose **Start with Swarm** to hand off to the execution runtime.
214
226
 
215
- ### Modes At A Glance
227
+ > `/swarm` will not start without an active `/contract`. If none exists, it prompts you to draft one automatically.
216
228
 
217
- | Mode/Profile | Use It When | Avoid It When |
218
- |------|-------------|----------------|
219
- | **full** | You want direct coding help and implementation speed | You need strict multi-workstream orchestration contracts |
220
- | **meta** | You need orchestration-first execution (parallel task/delegate graph + synthesis + verification closure) | You only need casual chat or lightweight Q&A |
221
- | **iosm** | You run IOSM cycles with metrics, artifacts, and governance | You only need quick one-off coding support |
222
- | **plan** | You need read-only architecture/planning/review | You are ready to edit and execute changes |
229
+ The swarm runtime then executes with locks, gates, retries, and checkpoints, writing per-run artifacts under `.iosm/orchestrate/<run-id>/`.
223
230
 
224
- ### META Model Requirements (Important)
231
+ Monitor and control the run:
225
232
 
226
- For strong `meta` orchestration quality, use modern high-capability models with:
227
- - large context windows (prefer `>=128k`, ideally `>=200k`)
228
- - high output token limits
229
- - reliable long-run tool-calling behavior
233
+ ```
234
+ /swarm watch ← live status
235
+ /swarm retry ← retry failed gates
236
+ /swarm resume ← continue interrupted runs
237
+ ```
230
238
 
231
- Why this matters:
232
- - `meta` mode keeps orchestration contracts, task plans, delegate outputs, and synthesis in context
233
- - small/legacy models are more likely to stop early, under-delegate, or lose orchestration constraints
234
- - model capability directly affects orchestration stability and output quality
239
+ ---
235
240
 
236
- Practical recommendation:
237
- - for conversational use, switch to `full` (Shift+Tab)
238
- - for complex orchestration in `meta`, pick your strongest available model via `/model`
241
+ ### Measurable codebase improvement (IOSM cycles)
239
242
 
240
- Typical advanced flow:
243
+ Use the `iosm` profile for structured improvement with metric tracking and artifact history.
241
244
 
242
245
  ```bash
243
246
  iosm --profile iosm
247
+ ```
248
+
249
+ Bootstrap the workspace once:
250
+
251
+ ```
244
252
  /init
253
+ ```
254
+
255
+ Run a full improvement cycle targeting an IOSM-Index of 0.95:
256
+
257
+ ```
245
258
  /iosm 0.95 --max-iterations 5
246
259
  ```
247
260
 
248
- ## Swarm-First Execution
261
+ Or use CLI subcommands:
262
+
263
+ ```bash
264
+ iosm init # bootstrap .iosm/ workspace
265
+ iosm cycle plan "Reduce auth complexity" "Improve test coverage"
266
+ iosm cycle status # check phase progress and gate results
267
+ iosm cycle report # full JSON report
268
+ iosm cycle list # history of all cycles
269
+ ```
270
+
271
+ Artifacts are written to `.iosm/cycles/<cycle-id>/` — baselines, hypothesis cards, phase data, and final reports.
272
+
273
+ ---
274
+
275
+ ## ✦ Agent Profiles
276
+
277
+ Profiles control tool access, thinking level, and behavioral guidance injected into the model's system prompt.
278
+
279
+ **Primary profiles** — operator-facing:
249
280
 
250
- For complex/risky work, use the canonical swarm runtime instead of one monolithic prompt.
281
+ | Profile | Best for | Tool access | Thinking |
282
+ |---------|----------|-------------|----------|
283
+ | `full` | General engineering (default) | Full toolset | Medium |
284
+ | `meta` | Orchestration-first, parallel delegation | Full toolset | Medium |
285
+ | `iosm` | IOSM cycles, artifact-aware refactoring | Full + IOSM context | Medium |
286
+ | `plan` | Read-only planning and code review | Read-only | Medium |
251
287
 
252
- Default routing rule:
253
- - simple tasks -> direct prompt to one agent
254
- - manual legacy multi-agent split -> `/orchestrate`
255
- - complex/risky changes (multi-agent orchestration level) -> `/swarm`
288
+ **Specialist profiles** — for subagent delegation and targeted work:
256
289
 
257
- `/swarm` supports:
258
- - contract-bound execution (run blocks until effective `/contract` exists)
259
- - run-level parallel workers via `--max-parallel` (1..20)
260
- - continuous dispatch over DAG tasks (ready -> locks -> gates -> checkpoint)
261
- - intra-task parallelism: one swarm task can fan out to delegated subagents (up to 10) when beneficial
262
- - run-scoped shared memory (`shared_memory_write` / `shared_memory_read`) across tasks and delegates that share the same `run_id`
263
- - standalone `task` executions auto-generate internal `run_id/task_id`, enabling shared memory for root + delegates without manual IDs
264
- - hierarchical touches-based locking and lock downgrade
265
- - task gates + run gates separation
266
- - retries by taxonomy (`permission`, `dependency/import`, `test`, `timeout`, `unknown`)
267
- - checkpoints/recovery (`/swarm resume`) and focused retries (`/swarm retry`)
268
- - scheduler guards (`progress heuristic` + `conflict density guard`) for stable throughput under contention
269
- - high-risk spawn candidates require explicit confirmation during run
290
+ | Profile | Best for | Tool access | Thinking |
291
+ |---------|----------|-------------|----------|
292
+ | `explore` | Fast codebase exploration (no writes) | Read, grep, find, ls | Off |
293
+ | `iosm_analyst` | Reading `.iosm/` artifacts, reporting | Read-only | Low |
294
+ | `iosm_verifier` | Verifying changes, updating `.iosm/` | bash, read, write | Low |
295
+ | `cycle_planner` | Planning IOSM cycles, writing hypotheses | bash, read, write | Medium |
270
296
 
271
- Example:
297
+ Select at startup:
272
298
 
273
299
  ```bash
274
- /swarm run "Improve auth reliability and performance with verification gates" \
275
- --max-parallel 3 \
276
- --budget-usd 15
300
+ iosm --profile plan
301
+ iosm --profile iosm
302
+ ```
303
+
304
+ Switch during a session: **Shift+Tab** (cycles through primary profiles), or select via the TUI.
305
+
306
+ > `meta` prioritizes orchestration and delegation over direct execution. Strong results require a capable model with a large context window and reliable tool-calling. For ordinary sessions, `full` is the better default.
307
+
308
+ ---
309
+
310
+ ## ✦ Complex Change Workflow
311
+
312
+ For non-trivial changes, the recommended path is a controlled progression rather than a single giant prompt.
313
+
314
+ ```mermaid
315
+ flowchart LR
316
+ A[Goal] --> B[/contract]
317
+ B --> C[/singular]
318
+ C --> D[/swarm]
319
+ D --> E[Verified changes]
320
+ E --> F[/iosm cycle]
321
+ F --> G[Artifacts + history]
277
322
  ```
278
323
 
279
- Bridge from decision mode:
324
+ **Step-by-step:**
325
+
326
+ 1. **Define scope** — `/contract` sets what is in scope, what is protected, and what model behavior is expected
327
+ 2. **Analyze options** — `/singular <request>` produces three implementation plans with trade-off analysis
328
+ 3. **Execute with guardrails** — `/swarm run <task>` enforces a deterministic control model:
329
+ ```
330
+ Scopes → Touches → Locks → Gates → Done
331
+ ```
332
+ 4. **Measure** — follow with `/iosm` to capture metric changes as part of a formal cycle
333
+
334
+ Run artifacts: `.iosm/orchestrate/<run-id>/` — run state, DAG, checkpoints, events, final report.
335
+
336
+ ---
337
+
338
+ ## ✦ Integration Modes
339
+
340
+ | Mode | Use case | How |
341
+ |------|----------|-----|
342
+ | **Interactive TUI** | Daily engineering work | `iosm` |
343
+ | **Print mode** | One-shot tasks, shell scripts | `iosm -p "..."` |
344
+ | **CI / automation** | Contract-driven runs inside pipelines | `iosm -p "..."` — exits non-zero on failure |
345
+ | **JSON stream** | Machine-readable event output | `iosm --mode json -p "..."` |
346
+ | **RPC server** | IDE / editor integration | `iosm --mode rpc --no-session` |
347
+ | **TypeScript SDK** | Embed the runtime in your own application | `createAgentSession()` |
280
348
 
281
349
  ```bash
282
- /singular "Refactor auth and split session handling from token validation"
283
- # choose option -> Start with Swarm (Recommended)
284
- ```
285
-
286
- ## Core Commands
287
-
288
- | Workflow Step | Command | Why It Matters |
289
- |------|---------|----------------|
290
- | Start clean context | `/new` or `/clear` | Reset session state before a new task or after context drift |
291
- | Configure auth | `/login` or `/auth` | Set OAuth/API key credentials with guided flow from full models.dev provider catalog |
292
- | Select active model | `/model` | Choose provider/model from available authenticated providers |
293
- | Launch controlled execution | `/swarm run ...` | Execute complex tasks with contract boundaries, locks, gates, retries, and checkpoints |
294
- | Bridge decision to execution | `/swarm from-singular ...` | Apply selected `/singular` option under effective contract policy |
295
- | Legacy orchestration | `/orchestrate --parallel ...` | Keep previous team-run flow when you explicitly need legacy semantics |
296
- | Initialize IOSM workspace | `/init` | Bootstrap/update IOSM files and cycle workspace |
297
- | Run IOSM cycle | `/iosm [target-index] [--max-iterations N]` | Execute measurable improve/verify loops with artifact output |
298
- | Track swarm runs | `/swarm watch`, `/swarm resume`, `/swarm retry` | Observe state, resume checkpoints, and recover failed tasks |
299
- | Manage MCP servers | `/mcp` | Inspect/add/enable external tool servers interactively |
300
- | Manage semantic search | `/semantic` | Configure provider with auto model discovery (OpenRouter/Ollama), index codebase, query by intent/meaning |
301
- | Define engineering contract | `/contract` | Field-by-field interactive contract editor with auto-save and automatic JSON generation |
302
- | Analyze feasibility variants | `/singular <feature request>` | Runs baseline + standard agent pass, then returns 3 implementation options and recommendation |
303
- | Manage memory | `/memory` | Add/edit/remove persistent project facts and constraints |
304
- | Save/restore state | `/checkpoint` / `/rollback` | Safe experimentation with fast rollback |
305
- | Diagnose runtime | `/doctor` | Verify model/auth/MCP/resources when behavior is inconsistent |
306
- | Manage settings | `/settings` | Tune runtime defaults and operational preferences |
307
-
308
- ## Decision Workflow: `/contract` + `/singular`
309
-
310
- ### `/contract` (interactive contract manager)
311
-
312
- - No manual JSON editing in terminal.
313
- - You edit fields directly (`goal`, `scope_include`, `scope_exclude`, `constraints`, `quality_gates`, `definition_of_done`, `risks`, and additional planning fields).
314
- - Press `Enter` on a field value and it is saved immediately.
315
- - Contract JSON is built automatically.
316
-
317
- Key manager actions:
318
- - `Open effective contract` = read merged runtime contract (`project + session`).
319
- - `Edit session contract` = temporary overlay for current session only.
320
- - `Edit project contract` = persistent baseline in `.iosm/contract.json`.
321
-
322
- ### `/singular <request>` (feature feasibility analyzer)
323
-
324
- - Command-first flow: write request, run analysis, receive decision options.
325
- - Uses standard agent-style repository run (not static form output), then merges with baseline repository scan.
326
- - Produces exactly 3 options:
327
- - `Option 1`: practical implementation path (usually recommended).
328
- - `Option 2`: alternative strategy with different trade-offs.
329
- - `Option 3`: defer/do-not-implement-now path.
330
- - Each option includes affected files, step-by-step plan, risks, and when-to-choose guidance.
331
- - User selects `1/2/3`, then chooses `Start with Swarm` or `Continue without Swarm`.
332
- - `Start with Swarm` executes selected option via `/swarm from-singular ...` under effective `/contract`.
333
-
334
- Legacy note:
335
- - `/blast` and `/shadow` are removed from active workflow.
336
- - Use `/singular` for feasibility decisions and `/contract` for engineering constraints.
337
-
338
- ## IOSM In One Line
339
-
340
- **IOSM** gives you a repeatable loop for improving codebases with explicit quality gates, metrics, and artifact history instead of one-off AI edits.
341
-
342
- Quick start:
350
+ # Print mode one-shot task
351
+ iosm -p "Review src/auth.ts for security issues"
352
+
353
+ # Constrain which tools are available
354
+ iosm --tools read,grep,find,ls -p "Audit src/ for dead code"
355
+
356
+ # Pre-load files as context
357
+ iosm @src/main.ts @src/core/sdk.ts -p "Explain the session lifecycle"
358
+
359
+ # JSON stream for programmatic consumption
360
+ iosm --mode json -p "Summarize the repository" | jq -r 'select(.type=="text_delta") | .delta'
361
+
362
+ # RPC server for editor integrations
363
+ iosm --mode rpc --no-session
364
+ ```
365
+
366
+ ---
367
+
368
+ ## Extensibility
369
+
370
+ `iosm-cli` acts as a runtime platform rather than a closed CLI tool. Every layer is open to extension.
371
+
372
+ ### Extension surfaces
373
+
374
+ | Surface | Capability |
375
+ |---------|-----------|
376
+ | **MCP servers** | Connect external services as tools (user-level or project-level via `.mcp.json`) |
377
+ | **TypeScript extensions** | Custom tools, slash commands, hooks, UI components, provider adapters |
378
+ | **Markdown skills** | Reusable multi-step workflows as slash commands |
379
+ | **Prompt templates** | Parameterized prompts available as slash commands |
380
+ | **JSON themes** | Customize terminal colors and TUI appearance |
381
+
382
+ Install from npm, git, or a local path:
343
383
 
344
384
  ```bash
345
- iosm init
346
- iosm cycle plan "reduce API latency" "simplify auth module"
347
- iosm cycle status
348
- iosm cycle report
385
+ iosm install npm:@yourorg/your-extension
386
+ iosm install git:github.com/yourorg/your-extension@main
387
+ iosm install ./local-extension --local
388
+ iosm list
389
+ iosm update
349
390
  ```
350
391
 
351
- ## Documentation
392
+ ### Included examples
393
+
394
+ - [66 extension examples](./examples/extensions/README.md) — tools, hooks, UI, commands
395
+ - [12 SDK examples](./examples/sdk/README.md) — programmatic session usage
396
+ - [Plan-mode extension](./examples/extensions/plan-mode/README.md)
397
+ - [Subagent orchestration extension](./examples/extensions/subagent/README.md)
398
+
399
+ ---
400
+
401
+ ## ✦ Configuration
402
+
403
+ Settings merge in priority order: **CLI flags** > **project** `.iosm/settings.json` > **global** `~/.iosm/agent/settings.json`.
352
404
 
353
- Use the docs as the source of truth for details.
405
+ ### Key paths
406
+
407
+ ```
408
+ ~/.iosm/agent/
409
+ ├── settings.json # global defaults
410
+ ├── auth.json # provider credentials
411
+ ├── models.json # model configuration
412
+ ├── mcp.json # global MCP servers
413
+ ├── keybindings.json # keyboard shortcuts
414
+ └── sessions/ # session persistence
415
+
416
+ .iosm/ # project workspace (created by /init or iosm init)
417
+ ├── iosm.yaml # methodology config: phases, gates, guardrails, weights
418
+ ├── IOSM.md # auto-generated project playbook
419
+ ├── contract.json # active engineering contract
420
+ ├── cycles/ # IOSM cycle artifacts
421
+ ├── orchestrate/ # swarm run artifacts
422
+ └── settings.json # project overrides
423
+ ```
424
+
425
+ ### Key settings
426
+
427
+ ```json
428
+ {
429
+ "model": {
430
+ "provider": "anthropic",
431
+ "id": "claude-sonnet-4-20250514",
432
+ "thinking": "medium"
433
+ },
434
+ "tools": {
435
+ "enabled": ["read", "bash", "edit", "write", "grep", "rg"],
436
+ "bashTimeout": 30000
437
+ },
438
+ "session": {
439
+ "autoCompact": true,
440
+ "compactThreshold": 100000
441
+ },
442
+ "permissions": {
443
+ "autoApprove": false
444
+ }
445
+ }
446
+ ```
447
+
448
+ Run `/settings` inside the TUI to view and modify all settings interactively.
449
+
450
+ ---
451
+
452
+ ## ✦ Architecture
453
+
454
+ ```
455
+ ┌─────────────────────────────────────────────────────────┐
456
+ │ User │
457
+ │ CLI flags · slash commands · SDK calls │
458
+ └────────────────────────┬────────────────────────────────┘
459
+
460
+ ┌────────────────────────▼────────────────────────────────┐
461
+ │ iosm-cli runtime │
462
+ │ Interactive TUI · Print mode · JSON stream · RPC │
463
+ │ Session persistence · Checkpoints · Contracts │
464
+ └──────────┬──────────────────────────┬───────────────────┘
465
+ │ │
466
+ ┌──────────▼─────────────┐ ┌─────────▼───────────────────┐
467
+ │ Agent engine │ │ Orchestrator │
468
+ │ Model · Profiles │ │ /swarm · /singular · /meta │
469
+ │ Thinking · Tools │ │ Shared memory · Locks │
470
+ └──────────┬─────────────┘ └─────────┬───────────────────┘
471
+ │ │
472
+ ┌──────────▼──────────────────────────▼───────────────────┐
473
+ │ Tool layer │
474
+ │ read · edit · write · bash · grep · rg · fd · ast_grep │
475
+ │ comby · jq · yq · semgrep · sed · semantic_search │
476
+ └─────────────────────────┬───────────────────────────────┘
477
+
478
+ ┌─────────────────────────▼───────────────────────────────┐
479
+ │ Filesystem + Shell │
480
+ │ Project codebase · External processes │
481
+ └─────────────────────────┬───────────────────────────────┘
482
+
483
+ ┌─────────────────────────▼───────────────────────────────┐
484
+ │ Artifacts + IOSM cycles │
485
+ │ .iosm/cycles/ · .iosm/orchestrate/ · sessions/ │
486
+ │ metrics-history.jsonl · decision-log.md │
487
+ └─────────────────────────────────────────────────────────┘
488
+ ```
489
+
490
+ Every layer is independently configurable: tool access per profile, orchestration via swarm or manual delegation, persistence toggleable per session, extension hooks attachable at the tool, command, and event layers of the runtime.
491
+
492
+ ---
493
+
494
+ ## ✦ Documentation
354
495
 
355
496
  | Topic | Link |
356
- |------|------|
497
+ |-------|------|
498
+ | Documentation index | [docs/README.md](./docs/README.md) |
357
499
  | Getting started | [docs/getting-started.md](./docs/getting-started.md) |
358
- | CLI flags and options | [docs/cli-reference.md](./docs/cli-reference.md) |
359
- | Interactive mode (commands, keys, profiles) | [docs/interactive-mode.md](./docs/interactive-mode.md) |
360
- | IOSM init/cycles | [docs/iosm-init-and-cycles.md](./docs/iosm-init-and-cycles.md) |
361
- | MCP, providers, settings | [docs/configuration.md](./docs/configuration.md) |
500
+ | CLI reference | [docs/cli-reference.md](./docs/cli-reference.md) |
501
+ | Interactive mode and slash commands | [docs/interactive-mode.md](./docs/interactive-mode.md) |
502
+ | IOSM init and cycles | [docs/iosm-init-and-cycles.md](./docs/iosm-init-and-cycles.md) |
362
503
  | Orchestration and subagents | [docs/orchestration-and-subagents.md](./docs/orchestration-and-subagents.md) |
363
- | Extensions, packages, themes | [docs/extensions-packages-themes.md](./docs/extensions-packages-themes.md) |
504
+ | Configuration and environment | [docs/configuration.md](./docs/configuration.md) |
505
+ | Extensions, packages, skills, themes | [docs/extensions-packages-themes.md](./docs/extensions-packages-themes.md) |
364
506
  | Sessions, traces, export | [docs/sessions-traces-export.md](./docs/sessions-traces-export.md) |
365
- | JSON/RPC/SDK usage | [docs/rpc-json-sdk.md](./docs/rpc-json-sdk.md) |
366
- | Full docs index | [docs/README.md](./docs/README.md) |
367
- | Full IOSM specification (local) | [iosm-spec.md](./iosm-spec.md) |
368
- | IOSM methodology spec (canonical) | [github.com/rokoss21/IOSM](https://github.com/rokoss21/IOSM) |
369
-
370
- ## Related Repositories
507
+ | JSON stream, RPC, SDK | [docs/rpc-json-sdk.md](./docs/rpc-json-sdk.md) |
508
+ | Development and testing | [docs/development-and-testing.md](./docs/development-and-testing.md) |
509
+ | Changelog | [CHANGELOG.md](./CHANGELOG.md) |
510
+ | IOSM specification (v1.0) | [iosm-spec.md](./iosm-spec.md) |
511
+ | Canonical IOSM repository | [github.com/rokoss21/IOSM](https://github.com/rokoss21/IOSM) |
371
512
 
372
- | Repository | Description |
373
- |------------|-------------|
374
- | [IOSM](https://github.com/rokoss21/IOSM) | Canonical IOSM v1.0 specification, schemas, artifact templates, and validation scripts |
375
- | [iosm-cli](https://github.com/rokoss21/iosm-cli) | This repo — CLI runtime that implements the IOSM methodology as an engineering agent |
513
+ ---
376
514
 
377
- ## Development
515
+ ## Development
378
516
 
379
517
  ```bash
518
+ git clone https://github.com/rokoss21/iosm-cli.git
519
+ cd iosm-cli
380
520
  npm install
381
- npm run check
382
- npm test
383
- npm run build
521
+ npm run check # typecheck
522
+ npm test # run tests (vitest)
523
+ npm run build # compile to dist/
384
524
  ```
385
525
 
386
- Contributing guide: [CONTRIBUTING.md](./CONTRIBUTING.md)
526
+ Additional scripts:
387
527
 
388
- ## License
528
+ ```bash
529
+ npm run dev # watch mode (incremental compilation)
530
+ npm run build:binary # standalone Bun binary
531
+ npm run deploy-local # build and sync local install
532
+ ```
389
533
 
390
- [MIT](./LICENSE) © 2026 Emil Rokossovskiy
534
+ **Repository layout:**
391
535
 
392
- <p align="center">
393
- <sub>Built for teams that treat AI coding as an engineering system, not a chat.</sub>
394
- </p>
536
+ ```
537
+ src/ TypeScript source
538
+ test/ Vitest test suites
539
+ docs/ Reference documentation
540
+ examples/ Extension and SDK examples (66 + 12)
541
+ iosm-spec.md IOSM methodology specification
542
+ ```
543
+
544
+ ---
545
+
546
+ ## ✦ Contributing
547
+
548
+ See [CONTRIBUTING.md](./CONTRIBUTING.md) for development workflow, testing requirements, and contribution guidelines.
549
+
550
+ Issues and pull requests are welcome. Please open an issue before starting large changes.
551
+
552
+ ---
553
+
554
+ ## ✦ License
555
+
556
+ [MIT](./LICENSE) © 2026 Emil Rokossovskiy