惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

Security Archives - TechRepublic
Security Archives - TechRepublic
T
The Exploit Database - CXSecurity.com
P
Proofpoint News Feed
Scott Helme
Scott Helme
NISL@THU
NISL@THU
Cisco Talos Blog
Cisco Talos Blog
C
Cybersecurity and Infrastructure Security Agency CISA
AWS News Blog
AWS News Blog
V
Vulnerabilities – Threatpost
J
Java Code Geeks
U
Unit 42
The GitHub Blog
The GitHub Blog
H
Help Net Security
T
Tenable Blog
aimingoo的专栏
aimingoo的专栏
Jina AI
Jina AI
Spread Privacy
Spread Privacy
Apple Machine Learning Research
Apple Machine Learning Research
人人都是产品经理
人人都是产品经理
L
Lohrmann on Cybersecurity
T
Threatpost
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
Engineering at Meta
Engineering at Meta
A
About on SuperTechFans
I
InfoQ
Microsoft Azure Blog
Microsoft Azure Blog
B
Blog
L
LINUX DO - 最新话题
K
Kaspersky official blog
cs.CV updates on arXiv.org
cs.CV updates on arXiv.org
T
Threat Research - Cisco Blogs
C
Check Point Blog
T
The Blog of Author Tim Ferriss
有赞技术团队
有赞技术团队
宝玉的分享
宝玉的分享
Help Net Security
Help Net Security
Google DeepMind News
Google DeepMind News
A
Arctic Wolf
Y
Y Combinator Blog
N
News | PayPal Newsroom
M
MIT News - Artificial intelligence
Latest news
Latest news
H
Hacker News: Front Page
Blog — PlanetScale
Blog — PlanetScale
腾讯CDC
I
Intezer
爱范儿
爱范儿
F
Fortinet All Blogs
P
Palo Alto Networks Blog
C
CERT Recently Published Vulnerability Notes

Recent Commits to openclaw:main

