coaiajs 0.1.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 (162) hide show
  1. package/CLAUDE.md +56 -0
  2. package/KINSHIP.md +63 -0
  3. package/README.md +148 -0
  4. package/articles/academic/creative-orientation-vs-problem-solving.md +177 -0
  5. package/articles/academic/jsonl-knowledge-graphs-agent-memory.md +142 -0
  6. package/articles/academic/langfuse-observability-llm-pipelines.md +144 -0
  7. package/articles/academic/medicine-wheel-software-architecture.md +163 -0
  8. package/articles/academic/mmot-autonomous-agents.md +156 -0
  9. package/articles/academic/model-context-protocol-interagent.md +161 -0
  10. package/articles/academic/pde-prompt-decomposition.md +186 -0
  11. package/articles/academic/structural-tension-in-ai-agents.md +134 -0
  12. package/articles/reviews/mcp-protocol-design-review.md +170 -0
  13. package/articles/reviews/observability-ai-systems-review.md +176 -0
  14. package/articles/reviews/prompt-engineering-decomposition-review.md +184 -0
  15. package/articles/surveys/agent-orchestration-survey.md +186 -0
  16. package/articles/surveys/knowledge-graph-storage-survey.md +204 -0
  17. package/articles/surveys/structural-tension-methodology-survey.md +154 -0
  18. package/articles/technical/aws-sdk-v3-polly.md +270 -0
  19. package/articles/technical/commander-cli-framework.md +262 -0
  20. package/articles/technical/dotenv-config-patterns.md +360 -0
  21. package/articles/technical/ioredis-vs-redis.md +142 -0
  22. package/articles/technical/langfuse-js-sdk-vs-rest.md +191 -0
  23. package/articles/technical/mcp-sdk-typescript.md +291 -0
  24. package/articles/technical/octokit-github-api.md +293 -0
  25. package/articles/technical/openai-sdk-modern.md +231 -0
  26. package/articles/technical/yaml-parsing-node.md +266 -0
  27. package/articles/technical/zod-runtime-validation.md +212 -0
  28. package/dist/mcp/config.d.ts +14 -0
  29. package/dist/mcp/config.js +185 -0
  30. package/dist/mcp/server.d.ts +3 -0
  31. package/dist/mcp/server.js +324 -0
  32. package/dist/mcp/tools/coaiapy-tools.d.ts +8 -0
  33. package/dist/mcp/tools/coaiapy-tools.js +326 -0
  34. package/dist/mcp/tools/index.d.ts +3 -0
  35. package/dist/mcp/tools/index.js +3 -0
  36. package/dist/src/audio.d.ts +12 -0
  37. package/dist/src/audio.js +57 -0
  38. package/dist/src/cli-helpers.d.ts +9 -0
  39. package/dist/src/cli-helpers.js +78 -0
  40. package/dist/src/cli.d.ts +3 -0
  41. package/dist/src/cli.js +1086 -0
  42. package/dist/src/config.d.ts +15 -0
  43. package/dist/src/config.js +145 -0
  44. package/dist/src/environment.d.ts +44 -0
  45. package/dist/src/environment.js +146 -0
  46. package/dist/src/github.d.ts +47 -0
  47. package/dist/src/github.js +79 -0
  48. package/dist/src/langfuse/client.d.ts +30 -0
  49. package/dist/src/langfuse/client.js +75 -0
  50. package/dist/src/langfuse/comments.d.ts +16 -0
  51. package/dist/src/langfuse/comments.js +36 -0
  52. package/dist/src/langfuse/datasets.d.ts +19 -0
  53. package/dist/src/langfuse/datasets.js +140 -0
  54. package/dist/src/langfuse/index.d.ts +13 -0
  55. package/dist/src/langfuse/index.js +10 -0
  56. package/dist/src/langfuse/media.d.ts +11 -0
  57. package/dist/src/langfuse/media.js +167 -0
  58. package/dist/src/langfuse/observations.d.ts +18 -0
  59. package/dist/src/langfuse/observations.js +113 -0
  60. package/dist/src/langfuse/prompts.d.ts +14 -0
  61. package/dist/src/langfuse/prompts.js +127 -0
  62. package/dist/src/langfuse/scores.d.ts +54 -0
  63. package/dist/src/langfuse/scores.js +366 -0
  64. package/dist/src/langfuse/traces.d.ts +29 -0
  65. package/dist/src/langfuse/traces.js +225 -0
  66. package/dist/src/llm.d.ts +23 -0
  67. package/dist/src/llm.js +76 -0
  68. package/dist/src/narrative/graph-manager.d.ts +106 -0
  69. package/dist/src/narrative/graph-manager.js +915 -0
  70. package/dist/src/narrative/index.d.ts +9 -0
  71. package/dist/src/narrative/index.js +7 -0
  72. package/dist/src/narrative/markdown-export.d.ts +21 -0
  73. package/dist/src/narrative/markdown-export.js +383 -0
  74. package/dist/src/narrative/tool-definitions.d.ts +21 -0
  75. package/dist/src/narrative/tool-definitions.js +588 -0
  76. package/dist/src/narrative/tool-handlers.d.ts +11 -0
  77. package/dist/src/narrative/tool-handlers.js +462 -0
  78. package/dist/src/narrative/types.d.ts +2 -0
  79. package/dist/src/narrative/types.js +2 -0
  80. package/dist/src/narrative/validation.d.ts +29 -0
  81. package/dist/src/narrative/validation.js +144 -0
  82. package/dist/src/pde/index.d.ts +8 -0
  83. package/dist/src/pde/index.js +8 -0
  84. package/dist/src/pde/mcp-handlers.d.ts +7 -0
  85. package/dist/src/pde/mcp-handlers.js +300 -0
  86. package/dist/src/pde/mcp-tools.d.ts +15 -0
  87. package/dist/src/pde/mcp-tools.js +191 -0
  88. package/dist/src/pde/session-manager.d.ts +32 -0
  89. package/dist/src/pde/session-manager.js +205 -0
  90. package/dist/src/pde/stc-mapper.d.ts +26 -0
  91. package/dist/src/pde/stc-mapper.js +234 -0
  92. package/dist/src/pipeline/index.d.ts +2 -0
  93. package/dist/src/pipeline/index.js +3 -0
  94. package/dist/src/pipeline/template-engine.d.ts +20 -0
  95. package/dist/src/pipeline/template-engine.js +361 -0
  96. package/dist/src/planning/index.d.ts +7 -0
  97. package/dist/src/planning/index.js +7 -0
  98. package/dist/src/planning/mcp-handlers.d.ts +7 -0
  99. package/dist/src/planning/mcp-handlers.js +310 -0
  100. package/dist/src/planning/mcp-tools.d.ts +15 -0
  101. package/dist/src/planning/mcp-tools.js +145 -0
  102. package/dist/src/planning/plan-parser.d.ts +35 -0
  103. package/dist/src/planning/plan-parser.js +506 -0
  104. package/dist/src/redis.d.ts +21 -0
  105. package/dist/src/redis.js +78 -0
  106. package/dist/src/types.d.ts +244 -0
  107. package/dist/src/types.js +8 -0
  108. package/mcp/config.ts +196 -0
  109. package/mcp/server.ts +402 -0
  110. package/mcp/tools/coaiapy-tools.ts +364 -0
  111. package/mcp/tools/index.ts +4 -0
  112. package/package.json +52 -0
  113. package/rispecs/00-coaiajs-platform.spec.md +102 -0
  114. package/rispecs/01-core-config.spec.md +89 -0
  115. package/rispecs/02-redis-module.spec.md +62 -0
  116. package/rispecs/03-langfuse-module.spec.md +101 -0
  117. package/rispecs/04-narrative-engine.spec.md +185 -0
  118. package/rispecs/05-pde-engine.spec.md +112 -0
  119. package/rispecs/06-planning-engine.spec.md +128 -0
  120. package/rispecs/07-pipeline-templates.spec.md +97 -0
  121. package/rispecs/08-cli-interface.spec.md +134 -0
  122. package/rispecs/09-mcp-server.spec.md +140 -0
  123. package/rispecs/10-audio-module.spec.md +63 -0
  124. package/rispecs/KINSHIP.md +56 -0
  125. package/rispecs/README.md +100 -0
  126. package/src/audio.ts +76 -0
  127. package/src/cli-helpers.ts +86 -0
  128. package/src/cli.ts +1223 -0
  129. package/src/config.ts +172 -0
  130. package/src/environment.ts +171 -0
  131. package/src/github.ts +143 -0
  132. package/src/langfuse/client.ts +105 -0
  133. package/src/langfuse/comments.ts +52 -0
  134. package/src/langfuse/datasets.ts +178 -0
  135. package/src/langfuse/index.ts +33 -0
  136. package/src/langfuse/media.ts +193 -0
  137. package/src/langfuse/observations.ts +131 -0
  138. package/src/langfuse/prompts.ts +157 -0
  139. package/src/langfuse/scores.ts +456 -0
  140. package/src/langfuse/traces.ts +276 -0
  141. package/src/llm.ts +106 -0
  142. package/src/narrative/graph-manager.ts +1358 -0
  143. package/src/narrative/index.ts +32 -0
  144. package/src/narrative/markdown-export.ts +535 -0
  145. package/src/narrative/tool-definitions.ts +635 -0
  146. package/src/narrative/tool-handlers.ts +528 -0
  147. package/src/narrative/types.ts +9 -0
  148. package/src/narrative/validation.ts +179 -0
  149. package/src/pde/index.ts +8 -0
  150. package/src/pde/mcp-handlers.ts +359 -0
  151. package/src/pde/mcp-tools.ts +201 -0
  152. package/src/pde/session-manager.ts +248 -0
  153. package/src/pde/stc-mapper.ts +298 -0
  154. package/src/pipeline/index.ts +7 -0
  155. package/src/pipeline/template-engine.ts +398 -0
  156. package/src/planning/index.ts +13 -0
  157. package/src/planning/mcp-handlers.ts +369 -0
  158. package/src/planning/mcp-tools.ts +155 -0
  159. package/src/planning/plan-parser.ts +587 -0
  160. package/src/redis.ts +97 -0
  161. package/src/types.ts +280 -0
  162. package/tsconfig.json +26 -0
