Garry's Opinionated OpenClaw/Hermes Agent Brain
TypeScript
setup: the brain-first block names the tools the registration lists (recall on the verbs listing)
garrytanf505fca451fb
diff --git a/src/commands/setup.ts b/src/commands/setup.tsindex 70427cfde2..7218549f25 100644--- a/src/commands/setup.ts+++ b/src/commands/setup.ts@@ -453,7 +453,7 @@ export async function runSetup(args: string[]): Promise<number> {{ step: 'hooks', action: found.hooksCurrent ? 'keep' : 'write', detail: plan.events.length ? `${plan.events.join(', ')} in ${found.settingsPath}` : `no hooks (${found.settingsPath})` },...Object.entries(found.edited).map(([event]) => ({ step: 'hooks' as const, action: 'preserve' as const, detail: `${event} was edited after setup wrote it; kept` })),];- const instructions = brainFirstFor('claude-code', flags, { kind: 'mcp', server: flags.name, surface }, { scope, projectDir });+ const instructions = brainFirstFor('claude-code', flags, { kind: 'mcp', server: flags.name, surface: plan.advertise ?? surface }, { scope, projectDir });return finish(out, { dryRun: true, target, consent, steps, states: [], verify: null, notices: [], notes, instructions });}@@ -463,7 +463,7 @@ export async function runSetup(args: string[]): Promise<number> {beforeMcp: brainCreate ? async () => { notices = runBrainInit(initArgv, out, 'claude-code'); } : undefined,});for (const s of result.steps) say(out, ` ${s.action.padEnd(8)} ${s.step.padEnd(7)} ${s.detail}`);- const instructions = brainFirstFor('claude-code', flags, { kind: 'mcp', server: flags.name, surface }, { scope, projectDir });+ const instructions = brainFirstFor('claude-code', flags, { kind: 'mcp', server: flags.name, surface: plan.advertise ?? surface }, { scope, projectDir });if (!result.changed && !instructionsChanged(instructions)) say(out, 'Nothing changed: this install is already wired.');let verify: { ok: boolean; reason: string; message: string } | null;@@ -603,7 +603,7 @@ async function runCodexSetup(flags: SetupFlags, launcher: string, cfg: GBrainCon{ step: 'trust', action: found.trustCurrent ? 'keep' : 'write', detail: `trust entries for setup's groups in ${found.configPath}` },...Object.keys(found.edited).map((event) => ({ step: 'hooks' as const, action: 'preserve' as const, detail: `${event} was edited after setup wrote it; kept` })),];- const instructions = brainFirstFor('codex', flags, { kind: 'mcp', server: flags.name, surface }, {});+ const instructions = brainFirstFor('codex', flags, { kind: 'mcp', server: flags.name, surface: plan.advertise ?? surface }, {});return finish(out, { harness: 'codex', dryRun: true, target, consent, steps, states: [], verify: null, notices: [], notes, instructions });}@@ -614,7 +614,7 @@ async function runCodexSetup(flags: SetupFlags, launcher: string, cfg: GBrainCon});for (const s of result.steps) say(out, ` ${s.action.padEnd(8)} ${s.step.padEnd(7)} ${s.detail}`);for (const n of result.notes) say(out, `note: ${n}`);- const instructions = brainFirstFor('codex', flags, { kind: 'mcp', server: flags.name, surface }, {});+ const instructions = brainFirstFor('codex', flags, { kind: 'mcp', server: flags.name, surface: plan.advertise ?? surface }, {});if (!result.changed && !instructionsChanged(instructions)) say(out, 'Nothing changed: this install is already wired.');let verify: { ok: boolean; reason: string; message: string };diff --git a/test/setup-brain-first.test.ts b/test/setup-brain-first.test.tsindex 046c92382c..1492cda209 100644--- a/test/setup-brain-first.test.ts+++ b/test/setup-brain-first.test.ts@@ -401,6 +401,7 @@ describe('brain-first block: full setup and the installer lanes', () => {const doc = JSON.parse(first.stdout);expect(doc.instructions).toMatchObject({ action: 'write', path: join(b.home, '.claude', 'CLAUDE.md') });expect(read(join(b.home, '.claude', 'CLAUDE.md'))).toContain('the `gbrain` MCP server');+ expect(read(join(b.home, '.claude', 'CLAUDE.md'))).toContain('`recall` for what was said or decided');const second = JSON.parse((await runCli(['setup', 'claude-code', '--json', '--gbrain-bin', b.bin], { env: b.env })).stdout);expect(second.steps.map((s: any) => s.action)).toEqual(['keep', 'keep', 'keep']);expect(second.instructions.action).toBe('keep');@@ -409,6 +410,15 @@ describe('brain-first block: full setup and the installer lanes', () => {expect(existsSync(join(b.home, '.claude', 'CLAUDE.md'))).toBe(false);});+ test('the block names the tools the registration lists: recall on the default verbs listing, search on an explicit --surface full', async () => {+ const b = box();+ expect((await runCli(['setup', 'codex', '--json', '--gbrain-bin', b.bin], { env: b.env })).exitCode).toBe(0);+ expect(read(join(b.home, '.codex', 'AGENTS.md'))).toContain('`recall` for what was said or decided');+ const c = box();+ expect((await runCli(['setup', 'codex', '--surface', 'full', '--json', '--gbrain-bin', c.bin], { env: c.env })).exitCode).toBe(0);+ expect(read(join(c.home, '.codex', 'AGENTS.md'))).toContain('`search` for names and phrases');+ });+test('gbrain setup codex --no-instructions wires MCP and hooks but no block', async () => {const b = box();const r = await runCli(['setup', 'codex', '--no-instructions', '--json', '--gbrain-bin', b.bin], { env: b.env });