@msbel5

SGA-MCTS Atoms

Plan-time atom retrieval for OpenClaw. Distill Inspector-approved sessions into reusable atomic experience.

当前版本
v1.0.5
bundle-plugin社区structural

SGA-MCTS Atoms

Distill past Inspector-approved sessions into reusable atomic experience.

When Inspector signs off on a session with a high enough score, the plugin extracts atomic units of experience (compact action/observation/outcome strings) and stores them in a local SQLite database. Captain queries the store via retrieve_atoms during plan decomposition for new tasks, biasing decomposition toward strategies that previously worked.

The atom store is intentionally local and dependency-free: no embeddings, no network, plain SQLite + bag-of-tokens scoring. Trades retrieval quality for predictability and zero cost — works fine on a Raspberry Pi.

Install

Via OpenClaw plugins CLI (recommended):

openclaw plugins install clawhub:openclaw-sga-mcts-atoms

Or via npm:

npm install -g @msbel/openclaw-sga-mcts-atoms

Add to OpenClaw config

Append to ~/.openclaw/openclaw.json:

{
  "plugins": {
    "entries": {
      "sga-mcts-atoms": {
        "enabled": true,
        "config": {
          "extractorPython": "python3",
          "extractorScript": "~/.openclaw/sga_mcts/atom_extractor.py",
          "retrieverScript": "~/.openclaw/sga_mcts/atom_retriever.py",
          "dbPath": "~/.openclaw/sga_mcts/atoms.db",
          "minSessionScore": 0.7,
          "topK": 5
        }
      }
    }
  }
}

Restart the gateway: systemctl --user restart openclaw-gateway.

Hooks + Tools

SurfaceWhat
Hook agent_endAuto-extract atoms when Inspector score ≥ minSessionScore
Tool retrieve_atoms(query, k)Captain calls during plan decomposition
Tool extract_atoms(session_id)Manual extraction for back-fill

Atom store schema

CREATE TABLE atoms (
    id        INTEGER PRIMARY KEY,
    session   TEXT NOT NULL,
    text      TEXT NOT NULL UNIQUE,
    score     REAL NOT NULL DEFAULT 0,
    created   TEXT NOT NULL DEFAULT (datetime('now'))
);

text carries a UNIQUE constraint, so duplicate atoms across sessions collapse naturally.

Performance

  • Extraction: ~50ms per session on a Pi 5 (intent: cheap, run after every approved session)
  • Retrieval: ~20ms for 1000 atoms with bag-of-tokens scoring
  • Storage: ~200 bytes per atom; 10K atoms ≈ 2MB SQLite file
  • No network I/O. No embeddings. No external services.

License

MIT. Source: https://github.com/msbel5/openclaw-sga-mcts-atoms

源码与版本

安装命令

openclaw plugins install clawhub:openclaw-sga-mcts-atoms

元数据

  • 包名: openclaw-sga-mcts-atoms
  • 创建时间: 2026/05/05
  • 更新时间: 2026/05/05
  • 执行代码:

兼容性

  • 构建于 OpenClaw: 2026.5.4
  • 插件 API 范围: >=2026.0.0
  • 标签: latest
  • 文件数: 7