@slatesvideo/shared 0.7.7 → 0.7.8

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 (121) hide show
  1. package/README.md +3 -6
  2. package/dist/analytics/events.d.ts +1 -1
  3. package/dist/analytics/events.js +7 -0
  4. package/dist/auth.d.ts +2 -0
  5. package/dist/auth.js +5 -0
  6. package/dist/clients/cloud.d.ts +2 -0
  7. package/dist/clients/cloud.js +5 -1
  8. package/dist/index.d.ts +7 -3
  9. package/dist/index.js +7 -3
  10. package/dist/manual/content.d.ts +1 -1
  11. package/dist/manual/content.js +1 -1
  12. package/dist/operations/index.d.ts +587 -161
  13. package/dist/operations/index.js +663 -57
  14. package/dist/operations/surface.d.ts +2 -2
  15. package/dist/operations/surface.js +18 -5
  16. package/dist/prompts/agent-doctrine.d.ts +12 -2
  17. package/dist/prompts/agent-doctrine.js +56 -28
  18. package/dist/prompts/banned-tokens.js +23 -13
  19. package/dist/prompts/brain.d.ts +29 -0
  20. package/dist/prompts/brain.js +72 -0
  21. package/dist/prompts/craft-cards.d.ts +15 -4
  22. package/dist/prompts/craft-cards.js +71 -9
  23. package/dist/prompts/generation-policy.d.ts +1 -1
  24. package/dist/prompts/guide-discovery.d.ts +6 -6
  25. package/dist/prompts/guide-retrieval.d.ts +7 -1
  26. package/dist/prompts/guide-retrieval.js +33 -5
  27. package/dist/prompts/partials.generated.js +1 -13
  28. package/dist/prompts/shot-grammar.d.ts +1 -1
  29. package/dist/prompts/shot-grammar.js +1 -1
  30. package/dist/skills/brain-check.d.ts +44 -0
  31. package/dist/skills/brain-check.js +172 -0
  32. package/dist/skills/content.d.ts +3 -0
  33. package/dist/skills/content.js +81 -44
  34. package/dist/skills/hyperframes-content.js +4 -4
  35. package/dist/skills/my-brain.d.ts +52 -0
  36. package/dist/skills/my-brain.js +218 -0
  37. package/dist/skills/served.d.ts +52 -0
  38. package/dist/skills/served.js +202 -0
  39. package/package.json +2 -4
  40. package/skills/hyperframes/NOTICE +19 -3
  41. package/skills/hyperframes/SLATES-MAPPING.md +1 -1
  42. package/skills/hyperframes/embedded-captions/CATALOG.md +3 -0
  43. package/skills/hyperframes/embedded-captions/SKILL.md +6 -6
  44. package/skills/hyperframes/embedded-captions/assets/fonts/char-widths.json +227 -1
  45. package/skills/hyperframes/embedded-captions/modes/standard/fonts/build-fonts-css.cjs +19 -2
  46. package/skills/hyperframes/embedded-captions/modes/standard/fonts/files/archivo-latin-wdth-italic.woff2 +0 -0
  47. package/skills/hyperframes/embedded-captions/modes/standard/fonts/files/archivo-latin-wdth-normal.woff2 +0 -0
  48. package/skills/hyperframes/embedded-captions/scripts/make-theme.cjs +438 -3
  49. package/skills/hyperframes/embedded-captions/scripts/make-theme.test.mjs +1 -0
  50. package/skills/hyperframes/embedded-captions/themes/README.md +26 -1
  51. package/skills/hyperframes/embedded-captions/themes/lesson.json +31 -0
  52. package/skills/slates-start-here.md +78 -0
  53. package/exports/slates-chatgpt-images/generated/SKILL.md +0 -113
  54. package/exports/slates-chatgpt-images/generated/slates-chatgpt-images.skill +0 -0
  55. package/exports/slates-prompt-builder/generated/SKILL.md +0 -71
  56. package/exports/slates-prompt-builder/generated/reference-character.md +0 -92
  57. package/exports/slates-prompt-builder/generated/reference-content-policy.md +0 -81
  58. package/exports/slates-prompt-builder/generated/reference-gpt-image-2-5.md +0 -191
  59. package/exports/slates-prompt-builder/generated/reference-kling.md +0 -295
  60. package/exports/slates-prompt-builder/generated/reference-nano-banana.md +0 -240
  61. package/exports/slates-prompt-builder/generated/reference-omni-flash.md +0 -97
  62. package/exports/slates-prompt-builder/generated/reference-seedance-2-5.md +0 -392
  63. package/exports/slates-prompt-builder/generated/reference-seedance.md +0 -441
  64. package/exports/slates-prompt-builder/generated/slates-prompt-builder-manifest.json +0 -133
  65. package/exports/slates-prompt-builder/generated/slates-prompt-builder.skill +0 -0
  66. package/skills/_partials/blender-action-curves.md +0 -24
  67. package/skills/_partials/cinematic-card.md +0 -8
  68. package/skills/_partials/decision-log.md +0 -1
  69. package/skills/_partials/image-defaults.md +0 -9
  70. package/skills/_partials/iteration-diagnosis.md +0 -5
  71. package/skills/_partials/living-performance.md +0 -22
  72. package/skills/_partials/model-routing.md +0 -35
  73. package/skills/_partials/references-read-literally.md +0 -11
  74. package/skills/_partials/seedance-25-timestamps.md +0 -34
  75. package/skills/_partials/sheet-tool-defaults.md +0 -6
  76. package/skills/_partials/still-gate.md +0 -3
  77. package/skills/_partials/thresholds.md +0 -19
  78. package/skills/slates-blocking-to-prompt.md +0 -279
  79. package/skills/slates-camera-language.md +0 -234
  80. package/skills/slates-captions.md +0 -81
  81. package/skills/slates-character-identity.md +0 -117
  82. package/skills/slates-chatgpt-images.md +0 -113
  83. package/skills/slates-cinematic-look.md +0 -237
  84. package/skills/slates-content-policy.md +0 -88
  85. package/skills/slates-cost-discipline.md +0 -150
  86. package/skills/slates-cuts.md +0 -46
  87. package/skills/slates-dialogue-blocking.md +0 -134
  88. package/skills/slates-direct-response-ad.md +0 -26
  89. package/skills/slates-edit-and-iterate.md +0 -76
  90. package/skills/slates-layer-brand-captions.md +0 -87
  91. package/skills/slates-layer-lower-third.md +0 -85
  92. package/skills/slates-layer-title.md +0 -82
  93. package/skills/slates-model-selection.md +0 -129
  94. package/skills/slates-motion.md +0 -57
  95. package/skills/slates-one-prompt-film.md +0 -38
  96. package/skills/slates-previs-blocking.md +0 -186
  97. package/skills/slates-project-organization.md +0 -42
  98. package/skills/slates-prompting-elevenlabs.md +0 -128
  99. package/skills/slates-prompting-flux-3.md +0 -157
  100. package/skills/slates-prompting-gpt-image-2-5.md +0 -196
  101. package/skills/slates-prompting-inworld-tts.md +0 -174
  102. package/skills/slates-prompting-kling-v3.md +0 -303
  103. package/skills/slates-prompting-lip-sync.md +0 -216
  104. package/skills/slates-prompting-ltx-2-5.md +0 -245
  105. package/skills/slates-prompting-minimax-h3.md +0 -383
  106. package/skills/slates-prompting-motion-transfer.md +0 -202
  107. package/skills/slates-prompting-nano-banana-2-1.md +0 -250
  108. package/skills/slates-prompting-omni-flash.md +0 -117
  109. package/skills/slates-prompting-seed-audio.md +0 -168
  110. package/skills/slates-prompting-seedance-2-5.md +0 -420
  111. package/skills/slates-prompting-seedance.md +0 -462
  112. package/skills/slates-prompting-seedream-5-lite.md +0 -122
  113. package/skills/slates-prompting-wan-3.md +0 -143
  114. package/skills/slates-restyle-from-blocking.md +0 -121
  115. package/skills/slates-script-craft.md +0 -45
  116. package/skills/slates-shot-variety.md +0 -24
  117. package/skills/slates-storyboard-from-script.md +0 -32
  118. package/skills/slates-style-prompting.md +0 -56
  119. package/skills/slates-transitions.md +0 -40
  120. package/skills/slates-ugc-influencer-ad.md +0 -32
  121. package/skills/slates-vision-feedback-loop.md +0 -118
