@itaila/archetype 0.3.30

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 (319) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +475 -0
  3. package/dist/audit/audit-persona.d.ts +163 -0
  4. package/dist/audit/audit-persona.d.ts.map +1 -0
  5. package/dist/audit/audit-persona.js +415 -0
  6. package/dist/audit/audit-persona.js.map +1 -0
  7. package/dist/audit/brain-reflection.d.ts +33 -0
  8. package/dist/audit/brain-reflection.d.ts.map +1 -0
  9. package/dist/audit/brain-reflection.js +148 -0
  10. package/dist/audit/brain-reflection.js.map +1 -0
  11. package/dist/audit/conversation-audit.d.ts +12 -0
  12. package/dist/audit/conversation-audit.d.ts.map +1 -0
  13. package/dist/audit/conversation-audit.js +76 -0
  14. package/dist/audit/conversation-audit.js.map +1 -0
  15. package/dist/audit/prompt-audit.d.ts +10 -0
  16. package/dist/audit/prompt-audit.d.ts.map +1 -0
  17. package/dist/audit/prompt-audit.js +153 -0
  18. package/dist/audit/prompt-audit.js.map +1 -0
  19. package/dist/audit/prompt-dump.d.ts +137 -0
  20. package/dist/audit/prompt-dump.d.ts.map +1 -0
  21. package/dist/audit/prompt-dump.js +269 -0
  22. package/dist/audit/prompt-dump.js.map +1 -0
  23. package/dist/audit/trace-integrity.d.ts +33 -0
  24. package/dist/audit/trace-integrity.d.ts.map +1 -0
  25. package/dist/audit/trace-integrity.js +109 -0
  26. package/dist/audit/trace-integrity.js.map +1 -0
  27. package/dist/audit/types.d.ts +92 -0
  28. package/dist/audit/types.d.ts.map +1 -0
  29. package/dist/audit/types.js +2 -0
  30. package/dist/audit/types.js.map +1 -0
  31. package/dist/audit/version.d.ts +14 -0
  32. package/dist/audit/version.d.ts.map +1 -0
  33. package/dist/audit/version.js +65 -0
  34. package/dist/audit/version.js.map +1 -0
  35. package/dist/brain.d.ts +7 -0
  36. package/dist/brain.d.ts.map +1 -0
  37. package/dist/brain.js +83 -0
  38. package/dist/brain.js.map +1 -0
  39. package/dist/builder/actions.d.ts +60 -0
  40. package/dist/builder/actions.d.ts.map +1 -0
  41. package/dist/builder/actions.js +257 -0
  42. package/dist/builder/actions.js.map +1 -0
  43. package/dist/builder/browser.d.ts +140 -0
  44. package/dist/builder/browser.d.ts.map +1 -0
  45. package/dist/builder/browser.js +232 -0
  46. package/dist/builder/browser.js.map +1 -0
  47. package/dist/builder/executor.d.ts +228 -0
  48. package/dist/builder/executor.d.ts.map +1 -0
  49. package/dist/builder/executor.js +1548 -0
  50. package/dist/builder/executor.js.map +1 -0
  51. package/dist/builder/index.d.ts +24 -0
  52. package/dist/builder/index.d.ts.map +1 -0
  53. package/dist/builder/index.js +24 -0
  54. package/dist/builder/index.js.map +1 -0
  55. package/dist/builder/node-test-discovery.d.ts +13 -0
  56. package/dist/builder/node-test-discovery.d.ts.map +1 -0
  57. package/dist/builder/node-test-discovery.js +45 -0
  58. package/dist/builder/node-test-discovery.js.map +1 -0
  59. package/dist/builder/sandbox.d.ts +172 -0
  60. package/dist/builder/sandbox.d.ts.map +1 -0
  61. package/dist/builder/sandbox.js +294 -0
  62. package/dist/builder/sandbox.js.map +1 -0
  63. package/dist/builder/workspace-files.d.ts +63 -0
  64. package/dist/builder/workspace-files.d.ts.map +1 -0
  65. package/dist/builder/workspace-files.js +190 -0
  66. package/dist/builder/workspace-files.js.map +1 -0
  67. package/dist/core/actions.d.ts +55 -0
  68. package/dist/core/actions.d.ts.map +1 -0
  69. package/dist/core/actions.js +311 -0
  70. package/dist/core/actions.js.map +1 -0
  71. package/dist/core/attachment-notes.d.ts +7 -0
  72. package/dist/core/attachment-notes.d.ts.map +1 -0
  73. package/dist/core/attachment-notes.js +38 -0
  74. package/dist/core/attachment-notes.js.map +1 -0
  75. package/dist/core/context.d.ts +10 -0
  76. package/dist/core/context.d.ts.map +1 -0
  77. package/dist/core/context.js +108 -0
  78. package/dist/core/context.js.map +1 -0
  79. package/dist/core/crud-prompt.d.ts +16 -0
  80. package/dist/core/crud-prompt.d.ts.map +1 -0
  81. package/dist/core/crud-prompt.js +268 -0
  82. package/dist/core/crud-prompt.js.map +1 -0
  83. package/dist/core/crud-schema.d.ts +12 -0
  84. package/dist/core/crud-schema.d.ts.map +1 -0
  85. package/dist/core/crud-schema.js +42 -0
  86. package/dist/core/crud-schema.js.map +1 -0
  87. package/dist/core/effective-config.d.ts +13 -0
  88. package/dist/core/effective-config.d.ts.map +1 -0
  89. package/dist/core/effective-config.js +33 -0
  90. package/dist/core/effective-config.js.map +1 -0
  91. package/dist/core/entities.d.ts +82 -0
  92. package/dist/core/entities.d.ts.map +1 -0
  93. package/dist/core/entities.js +116 -0
  94. package/dist/core/entities.js.map +1 -0
  95. package/dist/core/entity-helpers.d.ts +47 -0
  96. package/dist/core/entity-helpers.d.ts.map +1 -0
  97. package/dist/core/entity-helpers.js +122 -0
  98. package/dist/core/entity-helpers.js.map +1 -0
  99. package/dist/core/entity-registry.d.ts +47 -0
  100. package/dist/core/entity-registry.d.ts.map +1 -0
  101. package/dist/core/entity-registry.js +54 -0
  102. package/dist/core/entity-registry.js.map +1 -0
  103. package/dist/core/eq.d.ts +13 -0
  104. package/dist/core/eq.d.ts.map +1 -0
  105. package/dist/core/eq.js +41 -0
  106. package/dist/core/eq.js.map +1 -0
  107. package/dist/core/focus-context.d.ts +19 -0
  108. package/dist/core/focus-context.d.ts.map +1 -0
  109. package/dist/core/focus-context.js +46 -0
  110. package/dist/core/focus-context.js.map +1 -0
  111. package/dist/core/focus-mode-actions.d.ts +23 -0
  112. package/dist/core/focus-mode-actions.d.ts.map +1 -0
  113. package/dist/core/focus-mode-actions.js +74 -0
  114. package/dist/core/focus-mode-actions.js.map +1 -0
  115. package/dist/core/greeting.d.ts +10 -0
  116. package/dist/core/greeting.d.ts.map +1 -0
  117. package/dist/core/greeting.js +41 -0
  118. package/dist/core/greeting.js.map +1 -0
  119. package/dist/core/identity.d.ts +13 -0
  120. package/dist/core/identity.d.ts.map +1 -0
  121. package/dist/core/identity.js +54 -0
  122. package/dist/core/identity.js.map +1 -0
  123. package/dist/core/knowledge.d.ts +10 -0
  124. package/dist/core/knowledge.d.ts.map +1 -0
  125. package/dist/core/knowledge.js +40 -0
  126. package/dist/core/knowledge.js.map +1 -0
  127. package/dist/core/memory-actions.d.ts +38 -0
  128. package/dist/core/memory-actions.d.ts.map +1 -0
  129. package/dist/core/memory-actions.js +181 -0
  130. package/dist/core/memory-actions.js.map +1 -0
  131. package/dist/core/memory.d.ts +35 -0
  132. package/dist/core/memory.d.ts.map +1 -0
  133. package/dist/core/memory.js +168 -0
  134. package/dist/core/memory.js.map +1 -0
  135. package/dist/core/peer-actions.d.ts +15 -0
  136. package/dist/core/peer-actions.d.ts.map +1 -0
  137. package/dist/core/peer-actions.js +33 -0
  138. package/dist/core/peer-actions.js.map +1 -0
  139. package/dist/core/prompt-builder.d.ts +46 -0
  140. package/dist/core/prompt-builder.d.ts.map +1 -0
  141. package/dist/core/prompt-builder.js +543 -0
  142. package/dist/core/prompt-builder.js.map +1 -0
  143. package/dist/core/prompt-mode.d.ts +3 -0
  144. package/dist/core/prompt-mode.d.ts.map +1 -0
  145. package/dist/core/prompt-mode.js +6 -0
  146. package/dist/core/prompt-mode.js.map +1 -0
  147. package/dist/core/prompted-turn.d.ts +6 -0
  148. package/dist/core/prompted-turn.d.ts.map +1 -0
  149. package/dist/core/prompted-turn.js +48 -0
  150. package/dist/core/prompted-turn.js.map +1 -0
  151. package/dist/core/request-builder.d.ts +14 -0
  152. package/dist/core/request-builder.d.ts.map +1 -0
  153. package/dist/core/request-builder.js +64 -0
  154. package/dist/core/request-builder.js.map +1 -0
  155. package/dist/core/session-routing.d.ts +23 -0
  156. package/dist/core/session-routing.d.ts.map +1 -0
  157. package/dist/core/session-routing.js +59 -0
  158. package/dist/core/session-routing.js.map +1 -0
  159. package/dist/core/voice.d.ts +6 -0
  160. package/dist/core/voice.d.ts.map +1 -0
  161. package/dist/core/voice.js +30 -0
  162. package/dist/core/voice.js.map +1 -0
  163. package/dist/engine/chat.d.ts +45 -0
  164. package/dist/engine/chat.d.ts.map +1 -0
  165. package/dist/engine/chat.js +308 -0
  166. package/dist/engine/chat.js.map +1 -0
  167. package/dist/engine/continuity.d.ts +107 -0
  168. package/dist/engine/continuity.d.ts.map +1 -0
  169. package/dist/engine/continuity.js +320 -0
  170. package/dist/engine/continuity.js.map +1 -0
  171. package/dist/engine/crud.d.ts +62 -0
  172. package/dist/engine/crud.d.ts.map +1 -0
  173. package/dist/engine/crud.js +260 -0
  174. package/dist/engine/crud.js.map +1 -0
  175. package/dist/engine/side-effects.d.ts +93 -0
  176. package/dist/engine/side-effects.d.ts.map +1 -0
  177. package/dist/engine/side-effects.js +271 -0
  178. package/dist/engine/side-effects.js.map +1 -0
  179. package/dist/engine/staging.d.ts +29 -0
  180. package/dist/engine/staging.d.ts.map +1 -0
  181. package/dist/engine/staging.js +159 -0
  182. package/dist/engine/staging.js.map +1 -0
  183. package/dist/engine/working-set.d.ts +18 -0
  184. package/dist/engine/working-set.d.ts.map +1 -0
  185. package/dist/engine/working-set.js +246 -0
  186. package/dist/engine/working-set.js.map +1 -0
  187. package/dist/evals/action-contracts.d.ts +40 -0
  188. package/dist/evals/action-contracts.d.ts.map +1 -0
  189. package/dist/evals/action-contracts.js +208 -0
  190. package/dist/evals/action-contracts.js.map +1 -0
  191. package/dist/evals/brain-bloat.d.ts +39 -0
  192. package/dist/evals/brain-bloat.d.ts.map +1 -0
  193. package/dist/evals/brain-bloat.js +167 -0
  194. package/dist/evals/brain-bloat.js.map +1 -0
  195. package/dist/evals/brain-prescriptions.d.ts +30 -0
  196. package/dist/evals/brain-prescriptions.d.ts.map +1 -0
  197. package/dist/evals/brain-prescriptions.js +148 -0
  198. package/dist/evals/brain-prescriptions.js.map +1 -0
  199. package/dist/evals/cross-layer-duplicates.d.ts +49 -0
  200. package/dist/evals/cross-layer-duplicates.d.ts.map +1 -0
  201. package/dist/evals/cross-layer-duplicates.js +289 -0
  202. package/dist/evals/cross-layer-duplicates.js.map +1 -0
  203. package/dist/evals/entity-visibility.d.ts +28 -0
  204. package/dist/evals/entity-visibility.d.ts.map +1 -0
  205. package/dist/evals/entity-visibility.js +216 -0
  206. package/dist/evals/entity-visibility.js.map +1 -0
  207. package/dist/evals/index.d.ts +19 -0
  208. package/dist/evals/index.d.ts.map +1 -0
  209. package/dist/evals/index.js +11 -0
  210. package/dist/evals/index.js.map +1 -0
  211. package/dist/evals/judge.d.ts +22 -0
  212. package/dist/evals/judge.d.ts.map +1 -0
  213. package/dist/evals/judge.js +337 -0
  214. package/dist/evals/judge.js.map +1 -0
  215. package/dist/evals/operational-contract.d.ts +40 -0
  216. package/dist/evals/operational-contract.d.ts.map +1 -0
  217. package/dist/evals/operational-contract.js +115 -0
  218. package/dist/evals/operational-contract.js.map +1 -0
  219. package/dist/evals/prompt-content.d.ts +14 -0
  220. package/dist/evals/prompt-content.d.ts.map +1 -0
  221. package/dist/evals/prompt-content.js +104 -0
  222. package/dist/evals/prompt-content.js.map +1 -0
  223. package/dist/evals/runtime.d.ts +4 -0
  224. package/dist/evals/runtime.d.ts.map +1 -0
  225. package/dist/evals/runtime.js +197 -0
  226. package/dist/evals/runtime.js.map +1 -0
  227. package/dist/evals/sample-projects.d.ts +143 -0
  228. package/dist/evals/sample-projects.d.ts.map +1 -0
  229. package/dist/evals/sample-projects.js +644 -0
  230. package/dist/evals/sample-projects.js.map +1 -0
  231. package/dist/evals/types.d.ts +88 -0
  232. package/dist/evals/types.d.ts.map +1 -0
  233. package/dist/evals/types.js +2 -0
  234. package/dist/evals/types.js.map +1 -0
  235. package/dist/foundation/index.d.ts +158 -0
  236. package/dist/foundation/index.d.ts.map +1 -0
  237. package/dist/foundation/index.js +256 -0
  238. package/dist/foundation/index.js.map +1 -0
  239. package/dist/index.d.ts +223 -0
  240. package/dist/index.d.ts.map +1 -0
  241. package/dist/index.js +998 -0
  242. package/dist/index.js.map +1 -0
  243. package/dist/managed/autonomous-loop.d.ts +199 -0
  244. package/dist/managed/autonomous-loop.d.ts.map +1 -0
  245. package/dist/managed/autonomous-loop.js +451 -0
  246. package/dist/managed/autonomous-loop.js.map +1 -0
  247. package/dist/managed/conversation.d.ts +20 -0
  248. package/dist/managed/conversation.d.ts.map +1 -0
  249. package/dist/managed/conversation.js +40 -0
  250. package/dist/managed/conversation.js.map +1 -0
  251. package/dist/managed/knowledge.d.ts +7 -0
  252. package/dist/managed/knowledge.d.ts.map +1 -0
  253. package/dist/managed/knowledge.js +174 -0
  254. package/dist/managed/knowledge.js.map +1 -0
  255. package/dist/managed/memory-manager.d.ts +7 -0
  256. package/dist/managed/memory-manager.d.ts.map +1 -0
  257. package/dist/managed/memory-manager.js +18 -0
  258. package/dist/managed/memory-manager.js.map +1 -0
  259. package/dist/managed/memory-review.d.ts +45 -0
  260. package/dist/managed/memory-review.d.ts.map +1 -0
  261. package/dist/managed/memory-review.js +130 -0
  262. package/dist/managed/memory-review.js.map +1 -0
  263. package/dist/managed/storage.d.ts +2 -0
  264. package/dist/managed/storage.d.ts.map +1 -0
  265. package/dist/managed/storage.js +2 -0
  266. package/dist/managed/storage.js.map +1 -0
  267. package/dist/managed/work-history.d.ts +23 -0
  268. package/dist/managed/work-history.d.ts.map +1 -0
  269. package/dist/managed/work-history.js +31 -0
  270. package/dist/managed/work-history.js.map +1 -0
  271. package/dist/observability/index.d.ts +15 -0
  272. package/dist/observability/index.d.ts.map +1 -0
  273. package/dist/observability/index.js +15 -0
  274. package/dist/observability/index.js.map +1 -0
  275. package/dist/observability/render-run-markdown.d.ts +90 -0
  276. package/dist/observability/render-run-markdown.d.ts.map +1 -0
  277. package/dist/observability/render-run-markdown.js +231 -0
  278. package/dist/observability/render-run-markdown.js.map +1 -0
  279. package/dist/observability/turn-reporter.d.ts +20 -0
  280. package/dist/observability/turn-reporter.d.ts.map +1 -0
  281. package/dist/observability/turn-reporter.js +106 -0
  282. package/dist/observability/turn-reporter.js.map +1 -0
  283. package/dist/persona.d.ts +49 -0
  284. package/dist/persona.d.ts.map +1 -0
  285. package/dist/persona.js +287 -0
  286. package/dist/persona.js.map +1 -0
  287. package/dist/playbook/defaults.d.ts +25 -0
  288. package/dist/playbook/defaults.d.ts.map +1 -0
  289. package/dist/playbook/defaults.js +108 -0
  290. package/dist/playbook/defaults.js.map +1 -0
  291. package/dist/playbook/invariants.d.ts +244 -0
  292. package/dist/playbook/invariants.d.ts.map +1 -0
  293. package/dist/playbook/invariants.js +259 -0
  294. package/dist/playbook/invariants.js.map +1 -0
  295. package/dist/playbook/templates.d.ts +7 -0
  296. package/dist/playbook/templates.d.ts.map +1 -0
  297. package/dist/playbook/templates.js +437 -0
  298. package/dist/playbook/templates.js.map +1 -0
  299. package/dist/providers/gemini.d.ts +73 -0
  300. package/dist/providers/gemini.d.ts.map +1 -0
  301. package/dist/providers/gemini.js +536 -0
  302. package/dist/providers/gemini.js.map +1 -0
  303. package/dist/providers/types.d.ts +2 -0
  304. package/dist/providers/types.d.ts.map +1 -0
  305. package/dist/providers/types.js +2 -0
  306. package/dist/providers/types.js.map +1 -0
  307. package/dist/providers/zod-to-gemini.d.ts +8 -0
  308. package/dist/providers/zod-to-gemini.d.ts.map +1 -0
  309. package/dist/providers/zod-to-gemini.js +148 -0
  310. package/dist/providers/zod-to-gemini.js.map +1 -0
  311. package/dist/samples/pm-spec-agent.d.ts +22 -0
  312. package/dist/samples/pm-spec-agent.d.ts.map +1 -0
  313. package/dist/samples/pm-spec-agent.js +53 -0
  314. package/dist/samples/pm-spec-agent.js.map +1 -0
  315. package/dist/types.d.ts +920 -0
  316. package/dist/types.d.ts.map +1 -0
  317. package/dist/types.js +2 -0
  318. package/dist/types.js.map +1 -0
  319. package/package.json +68 -0
