@evo-dev/core 0.0.1-alpha.1 → 0.0.1-alpha.10

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 (66) hide show
  1. package/assets/skills/coding/knowledge-distillation/SKILL.md +117 -114
  2. package/assets/skills/coding/knowledge-distillation/references/knowledge-distillation-methods.md +11 -7
  3. package/assets/team/agents/code-reviewer.md +48 -0
  4. package/assets/team/agents/docs-maintainer.md +51 -0
  5. package/assets/team/agents/implementation-engineer.md +51 -0
  6. package/assets/team/agents/product-scope-analyst.md +58 -0
  7. package/assets/team/agents/release-engineer.md +55 -0
  8. package/assets/team/agents/security-boundary-reviewer.md +50 -0
  9. package/assets/team/agents/solution-architect.md +51 -0
  10. package/assets/team/agents/verification-engineer.md +51 -0
  11. package/assets/team/team.md +102 -0
  12. package/dist/config/index.js +925 -97
  13. package/dist/index.js +13107 -5618
  14. package/package.json +5 -1
  15. package/src/agents/index.ts +56 -264
  16. package/src/code-agent-traces/index.ts +520 -0
  17. package/src/config/index.ts +5 -0
  18. package/src/config/paths.ts +1 -1
  19. package/src/config/settings.ts +149 -0
  20. package/src/config/store.ts +2 -0
  21. package/src/daemon/index.ts +99 -50
  22. package/src/evolution/candidates/index.ts +564 -0
  23. package/src/evolution/control/index.ts +20 -0
  24. package/src/evolution/evidence/analysis.ts +533 -0
  25. package/src/evolution/evidence/index.ts +3 -0
  26. package/src/evolution/evidence/session-memory/analysis.ts +281 -0
  27. package/src/evolution/evidence/session-memory/constants.ts +9 -0
  28. package/src/evolution/evidence/session-memory/index.ts +7 -0
  29. package/src/evolution/evidence/session-memory/paths.ts +29 -0
  30. package/src/evolution/evidence/session-memory/policy.ts +39 -0
  31. package/src/evolution/evidence/session-memory/segment.ts +202 -0
  32. package/src/evolution/evidence/session-memory/sensitivity.ts +335 -0
  33. package/src/evolution/evidence/session-memory/state-machine.ts +249 -0
  34. package/src/evolution/evidence/session-memory/storage.ts +379 -0
  35. package/src/evolution/evidence/session-memory/types.ts +221 -0
  36. package/src/evolution/evidence/session-memory/updater.ts +191 -0
  37. package/src/evolution/formatters.ts +169 -0
  38. package/src/evolution/index.ts +16 -2356
  39. package/src/evolution/knowledge/index.ts +5427 -0
  40. package/src/evolution/paths.ts +44 -0
  41. package/src/evolution/processor/distillation.ts +518 -0
  42. package/src/evolution/processor/index.ts +3 -0
  43. package/src/evolution/processor/process.ts +528 -0
  44. package/src/{learning → evolution/review}/index.ts +10 -14
  45. package/src/evolution/schema.ts +568 -0
  46. package/src/evolution/shared.ts +758 -0
  47. package/src/evolution/triggers/classification.ts +102 -0
  48. package/src/evolution/triggers/index.ts +295 -0
  49. package/src/hooks/index.ts +438 -179
  50. package/src/index.ts +12 -3
  51. package/src/projects/index.ts +453 -0
  52. package/src/runtime-logs/index.ts +490 -24
  53. package/src/team/index.ts +1429 -185
  54. package/src/team/mcp.ts +9 -5
  55. package/src/team/prompts.ts +141 -0
  56. package/src/utils/errors.ts +13 -0
  57. package/src/utils/fs.ts +40 -0
  58. package/src/utils/hash.ts +9 -0
  59. package/src/utils/ids.ts +12 -0
  60. package/src/utils/index.ts +7 -0
  61. package/src/utils/parsing.ts +11 -0
  62. package/src/utils/text.ts +18 -0
  63. package/src/utils/time.ts +5 -0
  64. package/src/workflow/index.ts +3 -21
  65. package/src/project/index.ts +0 -507
  66. package/src/task/index.ts +0 -840
