@deimoscloud/coreai 0.1.13 → 0.1.15

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.
package/dist/index.d.ts CHANGED
@@ -166,7 +166,7 @@ declare function getConfigPath(startDir?: string): string | null;
166
166
  * TypeScript types corresponding to the JSON schema at schemas/agent.schema.json
167
167
  */
168
168
  type AgentType = 'ic-engineer' | 'manager' | 'specialist' | 'coordinator';
169
- type WorkflowType = 'ticket-implementation' | 'bug-investigation' | 'code-review' | 'planning-estimation';
169
+ type WorkflowType = 'ticket-implementation' | 'bug-investigation' | 'code-review' | 'planning-estimation' | 'product-planning';
170
170
  interface AgentExpertise {
171
171
  primary?: string[];
172
172
  tech_stack?: string;
@@ -184,13 +184,51 @@ interface AgentBehaviors {
184
184
  quality_gates?: string;
185
185
  [key: string]: unknown;
186
186
  }
187
+ /**
188
+ * @deprecated Use AgentKnowledgeLibrary instead
189
+ */
187
190
  interface AgentContextSources {
188
191
  shared?: string[];
189
192
  personal?: string[];
190
193
  }
194
+ interface AgentKnowledgeLibraryControl {
195
+ objectives?: string;
196
+ decisions?: string;
197
+ dependencies?: string;
198
+ index?: string;
199
+ }
200
+ interface AgentKnowledgeLibraryShared {
201
+ context?: string;
202
+ architecture?: string;
203
+ prd?: string;
204
+ remote?: string[];
205
+ }
206
+ interface AgentKnowledgeLibraryPersonal {
207
+ context?: string;
208
+ history?: string;
209
+ inbox?: string;
210
+ outbox?: string;
211
+ tech?: string;
212
+ control?: AgentKnowledgeLibraryControl;
213
+ }
214
+ interface AgentKnowledgeLibrary {
215
+ shared?: AgentKnowledgeLibraryShared;
216
+ personal?: AgentKnowledgeLibraryPersonal;
217
+ }
191
218
  interface AgentCommunication {
192
219
  inbox?: string;
193
220
  outbox?: string;
221
+ message_format?: string;
222
+ outbox_format?: string;
223
+ processed_dir?: string;
224
+ }
225
+ interface AgentStartupProtocol {
226
+ first_session?: string[];
227
+ subsequent?: string[];
228
+ }
229
+ interface AgentProtocols {
230
+ startup?: AgentStartupProtocol;
231
+ completion?: string[];
194
232
  }
195
233
  /**
196
234
  * Raw agent definition as loaded from YAML (before variable resolution)
@@ -205,8 +243,11 @@ interface AgentDefinition {
205
243
  skills?: string[];
206
244
  principles?: AgentPrinciples;
207
245
  behaviors?: AgentBehaviors;
246
+ /** @deprecated Use knowledge_library instead */
208
247
  context_sources?: AgentContextSources;
248
+ knowledge_library?: AgentKnowledgeLibrary;
209
249
  communication?: AgentCommunication;
250
+ protocols?: AgentProtocols;
210
251
  /**
211
252
  * Claude Code tools available to this agent.
212
253
  * If not specified, defaults to: Read, Write, Edit, Bash, Glob, Grep
package/dist/index.js CHANGED
@@ -383,6 +383,183 @@ function buildAgentTools(agent, mcpServers) {
383
383
  }
384
384
  return tools.join(", ");
385
385
  }
386
+ function generateKnowledgeLibrarySection(agent, lines) {
387
+ const kl = agent.knowledge_library;
388
+ if (!kl) return;
389
+ lines.push("## Knowledge Library Structure");
390
+ lines.push("");
391
+ if (kl.shared) {
392
+ lines.push("### Shared Context (Root - All Agents)");
393
+ lines.push("```");
394
+ lines.push("/KnowledgeLibrary/");
395
+ if (kl.shared.context) {
396
+ const filename = kl.shared.context.split("/").pop() ?? "context.txt";
397
+ lines.push(`\u251C\u2500\u2500 ${filename}`);
398
+ }
399
+ if (kl.shared.architecture) {
400
+ const filename = kl.shared.architecture.split("/").pop() ?? "architecture.txt";
401
+ lines.push(`\u251C\u2500\u2500 ${filename}`);
402
+ }
403
+ if (kl.shared.prd) {
404
+ const filename = kl.shared.prd.split("/").pop() ?? "prd.txt";
405
+ lines.push(`\u2514\u2500\u2500 ${filename}`);
406
+ }
407
+ lines.push("```");
408
+ if (kl.shared.remote && kl.shared.remote.length > 0) {
409
+ lines.push("");
410
+ lines.push("**Remote Documentation:**");
411
+ for (const remote of kl.shared.remote) {
412
+ lines.push(`- ${remote}`);
413
+ }
414
+ }
415
+ lines.push("");
416
+ }
417
+ if (kl.personal) {
418
+ lines.push(`### Personal Context (${agent.role})`);
419
+ lines.push("```");
420
+ lines.push(`/KnowledgeLibrary/${agent.role}/`);
421
+ if (kl.personal.context) {
422
+ lines.push("\u251C\u2500\u2500 context/");
423
+ lines.push("\u2502 \u2514\u2500\u2500 current.txt # Your current state, priorities, decisions, issues");
424
+ }
425
+ if (kl.personal.history) {
426
+ lines.push("\u251C\u2500\u2500 history/");
427
+ lines.push("\u2502 \u2514\u2500\u2500 [archived context files, timestamped]");
428
+ }
429
+ if (kl.personal.inbox) {
430
+ lines.push("\u251C\u2500\u2500 inbox/");
431
+ lines.push("\u2502 \u2514\u2500\u2500 YYYYMMDD_HHMM-[agent-name]-[topic].txt # Messages from other agents");
432
+ }
433
+ if (kl.personal.outbox) {
434
+ lines.push("\u251C\u2500\u2500 outbox/");
435
+ lines.push("\u2502 \u2514\u2500\u2500 YYYYMMDD_HHMM-to-[agent-name]-[topic].txt # Copies of sent messages");
436
+ }
437
+ if (kl.personal.tech) {
438
+ lines.push("\u251C\u2500\u2500 tech/");
439
+ lines.push("\u2502 \u2514\u2500\u2500 [Technical docs, implementation details, working drafts]");
440
+ }
441
+ if (kl.personal.control) {
442
+ lines.push("\u2514\u2500\u2500 control/");
443
+ if (kl.personal.control.objectives) {
444
+ lines.push(" \u251C\u2500\u2500 objectives.txt # Current job objectives and goals");
445
+ }
446
+ if (kl.personal.control.decisions) {
447
+ lines.push(" \u251C\u2500\u2500 decisions.txt # Log of key decisions with rationale");
448
+ }
449
+ if (kl.personal.control.dependencies) {
450
+ lines.push(" \u251C\u2500\u2500 dependencies.txt # Dependencies on other jobs");
451
+ }
452
+ if (kl.personal.control.index) {
453
+ lines.push(" \u2514\u2500\u2500 index.txt # Optional index of files/folders");
454
+ }
455
+ }
456
+ lines.push("```");
457
+ lines.push("");
458
+ }
459
+ lines.push("---");
460
+ lines.push("");
461
+ }
462
+ function generateCommunicationSection(agent, lines) {
463
+ const comm = agent.communication;
464
+ if (!comm) return;
465
+ lines.push("## Communication");
466
+ lines.push("");
467
+ if (comm.inbox) {
468
+ lines.push(`**Inbox:** \`${comm.inbox}\``);
469
+ }
470
+ if (comm.outbox) {
471
+ lines.push(`**Outbox:** \`${comm.outbox}\``);
472
+ }
473
+ lines.push("");
474
+ if (comm.message_format || comm.outbox_format || comm.processed_dir) {
475
+ lines.push("### Message Conventions");
476
+ lines.push("");
477
+ if (comm.message_format) {
478
+ lines.push(`- **Inbox message naming:** \`${comm.message_format}\``);
479
+ }
480
+ if (comm.outbox_format) {
481
+ lines.push(`- **Outbox message naming:** \`${comm.outbox_format}\``);
482
+ }
483
+ if (comm.processed_dir) {
484
+ lines.push(`- **Processed messages:** Move handled inbox messages to \`${comm.processed_dir}\``);
485
+ }
486
+ lines.push("");
487
+ }
488
+ }
489
+ function generateStartupProtocolSection(agent, lines) {
490
+ const protocols = agent.protocols;
491
+ if (!protocols?.startup) return;
492
+ lines.push("## When Invoked");
493
+ lines.push("");
494
+ lines.push("> **MANDATORY STARTUP PROTOCOL** - Execute before proceeding with any task.");
495
+ lines.push("");
496
+ lines.push("### Session Context Check");
497
+ lines.push("");
498
+ lines.push("First, determine if you have already loaded context in this session:");
499
+ lines.push("");
500
+ if (protocols.startup.first_session && protocols.startup.first_session.length > 0) {
501
+ lines.push("**If this is your FIRST invocation in this session** (no prior context loaded):");
502
+ lines.push("");
503
+ for (const step of protocols.startup.first_session) {
504
+ lines.push(`- [ ] ${step}`);
505
+ }
506
+ lines.push("");
507
+ lines.push('Acknowledge: "Startup protocol complete. Full context loaded."');
508
+ lines.push("");
509
+ }
510
+ if (protocols.startup.subsequent && protocols.startup.subsequent.length > 0) {
511
+ lines.push("**If you have ALREADY loaded context in this session** (subsequent invocation):");
512
+ lines.push("");
513
+ for (const step of protocols.startup.subsequent) {
514
+ lines.push(`- [ ] ${step}`);
515
+ }
516
+ lines.push("");
517
+ lines.push('Acknowledge: "Context already loaded. Checked inbox for new messages."');
518
+ lines.push("");
519
+ }
520
+ lines.push("Then proceed with the task.");
521
+ lines.push("");
522
+ lines.push("---");
523
+ lines.push("");
524
+ }
525
+ function generateCompletionProtocolSection(agent, lines) {
526
+ const protocols = agent.protocols;
527
+ if (!protocols?.completion || protocols.completion.length === 0) return;
528
+ lines.push("## Before Finishing");
529
+ lines.push("");
530
+ lines.push("> **MANDATORY COMPLETION PROTOCOL** - Execute ALL steps before ending any task.");
531
+ lines.push("");
532
+ for (let i = 0; i < protocols.completion.length; i++) {
533
+ lines.push(`### ${i + 1}. ${protocols.completion[i]}`);
534
+ lines.push("");
535
+ }
536
+ lines.push('Acknowledge: "Completion protocol finished. Context updated."');
537
+ lines.push("");
538
+ lines.push("---");
539
+ lines.push("");
540
+ }
541
+ function generateLegacyContextSourcesSection(agent, lines) {
542
+ if (!agent.context_sources) return;
543
+ if (agent.knowledge_library) return;
544
+ lines.push("## Context Sources");
545
+ lines.push("");
546
+ if (agent.context_sources.shared && agent.context_sources.shared.length > 0) {
547
+ lines.push("### Shared");
548
+ lines.push("");
549
+ for (const source of agent.context_sources.shared) {
550
+ lines.push(`- ${source}`);
551
+ }
552
+ lines.push("");
553
+ }
554
+ if (agent.context_sources.personal && agent.context_sources.personal.length > 0) {
555
+ lines.push("### Personal");
556
+ lines.push("");
557
+ for (const source of agent.context_sources.personal) {
558
+ lines.push(`- ${source}`);
559
+ }
560
+ lines.push("");
561
+ }
562
+ }
386
563
  function generateAgentMarkdown(agent, mcpServers) {
387
564
  const lines = [];
388
565
  const tools = buildAgentTools(agent, mcpServers);
@@ -478,37 +655,11 @@ function generateAgentMarkdown(agent, mcpServers) {
478
655
  lines.push("");
479
656
  }
480
657
  }
481
- if (agent.context_sources) {
482
- lines.push("## Context Sources");
483
- lines.push("");
484
- if (agent.context_sources.shared && agent.context_sources.shared.length > 0) {
485
- lines.push("### Shared");
486
- lines.push("");
487
- for (const source of agent.context_sources.shared) {
488
- lines.push(`- ${source}`);
489
- }
490
- lines.push("");
491
- }
492
- if (agent.context_sources.personal && agent.context_sources.personal.length > 0) {
493
- lines.push("### Personal");
494
- lines.push("");
495
- for (const source of agent.context_sources.personal) {
496
- lines.push(`- ${source}`);
497
- }
498
- lines.push("");
499
- }
500
- }
501
- if (agent.communication) {
502
- lines.push("## Communication");
503
- lines.push("");
504
- if (agent.communication.inbox) {
505
- lines.push(`**Inbox:** ${agent.communication.inbox}`);
506
- }
507
- if (agent.communication.outbox) {
508
- lines.push(`**Outbox:** ${agent.communication.outbox}`);
509
- }
510
- lines.push("");
511
- }
658
+ generateKnowledgeLibrarySection(agent, lines);
659
+ generateCommunicationSection(agent, lines);
660
+ generateStartupProtocolSection(agent, lines);
661
+ generateCompletionProtocolSection(agent, lines);
662
+ generateLegacyContextSourcesSection(agent, lines);
512
663
  lines.push("---");
513
664
  lines.push("");
514
665
  lines.push("*Generated by CoreAI*");