chore: remove docs/, extract current knowledge to .cards
CI / check (pull_request) Successful in 3m57s
CI / check (pull_request) Successful in 3m57s
Remove 13 docs files (7 fully outdated @uncaged/* era, 6 superseded). Extract 3 verified architectural facts as new .cards: - frontmatter-fast-path: no LLM extraction, pure parse + schema validate + agent self-retry - agent-cli-protocol: adapter output JSON via stdout, agent-owned step persistence - status-based-moderator: pure graph lookup + mustache rendering, zero LLM cost All 3 cards cross-checked against current source code (run.ts, evaluate.ts, frontmatter.ts).
This commit is contained in:
@@ -0,0 +1,24 @@
|
||||
---
|
||||
title: "Agent CLI Protocol — Adapter Output via stdout"
|
||||
created: "2026-06-07"
|
||||
source: "openclaw-xiaomo"
|
||||
tags: [architecture, protocol]
|
||||
category: "architecture"
|
||||
links:
|
||||
- deterministic-engine-uncertain-agent
|
||||
- frontmatter-fast-path
|
||||
---
|
||||
|
||||
uwf 的 agent 通过 CLI 协议与 engine 通信。
|
||||
|
||||
**调用方式**:`<agent-cmd> --thread <id> --role <role> --prompt <text>`
|
||||
|
||||
**输出协议**:agent 将 `AdapterOutput` JSON 写入 stdout 的最后一行。包含:
|
||||
- `stepHash` — 新 StepNode 的 CAS hash
|
||||
- `detailHash` — 完整 agent 交互记录(tool call 历史)
|
||||
- `role` — 角色名
|
||||
- `frontmatter` — 提取的结构化输出
|
||||
- `body` — markdown 正文
|
||||
- `usage` — token 用量统计(turns, input/output tokens, duration)
|
||||
|
||||
**关键设计**:agent 进程完全独立——自己读 CAS 拿上下文、自己写 StepNode、自己做 frontmatter 校验和重试。engine 只负责调度和路由。这保证了 agent 实现可以随时替换(builtin / hermes / claude-code),协议层面完全对等。
|
||||
@@ -0,0 +1,21 @@
|
||||
---
|
||||
title: "Frontmatter Fast-Path — No LLM Extraction"
|
||||
created: "2026-06-07"
|
||||
source: "openclaw-xiaomo"
|
||||
tags: [architecture, decision]
|
||||
category: "architecture"
|
||||
links:
|
||||
- deterministic-engine-uncertain-agent
|
||||
- dissipative-structure-token-for-entropy
|
||||
---
|
||||
|
||||
uwf 的 agent 输出提取管线做了一个关键简化:**完全不用 LLM 做结构化提取**。
|
||||
|
||||
流程:agent 输出 → 解析 YAML frontmatter → 校验 JSON Schema → 成功则继续,失败则让**同一个 agent** 在原 session 内追加轮次自修(最多 2 次)。
|
||||
|
||||
为什么不用单独的 LLM 提取:
|
||||
1. **原始 agent 有完整上下文**(tool call 历史、任务理解),另起 LLM 只能猜
|
||||
2. **零额外 token 成本**(fast-path 是纯字符串解析 + schema 校验)
|
||||
3. **重试走 continue() 而非新 session**,保持对话连贯性
|
||||
|
||||
这是 PR #142 (ThreadReactor) 确立的模式。之前存在的 `extract()` LLM fallback 已成死代码。
|
||||
@@ -0,0 +1,26 @@
|
||||
---
|
||||
title: "Status-Based Moderator — Pure Lookup, Zero LLM"
|
||||
created: "2026-06-07"
|
||||
source: "openclaw-xiaomo"
|
||||
tags: [architecture, decision]
|
||||
category: "architecture"
|
||||
links:
|
||||
- deterministic-engine-uncertain-agent
|
||||
- agent-cli-protocol
|
||||
- frontmatter-fast-path
|
||||
---
|
||||
|
||||
uwf 的 moderator(路由器)完全不用 LLM,是纯查表操作:
|
||||
|
||||
```
|
||||
graph[lastRole][lastOutput.$status] → { role, prompt, location }
|
||||
```
|
||||
|
||||
1. 从 agent 输出的 frontmatter 读 `$status` 字段
|
||||
2. 在 workflow graph 中查 `graph[lastRole][status]` 拿到 Target
|
||||
3. 用 Mustache 渲染 edge prompt(变量来自 agent 输出的 frontmatter 字段)
|
||||
4. 路由到下一个 role,或 `$END`(完成),或 `$SUSPEND`(等待外部输入)
|
||||
|
||||
这意味着 workflow 的**流转逻辑完全确定性**——给定 agent 输出,下一步去哪里是固定的。不确定性只存在于 agent session 内部。
|
||||
|
||||
Mustache 渲染禁用了 HTML 转义(`mustache.escape = text => text`),因为 prompt 是纯文本。
|
||||
Reference in New Issue
Block a user