iosm-cli 0.2.5 → 0.2.7

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 (59) hide show
  1. package/CHANGELOG.md +55 -0
  2. package/README.md +460 -304
  3. package/dist/cli/args.d.ts.map +1 -1
  4. package/dist/cli/args.js +4 -1
  5. package/dist/cli/args.js.map +1 -1
  6. package/dist/core/agent-profiles.d.ts.map +1 -1
  7. package/dist/core/agent-profiles.js +4 -2
  8. package/dist/core/agent-profiles.js.map +1 -1
  9. package/dist/core/agent-session.d.ts.map +1 -1
  10. package/dist/core/agent-session.js +14 -1
  11. package/dist/core/agent-session.js.map +1 -1
  12. package/dist/core/sdk.d.ts +2 -2
  13. package/dist/core/sdk.d.ts.map +1 -1
  14. package/dist/core/sdk.js +3 -3
  15. package/dist/core/sdk.js.map +1 -1
  16. package/dist/core/shadow-guard.js +1 -1
  17. package/dist/core/shadow-guard.js.map +1 -1
  18. package/dist/core/shared-memory.d.ts +14 -0
  19. package/dist/core/shared-memory.d.ts.map +1 -1
  20. package/dist/core/shared-memory.js +63 -0
  21. package/dist/core/shared-memory.js.map +1 -1
  22. package/dist/core/system-prompt.d.ts.map +1 -1
  23. package/dist/core/system-prompt.js +17 -2
  24. package/dist/core/system-prompt.js.map +1 -1
  25. package/dist/core/tools/fetch.d.ts +56 -0
  26. package/dist/core/tools/fetch.d.ts.map +1 -0
  27. package/dist/core/tools/fetch.js +272 -0
  28. package/dist/core/tools/fetch.js.map +1 -0
  29. package/dist/core/tools/fs-ops.d.ts +54 -0
  30. package/dist/core/tools/fs-ops.d.ts.map +1 -0
  31. package/dist/core/tools/fs-ops.js +206 -0
  32. package/dist/core/tools/fs-ops.js.map +1 -0
  33. package/dist/core/tools/git-read.d.ts +60 -0
  34. package/dist/core/tools/git-read.d.ts.map +1 -0
  35. package/dist/core/tools/git-read.js +267 -0
  36. package/dist/core/tools/git-read.js.map +1 -0
  37. package/dist/core/tools/index.d.ts +44 -0
  38. package/dist/core/tools/index.d.ts.map +1 -1
  39. package/dist/core/tools/index.js +22 -0
  40. package/dist/core/tools/index.js.map +1 -1
  41. package/dist/core/tools/shared-memory.d.ts.map +1 -1
  42. package/dist/core/tools/shared-memory.js +45 -5
  43. package/dist/core/tools/shared-memory.js.map +1 -1
  44. package/dist/core/tools/task.d.ts +12 -1
  45. package/dist/core/tools/task.d.ts.map +1 -1
  46. package/dist/core/tools/task.js +565 -9
  47. package/dist/core/tools/task.js.map +1 -1
  48. package/dist/index.d.ts +1 -1
  49. package/dist/index.d.ts.map +1 -1
  50. package/dist/index.js +1 -1
  51. package/dist/index.js.map +1 -1
  52. package/dist/modes/interactive/interactive-mode.d.ts.map +1 -1
  53. package/dist/modes/interactive/interactive-mode.js +185 -26
  54. package/dist/modes/interactive/interactive-mode.js.map +1 -1
  55. package/docs/cli-reference.md +4 -1
  56. package/docs/configuration.md +2 -2
  57. package/docs/interactive-mode.md +2 -2
  58. package/docs/rpc-json-sdk.md +1 -1
  59. package/package.json +1 -1
package/README.md CHANGED
@@ -1,400 +1,556 @@
1
- <h1 align="center">IOSM CLI v0.2.5</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 0.2.7</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
+
22
27
  ---
23
28
 
