@blockrun/franklin 3.28.3 → 3.29.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (40) hide show
  1. package/dist/agent/commands.js +37 -9
  2. package/dist/agent/compact.js +1 -1
  3. package/dist/agent/context.js +8 -14
  4. package/dist/agent/llm.js +3 -3
  5. package/dist/agent/loop.js +35 -7
  6. package/dist/agent/optimize.js +5 -5
  7. package/dist/agent/tokens.js +1 -0
  8. package/dist/agent/verification.js +1 -1
  9. package/dist/commands/skills.d.ts +1 -0
  10. package/dist/commands/skills.js +21 -5
  11. package/dist/commands/slack.js +1 -1
  12. package/dist/commands/social.js +1 -1
  13. package/dist/commands/telegram.js +1 -1
  14. package/dist/index.js +1 -0
  15. package/dist/learnings/extractor.js +2 -3
  16. package/dist/learnings/store.d.ts +25 -4
  17. package/dist/learnings/store.js +148 -39
  18. package/dist/mcp/client.d.ts +47 -29
  19. package/dist/mcp/client.js +288 -128
  20. package/dist/mcp/config.js +4 -0
  21. package/dist/mcp/oauth.d.ts +41 -0
  22. package/dist/mcp/oauth.js +205 -0
  23. package/dist/plugin-sdk/workflow.js +2 -2
  24. package/dist/pricing.js +4 -2
  25. package/dist/proxy/fallback.js +1 -1
  26. package/dist/proxy/server.js +15 -13
  27. package/dist/router/index.js +21 -22
  28. package/dist/router/vision.js +2 -1
  29. package/dist/skills/bootstrap.d.ts +35 -10
  30. package/dist/skills/bootstrap.js +87 -10
  31. package/dist/skills/loader.js +12 -0
  32. package/dist/skills/registry.d.ts +1 -1
  33. package/dist/skills/registry.js +4 -3
  34. package/dist/skills/triggers.d.ts +38 -0
  35. package/dist/skills/triggers.js +95 -0
  36. package/dist/skills/types.d.ts +14 -1
  37. package/dist/tools/moa.js +2 -3
  38. package/dist/tools/subagent.js +1 -1
  39. package/dist/ui/model-picker.js +25 -23
  40. package/package.json +1 -1
