Skip to content

Garry's Opinionated OpenClaw/Hermes Agent Brain

TypeScript

P8 part E: readiness registrations follow the new-install advertised default

garrytan610084bb6344
diff --git a/src/core/readiness.ts b/src/core/readiness.ts
index 8af63b7742..0f99440fdc 100644
--- a/src/core/readiness.ts
+++ b/src/core/readiness.ts
@@ -41,6 +41,7 @@ import { validateMountId } from './brain-registry.ts';
import { agentProcessMarker } from './interaction.ts';
import { resolveGbrainBin } from './gbrain-bin.ts';
import { resolveWritebackConfigFromFile } from './facts/writeback-config.ts';
+import { newInstallServeSurface } from '../mcp/surface.ts';
export type ReadinessState = 'ok' | 'disabled_by_choice' | 'not_applicable' | 'missing' | 'degraded' | 'unknown';
export type CapabilityId =
@@ -394,13 +395,14 @@ const HARNESS_DESTINATION: Record<ReadinessHarness, string> = {
const MEMORY_VERBS_INSTALL = 'docs/protocol/MEMORY_VERBS_v1.md#install-the-4-command-quickstart';
function stdioRegistration(h: ReadinessHarness, bin: string): Action {
- const argv = h === 'claude-code' ? ['claude', 'mcp', 'add', 'gbrain', '--', bin, 'serve', '--surface', 'verbs']
- : h === 'codex' ? ['codex', 'mcp', 'add', 'gbrain', '--', bin, 'serve', '--surface', 'verbs']
+ const surface = newInstallServeSurface();
+ const argv = h === 'claude-code' ? ['claude', 'mcp', 'add', 'gbrain', '--', bin, 'serve', '--surface', surface]
+ : h === 'codex' ? ['codex', 'mcp', 'add', 'gbrain', '--', bin, 'serve', '--surface', surface]
: ['gbrain', 'bootstrap', 'hooks', '--harness', 'opencode', '--no-hooks'];
const hooks = h === 'opencode' ? ' No lifecycle hooks are installed (--no-hooks); it must run inside an initialized agent workspace.' : ' No hooks, tool pre-approvals or tokens are added.';
return {
argv, consent: ['persistent_install'], actor: 'agent', requires_exclusive: false,
- why: `Registers gbrain as a stdio MCP server (${bin} serve --surface verbs, the seven memory verbs) in ${HARNESS_DESTINATION[h]}, so new ${HARNESS_LABEL[h]} sessions get memory tools.${hooks}`,
+ why: `Registers gbrain as a stdio MCP server (${bin} serve --surface ${surface}, ${surface === 'verbs' ? 'the seven memory verbs' : 'every tool callable, the advertised set listed'}) in ${HARNESS_DESTINATION[h]}, so new ${HARNESS_LABEL[h]} sessions get memory tools.${hooks}`,
user_message: `I'd like to add gbrain's memory tools to ${HARNESS_LABEL[h]} by writing one MCP server entry to ${HARNESS_DESTINATION[h]}. OK?`,
verify: VERIFY('harness_wiring'), docs: MEMORY_VERBS_INSTALL,
};
@@ -426,7 +428,7 @@ export function harnessWiringEntry(input: HarnessWiringInput): ReadinessEntry {
if (harnesses.length === 0) {
return { ...base, state: 'missing', reason: 'no_harness_detected', why: 'No agent harness was detected.',
fix: { consent: ['persistent_install'], actor: 'user', requires_exclusive: false, docs: MEMORY_VERBS_INSTALL,
- why: 'Register `<absolute path to gbrain> serve --surface verbs` as a stdio MCP server in your agent host; the install section lists the exact command per harness (Claude Code, Codex, Grok Build, opencode, OpenClaw).',
+ why: `Register \`<absolute path to gbrain> serve --surface ${newInstallServeSurface()}\` as a stdio MCP server in your agent host; the install section lists the exact command per harness (Claude Code, Codex, Grok Build, opencode, OpenClaw).`,
user_message: 'Which agent app should get gbrain memory? The install guide has a one-line command for each.' } };
}
if (lockOwner?.transport === 'http') {
diff --git a/src/mcp/surface.ts b/src/mcp/surface.ts
index 68bd0f76e0..745d123a9d 100644
--- a/src/mcp/surface.ts
+++ b/src/mcp/surface.ts
@@ -343,6 +343,16 @@ export function stdioToolListing(advertised: () => Promise<McpSurface | null>, c
};
}
+/**
+ * The `serve --surface` a readiness/quickstart registration writes. Once the
+ * benchmark picks an advertised surface, registrations call everything
+ * (`full`) and init's advertised surface narrows the list; until then they
+ * keep the seven verbs.
+ */
+export function newInstallServeSurface(): McpSurface {
+ return NEW_INSTALL_ADVERTISED_SURFACE === 'full' ? 'verbs' : 'full';
+}
+
/** What a fresh `gbrain init` writes into `mcp`: the advertised surface, unless it is 'full'. */
export function newInstallAdvertisedSurface(): { advertised_surface?: 'verbs' | 'starter' } {
return NEW_INSTALL_ADVERTISED_SURFACE === 'full' ? {} : { advertised_surface: NEW_INSTALL_ADVERTISED_SURFACE };
diff --git a/test/mcp-advertised-surface.serial.test.ts b/test/mcp-advertised-surface.serial.test.ts
index 95ccc913d9..cbc498cb6a 100644
--- a/test/mcp-advertised-surface.serial.test.ts
+++ b/test/mcp-advertised-surface.serial.test.ts
@@ -13,7 +13,7 @@ import { Client } from '@modelcontextprotocol/sdk/client/index.js';
import { StdioClientTransport } from '@modelcontextprotocol/sdk/client/stdio.js';
import { ToolListChangedNotificationSchema } from '@modelcontextprotocol/sdk/types.js';
import { operations } from '../src/core/operations.ts';
-import { advertisedOps, filterOpsForSurface, resolveAdvertisedSurface } from '../src/mcp/surface.ts';
+import { advertisedOps, filterOpsForSurface, newInstallAdvertisedSurface, newInstallServeSurface, NEW_INSTALL_ADVERTISED_SURFACE, resolveAdvertisedSurface } from '../src/mcp/surface.ts';
import { buildMcpInstructions } from '../src/mcp/instructions.ts';
import { keylessBrainEnv } from './helpers/provider-env.ts';
@@ -73,6 +73,15 @@ describe('advertised surface (pure)', () => {
expect(buildMcpInstructions({ tools: { callable: () => true } })).not.toContain('more are callable');
expect(buildMcpInstructions({ tools: { callable: n => n !== 'request_tools', hiddenCallable: 5 } })).not.toContain('more are callable');
});
+ test('new installs: init and registration move together', () => {
+ if (NEW_INSTALL_ADVERTISED_SURFACE === 'full') {
+ expect(newInstallAdvertisedSurface()).toEqual({});
+ expect(newInstallServeSurface()).toBe('verbs');
+ } else {
+ expect(newInstallAdvertisedSurface()).toEqual({ advertised_surface: NEW_INSTALL_ADVERTISED_SURFACE });
+ expect(newInstallServeSurface()).toBe('full');
+ }
+ });
});
describe('stdio session', () => {