24
- **IOSM CLI** (`iosm-cli`) is not a chat wrapper around an LLM.
25
-
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)
35
-
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.
37
-
38
- ## What's New in v0.2.5
39
-
40
- - stronger parallel orchestration defaults for `/orchestrate`:
41
- - in `--parallel` mode, omitted `--max-parallel` now auto-matches `--agents`
42
- - when no worker profile is set, parallel orchestration defaults workers to `meta` (except read-only host contexts)
43
- - assignment-level `delegate_parallel_hint` is propagated so nested delegation can fan out more predictably
44
- - improved swarm reliability and observability:
45
- - dispatch timeout guardrails in scheduler runtime
46
- - dependent tasks are auto-blocked when an upstream dependency fails
47
- - richer subagent progress visibility while `/swarm` runs
48
- - safer coordination internals:
49
- - queued retries for team status updates under lock contention
50
- - shared-memory reads are metadata-first by default (optional value preview when requested)
51
-
52
- ## Why It Exists
53
-
54
- Most AI CLIs optimize for conversation.
55
- **IOSM CLI** optimizes for engineering execution quality.
56
-
57
- | Area | Typical AI CLI | IOSM CLI |
58
- |------|----------------|------------|
59
- | Workflow | Prompt-by-prompt | Structured session + IOSM cycles |
60
- | Safety | Basic confirmations | Checkpoints, rollback, diagnostics, permission policies |
61
- | Context ops | Ad hoc notes | Managed memory with interactive edit/remove |
62
- | Tooling | Built-ins only | Built-ins + MCP + extension tools |
63
- | Integrations | Mostly interactive only | Interactive + print + JSON + JSON-RPC + SDK |
64
-
65
- ## Compared to Other Tools
66
-
67
- This is not a “better/worse” claim. It is a positioning map so teams can choose the right tool for the job.
68
-
69
- | Tool | Typical Strength | Typical Mode | IOSM CLI Difference |
70
- |------|------------------|--------------|------------------------|
71
- | **Claude Code** | Strong conversational coding flow | Terminal conversation | Adds structured IOSM cycles + explicit checkpoint/rollback/doctor workflow |
72
- | **OpenCode** | Lightweight open-source coding assistant | Terminal-first iteration | Emphasizes repeatable engineering process and quality-gated cycles |
73
- | **Cursor** | Excellent IDE-native editing and inline assistance | IDE-first | Keeps workflow in terminal with agent tooling, MCP, and scriptable runtime modes |
74
- | **Gemini CLI** | Fast Gemini-centric command-line assistance | CLI prompts and tasks | Provider-agnostic runtime + IOSM methodology + deeper operational controls |
75
- | **IOSM CLI** | Structured engineering execution | Terminal runtime + methodology | Designed for reproducible refactors, diagnostics, memory, and cycle artifacts |
76
-
77
- ## Who It Is For
78
-
79
- - developers at any level: start in **full** profile and be productive quickly
80
- - teams that need adaptive multi-agent execution with strict verification closure via **meta** profile
81
- - advanced engineers and tech leads using **iosm** mode for high-risk refactors and system-level change
82
- - teams that need auditability, rollback, and repeatable improvement history
83
- - platform/backend teams that operationalize AI coding into reliable workflows
84
- - teams building internal coding automation on top of a CLI runtime
85
-
86
- ## Install
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.
87
30
 
88
- ```bash
89
- npm install -g iosm-cli
90
- iosm --version
31
+ It is not a chat interface. It is a runtime.
32
+
33
+ ---
34
+
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)
51
+
52
+ ---
53
+
54
+ ## ✦ What You Get
55
+
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 |
66
+
67
+ ---
68
+
69
+ ## ✦ The IOSM Methodology
70
+
71
+ IOSM — **Improve, Optimize, Shrink, Modularize** — is an algorithmic methodology for systematic engineering improvement. It transforms ad-hoc refactoring into a reproducible, measurable process.
72
+
73
+ **Four mandatory phases — executed in strict order:**
74
+
75
+ ```
76
+ Improve → Optimize → Shrink → Modularize
91
77
  ```
92
78
 
93
- Requirements:
94
- - Node.js `>=20.6.0`
95
- - provider auth (environment variable API key and/or `/login`)
96
- - `/login` now includes the full `models.dev` provider catalog; `/model` loads available models for authenticated providers
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 |
85
+
86
+ **Six canonical metrics** track progress across every phase:
87
+
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 |
97
96
 
98
- ### Recommended CLI Toolchain (for maximum efficiency)
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
+ ---
99
106
 
100
- `iosm-cli` ships managed fallback for `rg` and `fd`, but best performance comes from system-installed tooling, especially for large repos.
107
+ ## Quick Start
101
108
 
102
- Tools used by advanced search/analysis workflows:
103
- - `rg`, `fd`, `ast-grep` (`sg`), `comby`, `jq`, `yq`, `semgrep`, `sed`
109
+ ### 1. Install
104
110
 
105
- macOS (Homebrew):
106
111
  ```bash
