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.
Files changed (3) hide show
  1. package/README.md +159 -154
  2. package/bin/mio.js +9 -0
  3. package/package.json +1 -1
package/README.md CHANGED
@@ -1,177 +1,198 @@
1
- # Mio Agent Runtime
1
+ # mio-agent-runtime
2
2
 
3
- **安装一次,所有 Agent 自动获得记忆、观察、策略和进化能力。**
3
+ > Your AI agents forget everything between sessions. Mio fixes that.
4
4
 
5
- Mio 不替代任何 AI Agent,而是作为统一智能层嵌入它们。安装后,Codex、OpenCode、Hermes、WorkBuddy 的决策、错误和结果自动进入共享记忆库,跨 Agent 复用经验。
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 ─┤──── MCP ──── Mio Intelligence Core
10
- Hermes ─┤ ├─ Memory 决策 / 上下文 / 问题记录
11
- WorkBuddy ─┘ ├─ Observer 被动观察 Agent 行为
12
- ├─ Policy 高风险操作拦截
13
- ├─ Experience 跨 Agent 经验复用
14
- ├─ Ideas 记忆驱动创意生成
15
- └─ Evolution 生态级优化建议
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
- ## Quick Start
20
+ ## Install
21
21
 
22
22
  ```bash
23
- npm install -g mio-agent-runtime # 全局安装
24
- mio init # 初始化 MIO_HOME
25
- mio install codex # 接入 Codex(可换 opencode / hermes / workbuddy)
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
- 安装后重启目标 Agent 即可。无需改变任何使用习惯。
29
+ Restart your agent after install. That's it.
30
30
 
31
31
  ---
32
32
 
33
- ## CLI
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
- **`mio install` 执行流程:**
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
- ├─ 写入 MCP Server 配置到 ~/.codex/config.json
55
- ├─ 注入 Agent 使用规则到 AGENTS.md
56
- ├─ 回填最近 24h 历史会话
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 — `mio.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 — `mio.observer.*`
91
+ ### Observer
75
92
 
76
- | Tool | Description |
77
- |------|-------------|
78
- | `mio.observer.ingest` | 上报 Agent 事件:工具调用、错误、重试、任务结果 |
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 — `mio.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 — `mio.experience.*`
105
+ ### Experience
89
106
 
90
- | Tool | Description |
91
- |------|-------------|
92
- | `mio.experience.reuse` | 记录一次跨 Agent 经验复用:来源 Agent → 目标 Agent → 是否改善结果 |
93
- | `mio.experience.confirm` | 人工确认自动声明的复用记录 |
94
- | `mio.experience.list` | 查询复用证据,按状态 / Agent 过滤 |
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 — `mio.task.*`
113
+ ### Task
97
114
 
98
- | Tool | Description |
99
- |------|-------------|
100
- | `mio.task.route` | 根据历史经验为任务推荐最佳执行 Agent |
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 — `mio.agent.*`
120
+ ### Agent
104
121
 
105
- | Tool | Description |
106
- |------|-------------|
107
- | `mio.agent.register` | 注册 Agent 元数据(名称、能力、宿主) |
108
- | `mio.agent.list` | 列出已注册的 Agent |
109
- | `mio.agent.report` | 查询指定 Agent 的能力报告和行为摘要 |
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 — `mio.idea.*`
128
+ ### Ideas
112
129
 
113
- | Tool | Description |
114
- |------|-------------|
115
- | `mio.idea.generate` | 基于记忆库,用 5 种策略生成创意:SCAMPER / 类比 / 第一性原理 / 随机刺激 / 约束反转 |
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 — `mio.evolution.*`
135
+ ### Evolution
119
136
 
120
- | Tool | Description |
121
- |------|-------------|
122
- | `mio.evolution.report` | 生成 Agent 生态系统分析报告 |
123
- | `mio.evolution.suggest` | 输出可执行优化建议(含 nextAction 和 impact) |
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 — `mio.phase0.*`
142
+ ### Validation
126
143
 
127
- | Tool | Description |
128
- |------|-------------|
129
- | `mio.phase0.report` | 生成跨 Agent 价值验证报告(JSON / Markdown) |
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 | MCP Config | Passive Observer | Notes |
136
- |------|-----------|-----------------|-------|
137
- | **Codex** | `~/.codex/config.json` | 不需要 | 默认主动调用 MCP 工具 |
138
- | **OpenCode** | `~/.config/opencode/opencode.json` | `opencode db` 增量读取 | 同时写入 `AGENTS.md` 的 `MIO_CONTEXT` 块 |
139
- | **Hermes** | `hermes mcp add` | `state.db` 自增游标 | 有原生记忆,Mio 负责跨 Agent 经验接入 |
140
- | **WorkBuddy** | `~/.workbuddy/mcp.json` | 监听 `projects/**/*.jsonl` | 写回 `CODEBUDDY.md` + `<workspace>/AGENTS.md` |
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
- **被动观察器**是核心差异化:不依赖 Agent 主动调用,自动从会话日志中提取任务结果和工具错误,写入统一数据层。
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
- 提取 task_outcome / error / summary
150
- ↓
151
- 写入 MIO_HOME/traces.jsonl + memory.jsonl
152
- ↓
153
- 写回 Agent 原生记忆文件(单 Agent 闭环)
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
- 增量机制:已处理文件偏移记录在 `observe-state.json`,只回填 24h 内更新的会话。
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
- 默认 `~/.mio-intelligence`,可通过 `MIO_HOME` 环境变量覆盖。
183
+ Default: `~/.mio-intelligence` (override with `MIO_HOME` env var).
163
184
 
164
185
  ```
165
186
  ~/.mio-intelligence/
166
- config.json 运行时配置
167
- memory.jsonl 记忆存储
168
- traces.jsonl 行为追踪
169
- experience-reuse.jsonl 跨 Agent 复用记录
170
- ideas.jsonl 创意想法
171
- suggestions.jsonl 进化建议
172
- observe-state.json 观察器增量游标
173
- observe.pid 后台守护进程 ID
174
- logs/ 运行日志
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
- 传统模式:每个 Agent 独立运作
203
+ Before Mio:
183
204
 
184
- Codex (记忆A) OpenCode (记忆B) Hermes (记忆C)
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 ─┤────────>│ Mio Intelligence Core │
193
- WorkBuddy ─┘ │ │
194
- │ Memory · Observer · Policy │
195
- │ Experience · Ideas · Evolution │
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
- | | 单 Agent Memory | Mio Control Plane |
222
+ | | Standalone Agent Memory | Mio Control Plane |
202
223
  |---|---|---|
203
- | **作用域** | 单个 Agent | 多 Agent 生态 |
204
- | **数据采集** | 依赖主动调用 | 被动观察 + 主动调用 |
205
- | **经验流动** | 无 | 跨 Agent 复用 + 证据验证 |
206
- | **风险管理** | 无 | 统一策略检查 |
207
- | **优化目标** | 单 Agent 记忆质量 | 整个生态的效率和质量 |
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 Requirements
232
+ ## Version History
212
233
 
213
- | Version | Capability |
234
+ | Version | Milestone |
214
235
  |---------|-----------|
215
- | < 0.3.6 | 仅主动 MCP 规则注入 |
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':
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mio-agent-runtime",
3
- "version": "0.5.6",
3
+ "version": "0.5.8",
4
4
  "description": "Mio Agent Runtime installer and MCP intelligence layer",
5
5
  "license": "MIT",
6
6
  "type": "commonjs",