omk 0.5.0

A Rust runtime for Kimi CLI. Turns prompts into proof-backed engineering runs with gates, worktrees, and replay.
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
# OMK API Reference

## MCP Server (JSON-RPC 2.0 over stdio)

Start the MCP server:

```bash
omk mcp-server
```

### Tools

#### `omk_team_run`

Run a scheduler-backed Kimi team through the Wire runtime.

**Parameters:**

| Name | Type | Description |
| --- | --- | --- |
| `spec` | string | Worker spec, for example `3:executor`. |
| `task` | string | Task description. |
| `name` | string | Optional team name. |

**Response:**

```json
{
  "status": "completed",
  "stdout": "...",
  "stderr": "",
  "spec": "3:executor",
  "task": "refactor authentication"
}
```

#### `omk_team_status`

Get team status.

**Parameters:**

| Name | Type | Description |
| --- | --- | --- |
| `name` | string | Team name. |

**Response:**

```json
{
  "status": "ok",
  "team": "executor-a1b2",
  "stdout": "...",
  "stderr": ""
}
```

#### `omk_team_shutdown`

Shutdown or mark a team interrupted.

**Parameters:**

| Name | Type | Description |
| --- | --- | --- |
| `name` | string | Team name. |
| `force` | boolean | Force shutdown handling. Defaults to `false`. |

**Response:**

```json
{
  "status": "shutdown",
  "team": "executor-a1b2",
  "force": false,
  "stdout": "...",
  "stderr": ""
}
```

#### `omk_doctor`

Run environment diagnostics.

**Parameters:** none

**Response:**

```json
{
  "status": "healthy",
  "healthy": true,
  "stdout": "...",
  "stderr": ""
}
```

## Web Dashboard REST API

Base URL: `http://localhost:8080`

### `GET /api/health`

```json
{
  "status": "ok",
  "version": "<crate-version>",
  "checks": {
    "kimi": {
      "status": "ok"
    },
    "disk": {
      "status": "ok"
    }
  }
}
```

`version` matches the running `omk` crate version reported by `omk --version`.

### `GET /api/teams`

```json
{
  "teams": [
    {
      "version": 1,
      "name": "executor-a1b2",
      "task": "refactor authentication",
      "created_at": "2026-05-11T12:00:00Z",
      "worker_count": 3,
      "worker_role": "executor",
      "phase": "Executing",
      "tasks": [],
      "state_dir": "/home/user/.local/state/omk/team/executor-a1b2"
    }
  ]
}
```

### `GET /api/autopilots`

```json
{
  "autopilots": [
    {
      "version": 1,
      "task": "build REST API",
      "phase": "Execution",
      "plans_dir": "/home/user/.local/state/omk/autopilot/ap-xxx/plans",
      "created_at": "2026-05-11T12:00:00Z"
    }
  ]
}
```

### `GET /api/ralphs`

```json
{
  "ralphs": [
    {
      "version": 1,
      "task": "implement auth",
      "iteration": 3,
      "max_iterations": 10,
      "state_dir": "/home/user/.local/state/omk/ralph/auth"
    }
  ]
}
```

### `GET /api/metrics`

Aggregated runtime counters.

```json
{
  "metrics": {
    "version": 1,
    "created_at": "2026-05-11T12:00:00Z",
    "updated_at": "2026-05-11T12:10:00Z",
    "total_team_runs": 12,
    "total_spawns": 12,
    "total_shutdowns": 10,
    "total_tasks_created": 45,
    "total_tasks_completed": 40,
    "total_tasks_failed": 5,
    "total_ask_calls": 78,
    "total_ask_errors": 2,
    "total_autopilot_runs": 5,
    "total_ralph_runs": 3
  }
}
```

`total_spawns` is a legacy compatibility alias for `total_team_runs`.

## Chat API

`omk chat` (alias `omk c`) opens a terminal-native REPL. Session state is persisted under the OMK state directory.

### Session files