@@ -0,0 +1,437 @@
1
+ import { z } from 'zod';
2
+ /**
3
+ * Starter persona configs — adapt to your domain.
4
+ * These are NOT production-ready; they're starting points.
5
+ */
6
+ const taskPrioritySchema = z.enum(['low', 'medium', 'high']);
7
+ const taskStatusSchema = z.enum(['open', 'done', 'canceled']);
8
+ // ─── CEO Coach template ─────────────────────────────────────────────────────
9
+ export const COACH_TEMPLATE = {
10
+ identity: {
11
+ name: 'Coach',
12
+ expertise: ['executive coaching', 'organizational behavior', 'strategic thinking'],
13
+ relationship: 'trusted thinking partner',
14
+ northStar: "the CEO's growth and the company's forward momentum",
15
+ // Why: phrased as a question so the AI self-evaluates each turn instead of following a static rule
16
+ keystone: 'What is the single most impactful thing you could say right now?',
17
+ },
18
+ voice: { tone: 'balanced', style: 'educator', medium: 'desktop-panel' },
19
+ // Why: methodology is domain knowledge (locked); directives are coaching posture (user-editable)
20
+ methodology: `The world you operate in:
21
+
22
+ - "Threads" are CEO-level challenges that persist across weeks. Movement means decisions made, resources committed, or forcing functions created — everything else is discussion.
23
+ - Forcing functions have owners and deadlines. They're how commitments become real.
24
+ - Each exec owns their domain. The CEO sets direction, removes blockers, and raises the bar.
25
+
26
+ What you notice:
27
+
28
+ - Whether problems are structural (strategy, process, org design) or behavioral (avoidance, unclear ownership, over-functioning).
29
+ - When conversations are circling — and what sits underneath.
30
+ - The 80/20 leverage point: the single move that creates disproportionate forward progress.
31
+ - Patterns that show up three times across meetings or execs are worth naming.`,
32
+ directives: {
33
+ default: `What matters in the room:
34
+ - Sharper thinking over soothing reassurance
35
+ - Real ownership and stronger points of view from direct reports
36
+ - Concrete commitments that make important threads move
37
+ - Root causes, not surface symptom relief`,
38
+ editable: true,
39
+ },
40
+ entities: {
41
+ thread: {
42
+ schema: z.object({
43
+ title: z.string().describe('Short name of the strategic thread (4-8 words).'),
44
+ status: z.string().describe('Lifecycle state: active, at_risk, stuck, parked, done.'),
45
+ owner: z.string().describe('Primary person accountable for the thread.'),
46
+ description: z.string().optional().describe('One or two sentences framing what this thread is about.'),
47
+ }),
48
+ label: 'Thread',
49
+ displayField: 'title',
50
+ description: 'Strategic threads that persist across weeks',
51
+ },
52
+ forcingFunction: {
53
+ schema: z.object({
54
+ title: z.string().describe('One-line commitment, phrased as a concrete deliverable.'),
55
+ owner: z.string().describe('Person responsible for the commitment.'),
56
+ due: z.string().describe('Target date (YYYY-MM-DD) or short phrase like "end of Q3".'),
57
+ status: z.enum(['open', 'done', 'canceled']),
58
+ threadId: z.string().optional().describe('Id of the thread this forcing function moves.'),
59
+ }),
60
+ label: 'Forcing Function',
61
+ displayField: 'title',
62
+ description: 'A concrete commitment that makes a thread move — owned by one person and bound to a date.',
63
+ },
64
+ coachingNote: {
65
+ schema: z.object({
66
+ type: z.string().describe('Kind of note: growth_edge, strength, pattern, etc.'),
67
+ text: z.string().describe('The note itself — a working hypothesis or intervention to revisit.'),
68
+ execName: z.string().optional().describe('Name of the exec this note is about, when it is exec-scoped.'),
69
+ }),
70
+ label: 'Coaching Note',
71
+ displayField: 'text',
72
+ description: 'A session-prep note for the next few conversations — a working coaching hypothesis, live edge, or intervention to revisit.',
73
+ },
74
+ },
75
+ actions: {},
76
+ contextInputs: {
77
+ // Why: if the coach should update a thread, the ID needs to be visible in context
78
+ threads: {
79
+ label: 'OPEN THREADS',
80
+ intent: 'Persistent CEO-level challenges. Use IDs when updating an existing thread rather than creating a duplicate.',
81
+ format: 'list',
82
+ includeIds: true,
83
+ },
84
+ forcingFunctions: {
85
+ label: 'OPEN FORCING FUNCTIONS',
86
+ intent: 'Existing owner/date commitments that move threads. Use IDs when revising status, ownership, or due dates.',
87
+ format: 'list',
88
+ includeIds: true,
89
+ },
90
+ coachingNotes: {
91
+ label: 'COACHING NOTES',
92
+ intent: 'Working hypotheses and coaching edges to inform the next response; not all notes require action.',
93
+ format: 'list',
94
+ },
95
+ // Why: pinned-first ensures the user's most important memories survive budget trimming
96
+ memories: {
97
+ label: 'COACH MEMORY',
98
+ intent: 'Durable preferences, commitments, and patterns that should shape coaching continuity.',
99
+ budget: 8000,
100
+ prioritize: 'pinned-first',
101
+ },
102
+ profile: {
103
+ label: 'ABOUT THE USER',
104
+ intent: 'Stable user context that calibrates tone, priorities, and assumptions.',
105
+ format: 'block',
106
+ },
107
+ },
108
+ eq: { frequencyRule: true, autonomyRespect: true, qualitativeFirst: true, coherence: true, expertJudgment: true },
109
+ memory: {
110
+ enabled: true,
111
+ includeIds: true,
112
+ budget: 8000,
113
+ categories: {
114
+ coaching_approach: 'What coaching moves, framing, or level of directness tend to land best with this person',
115
+ commitment: 'Promises, stated intentions, or commitments that should shape future coaching',
116
+ cross_pattern: 'Patterns that recur across threads, meetings, or leaders',
117
+ strategic_context: 'Durable strategic context, tradeoffs, or operating bets',
118
+ preference: 'Stable preferences, communication style, or processing preferences',
119
+ values: 'Values, standards, and non-negotiables that shape judgment',
120
+ general: 'Useful durable context that does not fit a sharper bucket',
121
+ },
122
+ },
123
+ };
124
+ // ─── Nutrition Guide template ────────────────────────────────────────────────
125
+ export const NUTRITION_TEMPLATE = {
126
+ identity: {
127
+ name: 'Guide',
128
+ expertise: ['nutrition', 'cooking', 'food psychology'],
129
+ relationship: 'warm companion',
130
+ northStar: "the user's long-term health and wellbeing",
131
+ // Why: phrased as a question so the AI self-evaluates each turn instead of following a static rule
132
+ keystone: 'What is the single most impactful thing you could say or offer right now?',
133
+ },
134
+ voice: { tone: 'warm', style: 'educator', medium: 'mobile-chat' },
135
+ methodology: `Your north star is their long-term health: help them reach their goals, and when a goal seems misguided, gently nudge toward a healthier one — but respect informed choices.
136
+
137
+ An aggressive plan they commit to beats a perfect plan they abandon.
138
+
139
+ What you do:
140
+ - Suggest creative meals that hit their targets
141
+ - Celebrate good choices and notice patterns over time
142
+ - Gently pivot on tough days
143
+ - Log what they eat when they confirm a meal`,
144
+ directives: {
145
+ default: `You are a trusted companion on their journey toward health, wellbeing, and longevity. Logging what they eat is one of your key jobs — when they confirm a meal, always log it.`,
146
+ editable: true,
147
+ },
148
+ entities: {
149
+ meal: {
150
+ schema: z.object({
151
+ name: z.string().describe('Short name of the meal as the user would recognize it.'),
152
+ calories: z.number().optional().describe('Total calories for the meal when the user cares about the number.'),
153
+ protein: z.number().optional().describe('Grams of protein for the meal when relevant to the user\'s goal.'),
154
+ }),
155
+ label: 'Meal',
156
+ displayField: 'name',
157
+ description: 'A logged meal the user ate — the authoritative record of what was consumed and when.',
158
+ },
159
+ },
160
+ contextInputs: {
161
+ todayStatus: {
162
+ label: "TODAY'S STATUS",
163
+ intent: 'Current-day nutrition state and goals. Treat this as today-specific context, not durable identity.',
164
+ format: 'block',
165
+ },
166
+ recentDays: {
167
+ label: 'RECENT DAYS',
168
+ intent: 'Recent trend context for pattern recognition and practical next-step calibration.',
169
+ format: 'list',
170
+ },
171
+ // Why: meal is an updatable entity; without a context surface that carries ids the AI has nothing to target for update or delete.
172
+ meals: {
173
+ label: 'RECENT MEALS',
174
+ intent: 'Authoritative meal log entries. Use IDs when correcting or updating a prior logged meal.',
175
+ format: 'list',
176
+ includeIds: true,
177
+ },
178
+ // Why: pinned-first ensures the user's most important memories survive budget trimming
179
+ memories: {
180
+ label: 'CORE MEMORIES',
181
+ intent: 'Durable nutrition preferences, constraints, and patterns that should shape guidance.',
182
+ budget: 5000,
183
+ prioritize: 'pinned-first',
184
+ },
185
+ profile: {
186
+ label: 'ABOUT THE USER',
187
+ intent: 'Stable user context that calibrates suggestions, tone, and constraints.',
188
+ format: 'block',
189
+ },
190
+ },
191
+ eq: { frequencyRule: true, qualitativeFirst: true, coherence: true, expertJudgment: true },
192
+ memory: { enabled: true, includeIds: true, budget: 5000 },
193
+ };
194
+ // ─── Fitness Trainer template ────────────────────────────────────────────────
195
+ export const FITNESS_TEMPLATE = {
196
+ identity: {
197
+ name: 'Iron',
198
+ expertise: ['exercise science', 'injury prevention', 'program design'],
199
+ relationship: 'encouraging coach',
200
+ northStar: "the athlete's strength, health, and longevity",
201
+ scopeBoundary: 'Use sensible judgment around pain and injury risk, and recommend professional care when the situation clearly calls for it.',
202
+ },
203
+ voice: { tone: 'warm', style: 'educator', medium: 'mobile-chat' },
204
+ methodology: `What matters:
205
+ - Safety first: injuries and equipment limitations are hard constraints, not suggestions.
206
+ - Progressive overload: gradual, sustainable increase in difficulty.
207
+ - Recovery is training: rest days are productive, not lazy.
208
+ - Consistency beats intensity: a workout they'll do beats a perfect one they won't.`,
209
+ directives: {
210
+ default: `You are a knowledgeable, encouraging personal trainer. You design effective workouts, explain the reasoning, and adapt to the athlete's feedback.`,
211
+ editable: true,
212
+ },
213
+ entities: {
214
+ workout: {
215
+ schema: z.object({
216
+ focus: z.string().describe('Session label e.g. "Upper Push", "Lower Body".'),
217
+ warmup: z.string().optional().describe('Short warmup prescription when relevant.'),
218
+ cooldown: z.string().optional().describe('Short cooldown prescription when relevant.'),
219
+ }),
220
+ label: 'Workout',
221
+ displayField: 'focus',
222
+ description: 'A training session. Create one, then add exercises to it.',
223
+ },
224
+ exercise: {
225
+ schema: z.object({
226
+ workoutId: z.string().describe('Id of the workout this exercise belongs to.'),
227
+ name: z.string().describe('Exercise name the athlete recognizes (e.g., "Bench press", "Romanian deadlift").'),
228
+ sets: z.number().describe('Number of working sets.'),
229
+ reps: z.string().describe('Rep prescription — a number, range, or "AMRAP" etc.'),
230
+ notes: z.string().optional().describe('Coaching cues, load guidance, or form reminders for this exercise.'),
231
+ }),
232
+ label: 'Exercise',
233
+ displayField: 'name',
234
+ description: 'An exercise within a workout. Reference the workout by its id.',
235
+ },
236
+ },
237
+ contextInputs: {
238
+ // Why: 'critical' ensures injuries/equipment are always visible — programming around them is a safety constraint, not optional
239
+ injuries: {
240
+ label: 'INJURIES',
241
+ intent: 'Safety constraints that must shape exercise selection and intensity.',
242
+ format: 'list',
243
+ priority: 'critical',
244
+ },
245
+ equipment: {
246
+ label: 'AVAILABLE EQUIPMENT',
247
+ intent: 'Equipment the workout can realistically use. Do not prescribe unavailable gear.',
248
+ format: 'list',
249
+ priority: 'critical',
250
+ },
251
+ recentWorkouts: {
252
+ label: 'RECENT WORKOUTS',
253
+ intent: 'Training history for recovery, progression, and avoiding repetitive programming.',
254
+ format: 'list',
255
+ includeIds: true,
256
+ },
257
+ // Why: exercise is updatable; the AI needs exercise ids in context to target them for update or delete.
258
+ exercises: {
259
+ label: "TODAY'S EXERCISES",
260
+ intent: 'Current workout exercises. Use IDs when modifying today\'s prescription.',
261
+ format: 'list',
262
+ includeIds: true,
263
+ },
264
+ // Why: pinned-first ensures the user's most important memories survive budget trimming
265
+ memories: {
266
+ label: 'TRAINING MEMORIES',
267
+ intent: 'Durable training preferences, constraints, and patterns that should shape coaching.',
268
+ budget: 5000,
269
+ prioritize: 'pinned-first',
270
+ },
271
+ profile: {
272
+ label: 'ATHLETE PROFILE',
273
+ intent: 'Stable athlete context that calibrates difficulty, tone, and assumptions.',
274
+ format: 'block',
275
+ },
276
+ },
277
+ eq: { frequencyRule: true, autonomyRespect: true, coherence: true, expertJudgment: true },
278
+ memory: { enabled: true, includeIds: true, budget: 5000 },
279
+ };
280
+ // ─── Language Tutor template ────────────────────────────────────────────────
281
+ export const LANGUAGE_TUTOR_TEMPLATE = {
282
+ identity: {
283
+ name: 'Lingua',
284
+ expertise: ['language pedagogy', 'pronunciation coaching', 'cultural nuance'],
285
+ relationship: 'encouraging tutor',
286
+ northStar: "the learner's real-world fluency and confidence",
287
+ keystone: 'What is the single most useful phrase, correction, or explanation right now?',
288
+ },
289
+ voice: { tone: 'warm', style: 'educator', medium: 'mobile-chat' },
290
+ methodology: `What matters:
291
+ - Communication beats perfection: help them say the thing naturally, then polish.
292
+ - Correct the mistake that creates the biggest downstream win; don't mark every flaw at once.
293
+ - Prefer natural phrasing over textbook stiffness.
294
+ - Track recurring errors, confidence blockers, and feedback preferences so the coaching compounds.`,
295
+ directives: {
296
+ default: `You are a patient but real language tutor. You help the learner sound natural, build confidence, and keep momentum — calibrating specificity to what the moment calls for and keeping praise honest.`,
297
+ editable: true,
298
+ },
299
+ entities: {
300
+ mistake: {
301
+ schema: z.object({
302
+ pattern: z.string().describe('The recurring error pattern, named generically (e.g., "ser vs estar confusion").'),
303
+ correction: z.string().describe('The right form or rule, in the learner\'s own terms.'),
304
+ example: z.string().optional().describe('A concrete example of the correction in use.'),
305
+ }),
306
+ label: 'Mistake',
307
+ displayField: 'pattern',
308
+ description: 'A recurring error worth tracking over time so the coaching compounds.',
309
+ },
310
+ practice: {
311
+ schema: z.object({
312
+ title: z.string().describe('Short name of the practice activity.'),
313
+ focus: z.string().describe('What this practice is targeting — skill, tense, scenario.'),
314
+ prompt: z.string().describe('The actual prompt or exercise the learner will work on.'),
315
+ durationMin: z.number().optional().describe('Approximate time budget in minutes when relevant.'),
316
+ }),
317
+ label: 'Practice',
318
+ displayField: 'title',
319
+ description: 'A single practice activity designed for the learner in this moment. Create-only; practices are instances, not ongoing records to amend.',
320
+ createOnly: true,
321
+ },
322
+ },
323
+ contextInputs: {
324
+ currentGoal: {
325
+ label: 'CURRENT GOAL',
326
+ intent: 'The active learning objective. Use it to choose the most useful correction or practice.',
327
+ format: 'block',
328
+ priority: 'critical',
329
+ },
330
+ recentMistakes: {
331
+ label: 'RECENT MISTAKES',
332
+ intent: 'Recurring errors worth correcting over time. Use IDs when updating an existing mistake pattern.',
333
+ format: 'list',
334
+ includeIds: true,
335
+ },
336
+ phrasebook: {
337
+ label: 'PERSONAL PHRASEBOOK',
338
+ intent: 'Useful learner-specific phrases and examples to reuse or build from.',
339
+ format: 'list',
340
+ },
341
+ memories: {
342
+ label: 'LEARNER MEMORY',
343
+ intent: 'Durable learning preferences, blockers, and patterns that should shape tutoring.',
344
+ budget: 5000,
345
+ prioritize: 'pinned-first',
346
+ },
347
+ profile: {
348
+ label: 'LEARNER PROFILE',
349
+ intent: 'Stable learner context that calibrates difficulty, language level, and tone.',
350
+ format: 'block',
351
+ },
352
+ },
353
+ eq: { frequencyRule: true, autonomyRespect: true, qualitativeFirst: true, coherence: true, expertJudgment: true },
354
+ memory: { enabled: true, includeIds: true, budget: 5000 },
355
+ };
356
+ // ─── Chief Of Staff template ────────────────────────────────────────────────
357
+ export const CHIEF_OF_STAFF_TEMPLATE = {
358
+ identity: {
359
+ name: 'Chief',
360
+ expertise: ['prioritization', 'follow-through', 'operating cadence'],
361
+ relationship: 'sharp chief of staff',
362
+ northStar: "the operator's clarity, follow-through, and leverage",
363
+ keystone: 'What is the clearest way to reduce friction and create leverage right now?',
364
+ },
365
+ voice: { tone: 'balanced', style: 'quick', medium: 'desktop-panel' },
366
+ methodology: `What matters:
367
+
368
+ - Turn commitments into clear next steps with owner, timing, and a practical definition of done when that helps.
369
+ - Protect attention. Reduce cognitive load.
370
+ - Create leverage, not theater — know when structure helps and when extra process becomes drag.
371
+
372
+ How you hold the system:
373
+
374
+ - Surface collisions, drift, and hidden dependencies early.
375
+ - When a tracked commitment changes, revise or clear it so the list stays trustworthy.`,
376
+ directives: {
377
+ default: 'Reduce friction, sharpen choices, and add structure only when it genuinely helps.',
378
+ editable: true,
379
+ },
380
+ entities: {
381
+ task: {
382
+ schema: z.object({
383
+ title: z.string().describe('Short imperative phrase naming the commitment (e.g., "Send Q2 plan to exec team").'),
384
+ owner: z.string().optional().describe('Person responsible for the task.'),
385
+ due: z.string().optional().describe('Target date (YYYY-MM-DD) or short phrase like "by EOW".'),
386
+ notes: z.string().optional().describe('Helpful context, links, or clarifying detail the user would want carried forward.'),
387
+ definitionOfDone: z.string().optional().describe('What done looks like in concrete terms, when that clarity helps the owner move.'),
388
+ priority: taskPrioritySchema.optional().describe('Importance tier — low, medium, or high — when the user has signaled priority.'),
389
+ status: taskStatusSchema.optional().describe('Lifecycle state — open, done, or canceled.'),
390
+ }),
391
+ label: 'Task',
392
+ displayField: 'title',
393
+ description: 'A commitment you may need to track or clean up — who owns it, when it needs to happen, and what done looks like when that clarity helps. When the user changes one, update the task itself rather than merely restating the edit.',
394
+ },
395
+ },
396
+ contextInputs: {
397
+ openTasks: {
398
+ label: 'OPEN TASKS',
399
+ intent: 'Authoritative commitments still in play. Use IDs when updating status, owner, due date, or details.',
400
+ format: 'list',
401
+ includeIds: true,
402
+ priority: 'critical',
403
+ },
404
+ constraints: {
405
+ label: 'OPERATING CONSTRAINTS',
406
+ intent: 'Current limits and operating rules that should shape prioritization and commitments.',
407
+ format: 'list',
408
+ },
409
+ memories: {
410
+ label: 'WORKING MEMORY',
411
+ intent: 'Durable working-style preferences, commitments, and friction patterns for continuity.',
412
+ budget: 5000,
413
+ prioritize: 'pinned-first',
414
+ },
415
+ profile: {
416
+ label: 'USER PROFILE',
417
+ intent: 'Stable user context that calibrates assumptions, tone, and support style.',
418
+ format: 'block',
419
+ },
420
+ },
421
+ eq: { frequencyRule: true, autonomyRespect: true, coherence: true, expertJudgment: true },
422
+ memory: {
423
+ enabled: true,
424
+ includeIds: true,
425
+ budget: 5000,
426
+ categories: {
427
+ working_style: 'How this person likes decisions, drafts, follow-through, or communication to be handled',
428
+ commitment: 'Stated commitments or timing promises worth carrying forward',
429
+ priority_signal: 'Repeated signals about what matters most right now',
430
+ friction_pattern: 'Recurring sources of drag, overload, or hidden work',
431
+ constraint: 'Durable operating constraints that should shape planning',
432
+ preference: 'Stable preferences that affect how support should show up',
433
+ general: 'Useful durable operating context that does not fit a sharper bucket',
434
+ },
435
+ },
436
+ };
437
+ //# sourceMappingURL=templates.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"templates.js","sourceRoot":"","sources":["../../src/playbook/templates.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AACvB;;;GAGG;AAEH,MAAM,kBAAkB,GAAG,CAAC,CAAC,IAAI,CAAC,CAAC,KAAK,EAAE,QAAQ,EAAE,MAAM,CAAC,CAAC,CAAA;AAC5D,MAAM,gBAAgB,GAAG,CAAC,CAAC,IAAI,CAAC,CAAC,MAAM,EAAE,MAAM,EAAE,UAAU,CAAC,CAAC,CAAA;AAE7D,+EAA+E;AAE/E,MAAM,CAAC,MAAM,cAAc,GAAoC;IAC7D,QAAQ,EAAE;QACR,IAAI,EAAE,OAAO;QACb,SAAS,EAAE,CAAC,oBAAoB,EAAE,yBAAyB,EAAE,oBAAoB,CAAC;QAClF,YAAY,EAAE,0BAA0B;QACxC,SAAS,EAAE,qDAAqD;QAChE,mGAAmG;QACn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E,IAAI,EAAE,cAAc,EAAE,IAAI,EAAE;IACzF,MAAM,EAAE;QACN,OAAO,EAAE,IAAI;QACb,UAAU,EAAE,IAAI;QAChB,MAAM,EAAE,IAAI;QACZ,UAAU,EAAE;YACV,aAAa,EAAE,yFAAyF;YACxG,UAAU,EAAE,8DAA8D;YAC1E,eAAe,EAAE,oDAAoD;YACrE,gBAAgB,EAAE,qDAAqD;YACvE,UAAU,EAAE,0DAA0D;YACtE,UAAU,EAAE,2DAA2D;YACvE,OAAO,EAAE,qEAAqE;SAC/E;KACF;CACF,CAAA"}
@@ -0,0 +1,73 @@
1
+ import { SchemaType } from '@google/generative-ai';
2
+ import type { LLMProvider, ActionDefinition, EntityConfig } from '../types.js';
3
+ export interface GeminiConfig {
4
+ model?: string;
5
+ apiKey?: string;
6
+ temperature?: number;
7
+ timeoutMs?: number;
8
+ /** @deprecated Use fallbackModels for a full cascade chain */
9
+ fallbackModel?: string;
10
+ /** Ordered cascade of fallback models. Each gets full retry treatment. */
11
+ fallbackModels?: string[];
12
+ /** Gemini 2.5 thinking budget in tokens. Default 8192 matches pi's medium preset.
13
+ * Lower values (e.g. 4096) reduce per-call latency for simpler prompts at
14
+ * the cost of less chain-of-thought. Pass 0 to disable thinking entirely. */
15
+ thinkingBudget?: number;
16
+ maxRetries?: number;
17
+ /** Use Gemini's native function-calling API instead of JSON-schema-constrained
18
+ * response. When the persona's responseSchema has the Archetype action
19
+ * shape `{ actions: { items: { anyOf: [{name, params}, ...] } } }`, each
20
+ * action becomes a function declaration and the model emits functionCall
21
+ * parts natively instead of a JSON-text blob. Pi (the reference coding
22
+ * agent) runs in this mode; JSON-schema mode is a secondary constraint the
23
+ * model has to simulate instead of using its pretrained tool-use fluency.
24
+ * Default off — existing Archetype consumers see no behavior change. */
25
+ useFunctionCalling?: boolean;
26
+ }
27
+ export declare const DEFAULT_GEMINI_MODEL = "gemini-3.5-flash";
28
+ export declare const DEFAULT_GEMINI_FALLBACK_MODELS: readonly ["gemini-3.1-pro-preview", "gemini-3.1-flash-lite"];
29
+ /**
30
+ * Build the ordered fallback chain from config + env vars.
31
+ * Precedence: fallbackModels config > fallbackModel config > GEMINI_FALLBACK_MODELS env > GEMINI_FALLBACK_MODEL env > defaults.
32
+ * Passing fallbackModels: [] explicitly disables fallback instead of inheriting env defaults.
33
+ * The primary model and duplicates are excluded.
34
+ */
35
+ export declare function resolveFallbackChain(primaryModel: string, config?: Pick<GeminiConfig, 'fallbackModel' | 'fallbackModels'>): string[];
36
+ /**
37
+ * Create a Gemini LLM provider.
38
+ * API key resolved from: config.apiKey → GEMINI_API_KEY env var.
39
+ */
40
+ export declare function Gemini(config?: GeminiConfig): LLMProvider;
41
+ export declare function isRetryable(err: Error): boolean;
42
+ /**
43
+ * Build the Gemini-compatible response schema for the standard chat format.
44
+ * Includes message, actions, outcomeNotes, and optional follow-ups/diagnostics.
45
+ *
46
+ * When actions are provided, builds per-action variants using anyOf so the
47
+ * model sees exact param types for each action (discriminated by name).
48
+ *
49
+ * Note: with large action sets (30+), Gemini may stringify params instead
50
+ * of returning objects. validateActions() handles this by parsing JSON
51
+ * strings before Zod validation.
52
+ */
53
+ export declare function buildGeminiResponseSchema(actions?: Record<string, ActionDefinition>, options?: {
54
+ followUpsDescription?: string;
55
+ entities?: Record<string, EntityConfig>;
56
+ promptMode?: 'conversation' | 'operational' | 'focus';
57
+ }): {
58
+ type: SchemaType;
59
+ properties: Record<string, unknown>;
60
+ required: string[];
61
+ };
62
+ /**
63
+ * Build a Gemini-compatible response schema for silent action-only passes.
64
+ * Useful for internal maintenance flows like retrospective memory updates.
65
+ */
66
+ export declare function buildGeminiActionOnlySchema(actions?: Record<string, ActionDefinition>, entities?: Record<string, EntityConfig>): {
67
+ type: SchemaType;
68
+ properties: {
69
+ actions: unknown;
70
+ diagnostics: unknown;
71
+ };
72
+ };
73
+ //# sourceMappingURL=gemini.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"gemini.d.ts","sourceRoot":"","sources":["../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