[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"project-1058":3},{"id":4,"name":5,"fullName":6,"owner":7,"repo":5,"description":8,"homepage":9,"htmlUrl":10,"language":11,"languages":10,"totalLinesOfCode":10,"stars":12,"forks":13,"watchers":14,"openIssues":15,"contributorsCount":16,"subscribersCount":16,"size":16,"stars1d":16,"stars7d":16,"stars30d":17,"stars90d":16,"forks30d":16,"starsTrendScore":16,"compositeScore":18,"rankGlobal":10,"rankLanguage":10,"license":19,"archived":20,"fork":20,"defaultBranch":21,"hasWiki":22,"hasPages":20,"topics":23,"createdAt":10,"pushedAt":10,"updatedAt":24,"readmeContent":25,"aiSummary":26,"trendingCount":16,"starSnapshotCount":16,"syncStatus":27,"lastSyncTime":28,"discoverSource":29},1058,"Plugin-GBT","PeiranLi0930\u002FPlugin-GBT","PeiranLi0930","[!NEW!] OpenClaw Plugin for Agents to Become Clever and Token-Efficient!","",null,"Python",386,49,24,3,0,9,46,"MIT License",false,"main",true,[],"2026-06-12 04:00:07","# GBT (Gated Behavior Tree) Plugin\n\nGBT turns OpenClaw's throwaway execution logs into a reusable experience tree.\n\nThat changes the economics of agent work.\n\nWithout GBT, every similar task forces the agent to plan again, reason again, debug again, and spend expensive tokens again. With GBT, successful runs and failed runs are distilled into reusable operational memory. The next time a similar task appears, OpenClaw can stop wasting tokens on rediscovering the same path and instead execute against a learned tree of concrete experience.\n\nAnd when a covered task fails, GBT does not just shrug and move on. It queues that failed trajectory, waits for idle time, asks for approval, silently replays the task inside OpenClaw, localizes the broken step, repairs it, verifies the repaired run against the real environment, and only then writes the repaired experience back into the tree.\n\nThis is not a prompt wrapper. It is a persistent experience system for OpenClaw.\n\n## Research Origin\n\nThis plugin is built on the core ideas from the paper:\n\n**Traversal-as-Policy: Log-Distilled Gated Behavior Trees as Externalized, Verifiable Policies for Safe, Robust, and Efficient Agents**  \nPeiran Li, Jiashuo Sun, Fangzhou Lin, Shuo Xing, Tianfu Fu, Suofei Feng, Chaoqun Ni, Zhengzhong Tu  \nhttps:\u002F\u002Farxiv.org\u002Fabs\u002F2603.05517\n\nThe plugin version in this repository focuses on turning agent logs into reusable experience trees, routing covered tasks onto cheaper single-step executors, and replaying failed trajectories to repair them into reusable experience. As noted below, this current release does **not** implement the paper's safety-gate mechanism.\n\n## What GBT Actually Does\n\n- Distills completed OpenClaw runs into reusable, non-task-specific macro nodes.\n- Stores both success and failure paths instead of discarding failure.\n- Switches covered tasks onto a cheaper executor model when existing experience is strong enough.\n- Injects step-local runtime guidance so the executor can act like a disciplined single-step worker instead of a full long-horizon planner.\n- Tracks runtime spine progress and recovery hints during execution.\n- Queues failed covered runs for idle-time self-evolution.\n- Replays failed tasks in fresh OpenClaw sessions, extracts the real transcript, verifies the repair, and only then writes the repaired path back into the tree.\n\n## Why This Is Useful\n\n- Lower token cost on repeated task families.\n- Less repeated planning on known workflows.\n- Better reuse of hard-won debugging work.\n- Stronger long-term personalization: each user grows their own tree from their own OpenClaw history.\n- Better use of expensive reasoning models: spend them on repair and evolution, not on re-solving the same problem forever.\n\n## Current Scope\n\nThis release fully implements the core GBT and GBT-SE workflow for reusable experience distillation, covered-task guidance, and replay-backed self-evolution.\n\nThis release intentionally does **not** implement the paper's safety-gate system.\n\n## Prerequisites\n\nBefore installing GBT, make sure you have:\n\n1. OpenClaw installed and working.\n2. Node.js available in the same environment that runs OpenClaw.\n3. Python 3.10+ available as `python3` or another executable you can point the plugin to.\n4. The Python `openai` package installed.\n5. At least one OpenClaw-capable model configured for your normal runs.\n6. OpenAI auth available if you want the bundled Python analysis path to do LLM-backed distillation \u002F verification.\n\nInstall the Python dependency:\n\n```bash\npython3 -m pip install --upgrade openai\n```\n\n## Step-by-Step Setup\n\n### 1. Build or pack the plugin\n\nFrom this repository:\n\n```bash\nnpm install\nnpm run build\n```\n\nIf you want a tarball for installation:\n\n```bash\nnpm pack\n```\n\nThat produces a file like `gbt-skill-0.1.0.tgz`.\n\n### 2. Install the plugin into OpenClaw\n\nInstall from the local repository:\n\n```bash\nopenclaw plugins install .\n```\n\nOr install from the packed tarball:\n\n```bash\nopenclaw plugins install .\u002Fgbt-skill-0.1.0.tgz\n```\n\nAfter install, restart OpenClaw if your setup requires a restart for plugin discovery.\n\n### 3. Enable the plugin\n\nEnable it through OpenClaw:\n\n```bash\nopenclaw plugins enable gbt-skill\n```\n\nYou can confirm it is visible with:\n\n```bash\nopenclaw plugins list\nopenclaw plugins info gbt-skill\n```\n\n### 4. Configure the plugin\n\nAdd plugin config under `plugins.entries.gbt-skill.config` in your OpenClaw config.\n\nMinimal example:\n\n```json\n{\n  \"plugins\": {\n    \"entries\": {\n      \"gbt-skill\": {\n        \"enabled\": true,\n        \"config\": {\n          \"pythonExecutable\": \"python3\",\n          \"stateSubdir\": \"gbt-skill\",\n          \"cheaperModel\": \"gpt-4.1-mini\",\n          \"cheaperProvider\": \"openai\",\n          \"coverageThreshold\": 0.6,\n          \"idleMinutes\": 10\n        }\n      }\n    }\n  }\n}\n```\n\nWhat the main config values mean:\n\n- `pythonExecutable`: Python executable used to run the GBT engine.\n- `stateSubdir`: Where GBT stores its tree, episodes, and self-evolve state.\n- `cheaperModel`: Model used for covered tasks once GBT has reusable experience.\n- `cheaperProvider`: Optional provider override for that cheaper executor.\n- `coverageThreshold`: How confident GBT must be before switching into guided executor mode.\n- `idleMinutes`: How long OpenClaw must stay idle before GBT asks whether to start self-evolution.\n- `distillModel`: Optional analysis-model override. Leave it empty if you want GBT to inherit the model from the current OpenClaw run.\n- `selfEvolveReplayCommand`: Optional override. Leave it empty to use GBT's built-in OpenClaw replay runner.\n- `selfEvolveReplayCwd`: Optional working directory for a custom replay command.\n- `selfEvolveReplayTimeoutSec`: Timeout for replay verification.\n\n### 5. Decide whether you need an explicit analysis-model override\n\nFor most OpenAI-backed OpenClaw setups, you do not need to set `distillModel`.\n\nGBT will inherit the main model from the run that just happened, and the bundled Python analysis engine will normalize OpenClaw model refs like `openai\u002Fgpt-5.4` into the directly callable OpenAI model name.\n\nSet `distillModel` only if one of these is true:\n\n- you want GBT's internal distill \u002F diagnose \u002F replay-verification steps to use a different model than your main OpenClaw run\n- your main OpenClaw model is not directly callable by the bundled Python OpenAI client\n\nExample override:\n\n```json\n{\n  \"plugins\": {\n    \"entries\": {\n      \"gbt-skill\": {\n        \"enabled\": true,\n        \"config\": {\n          \"distillModel\": \"gpt-5.4\"\n        }\n      }\n    }\n  }\n}\n```\n\n### 6. Make sure analysis auth is available when needed\n\nThe built-in replay runner uses OpenClaw's embedded replay path plus the bundled Python analysis client for strict verification when a directly usable analysis model is available.\n\nIf your OpenClaw auth store does not already have an OpenAI profile, set an API key in the shell before replay or configure OpenClaw auth for OpenAI.\n\nAt minimum:\n\n```bash\nexport OPENAI_API_KEY=\"your-key\"\n```\n\nGBT's built-in runner will register `openai:default` in the local OpenClaw auth store if needed during replay.\n\nIf you leave `distillModel` empty and your main OpenClaw runs are not OpenAI-backed, replay still works, but some verification \u002F diagnosis steps may fall back to heuristic analysis unless you provide an explicit OpenAI analysis model.\n\n### 7. Start using OpenClaw normally\n\nYou do **not** need a special launch mode.\n\nOnce the plugin is enabled:\n\n- completed runs are distilled into the tree\n- covered tasks can route onto the cheaper executor\n- failed covered runs are queued for self-evolution\n\nGBT is meant to sit inside the normal OpenClaw loop, not beside it.\n\n## First Run: What To Expect\n\n### After normal task completion\n\nGBT will:\n\n1. Normalize the tool log.\n2. Segment it into macro steps.\n3. Distill reusable summaries and metadata.\n4. Add those nodes and paths into the persistent experience tree.\n\n### When a new task is already covered\n\nGBT will:\n\n1. Match the task against the tree.\n2. Decide whether confidence is high enough.\n3. If covered, switch to your configured cheaper executor model.\n4. Inject macro-by-macro execution guidance into the prompt.\n\n### When a covered task fails\n\nGBT will:\n\n1. Preserve the failed trajectory.\n2. Queue it for self-evolution.\n3. Wait until OpenClaw has been idle for the configured window.\n4. Ask you whether to start self-evolution.\n5. If approved, silently replay the task in a fresh OpenClaw session.\n6. Verify the repair using real transcript evidence before writing it back into the tree.\n\n## User Commands\n\nGBT exposes these commands:\n\n- `\u002Fgbt status`\n- `\u002Fgbt match \u003Ctask>`\n- `\u002Fgbt evolve approve`\n- `\u002Fgbt evolve reject`\n\n## Recommended Configuration Pattern\n\nUse your normal strong model for the main OpenClaw run, and reserve the cheaper model only for covered execution.\n\nExample:\n\n- main OpenClaw model: stronger reasoning model\n- `distillModel`: leave empty to inherit the main OpenClaw model, or set it explicitly only if you want a different analysis model\n- `cheaperModel`: inexpensive executor model\n\nThat gives you the intended split:\n\n- strong models for original execution and repair analysis\n- cheaper models for repeated covered work\n\n## Verifying That GBT Is Really Working\n\nCheck build and tests:\n\n```bash\nnpm test\nnpm run build\n```\n\nInspect plugin state:\n\n```bash\n\u002Fgbt status\n```\n\nAsk whether a task is covered:\n\n```bash\n\u002Fgbt match fix the failing parser test by editing the parser file and rerunning pytest\n```\n\nIf GBT is active, you should start seeing:\n\n- increasing node and episode counts\n- covered-task matches with confidence scores\n- failed covered jobs entering the self-evolve queue\n\n## Packaging and Public Release Notes\n\nThis package is a real OpenClaw plugin:\n\n- `package.json` declares `openclaw.extensions = [\".\u002Fdist\u002Findex.js\"]`\n- `openclaw.plugin.json` defines plugin metadata and config schema\n- the bundled plugin prompt assets ship under `skills\u002Fgbt`\n- the Python engine ships inside the package under `gbt_skill`\n- the built-in self-evolve replay runner is included and enabled by default\n\n## Release Validation\n\nThe current release has been validated with:\n\n- `pytest -q`\n- `npm test`\n- `npm run build`\n- real OpenClaw embedded replay smoke runs using the built-in replay runner\n\n## Practical Limits\n\nGBT is powerful, but the system is still constrained by the underlying runtime:\n\n- if OpenClaw itself cannot access the required tools or workspace, replay cannot fix that\n- if your model\u002Fprovider auth is missing, self-evolve replay cannot run\n- very hard long-horizon repair cases may need multiple replay attempts\n\n## In One Sentence\n\nGBT turns OpenClaw from a stateless executor that keeps relearning the same lessons into a system that remembers, reuses, repairs, and gets cheaper on the work it has already paid to understand.\n\n## Citation\n\nIf you find GBT useful in your work, please consider citing:\n\n```bibtex\n@misc{li2026traversalaspolicylogdistilledgatedbehavior,\n      title={Traversal-as-Policy: Log-Distilled Gated Behavior Trees as Externalized, Verifiable Policies for Safe, Robust, and Efficient Agents},\n      author={Peiran Li and Jiashuo Sun and Fangzhou Lin and Shuo Xing and Tianfu Fu and Suofei Feng and Chaoqun Ni and Zhengzhong Tu},\n      year={2026},\n      eprint={2603.05517},\n      archivePrefix={arXiv},\n      primaryClass={cs.LG},\n      url={https:\u002F\u002Farxiv.org\u002Fabs\u002F2603.05517},\n}\n```\n","GBT (Gated Behavior Tree) 插件通过将 OpenClaw 的执行日志转化为可复用的经验树，从而提升代理的效率并减少令牌消耗。其核心功能包括将成功和失败的任务路径存储为宏节点、在已有经验足够时切换到更便宜的执行器模型、以及在空闲时间自动重放并修复失败任务。该插件适用于需要频繁执行相似任务且希望降低重复规划和调试成本的场景，特别适合那些希望通过长期积累个性化经验来优化流程的用户。基于 Python 开发，并遵循 MIT 许可证。",2,"2026-06-11 02:41:22","CREATED_QUERY"]