feat(ext/ai): land Agent/LLM optimize waves O1–O5
Wire opt-in sandbox trial into agent, require sandbox proof before OKF promote, add step_route/EFI/cost surfaces, style lint + quarantine, and offline policy optimize script—keeping GFM tables over json glue. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
1 parent
a707758d47
commit
0f72173d08
26 files changed
+1107
-272
No files matched your search
@@ -0,0 +1,49 @@
|
||||
---
|
||||
title: agent trial sandbox opt-in — host unchanged until commit
|
||||
description: >
|
||||
O1: agent.trial write stays upper until commit=True.
|
||||
Prefer link index over json.get.
|
||||
import agent:ext/ai/agent.mq.md
|
||||
import sandbox:ext/ai/sandbox.mq.md
|
||||
import fs:lib/fs.mq.md
|
||||
---
|
||||
|
||||
# main
|
||||
|
||||
Reset leftover workspace from prior runs.
|
||||
|
||||
**had = fs.exists path="_sbx_optin"**
|
||||
1. `had`
|
||||
> fs.remove path="_sbx_optin"
|
||||
2. *
|
||||
**_ = 0**
|
||||
|
||||
> fs.make_dir path="_sbx_optin"
|
||||
|
||||
Trial with `commit=False`: upper write must not touch the host tree.
|
||||
|
||||
**dry = agent.trial root="_sbx_optin" write_path="proof.txt" text=optin-ok commit=False**
|
||||
**dry_ok = [ok](dry)**
|
||||
**dry_committed = [committed](dry)**
|
||||
> print text=`dry_ok`
|
||||
> print text=`dry_committed`
|
||||
|
||||
**before = fs.exists path="_sbx_optin/proof.txt"**
|
||||
> print text=`before`
|
||||
|
||||
Trial with `commit=True`: host sees the file after success.
|
||||
|
||||
**wet = agent.trial root="_sbx_optin" write_path="proof.txt" text=optin-ok commit=True**
|
||||
**wet_ok = [ok](wet)**
|
||||
**wet_committed = [committed](wet)**
|
||||
> print text=`wet_ok`
|
||||
> print text=`wet_committed`
|
||||
|
||||
**after = fs.read_text path="_sbx_optin/proof.txt"**
|
||||
> print text=`after`
|
||||
|
||||
Profile row is attached (link-index readable).
|
||||
|
||||
**prof = [profile](wet)**
|
||||
**pname = [name](prof)**
|
||||
> print text=`pname`
|
||||
@@ -0,0 +1,35 @@
|
||||
---
|
||||
title: promote requires sandbox proof (O2)
|
||||
description: >
|
||||
Good workbook promotes; broken workbook is rejected (sandbox_proof_failed).
|
||||
Link-index reads; no json glue.
|
||||
import plugin:lib/plugin.mq.md
|
||||
import fs:lib/fs.mq.md
|
||||
import sys:lib/sys.mq.md
|
||||
---
|
||||
|
||||
# main
|
||||
|
||||
**p = plugin.native_path name="agent"**
|
||||
1. `p`
|
||||
> plugin.load path=`p`
|
||||
2. *
|
||||
> print text=no-plugin
|
||||
> sys.exit code=1
|
||||
|
||||
**kb = "_sbx_promote_kb"**
|
||||
**had = fs.exists path=`kb`**
|
||||
1. `had`
|
||||
> fs.remove path=`kb`
|
||||
2. *
|
||||
**_ = 0**
|
||||
|
||||
**prom = agent_kb_promote kb_dir=`kb` goal="sandbox promote good" workbook="sandbox-fixtures/promote-good.mq.md"**
|
||||
**ok = [promoted](prom)**
|
||||
> print text=`ok`
|
||||
|
||||
**rej = agent_kb_promote kb_dir=`kb` goal="sandbox promote bad" workbook="sandbox-fixtures/promote-bad.mq.md"**
|
||||
**rej_ok = [promoted](rej)**
|
||||
**reason = [reason](rej)**
|
||||
> print text=`rej_ok`
|
||||
> print text=`reason`
|
||||
@@ -0,0 +1,34 @@
|
||||
---
|
||||
title: O5 quarantine skill status
|
||||
description: Promote good skill then quarantine — status becomes quarantine.
|
||||
import plugin:lib/plugin.mq.md
|
||||
import fs:lib/fs.mq.md
|
||||
import sys:lib/sys.mq.md
|
||||
---
|
||||
|
||||
# main
|
||||
|
||||
**p = plugin.native_path name="agent"**
|
||||
1. `p`
|
||||
> plugin.load path=`p`
|
||||
2. *
|
||||
> print text=no-plugin
|
||||
> sys.exit code=1
|
||||
|
||||
**kb = "_sbx_quar_kb"**
|
||||
**had = fs.exists path=`kb`**
|
||||
1. `had`
|
||||
> fs.remove path=`kb`
|
||||
2. *
|
||||
**_ = 0**
|
||||
|
||||
**prom = agent_kb_promote kb_dir=`kb` goal="quarantine demo" workbook="sandbox-fixtures/promote-good.mq.md"**
|
||||
**ok = [promoted](prom)**
|
||||
**slug = [slug](prom)**
|
||||
> print text=`ok`
|
||||
|
||||
**q = agent_kb_quarantine kb_dir=`kb` slug=`slug` reason="fixture_regression"**
|
||||
**qok = [ok](q)**
|
||||
**st = [status](q)**
|
||||
> print text=`qok`
|
||||
> print text=`st`
|
||||
@@ -0,0 +1,19 @@
|
||||
---
|
||||
title: O3 step_route table backends
|
||||
description: lookup → marqdo; net → llm; default → auto.
|
||||
import agent:ext/ai/agent.mq.md
|
||||
---
|
||||
|
||||
# main
|
||||
|
||||
**a = agent.step_route kind="lookup"**
|
||||
**ba = [backend](a)**
|
||||
> print text=`ba`
|
||||
|
||||
**b = agent.step_route kind="net"**
|
||||
**bb = [backend](b)**
|
||||
> print text=`bb`
|
||||
|
||||
**c = agent.step_route kind="default"**
|
||||
**bc = [backend](c)**
|
||||
> print text=`bc`
|
||||
@@ -0,0 +1,8 @@
|
||||
---
|
||||
title: promote-bad
|
||||
proof: promote-bad.mq.md
|
||||
---
|
||||
|
||||
# main
|
||||
|
||||
> this_is_not_a_real_builtin_xyz
|
||||
@@ -0,0 +1,12 @@
|
||||
---
|
||||
title: promote-ok
|
||||
type: skill
|
||||
applies_when: demo
|
||||
fixtures: promote-good.mq.md
|
||||
sandbox_profile: default
|
||||
proof: promote-good.mq.md
|
||||
---
|
||||
|
||||
# main
|
||||
|
||||
> print text=proof-ok
|
||||
Reference in new issue
Block a user