#2265·LifeOS

AlgorithmNudge routes to skills the model can't invoke (skillOverrides user-invocable-only/off, disable-model-invocation)

Author: MatiasBarbozaCreated Sep 29, 2026Updated Sep 29, 2026

Version: v7.40.4 (also unchanged on main @ 5e2f2e8c0abd)

What's broken

AlgorithmNudge's skill-routing index is built from every skills/*/SKILL.md on disk, with no check of whether the model is allowed to invoke the skill. A skill set to user-invocable-only or off in settings.json → skillOverrides, or carrying disable-model-invocation: true in its frontmatter, still gets indexed. The hook then tells the model "This prompt matches USE WHEN of: X — invoke the skill rather than handrolling" for a skill it cannot invoke.

It's noise, not danger, but the nudge contradicts itself, and it grows with every skill a user hides (Claude Code's /skills menu makes hiding a one-click action, so this is becoming common).

  • LifeOS/install/hooks/AlgorithmNudge.hook.ts:384: buildIndex() reads readdirSync(SKILLS_DIR) and frontmatter description only.
  • LifeOS/install/hooks/AlgorithmNudge.hook.ts:440: loadIndex() staleness watches SKILL.md mtimes only, so toggling a skill in settings never triggers a rebuild.

Repro against a clean tree

bash
git clone --depth 1 --branch v7.40.4 --quiet https://github.com/danielmiessler/LifeOS.git clean
mkdir home && cp -r clean/LifeOS/install home/.claude && cd home/.claude
echo '{"skillOverrides":{"ThreatModel":"user-invocable-only"}}' > settings.json
mkdir -p LIFEOS/MEMORY/STATE
HOME=$(cd .. && pwd) bun hooks/AlgorithmNudge.hook.ts --rebuild-index
jq -r '[.entries[].skill] as $s | "ThreatModel: \($s|index("ThreatModel")!=null)  Interview: \($s|index("Interview")!=null)  Research: \($s|index("Research")!=null)"' \
  LIFEOS/MEMORY/STATE/skill-usewhen-index.json

Negative control (v7.40.4 untouched)

index: 55 skills, 651 phrases
ThreatModel: true  Interview: true  Research: true

ThreatModel is hidden via skillOverrides, and Interview ships with disable-model-invocation: true. Both are still indexed. Research is visible and indexed, as it should be.

On a real install with ~30 hidden skills, replaying 114 logged prompts through the stock index gave 12 of 55 routing fires on skills the model couldn't invoke.

Suggested fix

The fix filters by effective state, not a name list. It reads skillOverrides in Claude Code's precedence order (user < project < local, last wins, so on/name-only in local re-enables), skips disable-model-invocation: true, and fails open: a missing or unparsable settings file hides nothing. name-only is not hidden, since the model can still invoke it. The settings read happens in the detached rebuild; the hot path only gains three stat() calls for staleness.

With the fix applied to the same clean tree:

index: 49 skills, 585 phrases
ThreatModel: false  Interview: false  Research: true

With settings.json set to invalid JSON, ThreatModel is back in the index, which is the fail-open behavior.

Diff against v7.40.4
diff
--- a/LifeOS/install/hooks/AlgorithmNudge.hook.ts
+++ b/LifeOS/install/hooks/AlgorithmNudge.hook.ts
@@ -379,19 +379,59 @@
   return hits.sort((a, b) => b.phrase.length - a.phrase.length).slice(0, 3);
 }
 
