miii-agent 0.1.19 → 0.1.20

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 (3) hide show
  1. package/README.md +78 -247
  2. package/dist/cli.js +885 -115
  3. package/package.json +4 -2
package/README.md CHANGED
@@ -1,12 +1,9 @@
1
1
  <h1 align="center">miii</h1>
2
2
 
3
3
  <p align="center">
4
- <strong>Small. Simple. Smart. Strategic. Semantic.</strong>
5
- </p>
6
-
7
- <p align="center">
8
- A local-first AI coding agent that lives in your terminal.<br>
9
- Your code never leaves your machine. No API keys. No cloud. No bullshit.
4
+ <strong>Cursor / Claude Code, but local.</strong><br>
5
+ An offline AI pair-programmer in your terminal, powered by Ollama.<br>
6
+ Private by default. Free forever.
10
7
  </p>
11
8
 
12
9
  <p align="center">
@@ -16,91 +13,27 @@
16
13
  <a href="https://ollama.com"><img src="https://img.shields.io/badge/powered%20by-Ollama-black" alt="powered by Ollama"></a>
17
14
  </p>
18
15
 
19
- miii is a local-first AI coding agent that lives in your terminal. Powered by [Ollama](https://ollama.com) — or any OpenAI-compatible local server like [llama.cpp](https://github.com/ggml-org/llama.cpp) and [LM Studio](https://lmstudio.ai) — it reads your code, writes features, runs tests, and fixes bugs entirely on your hardware, at native speed.
20
-
21
- ---
22
-
23
- ## Contents
24
-
25
- - [Demo](#demo)
26
- - [The Local-First Advantage](#the-local-first-advantage)
27
- - [Core Philosophy](#core-philosophy)
28
- - [Quick Start](#quick-start)
29
- - [Interaction Guide](#interaction-guide)
30
- - [Technical Deep Dive](#technical-deep-dive)
31
- - [Configuration](#configuration)
32
- - [System Architecture](#system-architecture)
33
- - [Development](#development)
34
- - [Project Status](#project-status)
35
- - [License](#license)
36
-
37
- ---
38
-
39
- ## Demo
40
-
41
- ![miii demo](demo.gif)
42
-
43
- ---
44
-
45
- ## The Local-First Advantage
46
-
47
- Most AI coding tools are wrappers around cloud APIs. They are slow, expensive, and require you to trust your private codebase to a third-party server.
48
-
49
- miii flips the script:
50
-
51
- - **Absolute Privacy** — Powered by Ollama, llama.cpp, or any local OpenAI-compatible server. Your code stays on your disk, period.
52
- - **Zero Friction** — No API keys, no billing, no accounts. Just `miii`.
53
- - **True Agency** — miii doesn't just chat; it decomposes problems, invokes tools, and verifies results like a senior engineer.
54
- - **Native Performance** — No network round-trips. Latency is limited by your GPU, not a CDN.
55
-
56
- | | Cloud AI agents | **miii** |
57
- |----------------|--------------------------|------------------------------|
58
- | Your code | Sent to a third party | Never leaves your machine |
59
- | Cost | Per-token billing | Free — runs on your hardware |
60
- | Setup | API keys, accounts | `npm i -g miii-agent` |
61
- | Offline | No | Yes |
62
- | Latency | Network + queue | Your GPU only |
63
-
64
- ---
65
-
66
- ## Core Philosophy
67
-
68
- miii is built on five foundational principles:
69
-
70
- - **small** — A tight, bloat-free codebase. You can read the entire project in an afternoon.
71
- - **simple** — No configuration ceremony. Install and run.
72
- - **smart** — Decomposes complex tasks and verifies its own work.
73
- - **strategic** — Plans before acting; tools are gated and paths are confined.
74
- - **semantic** — Operates on the meaning of your code, not blind text matching.
16
+ <p align="center">
17
+ <img src="demo.gif" alt="miii demo">
18
+ </p>
75
19
 
76
20
  ---
77
21
 
78
- ## Quick Start
22
+ ## What is this?
79
23
 
80
- ### Prerequisites
24
+ miii lives in your terminal and codes alongside you — reading files, writing features, running tests, fixing bugs. The twist: it runs on **your** hardware, powered by [Ollama](https://ollama.com) (or any local OpenAI-compatible server like [llama.cpp](https://github.com/ggml-org/llama.cpp) / [LM Studio](https://lmstudio.ai)).
81
25
 
82
- - **Node.js** 18
83
- - **Ollama** running locally — [Download here](https://ollama.com/download)
84
- - A coding model pulled locally:
26
+ Your code never leaves your disk. There's nothing to log in to. Pull a model, type `miii`, go.
85
27
 
86
- ```bash
87
- ollama pull qwen2.5-coder:14b
88
- # or any model you prefer
89
- ollama pull deepseek-coder-v2
90
- ```
91
-
92
- ### Installation & Launch
28
+ ## Try it in 30 seconds
93
29
 
94
30
  ```bash
31
+ ollama pull qwen2.5-coder:14b # any coding model works
95
32
  npm install -g miii-agent
96
33
  miii
97
34
  ```
98
35
 
99
- ---
100
-
101
- ## Interaction Guide
102
-
103
- Inside the TUI, interact naturally:
36
+ Then just talk to it:
104
37
 
105
38
  ```
106
39
  > refactor the auth module to use async/await
@@ -108,93 +41,72 @@ Inside the TUI, interact naturally:
108
41
  > why are my tests failing in utils/parser.ts
109
42
  ```
110
43
 
111
- ### Keyboard Shortcuts
44
+ > **Needs:** Node ≥ 18 and [Ollama](https://ollama.com/download) running locally.
112
45
 
113
- | Key | Action |
114
- |-----|--------|
115
- | `Enter` | Send prompt |
116
- | `@filename` | Attach file to context |
117
- | `/models` | Switch active Ollama model |
118
- | `/clear` | Reset conversation history |
119
- | `Esc` | Stop current generation or tool run |
120
- | `Ctrl+O` | Toggle full tool output view |
121
- | `Ctrl+C` | Quit |
46
+ ## Why local-first?
122
47
 
123
- ### Project Instructions (`MIII.md`)
48
+ Most "AI coding tools" are just wrappers around a cloud API — slow, metered, and they ship your private codebase to someone else's server.
124
49
 
125
- Drop a `MIII.md` file in your project and miii reads it first, every turn — the same idea as `CLAUDE.md`. Use it to teach the agent your conventions, build/test commands, architecture, and do's and don'ts.
50
+ | | Cloud agents | **miii** |
51
+ |--------------|-----------------------|------------------------------|
52
+ | Your code | Sent to a third party | Never leaves your machine |
53
+ | Cost | Per-token billing | Free — runs on your hardware |
54
+ | Setup | API keys, accounts | `npm i -g miii-agent` |
55
+ | Offline | No | Yes |
56
+ | Latency | Network + queue | Your GPU only |
126
57
 
127
- ```markdown
128
- # MIII.md
129
- - Use tabs, not spaces.
130
- - Run `npm test` before declaring any task done.
131
- - The HTTP layer lives in src/server/ — never import it from src/core/.
132
- ```
58
+ It doesn't just chat, either — it decomposes the problem, calls tools, and checks its own work before claiming victory.
133
59
 
134
- miii searches upward from the working directory to the repo root (the directory containing `.git`); the nearest `MIII.md` wins. It is treated as authoritative — higher priority than the agent's defaults — except it can never override the permission system or safety boundaries. Files over 32KB are truncated.
60
+ ## Five letters, five ideas
135
61
 
136
- ---
62
+ **s**mall · **s**imple · **s**mart · **s**trategic · **s**emantic — a tiny codebase you can read in an afternoon, no config ceremony, plans before it acts, and operates on the *meaning* of your code, not blind text matching.
63
+
64
+ ## A few things that make it fun
137
65
 
138
- ## Technical Deep Dive
66
+ - **🧪 `miii doctor`** — not every local model can drive an agent. Doctor runs your models through real engineering tasks and tells you which ones actually deliver.
67
+ ```bash
68
+ miii doctor # grade every installed model
69
+ miii doctor qwen2.5-coder:7b # grade one
70
+ ```
71
+ - **💧 Lossless output spill** — that 50K-line test log won't get truncated and leave the model guessing. miii spills the full output to disk and lets the model page through it. Nothing is ever lost.
72
+ - **🔒 Permission-gated tools** — you approve what the agent can touch; "always" approvals persist. File tools are confined to your working directory.
73
+ - **📄 `MIII.md`** — drop one in your repo to teach miii your conventions, build/test commands, and do's & don'ts. Same idea as `CLAUDE.md`, read every turn.
139
74
 
140
- ### Capabilities
75
+ ## Going deeper
141
76
 
142
- miii ships with a built-in tool suite that the agent invokes autonomously:
77
+ <details>
78
+ <summary><strong>Built-in tools</strong></summary>
143
79
 
144
80
  | Tool | Function |
145
81
  |------|----------|
146
82
  | `read_file` | Read any file in your workspace |
147
83
  | `write_file` | Create new files |
148
- | `edit_file` | Precise string-level edits with whitespace tolerance (no rewrites) |
84
+ | `edit_file` | Precise string-level edits, whitespace-tolerant |
149
85
  | `glob` | Pattern-match files across the project |
150
86
  | `grep` | Regex search across files |
151
87
  | `run_bash` | Execute shell commands |
152
88
 
153
- **Security & Safety:** Every sensitive operation is gated by a permission system. You approve what the agent can touch, and "always" approvals persist to `~/.miii/permissions.json`. The file tools (`read_file`, `write_file`, `edit_file`) are strictly confined to your working directory; `../` traversal and absolute paths outside the workspace are rejected. `run_bash` runs arbitrary shell commands and is **not** path-confined — its only boundary is the permission prompt, so review commands before approving (especially "always").
154
-
155
- ### Lossless Output Spill
89
+ File tools (`read_file`, `write_file`, `edit_file`) reject `../` traversal and absolute paths outside the workspace. `run_bash` is **not** path-confined — its only boundary is the permission prompt, so review commands before approving (especially "always"). Saved rules live in `~/.miii/permissions.json`.
90
+ </details>
156
91
 
157
- Big tool outputs (like 50K-line test logs) usually get truncated, leaving the model to guess. miii doesn't truncate; it **spills**.
92
+ <details>
93
+ <summary><strong>Keyboard shortcuts</strong></summary>
158
94
 
159
- When a tool result exceeds the inline budget (~10K bytes), the full output is written to `~/.miii/output/<id>.txt`. Only a head + tail **preview** is inlined, followed by a pointer:
160
-
161
- ```
162
- [command output truncated: 5184 lines / 412900 bytes.
163
- Full output at ~/.miii/output/9f3a1c.txt read it with
164
- read_file offset/limit to see the elided middle.]
165
- ```
166
-
167
- If the model needs the elided middle, it pages through it using `read_file` ranged reads. Nothing is ever lost. Spill files are garbage-collected after 24 hours.
168
-
169
- ### The Model Doctor
170
-
171
- Not every local model can drive an agent. A model that cannot emit clean tool calls will simply chat at you instead of editing files. `miii doctor` validates your installed models against concrete engineering tasks.
172
-
173
- ```bash
174
- miii doctor # check every local model (from `ollama list`)
175
- miii doctor qwen2.5-coder:7b # check one model
176
- miii doctor gemma4:e4b grep # check one model against "grep" scenarios
177
- ```
178
-
179
- It verifies outcomes (did the file actually change?) and prints a verdict:
180
-
181
- ```
182
- === qwen3-coder ===
183
- PASS edit-exact-string ...
184
- PASS read-then-answer ...
185
- PASS create-new-file ...
186
- PASS grep-locate ...
187
- → qwen3-coder: 4/4 — ready
188
-
189
- === gemma4:e4b ===
190
- → gemma4:e4b: 1/4 — not recommended — weak tool-calling
191
- ```
192
-
193
- ---
95
+ | Key | Action |
96
+ |-----|--------|
97
+ | `Enter` | Send prompt |
98
+ | `@filename` | Attach file to context |
99
+ | `/models` | Switch active model |
100
+ | `/clear` | Reset conversation |
101
+ | `Esc` | Stop generation or tool run |
102
+ | `Ctrl+O` | Toggle full tool output |
103
+ | `Ctrl+C` | Quit |
104
+ </details>
194
105
 
195
- ## Configuration
106
+ <details>
107
+ <summary><strong>Configuration & other backends</strong></summary>
196
108
 
197
- Settings live in `~/.miii/config.json` and are created on first run.
109
+ Settings live in `~/.miii/config.json`, created on first run:
198
110
 
199
111
  ```json
200
112
  {
@@ -204,21 +116,9 @@ Settings live in `~/.miii/config.json` and are created on first run.
204
116
  }
205
117
  ```
206
118
 
207
- | Field | Description | Values |
208
- |-------|-------------|--------|
209
- | `model` | Default Ollama model | any `ollama list` model |
210
- | `ollamaHost` | Ollama API endpoint | URL string |
211
- | `effort` | Controls temperature & limits | `low` \| `medium` \| `high` |
119
+ `effort` (`low` \| `medium` \| `high`) controls temperature and limits.
212
120
 
213
- ### Other Local Backends
214
-
215
- Ollama is the default, but miii talks to any **OpenAI-compatible** local server — so you can run [llama.cpp](https://github.com/ggml-org/llama.cpp) or [LM Studio](https://lmstudio.ai) instead. Your code still never leaves your machine.
216
-
217
- Start `llama-server` (ships with llama.cpp), then point a named provider at it:
218
-
219
- ```bash
220
- llama-server -m ./qwen2.5-coder-14b.gguf --port 8080
221
- ```
121
+ miii talks to any **OpenAI-compatible** local server too. Start `llama-server`, then point a named provider at it:
222
122
 
223
123
  ```json
224
124
  {
@@ -230,80 +130,25 @@ llama-server -m ./qwen2.5-coder-14b.gguf --port 8080
230
130
  }
231
131
  ```
232
132
 
233
- | Field | Description | Values |
234
- |-------|-------------|--------|
235
- | `provider` | Active provider name (keys into `providers`) | e.g. `ollama`, `llamacpp` |
236
- | `providers.<name>.type` | Wire protocol | `ollama` \| `openai` |
237
- | `providers.<name>.baseUrl` | Server endpoint | URL string |
238
- | `providers.<name>.apiKey` | Optional bearer token | string |
133
+ Switch at launch with `miii --provider llamacpp`. Any `openai`-type provider on `localhost` counts as local — no key, no cloud.
134
+ </details>
239
135
 
240
- Switch the active provider at launch with `miii --provider llamacpp`. Any `openai`-type provider on a `localhost` URL counts as local — no key, no cloud.
136
+ <details>
137
+ <summary><strong>How it spills output</strong></summary>
241
138
 
242
- ---
139
+ When a tool result exceeds the inline budget (~10K bytes), the full output is written to `~/.miii/output/<id>.txt`. Only a head + tail preview is inlined, with a pointer:
243
140
 
244
- ## System Architecture
245
-
246
- ```mermaid
247
- graph TD
248
- User["User (Terminal)"] -->|"prompt / @file / /cmd"| InputBar
249
-
250
- subgraph TUI ["Ink TUI (React)"]
251
- InputBar["InputBar"] --> App["App.tsx"]
252
- App --> ChatView["ChatView"]
253
- App --> CommandPalette["CommandPalette\n(/models, /clear)"]
254
- App --> FilePicker["FilePicker (@file)"]
255
- App --> ModelsView["ModelsView"]
256
- end
257
-
258
- App -->|"user message"| AgentLoop["Agent Loop\n(agent/loop.ts)"]
259
-
260
- subgraph Agent ["Agent Layer"]
261
- AgentLoop -->|"chat request"| Adapter["Ollama Adapter\n(agent/adapter.ts)"]
262
- AgentLoop -->|"1. validate input"| Validate["Input Validator\n(tools/validate.ts)"]
263
- AgentLoop -->|"2. permission check"| Policy["Permission Policy\n(permissions/policy.ts)"]
264
- AgentLoop -->|"3. tool call"| ToolRegistry["Tool Registry\n(tools/registry.ts)"]
265
- AgentLoop -->|"events"| EventBus["Event Bus\n(hooks/bus.ts)"]
266
- end
267
-
268
- subgraph Tools ["Tools"]
269
- ToolRegistry --> ReadFile["read_file"]
270
- ToolRegistry --> WriteFile["write_file"]
271
- ToolRegistry --> EditFile["edit_file"]
272
- ToolRegistry --> Glob["glob"]
273
- ToolRegistry --> Grep["grep"]
274
- ToolRegistry --> RunBash["run_bash"]
275
- ReadFile -.-> Confine["Path Confinement\n(tools/paths.ts)"]
276
- WriteFile -.-> Confine
277
- EditFile -.-> Confine
278
- RunBash -->|"large output"| SpillMod["Output Spill\n(tools/spill.ts)"]
279
- Grep -->|"large output"| SpillMod
280
- Glob -->|"large output"| SpillMod
281
- SpillMod -.->|"head+tail preview\n+ read pointer"| ToolRegistry
282
- end
283
-
284
- Adapter -->|"HTTP streaming"| Ollama["Ollama\n(local LLM server)"]
285
- Ollama -->|"model response\n+ tool calls"| Adapter
286
-
287
- Tools -->|"tool results"| AgentLoop
288
- EventBus -->|"stream events"| ChatView
289
-
290
- subgraph Storage ["Local Storage"]
291
- Config["~/.miii/config.json\n(model, host, effort)"]
292
- Rules["~/.miii/permissions.json\n(saved allow rules)"]
293
- Spill["~/.miii/output/\n(spilled tool output)"]
294
- end
295
-
296
- App -.->|"reads"| Config
297
- Policy -.->|"reads / persists 'always'"| Rules
298
- SpillMod -.->|"writes full output"| Spill
299
- ReadFile -.->|"pages elided middle\n(offset/limit)"| Spill
141
+ ```
142
+ [command output truncated: 5184 lines / 412900 bytes.
143
+ Full output at ~/.miii/output/9f3a1c.txt — read it with
144
+ read_file offset/limit to see the elided middle.]
300
145
  ```
301
146
 
302
- ---
303
-
304
- ## Development
147
+ The model pages through the middle with ranged `read_file` reads. Spill files are garbage-collected after 24 hours.
148
+ </details>
305
149
 
306
- ### Setup
150
+ <details>
151
+ <summary><strong>Development</strong></summary>
307
152
 
308
153
  ```bash
309
154
  git clone https://github.com/maruakshay/miii-cli.git
@@ -312,43 +157,29 @@ npm install
312
157
  npm run dev
313
158
  ```
314
159
 
315
- ### Build & Test
316
-
317
160
  ```bash
318
161
  npm run build # production build
319
- npm run start # run built output
320
162
  npm run typecheck # type-check src + eval
321
- npm run eval # run the eval harness as a CI / regression gate
163
+ npm run eval # regression gate (powers `miii doctor`)
322
164
  ```
323
165
 
324
- The eval harness in `eval/` powers `miii doctor` and serves as a regression gate. If `npm run eval` exits non-zero, a prompt or tool change has regressed a baseline model.
325
-
326
- ### Testing Local Changes
327
-
328
- The global `miii` command points to the last installed version of `miii-agent`. To run your local working tree:
166
+ To run your local working tree against the global `miii`:
329
167
 
330
168
  ```bash
331
- node dist/cli.js doctor <model> # run the freshly built output directly
332
- # — or —
333
- npm run build && npm link # point the global `miii` at this repo
169
+ npm run build && npm link # restore later with: npm install -g miii-agent
334
170
  ```
335
-
336
- `npm link` symlinks the global `miii` to `dist/cli.js` in this repo. Restore the published version later with `npm install -g miii-agent`.
171
+ </details>
337
172
 
338
173
  ---
339
174
 
340
- ## Project Status
341
-
342
- **MVP.** Core agent loop is stable. Actively refining tool execution, streaming, and the permission model. PRs are welcome — fork it, break it, improve it.
175
+ ## Status
343
176
 
344
- ---
177
+ **MVP.** Core agent loop is stable; actively refining tool execution, streaming, and the permission model. PRs welcome — fork it, break it, improve it.
345
178
 
346
179
  ## License
347
180
 
348
181
  MIT © [maruakshay](https://github.com/maruakshay)
349
182
 
350
- ---
351
-
352
183
  <p align="center">
353
- Built for engineers who'd rather own their tools than rent them.
184
+ <em>Built for engineers who'd rather own their tools than rent them.</em>
354
185
  </p>