107
- brew install ripgrep fd ast-grep comby jq yq semgrep
112
+ npm install -g iosm-cli
113
+ iosm --version
108
114
  ```
109
115
 
110
- Ubuntu/Debian:
116
+ **Requirements:** Node.js `>=20.6.0` · at least one authenticated model provider
117
+
118
+ No global install? Use `npx`:
119
+
111
120
  ```bash
112
- sudo apt-get update
113
- sudo apt-get install -y ripgrep fd-find jq yq sed
121
+ npx iosm-cli --version
122
+ ```
123
+
124
+ ### 2. Configure a provider
125
+
126
+ The fastest path is interactive setup inside the app:
114
127
 
115
- # optional but recommended:
116
- # semgrep: pipx install semgrep
117
- # ast-grep: npm i -g @ast-grep/cli
118
- # comby: see https://comby.dev/docs/installation
119
128
  ```
129
+ iosm
130
+ /login ← OAuth or API key (models.dev catalog)
131
+ /model ← pick your model
132
+ ```
133
+
134
+ Or set an environment variable before launching:
120
135
 
121
- Check availability quickly:
122
136
  ```bash
123
- iosm
124
- /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
125
142
  ```
126
143
 
127
- ## 60-Second Start
144
+ ### 3. Run your first session
128
145
 
129
146
  ```bash
130
- # 1) Open project and start CLI
131
- cd /path/to/repo
147
+ cd /path/to/your/project
148
+
149
+ # Interactive mode
132
150
  iosm
151
+
152
+ # Or one-shot without entering the TUI
153
+ iosm -p "Summarize the repository architecture"
133
154
  ```
134
155
 
135
- Inside the session (full profile):
136
- ```text
137
- /login # or /auth: configure credentials (OAuth + API key providers from models.dev)
138
- /model # select active provider/model from currently authenticated providers
139
- <your task> # start working immediately
156
+ Inside interactive mode:
157
+ ```
158
+ Review the repository structure and summarize the architecture.
140
159
  ```
141
160
 
142
- When you need advanced IOSM workflow:
143
- ```text
144
- Shift+Tab # switch profile to iosm
145
- /init # bootstrap IOSM workspace
146
- /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
147
171
  ```
148
172
 
149
- Core commands to unlock full runtime value:
150
- - direct prompt to main agent — default for simple tasks (single-agent flow)
151
- - `/orchestrate` — manual legacy multi-agent orchestration (explicit team-run control)
152
- - `/swarm` — recommended multi-agent orchestration runtime for complex/risky changes (`run`, `from-singular`, `watch`, `retry`, `resume`)
153
- - `/init` + `/iosm` — execute measurable IOSM cycles with artifacts and quality gates
154
- - `/mcp` — connect external tool ecosystems in interactive UI
155
- - `/semantic` — configure semantic provider, build/rebuild embeddings index, run meaning-based retrieval
156
- - `/memory` — persist project facts and constraints across sessions
173
+ Run `/doctor` to check your environment at any time.
157
174
 
158
- ## Real-World Example: Swarm-First IOSM Refactor
175
+ ---
159
176
 