test: merge chat side-result checks · openclaw/openclaw@ddd2c2a test: merge cron history checks · openclaw/openclaw@f7eb746 test: merge responsive navigation shell checks · openclaw/openclaw@c2e4b47 docs(changelog): add codex oauth fixes · openclaw/openclaw@628e6cd test: merge navigation routing cases · openclaw/openclaw@5d8cecb Tests: mock channel registry bundled fallback · openclaw/openclaw@2b08233 Secrets: avoid broad web search discovery for single plugin config · openclaw/openclaw@a464f59 test: merge config view browser checks · openclaw/openclaw@20cf511 fix(status): align oauth health with runtime · openclaw/openclaw@eed7116 feat: add macOS screen snapshots for monitor preview (#67954) thanks … · openclaw/openclaw@f377db1 fix: report shared auth scopes in hello-ok (#67810) thanks @BunsDev · openclaw/openclaw@0b6c39b Auto-reply: avoid eager bundled route fallback · openclaw/openclaw@3ea1bf4 Tests: narrow session binding contract setup · openclaw/openclaw@54e4e16 fix(macOS): enable undo/redo in webchat composer text input (#34962) · openclaw/openclaw@00951dc Tests: speed up channel setup promotion · openclaw/openclaw@82b529a Docs: refresh agent instructions · openclaw/openclaw@5775fe2 fix(auth): serialize OAuth refresh across agents to fix #26322 (#67876) · openclaw/openclaw@8e79080 test: allow ollama public surface boundary test · openclaw/openclaw@7d4f1a6 Docs: add test performance guardrails · openclaw/openclaw@89706d3 Tests: restore context-engine usage proof · openclaw/openclaw@e4c4f95 Tests: slim context engine runtime coverage · openclaw/openclaw@74c198f ci: retry failed custom checkouts · openclaw/openclaw@0ee5baf test: trim duplicate provider auth onboarding cases · openclaw/openclaw@1ffc02e matrix: fix sessions_spawn --thread subagent session spawning (#67643) · openclaw/openclaw@1ce2596 test: reduce auth choice fixture churn · openclaw/openclaw@857b9cd test: mock health status config boundaries · openclaw/openclaw@9d5ab4a test: mock onboard config io boundary · openclaw/openclaw@299694d test: mock legacy state plugin boundaries · openclaw/openclaw@2713089 test: mock channel install boundaries · openclaw/openclaw@b945248 test: mock doctor preview channel boundaries · openclaw/openclaw@b1a3ad4 test: trim doctor command hotspots · openclaw/openclaw@c66f16a test: isolate agent auth and spawn hotspots · openclaw/openclaw@9285935 test: stabilize MCP startup disposal race · openclaw/openclaw@dd9d2eb test: merge browser contract server suites · openclaw/openclaw@5817a76 test: narrow ollama provider discovery setup · openclaw/openclaw@a0d9598 build: declare qa-lab aimock runtime dependency · openclaw/openclaw@24431e5 test: speed up safe-bins exec harness · openclaw/openclaw@ee856ab test: preserve tool helpers in embedded runner mocks · openclaw/openclaw@acd86a0 refactor: move memory embeddings into provider plugins · openclaw/openclaw@77e6e4c test: reuse system-run temp fixtures · openclaw/openclaw@7e9ff0f test: trim hotspot wait overhead · openclaw/openclaw@12a59b0 Check: avoid duplicate boundary prep · openclaw/openclaw@baf11b8 test: reduce hotspot fixture overhead · openclaw/openclaw@3a59edd feat(ui): overhaul settings and slash command UX (#67819) thanks @Bun… · openclaw/openclaw@2cfb660 QA Matrix: exit cleanly on failure · openclaw/openclaw@42805d2 QA Matrix: isolate scenario coverage · openclaw/openclaw@7e659e1 Matrix: refresh crypto bootstrap state · openclaw/openclaw@94081d8 QA Lab: add provider registry · openclaw/openclaw@bb7e982 Matrix: add plugin changelog · openclaw/openclaw@4acab55 test: trim more hotspot overhead · openclaw/openclaw@f485311 test: trim remaining hotspot tests · openclaw/openclaw@6ba8626 test: narrow hotspot mocks · openclaw/openclaw@dbc8179 test: isolate gemini embedding request helpers · openclaw/openclaw@cd330f5 test: trim memory and mcp hotspots · openclaw/openclaw@fd48dfa test: slim provider registry mocks · openclaw/openclaw@2e08c77 test: harden Parallels update smoke · openclaw/openclaw@1a98090 feat: default Anthropic to Opus 4.7 · openclaw/openclaw@628b454 fix: harden node-host shell payload mutability checks · openclaw/openclaw@75c551e fix: land node-host approval binding for native binaries (#66731) (th… · openclaw/openclaw@29919bb CI: add daily schedule to CodeQL workflow (#67645) · openclaw/openclaw@69d25f5 fix(gateway): capture config hash after plugin auto-enable to prevent… · openclaw/openclaw@8c11210 fix: repair sanitized replay tool results before send (#67620) (thank… · openclaw/openclaw@c3c7a99 fix: restrict HTML timeout short-circuit to transient statuses · openclaw/openclaw@de129a6 fix: keep TUI watchdog bound to active run (#67401) (thanks @xantorres) · openclaw/openclaw@3525273 Gateway/skills: dedupe skills prefix-match + drop dead fallback on log · openclaw/openclaw@d7f489f Extensions/lmstudio: back off inference preload after consecutive fai… · openclaw/openclaw@b555214 TUI/streaming: add watchdog that resets the activity indicator after … · openclaw/openclaw@f44ab20 Agents/tool-loop: enable unknown-tool stream guard by default · openclaw/openclaw@36ed367 Gateway/skills: invalidate session skills snapshot on config write · openclaw/openclaw@b23d59a fix: classify HTML provider error pages correctly (#67642) (thanks @s… · openclaw/openclaw@e588e90 fix(skills): remove unused model-usage import (#67641) · openclaw/openclaw@55f05df docs(changelog): credit codex fix superseded PRs · openclaw/openclaw@e485f24 fix(openai-codex): normalize stale transport metadata in resolution a… · openclaw/openclaw@90801ba CI: pin Docker-related GitHub Actions (#67632) · openclaw/openclaw@f697b01 Android: modernize WebView and discovery API usage (#67627) · openclaw/openclaw@44a6e50 fix(deps): bump hono to 4.12.14 and @hono/node-server to 1.19.14 (GHS… · openclaw/openclaw@fbccc18 fix(deps): bump dompurify to 3.4.0 (#67614) · openclaw/openclaw@2c2dc00 CI: add explicit permissions to all workflow jobs (fixes code-scannin… · openclaw/openclaw@01b7516 fix: register bundled TTS providers and route overrides correctly (#6… · openclaw/openclaw@6ea3cdd fix: align host tilde paths with OS home (#62804) (thanks @stainlu) · openclaw/openclaw@ecfaf64 fix: flush creds queue before reconnect socket open (#67464) (thanks … · openclaw/openclaw@405c63f fix: strip standalone <function> tool call tags from visible text (#6… · openclaw/openclaw@78df859 fix(agents): preserve cli session metadata before transcript persist … · openclaw/openclaw@898fd04 docs(changelog): move cli transcript entry · openclaw/openclaw@c1817c6 fix(agents): normalize cli transcript api field · openclaw/openclaw@3a3fae0 docs(changelog): note cli transcript persistence · openclaw/openclaw@6c343f1 fix(agents): persist cli transcript turns · openclaw/openclaw@b8ef507 fix(msteams): harden security-sensitive flows (#65841) · openclaw/openclaw@c56b56e [Dashboard] Fix exec approval modal overflow for long command content… · openclaw/openclaw@053c5b0 Docs: remove QA changelog entry · openclaw/openclaw@7fd5771 QA: fix private runtime source loading (#67428) · openclaw/openclaw@d5933af docs(gateway): correct protocol.md schema path, hello-ok example, aut… · openclaw/openclaw@489404d CI: pin Node 22 runners to 22.18.0 · openclaw/openclaw@4ffa621 models.authStatus: normalize provider ids + tighten env-backed escape… · openclaw/openclaw@f2fdb9d Update CHANGELOG.md · openclaw/openclaw@7694a92 test(parallels): clean up npm update guard jobs · openclaw/openclaw@045ea7b Plugins: prefer scanDir override paths · openclaw/openclaw@b2974da fix(dreaming): default storage.mode to "separate" so phase blocks sto… · openclaw/openclaw@8c392f0 fix(memory-core): skip dreaming transcript ingestion via session stor… · openclaw/openclaw@a1b01f0 fix: dedupe replayed exec.finished node events (#67281) · openclaw/openclaw@5dcf526
fix(acpx): harden session lifecycle cleanup · openclaw/openclaw@42ecd5d
steipete · 2026-05-07 · via Recent Commits to openclaw:main

@@ -0,0 +1,310 @@

1+

---

2+

summary: "Build a plugin that registers a local AI CLI backend"

3+

title: "Building CLI backend plugins"

4+

sidebarTitle: "CLI backend plugins"

5+

read_when:

6+

- You are building a local AI CLI backend plugin

7+

- You want to register a backend for model refs such as acme-cli/model

8+

- You need to map a third-party CLI into OpenClaw's text fallback runner

9+

---

10+11+

CLI backend plugins let OpenClaw call a local AI CLI as a text inference

12+

backend. The backend appears as a provider prefix in model refs:

13+14+

```text

15+

acme-cli/acme-large

16+

```

17+18+

Use a CLI backend when the upstream integration is already exposed as a local

19+

command, when the CLI owns local login state, or when the CLI is a useful

20+

fallback if API providers are unavailable.

21+22+

<Info>

23+

If the upstream service exposes a normal HTTP model API, write a

24+

[provider plugin](/plugins/sdk-provider-plugins) instead. If the upstream

25+

runtime owns complete agent sessions, tool events, compaction, or background

26+

task state, use an [agent harness](/plugins/sdk-agent-harness).

27+

</Info>

28+29+

## What the plugin owns

30+31+

A CLI backend plugin has three contracts:

32+33+

| Contract | File | Purpose |

34+

| -------------------- | ---------------------- | --------------------------------------------------------- |

35+

| Package entry | `package.json` | Points OpenClaw at the plugin runtime module |

36+

| Manifest ownership | `openclaw.plugin.json` | Declares the backend id before runtime loads |

37+

| Runtime registration | `index.ts` | Calls `api.registerCliBackend(...)` with command defaults |

38+39+

The manifest is discovery metadata. It does not execute the CLI and does not

40+

register runtime behavior. Runtime behavior starts when the plugin entry calls

41+

`api.registerCliBackend(...)`.

42+43+

## Minimal backend plugin

44+45+

<Steps>

46+

<Step title="Create package metadata">

47+

```json package.json

48+

{

49+

"name": "@acme/openclaw-acme-cli",

50+

"version": "1.0.0",

51+

"type": "module",

52+

"openclaw": {

53+

"extensions": ["./index.ts"],

54+

"compat": {

55+

"pluginApi": ">=2026.3.24-beta.2",

56+

"minGatewayVersion": "2026.3.24-beta.2"

57+

},

58+

"build": {

59+

"openclawVersion": "2026.3.24-beta.2",

60+

"pluginSdkVersion": "2026.3.24-beta.2"

61+

}

62+

},

63+

"dependencies": {

64+

"openclaw": "^2026.3.24"

65+

},

66+

"devDependencies": {

67+

"typescript": "^5.9.0"

68+

}

69+

}

70+

```

71+72+

Published packages must ship built JavaScript runtime files. If your source

73+

entry is `./src/index.ts`, add `openclaw.runtimeExtensions` that points at

74+

the built JavaScript peer. See [Entry points](/plugins/sdk-entrypoints).

75+76+

</Step>

77+78+

<Step title="Declare backend ownership">

79+

```json openclaw.plugin.json

80+

{

81+

"id": "acme-cli",

82+

"name": "Acme CLI",

83+

"description": "Run Acme's local AI CLI through OpenClaw",

84+

"cliBackends": ["acme-cli"],

85+

"setup": {

86+

"cliBackends": ["acme-cli"],

87+

"requiresRuntime": false

88+

},

89+

"activation": {

90+

"onStartup": false

91+

},

92+

"configSchema": {

93+

"type": "object",

94+

"additionalProperties": false

95+

}

96+

}

97+

```

98+99+

`cliBackends` is the runtime ownership list. It lets OpenClaw auto-load the

100+

plugin when config or model selection mentions `acme-cli/...`.

101+102+

`setup.cliBackends` is the descriptor-first setup surface. Add it when

103+

model discovery, onboarding, or status should recognize the backend without

104+

loading plugin runtime. Use `requiresRuntime: false` only when those static

105+

descriptors are enough for setup.

106+107+

</Step>

108+109+

<Step title="Register the backend">

110+

```typescript index.ts

111+

import { definePluginEntry } from "openclaw/plugin-sdk/plugin-entry";

112+

import {

113+

CLI_FRESH_WATCHDOG_DEFAULTS,

114+

CLI_RESUME_WATCHDOG_DEFAULTS,

115+

type CliBackendPlugin,

116+

} from "openclaw/plugin-sdk/cli-backend";

117+118+

function buildAcmeCliBackend(): CliBackendPlugin {

119+

return {

120+

id: "acme-cli",

121+

liveTest: {

122+

defaultModelRef: "acme-cli/acme-large",

123+

defaultImageProbe: false,

124+

defaultMcpProbe: false,

125+

docker: {

126+

npmPackage: "@acme/acme-cli",

127+

binaryName: "acme",

128+

},

129+

},

130+

config: {

131+

command: "acme",

132+

args: ["chat", "--json"],

133+

output: "json",

134+

input: "stdin",

135+

modelArg: "--model",

136+

sessionArg: "--session",

137+

sessionMode: "existing",

138+

sessionIdFields: ["session_id", "conversation_id"],

139+

systemPromptFileArg: "--system-file",

140+

systemPromptWhen: "first",

141+

imageArg: "--image",

142+

imageMode: "repeat",

143+

reliability: {

144+

watchdog: {

145+

fresh: { ...CLI_FRESH_WATCHDOG_DEFAULTS },

146+

resume: { ...CLI_RESUME_WATCHDOG_DEFAULTS },

147+

},

148+

},

149+

serialize: true,

150+

},

151+

};

152+

}

153+154+

export default definePluginEntry({

155+

id: "acme-cli",

156+

name: "Acme CLI",

157+

description: "Run Acme's local AI CLI through OpenClaw",

158+

register(api) {

159+

api.registerCliBackend(buildAcmeCliBackend());

160+

},

161+

});

162+

```

163+164+

The backend id must match the manifest `cliBackends` entry. The registered

165+

`config` is only the default; user config under

166+

`agents.defaults.cliBackends.acme-cli` is merged over it at runtime.

167+168+

</Step>

169+

</Steps>

170+171+

## Config shape

172+173+

`CliBackendConfig` describes how OpenClaw should launch and parse the CLI:

174+175+

| Field | Use |

176+

| ----------------------------------------- | ----------------------------------------------------------- |

177+

| `command` | Binary name or absolute command path |

178+

| `args` | Base argv for fresh runs |

179+

| `resumeArgs` | Alternate argv for resumed sessions; supports `{sessionId}` |

180+

| `output` / `resumeOutput` | Parser: `json`, `jsonl`, or `text` |

181+

| `input` | Prompt transport: `arg` or `stdin` |

182+

| `modelArg` | Flag used before the model id |

183+

| `modelAliases` | Map OpenClaw model ids to CLI-native ids |

184+

| `sessionArg` / `sessionArgs` | How to pass a session id |

185+

| `sessionMode` | `always`, `existing`, or `none` |

186+

| `sessionIdFields` | JSON fields OpenClaw reads from CLI output |

187+

| `systemPromptArg` / `systemPromptFileArg` | System prompt transport |

188+

| `systemPromptWhen` | `first`, `always`, or `never` |

189+

| `imageArg` / `imageMode` | Image path support |

190+

| `serialize` | Keep same-backend runs ordered |

191+

| `reliability.watchdog` | No-output timeout tuning |

192+193+

Prefer the smallest static config that matches the CLI. Add plugin callbacks

194+

only for behavior that really belongs to the backend.

195+196+

## Advanced backend hooks

197+198+

`CliBackendPlugin` can also define:

199+200+

| Hook | Use |

201+

| ---------------------------------- | ------------------------------------------------------ |

202+

| `normalizeConfig(config, context)` | Rewrite legacy user config after merge |

203+

| `resolveExecutionArgs(ctx)` | Add request-scoped flags such as thinking effort |

204+

| `prepareExecution(ctx)` | Create temporary auth or config bridges before launch |

205+

| `transformSystemPrompt(ctx)` | Apply a final CLI-specific system prompt transform |

206+

| `textTransforms` | Bidirectional prompt/output replacements |

207+

| `defaultAuthProfileId` | Prefer a specific OpenClaw auth profile |

208+

| `authEpochMode` | Decide how auth changes invalidate stored CLI sessions |

209+

| `nativeToolMode` | Declare whether the CLI has always-on native tools |

210+

| `bundleMcp` / `bundleMcpMode` | Opt into OpenClaw's loopback MCP tool bridge |

211+212+

Keep these hooks provider-owned. Do not add CLI-specific branches to core when a

213+

backend hook can express the behavior.

214+215+

## MCP tool bridge

216+217+

CLI backends do not receive OpenClaw tools by default. If the CLI can consume an

218+

MCP configuration, opt in explicitly:

219+220+

```typescript

221+

return {

222+

id: "acme-cli",

223+

bundleMcp: true,

224+

bundleMcpMode: "codex-config-overrides",

225+

config: {

226+

command: "acme",

227+

args: ["chat", "--json"],

228+

output: "json",

229+

},

230+

};

231+

```

232+233+

Supported bridge modes are:

234+235+

| Mode | Use |

236+

| ------------------------ | ---------------------------------------------------------------- |

237+

| `claude-config-file` | CLIs that accept an MCP config file |

238+

| `codex-config-overrides` | CLIs that accept config overrides on argv |

239+

| `gemini-system-settings` | CLIs that read MCP settings from their system settings directory |

240+241+

Only enable the bridge when the CLI can actually consume it. If the CLI has its

242+

own built-in tool layer that cannot be disabled, set `nativeToolMode:

243+

"always-on"` so OpenClaw can fail closed when a caller requires no native tools.

244+245+

## User configuration

246+247+

Users can override any backend default:

248+249+

```json5

250+

{

251+

agents: {

252+

defaults: {

253+

cliBackends: {

254+

"acme-cli": {

255+

command: "/opt/acme/bin/acme",

256+

args: ["chat", "--json", "--profile", "work"],

257+

modelAliases: {

258+

large: "acme-large-2026",

259+

},

260+

},

261+

},

262+

model: {

263+

primary: "openai/gpt-5.5",

264+

fallbacks: ["acme-cli/large"],

265+

},

266+

},

267+

},

268+

}

269+

```

270+271+

Document the minimum override users are likely to need. Usually that is only

272+

`command` when the binary is outside `PATH`.

273+274+

## Verification

275+276+

For bundled plugins, add a focused test around the builder and setup

277+

registration, then run the plugin's targeted test lane:

278+279+

```bash

280+

pnpm test extensions/acme-cli

281+

```

282+283+

For local or installed plugins, verify discovery and one real model run:

284+285+

```bash

286+

openclaw plugins inspect acme-cli --runtime --json

287+

openclaw agent --message "reply exactly: backend ok" --model acme-cli/acme-large

288+

```

289+290+

If the backend supports images or MCP, add a live smoke that proves those paths

291+

with the real CLI. Do not rely on static inspection for prompt, image, MCP, or

292+

session-resume behavior.

293+294+

## Checklist

295+296+

<Check>`package.json` has `openclaw.extensions` and built runtime entries for published packages</Check>

297+

<Check>`openclaw.plugin.json` declares `cliBackends` and intentional `activation.onStartup`</Check>

298+

<Check>`setup.cliBackends` is present when setup/model discovery should see the backend cold</Check>

299+

<Check>`api.registerCliBackend(...)` uses the same backend id as the manifest</Check>

300+

<Check>User overrides under `agents.defaults.cliBackends.<id>` still win</Check>

301+

<Check>Session, system prompt, image, and output parser settings match the real CLI contract</Check>

302+

<Check>Targeted tests and at least one live CLI smoke prove the backend path</Check>

303+304+

## Related

305+306+

- [CLI backends](/gateway/cli-backends) - user configuration and runtime behavior

307+

- [Building plugins](/plugins/building-plugins) - package and manifest basics

308+

- [Plugin SDK overview](/plugins/sdk-overview) - registration API reference

309+

- [Plugin manifest](/plugins/manifest) - `cliBackends` and setup descriptors

310+

- [Agent harness](/plugins/sdk-agent-harness) - full external agent runtimes