# `CMDC.Tool.WriteTodos`
[🔗](https://github.com/tupleyun/cmdc/blob/v0.5.3/lib/cmdc/tool/write_todos.ex#L1)

更新 Agent 的 Todo 任务列表。

通过返回 `{:effect, {:update_todos, todos}}` 触发 Agent 上下文更新，
同时通过 `emit` 闭包广播 `{:todo_change, session_id, todos}` 事件。

## Todo 条目格式

每条 todo 为一个 map，包含：
- `"id"` — 唯一标识符
- `"content"` — 任务内容描述
- `"status"` — `"pending"` | `"in_progress"` | `"completed"` | `"cancelled"`

## 与 ToolRunner 的约定

返回 `{:effect, {:update_todos, todos}}`，ToolRunner 将其归一化为
`"[effect applied]"` 文本传给 LLM，状态更新由 Agent 读取。

实际上通过 `emit` 闭包将 `:todo_change` 事件写入 EventBus，
外部监听者（TUI、Facade API）可通过订阅 EventBus 获取最新 todos。

---

*Consult [api-reference.md](api-reference.md) for complete listing*