@@ -0,0 +1,568 @@
1
+ import type { SessionEvidenceSegmentV1 } from "./evidence/session-memory/types.ts";
2
+ import type { OkfKnowledgeActivationResult, OkfKnowledgePlan } from "./knowledge/index.ts";
3
+
4
+ export type EvolutionEvidenceSourceKind =
5
+ | "evodev-execution-event"
6
+ | "team-agent-trace"
7
+ | "session-trace"
8
+ | "session-memory-segment"
9
+ | "verification"
10
+ | "review-summary"
11
+ | "user-feedback"
12
+ | "code-agent-trace-ref";
13
+
14
+ export type EvolutionEvidenceEventKind =
15
+ | "trace"
16
+ | "tool-call"
17
+ | "skill-call"
18
+ | "subagent"
19
+ | "verification"
20
+ | "review"
21
+ | "user-feedback"
22
+ | "error"
23
+ | "run-state";
24
+
25
+ export type EvolutionNormalizedEventType =
26
+ | "SessionStart"
27
+ | "UserPromptSubmit"
28
+ | "UserPromptExpansion"
29
+ | "PreToolUse"
30
+ | "PermissionRequest"
31
+ | "PostToolUse"
32
+ | "PostToolUseFailure"
33
+ | "PostToolBatch"
34
+ | "PermissionDenied"
35
+ | "SubagentStart"
36
+ | "Stop"
37
+ | "StopFailure"
38
+ | "TeammateIdle"
39
+ | "SubagentStop"
40
+ | "TaskCreated"
41
+ | "TaskCompleted"
42
+ | "PreCompact"
43
+ | "PostCompact"
44
+ | "SessionEnd"
45
+ | "ConfigChange"
46
+ | "CwdChanged"
47
+ | "FileChanged"
48
+ | "WorktreeCreate"
49
+ | "WorktreeRemove"
50
+ | "unknown";
51
+
52
+ export type EvolutionTriggerStrength = "none" | "conditional" | "strong";
53
+ export type EvolutionTriggerReason =
54
+ | "none"
55
+ | "turn-completed"
56
+ | "task-completed"
57
+ | "session-ended"
58
+ | "role-completed"
59
+ | "stop-failure"
60
+ | "tool-failure"
61
+ | "permission-denied"
62
+ | "explicit-command"
63
+ | "failure-signal";
64
+
65
+ export type EvolutionEpisodeKind = "session" | "turn" | "task" | "role";
66
+ export type EvolutionEpisodeStatus = "open" | "closed" | "failed";
67
+ export type EvolutionTriggerStatus = "pending" | "processing" | "consumed" | "failed" | "skipped";
68
+ export type SegmentEvolutionTriggerReason =
69
+ | "session-memory-init"
70
+ | "session-memory-threshold"
71
+ | "intent-refinement"
72
+ | "user-interruption"
73
+ | "failure-signal"
74
+ | "permission-denied"
75
+ | "verification-after-fix"
76
+ | "explicit-memory-intent";
77
+ export type SegmentEvolutionTriggerStrength = "normal" | "strong";
78
+
79
+ export type EvolutionKnowledgeKind =
80
+ | "run-summary"
81
+ | "lesson"
82
+ | "rule"
83
+ | "workflow-hint"
84
+ | "skill-gap"
85
+ | "role-note"
86
+ | "verification-pattern";
87
+
88
+ export type EvolutionReviewState =
89
+ | "auto-accepted"
90
+ | "auto-stored/unreviewed"
91
+ | "needs-human"
92
+ | "accepted"
93
+ | "rejected"
94
+ | "deferred"
95
+ | "stale"
96
+ | "deprecated"
97
+ | "superseded"
98
+ | "revoked";
99
+
100
+ export type EvolutionAuthority = "contextual" | "reviewed";
101
+ export type EvolutionConfidence = "low" | "medium" | "high";
102
+
103
+ export type EvolutionProposalKind =
104
+ | "skill"
105
+ | "rule"
106
+ | "role-agent"
107
+ | "team"
108
+ | "ci"
109
+ | "test"
110
+ | "docs"
111
+ | "engineering-practice";
112
+
113
+ export interface EvolutionPrivacyFields {
114
+ classification: "local-private";
115
+ rawPromptsStored: false;
116
+ rawLogsStored: false;
117
+ sourceDumpsStored: false;
118
+ rawCommandOutputStored: false;
119
+ secretsStored: false;
120
+ internalLinksStored: boolean;
121
+ }
122
+
123
+ export interface EvolutionEvidenceWindow {
124
+ schemaVersion: 1;
125
+ id: string;
126
+ kind: "evidence-window";
127
+ projectKey: string;
128
+ runId: string;
129
+ taskId: string | null;
130
+ createdAt: string;
131
+ sourceRefs: EvolutionEvidenceSourceRef[];
132
+ events: EvolutionEvidenceEvent[];
133
+ episodes: EvolutionEpisode[];
134
+ triggerPolicy: EvolutionTriggerPolicy;
135
+ privacy: EvolutionPrivacyFields;
136
+ }
137
+
138
+ export interface EvolutionEvidenceSourceRef {
139
+ id: string;
140
+ kind: EvolutionEvidenceSourceKind;
141
+ path: string;
142
+ roleId: string | null;
143
+ rawContentStored: false;
144
+ externalContentCopied: false;
145
+ }
146
+
147
+ export interface EvolutionEvidenceEvent {
148
+ id: string;
149
+ kind: EvolutionEvidenceEventKind;
150
+ eventType: EvolutionNormalizedEventType;
151
+ hookEventId: string | null;
152
+ occurredAt: string | null;
153
+ summary: string;
154
+ roleId: string | null;
155
+ taskId: string | null;
156
+ evidenceRef: string;
157
+ episodeIds: string[];
158
+ triggerStrength: EvolutionTriggerStrength;
159
+ triggerReason: EvolutionTriggerReason;
160
+ rawContentStored: false;
161
+ }
162
+
163
+ export interface EvolutionEpisode {
164
+ id: string;
165
+ kind: EvolutionEpisodeKind;
166
+ status: EvolutionEpisodeStatus;
167
+ roleId: string | null;
168
+ taskId: string | null;
169
+ startedAt: string | null;
170
+ endedAt: string | null;
171
+ eventIds: string[];
172
+ triggerStrength: EvolutionTriggerStrength;
173
+ triggerReason: EvolutionTriggerReason;
174
+ summary: string;
175
+ rawContentStored: false;
176
+ }
177
+
178
+ export interface EvolutionTriggerPolicy {
179
+ strongest: EvolutionTriggerStrength;
180
+ reasons: EvolutionTriggerReason[];
181
+ distillRecommended: boolean;
182
+ evidenceSignals: {
183
+ failures: number;
184
+ verifications: number;
185
+ roleLifecycle: number;
186
+ skillCalls: number;
187
+ };
188
+ }
189
+
190
+ export interface EvolutionTriggerRecord {
191
+ schemaVersion: 1;
192
+ id: string;
193
+ kind: "evolution-trigger";
194
+ projectKey: string;
195
+ runId: string;
196
+ roleId: string | null;
197
+ taskId: string | null;
198
+ eventType: EvolutionNormalizedEventType;
199
+ eventId: string | null;
200
+ evidenceRef: string | null;
201
+ summary: string;
202
+ triggerStrength: EvolutionTriggerStrength;
203
+ triggerReason: EvolutionTriggerReason;
204
+ status: EvolutionTriggerStatus;
205
+ attempts: number;
206
+ createdAt: string;
207
+ updatedAt: string;
208
+ processedBatchId: string | null;
209
+ lastError: string | null;
210
+ rawContentStored: false;
211
+ privacy: EvolutionPrivacyFields;
212
+ }
213
+
214
+ export interface SegmentEvolutionTriggerRecord {
215
+ schemaVersion: 1;
216
+ id: string;
217
+ kind: "segment-evolution-trigger";
218
+ projectKey: string;
219
+ sessionKey: string;
220
+ runId: string | null;
221
+ roleId: string | null;
222
+ segmentId: string;
223
+ segmentPath: string;
224
+ strength: SegmentEvolutionTriggerStrength;
225
+ reason: SegmentEvolutionTriggerReason;
226
+ summary: string;
227
+ status: EvolutionTriggerStatus;
228
+ attempts: number;
229
+ createdAt: string;
230
+ updatedAt: string;
231
+ processedBatchId: string | null;
232
+ lastError: string | null;
233
+ rawContentStored: false;
234
+ }
235
+
236
+ export interface EvolutionTriggerDecision {
237
+ eventType: EvolutionNormalizedEventType;
238
+ strength: EvolutionTriggerStrength;
239
+ reason: EvolutionTriggerReason;
240
+ shouldQueue: boolean;
241
+ summary: string;
242
+ }
243
+
244
+ export interface EvolutionKnowledgeRecord {
245
+ schemaVersion: 1;
246
+ id: string;
247
+ kind: EvolutionKnowledgeKind;
248
+ title: string;
249
+ projectKey: string;
250
+ summary: string;
251
+ body: string;
252
+ roleTags: string[];
253
+ tags: string[];
254
+ reviewState: EvolutionReviewState;
255
+ authority: EvolutionAuthority;
256
+ confidence: EvolutionConfidence;
257
+ provenance: {
258
+ runId: string;
259
+ taskId: string | null;
260
+ evidenceWindowId: string;
261
+ sourceRefs: string[];
262
+ createdAt: string;
263
+ createdBy: "evodev";
264
+ rawLogsStored: false;
265
+ rawPromptsStored: false;
266
+ sourceDumpsStored: false;
267
+ rawCommandOutputStored: false;
268
+ };
269
+ relations: {
270
+ relatedKnowledgeIds: string[];
271
+ evosCaseIds: string[];
272
+ proposalIds: string[];
273
+ supersedes: string[];
274
+ };
275
+ privacy: EvolutionPrivacyFields;
276
+ runtime: {
277
+ canLoad: boolean;
278
+ hardBlocking: false;
279
+ };
280
+ }
281
+
282
+ export interface EvolutionKnowledgeReviewHistoryRecord {
283
+ version: 1;
284
+ kind: "evolution-knowledge-review-state-changed";
285
+ knowledgeId: string;
286
+ projectKey: string;
287
+ roleTags: string[];
288
+ artifactCreatedAt: string;
289
+ previousReviewState: EvolutionReviewState;
290
+ nextReviewState: EvolutionReviewState;
291
+ changedAt: string;
292
+ metadataOnly: true;
293
+ }
294
+
295
+ export interface EvolutionEvosCase {
296
+ schemaVersion: 1;
297
+ id: string;
298
+ kind: "evos-case";
299
+ projectKey: string;
300
+ title: string;
301
+ roleTags: string[];
302
+ tags: string[];
303
+ reviewState: EvolutionReviewState;
304
+ confidence: EvolutionConfidence;
305
+ trigger: {
306
+ kind: "task-completion" | "plan-task-completion" | "session-completion" | "manual";
307
+ summary: string;
308
+ };
309
+ intervention: {
310
+ summary: string;
311
+ roleIds: string[];
312
+ };
313
+ result: {
314
+ summary: string;
315
+ verificationSignals: string[];
316
+ };
317
+ expectedFutureBehavior: string;
318
+ provenance: {
319
+ runId: string;
320
+ taskId: string | null;
321
+ evidenceWindowId: string;
322
+ sourceRefs: string[];
323
+ createdAt: string;
324
+ createdBy: "evodev";
325
+ rawLogsStored: false;
326
+ rawPromptsStored: false;
327
+ sourceDumpsStored: false;
328
+ rawCommandOutputStored: false;
329
+ };
330
+ privacy: EvolutionPrivacyFields;
331
+ }
332
+
333
+ export interface EvolutionRepoProposal {
334
+ schemaVersion: 1;
335
+ id: string;
336
+ kind: EvolutionProposalKind;
337
+ projectKey: string;
338
+ title: string;
339
+ summary: string;
340
+ rationale: string;
341
+ roleTags: string[];
342
+ tags: string[];
343
+ reviewState: "pending" | "accepted" | "rejected" | "deferred" | "applied";
344
+ reviewStateChangedAt?: string;
345
+ confidence: EvolutionConfidence;
346
+ targetRepoPath: string | null;
347
+ plannedFiles: Array<{
348
+ relativePath: string;
349
+ action: "create" | "update";
350
+ reason: string;
351
+ proposedChange?: string;
352
+ }>;
353
+ lastDecision?: {
354
+ state: "accepted" | "rejected" | "deferred";
355
+ reason: string | null;
356
+ decidedAt: string;
357
+ };
358
+ apply: {
359
+ autoApply: false;
360
+ requiresExplicitCommand: true;
361
+ rollbackPlan: string;
362
+ };
363
+ provenance: {
364
+ runId: string;
365
+ taskId: string | null;
366
+ evidenceWindowId: string;
367
+ sourceRefs: string[];
368
+ createdAt: string;
369
+ createdBy: "evodev";
370
+ rawLogsStored: false;
371
+ rawPromptsStored: false;
372
+ sourceDumpsStored: false;
373
+ rawCommandOutputStored: false;
374
+ };
375
+ privacy: EvolutionPrivacyFields;
376
+ }
377
+
378
+ export interface EvolutionReviewCandidate {
379
+ schemaVersion: 1;
380
+ kind: "evolution-review-candidate";
381
+ id: string;
382
+ projectKey: string;
383
+ runId: string;
384
+ createdAt: string;
385
+ candidateKind: string;
386
+ title: string;
387
+ targetStore: string;
388
+ targetPath: string;
389
+ stableKey: string;
390
+ reviewState: "needs-human" | "accepted" | "rejected" | "deferred";
391
+ reviewStateChangedAt?: string;
392
+ reasons: string[];
393
+ candidate: unknown;
394
+ provenance: {
395
+ runId: string;
396
+ evidenceWindowId: string;
397
+ evidenceRefs: string[];
398
+ createdBy: "evodev";
399
+ rawLogsStored: false;
400
+ rawPromptsStored: false;
401
+ sourceDumpsStored: false;
402
+ rawCommandOutputStored: false;
403
+ };
404
+ privacy: EvolutionPrivacyFields;
405
+ }
406
+
407
+ export interface EvolutionDistillationBatch {
408
+ schemaVersion: 1;
409
+ id: string;
410
+ projectKey: string;
411
+ runId: string;
412
+ createdAt: string;
413
+ evidenceWindow: EvolutionEvidenceWindow;
414
+ knowledgeRecords: EvolutionKnowledgeRecord[];
415
+ evosCases: EvolutionEvosCase[];
416
+ repoProposals: EvolutionRepoProposal[];
417
+ warnings: string[];
418
+ }
419
+
420
+ export interface EvolutionAnalyzeInput {
421
+ homeDir: string;
422
+ runId: string;
423
+ projectKey?: string;
424
+ projectDir?: string;
425
+ now?: string | Date;
426
+ }
427
+
428
+ export interface EvolutionAnalyzeResult {
429
+ evidenceWindow: EvolutionEvidenceWindow;
430
+ warnings: string[];
431
+ }
432
+
433
+ export interface EvolutionWriteResult {
434
+ evidenceWindowPath: string;
435
+ batchPath: string;
436
+ knowledgePaths: string[];
437
+ evosCasePaths: string[];
438
+ repoProposalPaths: string[];
439
+ knowledgeIndexPath: string;
440
+ evosIndexPath: string;
441
+ }
442
+
443
+ export interface EvolutionActivationResult {
444
+ evidenceWindowPath: string;
445
+ batchPath: string;
446
+ okf: OkfKnowledgeActivationResult;
447
+ evosCasePaths: string[];
448
+ repoProposalPaths: string[];
449
+ evosIndexPath: string;
450
+ }
451
+
452
+ export interface EvolutionReviewSnapshot {
453
+ projectKey: string | null;
454
+ knowledgeRecords: EvolutionKnowledgeRecord[];
455
+ evosCases: EvolutionEvosCase[];
456
+ repoProposals: EvolutionRepoProposal[];
457
+ reviewCandidates: EvolutionReviewCandidate[];
458
+ triggers: EvolutionTriggerRecord[];
459
+ }
460
+
461
+ export interface EvolutionEvosCaseQueryResult {
462
+ cases: EvolutionEvosCase[];
463
+ warnings: string[];
464
+ }
465
+
466
+ export interface EvolutionResolvedPaths {
467
+ projectKey: string;
468
+ runId: string;
469
+ evolutionStateDir: string;
470
+ runStateDir: string;
471
+ evidenceWindowPath: string;
472
+ batchPath: string;
473
+ triggersDir: string;
474
+ reviewCandidatesDir: string;
475
+ repoProposalsDir: string;
476
+ repoProposalsIndexPath: string;
477
+ knowledgeProjectDir: string;
478
+ knowledgeRecordsDir: string;
479
+ knowledgeIndexPath: string;
480
+ knowledgeReviewHistoryPath: string;
481
+ evosCasesProjectDir: string;
482
+ evosIndexPath: string;
483
+ }
484
+
485
+ export interface EvolutionTriggerInput {
486
+ homeDir: string;
487
+ projectKey: string;
488
+ runId: string;
489
+ roleId?: string | null;
490
+ taskId?: string | null;
491
+ eventType: string;
492
+ eventId?: string | null;
493
+ evidenceRef?: string | null;
494
+ summary?: string | null;
495
+ now?: string | Date;
496
+ }
497
+
498
+ export interface SegmentEvolutionTriggerInput {
499
+ homeDir: string;
500
+ projectKey: string;
501
+ sessionKey: string;
502
+ runId?: string | null;
503
+ roleId?: string | null;
504
+ segmentId: string;
505
+ segmentPath: string;
506
+ strength: SegmentEvolutionTriggerStrength;
507
+ reason: SegmentEvolutionTriggerReason;
508
+ summary: string;
509
+ now?: string | Date;
510
+ }
511
+
512
+ export interface EvolutionTriggerListInput {
513
+ homeDir: string;
514
+ projectKey?: string;
515
+ runId?: string;
516
+ status?: EvolutionTriggerStatus;
517
+ }
518
+
519
+ export interface SegmentEvolutionTriggerListInput {
520
+ homeDir: string;
521
+ projectKey?: string;
522
+ runId?: string;
523
+ status?: EvolutionTriggerStatus;
524
+ }
525
+
526
+ export interface EvolutionProcessInput {
527
+ homeDir: string;
528
+ projectKey?: string;
529
+ runId?: string;
530
+ limit?: number;
531
+ now?: string | Date;
532
+ dryRun?: boolean;
533
+ distillSessionKnowledge?: SessionKnowledgeDistiller;
534
+ onProgress?: (progress: EvolutionProcessProgress) => void | Promise<void>;
535
+ }
536
+
537
+ export interface SessionKnowledgeDistillerInput {
538
+ homeDir: string;
539
+ segment: SessionEvidenceSegmentV1;
540
+ evidenceWindow: EvolutionEvidenceWindow;
541
+ now: string;
542
+ }
543
+
544
+ export type SessionKnowledgeDistiller = (
545
+ input: SessionKnowledgeDistillerInput,
546
+ ) => Promise<OkfKnowledgePlan>;
547
+
548
+ export interface EvolutionProcessProgress {
549
+ phase: "started" | "updated" | "completed";
550
+ total: number;
551
+ processed: number;
552
+ consumed: number;
553
+ skipped: number;
554
+ failed: number;
555
+ pending: number;
556
+ }
557
+
558
+ export interface EvolutionProcessResult {
559
+ processed: number;
560
+ consumed: number;
561
+ skipped: number;
562
+ failed: number;
563
+ pending: number;
564
+ triggerIds: string[];
565
+ batchIds: string[];
566
+ warnings: string[];
567
+ dryRun: boolean;
568
+ }