Files
united-workforce/.cards/agent-cli-protocol.md
T
xiaomo cb3a4acf4d
CI / check (pull_request) Successful in 3m57s
chore: remove docs/, extract current knowledge to .cards
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).
2026-06-07 14:45:23 +00:00

1.0 KiB

title, created, source, tags, category, links
title created source tags category links
Agent CLI Protocol — Adapter Output via stdout 2026-06-07 openclaw-xiaomo
architecture
protocol
architecture
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),协议层面完全对等。