@@ -16,8 +16,8 @@ export interface SurfaceOp {
16
16
  *
17
17
  * `openWorldHint` means "reaches something outside this system": every billable
18
18
  * op hits a provider, every Blender op hits a separate process over a socket,
19
- * and the registry ops may fetch from GitHub. Everything else touches only the
20
- * user's own workspace.
19
+ * the registry ops may fetch from GitHub, and the product intake ops fetch a
20
+ * web page. Everything else touches only the user's own workspace.
21
21
  */
22
22
  export declare function annotate(id: string, billable: boolean | undefined): OperationAnnotations;
23
23
  /**
@@ -85,13 +85,18 @@ const IDEMPOTENT_PREFIXES = [
85
85
  const startsWithAny = (id, prefixes) => prefixes.some((p) => id.startsWith(p));
86
86
  /** Ops that can fetch from the HyperFrames registry on GitHub: a listing, a block, a caption component. */
87
87
  const REGISTRY_IDS = new Set(['slates_list_motion_blocks', 'slates_add_html_clip', 'slates_add_captions']);
88
+ /**
89
+ * Ops that fetch a web address the user names: product intake (a store's page and its pictures) and a
90
+ * reference link (a Meta Ad Library page and the ad's video file, or a direct video link).
91
+ */
92
+ const WEB_PAGE_IDS = new Set(['slates_get_product_page', 'slates_import_product', 'slates_break_down_reference']);
88
93
  /**
89
94
  * Derive an op's four hints.
90
95
  *
91
96
  * `openWorldHint` means "reaches something outside this system": every billable
92
97
  * op hits a provider, every Blender op hits a separate process over a socket,
93
- * and the registry ops may fetch from GitHub. Everything else touches only the
94
- * user's own workspace.
98
+ * the registry ops may fetch from GitHub, and the product intake ops fetch a
99
+ * web page. Everything else touches only the user's own workspace.
95
100
  */
96
101
  export function annotate(id, billable) {
97
102
  const readOnlyHint = startsWithAny(id, READ_ONLY_PREFIXES);
@@ -100,7 +105,7 @@ export function annotate(id, billable) {
100
105
  // A read is never destructive, whatever the id looks like.
101
106
  destructiveHint: !readOnlyHint && DESTRUCTIVE_IDS.has(id),
102
107
  idempotentHint: readOnlyHint || startsWithAny(id, IDEMPOTENT_PREFIXES),
103
- openWorldHint: !!billable || id.startsWith('slates_blender_') || REGISTRY_IDS.has(id),
108
+ openWorldHint: !!billable || id.startsWith('slates_blender_') || REGISTRY_IDS.has(id) || WEB_PAGE_IDS.has(id),
104
109
  };
105
110
  }
106
111
  // ── 2. Tiers ────────────────────────────────────────────────────────────────
@@ -161,9 +166,10 @@ export const OPERATION_GROUPS = {
161
166
  script: ['slates_get_script_document', 'slates_update_script_document', 'slates_get_script_sections', 'slates_update_script_section', 'slates_get_script_suggestions', 'slates_update_script_suggestions', 'slates_get_script_uses', 'slates_preview_script_variation', 'slates_create_script_variation', 'slates_get_shot_inputs', 'slates_reuse_shot_take'],
162
167
  timeline: [
163
168
  'slates_list_timelines', 'slates_save_timeline', 'slates_export_cuts',
164
- 'slates_get_export_batch', 'slates_cancel_export_batch', 'slates_get_variant_grid',
169
+ 'slates_get_export_batch', 'slates_cancel_export_batch', 'slates_get_variant_grid', 'slates_get_recipe',
165
170
  'slates_reframe_clip', 'slates_get_reframe_report',
166
171
  'slates_get_timeline',
172
+ 'slates_get_timeline_loudness',
167
173
  'slates_add_clip_to_timeline',
168
174
  'slates_reorder_clips',
169
175
  'slates_remove_clip',
@@ -249,7 +255,7 @@ export function tierFor(id) {
249
255
  export const GROUP_SUMMARY = {
250
256
  library: 'folders, favorites, pins, the Library (user-named categories of saved references: characters, locations, products, looks) and styles, templates (list, export, import), exporting original asset files, moving and copying assets and Library items between projects, moving a project into the current projects folder, revealing files on disk',
251
257
  script: 'rich script documents, anchored sections and their saved versions, reusable passages, variations and take input history',
252
- timeline: 'named cuts and exporting several at once; the timeline (tracks, clips, markers, settings), text, picture and HTML motion layers, captions, video export and FCP7 XML export for DaVinci Resolve or Premiere, clip trimming',
258
+ timeline: 'named cuts and exporting several at once, what made an exported ad (its recipe ID); the timeline (tracks, clips, markers, settings), text, picture and HTML motion layers, captions, video export and FCP7 XML export for DaVinci Resolve or Premiere, clip trimming',
253
259
  admin: 'rename / delete / reorder for projects, characters, locations, looks, boards, scenes and frames; shot duplicate, split and merge',
254
260
  blender: 'the Blender previs bridge — scene inspection, bpy execution, API docs, grey-box render',
255
261
  };
@@ -307,6 +313,13 @@ const TASK_ALIASES = {
307
313
  slates_edit_image: 'photo picture',
308
314
  slates_use_pictures_as_first_frames: 'photo animate',
309
315
  slates_generate_audio: 'voiceover narration speech ambience sound effect',
316
+ slates_break_down_reference: 'remake recreate winning ad advert advertisement storyboard scene shot list link url meta facebook ad library',
317
+ slates_get_product_page: 'product page link url shop store shopify brand logo colours price',
318
+ slates_import_product: 'product page link url shop store shopify brand logo colours palette add library item',
319
+ slates_get_variants: 'ad variants hooks body end card slots combinations shared body seam grid matrix how many files missing takes price',
320
+ slates_edit_variant_slots: 'ad variants hook body end card slot alternative collapse clips shared body bed music',
321
+ slates_edit_variants: 'ad variants combinations hooks seam j-cut l-cut crossfade rebuild ab test',
322
+ slates_export_cuts: 'ad variants grid hooks body end card formats every combination batch files render all',
310
323
  };
311
324
  /** Rank exact task words by rarity across the current registry, returning at most ten. */
312
325
  export function searchTools(operations, query) {
@@ -19,9 +19,19 @@ export declare const WORKING_METHOD: ReadonlyArray<Record<AgentSurface, string>>
19
19
  export declare const HARD_RULES: ReadonlyArray<Record<AgentSurface, string>>;
20
20
  /**
21
21
  * The MCP server's `instructions`: the Essentials, ending on the pointer to the
22
- * full working method, then the every-request rules. The server adds only its version line
23
- * and the update notice (lockstep check 2).
22
+ * full working method, then the Director card, then the every-request rules. The server adds
23
+ * only its version line and the update notice (lockstep check 2).
24
24
  */
25
+ /**
26
+ * The router, sent once on an MCP connection that has not opened it: the server attaches this to the first
27
+ * result of a tool that spends nothing (never a billable op's, which reports a spend), another guide's answer
28
+ * included. The instructions say to start every job at the router, and the brain's craft eval
29
+ * (2026-10-25, 20 jobs on Opus) still saw 3 runs go straight to the tools and skip the job's playbook, the one
30
+ * that turned a script into shots with no shot sizes and no prices. A pointer to a guide is skipped; the fact
31
+ * in a result is read (the banned-token measurement, 13% against 94%). The desktop's Director needs none:
32
+ * its doctrine carries the router whole.
33
+ */
34
+ export declare const ROUTER_NOTICE: string;
25
35
  export declare function buildMcpInstructions(): string;
26
36
  /**
27
37
  * THE doctrine string for a surface. The desktop's whole system prompt and the
@@ -54,9 +54,10 @@
54
54
  // desktop RENDERER and must stay small and Node-free, and this module pulls in
55
55
  // the whole embedded SKILLS record. Root barrel only.
56
56
  // ============================================================
57
- import { SKILLS } from '../skills/content.js';
57
+ import { brainFiles, servedBrain } from '../skills/served.js';
58
58
  import { guideCatalog } from './guide-discovery.js';
59
- import { VIDEO_MODELS, AUDIO_MODELS, WORKING_METHOD_TOPIC } from '../operations/index.js';
59
+ import { BRAIN_ROUTER, DIRECTOR_CARD, ROUTER_BODY } from './brain.js';
60
+ import { VIDEO_MODELS, AUDIO_MODELS, WORKING_METHOD_TOPIC, CONNECT_FOR_BRAIN } from '../operations/index.js';
60
61
  /** A line that is identical on both surfaces. The default. */
61
62
  function both(text) {
62
63
  return { desktop: text, mcp: text };
@@ -67,7 +68,7 @@ function fork(desktop, mcp) {
67
68
  }
68
69
  /** Generated from the same validated metadata used by discovery and installation. */
69
70
  export function buildSkillIndex() {
70
- return guideCatalog(SKILLS).map(({ name, description }) => ({ name, description }));
71
+ return guideCatalog(brainFiles()).map(({ name, description }) => ({ name, description }));
71
72
  }
72
73
  // ── Preamble ───────────────────────────────────────────────────────
73
74
  // FORKED, and the MCP side is a SUMMARY THAT MUST FIT IN THE CUT. Claude Code
@@ -79,7 +80,7 @@ export function buildSkillIndex() {
79
80
  // pointer to the full method. mcp-instructions-smoke asserts these lines and
80
81
  // that pointer land inside the cut when UPDATE AVAILABLE follows the first
81
82
  // doctrine paragraph.
82
- const PREAMBLE = fork(`You are Slates Director — a production assistant living inside Slates, the AI video creation studio. Turn the user's vision into finished work using the optional Slates tools and relevant production craft. Choose the workflow for the brief; start from the user's existing material and bring results into their project or timeline when asked.`, `Turn the user's vision into finished work in Slates. Find craft with slates_get_prompting_guide(query: the brief). Tools generate real media and spend credits. Before generation, estimate every step, show the itemized total and wait for approval. Choose tools to fit the brief.
83
+ const PREAMBLE = fork(`You are Slates Director — a production assistant living inside Slates, the AI video creation studio. Turn the user's vision into finished work using the optional Slates tools and relevant production craft. Choose the workflow for the brief; start from the user's existing material and bring results into their project or timeline when asked.`, `Turn the user's vision into finished work in Slates. Start every job at slates_get_prompting_guide(topic: "${BRAIN_ROUTER}"). Tools generate real media and spend credits. Before generation, estimate every step, show the itemized total and wait for approval.
83
84
 
84
85
  ## Essentials
85
86
 
@@ -207,9 +208,26 @@ const MCP_EVERY_REQUEST = [
207
208
  ];
208
209
  /**
209
210
  * The MCP server's `instructions`: the Essentials, ending on the pointer to the
210
- * full working method, then the every-request rules. The server adds only its version line
211
- * and the update notice (lockstep check 2).
211
+ * full working method, then the Director card, then the every-request rules. The server adds
212
+ * only its version line and the update notice (lockstep check 2).
212
213
  */
214
+ /**
215
+ * The router, sent once on an MCP connection that has not opened it: the server attaches this to the first
216
+ * result of a tool that spends nothing (never a billable op's, which reports a spend), another guide's answer
217
+ * included. The instructions say to start every job at the router, and the brain's craft eval
218
+ * (2026-10-25, 20 jobs on Opus) still saw 3 runs go straight to the tools and skip the job's playbook, the one
219
+ * that turned a script into shots with no shot sizes and no prices. A pointer to a guide is skipped; the fact
220
+ * in a result is read (the banned-token measurement, 13% against 94%). The desktop's Director needs none:
221
+ * its doctrine carries the router whole.
222
+ */
223
+ export const ROUTER_NOTICE = `This session has not opened the router (${BRAIN_ROUTER}), so here it is, once. Find this job's row and read its playbook with slates_get_prompting_guide before you plan or build; a question about the app itself is answered from topic app-manual with a query, with no intake questions.
224
+
225
+ ${ROUTER_BODY}`;
226
+ /**
227
+ * Where the MCP working method points instead of carrying the router: ROUTER_NOTICE already sends the router once
228
+ * per connection, so a copy here was the same 4,000 characters twice for an agent that read both.
229
+ */
230
+ const MCP_ROUTER_POINTER = `The router names the playbook for each job, the question to ask first, the method to offer for each result and the rules every playbook links. It comes with your first result from a tool that spends nothing if you have not opened it; open it with slates_get_prompting_guide (topic: ${BRAIN_ROUTER}).`;
213
231
  export function buildMcpInstructions() {
214
232
  const pool = [...WORKING_METHOD, ...HARD_RULES].map((entry) => entry.mcp);
215
233
  const lines = MCP_EVERY_REQUEST.map((opener) => {
@@ -221,9 +239,17 @@ export function buildMcpInstructions() {
221
239
  // The pointer is the last Essentials bullet, not a closing section: a host
222
240
  // that cuts at 2,048 characters dropped the closing section, and the model
223
241
  // then said nothing pointed at the full method (2026-10-18 probe, Claude Code 2.1.293).
242
+ // The Director card comes straight after the Essentials: Claude Code keeps the
243
+ // first 4,096 characters (2,048 before v2.1.296), and behind the every-request
244
+ // rules the card started past character 6,000, so no Claude Code session saw how
245
+ // a job starts. mcp-instructions-smoke and lockstep check 2 assert where it ends.
224
246
  return `${PREAMBLE.mcp}
225
247
  - WORKING METHOD: the full method, hard rules (exact model ids, variety counts, Seed Audio length) and guide index: slates_get_prompting_guide(topic: "${WORKING_METHOD_TOPIC}"). Read it once a production workflow starts.
226
248
 
249
+ ## Start here
250
+
251
+ ${DIRECTOR_CARD}
252
+
227
253
  ## Every request
228
254
 
229
255
  ${lines.join('\n')}
@@ -243,28 +269,28 @@ ${MCP_FOOTER}`;
243
269
  * SLATES-AGENT-DOCTRINE-SSOT
244
270
  */
245
271
  export function buildAgentDoctrine({ surface }) {
246
- // COMPRESSED on purpose (2026-08-30). The full frontmatter descriptions were
247
- // 14,556 characters — 38% of the doctrine — and they are DISCOVERY blurbs,
248
- // written in Claude Code's "Use when X, or when Y" style for a fuzzy matcher
249
- // choosing among skills. Here the mapping is close to deterministic:
250
- // `resolveGuideTopic()` turns a model id into the right guide in code.
251
- //
252
- // So the per-model guides are listed as bare names (the name IS the
253
- // description) and everything else keeps its FIRST SENTENCE, which is the
254
- // part that says when to reach for it. The complete list with full
255
- // descriptions is one `slates_get_prompting_guide` call away.
256
- const entries = buildSkillIndex();
257
- const firstSentence = (d) => {
258
- const m = /^(.*?[.!?])(\s|$)/.exec(d.trim());
259
- return (m ? m[1] : d.trim()).slice(0, 180);
260
- };
261
- const perModel = entries.filter((s) => s.name.startsWith('slates-prompting-'));
262
- const rest = entries.filter((s) => !s.name.startsWith('slates-prompting-'));
263
- const skillIndex = rest.map((s) => `- ${s.name}: ${firstSentence(s.description)}`).join('\n') +
264
- `\n- PER-MODEL PROMPTING GUIDES — pass the model id, or the name: ` +
265
- perModel.map((s) => s.name).join(', ');
272
+ // THE GUIDE INDEX IS THE BRAIN'S ROUTER (2026-10-25). It used to be every
273
+ // skill's first sentence, a flat list the agent picked from by description
274
+ // and nothing linked. The router (slates-start-here) names one playbook per
275
+ // job, the question to ask first, and the rules the playbooks link; the brain
276
+ // lint proves every skill is reachable from it. The Director card (L0) opens
277
+ // the doctrine. Per-model guides stay bare names: `resolveGuideTopic()` maps
278
+ // a model id to its guide in code, and the guide gate makes the agent read
279
+ // one before that model's first generation. A guide past the account's tier is
280
+ // still named (it answers with its notice); with no brain on this machine yet (a
281
+ // first launch, before connecting) the line says so rather than listing nothing.
282
+ const perModel = [...new Set([...buildSkillIndex(), ...servedBrain().locked].map((s) => s.name))]
283
+ .filter((name) => name.startsWith('slates-prompting-'))
284
+ .sort();
285
+ const perModelIndex = perModel.length
286
+ ? `PER-MODEL PROMPTING GUIDES — pass the model id, or the name: ${perModel.join(', ')}`
287
+ : `PER-MODEL PROMPTING GUIDES load once this machine is connected to the user's Slates account. ${CONNECT_FOR_BRAIN}.`;
266
288
  return `${PREAMBLE[surface]}
267
289
 
290
+ ## Start here
291
+
292
+ ${DIRECTOR_CARD}
293
+
268
294
  ## How you work
269
295
 
270
296
  ${WORKING_METHOD.map((s) => s[surface]).join('\n')}
@@ -273,9 +299,11 @@ ${WORKING_METHOD.map((s) => s[surface]).join('\n')}
273
299
 
274
300
  ${HARD_RULES.map((r) => r[surface]).join('\n')}
275
301
 
276
- ## Guide index (load via slates_get_prompting_guide)
302
+ ## Guide index: the router (${BRAIN_ROUTER}; load each guide via slates_get_prompting_guide)
303
+
304
+ ${surface === 'mcp' ? MCP_ROUTER_POINTER : ROUTER_BODY}
277
305
 
278
- ${skillIndex}
306
+ ${perModelIndex}
279
307
  ${surface === 'mcp' ? `\n${MCP_FOOTER}` : ''}`;
280
308
  }
281
309
  //# sourceMappingURL=agent-doctrine.js.map
@@ -13,7 +13,7 @@
13
13
  * the refusal to calls of that shape. A line whose rule depends on context the
14
14
  * call cannot show ("after the first introduction") stays a warning only.
15
15
  */
16
- import { SKILLS } from '../skills/content.js';
16
+ import { brainFiles, servedBrain } from '../skills/served.js';
17
17
  /** The right way, written next to the wrong one: never a token. */
18
18
  const POSITIVE_BEFORE = [/\(\s*say\s*$/i, /\bthan\s*$/i, /\bas in:?\s*$/i];
19
19
  const POSITIVE_AFTER = /^\)\s*passed\b/i;
@@ -47,23 +47,33 @@ function parseBannedBlock(body, skill, scope) {
47
47
  }
48
48
  return out;
49
49
  }
50
- const bySkill = new Map();
51
- for (const [skill, content] of Object.entries(SKILLS)) {
52
- const fences = [...content.matchAll(/<!--\s*@banned:start\s*-->([\s\S]*?)<!--\s*@banned:end\s*-->/g)];
53
- if (!fences.length)
54
- continue;
55
- const scope = /nano-banana|gpt-image|flux|seedream/.test(skill) ? 'image' : 'video';
56
- const tokens = fences.flatMap((f) => parseBannedBlock(f[1], skill, scope))
57
- .filter((t, i, all) => all.findIndex((o) => o.token === t.token) === i);
58
- if (!tokens.length)
59
- throw new Error(`${skill}: @banned block contains no tokens`);
60
- bySkill.set(skill, tokens);
50
+ // Read from the brain this process holds (skills/served.ts) and rebuilt when it changes: the model guides that
51
+ // carry the @banned blocks are served by the account's tier.
52
+ let built;
53
+ function bannedBySkill() {
54
+ const brain = servedBrain();
55
+ if (built?.brain === brain)
56
+ return built.bySkill;
57
+ const bySkill = new Map();
58
+ for (const [skill, content] of Object.entries(brainFiles())) {
59
+ const fences = [...content.matchAll(/<!--\s*@banned:start\s*-->([\s\S]*?)<!--\s*@banned:end\s*-->/g)];
60
+ if (!fences.length)
61
+ continue;
62
+ const scope = /nano-banana|gpt-image|flux|seedream/.test(skill) ? 'image' : 'video';
63
+ const tokens = fences.flatMap((f) => parseBannedBlock(f[1], skill, scope))
64
+ .filter((t, i, all) => all.findIndex((o) => o.token === t.token) === i);
65
+ if (!tokens.length)
66
+ throw new Error(`${skill}: @banned block contains no tokens`);
67
+ bySkill.set(skill, tokens);
68
+ }
69
+ built = { brain, bySkill };
70
+ return bySkill;
61
71
  }
62
72
  /** Compatibility exports: there is no cross-model blacklist. */
63
73
  export const BANNED_PROMPT_TOKENS = Object.freeze([]);
64
74
  export function bannedTokensFor(_scope) { return BANNED_PROMPT_TOKENS; }
65
75
  export function describeBannedTokens(_scope) { return ''; }
66
- export function bannedTokensForSkill(skill) { return bySkill.get(skill) ?? []; }
76
+ export function bannedTokensForSkill(skill) { return bannedBySkill().get(skill) ?? []; }
67
77
  const matchers = new Map();
68
78
  function matcherFor(token) {
69
79
  let matcher = matchers.get(token);
@@ -0,0 +1,29 @@
1
+ export declare const BRAIN_ROUTER = "slates-start-here";
2
+ /** Every other name that opens the router (resolveGuideTopic); none of them may name a My brain file. */
3
+ export declare const ROUTER_ALIASES: readonly string[];
4
+ /**
5
+ * The guide topic that serves the user's own brain: what an agent reads of it before the router
6
+ * (skills/my-brain.ts, myBrainPreload). Its own topic, not a router alias; no My brain file takes the name.
7
+ */
8
+ export declare const MY_BRAIN_TOPIC = "my-brain";
9
+ /**
10
+ * The playbooks (L2), pinned in scripts/brain-shape.json. The Director card says to follow a playbook's steps,
11
+ * so the guide op serves each one whole at its default depth (guide-retrieval.ts).
12
+ */
13
+ export declare const PLAYBOOKS: ReadonlySet<string>;
14
+ /** L0: how every job starts. */
15
+ export declare const DIRECTOR_CARD: string;
16
+ /** L1: the router without its frontmatter, title or Director card. */
17
+ export declare const ROUTER_BODY: string;
18
+ /** A file's operative summary, or null when it carries none (a model guide's summary is its card). */
19
+ export declare function operativeSummary(content: string): string | null;
20
+ export declare const OVERLAY_LEAD = "From the user's own brain (My brain): their rules for this guide, which win where they differ. The shared guide follows them.";
21
+ export declare const OVERLAY_SHARED_LEAD = "The shared guide of this name, under their rules:";
22
+ /** The guide served when a user's file `theirs` shares its name with the bundled `shared`. */
23
+ export declare function overlayGuide(theirs: string, shared: string): string;
24
+ /** The two halves of an overlaid guide, or null when `content` is one file. */
25
+ export declare function splitOverlay(content: string): {
26
+ theirs: string;
27
+ shared: string;
28
+ } | null;
29
+ //# sourceMappingURL=brain.d.ts.map
@@ -0,0 +1,72 @@
1
+ // ============================================================
2
+ // THE BRAIN'S LAYERS, extracted from the skills (second-brain
3
+ // plans/2026-10-25-slates-brain.md § The shape).
4
+ //
5
+ // L0 the Director card: between the @director markers in slates-start-here,
6
+ // always loaded (Director's system prompt, the MCP server's instructions)
7
+ // L1 the router: the rest of slates-start-here, one row per job
8
+ // L2 playbooks, L3 rules and model guides: each file leads with an
9
+ // operative summary (@operative), or its craft card (@card) on a model guide
10
+ //
11
+ // Nothing here is written by hand: each layer is cut from its markdown, the same
12
+ // way craft-cards.ts cuts cards, so an edit to the skill is the only edit.
13
+ // scripts/brain-lint.mjs holds the shape (caps, summaries, reachability).
14
+ //
15
+ // Root barrel only, like agent-doctrine.ts: it pulls in the whole SKILLS record.
16
+ // ============================================================
17
+ import { BRAIN_SHAPE, SKILLS } from '../skills/content.js';
18
+ export const BRAIN_ROUTER = 'slates-start-here';
19
+ /** Every other name that opens the router (resolveGuideTopic); none of them may name a My brain file. */
20
+ export const ROUTER_ALIASES = ['start-here', 'start here', 'start', 'router', 'brain', 'director-card', 'playbooks'];
21
+ /**
22
+ * The guide topic that serves the user's own brain: what an agent reads of it before the router
23
+ * (skills/my-brain.ts, myBrainPreload). Its own topic, not a router alias; no My brain file takes the name.
24
+ */
25
+ export const MY_BRAIN_TOPIC = 'my-brain';
26
+ /**
27
+ * The playbooks (L2), pinned in scripts/brain-shape.json. The Director card says to follow a playbook's steps,
28
+ * so the guide op serves each one whole at its default depth (guide-retrieval.ts).
29
+ */
30
+ export const PLAYBOOKS = new Set(BRAIN_SHAPE.layers.playbook ?? []);
31
+ const DIRECTOR_RE = /<!--\s*@director:start\s*-->([\s\S]*?)<!--\s*@director:end\s*-->/;
32
+ const OPERATIVE_RE = /<!--\s*@operative:start\s*-->([\s\S]*?)<!--\s*@operative:end\s*-->/;
33
+ const COMMENT_RE = /<!--[\s\S]*?-->/g;
34
+ const FRONTMATTER_RE = /^?---\r?\n[\s\S]*?\r?\n---\r?\n/;
35
+ const router = SKILLS[BRAIN_ROUTER];
36
+ if (!router)
37
+ throw new Error(`[brain] ${BRAIN_ROUTER}.md is missing from the embedded skills`);
38
+ const card = DIRECTOR_RE.exec(router);
39
+ if (!card)
40
+ throw new Error(`[brain] ${BRAIN_ROUTER}.md has no @director block`);
41
+ /** L0: how every job starts. */
42
+ export const DIRECTOR_CARD = card[1].replace(COMMENT_RE, '').trim();
43
+ /** L1: the router without its frontmatter, title or Director card. */
44
+ export const ROUTER_BODY = router
45
+ .replace(FRONTMATTER_RE, '')
46
+ .replace(DIRECTOR_RE, '')
47
+ .replace(COMMENT_RE, '')
48
+ .replace(/^\s*# [^\n]*\n/, '')
49
+ .trim();
50
+ /** A file's operative summary, or null when it carries none (a model guide's summary is its card). */
51
+ export function operativeSummary(content) {
52
+ const m = OPERATIVE_RE.exec(content);
53
+ return m ? m[1].replace(COMMENT_RE, '').trim() : null;
54
+ }
55
+ // A My brain file named like a bundled skill adds to it rather than replacing it, so a later fix to the shared
56
+ // guide still reaches the user (skills/my-brain.ts). The served guide is one markdown string: the shared
57
+ // frontmatter (the guide still does the shared one's job), their file, then the shared body after a marker that
58
+ // only code reads. Every reader strips comments, so an agent sees the two lead lines and never the marker.
59
+ const OVERLAY_MARK = '<!-- @my-brain:shared -->';
60
+ export const OVERLAY_LEAD = "From the user's own brain (My brain): their rules for this guide, which win where they differ. The shared guide follows them.";
61
+ export const OVERLAY_SHARED_LEAD = 'The shared guide of this name, under their rules:';
62
+ /** The guide served when a user's file `theirs` shares its name with the bundled `shared`. */
63
+ export function overlayGuide(theirs, shared) {
64
+ const frontmatter = FRONTMATTER_RE.exec(shared)?.[0] ?? '';
65
+ return `${frontmatter}\n${OVERLAY_LEAD}\n\n${theirs.replace(FRONTMATTER_RE, '').trim()}\n\n${OVERLAY_MARK}\n${OVERLAY_SHARED_LEAD}\n\n${shared.replace(FRONTMATTER_RE, '').trim()}\n`;
66
+ }
67
+ /** The two halves of an overlaid guide, or null when `content` is one file. */
68
+ export function splitOverlay(content) {
69
+ const at = content.indexOf(OVERLAY_MARK);
70
+ return at < 0 ? null : { theirs: content.slice(0, at), shared: content.slice(at + OVERLAY_MARK.length) };
71
+ }
72
+ //# sourceMappingURL=brain.js.map
@@ -4,17 +4,28 @@
4
4
  * A card is a CARD. The largest skill is 5,736 words and loading it whole is
5
5
  * exactly the cost this mechanism exists to avoid — if a card needs more than
6
6
  * this, the extra belongs in the body of the skill, which is one
7
- * `slates_get_prompting_guide` call away. Asserted at load, so an over-long
8
- * card fails the build rather than quietly inflating every estimate result.
7
+ * `slates_get_prompting_guide` call away. check:agent-surface § 8 fails the build on an over-long card; a served
8
+ * brain arrives at run time, so there an over-long card is skipped and named (oversizedCraftCards), never thrown.
9
9
  */
10
10
  export declare const CRAFT_CARD_CEILING = 2400;
11
- /** Every card, keyed by skill name. Built once at load; integrity asserted. */
11
+ /** The guides in the held brain whose card is over the ceiling and so rides no estimate result. */
12
+ export declare function oversizedCraftCards(): readonly string[];
13
+ /** A live view of cards(), so `CRAFT_CARDS[name]`, `in` and `Object.keys` follow the served brain. */
12
14
  export declare const CRAFT_CARDS: Readonly<Record<string, string>>;
13
15
  /** The card for a skill, or null when that skill carries none. */
14
16
  export declare function craftCard(skill: string): string | null;
17
+ /**
18
+ * The card inside this content: the bundled card when the content is the bundled skill, else the content's own.
19
+ * A My brain file laid over a model guide (brain.ts, overlayGuide) gives its own card first, as the rules that
20
+ * win, then the shared card. An oversized card in a user's file reads as none, so the guide falls back to its
21
+ * summary instead of throwing.
22
+ */
23
+ export declare function craftCardOf(skill: string, content: string): string | null;
15
24
  /**
16
25
  * The card as it appears in an op RESULT: the body, plus one line naming where
17
26
  * the rest lives so the agent knows the card is a summary and not the guide.
27
+ * `content` is the skill as this user's brain serves it (brainSkills().skills),
28
+ * so a card from their My brain rides; without it, the bundled card.
18
29
  */
19
- export declare function describeCraftCard(skill: string): string;
30
+ export declare function describeCraftCard(skill: string, content?: string): string;
20
31
  //# sourceMappingURL=craft-cards.d.ts.map
@@ -30,15 +30,16 @@
30
30
  // downstream is a second copy of the skill that drifts from it. Edit the skill;
31
31
  // the card follows on the next build.
32
32
  // ============================================================
33
- import { SKILLS } from '../skills/content.js';
33
+ import { brainFiles, servedBrain } from '../skills/served.js';
34
+ import { splitOverlay } from './brain.js';
34
35
  /**
35
36
  * Hard ceiling per card, in characters.
36
37
  *
37
38
  * A card is a CARD. The largest skill is 5,736 words and loading it whole is
38
39
  * exactly the cost this mechanism exists to avoid — if a card needs more than
39
40
  * this, the extra belongs in the body of the skill, which is one
40
- * `slates_get_prompting_guide` call away. Asserted at load, so an over-long
41
- * card fails the build rather than quietly inflating every estimate result.
41
+ * `slates_get_prompting_guide` call away. check:agent-surface § 8 fails the build on an over-long card; a served
42
+ * brain arrives at run time, so there an over-long card is skipped and named (oversizedCraftCards), never thrown.
42
43
  */
43
44
  export const CRAFT_CARD_CEILING = 2400;
44
45
  const CARD_FENCE_RE = /<!--\s*@card:start\s*-->([\s\S]*?)<!--\s*@card:end\s*-->/g;
@@ -61,20 +62,81 @@ function extractCard(skill, content) {
61
62
  }
62
63
  return body;
63
64
  }
64
- /** Every card, keyed by skill name. Built once at load; integrity asserted. */
65
- export const CRAFT_CARDS = Object.freeze(Object.fromEntries(Object.entries(SKILLS)
66
- .map(([skill, content]) => [skill, extractCard(skill, content)])
67
- .filter((entry) => entry[1] !== null)));
65
+ /**
66
+ * Every card, keyed by skill name, from the brain this process holds (skills/served.ts): rebuilt when that brain
67
+ * changes, integrity asserted on each build. Model guides are served by tier, so without a brain there are none.
68
+ */
69
+ let built;
70
+ function build() {
71
+ const brain = servedBrain();
72
+ if (built?.brain !== brain) {
73
+ const cards = {};
74
+ const oversized = [];
75
+ for (const [skill, content] of Object.entries(brainFiles())) {
76
+ try {
77
+ const card = extractCard(skill, content);
78
+ if (card !== null)
79
+ cards[skill] = card;
80
+ }
81
+ catch (error) {
82
+ // One over-long card must not take down every estimate: that guide goes without a card, and says why.
83
+ oversized.push(skill);
84
+ console.error(String(error.message));
85
+ }
86
+ }
87
+ built = { brain, cards: Object.freeze(cards), oversized: Object.freeze(oversized) };
88
+ }
89
+ return built;
90
+ }
91
+ const cards = () => build().cards;
92
+ /** The guides in the held brain whose card is over the ceiling and so rides no estimate result. */
93
+ export function oversizedCraftCards() {
94
+ return build().oversized;
95
+ }
96
+ /** A live view of cards(), so `CRAFT_CARDS[name]`, `in` and `Object.keys` follow the served brain. */
97
+ export const CRAFT_CARDS = new Proxy({}, {
98
+ get: (_, key) => (typeof key === 'string' ? cards()[key] : undefined),
99
+ has: (_, key) => typeof key === 'string' && Object.hasOwn(cards(), key),
100
+ ownKeys: () => Reflect.ownKeys(cards()),
101
+ getOwnPropertyDescriptor: (_, key) => typeof key === 'string' && Object.hasOwn(cards(), key) ? { value: cards()[key], enumerable: true, configurable: true, writable: false } : undefined,
102
+ set: () => false,
103
+ });
68
104
  /** The card for a skill, or null when that skill carries none. */
69
105
  export function craftCard(skill) {
70
106
  return CRAFT_CARDS[skill] ?? null;
71
107
  }
108
+ /**
109
+ * The card inside this content: the bundled card when the content is the bundled skill, else the content's own.
110
+ * A My brain file laid over a model guide (brain.ts, overlayGuide) gives its own card first, as the rules that
111
+ * win, then the shared card. An oversized card in a user's file reads as none, so the guide falls back to its
112
+ * summary instead of throwing.
113
+ */
114
+ export function craftCardOf(skill, content) {
115
+ if (brainFiles()[skill] === content)
116
+ return craftCard(skill);
117
+ const overlay = splitOverlay(content);
118
+ if (overlay) {
119
+ const own = craftCardOf(skill, overlay.theirs);
120
+ const shared = craftCard(skill) ?? craftCardOf(skill, overlay.shared);
121
+ if (!own || !shared)
122
+ return own ?? shared;
123
+ return `Their card (My brain), which wins where they differ:\n${own}\n\nThe shared card:\n${shared}`;
124
+ }
125
+ try {
126
+ return extractCard(skill, content);
127
+ }
128
+ catch {
129
+ return null;
130
+ }
131
+ }
72
132
  /**
73
133
  * The card as it appears in an op RESULT: the body, plus one line naming where
74
134
  * the rest lives so the agent knows the card is a summary and not the guide.
135
+ * `content` is the skill as this user's brain serves it (brainSkills().skills),
136
+ * so a card from their My brain rides; without it, the bundled card.
75
137
  */
76
- export function describeCraftCard(skill) {
77
- const card = craftCard(skill);
138
+ export function describeCraftCard(skill, content) {
139
+ const card = content === undefined ? craftCard(skill) : craftCardOf(skill, content);
78
140
  if (!card)
79
141
  return '';
80
142
  return `${card}\n\nFull guide (examples, failure modes, sources): slates_get_prompting_guide({topic: "${skill}", depth: "full"}); use query for one section.`;
@@ -2,7 +2,7 @@
2
2
  * This is NOT a model capability or provider batch limit. Desktop mirror is
3
3
  * generated by slate/scripts/sync-generation-policy.mjs; never edit it there. */
4
4
  export declare const IMAGE_QUANTITIES: readonly [1, 2, 3, 4, 5, 6, 7, 8, 9, 10];
5
- export declare const MAX_IMAGE_VARIATIONS: 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10;
5
+ export declare const MAX_IMAGE_VARIATIONS: 9 | 3 | 1 | 4 | 5 | 2 | 6 | 10 | 8 | 7;
6
6
  export type ImageQuantity = typeof IMAGE_QUANTITIES[number];
7
7
  export declare const clampImageQuantity: (count?: number) => ImageQuantity;
8
8
  /** Default saved-recipe framing, shared by composer restore, quote and dispatch. */
@@ -2,8 +2,8 @@ export interface GuideCatalogEntry {
2
2
  name: string;
3
3
  description: string;
4
4
  tier: 'free' | 'paid';
5
- /** The motion engine's own skills (`skills/hyperframes.ts`): they carry the craft, Slates' guides direct. */
6
- source?: 'motion';
5
+ /** The motion engine's own skills (`skills/hyperframes.ts`), or the user's own My brain (`skills/my-brain.ts`). */
6
+ source?: 'motion' | 'my-brain';
7
7
  /** What ranking reads when `description` is a listing summary. */
8
8
  searchText?: string;
9
9
  }
@@ -21,15 +21,15 @@ export declare function discoverGuides(entries: readonly GuideCatalogEntry[], sk
21
21
  name: string;
22
22
  description: string;
23
23
  tier: "free" | "paid";
24
- /** The motion engine's own skills (`skills/hyperframes.ts`): they carry the craft, Slates' guides direct. */
25
- source?: "motion";
24
+ /** The motion engine's own skills (`skills/hyperframes.ts`), or the user's own My brain (`skills/my-brain.ts`). */
25
+ source?: "motion" | "my-brain";
26
26
  }[];
27
27
  rest: {
28
28
  name: string;
29
29
  description: string;
30
30
  tier: "free" | "paid";
31
- /** The motion engine's own skills (`skills/hyperframes.ts`): they carry the craft, Slates' guides direct. */
32
- source?: "motion";
31
+ /** The motion engine's own skills (`skills/hyperframes.ts`), or the user's own My brain (`skills/my-brain.ts`). */
32
+ source?: "motion" | "my-brain";
33
33
  }[];
34
34
  };
35
35
  //# sourceMappingURL=guide-discovery.d.ts.map
@@ -4,6 +4,12 @@ export declare function guideSections(content: string): Array<{
4
4
  title: string;
5
5
  body: string;
6
6
  }>;
7
+ /**
8
+ * The depth a request is served at. The router, the index of the brain, and every playbook, whose steps the
9
+ * Director card says to follow (a summary of steps is not the steps), are served whole at the default depth;
10
+ * rules and model guides stay at their card.
11
+ */
12
+ export declare function servedDepth(skill: string, depth: GuideDepth, query?: string): GuideDepth;
7
13
  /** Bounded retrieval. A missing card never silently expands to the full guide. */
8
- export declare function retrieveGuide(skill: string, content: string, depth: GuideDepth, query?: string): string;
14
+ export declare function retrieveGuide(skill: string, content: string, requested: GuideDepth, query?: string): string;
9
15
  //# sourceMappingURL=guide-retrieval.d.ts.map