Garry's Opinionated OpenClaw/Hermes Agent Brain
TypeScript
fix: drop the opt-out sweep across user-global paths (it reached other workspaces and profiles); the moved-Codex-target case is #8485
garrytan42b9be0cd4bb
diff --git a/src/core/setup/skills-block.ts b/src/core/setup/skills-block.tsindex 56124c8013..cc69001de9 100644--- a/src/core/setup/skills-block.ts+++ b/src/core/setup/skills-block.ts@@ -34,7 +34,7 @@ import { bundledCatalogId, bundledSkills, type SkillAudience } from '../skills/bimport { shellQuote } from '../shell-quote.ts';import { renderSkillIndexBlock, SKILL_INDEX_VERSION, SkillIndexTooLarge, skillIndexCatalog } from '../skills/spring-index.ts';import { SKILLS_BLOCK_BEGIN, SKILLS_BLOCK_END } from '../skills/index-block.ts';-import { BRAIN_FIRST_END, brainFirstTargetAt, CURSOR_HEAD, direntExists, isProjectSurface, readBrainFirstLedger, writeUnlessChanged, type BrainFirstHarness, type BrainFirstTarget } from './brain-first.ts';+import { BRAIN_FIRST_END, brainFirstTargetAt, CURSOR_HEAD, direntExists, readBrainFirstLedger, writeUnlessChanged, type BrainFirstHarness, type BrainFirstTarget } from './brain-first.ts';export { SKILLS_BLOCK_BEGIN, SKILLS_BLOCK_END };export const SKILL_LOADING_ENV = 'GBRAIN_SKILL_LOADING';@@ -390,7 +390,7 @@ const message = (e: unknown) => (e instanceof Error ? e.message : String(e));* outcome with a reason, and the file is left as it was unless the detail* says otherwise.*/-export function syncSkillsBlock(opts: { target: BrainFirstTarget; launcher: string; decision: SkillLoadingDecision; writer: string; dryRun: boolean; audience?: SkillAudience; settingsPath?: string; thisFileOnly?: boolean }): SkillsBlockOutcome {+export function syncSkillsBlock(opts: { target: BrainFirstTarget; launcher: string; decision: SkillLoadingDecision; writer: string; dryRun: boolean; audience?: SkillAudience; settingsPath?: string }): SkillsBlockOutcome {const { target, launcher, decision } = opts;const settings = opts.settingsPath ?? claudeUserSettingsPath();const audience = opts.audience ?? 'owner';@@ -421,11 +421,6 @@ export function syncSkillsBlock(opts: { target: BrainFirstTarget; launcher: strireturn out('preserve', `the skills markers in ${target.path} were hand-edited (duplicate, orphan or out of order); fix or delete them, then re-run`, { reason: 'damaged_markers' });}if (decision.value === 'off') {- if (!target.project && !opts.thisFileOnly && decision.source !== 'default') {- for (const other of readSkillLoadingLedger().filter((e) => e.harness === target.harness && e.path !== target.path && e.mode === 'spring' && !isProjectSurface(e.harness, e.path))) {- syncSkillsBlock({ ...opts, target: { ...target, path: other.path }, audience: other.audience, settingsPath: other.allow_settings, thisFileOnly: true });- }- }if (decision.source === 'default' && !prior && (before.state === 'current' || before.state === 'stale')) {return out('skip', `the skills index in ${target.path} is not in this gbrain's record (${skillLoadingLedgerPath()}); another gbrain home or install probably wrote it, so it is left as it is. Pass --skill-loading off to remove it from here`);}@@ -730,7 +725,6 @@ export function refreshSkillsIndexes(harness: BrainFirstHarness, opts: { mode?:writer: e.writer,dryRun: opts.dryRun,settingsPath: e.allow_settings,- thisFileOnly: true,}));if (!opts.dryRun || harness !== 'claude-code') return outcomes;// Each row previewed alone sees the others still owning a shared rule. When the batch drops that rule from everydiff --git a/test/setup-skill-loading.test.ts b/test/setup-skill-loading.test.tsindex 84762ac048..9b34d2dfbe 100644--- a/test/setup-skill-loading.test.ts+++ b/test/setup-skill-loading.test.ts@@ -262,19 +262,6 @@ describe('skill loading: launcher, permission and refresh', () => {expect(existsSync(join(profileB, 'settings.json')) ? JSON.parse(read(join(profileB, 'settings.json'))).permissions?.allow ?? [] : []).not.toContain(rule);});- test('codex --no-instructions also strips the index left in AGENTS.md after AGENTS.override.md took over', async () => {- const b = box();- const agents = join(b.home, '.codex', 'AGENTS.md');- await setup(b, ['codex', '--instructions-only', '--gbrain-bin', LAUNCHER, '--skill-loading', 'spring']);- expect(read(agents)).toContain(SKILLS_BLOCK_BEGIN);- writeFileSync(join(b.home, '.codex', 'AGENTS.override.md'), '# override rules for alice-example\n');- const r = await setup(b, ['codex', '--instructions-only', '--no-instructions', '--no-hooks']);- expect(r.exitCode).toBe(0);- expect(existsSync(agents) ? read(agents) : '').not.toContain(SKILLS_BLOCK_BEGIN);- const ledger = JSON.parse(read(join(b.home, '.gbrain', 'skill-loading.json')));- expect(ledger.entries.filter((e: { mode: string }) => e.mode === 'spring')).toEqual([]);- });-test('codex gets no permission edit (its sandbox runs the read-only loader)', async () => {const b = box();await setup(b, ['codex', '--instructions-only', '--gbrain-bin', LAUNCHER, '--skill-loading', 'spring']);