Tools
Shared Context
OpenClaw plugin: progressive shared context injection + workspace_context tool
Configuration Example
{
"path": "~/.openclaw/extensions/shared-context/index.js"
}
README
# shared-context — OpenClaw Plugin
Progressive shared context injection for [OpenClaw](https://github.com/openclaw/openclaw) agents.
## 功能
- **漸進式注入**:第 1 輪注入完整 shared files,第 2+ 輪只注入 compact reminder(節省 ~1,100 tok/輪)
- **workspace_context tool**:讓 agent 可按 section 按需查詢 workspace 參考文件
- **per-agent 設定**:每個 agent 有獨立的 always / first-turn 檔案清單
## 安裝
1. 複製到 `~/.openclaw/extensions/shared-context/`
2. 在 `openclaw.json` 的 `plugins` 加入:
```json
{
"path": "~/.openclaw/extensions/shared-context/index.js"
}
```
3. `openclaw gateway restart`
## Build
```bash
npm run build
# 等同於:
npx esbuild index.ts --bundle --platform=node --format=cjs --outfile=index.js --external:fs --external:path
```
## workspace_context Tool
Agent 可呼叫此 tool 查詢 workspace 參考文件:
```ts
// 列出所有 section
workspace_context({ id: "global-ref", list_sections: true })
// 讀取特定 section(fuzzy match)
workspace_context({ id: "global-ref", section: "記憶管理" })
// 讀取全文
workspace_context({ id: "shared-tools" })
```
**支援 id**:`global`, `global-ref`, `shared-tools`, `business`, `personal`, `tools`, `memory`, `heartbeat`, `soul`
## Agent 注入規則
| Agent | Always (每輪) | First Turn Only |
|-------|--------------|-----------------|
| akane | GLOBAL-CORE.md | SHARED-TOOLS + BUSINESS + PERSONAL |
| rem, yukino, anya, kurisu, emilia, utaha | GLOBAL-CORE.md | SHARED-TOOLS + PERSONAL |
| coo, admin, finance, ... (Claw Corp) | GLOBAL-CORE.md | SHARED-TOOLS + BUSINESS |
| main | *(route index only)* | SHARED-TOOLS |
| mira-pa | *(skip)* | — |
tools
Comments
Sign in to leave a comment