@@ -219,7 +219,7 @@ const DIRECT_COMMANDS = {
219
219
  if (ctx.skillRegistry) {
220
220
  const visible = ctx.skillRegistry
221
221
  .list()
222
- .filter((l) => !l.skill.disableModelInvocation);
222
+ .filter((l) => !l.skill.disableModelInvocation && !l.skill.hidden);
223
223
  if (visible.length > 0) {
224
224
  skillsBlock =
225
225
  `\n **Skills:**\n` +
@@ -318,20 +318,48 @@ const DIRECT_COMMANDS = {
318
318
  emitDone(ctx);
319
319
  },
320
320
  '/mcp': async (ctx) => {
321
- const { listMcpServers } = await import('../mcp/client.js');
321
+ const { listMcpServers, listMcpFailures, getMcpStderrTail } = await import('../mcp/client.js');
322
322
  const servers = listMcpServers();
323
- if (servers.length === 0) {
324
- ctx.onEvent({ kind: 'text_delta', text: 'No MCP servers connected.\nAdd servers to `~/.blockrun/mcp.json` or `.mcp.json` in your project.\n' });
323
+ const failures = listMcpFailures();
324
+ let text = '';
325
+ if (servers.length === 0 && failures.length === 0) {
326
+ text = 'No MCP servers connected.\nAdd servers to `~/.blockrun/mcp.json` or `.mcp.json` in your project.\n';
325
327
  }
326
328
  else {
327
- let text = `**${servers.length} MCP server(s) connected:**\n\n`;
329
+ if (servers.length > 0) {
330
+ text += `**${servers.length} MCP server(s) connected:**\n\n`;
331
+ for (const s of servers) {
332
+ const oauthFlag = s.hasOAuth ? (s.oauthAuthorized ? ' · oauth ✓' : ' · oauth ✗') : '';
333
+ const filterNote = s.filtered > 0 ? ` (+${s.filtered} hidden by enabled_tools/disabled_tools)` : '';
334
+ text += ` **${s.name}** [${s.transport}] — ${s.toolCount} tools${filterNote}${oauthFlag}\n`;
335
+ for (const t of s.tools)
336
+ text += ` · ${t}\n`;
337
+ }
338
+ }
339
+ if (failures.length > 0) {
340
+ text += `\n**${failures.length} MCP server(s) failed to connect:**\n\n`;
341
+ for (const f of failures) {
342
+ text += ` **${f.name}** [${f.transport}] — ${f.reason}\n`;
343
+ if (f.stderrTail.length > 0) {
344
+ text += ` stderr (last ${f.stderrTail.length} lines):\n`;
345
+ for (const line of f.stderrTail.slice(-10)) {
346
+ text += ` | ${line.slice(0, 200)}\n`;
347
+ }
348
+ }
349
+ }
350
+ }
351
+ // Surface live stderr from running stdio servers (debug helper).
328
352
  for (const s of servers) {
329
- text += ` **${s.name}** — ${s.toolCount} tools\n`;
330
- for (const t of s.tools)
331
- text += ` · ${t}\n`;
353
+ const tail = getMcpStderrTail(s.name);
354
+ if (tail.length > 0 && s.transport === 'stdio') {
355
+ text += `\n ${s.name} recent stderr (${tail.length} lines):\n`;
356
+ for (const line of tail.slice(-5)) {
357
+ text += ` | ${line.slice(0, 200)}\n`;
358
+ }
359
+ }
332
360
  }
333
- ctx.onEvent({ kind: 'text_delta', text });
334
361
  }
362
+ ctx.onEvent({ kind: 'text_delta', text });
335
363
  emitDone(ctx);
336
364
  },
337
365
  '/context': async (ctx) => {
@@ -456,7 +456,7 @@ function formatCompactSummary(raw) {
456
456
  function pickCompactionModel(primaryModel) {
457
457
  // Free parent → free compaction (no silent charge)
458
458
  if (primaryModel.startsWith('nvidia/') || primaryModel === 'blockrun/free') {
459
- return 'nvidia/qwen3-coder-480b';
459
+ return 'nvidia/llama-4-maverick';
460
460
  }
461
461
  // Use cheapest capable model for summarization to save cost
462
462
  // Tier down: opus/pro → sonnet, sonnet → haiku, everything else → flash (cheapest capable)
@@ -9,7 +9,7 @@ import { BLOCKRUN_DIR } from '../config.js';
9
9
  import { getWalletAddress as getBaseWalletAddress } from '@blockrun/llm';
10
10
  import { Keypair } from '@solana/web3.js';
11
11
  import bs58 from 'bs58';
12
- import { loadLearnings, decayLearnings, saveLearnings, formatForPrompt, loadSkills, formatSkillsForPrompt } from '../learnings/store.js';
12
+ import { loadLearnings, decayLearnings, saveLearnings, formatForPrompt } from '../learnings/store.js';
13
13
  // ─── System Instructions Assembly ──────────────────────────────────────────
14
14
  // Composable prompt sections — each independently maintainable and conditionally includable.
15
15
  function getCoreInstructions() {
@@ -242,7 +242,7 @@ You run on the BlockRun AI Gateway. When the user asks you to "test the BlockRun
242
242
  - \`GET /.well-known/x402\` — x402 resource list with prices
243
243
 
244
244
  **LLM (POST, x402-paid)**
245
- - \`POST /v1/chat/completions\` — OpenAI-compatible. Body: \`{ model, messages, stream?, tools?, max_tokens?, temperature? }\`. \`model\` MUST come from \`GET /v1/models\` (real frontier examples on the gateway as of 2026-05: \`anthropic/claude-sonnet-4.6\`, \`anthropic/claude-opus-4.8\`, \`deepseek/deepseek-v4-pro\`, \`zai/glm-5.1\`, \`nvidia/qwen3-coder-480b\`, \`openai/gpt-5-nano\`). Do NOT invent versions like \`openai/gpt-5.1\` or \`xai/grok-5\` — those don't exist; the gateway 400s with the valid list in the error body, so when in doubt fetch \`GET /v1/models\` first.
245
+ - \`POST /v1/chat/completions\` — OpenAI-compatible. Body: \`{ model, messages, stream?, tools?, max_tokens?, temperature? }\`. \`model\` MUST come from \`GET /v1/models\` (real frontier examples on the gateway as of 2026-06: \`anthropic/claude-sonnet-4.6\`, \`anthropic/claude-opus-4.8\`, \`deepseek/deepseek-v4-pro\`, \`zai/glm-5.1\`, \`nvidia/llama-4-maverick\`, \`openai/gpt-5-nano\`). Do NOT invent versions like \`openai/gpt-5.1\` or \`xai/grok-5\` — those don't exist; the gateway 400s with the valid list in the error body, so when in doubt fetch \`GET /v1/models\` first.
246
246
  - \`POST /v1/messages\` — Anthropic-compatible. Body: \`{ model, messages, max_tokens, system?, tools? }\`.
247
247
 
248
248
  **Media (POST, x402-paid; GET to poll async jobs)**
@@ -505,18 +505,12 @@ export function assembleInstructions(workingDir, model) {
505
505
  }
506
506
  }
507
507
  catch { /* learnings are optional — never block startup */ }
508
- // Inject relevant skills (procedural memory from past complex tasks)
509
- try {
510
- const allSkills = loadSkills();
511
- if (allSkills.length > 0) {
512
- // Skills are matched lazily on first user message — for now inject top skills by use count
513
- const topSkills = allSkills.sort((a, b) => b.uses - a.uses).slice(0, 5);
514
- const skillsSection = formatSkillsForPrompt(topSkills);
515
- if (skillsSection)
516
- parts.push(skillsSection);
517
- }
518
- }
519
- catch { /* skills are optional */ }
508
+ // Procedural skills (bundled + learned + user + project) used to be
509
+ // injected here at session boot. They now flow through the unified
510
+ // src/skills/ Registry and are matched per-turn against the user's
511
+ // message in src/skills/triggers.ts, so we no longer pre-inject all
512
+ // top-by-use skills into every system prompt — the per-turn hint is both
513
+ // more relevant and cheaper.
520
514
  // Model-specific execution guidance
521
515
  if (model) {
522
516
  parts.push(getModelGuidance(model));
package/dist/agent/llm.js CHANGED
@@ -422,10 +422,10 @@ export class ModelClient {
422
422
  // strings (now retired routing profiles) end up at the same place
423
423
  // without needing dedicated entries.
424
424
  const FALLBACKS = {
425
- 'blockrun/auto': 'nvidia/qwen3-coder-480b',
426
- 'blockrun/free': 'nvidia/qwen3-coder-480b',
425
+ 'blockrun/auto': 'nvidia/llama-4-maverick',
426
+ 'blockrun/free': 'nvidia/llama-4-maverick',
427
427
  };
428
- return FALLBACKS[model] || 'nvidia/qwen3-coder-480b';
428
+ return FALLBACKS[model] || 'nvidia/llama-4-maverick';
429
429
  }
430
430
  /**
431
431
  * USDC actually charged for the most recent stream. 0 if no payment
@@ -6,7 +6,8 @@ import { ModelClient } from './llm.js';
6
6
  import { autoCompactIfNeeded, forceCompact, microCompact, projectCompactionSavings } from './compact.js';
7
7
  import { estimateHistoryTokens, updateActualTokens, resetTokenAnchor, getAnchoredTokenCount, getContextWindow, setEstimationModel } from './tokens.js';
8
8
  import { handleSlashCommand } from './commands.js';
9
- import { loadBundledSkills, getSkillVars } from '../skills/bootstrap.js';
9
+ import { loadAllSkills, getSkillVars } from '../skills/bootstrap.js';
10
+ import { matchSkillTriggers, formatSkillHints } from '../skills/triggers.js';
10
11
  import { reduceTokens } from './reduce.js';
11
12
  import { redactSecrets, stashSecretsToEnv, formatRedactionWarning } from './secret-redact.js';
12
13
  import { PermissionManager } from './permissions.js';
@@ -543,10 +544,12 @@ export async function interactiveSession(config, getUserInput, onEvent, onAbortR
543
544
  config.baseModel = config.model; // User's intended model — /model command updates this
544
545
  let turnFailedModels = new Set(); // Models that failed this turn (cleared each new turn)
545
546
  // ── Skills (file-loaded SKILL.md prompt-rewrite slash commands) ──
546
- // Bundled-only in Phase 1 of the skills MVP. User-global and project-local
547
- // discovery + the budget-cap-usd / cost-receipt enforcement contract land
548
- // in Phase 2 — see docs/plans/2026-04-29-franklin-skills-mvp-design.md.
549
- const skillBoot = loadBundledSkills();
547
+ // Loaded from four sources, precedence project > user > learned > bundled,
548
+ // in a single Registry that handles name conflicts. Learned skills are
549
+ // written by the learnings extractor under ~/.blockrun/skills/learned/
550
+ // and join the same Registry — they show up via trigger matching but are
551
+ // hidden from /help unless the user explicitly lists them.
552
+ const skillBoot = loadAllSkills(workDir);
550
553
  if (skillBoot.errors.length > 0 && config.debug) {
551
554
  for (const err of skillBoot.errors) {
552
555
  onEvent({ kind: 'text_delta', text: `[skills] ${err.path}: ${err.error}\n` });
@@ -724,6 +727,26 @@ export async function interactiveSession(config, getUserInput, onEvent, onAbortR
724
727
  input = redactedText;
725
728
  }
726
729
  lastUserInput = input;
730
+ // ── Skill trigger auto-invoke ──
731
+ // Match the user message against every skill's `triggers:` list. Strong
732
+ // matches surface as a soft hint appended to this turn's system prompt
733
+ // so the model treats the skill's procedure as guidance rather than
734
+ // mandatory rewriting (which would surprise the user). The skill body
735
+ // is NEVER substituted into the visible user message — that breaks the
736
+ // session transcript and the user's intent representation. See
737
+ // src/skills/triggers.ts for the matching algorithm.
738
+ let turnSkillHints = '';
739
+ try {
740
+ const matches = matchSkillTriggers(input, skillRegistry.list());
741
+ if (matches.length > 0) {
742
+ turnSkillHints = formatSkillHints(matches);
743
+ if (config.debug && matches.length > 0) {
744
+ const summary = matches.map(m => `${m.skill.skill.name}(${m.score.toFixed(1)})`).join(', ');
745
+ onEvent({ kind: 'text_delta', text: `*[skill triggers] ${summary}*\n` });
746
+ }
747
+ }
748
+ }
749
+ catch { /* trigger matching is best-effort */ }
727
750
  // Push the user's clean message; any harness-injected annotations
728
751
  // (pushback SYSTEM NOTE, prefetch context block) are applied AFTER
729
752
  // the turn analyzer runs so they get driven by model-decided flags
@@ -1257,6 +1280,11 @@ export async function interactiveSession(config, getUserInput, onEvent, onAbortR
1257
1280
  callMaxTokens = 2048; // Short plan output
1258
1281
  callSystemPrompt = systemPrompt + '\n\n' + getPlanningPrompt();
1259
1282
  }
1283
+ // Skill-trigger hints from this turn — see the trigger-match block
1284
+ // above, computed once per user message.
1285
+ if (turnSkillHints) {
1286
+ callSystemPrompt = callSystemPrompt + '\n\n' + turnSkillHints;
1287
+ }
1260
1288
  // ── Hallucination guard for weak models ──
1261
1289
  // Weak / free models (nemotron-ultra, GLM-4, qwen coder, free-profile
1262
1290
  // resolves) have been observed inventing tool names (e.g. MixtureOfAgents)
@@ -1348,7 +1376,7 @@ export async function interactiveSession(config, getUserInput, onEvent, onAbortR
1348
1376
  const hasTools = responseParts.some(p => p.type === 'tool_use');
1349
1377
  const hasThinking = responseParts.some(p => p.type === 'thinking');
1350
1378
  if (!hasText && !hasTools && !hasThinking) {
1351
- const EMPTY_FALLBACK_MODELS = ['nvidia/qwen3-coder-480b', 'nvidia/llama-4-maverick', 'zai/glm-5.1'];
1379
+ const EMPTY_FALLBACK_MODELS = ['nvidia/llama-4-maverick', 'nvidia/deepseek-v4-flash', 'zai/glm-5.1'];
1352
1380
  const nextModel = EMPTY_FALLBACK_MODELS.find(m => m !== config.model && !turnFailedModels.has(m));
1353
1381
  if (nextModel && recoveryAttempts < 2) {
1354
1382
  recoveryAttempts++;
@@ -1390,7 +1418,7 @@ export async function interactiveSession(config, getUserInput, onEvent, onAbortR
1390
1418
  // Excludes nvidia/* and *-coder-* — they're the source population.
1391
1419
  const TOOL_USE_FALLBACK_MODELS = [
1392
1420
  'anthropic/claude-haiku-4.5',
1393
- 'moonshot/kimi-k2.6',
1421
+ 'moonshot/kimi-k2.7',
1394
1422
  'openai/gpt-5',
1395
1423
  'anthropic/claude-sonnet-4.6',
1396
1424
  ];
@@ -40,11 +40,11 @@ const MODEL_MAX_OUTPUT = {
40
40
  'deepseek/deepseek-chat': 65_536,
41
41
  'deepseek/deepseek-reasoner': 65_536,
42
42
  'deepseek/deepseek-v4-pro': 65_536,
43
- // Kimi K2.6 supports 65K output per the BlockRun gateway model entry
44
- // (moonshot/kimi-k2.6 max_output: 65536). Without this entry the default
45
- // 16K cap left users with 4× headroom on the table for long-form coding
46
- // outputs and dashboard scaffolds the model can otherwise emit in a
47
- // single response.
43
+ // Kimi K2.7 (flagship) + K2.6 support 65K output per the BlockRun gateway
44
+ // model entry (max_output: 65536). Without this entry the default 16K cap
45
+ // left users with 4× headroom on the table for long-form coding outputs
46
+ // and dashboard scaffolds the model can otherwise emit in a single response.
47
+ 'moonshot/kimi-k2.7': 65_536,
48
48
  'moonshot/kimi-k2.6': 65_536,
49
49
  };
50
50
  /** Get max output tokens for a model */
@@ -233,6 +233,7 @@ const MODEL_CONTEXT_WINDOWS = {
233
233
  'xai/grok-4-1-fast-reasoning': 131_072,
234
234
  // Others
235
235
  'zai/glm-5.1': 200_000,
236
+ 'moonshot/kimi-k2.7': 256_000,
236
237
  'moonshot/kimi-k2.6': 256_000,
237
238
  'moonshot/kimi-k2.5': 128_000,
238
239
  'minimax/minimax-m3': 1_000_000,
@@ -113,7 +113,7 @@ export async function runVerification(history, handlers, client, config) {
113
113
  ];
114
114
  config.onEvent?.({ kind: 'text_delta', text: '\n*Verifying...*\n' });
115
115
  // Use agent-tested free model for verification.
116
- const verificationModel = 'nvidia/qwen3-coder-480b';
116
+ const verificationModel = 'nvidia/llama-4-maverick';
117
117
  try {
118
118
  // Simple single-turn verification call
119
119
  const response = await client.complete({
@@ -4,5 +4,6 @@
4
4
  */
5
5
  export interface SkillsCommandOptions {
6
6
  json?: boolean;
7
+ all?: boolean;
7
8
  }
8
9
  export declare function skillsCommand(action: string | undefined, arg: string | undefined, opts?: SkillsCommandOptions): Promise<void>;
@@ -3,7 +3,7 @@
3
3
  * during a session. Phase 1 of the skills MVP — bundled only.
4
4
  */
5
5
  import chalk from 'chalk';
6
- import { loadBundledSkills } from '../skills/bootstrap.js';
6
+ import { loadAllSkills } from '../skills/bootstrap.js';
7
7
  export async function skillsCommand(action, arg, opts = {}) {
8
8
  const sub = action ?? 'list';
9
9
  if (sub === 'list') {
@@ -19,8 +19,13 @@ export async function skillsCommand(action, arg, opts = {}) {
19
19
  process.exit(1);
20
20
  }
21
21
  function runList(opts) {
22
- const { registry, errors } = loadBundledSkills();
23
- const skills = registry.list();
22
+ const { registry, errors } = loadAllSkills(process.cwd());
23
+ const all = registry.list();
24
+ // Hidden skills (e.g. auto-generated learned skills) stay active for trigger
25
+ // matching and explicit `which` lookup, but are kept out of the default list.
26
+ // `--all` reveals them; `--json` always includes everything for tooling.
27
+ const skills = opts.json || opts.all ? all : all.filter((l) => !l.skill.hidden);
28
+ const hiddenCount = all.length - skills.length;
24
29
  if (opts.json) {
25
30
  process.stdout.write(JSON.stringify({
26
31
  skills: skills.map((l) => ({
@@ -32,6 +37,8 @@ function runList(opts) {
32
37
  costReceipt: l.skill.costReceipt ?? false,
33
38
  budgetCapUsd: l.skill.budgetCapUsd ?? null,
34
39
  disableModelInvocation: l.skill.disableModelInvocation ?? false,
40
+ hidden: l.skill.hidden ?? false,
41
+ autoGenerated: l.skill.autoGenerated ?? false,
35
42
  })),
36
43
  errors,
37
44
  shadowed: registry.shadowed().map((s) => ({
@@ -41,9 +48,12 @@ function runList(opts) {
41
48
  }, null, 2) + '\n');
42
49
  return;
43
50
  }
44
- if (skills.length === 0) {
51
+ if (skills.length === 0 && hiddenCount === 0) {
45
52
  console.log(chalk.dim('No skills loaded.'));
46
53
  }
54
+ else if (skills.length === 0) {
55
+ console.log(chalk.dim(`No visible skills. ${hiddenCount} hidden — run with --all to show.`));
56
+ }
47
57
  else {
48
58
  console.log(chalk.bold(`Skills (${skills.length})`));
49
59
  console.log('');
@@ -56,10 +66,16 @@ function runList(opts) {
56
66
  flags.push(`cap $${l.skill.budgetCapUsd.toFixed(2)}`);
57
67
  if (l.skill.disableModelInvocation)
58
68
  flags.push('manual-only');
69
+ if (l.skill.hidden)
70
+ flags.push('hidden');
59
71
  const flagStr = flags.length > 0 ? chalk.dim(` [${flags.join(', ')}]`) : '';
60
72
  const sourceTag = chalk.dim(`(${l.source})`);
61
73
  console.log(` ${chalk.cyan('/' + l.skill.name.padEnd(nameWidth))} ${l.skill.description}${flagStr} ${sourceTag}`);
62
74
  }
75
+ if (hiddenCount > 0) {
76
+ console.log('');
77
+ console.log(chalk.dim(` +${hiddenCount} hidden — run with --all to show.`));
78
+ }
63
79
  }
64
80
  const shadowed = registry.shadowed();
65
81
  if (shadowed.length > 0) {
@@ -83,7 +99,7 @@ function runWhich(name) {
83
99
  console.log(chalk.red('Usage: franklin skills which <name>'));
84
100
  process.exit(1);
85
101
  }
86
- const { registry } = loadBundledSkills();
102
+ const { registry } = loadAllSkills(process.cwd());
87
103
  const skill = registry.lookup(name);
88
104
  if (!skill) {
89
105
  console.log(chalk.red(`Skill not found: ${name}`));
@@ -41,7 +41,7 @@ export async function slackCommand(opts) {
41
41
  const config = loadConfig();
42
42
  const model = opts.model ||
43
43
  config['default-model'] ||
44
- 'nvidia/qwen3-coder-480b';
44
+ 'nvidia/llama-4-maverick';
45
45
  const workingDir = process.cwd();
46
46
  const systemInstructions = assembleInstructions(workingDir, model);
47
47
  // Connect MCP servers (Notion, etc.) so the bot exposes their tools — mirrors
@@ -159,7 +159,7 @@ async function runCommand(options) {
159
159
  const chain = loadChain();
160
160
  const apiUrl = API_URLS[chain];
161
161
  const appConfig = loadAppConfig();
162
- const model = options.model || appConfig['default-model'] || 'nvidia/qwen3-coder-480b';
162
+ const model = options.model || appConfig['default-model'] || 'nvidia/llama-4-maverick';
163
163
  console.log(chalk.dim(` Model: ${model}`));
164
164
  console.log('');
165
165
  let result;
@@ -44,7 +44,7 @@ export async function telegramCommand(opts) {
44
44
  // Model: --model flag > config default > free default.
45
45
  const model = opts.model ||
46
46
  config['default-model'] ||
47
- 'nvidia/qwen3-coder-480b';
47
+ 'nvidia/llama-4-maverick';
48
48
  const workingDir = process.cwd();
49
49
  const systemInstructions = assembleInstructions(workingDir, model);
50
50
  // Resume the most recent session tagged for THIS owner so a process
package/dist/index.js CHANGED
@@ -158,6 +158,7 @@ program
158
158
  .command('skills [action] [arg]')
159
159
  .description('Manage Franklin skills — list | which <name>')
160
160
  .option('--json', 'Output the skill list as JSON')
161
+ .option('--all', 'Include hidden (auto-generated) skills in the list')
161
162
  .action(async (action, arg, opts) => {
162
163
  const { skillsCommand } = await import('./commands/skills.js');
163
164
  await skillsCommand(action, arg, opts);
@@ -9,9 +9,8 @@ import { loadLearnings, mergeLearning, saveLearnings, loadSkills, saveSkill } fr
9
9
  // Free models for learning extraction — JSON extraction is simple enough.
10
10
  // Ordered by reliability: try the best free model first, fall back to others.
11
11
  const EXTRACTION_MODELS = [
12
- 'nvidia/qwen3-coder-480b', // Agent-tested free model; strong at JSON tasks
13
- 'nvidia/llama-4-maverick', // Agent-tested fallback
14
- 'nvidia/deepseek-v4-flash', // 1M-ctx fallback (was glm-4.7 — NVIDIA NIM hung 2026-06-07)
12
+ 'nvidia/llama-4-maverick', // Agent-tested free model; reliable for JSON tasks
13
+ 'nvidia/deepseek-v4-flash', // 1M-ctx fallback (qwen3-coder-480b EOL 2026-06-11)
15
14
  ];
16
15
  const VALID_CATEGORIES = new Set([
17
16
  'language', 'model_preference', 'tool_pattern', 'coding_style',
@@ -13,13 +13,34 @@ export declare function mergeLearning(existing: Learning[], newEntry: {
13
13
  }): Learning[];
14
14
  export declare function decayLearnings(learnings: Learning[]): Learning[];
15
15
  export declare function formatForPrompt(learnings: Learning[]): string;
16
- /** Load all skills from disk. */
16
+ /**
17
+ * One-time migration of legacy auto-extracted skills.
18
+ *
19
+ * Before the unified registry, learned skills were flat markdown files at
20
+ * `~/.blockrun/skills/<name>.md`. The new layout expects
21
+ * `~/.blockrun/skills/learned/<name>/SKILL.md`, and the user-source loader
22
+ * only reads `<dir>/SKILL.md` — so the old flat files would be silently
23
+ * orphaned on upgrade. This moves each one into the new layout (normalizing
24
+ * it through `saveSkill`, which adds `hidden`/`auto-generated`) and deletes
25
+ * the old file. Idempotent and cheap: returns immediately when there are no
26
+ * flat `.md` files left to migrate.
27
+ */
28
+ export declare function migrateLegacyLearnedSkills(): number;
29
+ /** Load all learned skills from `~/.blockrun/skills/learned/`. */
17
30
  export declare function loadSkills(): Skill[];
18
- /** Save a new skill to disk. */
31
+ /** Save a new auto-extracted skill to disk in unified SKILL.md format. */
19
32
  export declare function saveSkill(skill: Skill): void;
20
33
  /** Bump use count for a skill. */
21
34
  export declare function bumpSkillUse(skill: Skill): void;
22
- /** Find skills relevant to a user message, by trigger matching. */
35
+ /**
36
+ * Compat shim retained so older callers keep working while the rest of the
37
+ * codebase migrates to `src/skills/triggers.ts`. New code should NOT depend
38
+ * on this — it ignores `hidden` and `disableModelInvocation` flags.
39
+ */
23
40
  export declare function matchSkills(input: string, skills: Skill[]): Skill[];
24
- /** Format matched skills for system prompt injection. */
41
+ /**
42
+ * Compat shim. The new code path injects skills per-turn via
43
+ * `formatSkillHints` rather than baking them into the boot-time system
44
+ * prompt, so callers should not need this any more.
45
+ */
25
46
  export declare function formatSkillsForPrompt(skills: Skill[]): string;