Skip to content

Garry's Opinionated OpenClaw/Hermes Agent Brain

TypeScript

fix(openclaw): declare gbrain plugin manifest entry (takeover of #2551) (#3185)

Time Attakcd9eb027bdd75
diff --git a/docs/guides/skillpacks-as-scaffolding.md b/docs/guides/skillpacks-as-scaffolding.md
index b58d8e5111..db33a8a1dc 100644
--- a/docs/guides/skillpacks-as-scaffolding.md
+++ b/docs/guides/skillpacks-as-scaffolding.md
@@ -131,7 +131,9 @@ into gbrain so other clients can scaffold it. Default behavior:
`~/.gbrain/harvest-private-patterns.txt` plus built-in defaults
(canonical private fork name, common email regex, Slack channel pattern). Any
match → rollback (delete the harvested files) and exit non-zero.
-- `openclaw.plugin.json` updated with the new slug, sorted.
+- `openclaw.plugin.json` updated with the new slug, sorted. Harvest must preserve
+ the top-level OpenClaw-native plugin fields (`id`, `configSchema`, `contracts`)
+ because OpenClaw validates those before it can install the package.
- `--no-lint` bypasses the linter (after a manual editorial scrub).
Use the `skillpack-harvest` skill (its companion editorial workflow)
diff --git a/openclaw.plugin.json b/openclaw.plugin.json
index e6c1b0533e..f12bb64454 100644
--- a/openclaw.plugin.json
+++ b/openclaw.plugin.json
@@ -1,4 +1,5 @@
{
+ "id": "gbrain-context-engine",
"name": "gbrain",
"version": "0.32.3.0",
"description": "Personal knowledge brain with Postgres + pgvector hybrid search",
diff --git a/skills/skillpack-harvest/SKILL.md b/skills/skillpack-harvest/SKILL.md
index a19e217b50..bd6f2dfbbb 100644
--- a/skills/skillpack-harvest/SKILL.md
+++ b/skills/skillpack-harvest/SKILL.md
@@ -266,4 +266,5 @@ editorial pass.
(e.g. `src/commands/<slug>.ts` if the host SKILL.md declares it
in frontmatter)
- gbrain's `openclaw.plugin.json` — adds the slug to `skills:`
- array, sorted alphabetically
+ array, sorted alphabetically, without removing OpenClaw-native plugin fields
+ like `id`, `configSchema`, or `contracts`
diff --git a/skills/testing/SKILL.md b/skills/testing/SKILL.md
index 790820c563..9d73437d14 100644
--- a/skills/testing/SKILL.md
+++ b/skills/testing/SKILL.md
@@ -57,6 +57,8 @@ This mode guarantees:
- `skills/manifest.json` lists every skill directory
- `skills/RESOLVER.md` references every skill in the manifest
- `openclaw.plugin.json` `skills[]` round-trips with both
+- `openclaw.plugin.json` keeps OpenClaw install-required native plugin fields
+ (`id`, object `configSchema`, and `contracts.contextEngines` when applicable)
- No MECE violations (duplicate triggers across skills)
### Phases
@@ -72,7 +74,7 @@ This mode guarantees:
### Automation
```bash
-bun test test/skills-conformance.test.ts test/resolver.test.ts
+bun test test/skills-conformance.test.ts test/resolver.test.ts test/openclaw-plugin-manifest.test.ts
```
The CI-gated check is the package.json `test` script.
diff --git a/src/openclaw-context-engine.ts b/src/openclaw-context-engine.ts
index b1809523f3..a1055cf293 100644
--- a/src/openclaw-context-engine.ts
+++ b/src/openclaw-context-engine.ts
@@ -63,25 +63,26 @@ interface PluginCtx {
[key: string]: unknown;
}
+export function register(api: PluginApi) {
+ api.registerContextEngine(ENGINE_ID, (ctx: PluginCtx) => {
+ const hostResolver =
+ typeof ctx.resolveEntities === 'function'
+ ? ctx.resolveEntities
+ : typeof ctx.brainQuery === 'function'
+ ? ctx.brainQuery
+ : undefined;
+ return createGBrainContextEngine({
+ workspaceDir: ctx.workspaceDir,
+ resolveEntities: hostResolver,
+ });
+ });
+}
+
const entry: PluginEntry = {
id: 'gbrain-context-engine',
name: 'GBrain Context Engine',
description: 'Deterministic temporal/spatial context injection on every turn',
-
- register(api: PluginApi) {
- api.registerContextEngine(ENGINE_ID, (ctx: PluginCtx) => {
- const hostResolver =
- typeof ctx.resolveEntities === 'function'
- ? ctx.resolveEntities
- : typeof ctx.brainQuery === 'function'
- ? ctx.brainQuery
- : undefined;
- return createGBrainContextEngine({
- workspaceDir: ctx.workspaceDir,
- resolveEntities: hostResolver,
- });
- });
- },
+ register,
};
export default entry;
diff --git a/test/openclaw-plugin-manifest.test.ts b/test/openclaw-plugin-manifest.test.ts
new file mode 100644
index 0000000000..f06882f8d3
--- /dev/null
+++ b/test/openclaw-plugin-manifest.test.ts
@@ -0,0 +1,17 @@
+import { describe, expect, it } from 'bun:test';
+import { readFileSync } from 'fs';
+import { join } from 'path';
+
+describe('root OpenClaw plugin manifest', () => {
+ it('declares the id required by OpenClaw plugin installs', () => {
+ const manifest = JSON.parse(readFileSync(join(import.meta.dir, '..', 'openclaw.plugin.json'), 'utf8'));
+ const entrySource = readFileSync(join(import.meta.dir, '..', 'src', 'openclaw-context-engine.ts'), 'utf8');
+ const entryId = entrySource.match(/id:\s*'([^']+)'/)?.[1];
+
+ expect(manifest.id).toBe(entryId);
+ expect(manifest.configSchema).toBeDefined();
+ expect(typeof manifest.configSchema).toBe('object');
+ expect(manifest.contracts?.contextEngines).toContain('gbrain-context');
+ expect(entrySource).toContain('export function register');
+ });
+});