160
- ```console
161
- $ iosm
162
- IOSM CLI v0.2.5 [full]
177
+ ## ✦ Usage Patterns
163
178
 
164
- you> /singular Refactor auth and split session handling from token validation
165
- iosm> Option 1 selected
166
- iosm> Start with Swarm (Recommended)
167
- iosm> /swarm from-singular 2026-03-10-210201 --option 1
168
- iosm> Swarm run started: swarm_1741632000000_ab12cd
169
- iosm> status: running (ready/running/blocked/done visible via /swarm watch)
170
- iosm> Touches -> Locks -> Gates pipeline completed
171
- iosm> integration report written to .iosm/orchestrate/swarm_1741632000000_ab12cd/reports/
179
+ ### Daily coding and repository work
172
180
 
173
- iosm> switch profile: iosm (Shift+Tab)
174
- iosm> /init
175
- iosm> IOSM workspace initialized
176
- iosm> /iosm 0.95 --max-iterations 5
181
+ Default `full` profile. Works on any codebase without prior setup.
177
182
 
178
- iosm> Baseline captured
179
- iosm> Planned cycle from team artifacts: simplify auth module
180
- iosm> Running improve -> verify -> optimize loop
181
- iosm> Result: simplicity +18%, modularity +11%, performance +6%
182
- iosm> Artifacts written to .iosm/cycles/2026-03-10-001/
183
+ ```bash
184
+ iosm
183
185
  ```
184
186
 
185
- 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:
186
195
 
187
196
  ```bash
188
- /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/"
189
200
  ```
190
201
 
191
- ## Architecture Overview
202
+ ---
203
+
204
+ ### Read-only planning and review
192
205
 
193
- `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.
194
207
 
195
- ```text
196
- Providers (built-ins + full models.dev catalog)
197
-
198
- Auth + Model Selection (/login, /model)
199
-
200
- Agent Runtime (interactive + JSON + JSON-RPC + SDK)
201
-
202
- Tooling Layer (read/edit/bash + search/structural/data/security tools + MCP tools)
203
-
204
- Swarm Runtime (/swarm run|from-singular|watch|retry|resume)
205
-
206
- IOSM Layer (/init, /iosm cycles, metrics, governance)
207
-
208
- Artifacts + Memory (.iosm/cycles/*, checkpoints, /memory state)
208
+ ```bash
209
+ iosm --profile plan
209
210
  ```
210
211
 
211
- ## 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.
213
+
214
+ ---
215
+
216
+ ### Complex or risky engineering changes
212
217
 
213
- - **AI executes structured engineering loops, not ad hoc chats.** Core flow for risky tasks is ` /singular -> /contract -> /swarm -> /iosm `.
214
- - **Complex work needs controlled execution.** Swarm applies `Scopes -> Touches -> Locks -> Gates -> Done` with continuous dispatch and bounded retries.
215
- - **Refactoring must be measurable.** IOSM cycles capture baseline, hypotheses, and metric deltas instead of untracked edits.
216
- - **Every important run must be auditable.** Artifacts and memory preserve decisions and outcomes across sessions.
217
- - **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.
218
+ Define constraints analyze options execute with guardrails:
218
219
 
219
- ## Operating Profiles
220
+ ```
221
+ /contract
222
+ /singular Refactor auth module, split token validation from session management
223
+ ```
220
224
 
221
- `IOSM CLI` supports four practical profiles/modes:
225
+ `/singular` produces three implementation options with trade-off analysis. Select one, then choose **Start with Swarm** to hand off to the execution runtime.
222
226
 
223
- | Profile | Use It When | Avoid It When | What `/init` Does | Switch/Command |
224
- |------|-------------|----------------|-------------------|----------------|
225
- | **full** (default) | You want direct coding help and implementation speed | You need strict multi-workstream orchestration contracts | Generates/updates `AGENTS.md` from real repo scan and prepares `.iosm/agents/` | `Shift+Tab` in TUI or `iosm --profile full` |
226
- | **meta** (orchestration-first) | You need orchestration-first execution (parallel task/delegate graph + synthesis + verification closure) | You only need casual chat or lightweight Q&A | Same initialization behavior as full profile | `Shift+Tab` in TUI or `iosm --profile meta` |
227
- | **iosm** (advanced) | You run IOSM cycles with metrics, artifacts, and governance | You only need quick one-off coding support | Bootstraps full IOSM workspace (`iosm.yaml`, `IOSM.md`, `.iosm/cycles/...`) with optional agent verification | `Shift+Tab` in TUI, `iosm --profile iosm`, `/iosm [target-index] [--max-iterations N] [--force-init]` |
228
- | **plan** | You need read-only architecture/planning/review | You are ready to edit and execute changes | Not intended for initialization-heavy workflows | `Shift+Tab` in TUI or `iosm --profile plan` |
227
+ > `/swarm` will not start without an active `/contract`. If none exists, it prompts you to draft one automatically.
229
228
 
230
- ### META Model Requirements (Important)
229
+ The swarm runtime then executes with locks, gates, retries, and checkpoints, writing per-run artifacts under `.iosm/orchestrate/<run-id>/`.
231
230
 
232
- For strong `meta` orchestration quality, use modern high-capability models with:
233
- - large context windows (prefer `>=128k`, ideally `>=200k`)
234
- - high output token limits
235
- - reliable long-run tool-calling behavior
231
+ Monitor and control the run:
236
232
 
237
- Why this matters:
238
- - `meta` mode keeps orchestration contracts, task plans, delegate outputs, and synthesis in context
239
- - small/legacy models are more likely to stop early, under-delegate, or lose orchestration constraints
240
- - model capability directly affects orchestration stability and output quality
233
+ ```
234
+ /swarm watch ← live status
235
+ /swarm retry ← retry failed gates
236
+ /swarm resume ← continue interrupted runs
237
+ ```
241
238
 
242
- Practical recommendation:
243
- - for conversational use, switch to `full` (Shift+Tab)
244
- - for complex orchestration in `meta`, pick your strongest available model via `/model`
239
+ ---
245
240
 
246
- Typical advanced flow:
241
+ ### Measurable codebase improvement (IOSM cycles)
242
+
243
+ Use the `iosm` profile for structured improvement with metric tracking and artifact history.
247
244
 
248
245
  ```bash
249
246
  iosm --profile iosm
247
+ ```
248
+
249
+ Bootstrap the workspace once:
250
+
251
+ ```
250
252
  /init
253
+ ```
254
+
255
+ Run a full improvement cycle targeting an IOSM-Index of 0.95:
256
+
257
+ ```
251
258
  /iosm 0.95 --max-iterations 5
252
259
  ```
253
260
 
254
- ## Swarm-First Execution
261
+ Or use CLI subcommands:
255
262
 
256
- For complex/risky work, use the canonical swarm runtime instead of one monolithic prompt.
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
+ ---
257
274
 
258
- Default routing rule:
259
- - simple tasks -> direct prompt to one agent
260
- - manual legacy multi-agent split -> `/orchestrate`
261
- - complex/risky changes (multi-agent orchestration level) -> `/swarm`
275
+ ## Agent Profiles
262
276
 
263
- `/swarm` supports:
264
- - contract-bound execution (run blocks until effective `/contract` exists)
265
- - run-level parallel workers via `--max-parallel` (1..20)
266
- - continuous dispatch over DAG tasks (ready -> locks -> gates -> checkpoint)
267
- - intra-task parallelism: one swarm task can fan out to delegated subagents (up to 10) when beneficial
268
- - run-scoped shared memory (`shared_memory_write` / `shared_memory_read`) across tasks and delegates that share the same `run_id`
269
- - standalone `task` executions auto-generate internal `run_id/task_id`, enabling shared memory for root + delegates without manual IDs
270
- - hierarchical touches-based locking and lock downgrade
271
- - task gates + run gates separation
272
- - retries by taxonomy (`permission`, `dependency/import`, `test`, `timeout`, `unknown`)
273
- - checkpoints/recovery (`/swarm resume`) and focused retries (`/swarm retry`)
274
- - scheduler guards (`progress heuristic` + `conflict density guard`) for stable throughput under contention
275
- - high-risk spawn candidates require explicit confirmation during run
277
+ Profiles control tool access, thinking level, and behavioral guidance injected into the model's system prompt.
276
278
 
277
- Example:
279
+ **Primary profiles** — operator-facing:
280
+
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 |
287
+
288
+ **Specialist profiles** — for subagent delegation and targeted work:
289
+
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 |
296
+
297
+ Select at startup:
278
298
 
279
299
  ```bash
