cmp-standards 2.4.0 → 2.7.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 (97) hide show
  1. package/README.md +633 -611
  2. package/dist/cli/index.js +0 -0
  3. package/dist/db/drizzle-client.d.ts +3 -3
  4. package/dist/db/drizzle-client.d.ts.map +1 -1
  5. package/dist/db/drizzle-client.js +57 -58
  6. package/dist/db/drizzle-client.js.map +1 -1
  7. package/dist/db/turso-client.js +11 -11
  8. package/dist/eslint/rules/no-async-useeffect.js +6 -6
  9. package/dist/hooks/cloud-pre-tool-use.js +20 -20
  10. package/dist/hooks/cloud-session-start.d.ts +15 -3
  11. package/dist/hooks/cloud-session-start.d.ts.map +1 -1
  12. package/dist/hooks/cloud-session-start.js +135 -8
  13. package/dist/hooks/cloud-session-start.js.map +1 -1
  14. package/dist/hooks/session-start.d.ts +2 -1
  15. package/dist/hooks/session-start.d.ts.map +1 -1
  16. package/dist/hooks/session-start.js +99 -74
  17. package/dist/hooks/session-start.js.map +1 -1
  18. package/dist/index.d.ts +4 -0
  19. package/dist/index.d.ts.map +1 -1
  20. package/dist/index.js +4 -0
  21. package/dist/index.js.map +1 -1
  22. package/dist/mcp/server.js +2 -2
  23. package/dist/mcp/server.js.map +1 -1
  24. package/dist/schema/plans.d.ts +194 -0
  25. package/dist/schema/plans.d.ts.map +1 -0
  26. package/dist/schema/plans.js +180 -0
  27. package/dist/schema/plans.js.map +1 -0
  28. package/dist/schema/tracking.d.ts +90 -90
  29. package/dist/services/ContextGenerator.d.ts +16 -0
  30. package/dist/services/ContextGenerator.d.ts.map +1 -0
  31. package/dist/services/ContextGenerator.js +62 -0
  32. package/dist/services/ContextGenerator.js.map +1 -0
  33. package/dist/services/PlanManager.d.ts +99 -0
  34. package/dist/services/PlanManager.d.ts.map +1 -0
  35. package/dist/services/PlanManager.js +372 -0
  36. package/dist/services/PlanManager.js.map +1 -0
  37. package/dist/services/ProjectScaffold.js +76 -76
  38. package/dist/services/context-injector.d.ts +111 -0
  39. package/dist/services/context-injector.d.ts.map +1 -0
  40. package/dist/services/context-injector.js +397 -0
  41. package/dist/services/context-injector.js.map +1 -0
  42. package/dist/services/index.d.ts +15 -15
  43. package/dist/services/index.d.ts.map +1 -1
  44. package/dist/services/index.js +18 -20
  45. package/dist/services/index.js.map +1 -1
  46. package/dist/services/memory-router.d.ts +122 -0
  47. package/dist/services/memory-router.d.ts.map +1 -0
  48. package/dist/services/memory-router.js +517 -0
  49. package/dist/services/memory-router.js.map +1 -0
  50. package/dist/services/pattern-tracker.d.ts +97 -0
  51. package/dist/services/pattern-tracker.d.ts.map +1 -0
  52. package/dist/services/pattern-tracker.js +425 -0
  53. package/dist/services/pattern-tracker.js.map +1 -0
  54. package/dist/services/semantic-search.d.ts +33 -35
  55. package/dist/services/semantic-search.d.ts.map +1 -1
  56. package/dist/services/semantic-search.js +207 -165
  57. package/dist/services/semantic-search.js.map +1 -1
  58. package/dist/types/index.d.ts +329 -4
  59. package/dist/types/index.d.ts.map +1 -1
  60. package/dist/types/index.js +186 -9
  61. package/dist/types/index.js.map +1 -1
  62. package/package.json +104 -100
  63. package/standards/README.md +50 -50
  64. package/standards/experts/expert-routing.md +215 -215
  65. package/standards/general/code-quality.md +86 -86
  66. package/standards/general/memory-usage.md +205 -205
  67. package/standards/general/sync-workflow.md +235 -235
  68. package/standards/general/workflow.md +82 -82
  69. package/standards/hooks/mandatory-tracking.md +446 -446
  70. package/standards/infrastructure/cloud-database.md +287 -287
  71. package/standards/mcp/server-design.md +243 -243
  72. package/standards/mcp/tool-patterns.md +354 -354
  73. package/standards/skills/skill-structure.md +286 -286
  74. package/standards/skills/workflow-design.md +323 -323
  75. package/standards/tools/tool-design.md +297 -297
  76. package/templates/agents/architecture-expert.md +61 -61
  77. package/templates/agents/database-expert.md +62 -62
  78. package/templates/agents/documentation-expert.md +57 -57
  79. package/templates/agents/memory-expert.md +88 -88
  80. package/templates/agents/performance-expert.md +61 -61
  81. package/templates/agents/security-expert.md +59 -59
  82. package/templates/agents/ux-expert.md +63 -63
  83. package/templates/agents/worker.md +75 -75
  84. package/templates/ai-skills/SKILL_TEMPLATE.md +55 -55
  85. package/templates/claude-settings.json +72 -72
  86. package/templates/commands/experts.md +138 -138
  87. package/templates/hooks/README.md +158 -158
  88. package/templates/hooks/project.config.json.template +77 -77
  89. package/templates/hooks/settings.local.json.template +57 -57
  90. package/templates/memory-config.json +56 -56
  91. package/templates/memory-config.schema.json +212 -212
  92. package/templates/settings.json +58 -58
  93. package/templates/skills/continue.md +205 -205
  94. package/templates/workflows/business-improvement.md +264 -264
  95. package/templates/workflows/expert-review.md +153 -153
  96. package/templates/workflows/internal-app.md +245 -245
  97. package/templates/workflows/sync-docs.md +187 -187
