Enable default writeback on agent step and lock the plan design.
Document multi-step workbooks in ext-agent-plan, and make step/单步 persist ok/error slots unless writeback is turned off. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
1 parent
1f23e2ed93
commit
fbece725e1
9 files changed
+383
-80
No files matched your search
+14
-1
@@ -4,6 +4,7 @@ description: Document-driven agent — step / plan; tools via lib/subtask; runti
|
||||
> ext/ai/llm.mq.md
|
||||
> lib/json.mq.md
|
||||
> lib/sys.mq.md
|
||||
> lib/writeback.mq.md
|
||||
> lib/subtask.mq.md
|
||||
> lib/plugin.mq.md
|
||||
---
|
||||
@@ -127,8 +128,9 @@ Clear the plugin session bag for this agent id.
|
||||
|
||||
## step
|
||||
+ `task`
|
||||
+ `writeback`=True
|
||||
|
||||
One atomic turn: context → LLM → optional tool via subtask. Returns a **map** (`status`, `task`, `decision`, and on success `result` plus optional `tool` / `tool_result`; on failure `error`). Does **not** write back — call `lib/writeback` yourself if you want persistence.
|
||||
One atomic turn: context → LLM → optional tool via subtask. Returns a **map** (`status`, `task`, `decision`, and on success `result` plus optional `tool` / `tool_result`; on failure `error`). By default (`writeback=True`) persists that map under named slots `ok` / `error` at the call site; pass `writeback=False` to skip.
|
||||
|
||||
*`ctx` = > build_step_context agent=`self` task=`task` *
|
||||
*`id` = > json.get value=`self` key=id *
|
||||
@@ -175,6 +177,17 @@ One atomic turn: context → LLM → optional tool via subtask. Returns a **map*
|
||||
*`as_turn` = > json.parse text={"role":"assistant"} *
|
||||
*`as_turn` = > json.set map=`as_turn` key=content value=`reply` *
|
||||
> agent_history_append id=`id` item=`as_turn`
|
||||
|
||||
1. `writeback`
|
||||
*`body` = > json.stringify value=`out` *
|
||||
*`st` = > json.get value=`out` key=status *
|
||||
1. `st` == ok
|
||||
> writeback.record value=`body` key=ok
|
||||
2. *
|
||||
> writeback.record value=`body` key=error
|
||||
2. *
|
||||
*`_` = 1*
|
||||
|
||||
**`out`**
|
||||
|
||||
## plan
|
||||
|
||||
+14
-1
@@ -4,6 +4,7 @@ description: 文档驱动智能体 — 单步 / 多步;工具经 lib/子任务
|
||||
> ext/ai/大模型.mq.md
|
||||
> lib/json.mq.md
|
||||
> lib/系统.mq.md
|
||||
> lib/自写回.mq.md
|
||||
> lib/子任务.mq.md
|
||||
> lib/插件.mq.md
|
||||
---
|
||||
@@ -127,8 +128,9 @@ description: 文档驱动智能体 — 单步 / 多步;工具经 lib/子任务
|
||||
|
||||
## 单步
|
||||
+ `任务`
|
||||
+ `写回`=真
|
||||
|
||||
原子一轮:上下文 → 大模型 → 可选子任务调工具。返回 **map**(`status`、`task`、`decision`;成功含 `result`,可选 `tool` / `tool_result`;失败含 `error`)。**不**自动写回——需要持久化时自行调用 `lib/自写回`。
|
||||
原子一轮:上下文 → 大模型 → 可选子任务调工具。返回 **map**(`status`、`task`、`decision`;成功含 `result`,可选 `tool` / `tool_result`;失败含 `error`)。默认(`写回=真`)将结果写入调用行下的命名槽 `ok` / `error`;传 `写回=假` 可关闭。
|
||||
|
||||
*`ctx` = > 构建单步上下文 智能体=`自` 任务=`任务` *
|
||||
*`id` = > json.get value=`自` key=id *
|
||||
@@ -175,6 +177,17 @@ description: 文档驱动智能体 — 单步 / 多步;工具经 lib/子任务
|
||||
*`as_turn` = > json.parse text={"role":"assistant"} *
|
||||
*`as_turn` = > json.set map=`as_turn` key=content value=`reply` *
|
||||
> agent_history_append id=`id` item=`as_turn`
|
||||
|
||||
1. `写回`
|
||||
*`body` = > json.stringify value=`out` *
|
||||
*`st` = > json.get value=`out` key=status *
|
||||
1. `st` == ok
|
||||
> 自写回.写回 值=`body` 键=ok
|
||||
2. *
|
||||
> 自写回.写回 值=`body` 键=error
|
||||
2. *
|
||||
*`_` = 1*
|
||||
|
||||
**`out`**
|
||||
|
||||
## 多步
|
||||
|
||||
Reference in new issue
Block a user