+// Skip skills the model cannot invoke: `user-invocable-only` / `off` in
+// skillOverrides, or `disable-model-invocation: true` in frontmatter. Read the
+// STATE, not a copied name list. Files are read in Claude Code precedence order
+// (user < project < local); last wins, so `on`/`name-only` in local re-enables a
+// skill hidden at user level. Fail open: a missing/broken settings hides nothing.
+const SKILL_SETTINGS_PATHS = [
+  join(PAI, 'settings.json'),
+  join(PAI, '.claude', 'settings.json'),
+  join(PAI, '.claude', 'settings.local.json'),
+];
+const HIDDEN_STATES = new Set(['user-invocable-only', 'off']);
+
+export function hiddenSkills(settingsPaths: string[] = SKILL_SETTINGS_PATHS): Set<string> {
+  const state = new Map<string, string>();
+  for (const p of settingsPaths) {
+    try {
+      const o = JSON.parse(readFileSync(p, 'utf-8'))?.skillOverrides;
+      if (!o || typeof o !== 'object') continue;
+      for (const [k, v] of Object.entries(o)) if (typeof v === 'string') state.set(k, v);
+    } catch { /* missing or unparsable ⇒ contributes nothing */ }
+  }
+  return new Set([...state].filter(([, v]) => HIDDEN_STATES.has(v)).map(([k]) => k));
+}
+
+/** Newest mtime among the settings files that can hide a skill — a change there
+ *  must rebuild the index just like a SKILL.md edit does. */
+function newestSettingsMtime(): number {
+  let newest = 0;
+  for (const p of SKILL_SETTINGS_PATHS) {
+    try { const t = statSync(p).mtimeMs; if (t > newest) newest = t; } catch { /* missing */ }
+  }
+  return newest;
+}
+
 /** Build the index by scanning skills/*\/SKILL.md frontmatter. Slow path only —
  *  invoked via --rebuild-index (detached from the hot path). */
-export function buildIndex(): SkillIndex {
+export function buildIndex(
+  skillsDir: string = SKILLS_DIR,
+  settingsPaths: string[] = SKILL_SETTINGS_PATHS,
+): SkillIndex {
   const entries: SkillIndex['entries'] = [];
+  const hidden = hiddenSkills(settingsPaths);
   let dirs: string[] = [];
-  try { dirs = readdirSync(SKILLS_DIR); } catch { /* no skills dir */ }
+  try { dirs = readdirSync(skillsDir); } catch { /* no skills dir */ }
   for (const dir of dirs) {
-    const skillMd = join(SKILLS_DIR, dir, 'SKILL.md');
+    const skillMd = join(skillsDir, dir, 'SKILL.md');
     try {
+      if (hidden.has(dir)) continue;
       if (!existsSync(skillMd)) continue;
       const head = readFileSync(skillMd, 'utf-8').slice(0, 4096);
       const fm = head.match(/^---\n([\s\S]*?)\n---/);
       if (!fm) continue;
+      if (/^disable-model-invocation:\s*true\s*$/m.test(fm[1])) continue;
       const desc = fm[1].match(/description:\s*([\s\S]*?)(?:\n[a-zA-Z_-]+:|$)/);
       if (!desc) continue;
       const phrases = parseUseWhen(desc[1]);
@@ -440,7 +480,8 @@
 function loadIndex(): SkillIndex | null {
   const idx = readJson<SkillIndex | null>(INDEX_PATH, null);
   const stale = !idx || Date.now() - idx.builtAt > INDEX_MAX_AGE_MS
-    || newestSkillMtime() > idx.builtAt;
+    || newestSkillMtime() > idx.builtAt
+    || newestSettingsMtime() > idx.builtAt;
   if (stale) {
     // Resolve bun absolutely: a detached rebuild spawned with the bare name
     // silently no-ops if bun isn't on the subprocess PATH, and the empty catch

We also have a 6-case test (hidden by user / local / off / frontmatter don't fire; visible and name-only do; local re-enables; broken settings hides nothing). With the filter removed, it fails 3 of 6. Happy to PR it alongside if useful.

Searched first: issues, PRs, and discussions for AlgorithmNudge, skillOverrides, user-invocable-only, disable-model-invocation, buildIndex, skill-usewhen-index, and "hidden skills". Related but distinct: #1787 (staleness by content, matchSkills morphology) and #1543 (nudges don't lead to invocations). Nothing on this.