Merge pull request 'chore: remove docs/, extract current knowledge to .cards' (#164) from chore/remove-docs-folder into main
CI / check (push) Successful in 3m42s

chore: remove docs/, extract current knowledge to .cards (#164)
This commit was merged in pull request #164.
This commit is contained in:
2026-06-07 14:51:51 +00:00
16 changed files with 71 additions and 4938 deletions
+24
View File
@@ -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),协议层面完全对等。
+21
View File
@@ -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 已成死代码。
+26
View File
@@ -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 是纯文本。