@@ -0,0 +1,635 @@
1
+ /**
2
+ * COAIA Narrative - MCP Tool Definitions (Schemas)
3
+ *
4
+ * Pure data: array of MCP tool schema objects.
5
+ * No logic, no side effects — easy to review, test, and extend.
6
+ */
7
+
8
+ export interface ToolDefinition {
9
+ name: string;
10
+ description: string;
11
+ inputSchema: {
12
+ type: string;
13
+ properties: Record<string, unknown>;
14
+ required?: string[];
15
+ };
16
+ }
17
+
18
+ export const ALL_TOOL_DEFINITIONS: ToolDefinition[] = [
19
+ // ─── Knowledge Graph Tools (9) ────────────────────────────────────
20
+
21
+ {
22
+ name: 'create_entities',
23
+ description:
24
+ 'ADVANCED: Create traditional knowledge graph entities. For structural tension charts, use create_structural_tension_chart or add_action_step instead.',
25
+ inputSchema: {
26
+ type: 'object',
27
+ properties: {
28
+ entities: {
29
+ type: 'array',
30
+ items: {
31
+ type: 'object',
32
+ properties: {
33
+ name: { type: 'string', description: 'The name of the entity' },
34
+ entityType: { type: 'string', description: 'The type of the entity' },
35
+ observations: {
36
+ type: 'array',
37
+ items: { type: 'string' },
38
+ description: 'An array of observation contents associated with the entity',
39
+ },
40
+ },
41
+ required: ['name', 'entityType', 'observations'],
42
+ },
43
+ },
44
+ },
45
+ required: ['entities'],
46
+ },
47
+ },
48
+ {
49
+ name: 'create_relations',
50
+ description:
51
+ 'Create multiple new relations between entities in the knowledge graph. Relations should be in active voice',
52
+ inputSchema: {
53
+ type: 'object',
54
+ properties: {
55
+ relations: {
56
+ type: 'array',
57
+ items: {
58
+ type: 'object',
59
+ properties: {
60
+ from: { type: 'string', description: 'The name of the entity where the relation starts' },
61
+ to: { type: 'string', description: 'The name of the entity where the relation ends' },
62
+ relationType: { type: 'string', description: 'The type of the relation' },
63
+ },
64
+ required: ['from', 'to', 'relationType'],
65
+ },
66
+ },
67
+ },
68
+ required: ['relations'],
69
+ },
70
+ },
71
+ {
72
+ name: 'add_observations',
73
+ description:
74
+ 'ADVANCED: Add observations to traditional knowledge graph entities. For structural tension charts, use update_current_reality instead.',
75
+ inputSchema: {
76
+ type: 'object',
77
+ properties: {
78
+ observations: {
79
+ type: 'array',
80
+ items: {
81
+ type: 'object',
82
+ properties: {
83
+ entityName: { type: 'string', description: 'The name of the entity to add the observations to' },
84
+ contents: {
85
+ type: 'array',
86
+ items: { type: 'string' },
87
+ description: 'An array of observation contents to add',
88
+ },
89
+ },
90
+ required: ['entityName', 'contents'],
91
+ },
92
+ },
93
+ },
94
+ required: ['observations'],
95
+ },
96
+ },
97
+ {
98
+ name: 'delete_entities',
99
+ description: 'Delete multiple entities and their associated relations from the knowledge graph',
100
+ inputSchema: {
101
+ type: 'object',
102
+ properties: {
103
+ entityNames: {
104
+ type: 'array',
105
+ items: { type: 'string' },
106
+ description: 'An array of entity names to delete',
107
+ },
108
+ },
109
+ required: ['entityNames'],
110
+ },
111
+ },
112
+ {
113
+ name: 'delete_observations',
114
+ description: 'Delete specific observations from entities in the knowledge graph',
115
+ inputSchema: {
116
+ type: 'object',
117
+ properties: {
118
+ deletions: {
119
+ type: 'array',
120
+ items: {
121
+ type: 'object',
122
+ properties: {
123
+ entityName: { type: 'string', description: 'The name of the entity containing the observations' },
124
+ observations: {
125
+ type: 'array',
126
+ items: { type: 'string' },
127
+ description: 'An array of observations to delete',
128
+ },
129
+ },
130
+ required: ['entityName', 'observations'],
131
+ },
132
+ },
133
+ },
134
+ required: ['deletions'],
135
+ },
136
+ },
137
+ {
138
+ name: 'delete_relations',
139
+ description: 'Delete multiple relations from the knowledge graph',
140
+ inputSchema: {
141
+ type: 'object',
142
+ properties: {
143
+ relations: {
144
+ type: 'array',
145
+ items: {
146
+ type: 'object',
147
+ properties: {
148
+ from: { type: 'string', description: 'The name of the entity where the relation starts' },
149
+ to: { type: 'string', description: 'The name of the entity where the relation ends' },
150
+ relationType: { type: 'string', description: 'The type of the relation' },
151
+ },
152
+ required: ['from', 'to', 'relationType'],
153
+ },
154
+ description: 'An array of relations to delete',
155
+ },
156
+ },
157
+ required: ['relations'],
158
+ },
159
+ },
160
+ {
161
+ name: 'read_graph',
162
+ description:
163
+ 'RARELY USED: Dumps entire knowledge graph (all entities and relations). Only use for debugging or when you need to see ALL data. For chart work, use list_active_charts instead.',
164
+ inputSchema: {
165
+ type: 'object',
166
+ properties: {},
167
+ },
168
+ },
169
+ {
170
+ name: 'search_nodes',
171
+ description: 'Search for nodes in the knowledge graph based on a query',
172
+ inputSchema: {
173
+ type: 'object',
174
+ properties: {
175
+ query: {
176
+ type: 'string',
177
+ description: 'The search query to match against entity names, types, and observation content',
178
+ },
179
+ },
180
+ required: ['query'],
181
+ },
182
+ },
183
+ {
184
+ name: 'open_nodes',
185
+ description:
186
+ "ADVANCED: Open specific entity nodes by exact name (e.g. 'chart_123_current_reality'). Only use if you need to inspect specific chart components. NOT for general chart viewing - use list_active_charts instead.",
187
+ inputSchema: {
188
+ type: 'object',
189
+ properties: {
190
+ names: {
191
+ type: 'array',
192
+ items: { type: 'string' },
193
+ description: "An array of exact entity names to retrieve (e.g. 'chart_123_desired_outcome')",
194
+ },
195
+ },
196
+ required: ['names'],
197
+ },
198
+ },
199
+
200
+ // ─── STC Tools (14) ───────────────────────────────────────────────
201
+
202
+ {
203
+ name: 'create_structural_tension_chart',
204
+ description:
205
+ "Create a new structural tension chart with desired outcome, current reality, and optional action steps. CRITICAL: Use creative orientation (what you want to CREATE) not problem-solving (what you want to fix/solve). Current reality must be factual assessment, never 'ready to begin'.",
206
+ inputSchema: {
207
+ type: 'object',
208
+ properties: {
209
+ desiredOutcome: {
210
+ type: 'string',
211
+ description: 'What you want to CREATE (not solve/fix). Focus on positive outcomes, not problems to eliminate.',
212
+ },
213
+ currentReality: {
214
+ type: 'string',
215
+ description:
216
+ "Your current situation - factual assessment only. NEVER use 'ready to begin' or similar readiness statements.",
217
+ },
218
+ dueDate: { type: 'string', description: 'When you want to achieve this outcome (ISO date string)' },
219
+ actionSteps: {
220
+ type: 'array',
221
+ items: { type: 'string' },
222
+ description: 'Optional list of action steps needed to achieve the outcome',
223
+ },
224
+ elementsOfPerformance: {
225
+ type: 'array',
226
+ items: {
227
+ type: 'object',
228
+ properties: {
229
+ description: { type: 'string', description: 'What is being evaluated' },
230
+ type: {
231
+ type: 'string',
232
+ enum: ['DESIGN', 'EXECUTION'],
233
+ description: 'DESIGN = structural intent/architecture, EXECUTION = delivery/implementation quality',
234
+ },
235
+ },
236
+ required: ['description', 'type'],
237
+ },
238
+ description: 'Optional Elements of Performance for MMOT evaluation — criteria the agent uses to self-assess output',
239
+ },
240
+ },
241
+ required: ['desiredOutcome', 'currentReality', 'dueDate'],
242
+ },
243
+ },
244
+ {
245
+ name: 'manage_action_step',
246
+ description:
247
+ '✨ RECOMMENDED: Unified interface for managing action steps - handles both creation and expansion. Automatically detects whether you\'re creating a new action step (chart ID) or expanding an existing one (entity name). Provides clear error messages when parameters are invalid.',
248
+ inputSchema: {
249
+ type: 'object',
250
+ properties: {
251
+ parentReference: {
252
+ type: 'string',
253
+ description:
254
+ "Chart ID (e.g., 'chart_123') to create new action step, OR action step entity name (e.g., 'chart_123_action_1' or 'chart_123_desired_outcome') to expand existing action step",
255
+ },
256
+ actionDescription: {
257
+ type: 'string',
258
+ description: 'Title/description of the action step',
259
+ },
260
+ currentReality: {
261
+ type: 'string',
262
+ description:
263
+ "REQUIRED for new action creation. Honest assessment of actual current state relative to this action step. Examples: 'Never used Django', 'Completed models, struggling with views'. AVOID: 'Ready to begin'. Optional when expanding existing actions.",
264
+ },
265
+ initialActionSteps: {
266
+ type: 'array',
267
+ items: { type: 'string' },
268
+ description: 'Optional list of sub-actions for the action step',
269
+ },
270
+ dueDate: {
271
+ type: 'string',
272
+ description: 'Optional due date (ISO string). Auto-distributed if not provided.',
273
+ },
274
+ performanceElements: {
275
+ type: 'array',
276
+ items: {
277
+ type: 'object',
278
+ properties: {
279
+ description: { type: 'string', description: 'What is being evaluated for this action step' },
280
+ type: { type: 'string', enum: ['DESIGN', 'EXECUTION'], description: 'DESIGN or EXECUTION element' },
281
+ },
282
+ required: ['description', 'type'],
283
+ },
284
+ description: 'Optional per-step Elements of Performance for MMOT evaluation',
285
+ },
286
+ },
287
+ required: ['parentReference', 'actionDescription'],
288
+ },
289
+ },
290
+ {
291
+ name: 'add_action_step',
292
+ description:
293
+ "⚠️ DEPRECATED: Use 'manage_action_step' instead for unified interface. Add a strategic action step to an existing structural tension chart (creates telescoped chart). WARNING: Requires honest current reality assessment - avoid 'ready to begin' language. Action steps become full structural tension charts.",
294
+ inputSchema: {
295
+ type: 'object',
296
+ properties: {
297
+ parentChartId: { type: 'string', description: 'ID of the parent chart to add the action step to' },
298
+ actionStepTitle: {
299
+ type: 'string',
300
+ description: 'Title of the action step (becomes desired outcome of telescoped chart)',
301
+ },
302
+ dueDate: {
303
+ type: 'string',
304
+ description: 'Optional due date for the action step (ISO string). If not provided, auto-distributed between now and parent due date',
305
+ },
306
+ currentReality: {
307
+ type: 'string',
308
+ description:
309
+ 'Current reality specific to this action step. Required to maintain structural tension - assess the actual current state relative to this action step, not readiness to begin.',
310
+ },
311
+ },
312
+ required: ['parentChartId', 'actionStepTitle', 'currentReality'],
313
+ },
314
+ },
315
+ {
316
+ name: 'telescope_action_step',
317
+ description:
318
+ "⚠️ DEPRECATED: Use 'manage_action_step' instead for unified interface. Break down an action step into a detailed structural tension chart. CRITICAL: Current reality must be an honest assessment of actual current state relative to this specific action step, NOT readiness or preparation statements. This maintains structural tension essential for creative advancement.",
319
+ inputSchema: {
320
+ type: 'object',
321
+ properties: {
322
+ actionStepName: { type: 'string', description: 'Name of the action step to telescope' },
323
+ newCurrentReality: {
324
+ type: 'string',
325
+ description:
326
+ "REQUIRED: Honest assessment of actual current state relative to this action step. Examples: 'Never used Django before', 'Completed models section, struggling with views'. AVOID: 'Ready to begin', 'Prepared to start'.",
327
+ },
328
+ initialActionSteps: {
329
+ type: 'array',
330
+ items: { type: 'string' },
331
+ description: 'Optional list of initial action steps for the telescoped chart',
332
+ },
333
+ },
334
+ required: ['actionStepName', 'newCurrentReality'],
335
+ },
336
+ },
337
+ {
338
+ name: 'remove_action_step',
339
+ description: 'Remove an action step from a structural tension chart (deletes telescoped chart)',
340
+ inputSchema: {
341
+ type: 'object',
342
+ properties: {
343
+ parentChartId: { type: 'string', description: 'ID of the parent chart containing the action step' },
344
+ actionStepName: {
345
+ type: 'string',
346
+ description: "Name of the action step to remove (telescoped chart's desired outcome name)",
347
+ },
348
+ },
349
+ required: ['parentChartId', 'actionStepName'],
350
+ },
351
+ },
352
+ {
353
+ name: 'mark_action_complete',
354
+ description: 'Mark an action step as completed and update current reality',
355
+ inputSchema: {
356
+ type: 'object',
357
+ properties: {
358
+ actionStepName: { type: 'string', description: 'Name of the completed action step' },
359
+ },
360
+ required: ['actionStepName'],
361
+ },
362
+ },
363
+ {
364
+ name: 'get_chart_progress',
365
+ description:
366
+ 'Get detailed progress for a specific chart (redundant if you just used list_active_charts which shows progress). Only use if you need the nextAction details.',
367
+ inputSchema: {
368
+ type: 'object',
369
+ properties: {
370
+ chartId: { type: 'string', description: 'ID of the chart to check progress for' },
371
+ },
372
+ required: ['chartId'],
373
+ },
374
+ },
375
+ {
376
+ name: 'list_active_charts',
377
+ description:
378
+ "List all active structural tension charts with their progress. Use this FIRST to see all charts and their IDs. This shows chart overview with progress - you don't need other tools after this for basic chart information.",
379
+ inputSchema: {
380
+ type: 'object',
381
+ properties: {},
382
+ },
383
+ },
384
+ {
385
+ name: 'get_chart',
386
+ description:
387
+ 'Get the full details of a specific structural tension chart, including its desired outcome, current reality, and all associated action steps.',
388
+ inputSchema: {
389
+ type: 'object',
390
+ properties: {
391
+ chartId: { type: 'string', description: 'ID of the chart to retrieve.' },
392
+ },
393
+ required: ['chartId'],
394
+ },
395
+ },
396
+ {
397
+ name: 'get_action_step',
398
+ description: 'Get the full details of a specific action step, which is itself a telescoped chart.',
399
+ inputSchema: {
400
+ type: 'object',
401
+ properties: {
402
+ actionStepName: {
403
+ type: 'string',
404
+ description: "Name of the action step (e.g., 'chart_123_desired_outcome') to retrieve.",
405
+ },
406
+ },
407
+ required: ['actionStepName'],
408
+ },
409
+ },
410
+ {
411
+ name: 'update_action_progress',
412
+ description: 'Update progress on an action step without marking it complete, optionally updating current reality',
413
+ inputSchema: {
414
+ type: 'object',
415
+ properties: {
416
+ actionStepName: { type: 'string', description: 'Name of the action step to update progress for' },
417
+ progressObservation: { type: 'string', description: 'Description of progress made on this action step' },
418
+ updateCurrentReality: {
419
+ type: 'boolean',
420
+ description: 'Whether to also add this progress to current reality (optional, defaults to false)',
421
+ },
422
+ },
423
+ required: ['actionStepName', 'progressObservation'],
424
+ },
425
+ },
426
+ {
427
+ name: 'update_current_reality',
428
+ description:
429
+ 'FOR STRUCTURAL TENSION CHARTS: Add observations to current reality. DO NOT use add_observations or create_entities for chart work - use this instead.',
430
+ inputSchema: {
431
+ type: 'object',
432
+ properties: {
433
+ chartId: { type: 'string', description: 'ID of the chart to update current reality for' },
434
+ newObservations: {
435
+ type: 'array',
436
+ items: { type: 'string' },
437
+ description: 'Array of new observations to add to current reality',
438
+ },
439
+ },
440
+ required: ['chartId', 'newObservations'],
441
+ },
442
+ },
443
+ {
444
+ name: 'update_desired_outcome',
445
+ description:
446
+ "Update a chart's desired outcome (goal). Works for BOTH master charts AND action steps (which are telescoped charts). Provide the chart ID of the chart you want to update - whether it's a master chart or an action step chart.",
447
+ inputSchema: {
448
+ type: 'object',
449
+ properties: {
450
+ chartId: {
451
+ type: 'string',
452
+ description: "ID of the chart to update (works for master charts like 'chart_123' or action step charts like 'chart_456')",
453
+ },
454
+ newDesiredOutcome: { type: 'string', description: 'New desired outcome text' },
455
+ },
456
+ required: ['chartId', 'newDesiredOutcome'],
457
+ },
458
+ },
459
+ {
460
+ name: 'perform_mmot_evaluation',
461
+ description:
462
+ "Autonomous MMOT (Managerial Moment of Truth) self-evaluation on a structural tension chart. The agent compares produced output against defined Elements of Performance, acknowledges discrepancy, analyzes dynamics, updates the chart, and recommits or redirects. Runs the four Creator's Moment of Truth steps: acknowledge → analyze → update → recommit. Can be called from any directional perspective (South/East/West/North) for collective inquiry.",
463
+ inputSchema: {
464
+ type: 'object',
465
+ properties: {
466
+ chartId: { type: 'string', description: 'ID of the chart to evaluate' },
467
+ phase: {
468
+ type: 'string',
469
+ enum: ['full', 'acknowledge', 'analyze', 'update', 'recommit'],
470
+ default: 'full',
471
+ description: "Which MMOT phase: 'full' runs all four steps, or run individual phases",
472
+ },
473
+ assessment: {
474
+ type: 'string',
475
+ description:
476
+ "The agent's honest assessment — what was expected vs. what was delivered, observations, corrective insights",
477
+ },
478
+ direction: {
479
+ type: 'string',
480
+ enum: ['South', 'East', 'West', 'North'],
481
+ description:
482
+ 'Optional directional perspective: South=DESIGN/structure (Mia), East=EXECUTION/narrative (Miette), West=EXECUTION/embodied (Heyva), North=DESIGN/wisdom (Echo Weaver)',
483
+ },
484
+ correctiveActions: {
485
+ type: 'array',
486
+ items: { type: 'string' },
487
+ description: 'Optional corrective action steps to add to the chart based on evaluation',
488
+ },
489
+ updateReality: {
490
+ type: 'boolean',
491
+ default: true,
492
+ description: 'Whether to write evaluation observations into current reality',
493
+ },
494
+ },
495
+ required: ['chartId'],
496
+ },
497
+ },
498
+
499
+ // ─── Narrative Tools (3) ──────────────────────────────────────────
500
+
501
+ {
502
+ name: 'create_narrative_beat',
503
+ description:
504
+ 'Create a new narrative beat with multi-universe perspective and optional IAIP integration. Documents story progression across three archetypal universes (engineer-world, ceremony-world, story-engine-world).',
505
+ inputSchema: {
506
+ type: 'object',
507
+ properties: {
508
+ parentChartId: { type: 'string', description: 'ID of the parent structural tension chart' },
509
+ title: { type: 'string', description: 'Title of the narrative beat' },
510
+ act: { type: 'number', description: 'Act number in the narrative sequence' },
511
+ type_dramatic: {
512
+ type: 'string',
513
+ description: "Dramatic type (e.g. 'Crisis/Antagonist Force', 'Setup', 'Turning Point')",
514
+ },
515
+ universes: {
516
+ type: 'array',
517
+ items: { type: 'string' },
518
+ description: 'Universe perspectives (engineer-world, ceremony-world, story-engine-world)',
519
+ },
520
+ description: { type: 'string', description: 'Detailed description of the narrative beat' },
521
+ prose: { type: 'string', description: 'Prose narrative of the beat' },
522
+ lessons: {
523
+ type: 'array',
524
+ items: { type: 'string' },
525
+ description: 'Key lessons or insights from this beat',
526
+ },
527
+ assessRelationalAlignment: { type: 'boolean', description: 'Whether to call iaip-mcp assess_relational_alignment' },
528
+ initiateFourDirectionsInquiry: { type: 'boolean', description: 'Whether to call iaip-mcp get_direction_guidance' },
529
+ filePath: { type: 'string', description: 'Path to narrative JSONL file (optional)' },
530
+ },
531
+ required: ['parentChartId', 'title', 'act', 'type_dramatic', 'universes', 'description', 'prose', 'lessons'],
532
+ },
533
+ },
534
+ {
535
+ name: 'telescope_narrative_beat',
536
+ description:
537
+ 'Telescope a narrative beat into sub-beats for detailed exploration. Creates detailed sub-narrative structure from a parent beat.',
538
+ inputSchema: {
539
+ type: 'object',
540
+ properties: {
541
+ parentBeatName: { type: 'string', description: 'Name of the parent narrative beat to telescope' },
542
+ newCurrentReality: { type: 'string', description: 'Updated current reality for the telescoped beat' },
543
+ initialSubBeats: {
544
+ type: 'array',
545
+ items: {
546
+ type: 'object',
547
+ properties: {
548
+ title: { type: 'string' },
549
+ type_dramatic: { type: 'string' },
550
+ description: { type: 'string' },
551
+ prose: { type: 'string' },
552
+ lessons: { type: 'array', items: { type: 'string' } },
553
+ },
554
+ required: ['title', 'type_dramatic', 'description', 'prose', 'lessons'],
555
+ },
556
+ description: 'Optional initial sub-beats to create',
557
+ },
558
+ },
559
+ required: ['parentBeatName', 'newCurrentReality'],
560
+ },
561
+ },
562
+ {
563
+ name: 'list_narrative_beats',
564
+ description: 'List all narrative beats, optionally filtered by parent chart ID. Shows multi-universe story progression.',
565
+ inputSchema: {
566
+ type: 'object',
567
+ properties: {
568
+ parentChartId: { type: 'string', description: 'Optional: Filter by parent chart ID' },
569
+ },
570
+ },
571
+ },
572
+
573
+ // ─── System (1) ───────────────────────────────────────────────────
574
+
575
+ {
576
+ name: 'init_llm_guidance',
577
+ description:
578
+ "🚨 NEW LLM? Essential guidance for understanding COAIA Memory's structural tension methodology, delayed resolution principle, and proper tool usage. Run this FIRST to avoid common mistakes.",
579
+ inputSchema: {
580
+ type: 'object',
581
+ properties: {
582
+ format: {
583
+ type: 'string',
584
+ enum: ['full', 'quick', 'save_directive'],
585
+ default: 'full',
586
+ description: "Level of detail: 'full' for complete guidance, 'quick' for essentials only, 'save_directive' for session memory instructions",
587
+ },
588
+ },
589
+ },
590
+ },
591
+ ];
592
+
593
+ // ─── Tool Group Subsets ─────────────────────────────────────────────
594
+
595
+ export const STC_TOOLS = [
596
+ 'create_structural_tension_chart',
597
+ 'manage_action_step',
598
+ 'add_action_step',
599
+ 'telescope_action_step',
600
+ 'remove_action_step',
601
+ 'mark_action_complete',
602
+ 'get_chart_progress',
603
+ 'list_active_charts',
604
+ 'get_chart',
605
+ 'get_action_step',
606
+ 'update_action_progress',
607
+ 'update_current_reality',
608
+ 'update_desired_outcome',
609
+ 'perform_mmot_evaluation',
610
+ ] as const;
611
+
612
+ export const NARRATIVE_TOOLS = [
613
+ 'create_narrative_beat',
614
+ 'telescope_narrative_beat',
615
+ 'list_narrative_beats',
616
+ ] as const;
617
+
618
+ export const KG_TOOLS = [
619
+ 'create_entities',
620
+ 'create_relations',
621
+ 'add_observations',
622
+ 'delete_entities',
623
+ 'delete_observations',
624
+ 'delete_relations',
625
+ 'search_nodes',
626
+ 'open_nodes',
627
+ 'read_graph',
628
+ ] as const;
629
+
630
+ export const CORE_TOOLS = [
631
+ 'list_active_charts',
632
+ 'create_structural_tension_chart',
633
+ 'add_action_step',
634
+ 'mark_action_complete',
635
+ ] as const;