Skip to content

Garry's Opinionated OpenClaw/Hermes Agent Brain

TypeScript

fix: keep --no-instructions removing the Cursor skills index

garrytanf57dea80eea7
diff --git a/changelog.d/capy-gbra435-pr3-cursor-pins.md b/changelog.d/capy-gbra435-pr3-cursor-pins.md
index 48b57b33d1..034d5cbfea 100644
--- a/changelog.d/capy-gbra435-pr3-cursor-pins.md
+++ b/changelog.d/capy-gbra435-pr3-cursor-pins.md
@@ -5,4 +5,5 @@
- Setup builds a catalog for the project from the skill folders Cursor loads there (`.agents`, `.cursor`, `.claude` and `.codex` skills in the project and your home directory) and prints its name. `gbrain skills pin add <id> --catalog <name>` checks the id against that catalog.
- The pins go in their own always-applied rule, `.cursor/rules/gbrain-pinned-skills.mdc`, with each skill's SKILL.md path. In a git repository its path goes in `.git/info/exclude`, so it is never committed. Your own rules are never touched, and with no pins there is no file.
- `gbrain doctor` reports Cursor as partial: pinned only, no per-turn hook, unverified. Nothing on this machine can see Cursor's request to confirm the rule reaches the model.
+- The pins sit beside the skills index that `--skill-loading spring` writes into gbrain's brain-first rule: on Cursor, resolve leaves that index in place, and `--skill-loading spring` no longer removes the pinned-skills rule.
- `gbrain setup cursor --skill-loading off` removes the rule and its exclude line; the pins stay in config.json. Nothing opens a brain, so a keyless or brainless install stays as it is.
diff --git a/src/commands/setup.ts b/src/commands/setup.ts
index a751d869fd..9c693ebbff 100644
--- a/src/commands/setup.ts
+++ b/src/commands/setup.ts
@@ -897,7 +897,7 @@ function removeBrainFirstFor(harness: BrainFirstHarness, where: { scope?: Wiring
* It sits beside the brain-first block, so declining that block (--no-instructions) removes the index too.
*/
function skillsFor(harness: BrainFirstHarness, flags: SetupFlags, launcher: string, where: { scope?: WiringScope; projectDir?: string }, brainFirst: BrainFirstOutcome | null): SkillsBlockOutcome | null {
- if (harness === 'cursor' && flags.skillResolver === 'on') return null;
+ if (harness === 'cursor' && flags.skillResolver === 'on' && brainFirst?.decision.value !== 'declined') return null;
const target = brainFirstTarget(harness, { ...where, workspace: flags.workspace });
if ('error' in target) return null;
return installerSkillsBlock({ target, launcher, writer: `gbrain setup ${harness}`, brainFirstDeclined: brainFirst?.decision.value === 'declined', skillLoading: flags.skillLoading, audience: isThinClient(loadConfig()) ? 'downstream' : 'owner', dryRun: flags.dryRun });
diff --git a/test/setup-cursor-skill-pins.test.ts b/test/setup-cursor-skill-pins.test.ts
index 2b85317c1a..0475298b9a 100644
--- a/test/setup-cursor-skill-pins.test.ts
+++ b/test/setup-cursor-skill-pins.test.ts
@@ -212,6 +212,10 @@ describe('gbrain setup cursor --skill-loading resolve (pinned skills only)', ()
expect(again.exitCode).toBe(0);
expect(readFileSync(rulePath(b), 'utf8')).toBe(rule);
expect(readFileSync(join(b.project, BRAIN_FIRST), 'utf8')).toBe(index);
+ const declined = await setup(b, ['--skill-loading', 'resolve', '--no-instructions', '--gbrain-bin', launcher]);
+ expect(declined.exitCode).toBe(0);
+ expect(declined.doc.skills).toMatchObject({ action: 'remove' });
+ expect(existsSync(join(b.project, BRAIN_FIRST)) ? readFileSync(join(b.project, BRAIN_FIRST), 'utf8') : '').not.toContain('gbrain:skills');
});
test('a plain gbrain setup cursor writes no pins, and a project with no skill directory refuses resolve', async () => {