Inside italic/bold code segments every bare word is a variable — including call arguments and method-call receivers — so text literals must be quoted and receivers no longer need backticks. A bare dotted callee `a.b` resolves as a method call when `a` is a local variable, otherwise as a library path (Python-style unified namespace), in both the tree-walk and bytecode backends. Migrate ~70 tests plus ext/web, ext/quantum, ext/ai and the example projects to the new idiom; update SKILL.md and the design docs; fix the web/quantum example data model (db/index.mq.md). Unit and gold suites pass; only the 3 network-live tests fail offline. Co-authored-by: Cursor <cursoragent@cursor.com>
2.5 KiB
title: OKF agent-kb alias lookup (offline) description: Promote resource; patch Task aliases; variant goal hits same resource. import agent:ext/ai/agent.mq.md import fs:lib/fs.mq.md import json:lib/json.mq.md import plugin:lib/plugin.mq.md import sys:lib/sys.mq.md
main
p = > plugin.native_path name="agent"
p
plugin.load path=
p
print text=no-agent-plugin sys.exit code=1
kb = ".marqdo/agent-kb-alias-test" wb = ".marqdo/agent-runs/alias-pong.mq.md" goal = "Reply with exactly the word pong and nothing else." alias = "say pong only" body = "---\ntitle: pong skill\n---\n\n# main\n\nmsg = "pong"\n\nmsg\n"
fs.write_text path=
wbtext=bodyprom = > agent_kb_promote kb_dir=kbgoal=goalworkbook=wbaliases=aliasokp = > json.get value=promkey="promoted"
okp
print text=promoted
print text=promote-fail
slug = > json.get value=prom key="slug"
parts = > json.parse text={"a":"/concepts/tasks/","b":".md"}
a = > json.get value=parts key="a"
b = > json.get value=parts key="b"
task = kb + a + slug + b
src = > fs.read_text path=task
has = > split value=src sep="say pong only"
hn = > len value=has
hn> 1
print text=alias-written
print text=alias-missing
hit = > agent_kb_lookup kb_dir=kb goal=alias
hit
print text=alias-ok
print text=alias-miss
mk = > json.get value=hit key="match"
print text=
mk
slug_hit = > json.get value=hit key="slug"
slug==slug_hit
print text=same-slug
print text=slug-drift
exact = > agent_kb_lookup kb_dir=kb goal=goal
mk2 = > json.get value=exact key="match"
print text=
mk2
g_trip = "帮我规划明天的行程" wb2 = ".marqdo/agent-runs/alias-trip.mq.md" body2 = "---\ntitle: trip\n---\n\n# main\n\nmsg = "trip-ok"\n\nmsg\n"
fs.write_text path=
wb2text=body2prom2 = > agent_kb_promote kb_dir=kbgoal=g_tripworkbook=wb2ok2 = > json.get value=prom2key="promoted"
ok2
print text=trip-promoted
print text=trip-promote-fail
g_canon = "你是一个智能体,帮我规划明天的行程"
c = > agent_kb_canonicalize goal=g_canon
print text=
chit_c = > agent_kb_lookup kb_dir=kbgoal=g_canon
hit_c
print text=canonical-ok
print text=canonical-miss mk3 = > json.get value=
hit_ckey="match" print text=mk3
listed = > agent_kb_list_tasks kb_dir=kb
tc = > json.get value=listed key="count"
tc> 1
print text=list-ok
print text=list-bad