Files
marqdo/tests/ext/agent-p4-route.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

2.6 KiB
Executable File

markup, title, description, import
markup title description import
occlusion Agent Framework P4 — Adaptive Routing + Policy Compilation (offline) Learn skill, compile policy from skill-tagged episodes, route via marqdo backend without Jev/LLM.
fs json plugin sys
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={"mem":".marqdo/agent-memory-p4-test","kb":".marqdo/agent-kb-p4-test","task":"Reply with exactly the word pong and nothing else.","skill":"concepts/skills/reply-with-exactly-the-word-pong-and-nothing-els.md"} mem = > json.get value=paths key="mem" kb = > json.get value=paths key="kb" task = > json.get value=paths key="task" skill = > json.get value=paths key="skill"

  1. fs.exists path=mem

fs.remove_tree path=mem

_ = 1

  1. fs.exists path=kb

fs.remove_tree path=kb

_ = 1

agent_memory_ensure memory_dir=mem

ep1 = > agent_record_episode task=task status="ok" result="pong" mode="explore" skill=skill llm_calls=2 memory_dir=mem ep2 = > agent_record_episode task=task status="ok" result="pong" mode="explore" skill=skill llm_calls=2 memory_dir=mem ep3 = > agent_record_episode task=task status="ok" result="pong" mode="explore" skill=skill llm_calls=2 memory_dir=mem

learned = > agent_maybe_learn task=task memory_dir=mem kb_dir=kb improve_every=3 promote=True did = > json.get value=learned key="learned"

  1. did

print text=skill-learned

print text=skill-skip

ep4 = > agent_record_episode task=task status="ok" result="pong" mode="compiled" skill=skill llm_calls=0 memory_dir=mem ep5 = > agent_record_episode task=task status="ok" result="pong" mode="compiled" skill=skill llm_calls=0 memory_dir=mem ep6 = > agent_record_episode task=task status="ok" result="pong" mode="compiled" skill=skill llm_calls=0 memory_dir=mem

pol = > agent_compile_policy memory_dir=mem min_evidence=3 pok = > json.get value=pol key="ok"

  1. pok

print text=policy-ok

print text=policy-fail

routed = > agent_route task=task backend="auto" memory_dir=mem kb_dir=kb matched = > json.get value=routed key="matched" needs = > json.get value=routed key="needs_llm"

  1. matched
  2. not needs > print text=route-hit
> print text=route-needs-llm

print text=route-miss

backend = > json.get value=routed key="backend"

print text=backend