280
- /swarm run "Improve auth reliability and performance with verification gates" \
281
- --max-parallel 3 \
282
- --budget-usd 15
300
+ iosm --profile plan
301
+ iosm --profile iosm
283
302
  ```
284
303
 
285
- Bridge from decision mode:
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]
322
+ ```
323
+
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()` |
286
348
 
287
349
  ```bash
288
- /singular "Refactor auth and split session handling from token validation"
289
- # choose option -> Start with Swarm (Recommended)
290
- ```
291
-
292
- ## Core Commands
293
-
294
- | Workflow Step | Command | Why It Matters |
295
- |------|---------|----------------|
296
- | Start clean context | `/new` or `/clear` | Reset session state before a new task or after context drift |
297
- | Configure auth | `/login` or `/auth` | Set OAuth/API key credentials with guided flow from full models.dev provider catalog |
298
- | Select active model | `/model` | Choose provider/model from available authenticated providers |
299
- | Launch controlled execution | `/swarm run ...` | Execute complex tasks with contract boundaries, locks, gates, retries, and checkpoints |
300
- | Bridge decision to execution | `/swarm from-singular ...` | Apply selected `/singular` option under effective contract policy |
301
- | Legacy orchestration | `/orchestrate --parallel ...` | Keep previous team-run flow when you explicitly need legacy semantics |
302
- | Initialize IOSM workspace | `/init` | Bootstrap/update IOSM files and cycle workspace |
303
- | Run IOSM cycle | `/iosm [target-index] [--max-iterations N]` | Execute measurable improve/verify loops with artifact output |
304
- | Track swarm runs | `/swarm watch`, `/swarm resume`, `/swarm retry` | Observe state, resume checkpoints, and recover failed tasks |
305
- | Manage MCP servers | `/mcp` | Inspect/add/enable external tool servers interactively |
306
- | Manage semantic search | `/semantic` | Configure provider with auto model discovery (OpenRouter/Ollama), index codebase, query by intent/meaning |
307
- | Define engineering contract | `/contract` | Field-by-field interactive contract editor with auto-save and automatic JSON generation |
308
- | Analyze feasibility variants | `/singular <feature request>` | Runs baseline + standard agent pass, then returns 3 implementation options and recommendation |
309
- | Manage memory | `/memory` | Add/edit/remove persistent project facts and constraints |
310
- | Save/restore state | `/checkpoint` / `/rollback` | Safe experimentation with fast rollback |
311
- | Diagnose runtime | `/doctor` | Verify model/auth/MCP/resources when behavior is inconsistent |
312
- | Manage settings | `/settings` | Tune runtime defaults and operational preferences |
313
-
314
- ## Decision Workflow: `/contract` + `/singular`
315
-
316
- ### `/contract` (interactive contract manager)
317
-
318
- - No manual JSON editing in terminal.
319
- - You edit fields directly (`goal`, `scope_include`, `scope_exclude`, `constraints`, `quality_gates`, `definition_of_done`, `risks`, and additional planning fields).
320
- - Press `Enter` on a field value and it is saved immediately.
321
- - Contract JSON is built automatically.
322
-
323
- Key manager actions:
324
- - `Open effective contract` = read merged runtime contract (`project + session`).
325
- - `Edit session contract` = temporary overlay for current session only.
326
- - `Edit project contract` = persistent baseline in `.iosm/contract.json`.
327
-
328
- ### `/singular <request>` (feature feasibility analyzer)
329
-
330
- - Command-first flow: write request, run analysis, receive decision options.
331
- - Uses standard agent-style repository run (not static form output), then merges with baseline repository scan.
332
- - Produces exactly 3 options:
333
- - `Option 1`: practical implementation path (usually recommended).
334
- - `Option 2`: alternative strategy with different trade-offs.
335
- - `Option 3`: defer/do-not-implement-now path.
336
- - Each option includes affected files, step-by-step plan, risks, and when-to-choose guidance.
337
- - User selects `1/2/3`, then chooses `Start with Swarm` or `Continue without Swarm`.
338
- - `Start with Swarm` executes selected option via `/swarm from-singular ...` under effective `/contract`.
339
-
340
- Legacy note:
341
- - `/blast` and `/shadow` are removed from active workflow.
342
- - Use `/singular` for feasibility decisions and `/contract` for engineering constraints.
343
-
344
- ## IOSM In One Line
345
-
346
- **IOSM** gives you a repeatable loop for improving codebases with explicit quality gates, metrics, and artifact history instead of one-off AI edits.
347
-
348
- 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:
349
383
 
350
384
  ```bash
