Skip to content

架构升级:Effect / Admission / Posture / Execution Journal / Capability - #92

Merged
killpanda merged 7 commits into
mainfrom
claude/project-thread-qfymx7
Nov 6, 2026
Merged

killpanda merged 7 commits into
mainfrom
claude/project-thread-qfymx7

Conversation

@killpanda

@killpanda killpanda commented Nov 6, 2026 •

Copy link
Copy Markdown
Owner

Requested by jack mini · project thread

概要

按架构升级计划把 Limbo 的核心收敛到 Capability / Policy / Effect / Journal。一个阶段一个 commit,默认行为不变。安全 Profile(原阶段 3)按讨论暂缓。

一次工具调用现在走的路径:Capability(provider)→ Effect → Admission(Policy → Allow / Deny)→ 执行 → Execution Journal → 恢复时按 Recovery 处理。

阶段 新模块 改动
1 Effect 语义 effect.rs 每个工具声明 Effect(read / fetch / session / write / mutate / exec)和 Recovery(replay / inspect);replay_safe() / mutates() 由它们推导,各工具的取值不变
2 Admission admission.rs,subagents/hooks.rs → policies.rs 删除 ToolHook;ToolRegistry::execute = 解析 → 准入 → 执行。plan mode 变成 PlanPolicy(按 effect 拦截),4 个 subagent hook 变成 Policy,拒绝文案不变
4 Posture posture.rs registry 的 3 个模式 bool 合成 Posture = policy × capability set × presentation;/goal 的续跑条件是 Strategy::Goal。set_*_mode 变成 set_posture 的语法糖;session 文件仍写旧的 plan_mode / daily_mode / code_mode 字段
5 Execution Journal journal.rs tool_intent 泛化成 action 记录:执行前写 started / denied,结果到达后写 completed / failed;goal verify 也写(kind verify)。恢复时多了一种情况:“已执行完但结果丢失”。旧的 tool_intent 按 started 读入
6 Capability capability.rs 每个工具是一个 Capability,带 Provider(tool / program / subagent / human / runtime)。准入请求和 action 记录都带 provider;只读 subagent policy 改为按 provider 放行任务板工具,而不是按名字
6b Provider 可见 — goal verify 记录的 provider 是 runtime;run_code 子调用单独写 action 记录(parent = 外层 run_code 调用);AgentEvent::ToolCall 带 provider,TUI 工具卡片显示为 read · tool,headless 文本行、--json 事件和 trace 的 tool_call 也带 provider

兼容性

  • 旧 session 文件照常加载:tool_intent 读成 started,meta 字段不变。
  • 新文件里的 action 记录对旧版本来说是未知记录类型,会被跳过(旧版本会因此失去崩溃恢复信息,但不会加载失败)。
  • 模型看到的工具列表、系统提示和拒绝文案都不变,prompt cache 不受影响。

有意没做的部分

  • 由 Router 自动在本地工具和 subagent 之间选择:会改变模型看到的工具列表,暂缓。
  • goal verify 确认和 subagent 计划审批仍然由各前端自己处理:这几种交互本来就是在 turn 边界通过用户的下一条消息完成的,可以持久化;要统一成 Human Provider,需要改造 TUI 和 headless 前端的交互流程,适合单独一个 PR。
  • 安全 Profile:暂缓。

测试

  • cargo test(127 个通过,新增 15 个:effect 表、准入顺序、profile policy、posture 往返、action 记录、结果丢失恢复、capability provider、run_code 子调用日志、工具卡片 provider 渲染)
  • cargo fmt --check
  • cargo clippy --all-targets -- -D warnings

🤖 Generated with Claude Code

https://claude.ai/code/session_014BrrmT45MDfJYo6atYUqsd

First step of the capability architecture upgrade. Each tool now declares
one Effect (read/fetch/session/write/mutate/exec) and a Recovery
(replay/inspect); replay_safe() and mutates() are derived from them, so
plan mode, subagent hooks and crash recovery behave exactly as before.
tool_intent records also carry the effect (older files load unchanged).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_014BrrmT45MDfJYo6atYUqsd
@killpanda killpanda self-assigned this Nov 6, 2026
@killpanda killpanda changed the title 架构升级阶段 1:为每个工具声明 Effect 语义 架构升级:Effect / Admission / Posture / Execution Journal / Capability Nov 6, 2026
@killpanda
killpanda marked this pull request as draft November 6, 2026 10:31
Every call now goes resolve -> admit -> run. Plan mode becomes PlanPolicy
(blocks by effect), and the four subagent profile hooks become policies in
subagents/policies.rs. Denial texts and visibility are unchanged.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_014BrrmT45MDfJYo6atYUqsd
@graphify-labs

graphify-labs Bot commented Nov 6, 2026

Copy link
Copy Markdown

Graphify reviews are paused for this workspace because nobody has used it in 7 days. A workspace owner can resume reviews from the Repositories page: https://app.graphify.com/angus-lab/repositories

ToolRegistry's three mode flags become one Posture (policy x capability
set x presentation); the goal loop's continuation is the goal Strategy.
The set_*_mode verbs are sugar over Agent::set_posture. Session files keep
the legacy plan_mode/daily_mode/code_mode fields.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_014BrrmT45MDfJYo6atYUqsd
…records

Every tool call appends an action record (started or denied) before it
runs and completed/failed once its result is in; goal verify runs are
journaled the same way. Resume uses the log to tell 'did not run',
'may have partially run' and the new 'ran to the end, result lost' apart.
Legacy tool_intent records load as started.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_014BrrmT45MDfJYo6atYUqsd
Tools declare who carries them out: a local tool, a run_code program, the
subagent task board, or the human (ask_user). Admission requests and
action records carry the provider, and the read-only subagent policy now
admits the board's own capabilities by provider instead of by name.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_014BrrmT45MDfJYo6atYUqsd
@killpanda
killpanda marked this pull request as ready for review November 6, 2026 10:40
…ow it in the TUI

- goal verify actions carry the new runtime provider
- run_code sub-calls are journaled as their own actions (parent = the
  run_code call) through ToolContext.journal
- AgentEvent::ToolCall carries the provider: TUI tool cards show it
  (read · tool), as do headless lines, --json events and the trace

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_014BrrmT45MDfJYo6atYUqsd
@killpanda
killpanda merged commit 1b16c4b into main Nov 6, 2026
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants