@@ -12,7 +12,7 @@ import { existsSync, lstatSync, mkdirSync, readdirSync, readFileSync, realpathSy
1212import { homedir } from 'node:os'
1313import { setTimeout as delay } from 'node:timers/promises'
1414import { promisify } from 'node:util'
15- import { join } from 'pathe'
15+ import { dirname , join } from 'pathe'
1616import { readCachedSection , writeSections } from '../../cache/index.ts'
1717import { sanitizeMarkdown } from '../../core/sanitize.ts'
1818import { detectInstalledAgents } from '../detect.ts'
@@ -179,10 +179,21 @@ function resolveReferenceDirs(skillDir: string): string[] {
179179 const refsDir = join ( skillDir , '.skilld' )
180180 if ( ! existsSync ( refsDir ) )
181181 return [ ]
182- return readdirSync ( refsDir )
182+ const resolved = readdirSync ( refsDir )
183183 . map ( entry => join ( refsDir , entry ) )
184184 . filter ( p => lstatSync ( p ) . isSymbolicLink ( ) && existsSync ( p ) )
185185 . map ( p => realpathSync ( p ) )
186+
187+ // Include parent directories so CLIs can search across all references at once
188+ // (e.g. Gemini's sandbox requires the parent dir to be explicitly included)
189+ const parents = new Set < string > ( )
190+ for ( const p of resolved ) {
191+ const parent = dirname ( p )
192+ if ( ! resolved . includes ( parent ) )
193+ parents . add ( parent )
194+ }
195+
196+ return [ ...resolved , ...parents ]
186197}
187198
188199// ── Cache ────────────────────────────────────────────────────────────
0 commit comments