| File | Purpose |
|------|---------|
| `~/.local/state/omk/sessions/<session-id>/meta.json` | Session metadata (id, start time, project root, theme) |
| `~/.local/state/omk/sessions/<session-id>/conversation.jsonl` | Append-only conversation log |
| `~/.local/state/omk/sessions/<session-id>/session-history.jsonl` | Input history for the current session |
| `~/.local/state/omk/sessions/<session-id>/engine-events.jsonl` | Engine pane event stream |

### `conversation.jsonl` schema

Each line is a JSON object:

```json
{"ts":"2026-05-21T10:00:00Z","role":"user","text":"hello"}
```

- `ts` — ISO 8601 UTC timestamp
- `role``user` or `assistant`
- `text` — message content

### CLI options

- `omk chat --session <id>` — resume a specific session
- `omk chat --new` — start a fresh session

## MCP Client API

`omk mcp` provides a client surface for configured MCP servers.

| Command | Output | Notes |
|---|---|---|
| `omk mcp list` | Text list of configured servers and their config path | Reads `~/.config/omk/mcp.json` or `.omk/mcp.json` |
| `omk mcp doctor` | Text diagnostics (healthy/unhealthy counts) | Checks reachability of configured transports |
| `omk mcp call <server> <tool> [args]` | Tool-specific output | `args` defaults to `{}` |

## Goal API

> **Current status:** Goal is CLI-only. There are no goal-specific MCP tools or REST endpoints yet. The web dashboard does not expose goal state over HTTP. Machine-readable access is available through the `omk goal` CLI with `--json` or `--format json|md`.

### Goal CLI — Machine-Readable Output

The following commands support structured output for scripting and integration:

| Command | `--json` | `--format text` | `--format json` | `--format md` | Notes |
| --- | --- | --- | --- | --- | --- |
| `omk goal show` ||||| Full `GoalState` |
| `omk goal proof` ||||| `GoalProof` artifact |
| `omk goal replay` ||||| `GoalReplay` timeline |
| `omk goal budget` ||||| `GoalBudgetReport` |
| `omk goal status` ||||| Text only |
| `omk goal list` ||||| Text only |

#### `omk goal show --json`

Serializes the full `GoalState` (secrets redacted at the Wire boundary):

```json
{
  "version": 1,
  "goal_id": "goal-20260519-abc123",
  "original_goal": "refactor authentication module",
  "normalized_goal": "refactor authentication module",
  "status": "running",
  "phase": "execution",
  "created_at": "2026-05-19T10:00:00Z",
  "updated_at": "2026-05-19T10:30:00Z",
  "completed_at": null,
  "until_ready": true,
  "budget_time": "8h",
  "budget_tokens": 500000,
  "budget_usd": 10.0,
  "max_agents": 5,
  "terminal_criteria": {
    "proof_required": true,
    "gates_required": true,
    "human_blockers_stop": true
  },
  "delivery_policy": "local",
  "merge_policy": "disabled",
  "slice_execution": false,
  "artifacts": [
    {
      "kind": "plan",
      "path": "/home/user/.local/state/omk/goal/goal-20260519-abc123/plan.md",
      "created_at": "2026-05-19T10:05:00Z"
    }
  ],
  "failure": null,
  "state_dir": "/home/user/.local/state/omk/goal/goal-20260519-abc123"
}
```

**Status values:** `running`, `ready`, `not_ready`, `blocked_on_human`, `blocked_on_external`, `needs_more_budget`, `failed_infra`, `paused`, `cancelled`.

**Phase values:** `intake`, `planning`, `decomposition`, `execution`, `verification_design`, `proof`.

#### `omk goal proof --json`

Serializes the current `GoalProof` artifact:

