Files
marqdo/tests/ext/agent-tools-rag-a4.mq.md
T
cflmy 9331af78e2 release(2.8.0): 合入 CHANGELOG/README/发版说明/skills prove 任务;CI 链接指向 doc/releases
- CHANGELOG.md:v2.8.0 条目(中英双语);
- README.md:版本行 2.7.1→2.8.0 + 愿景第 6 条(知识可证明);
- doc/releases/v2.8.0.md:双语发版说明(亮点/用法/已知限制);
- skills/marqdo-dev/index.mq.md:新增 prove 任务(路径/目录模式/
  require_lean/json;参数用 + 行声明升参,check 与 narrative-ratio 通过);
- 设计文档 §12.5 标记已合入;发版链接统一指向 doc/releases/v2.8.0.md。
2026-11-18 10:29:26 +08:00

3.1 KiB
Executable File

markup, title, description, import
markup title description import
occlusion agent corpus_search + mcp fixture tools (A4 offline) Local RAG-lite corpus search and MCP fixture call; authority stays workbook.
agent fs json plugin sys
ext/ai/agent.mq.md lib/fs.mq.md lib/json.mq.md lib/plugin.mq.md lib/sys.mq.md

main

p = > plugin.native_path name="agent"

  1. p

plugin.load path=p

print text=no-agent-plugin sys.exit code=1

paths = > json.parse text={"root":".marqdo/agent-corpus-a4","fx":".marqdo/agent-runs/a4-mcp-fixture.json","a":".marqdo/agent-corpus-a4/refunds.md","b":".marqdo/agent-corpus-a4/shipping.md"} root = > json.get value=paths key="root" fx = > json.get value=paths key="fx" pa = > json.get value=paths key="a" pb = > json.get value=paths key="b"

  1. fs.exists path=root

fs.remove path=root

_ = 1

fs.make_dir path=root

ba = > json.parse text={"t":"# Refund policy\n\nCustomers may request a refund within 30 days of purchase.\n"} body_a = > json.get value=ba key="t"

fs.write_text path=pa text=body_a bb = > json.parse text={"t":"# Shipping\n\nOrders ship in two business days.\n"} body_b = > json.get value=bb key="t" fs.write_text path=pb text=body_b

fx_body = > json.parse text={"t":"{"note":"Fixture evidence only; workbook remains authority.","tools":[{"name":"wiki_get","description":"Fetch policy wiki page"}],"results":{"wiki_get":{"page":"refunds","text":"Refunds within 30 days."}}}"} fx_t = > json.get value=fx_body key="t"

fs.write_text path=fx text=fx_t

hit = > agent.corpus_search query="refund 30 days" root=root limit=4 auth = > json.get value=hit key="authority"

  1. auth == workbook

print text=auth-ok

print text=auth-bad cnt = > json.get value=hit key="count"

  1. cnt > 0

print text=corpus-hit

print text=corpus-miss hits = > json.get value=hit key="hits" hn = > len value=hits

  1. hn > 0 h0 = > at value=hits index=0 p0 = > json.get value=h0 key="path"
  2. p0 == refunds.md > print text=top-refunds
> print text=top-bad

print text=top-empty

listed = > agent.mcp_list_tools fixture=fx tools = > json.get value=listed key="tools" t0 = > at value=tools index=0 tn = > json.get value=t0 key="name"

  1. tn == wiki_get

print text=mcp-list-ok

print text=mcp-list-bad

called = > agent.mcp_call name="wiki_get" fixture=fx ok = > json.get value=called key="ok"

  1. ok

print text=mcp-call-ok

print text=mcp-call-bad auth2 = > json.get value=called key="authority"

  1. auth2 == workbook

print text=mcp-auth-ok

print text=mcp-auth-bad

reply = > json.parse text={"t":"CALL:corpus_search\nARGS:{"query":"refund","root":".marqdo/agent-corpus-a4","limit":3}\n"} raw = > json.get value=reply key="t" via = > agent.run_parent_tool name="corpus_search" path="." reply=raw vc = > json.get value=via key="count"

  1. vc > 0

print text=parent-corpus-ok

print text=parent-corpus-bad