351
- iosm init
352
- iosm cycle plan "reduce API latency" "simplify auth module"
353
- iosm cycle status
354
- 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
355
390
  ```
356
391
 
357
- ## Documentation
392
+ ### Included examples
358
393
 
359
- Use the docs as the source of truth for details.
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`.
404
+
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 · fs_ops · bash · grep · rg · fd · ast_grep │
475
+ │ comby · jq · yq · semgrep · sed · semantic_search · fetch · git_read │
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
360
495
 
361
496
  | Topic | Link |
362
- |------|------|
497
+ |-------|------|
498
+ | Documentation index | [docs/README.md](./docs/README.md) |
363
499
  | Getting started | [docs/getting-started.md](./docs/getting-started.md) |
364
- | CLI flags and options | [docs/cli-reference.md](./docs/cli-reference.md) |
365
- | Interactive mode (commands, keys, profiles) | [docs/interactive-mode.md](./docs/interactive-mode.md) |
366
- | IOSM init/cycles | [docs/iosm-init-and-cycles.md](./docs/iosm-init-and-cycles.md) |
367
- | 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) |
368
503
  | Orchestration and subagents | [docs/orchestration-and-subagents.md](./docs/orchestration-and-subagents.md) |
369
- | 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) |
370
506
  | Sessions, traces, export | [docs/sessions-traces-export.md](./docs/sessions-traces-export.md) |
371
- | JSON/RPC/SDK usage | [docs/rpc-json-sdk.md](./docs/rpc-json-sdk.md) |
372
- | Full docs index | [docs/README.md](./docs/README.md) |
373
- | Full IOSM specification (local) | [iosm-spec.md](./iosm-spec.md) |
374
- | IOSM methodology spec (canonical) | [github.com/rokoss21/IOSM](https://github.com/rokoss21/IOSM) |
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) |
375
512
 
376
- ## Related Repositories
377
-
378
- | Repository | Description |
379
- |------------|-------------|
380
- | [IOSM](https://github.com/rokoss21/IOSM) | Canonical IOSM v1.0 specification, schemas, artifact templates, and validation scripts |
381
- | [iosm-cli](https://github.com/rokoss21/iosm-cli) | This repo — CLI runtime that implements the IOSM methodology as an engineering agent |
513
+ ---
382
514
 
383
- ## Development
515
+ ## Development
384
516
 
385
517
  ```bash
518
+ git clone https://github.com/rokoss21/iosm-cli.git
519
+ cd iosm-cli
386
520
  npm install
387
- npm run check
388
- npm test
389
- npm run build
521
+ npm run check # typecheck
522
+ npm test # run tests (vitest)
523
+ npm run build # compile to dist/
390
524
  ```
391
525
 
392
- Contributing guide: [CONTRIBUTING.md](./CONTRIBUTING.md)
526
+ Additional scripts:
393
527
 
394
- ## 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
+ ```
395
533
 
396
- [MIT](./LICENSE) © 2026 Emil Rokossovskiy
534
+ **Repository layout:**
397
535
 
398
- <p align="center">
399
- <sub>Built for teams that treat AI coding as an engineering system, not a chat.</sub>
400
- </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