```json
{
  "version": 1,
  "goal_id": "goal-20260519-abc123",
  "status": "not_ready",
  "readiness": "not ready: verification gates and bounded agent execution passed, but review/security evidence is missing",
  "summary": "Goal 'refactor authentication module' has 3 gate result(s) and remains not ready until all required execution and review evidence exists.",
  "generated_at": "2026-05-19T10:30:00Z",
  "artifacts": [
    {
      "kind": "plan",
      "path": "/home/user/.local/state/omk/goal/goal-20260519-abc123/plan.md",
      "created_at": "2026-05-19T10:05:00Z"
    }
  ],
  "task_graph_summary": {
    "total_tasks": 5,
    "pending_tasks": 1,
    "blocked_tasks": 0,
    "done_tasks": 4
  },
  "changed_files": [
    "src/auth/mod.rs",
    "src/auth/oauth.rs"
  ],
  "commits": [
    "a1b2c3d"
  ],
  "gates": [
    {
      "name": "cargo test",
      "passed": true,
      "stdout": "...",
      "stderr": "",
      "duration_ms": 12500,
      "required": true,
      "command_line": "cargo test",
      "exit_code": 0,
      "timed_out": false
    }
  ],
  "post_mutation_gates_ran": false,
  "known_gaps": [
    "review evidence has not run for this goal yet",
    "security review evidence has not run for this goal yet"
  ],
  "human_decisions_required": []
}
```

#### `omk goal replay --json`

Serializes the deduplicated goal timeline:

```json
{
  "version": 1,
  "goal_id": "goal-20260519-abc123",
  "status": "running",
  "phase": "execution",
  "generated_at": "2026-05-19T10:30:00Z",
  "event_count": 12,
  "task_graph_summary": {
    "total_tasks": 5,
    "pending_tasks": 1,
    "blocked_tasks": 0,
    "done_tasks": 4
  },
  "timeline": [
    {
      "index": 0,
      "ts": "2026-05-19T10:00:05Z",
      "kind": "goal_created",
      "actor": null,
      "summary": "status=running, phase=intake"
    },
    {
      "index": 3,
      "ts": "2026-05-19T10:15:00Z",
      "kind": "task_started",
      "actor": "agent-1",
      "summary": "task_id=goal-agent-execute"
    }
  ],
  "recovery_status": null,
  "known_gaps": [],
  "duplicate_events": 0,
  "parse_failures": 0
}
```

#### `omk goal budget --json`

Serializes the `GoalBudgetReport` with checkpoints:

```json
{
  "version": 1,
  "goal_id": "goal-20260519-abc123",
  "generated_at": "2026-05-19T10:30:00Z",
  "budget_time": "8h",
  "total_budget_secs": 28800,
  "budget_tokens": 500000,
  "used_tokens": 125000,
  "remaining_budget_tokens": 375000,
  "budget_usd": 10.0,
  "estimated_cost_usd": 2.5,
  "remaining_budget_usd": 7.5,
  "latest": {
    "version": 1,
    "goal_id": "goal-20260519-abc123",
    "label": "budget_extended",
    "status": "running",
    "phase": "execution",
    "recorded_at": "2026-05-19T10:20:00Z",
    "budget_time": "8h",
    "total_budget_secs": 28800,
    "elapsed_since_created_secs": 1200,
    "remaining_budget_secs": 27600,
    "budget_tokens": 500000,
    "used_tokens": 125000,
    "remaining_budget_tokens": 375000,
    "budget_usd": 10.0,
    "estimated_cost_usd": 2.5,
    "remaining_budget_usd": 7.5
  },
  "checkpoints": [
    {
      "version": 1,
      "goal_id": "goal-20260519-abc123",
      "label": "budget_extended",
      "status": "running",
      "phase": "execution",
      "recorded_at": "2026-05-19T10:20:00Z",
      "budget_time": "8h",
      "total_budget_secs": 28800,
      "elapsed_since_created_secs": 1200,
      "remaining_budget_secs": 27600,
      "budget_tokens": 500000,
      "used_tokens": 125000,
      "remaining_budget_tokens": 375000,
      "budget_usd": 10.0,
      "estimated_cost_usd": 2.5,
      "remaining_budget_usd": 7.5
    }
  ],
  "spent_usd": 2.5,
  "spent_tokens": 125000,
  "spent_seconds": 1200
}
```