@@ -17,10 +17,10 @@ export declare const ImprovementSchema: z.ZodObject<{
17
17
  implementedAt: z.ZodOptional<z.ZodString>;
18
18
  implementedInTask: z.ZodOptional<z.ZodString>;
19
19
  }, "strip", z.ZodTypeAny, {
20
+ title: string;
21
+ description: string;
20
22
  id: string;
21
23
  priority: "critical" | "high" | "medium" | "low";
22
- description: string;
23
- title: string;
24
24
  area: string;
25
25
  detectedAt: string;
26
26
  effort?: "medium" | "small" | "large" | "trivial" | undefined;
@@ -28,10 +28,10 @@ export declare const ImprovementSchema: z.ZodObject<{
28
28
  implementedAt?: string | undefined;
29
29
  implementedInTask?: string | undefined;
30
30
  }, {
31
+ title: string;
32
+ description: string;
31
33
  id: string;
32
34
  priority: "critical" | "high" | "medium" | "low";
33
- description: string;
34
- title: string;
35
35
  area: string;
36
36
  detectedAt: string;
37
37
  effort?: "medium" | "small" | "large" | "trivial" | undefined;
@@ -66,10 +66,10 @@ export declare const TaskContentSchema: z.ZodObject<{
66
66
  implementedAt: z.ZodOptional<z.ZodString>;
67
67
  implementedInTask: z.ZodOptional<z.ZodString>;
68
68
  }, "strip", z.ZodTypeAny, {
69
+ title: string;
70
+ description: string;
69
71
  id: string;
70
72
  priority: "critical" | "high" | "medium" | "low";
71
- description: string;
72
- title: string;
73
73
  area: string;
74
74
  detectedAt: string;
75
75
  effort?: "medium" | "small" | "large" | "trivial" | undefined;
@@ -77,10 +77,10 @@ export declare const TaskContentSchema: z.ZodObject<{
77
77
  implementedAt?: string | undefined;
78
78
  implementedInTask?: string | undefined;
79
79
  }, {
80
+ title: string;
81
+ description: string;
80
82
  id: string;
81
83
  priority: "critical" | "high" | "medium" | "low";
82
- description: string;
83
- title: string;
84
84
  area: string;
85
85
  detectedAt: string;
86
86
  effort?: "medium" | "small" | "large" | "trivial" | undefined;
@@ -91,15 +91,16 @@ export declare const TaskContentSchema: z.ZodObject<{
91
91
  lessons: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
92
92
  }, "strip", z.ZodTypeAny, {
93
93
  title: string;
94
+ domain: string;
95
+ sessionId: string;
94
96
  files: string[];
95
97
  startedAt: string;
96
- sessionId: string;
97
- plan: string[];
98
+ userRequest: string;
98
99
  improvements: {
100
+ title: string;
101
+ description: string;
99
102
  id: string;
100
103
  priority: "critical" | "high" | "medium" | "low";
101
- description: string;
102
- title: string;
103
104
  area: string;
104
105
  detectedAt: string;
105
106
  effort?: "medium" | "small" | "large" | "trivial" | undefined;
@@ -107,34 +108,32 @@ export declare const TaskContentSchema: z.ZodObject<{
107
108
  implementedAt?: string | undefined;
108
109
  implementedInTask?: string | undefined;
109
110
  }[];
110
- domain: string;
111
- userRequest: string;
111
+ plan: string[];
112
112
  currentStep: number;
113
113
  lastActivityAt: string;
114
114
  lessons: string[];
115
115
  description?: string | undefined;
116
- result?: "blocked" | "success" | "partial" | undefined;
117
116
  completedAt?: string | undefined;
117
+ result?: "blocked" | "success" | "partial" | undefined;
118
118
  agentId?: string | undefined;
119
119
  resultNotes?: string | undefined;
120
120
  }, {
121
121
  title: string;
122
- startedAt: string;
123
- sessionId: string;
124
- plan: string[];
125
122
  domain: string;
123
+ sessionId: string;
124
+ startedAt: string;
126
125
  userRequest: string;
126
+ plan: string[];
127
127
  currentStep: number;
128
128
  lastActivityAt: string;
129
129
  description?: string | undefined;
130
- result?: "blocked" | "success" | "partial" | undefined;
131
130
  files?: string[] | undefined;
132
131
  completedAt?: string | undefined;
133
132
  improvements?: {
133
+ title: string;
134
+ description: string;
134
135
  id: string;
135
136
  priority: "critical" | "high" | "medium" | "low";
136
- description: string;
137
- title: string;
138
137
  area: string;
139
138
  detectedAt: string;
140
139
  effort?: "medium" | "small" | "large" | "trivial" | undefined;
@@ -142,6 +141,7 @@ export declare const TaskContentSchema: z.ZodObject<{
142
141
  implementedAt?: string | undefined;
143
142
  implementedInTask?: string | undefined;
144
143
  }[] | undefined;
144
+ result?: "blocked" | "success" | "partial" | undefined;
145
145
  agentId?: string | undefined;
146
146
  resultNotes?: string | undefined;
147
147
  lessons?: string[] | undefined;
@@ -178,10 +178,10 @@ export declare const TaskSchema: z.ZodObject<{
178
178
  implementedAt: z.ZodOptional<z.ZodString>;
179
179
  implementedInTask: z.ZodOptional<z.ZodString>;
180
180
  }, "strip", z.ZodTypeAny, {
181
+ title: string;
182
+ description: string;
181
183
  id: string;
182
184
  priority: "critical" | "high" | "medium" | "low";
183
- description: string;
184
- title: string;
185
185
  area: string;
186
186
  detectedAt: string;
187
187
  effort?: "medium" | "small" | "large" | "trivial" | undefined;
@@ -189,10 +189,10 @@ export declare const TaskSchema: z.ZodObject<{
189
189
  implementedAt?: string | undefined;
190
190
  implementedInTask?: string | undefined;
191
191
  }, {
192
+ title: string;
193
+ description: string;
192
194
  id: string;
193
195
  priority: "critical" | "high" | "medium" | "low";
194
- description: string;
195
- title: string;
196
196
  area: string;
197
197
  detectedAt: string;
198
198
  effort?: "medium" | "small" | "large" | "trivial" | undefined;
@@ -203,15 +203,16 @@ export declare const TaskSchema: z.ZodObject<{
203
203
  lessons: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
204
204
  }, "strip", z.ZodTypeAny, {
205
205
  title: string;
206
+ domain: string;
207
+ sessionId: string;
206
208
  files: string[];
207
209
  startedAt: string;
208
- sessionId: string;
209
- plan: string[];
210
+ userRequest: string;
210
211
  improvements: {
212
+ title: string;
213
+ description: string;
211
214
  id: string;
212
215
  priority: "critical" | "high" | "medium" | "low";
213
- description: string;
214
- title: string;
215
216
  area: string;
216
217
  detectedAt: string;
217
218
  effort?: "medium" | "small" | "large" | "trivial" | undefined;
@@ -219,34 +220,32 @@ export declare const TaskSchema: z.ZodObject<{
219
220
  implementedAt?: string | undefined;
220
221
  implementedInTask?: string | undefined;
221
222
  }[];
222
- domain: string;
223
- userRequest: string;
223
+ plan: string[];
224
224
  currentStep: number;
225
225
  lastActivityAt: string;
226
226
  lessons: string[];
227
227
  description?: string | undefined;
228
- result?: "blocked" | "success" | "partial" | undefined;
229
228
  completedAt?: string | undefined;
229
+ result?: "blocked" | "success" | "partial" | undefined;
230
230
  agentId?: string | undefined;
231
231
  resultNotes?: string | undefined;
232
232
  }, {
233
233
  title: string;
234
- startedAt: string;
235
- sessionId: string;
236
- plan: string[];
237
234
  domain: string;
235
+ sessionId: string;
236
+ startedAt: string;
238
237
  userRequest: string;
238
+ plan: string[];
239
239
  currentStep: number;
240
240
  lastActivityAt: string;
241
241
  description?: string | undefined;
242
- result?: "blocked" | "success" | "partial" | undefined;
243
242
  files?: string[] | undefined;
244
243
  completedAt?: string | undefined;
245
244
  improvements?: {
245
+ title: string;
246
+ description: string;
246
247
  id: string;
247
248
  priority: "critical" | "high" | "medium" | "low";
248
- description: string;
249
- title: string;
250
249
  area: string;
251
250
  detectedAt: string;
252
251
  effort?: "medium" | "small" | "large" | "trivial" | undefined;
@@ -254,6 +253,7 @@ export declare const TaskSchema: z.ZodObject<{
254
253
  implementedAt?: string | undefined;
255
254
  implementedInTask?: string | undefined;
256
255
  }[] | undefined;
256
+ result?: "blocked" | "success" | "partial" | undefined;
257
257
  agentId?: string | undefined;
258
258
  resultNotes?: string | undefined;
259
259
  lessons?: string[] | undefined;
@@ -262,20 +262,23 @@ export declare const TaskSchema: z.ZodObject<{
262
262
  updatedAt: z.ZodString;
263
263
  }, "strip", z.ZodTypeAny, {
264
264
  system: string;
265
- id: string;
266
265
  type: "task";
267
266
  status: "in_progress" | "blocked" | "pending" | "completed";
267
+ id: string;
268
+ createdAt: string;
269
+ updatedAt: string;
268
270
  content: {
269
271
  title: string;
272
+ domain: string;
273
+ sessionId: string;
270
274
  files: string[];
271
275
  startedAt: string;
272
- sessionId: string;
273
- plan: string[];
276
+ userRequest: string;
274
277
  improvements: {
278
+ title: string;
279
+ description: string;
275
280
  id: string;
276
281
  priority: "critical" | "high" | "medium" | "low";
277
- description: string;
278
- title: string;
279
282
  area: string;
280
283
  detectedAt: string;
281
284
  effort?: "medium" | "small" | "large" | "trivial" | undefined;
@@ -283,42 +286,40 @@ export declare const TaskSchema: z.ZodObject<{
283
286
  implementedAt?: string | undefined;
284
287
  implementedInTask?: string | undefined;
285
288
  }[];
286
- domain: string;
287
- userRequest: string;
289
+ plan: string[];
288
290
  currentStep: number;
289
291
  lastActivityAt: string;
290
292
  lessons: string[];
291
293
  description?: string | undefined;
292
- result?: "blocked" | "success" | "partial" | undefined;
293
294
  completedAt?: string | undefined;
295
+ result?: "blocked" | "success" | "partial" | undefined;
294
296
  agentId?: string | undefined;
295
297
  resultNotes?: string | undefined;
296
298
  };
297
- createdAt: string;
298
- updatedAt: string;
299
299
  }, {
300
300
  system: string;
301
- id: string;
302
301
  type: "task";
303
302
  status: "in_progress" | "blocked" | "pending" | "completed";
303
+ id: string;
304
+ createdAt: string;
305
+ updatedAt: string;
304
306
  content: {
305
307
  title: string;
306
- startedAt: string;
307
- sessionId: string;
308
- plan: string[];
309
308
  domain: string;
309
+ sessionId: string;
310
+ startedAt: string;
310
311
  userRequest: string;
312
+ plan: string[];
311
313
  currentStep: number;
312
314
  lastActivityAt: string;
313
315
  description?: string | undefined;
314
- result?: "blocked" | "success" | "partial" | undefined;
315
316
  files?: string[] | undefined;
316
317
  completedAt?: string | undefined;
317
318
  improvements?: {
319
+ title: string;
320
+ description: string;
318
321
  id: string;
319
322
  priority: "critical" | "high" | "medium" | "low";
320
- description: string;
321
- title: string;
322
323
  area: string;
323
324
  detectedAt: string;
324
325
  effort?: "medium" | "small" | "large" | "trivial" | undefined;
@@ -326,12 +327,11 @@ export declare const TaskSchema: z.ZodObject<{
326
327
  implementedAt?: string | undefined;
327
328
  implementedInTask?: string | undefined;
328
329
  }[] | undefined;
330
+ result?: "blocked" | "success" | "partial" | undefined;
329
331
  agentId?: string | undefined;
330
332
  resultNotes?: string | undefined;
331
333
  lessons?: string[] | undefined;
332
334
  };
333
- createdAt: string;
334
- updatedAt: string;
335
335
  }>;
336
336
  export type Task = z.infer<typeof TaskSchema>;
337
337
  export type TaskContent = z.infer<typeof TaskContentSchema>;
@@ -353,9 +353,9 @@ export declare const ImprovementContentSchema: z.ZodObject<{
353
353
  rejectedAt: z.ZodOptional<z.ZodString>;
354
354
  rejectedReason: z.ZodOptional<z.ZodString>;
355
355
  }, "strip", z.ZodTypeAny, {
356
- priority: "critical" | "high" | "medium" | "low";
357
- description: string;
358
356
  title: string;
357
+ description: string;
358
+ priority: "critical" | "high" | "medium" | "low";
359
359
  area: string;
360
360
  detectedAt: string;
361
361
  detectedBy: string;
@@ -367,9 +367,9 @@ export declare const ImprovementContentSchema: z.ZodObject<{
367
367
  rejectedAt?: string | undefined;
368
368
  rejectedReason?: string | undefined;
369
369
  }, {
370
- priority: "critical" | "high" | "medium" | "low";
371
- description: string;
372
370
  title: string;
371
+ description: string;
372
+ priority: "critical" | "high" | "medium" | "low";
373
373
  area: string;
374
374
  detectedAt: string;
375
375
  detectedBy: string;
@@ -401,9 +401,9 @@ export declare const ImprovementRecordSchema: z.ZodObject<{
401
401
  rejectedAt: z.ZodOptional<z.ZodString>;
402
402
  rejectedReason: z.ZodOptional<z.ZodString>;
403
403
  }, "strip", z.ZodTypeAny, {
404
- priority: "critical" | "high" | "medium" | "low";
405
- description: string;
406
404
  title: string;
405
+ description: string;
406
+ priority: "critical" | "high" | "medium" | "low";
407
407
  area: string;
408
408
  detectedAt: string;
409
409
  detectedBy: string;
@@ -415,9 +415,9 @@ export declare const ImprovementRecordSchema: z.ZodObject<{
415
415
  rejectedAt?: string | undefined;
416
416
  rejectedReason?: string | undefined;
417
417
  }, {
418
- priority: "critical" | "high" | "medium" | "low";
419
- description: string;
420
418
  title: string;
419
+ description: string;
420
+ priority: "critical" | "high" | "medium" | "low";
421
421
  area: string;
422
422
  detectedAt: string;
423
423
  detectedBy: string;
@@ -433,13 +433,15 @@ export declare const ImprovementRecordSchema: z.ZodObject<{
433
433
  updatedAt: z.ZodString;
434
434
  }, "strip", z.ZodTypeAny, {
435
435
  system: string;
436
- id: string;
437
436
  type: "improvement";
438
437
  status: "in_progress" | "pending" | "implemented" | "rejected" | "deferred";
438
+ id: string;
439
+ createdAt: string;
440
+ updatedAt: string;
439
441
  content: {
440
- priority: "critical" | "high" | "medium" | "low";
441
- description: string;
442
442
  title: string;
443
+ description: string;
444
+ priority: "critical" | "high" | "medium" | "low";
443
445
  area: string;
444
446
  detectedAt: string;
445
447
  detectedBy: string;
@@ -451,17 +453,17 @@ export declare const ImprovementRecordSchema: z.ZodObject<{
451
453
  rejectedAt?: string | undefined;
452
454
  rejectedReason?: string | undefined;
453
455
  };
454
- createdAt: string;
455
- updatedAt: string;
456
456
  }, {
457
457
  system: string;
458
- id: string;
459
458
  type: "improvement";
460
459
  status: "in_progress" | "pending" | "implemented" | "rejected" | "deferred";
460
+ id: string;
461
+ createdAt: string;
462
+ updatedAt: string;
461
463
  content: {
462
- priority: "critical" | "high" | "medium" | "low";
463
- description: string;
464
464
  title: string;
465
+ description: string;
466
+ priority: "critical" | "high" | "medium" | "low";
465
467
  area: string;
466
468
  detectedAt: string;
467
469
  detectedBy: string;
@@ -473,8 +475,6 @@ export declare const ImprovementRecordSchema: z.ZodObject<{
473
475
  rejectedAt?: string | undefined;
474
476
  rejectedReason?: string | undefined;
475
477
  };
476
- createdAt: string;
477
- updatedAt: string;
478
478
  }>;
479
479
  export type ImprovementRecord = z.infer<typeof ImprovementRecordSchema>;
480
480
  export type ImprovementContent = z.infer<typeof ImprovementContentSchema>;
@@ -495,8 +495,8 @@ export declare const SessionContentSchema: z.ZodObject<{
495
495
  improvementsDetected: z.ZodDefault<z.ZodNumber>;
496
496
  }, "strip", z.ZodTypeAny, {
497
497
  system: string;
498
- startedAt: string;
499
498
  sessionId: string;
499
+ startedAt: string;
500
500
  toolCalls: number;
501
501
  lastActivityAt: string;
502
502
  tasksStarted: number;
@@ -508,11 +508,11 @@ export declare const SessionContentSchema: z.ZodObject<{
508
508
  ide?: string | undefined;
509
509
  }, {
510
510
  system: string;
511
- startedAt: string;
512
511
  sessionId: string;
512
+ startedAt: string;
513
513
  lastActivityAt: string;
514
- endedAt?: string | undefined;
515
514
  toolCalls?: number | undefined;
515
+ endedAt?: string | undefined;
516
516
  userId?: string | undefined;
517
517
  projectPath?: string | undefined;
518
518
  ide?: string | undefined;
@@ -540,8 +540,8 @@ export declare const SessionSchema: z.ZodObject<{
540
540
  improvementsDetected: z.ZodDefault<z.ZodNumber>;
541
541
  }, "strip", z.ZodTypeAny, {
542
542
  system: string;
543
- startedAt: string;
544
543
  sessionId: string;
544
+ startedAt: string;
545
545
  toolCalls: number;
546
546
  lastActivityAt: string;
547
547
  tasksStarted: number;
@@ -553,11 +553,11 @@ export declare const SessionSchema: z.ZodObject<{
553
553
  ide?: string | undefined;
554
554
  }, {
555
555
  system: string;
556
- startedAt: string;
557
556
  sessionId: string;
557
+ startedAt: string;
558
558
  lastActivityAt: string;
559
- endedAt?: string | undefined;
560
559
  toolCalls?: number | undefined;
560
+ endedAt?: string | undefined;
561
561
  userId?: string | undefined;
562
562
  projectPath?: string | undefined;
563
563
  ide?: string | undefined;
@@ -569,13 +569,15 @@ export declare const SessionSchema: z.ZodObject<{
569
569
  updatedAt: z.ZodString;
570
570
  }, "strip", z.ZodTypeAny, {
571
571
  system: string;
572
- id: string;
573
572
  type: "session";
574
573
  status: "active" | "ended";
574
+ id: string;
575
+ createdAt: string;
576
+ updatedAt: string;
575
577
  content: {
576
578
  system: string;
577
- startedAt: string;
578
579
  sessionId: string;
580
+ startedAt: string;
579
581
  toolCalls: number;
580
582
  lastActivityAt: string;
581
583
  tasksStarted: number;
@@ -586,20 +588,20 @@ export declare const SessionSchema: z.ZodObject<{
586
588
  projectPath?: string | undefined;
587
589
  ide?: string | undefined;
588
590
  };
589
- createdAt: string;
590
- updatedAt: string;
591
591
  }, {
592
592
  system: string;
593
- id: string;
594
593
  type: "session";
595
594
  status: "active" | "ended";
595
+ id: string;
596
+ createdAt: string;
597
+ updatedAt: string;
596
598
  content: {
597
599
  system: string;
598
- startedAt: string;
599
600
  sessionId: string;
601
+ startedAt: string;
600
602
  lastActivityAt: string;
601
- endedAt?: string | undefined;
602
603
  toolCalls?: number | undefined;
604
+ endedAt?: string | undefined;
603
605
  userId?: string | undefined;
604
606
  projectPath?: string | undefined;
605
607
  ide?: string | undefined;
@@ -607,8 +609,6 @@ export declare const SessionSchema: z.ZodObject<{
607
609
  tasksCompleted?: number | undefined;
608
610
  improvementsDetected?: number | undefined;
609
611
  };
610
- createdAt: string;
611
- updatedAt: string;
612
612
  }>;
613
613
  export type Session = z.infer<typeof SessionSchema>;
614
614
  export type SessionContent = z.infer<typeof SessionContentSchema>;
@@ -0,0 +1,16 @@
1
+ /**
2
+ * Context Generator Service
3
+ *
4
+ * Generates fresh context from the database for LLM agents.
5
+ * Updates GEMINI.md or CLAUDE.md with recent memories and tasks.
6
+ */
7
+ import type { DrizzleMemoryClient } from "../db/drizzle-client.js";
8
+ export declare class ContextGenerator {
9
+ private client;
10
+ constructor(client: DrizzleMemoryClient);
11
+ /**
12
+ * Update a markdown file with fresh database context
13
+ */
14
+ generateContext(filePath: string): Promise<boolean>;
15
+ }
16
+ //# sourceMappingURL=ContextGenerator.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ContextGenerator.d.ts","sourceRoot":"","sources":["../../src/services/ContextGenerator.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAIH,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAC;AAEnE,qBAAa,gBAAgB;IAC3B,OAAO,CAAC,MAAM,CAAsB;gBAExB,MAAM,EAAE,mBAAmB;IAIvC;;OAEG;IACG,eAAe,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;CAmD1D"}
@@ -0,0 +1,62 @@
1
+ /**
2
+ * Context Generator Service
3
+ *
4
+ * Generates fresh context from the database for LLM agents.
5
+ * Updates GEMINI.md or CLAUDE.md with recent memories and tasks.
6
+ */
7
+ import fs from "fs/promises";
8
+ export class ContextGenerator {
9
+ client;
10
+ constructor(client) {
11
+ this.client = client;
12
+ }
13
+ /**
14
+ * Update a markdown file with fresh database context
15
+ */
16
+ async generateContext(filePath) {
17
+ try {
18
+ const [tasks, memories] = await Promise.all([
19
+ this.client.list({ type: "task", status: "in_progress", limit: 5 }),
20
+ this.client.list({ type: "memory", limit: 10 }),
21
+ ]);
22
+ const tasksMd = tasks
23
+ .map((t) => {
24
+ const c = t.content;
25
+ return `- [TASK] ${c.title || t.id}`;
26
+ })
27
+ .join("\n");
28
+ const memoriesMd = memories
29
+ .map((m) => {
30
+ const c = m.content;
31
+ return `- ${c.body || c.title} (${new Date(m.createdAt).toLocaleDateString()})`;
32
+ })
33
+ .join("\n");
34
+ let content = "";
35
+ try {
36
+ content = await fs.readFile(filePath, "utf-8");
37
+ }
38
+ catch {
39
+ content = "# Project Context\n\n";
40
+ }
41
+ const splitMarker = "## Hive Mind Context";
42
+ if (content.includes(splitMarker)) {
43
+ content = content.split(splitMarker)[0];
44
+ }
45
+ const freshContext = `
46
+ ${splitMarker}
47
+ ### Active Tasks
48
+ ${tasksMd || "- No active tasks."}
49
+
50
+ ### Recent Memories
51
+ ${memoriesMd || "- No recent memories."}
52
+ `;
53
+ await fs.writeFile(filePath, content + freshContext, "utf-8");
54
+ return true;
55
+ }
56
+ catch (error) {
57
+ console.error("[ContextGenerator] Error:", error);
58
+ return false;
59
+ }
60
+ }
61
+ }
62
+ //# sourceMappingURL=ContextGenerator.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ContextGenerator.js","sourceRoot":"","sources":["../../src/services/ContextGenerator.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,MAAM,aAAa,CAAC;AAI7B,MAAM,OAAO,gBAAgB;IACnB,MAAM,CAAsB;IAEpC,YAAY,MAA2B;QACrC,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;IACvB,CAAC;IAED;;OAEG;IACH,KAAK,CAAC,eAAe,CAAC,QAAgB;QACpC,IAAI,CAAC;YACH,MAAM,CAAC,KAAK,EAAE,QAAQ,CAAC,GAAG,MAAM,OAAO,CAAC,GAAG,CAAC;gBAC1C,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,aAAa,EAAE,KAAK,EAAE,CAAC,EAAE,CAAC;gBACnE,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,QAAQ,EAAE,KAAK,EAAE,EAAE,EAAE,CAAC;aAChD,CAAC,CAAC;YAEH,MAAM,OAAO,GAAG,KAAK;iBAClB,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE;gBACT,MAAM,CAAC,GAAG,CAAC,CAAC,OAAkC,CAAC;gBAC/C,OAAO,YAAY,CAAC,CAAC,KAAK,IAAI,CAAC,CAAC,EAAE,EAAE,CAAC;YACvC,CAAC,CAAC;iBACD,IAAI,CAAC,IAAI,CAAC,CAAC;YAEd,MAAM,UAAU,GAAG,QAAQ;iBACxB,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE;gBACT,MAAM,CAAC,GAAG,CAAC,CAAC,OAAkC,CAAC;gBAC/C,OAAO,KAAK,CAAC,CAAC,IAAI,IAAI,CAAC,CAAC,KAAK,KAAK,IAAI,IAAI,CACxC,CAAC,CAAC,SAAU,CACb,CAAC,kBAAkB,EAAE,GAAG,CAAC;YAC5B,CAAC,CAAC;iBACD,IAAI,CAAC,IAAI,CAAC,CAAC;YAEd,IAAI,OAAO,GAAG,EAAE,CAAC;YACjB,IAAI,CAAC;gBACH,OAAO,GAAG,MAAM,EAAE,CAAC,QAAQ,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC;YACjD,CAAC;YAAC,MAAM,CAAC;gBACP,OAAO,GAAG,uBAAuB,CAAC;YACpC,CAAC;YAED,MAAM,WAAW,GAAG,sBAAsB,CAAC;YAC3C,IAAI,OAAO,CAAC,QAAQ,CAAC,WAAW,CAAC,EAAE,CAAC;gBAClC,OAAO,GAAG,OAAO,CAAC,KAAK,CAAC,WAAW,CAAC,CAAC,CAAC,CAAE,CAAC;YAC3C,CAAC;YAED,MAAM,YAAY,GAAG;EACzB,WAAW;;EAEX,OAAO,IAAI,oBAAoB;;;EAG/B,UAAU,IAAI,uBAAuB;CACtC,CAAC;YAEI,MAAM,EAAE,CAAC,SAAS,CAAC,QAAQ,EAAE,OAAO,GAAG,YAAY,EAAE,OAAO,CAAC,CAAC;YAC9D,OAAO,IAAI,CAAC;QACd,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,OAAO,CAAC,KAAK,CAAC,2BAA2B,EAAE,KAAK,CAAC,CAAC;YAClD,OAAO,KAAK,CAAC;QACf,CAAC;IACH,CAAC;CACF"}
@@ -0,0 +1,99 @@
1
+ /**
2
+ * @file PlanManager Service
3
+ * @description Gestiona planes de trabajo con checkpoints para continuidad multi-agente.
4
+ *
5
+ * Características:
6
+ * - Detección de planes similares al iniciar sesión
7
+ * - Checkpoints incrementales para save points
8
+ * - Soporte para merge de planes
9
+ * - Historial navegable
10
+ *
11
+ * @version 1.0.0
12
+ */
13
+ import { type Plan, type PlanCheckpoint, type PlanMatch, type PlanStatus, type CheckpointType } from '../schema/plans.js';
14
+ import type { DevSystem } from '../types/index.js';
15
+ export interface CreatePlanOptions {
16
+ title: string;
17
+ description?: string;
18
+ originalPrompt: string;
19
+ domain?: string;
20
+ keywords?: string[];
21
+ }
22
+ export interface FindSimilarOptions {
23
+ prompt: string;
24
+ domain?: string;
25
+ limit?: number;
26
+ minSimilarity?: number;
27
+ }
28
+ export interface AddCheckpointOptions {
29
+ checkpointType: CheckpointType;
30
+ summary: string;
31
+ decisions?: PlanCheckpoint['decisions'];
32
+ nextSteps?: string[];
33
+ filesModified?: string[];
34
+ }
35
+ export declare class PlanManager {
36
+ private client;
37
+ private system;
38
+ private currentSessionId;
39
+ private agentId;
40
+ constructor(system: DevSystem, options?: {
41
+ sessionId?: string;
42
+ agentId?: string;
43
+ });
44
+ /**
45
+ * Crear un nuevo plan
46
+ */
47
+ create(options: CreatePlanOptions): Promise<Plan>;
48
+ /**
49
+ * Obtener plan por ID con validación Zod
50
+ */
51
+ get(planId: string): Promise<Plan | null>;
52
+ /**
53
+ * Obtener todos los planes activos
54
+ */
55
+ getActive(): Promise<Plan[]>;
56
+ /**
57
+ * Buscar planes similares a un prompt (optimizado para evitar N+1 queries)
58
+ */
59
+ findSimilar(options: FindSimilarOptions): Promise<PlanMatch[]>;
60
+ /**
61
+ * Actualizar estado del plan
62
+ */
63
+ updateStatus(planId: string, status: PlanStatus): Promise<void>;
64
+ /**
65
+ * Mergear dos planes
66
+ */
67
+ merge(targetPlanId: string, sourcePlanId: string): Promise<void>;
68
+ /**
69
+ * Agregar checkpoint a un plan
70
+ */
71
+ addCheckpoint(planId: string, options: AddCheckpointOptions): Promise<PlanCheckpoint>;
72
+ /**
73
+ * Obtener checkpoints de un plan con validación Zod
74
+ */
75
+ getCheckpoints(planId: string, limit?: number): Promise<PlanCheckpoint[]>;
76
+ /**
77
+ * Obtener último checkpoint de un plan
78
+ */
79
+ getLastCheckpoint(planId: string): Promise<PlanCheckpoint | null>;
80
+ /**
81
+ * Generar contexto de planes para session start
82
+ */
83
+ getSessionContext(currentPrompt?: string): Promise<string>;
84
+ }
85
+ /**
86
+ * Obtener o crear instancia de PlanManager
87
+ */
88
+ export declare function getPlanManager(system: DevSystem, options?: {
89
+ sessionId?: string;
90
+ agentId?: string;
91
+ }): PlanManager;
92
+ /**
93
+ * Crear nueva instancia de PlanManager
94
+ */
95
+ export declare function createPlanManager(system: DevSystem, options?: {
96
+ sessionId?: string;
97
+ agentId?: string;
98
+ }): PlanManager;
99
+ //# sourceMappingURL=PlanManager.d.ts.map