fix(manifest): declare kind=context-engine so install auto-binds slot#397
Merged
jalehman merged 1 commit intoApr 11, 2026
Merged
Conversation
The OpenClaw core slot resolver in `plugins/slots.ts` reads a plugin's
top-level `kind` field, maps it via `SLOT_BY_KIND` (`context-engine ->
contextEngine`), and calls `applyExclusiveSlotSelection`. When `kind` is
missing, `slotKeysForPluginKind` returns an empty array and the
exclusive-slot selection path early-returns without assigning any slot.
As a result, `openclaw plugins install @martian-engineering/lossless-claw`
silently leaves `plugins.slots.contextEngine` unset, and OpenClaw falls
back to the built-in `legacy` context engine at runtime. The plugin loads
and registers its context engine with `api.registerContextEngine("lossless-claw", ...)`,
but nothing ever routes traffic to it.
The only user-visible symptom is that `lcm.db` stays at the initial
~4 KB / 0 tables forever, even on an install that reports success. The
README states that installation auto-sets the slot, which is the intended
behavior — it only fails because the manifest is missing this one field.
The fix is a single new top-level field in `openclaw.plugin.json`. A
matching manifest-shape test is added to `test/config.test.ts` so any
future edit that drops or retypes the field fails fast.
Verification:
- All 40 test files / 694 tests pass locally on `npm test`
- New manifest test explicitly checks `manifest.kind === "context-engine"`
- Traced against OpenClaw core `dist/slots-CFrDTeTR.js` (`SLOT_BY_KIND`,
`slotKeysForPluginKind`, `applyExclusiveSlotSelection`): with `kind`
present, `slotKeysForPluginKind` now returns `["contextEngine"]` and
`applyExclusiveSlotSelection` writes `plugins.slots.contextEngine =
"lossless-claw"`, which is the exact config state that activates LCM
end-to-end.
Fixes Martian-Engineering#384.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Contributor
|
Thank you! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
"kind": "context-engine"field toopenclaw.plugin.jsonso OpenClaw core's slot resolver binds thecontextEngineslot to this plugin on install.test/config.test.tsso any future edit that drops or retypes the field fails fast.Fixes #384.
Root cause (quoting the issue)
OpenClaw core's slot resolver lives in
src/plugins/slots.ts(compiled todist/slots-CFrDTeTR.jsin the published build). Its pipeline:Before this PR,
openclaw.plugin.jsonhas no top-levelkindfield, soslotKeysForPluginKindreturns[]andapplyExclusiveSlotSelectionearly-returns withchanged: false.openclaw plugins install @martian-engineering/lossless-clawsilently leavesplugins.slots.contextEngineunset, and OpenClaw falls back to the defaultlegacycontext engine at runtime.The plugin still loads and still calls
api.registerContextEngine("lossless-claw", () => lcm)— but the slot resolver never routes any traffic to that registration, so no conversation ever reacheslcm.handleContextPrepare/lcm.onTurnComplete.User-visible symptom
lcm.dbstays at the initial ~4 KB / 0 tables forever, even on an install that reports success and even withplugins.entries.lossless-claw.enabled: true. On one 4-week-old v0.3.0 install the DB was still empty untilplugins.slots.contextEngine: "lossless-claw"was added manually, at which point all 21 LCM tables initialized on the next turn and LCM started writing normally. See #384 for the full trace.Fix
One new top-level field in
openclaw.plugin.json:{ "id": "lossless-claw", + "kind": "context-engine", "skills": [With
kindpresent,slotKeysForPluginKindnow returns["contextEngine"]andapplyExclusiveSlotSelectionwritesplugins.slots.contextEngine = "lossless-claw"— which is the exact config state users currently have to hand-edit to make LCM work.Test
Adds one shape test next to the existing skill-path test:
Verification
npm test— all 40 test files / 694 tests pass locallydist/slots-CFrDTeTR.js(SLOT_BY_KIND,slotKeysForPluginKind,applyExclusiveSlotSelection) — the semantics match what is claimed abovekindfield, so this is a pure additionWhat this does NOT change
api.registerContextEnginecall orindex.tsentrypoint🤖 Generated with Claude Code