Files
memabra/docs/RUNNER_AND_STORE.md
2026-04-15 11:06:05 +08:00

84 lines
1.7 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# Runner, Schemas, and Memory Store
## 目标
把 memabra 从“能分别检索、路由、回放”推进到“能产出合法 draft trajectory、能校验数据、能管理 typed memory records”。
## 当前实现
### runner.py
提供:
- `MemabraRunner`
能力:
- 接收 `TaskContext`
- 调用 retriever 获取候选
- 调用 router 生成动作决策
- 自动生成 draft trajectory
- 产出最小事件流:
- `task_received`
- `candidates_recalled`
- `action_selected`
意义:
这让 memabra 第一次具备了一个 task-to-trajectory 的实际入口。
### schemas.py
提供:
- `SchemaRegistry`
- `SchemaValidationError`
当前策略:
- 先做轻量级 runtime validation
- 不依赖外部库
- 先校验关键 required keys
这还不是完整 JSON Schema engine但足够先守住地板线避免样本结构乱飞。
### memory_store.py
提供:
- `MemoryRecord`
- `MemorySource`
- `VerificationState`
- `InMemoryMemoryStore`
当前能力:
- upsert
- get
- list_by_type
- mark_used
- verify
- revoke
意义:
现在 memabra 终于不是只会“谈记忆”,而是有一个 typed memory record runtime 了。
## 当前闭环
现在已有:
- retrieval
- router
- runner
- replay
- memory store
- schema validation
也就是:
任务 -> 候选召回 -> 路由决策 -> trajectory 草稿 -> 回放统计
并且 memory record 本身也能做校验和状态变更。
## 还差什么
- execution adapter真实工具/skill/memory 注入)
- 完整 JSON Schema 验证
- trajectory 持久化层
- richer reward aggregation
- counterfactual replay
## 建议下一步
1.`execution.py`
2.`persistence.py`
3. 给 runner 接上 memory store 和 telemetry writeback
4. 做 richer router scoring v2