mio-agent-runtime 0.5.6 → 0.5.8
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.
- package/README.md +159 -154
- package/bin/mio.js +9 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,177 +1,198 @@
|
|
|
1
|
-
#
|
|
1
|
+
# mio-agent-runtime
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
> Your AI agents forget everything between sessions. Mio fixes that.
|
|
4
4
|
|
|
5
|
-
Mio
|
|
5
|
+
Mio is a drop-in intelligence layer for Codex, OpenCode, Hermes, and WorkBuddy. Install once, and every agent you use starts remembering decisions, learning from mistakes, and sharing experience across tools — without any workflow changes.
|
|
6
6
|
|
|
7
7
|
```
|
|
8
8
|
Codex ─┐
|
|
9
|
-
OpenCode
|
|
10
|
-
Hermes
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
9
|
+
OpenCode ─┤── MCP ──> Mio Intelligence Core
|
|
10
|
+
Hermes ─┘ ├─ Memory decisions, context, problems
|
|
11
|
+
├─ Observer passive session monitoring
|
|
12
|
+
├─ Policy risk checks before dangerous ops
|
|
13
|
+
├─ Experience cross-agent knowledge transfer
|
|
14
|
+
├─ Ideas memory-powered idea generation
|
|
15
|
+
└─ Evolution ecosystem-level optimization
|
|
16
16
|
```
|
|
17
17
|
|
|
18
18
|
---
|
|
19
19
|
|
|
20
|
-
##
|
|
20
|
+
## Install
|
|
21
21
|
|
|
22
22
|
```bash
|
|
23
|
-
npm install -g mio-agent-runtime
|
|
24
|
-
mio init
|
|
25
|
-
mio install codex
|
|
26
|
-
mio status
|
|
23
|
+
npm install -g mio-agent-runtime
|
|
24
|
+
mio init
|
|
25
|
+
mio install codex # or: opencode, hermes, workbuddy
|
|
26
|
+
mio status
|
|
27
27
|
```
|
|
28
28
|
|
|
29
|
-
|
|
29
|
+
Restart your agent after install. That's it.
|
|
30
30
|
|
|
31
31
|
---
|
|
32
32
|
|
|
33
|
-
##
|
|
33
|
+
## What it actually does
|
|
34
34
|
|
|
35
|
-
|
|
36
|
-
|------|------|
|
|
37
|
-
| `mio init` | 创建 `~/.mio-intelligence` 目录和默认配置 |
|
|
38
|
-
| `mio install <host>` | 接入指定 Agent,写入 MCP 配置 + 规则,启动观察器 |
|
|
39
|
-
| `mio mcp` | 启动 MCP Server(stdio 模式) |
|
|
40
|
-
| `mio status` | 显示运行时状态、各 Adapter 状态、观察器进程 |
|
|
41
|
-
| `mio agents` | 列出已安装的 Agent |
|
|
42
|
-
| `mio observe` | 前台持续监听(Ctrl+C 停止) |
|
|
43
|
-
| `mio observe --start` | 启动后台观察守护进程 |
|
|
44
|
-
| `mio observe --stop` | 停止后台守护进程 |
|
|
45
|
-
| `mio observe --status` | 查看观察器运行状态 |
|
|
46
|
-
| `mio observe --once` | 执行一次采集周期 |
|
|
47
|
-
| `mio --json <cmd>` | 任意命令加 `--json` 输出机器可读格式 |
|
|
35
|
+
**Without Mio**, every agent starts from zero each session. Your Codex forgets why you chose Postgres over Redis. Your OpenCode re-discovers the same config bug. Your WorkBuddy re-reads the same ADR you already explained.
|
|
48
36
|
|
|
49
|
-
|
|
37
|
+
**With Mio**, the first agent to solve a problem records the solution. The next agent — any agent — finds it automatically.
|
|
38
|
+
|
|
39
|
+
```
|
|
40
|
+
Session 1 (Codex) Session 2 (OpenCode)
|
|
41
|
+
───────────────── ──────────────────
|
|
42
|
+
"Why not Redis?" "How should we cache?"
|
|
43
|
+
→ records decision → queries memory
|
|
44
|
+
→ Mio saves it → finds the Redis answer
|
|
45
|
+
→ skips the dead end
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
---
|
|
49
|
+
|
|
50
|
+
## CLI Reference
|
|
51
|
+
|
|
52
|
+
| Command | Description |
|
|
53
|
+
|---------|-------------|
|
|
54
|
+
| `mio init` | Create `~/.mio-intelligence` and default config |
|
|
55
|
+
| `mio install <host>` | Wire MCP + rules + observer into a host |
|
|
56
|
+
| `mio mcp` | Start MCP server (stdio, for agent integration) |
|
|
57
|
+
| `mio status` | Show runtime state, adapter status, observer PID |
|
|
58
|
+
| `mio agents` | List installed hosts |
|
|
59
|
+
| `mio observe` | Foreground session monitor (Ctrl+C to stop) |
|
|
60
|
+
| `mio observe --start` | Start background observer daemon |
|
|
61
|
+
| `mio observe --stop` | Stop background daemon |
|
|
62
|
+
| `mio observe --status` | Check daemon state |
|
|
63
|
+
| `mio observe --once` | Run one collection cycle |
|
|
64
|
+
| `mio --json <cmd>` | Any command outputs JSON |
|
|
65
|
+
|
|
66
|
+
**What `mio install` does under the hood:**
|
|
50
67
|
|
|
51
68
|
```
|
|
52
69
|
mio install codex
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
70
|
+
|
|
|
71
|
+
+-- Writes MCP server config to ~/.codex/config.json
|
|
72
|
+
+-- Injects usage rules into AGENTS.md
|
|
73
|
+
+-- Backfills last 24h of session history
|
|
74
|
+
+-- Starts background passive observer
|
|
58
75
|
```
|
|
59
76
|
|
|
60
77
|
---
|
|
61
78
|
|
|
62
|
-
## MCP Tools
|
|
79
|
+
## MCP Tools (22 tools)
|
|
63
80
|
|
|
64
|
-
### Memory
|
|
81
|
+
### Memory
|
|
65
82
|
|
|
66
|
-
| Tool | Description |
|
|
67
|
-
|
|
68
|
-
| `mio.memory.record` |
|
|
69
|
-
| `mio.memory.query` |
|
|
70
|
-
| `mio.memory.analyze` |
|
|
71
|
-
| `mio.memory.archive` |
|
|
72
|
-
| `mio.memory.migrate` |
|
|
83
|
+
| Tool | Required | Optional | Description |
|
|
84
|
+
|------|----------|----------|-------------|
|
|
85
|
+
| `mio.memory.record` | `content` | `kind`, `tags`, `project`, `scope`, `source` | Save a decision, context, problem, or note |
|
|
86
|
+
| `mio.memory.query` | `query` | `project`, `limit`, `kind`, `tags`, `scope` | Search memory by keyword, tag, or type |
|
|
87
|
+
| `mio.memory.analyze` | — | `project`, `limit` | Audit quality: duplicates, low-quality, type distribution |
|
|
88
|
+
| `mio.memory.archive` | `ids` | `project`, `restore`, `reason` | Archive records (recoverable) |
|
|
89
|
+
| `mio.memory.migrate` | `ids`, `scope` | `project`, `reason` | Move between project and global layers |
|
|
73
90
|
|
|
74
|
-
### Observer
|
|
91
|
+
### Observer
|
|
75
92
|
|
|
76
|
-
| Tool | Description |
|
|
77
|
-
|
|
78
|
-
| `mio.observer.ingest` |
|
|
79
|
-
| `mio.observer.subscribe` |
|
|
80
|
-
| `mio.observer.digest` |
|
|
93
|
+
| Tool | Required | Optional | Description |
|
|
94
|
+
|------|----------|----------|-------------|
|
|
95
|
+
| `mio.observer.ingest` | `trace_id`, `event_type` | `payload`, `outcome`, `agent`, `host`, `project` | Report tool calls, errors, retries, task outcomes |
|
|
96
|
+
| `mio.observer.subscribe` | — | `eventTypes`, `project`, `topic`, `ttlDays` | Subscribe to event stream by type/project |
|
|
97
|
+
| `mio.observer.digest` | — | `project`, `eventTypes`, `limit` | Pull new events since last digest |
|
|
81
98
|
|
|
82
|
-
### Policy
|
|
99
|
+
### Policy
|
|
83
100
|
|
|
84
|
-
| Tool | Description |
|
|
85
|
-
|
|
86
|
-
| `mio.policy.check` |
|
|
101
|
+
| Tool | Required | Optional | Description |
|
|
102
|
+
|------|----------|----------|-------------|
|
|
103
|
+
| `mio.policy.check` | `action` | `project`, `context` | Pre-flight risk check against historical failure data |
|
|
87
104
|
|
|
88
|
-
### Experience
|
|
105
|
+
### Experience
|
|
89
106
|
|
|
90
|
-
| Tool | Description |
|
|
91
|
-
|
|
92
|
-
| `mio.experience.reuse` |
|
|
93
|
-
| `mio.experience.confirm` |
|
|
94
|
-
| `mio.experience.list` |
|
|
107
|
+
| Tool | Required | Optional | Description |
|
|
108
|
+
|------|----------|----------|-------------|
|
|
109
|
+
| `mio.experience.reuse` | `sourceAgent`, `targetAgent`, `experienceId`, `reuse`, `behaviorChanged`, `outcomeImproved` | `notes`, `project` | Record cross-agent experience reuse with evidence |
|
|
110
|
+
| `mio.experience.confirm` | `id` | `confirmedBy`, `notes`, `outcomeImproved` | Human-confirm an auto-claimed reuse record |
|
|
111
|
+
| `mio.experience.list` | — | `status`, `targetAgent`, `limit`, `project` | Query reuse evidence, filter by status |
|
|
95
112
|
|
|
96
|
-
### Task
|
|
113
|
+
### Task
|
|
97
114
|
|
|
98
|
-
| Tool | Description |
|
|
99
|
-
|
|
100
|
-
| `mio.task.route` |
|
|
101
|
-
| `mio.task.record_outcome` |
|
|
115
|
+
| Tool | Required | Optional | Description |
|
|
116
|
+
|------|----------|----------|-------------|
|
|
117
|
+
| `mio.task.route` | `task` | `project`, `scope`, `limit` | Recommend best agent for a task based on history |
|
|
118
|
+
| `mio.task.record_outcome` | — | (event-based) | Record task success/failure/abort |
|
|
102
119
|
|
|
103
|
-
### Agent
|
|
120
|
+
### Agent
|
|
104
121
|
|
|
105
|
-
| Tool | Description |
|
|
106
|
-
|
|
107
|
-
| `mio.agent.register` |
|
|
108
|
-
| `mio.agent.list` |
|
|
109
|
-
| `mio.agent.report` |
|
|
122
|
+
| Tool | Required | Optional | Description |
|
|
123
|
+
|------|----------|----------|-------------|
|
|
124
|
+
| `mio.agent.register` | — | (metadata) | Register agent capabilities and host |
|
|
125
|
+
| `mio.agent.list` | — | — | List registered agents |
|
|
126
|
+
| `mio.agent.report` | — | (agent ID) | Query agent behavior summary |
|
|
110
127
|
|
|
111
|
-
### Ideas
|
|
128
|
+
### Ideas
|
|
112
129
|
|
|
113
|
-
| Tool | Description |
|
|
114
|
-
|
|
115
|
-
| `mio.idea.generate` |
|
|
116
|
-
| `mio.idea.list` |
|
|
130
|
+
| Tool | Required | Optional | Description |
|
|
131
|
+
|------|----------|----------|-------------|
|
|
132
|
+
| `mio.idea.generate` | `goal` | `context`, `constraints` | Generate ideas using 5 strategies: SCAMPER, analogy, first-principles, random-stimulus, constraint-inversion |
|
|
133
|
+
| `mio.idea.list` | — | `goal`, `strategy`, `period` | Query saved ideas |
|
|
117
134
|
|
|
118
|
-
### Evolution
|
|
135
|
+
### Evolution
|
|
119
136
|
|
|
120
|
-
| Tool | Description |
|
|
121
|
-
|
|
122
|
-
| `mio.evolution.report` |
|
|
123
|
-
| `mio.evolution.suggest` |
|
|
137
|
+
| Tool | Required | Optional | Description |
|
|
138
|
+
|------|----------|----------|-------------|
|
|
139
|
+
| `mio.evolution.report` | — | `project` | Ecosystem analysis report |
|
|
140
|
+
| `mio.evolution.suggest` | — | `project` | Actionable optimization suggestions with nextAction + impact |
|
|
124
141
|
|
|
125
|
-
### Validation
|
|
142
|
+
### Validation
|
|
126
143
|
|
|
127
|
-
| Tool | Description |
|
|
128
|
-
|
|
129
|
-
| `mio.phase0.report` |
|
|
144
|
+
| Tool | Required | Optional | Description |
|
|
145
|
+
|------|----------|----------|-------------|
|
|
146
|
+
| `mio.phase0.report` | — | `project`, `format` | Cross-agent value validation report (JSON / Markdown) |
|
|
130
147
|
|
|
131
148
|
---
|
|
132
149
|
|
|
133
150
|
## Supported Hosts
|
|
134
151
|
|
|
135
|
-
| Host |
|
|
136
|
-
|
|
137
|
-
| **Codex** | `~/.codex/config.json` |
|
|
138
|
-
| **OpenCode** | `~/.config/opencode/opencode.json` | `opencode db`
|
|
139
|
-
| **Hermes** | `hermes mcp add` | `state.db`
|
|
140
|
-
| **WorkBuddy** | `~/.workbuddy/mcp.json` |
|
|
152
|
+
| Host | Config Location | Observer Method | Write-back |
|
|
153
|
+
|------|----------------|-----------------|------------|
|
|
154
|
+
| **Codex** | `~/.codex/config.json` | Not needed (agent calls MCP directly) | AGENTS.md rules |
|
|
155
|
+
| **OpenCode** | `~/.config/opencode/opencode.json` | `opencode db` incremental read | `MIO_CONTEXT` block in AGENTS.md |
|
|
156
|
+
| **Hermes** | `hermes mcp add` | `state.db` cursor (no CLI needed) | AGENTS.md (git repos only) |
|
|
157
|
+
| **WorkBuddy** | `~/.workbuddy/mcp.json` | Tails `projects/**/*.jsonl` | `CODEBUDDY.md` + workspace AGENTS.md |
|
|
158
|
+
|
|
159
|
+
### How passive observation works
|
|
141
160
|
|
|
142
|
-
|
|
161
|
+
Most agents don't call memory tools on their own, even when rules are injected. The passive observer solves this by reading session logs directly:
|
|
143
162
|
|
|
144
163
|
```
|
|
145
|
-
Agent
|
|
146
|
-
|
|
147
|
-
mio observe
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
164
|
+
Agent session logs
|
|
165
|
+
|
|
|
166
|
+
mio observe (background daemon)
|
|
167
|
+
|
|
|
168
|
+
+-- Extracts task_outcome, errors, summaries
|
|
169
|
+
+-- Writes to MIO_HOME/traces.jsonl + memory.jsonl
|
|
170
|
+
+-- Writes summary back to agent's native memory file
|
|
171
|
+
|
|
|
172
|
+
Next session: agent sees Mio's notes without calling any tool
|
|
154
173
|
```
|
|
155
174
|
|
|
156
|
-
|
|
175
|
+
- **Incremental**: file offsets tracked in `observe-state.json`, no duplicates
|
|
176
|
+
- **Scoped**: only backfills sessions updated in last 24h
|
|
177
|
+
- **Per-host**: each adapter reads its own format (JSONL / SQLite / DB CLI)
|
|
157
178
|
|
|
158
179
|
---
|
|
159
180
|
|
|
160
181
|
## MIO_HOME
|
|
161
182
|
|
|
162
|
-
|
|
183
|
+
Default: `~/.mio-intelligence` (override with `MIO_HOME` env var).
|
|
163
184
|
|
|
164
185
|
```
|
|
165
186
|
~/.mio-intelligence/
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
187
|
+
config.json runtime config + installed hosts
|
|
188
|
+
memory.jsonl decisions, context, problems
|
|
189
|
+
traces.jsonl agent behavior events
|
|
190
|
+
experience-reuse.jsonl cross-agent reuse evidence
|
|
191
|
+
ideas.jsonl generated ideas
|
|
192
|
+
suggestions.jsonl evolution suggestions
|
|
193
|
+
observe-state.json observer increment cursors
|
|
194
|
+
observe.pid background daemon PID
|
|
195
|
+
logs/ runtime logs
|
|
175
196
|
```
|
|
176
197
|
|
|
177
198
|
---
|
|
@@ -179,59 +200,43 @@ mio observe(被动监听)
|
|
|
179
200
|
## Architecture
|
|
180
201
|
|
|
181
202
|
```
|
|
182
|
-
|
|
203
|
+
Before Mio:
|
|
183
204
|
|
|
184
|
-
Codex
|
|
185
|
-
|
|
186
|
-
|
|
205
|
+
Codex ──── (forgets everything)
|
|
206
|
+
OpenCode ── (starts from zero)
|
|
207
|
+
Hermes ──── (isolated memory)
|
|
208
|
+
WorkBuddy ─ (no continuity)
|
|
187
209
|
|
|
188
|
-
Mio
|
|
210
|
+
After Mio:
|
|
189
211
|
|
|
190
212
|
Codex ─┐
|
|
191
|
-
OpenCode ─┤
|
|
192
|
-
Hermes
|
|
193
|
-
WorkBuddy ─┘
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
跨 Agent 经验复用 + 生态优化
|
|
213
|
+
OpenCode ─┤ Mio Intelligence Core
|
|
214
|
+
Hermes ─┼────> + Memory ........... shared knowledge base
|
|
215
|
+
WorkBuddy ─┘ + Observer ......... automatic data collection
|
|
216
|
+
+ Policy ........... risk management
|
|
217
|
+
+ Experience ........ cross-agent reuse with evidence
|
|
218
|
+
+ Ideas ............ memory-powered creativity
|
|
219
|
+
+ Evolution ........ ecosystem optimization
|
|
199
220
|
```
|
|
200
221
|
|
|
201
|
-
| |
|
|
222
|
+
| | Standalone Agent Memory | Mio Control Plane |
|
|
202
223
|
|---|---|---|
|
|
203
|
-
|
|
|
204
|
-
|
|
|
205
|
-
|
|
|
206
|
-
|
|
|
207
|
-
|
|
|
224
|
+
| **Scope** | Single agent | Multi-agent ecosystem |
|
|
225
|
+
| **Collection** | Agent must call tools | Passive observation + active calls |
|
|
226
|
+
| **Knowledge flow** | Isolated | Shared with reuse evidence |
|
|
227
|
+
| **Risk management** | None | Unified policy checks |
|
|
228
|
+
| **Optimization** | Per-agent | Ecosystem-wide |
|
|
208
229
|
|
|
209
230
|
---
|
|
210
231
|
|
|
211
|
-
## Version
|
|
232
|
+
## Version History
|
|
212
233
|
|
|
213
|
-
| Version |
|
|
234
|
+
| Version | Milestone |
|
|
214
235
|
|---------|-----------|
|
|
215
|
-
| < 0.3.6 |
|
|
216
|
-
| >= 0.3.6 |
|
|
217
|
-
| >= 0.5.0 |
|
|
218
|
-
|
|
219
|
-
---
|
|
220
|
-
|
|
221
|
-
## Development
|
|
222
|
-
|
|
223
|
-
```bash
|
|
224
|
-
git clone https://github.com/your-org/akemi-mio.git
|
|
225
|
-
cd akemi-mio
|
|
226
|
-
npm run check # 全量语法检查
|
|
227
|
-
```
|
|
228
|
-
|
|
229
|
-
**发布流程:**
|
|
230
|
-
|
|
231
|
-
1. 编辑 `server/mio-intelligence-mcp/index.js`
|
|
232
|
-
2. 复制到 `tmp/mio-agent-runtime/package/server/mio-intelligence-mcp/index.js`
|
|
233
|
-
3. Bump `tmp/mio-agent-runtime/package/package.json` 版本号
|
|
234
|
-
4. `cd tmp/mio-agent-runtime/package && npm publish`
|
|
236
|
+
| < 0.3.6 | Active MCP rule injection only |
|
|
237
|
+
| >= 0.3.6 | Passive observation + seamless read/write |
|
|
238
|
+
| >= 0.5.0 | Idea generation + evolution suggestions |
|
|
239
|
+
| >= 0.5.6 | Rewritten documentation |
|
|
235
240
|
|
|
236
241
|
---
|
|
237
242
|
|
package/bin/mio.js
CHANGED
|
@@ -45,6 +45,11 @@ function jsonOrText(payload, useJson) {
|
|
|
45
45
|
return payload
|
|
46
46
|
}
|
|
47
47
|
|
|
48
|
+
function versionCommand() {
|
|
49
|
+
const pkg = require(path.resolve(__dirname, '..', 'package.json'))
|
|
50
|
+
console.log(pkg.version)
|
|
51
|
+
}
|
|
52
|
+
|
|
48
53
|
function initCommand() {
|
|
49
54
|
ensureHome()
|
|
50
55
|
const config = readConfig()
|
|
@@ -218,6 +223,7 @@ function help() {
|
|
|
218
223
|
console.log(`Mio Agent Runtime CLI
|
|
219
224
|
|
|
220
225
|
Usage:
|
|
226
|
+
mio version Show installed Mio version
|
|
221
227
|
mio init Initialize MIO_HOME
|
|
222
228
|
mio mcp Start Mio MCP server (stdio)
|
|
223
229
|
mio install <host> Install Mio into a host (codex|opencode|workbuddy|hermes)
|
|
@@ -238,6 +244,9 @@ function main() {
|
|
|
238
244
|
const command = args[0] || 'help'
|
|
239
245
|
|
|
240
246
|
switch (command) {
|
|
247
|
+
case 'version':
|
|
248
|
+
case '--version':
|
|
249
|
+
return versionCommand()
|
|
241
250
|
case 'init':
|
|
242
251
|
return initCommand()
|
|
243
252
|
case 'mcp':
|