cognitive-core 0.2.2 → 0.2.3

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.
File without changes
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cognitive-core",
3
- "version": "0.2.2",
3
+ "version": "0.2.3",
4
4
  "description": "TypeScript-native cognitive core for adaptive learning and abstraction",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -72,8 +72,8 @@
72
72
  "vitest": "^1.0.0"
73
73
  },
74
74
  "dependencies": {
75
- "acp-factory": "^0.1.7",
76
- "agent-workspace": "^0.1.4",
75
+ "acp-factory": "^0.1.14",
76
+ "agent-workspace": "^0.1.5",
77
77
  "better-sqlite3": "^9.0.0",
78
78
  "minimem": "^0.1.0",
79
79
  "sessionlog": "^0.0.4",
@@ -1,89 +0,0 @@
1
- import type { Trajectory, LearningConfig } from '../types/index.js';
2
- import type { TrajectoryWithAnalysis } from '../types/trajectory-source.js';
3
- import type { MemorySystem } from '../memory/system.js';
4
- import { type AnalysisResult } from './analyzer.js';
5
- import type { AgenticTaskRunner } from '../workspace/runner.js';
6
- /**
7
- * Result of processing a single trajectory
8
- */
9
- export interface ProcessResult {
10
- trajectoryId: string;
11
- stored: boolean;
12
- analysis: AnalysisResult;
13
- abstractable: boolean;
14
- playbookExtracted: boolean;
15
- }
16
- /**
17
- * Result of batch learning
18
- */
19
- export interface BatchResult {
20
- trajectoriesProcessed: number;
21
- playbooksExtracted: number;
22
- experiencesPruned: number;
23
- successRate: number;
24
- }
25
- /**
26
- * Learning Pipeline
27
- * Orchestrates trajectory analysis, playbook extraction, and memory updates
28
- */
29
- export declare class LearningPipeline {
30
- private analyzer;
31
- private playbookExtractor;
32
- private memory;
33
- private config;
34
- private taskRunner;
35
- private accumulated;
36
- private accumulatedAnalyses;
37
- private lastBatchTime;
38
- constructor(memory: MemorySystem, config?: Partial<LearningConfig>);
39
- /**
40
- * Set the agentic task runner for workspace-based analysis.
41
- * When set, analysis tasks are delegated to templates (with heuristic fallback).
42
- */
43
- setTaskRunner(runner: AgenticTaskRunner): void;
44
- /**
45
- * Process a single trajectory
46
- */
47
- processTrajectory(trajectory: Trajectory): Promise<ProcessResult>;
48
- /**
49
- * Run trajectory analysis via the workspace template.
50
- * The template's assessComplexity() routes simple cases to heuristicFallback()
51
- * (which calls the existing TrajectoryAnalyzer), so this is safe for all inputs.
52
- */
53
- private analyzeWithTemplate;
54
- /**
55
- * Check if batch learning should run
56
- */
57
- shouldRunBatch(): boolean;
58
- /**
59
- * Run batch learning on accumulated trajectories
60
- */
61
- runBatchLearning(): Promise<BatchResult>;
62
- /**
63
- * Run playbook extraction via the workspace template.
64
- * Falls back to heuristic extractor on failure.
65
- */
66
- private extractPlaybooks;
67
- /**
68
- * Get accumulated trajectory count
69
- */
70
- getAccumulatedCount(): number;
71
- /**
72
- * Get accumulated trajectories with their analyses.
73
- * Read-only view — does not clear the accumulator.
74
- */
75
- getAccumulated(): TrajectoryWithAnalysis[];
76
- /**
77
- * Clear accumulated trajectories
78
- */
79
- clearAccumulated(): void;
80
- /**
81
- * Update configuration
82
- */
83
- updateConfig(config: Partial<LearningConfig>): void;
84
- }
85
- /**
86
- * Create a learning pipeline
87
- */
88
- export declare function createLearningPipeline(memory: MemorySystem, config?: Partial<LearningConfig>): LearningPipeline;
89
- //# sourceMappingURL=pipeline.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"pipeline.d.ts","sourceRoot":"","sources":["../../src/learning/pipeline.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,UAAU,EACV,cAAc,EACf,MAAM,mBAAmB,CAAC;AAC3B,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,+BAA+B,CAAC;AAC5E,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACxD,OAAO,EAGL,KAAK,cAAc,EACpB,MAAM,eAAe,CAAC;AAKvB,OAAO,KAAK,EAAE,iBAAi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AAC,MAAM,EAAE,OAAO,CAAC,cAAc,CAAC,GAAG,IAAI;CAMpD;AAED;;GAEG;AACH,wBAAgB,sBAAsB,CACpC,MAAM,EAAE,YAAY,EACpB,MAAM,CAAC,EAAE,OAAO,CAAC,cAAc,CAAC,GAC/B,gBAAgB,CAElB"}
@@ -1,236 +0,0 @@
1
- import { createAnalyzer, } from './analyzer.js';
2
- import { createPlaybookExtractor, } from './playbook-extractor.js';
3
- import { trajectoryAnalysisTemplate } from '../workspace/templates/trajectory-analysis.js';
4
- import { playbookExtractionTemplate } from '../workspace/templates/playbook-extraction.js';
5
- /**
6
- * Learning Pipeline
7
- * Orchestrates trajectory analysis, playbook extraction, and memory updates
8
- */
9
- export class LearningPipeline {
10
- analyzer;
11
- playbookExtractor;
12
- memory;
13
- config;
14
- // Optional agentic task runner for workspace-based analysis
15
- taskRunner = null;
16
- // Accumulated trajectories for batch learning
17
- accumulated = [];
18
- accumulatedAnalyses = [];
19
- lastBatchTime = null;
20
- constructor(memory, config) {
21
- this.memory = memory;
22
- this.config = {
23
- creditStrategy: config?.creditStrategy ?? 'simple',
24
- patternExtractor: config?.patternExtractor ?? 'llm',
25
- minTrajectories: config?.minTrajectories ?? 10,
26
- minHoursSinceLast: config?.minHoursSinceLast,
27
- minSuccessRate: config?.minSuccessRate,
28
- deduplicationThreshold: config?.deduplicationThreshold ?? 0.9,
29
- maxExperiences: config?.maxExperiences ?? 1000,
30
- };
31
- this.analyzer = createAnalyzer(this.config.creditStrategy);
32
- this.playbookExtractor = createPlaybookExtractor({
33
- minTrajectories: this.config.minTrajectories,
34
- mergeThreshold: this.config.deduplicationThreshold,
35
- minSuccessRate: this.config.minSuccessRate ?? 0.6,
36
- });
37
- }
38
- /**
39
- * Set the agentic task runner for workspace-based analysis.
40
- * When set, analysis tasks are delegated to templates (with heuristic fallback).
41
- */
42
- setTaskRunner(runner) {
43
- this.taskRunner = runner;
44
- }
45
- /**
46
- * Process a single trajectory
47
- */
48
- async processTrajectory(trajectory) {
49
- // Store in experience memory
50
- await this.memory.storeTrajectory(trajectory);
51
- // Analyze: workspace-based when runner available, heuristic otherwise
52
- let analysis;
53
- if (this.taskRunner) {
54
- analysis = await this.analyzeWithTemplate(trajectory);
55
- }
56
- else {
57
- analysis = await this.analyzer.analyze(trajectory);
58
- }
59
- // Accumulate for batch learning
60
- this.accumulated.push(trajectory);
61
- this.accumulatedAnalyses.push(analysis);
62
- return {
63
- trajectoryId: trajectory.id,
64
- stored: true,
65
- analysis,
66
- abstractable: analysis.abstractable,
67
- playbookExtracted: false, // Playbooks are extracted in batch
68
- };
69
- }
70
- /**
71
- * Run trajectory analysis via the workspace template.
72
- * The template's assessComplexity() routes simple cases to heuristicFallback()
73
- * (which calls the existing TrajectoryAnalyzer), so this is safe for all inputs.
74
- */
75
- async analyzeWithTemplate(trajectory) {
76
- try {
77
- const result = await this.taskRunner.run(trajectoryAnalysisTemplate, {
78
- trajectory,
79
- creditStrategy: this.config.creditStrategy,
80
- });
81
- return result.output;
82
- }
83
- catch (error) {
84
- // If workspace-based analysis fails, fall back to heuristic
85
- console.error('Workspace-based trajectory analysis failed, falling back to heuristic:', error instanceof Error ? error.message : error);
86
- return this.analyzer.analyze(trajectory);
87
- }
88
- }
89
- /**
90
- * Check if batch learning should run
91
- */
92
- shouldRunBatch() {
93
- // Check minimum trajectories
94
- if (this.accumulated.length < this.config.minTrajectories) {
95
- return false;
96
- }
97
- // Check time since last batch
98
- if (this.config.minHoursSinceLast && this.lastBatchTime) {
99
- const hoursSinceLast = (Date.now() - this.lastBatchTime.getTime()) / (1000 * 60 * 60);
100
- if (hoursSinceLast < this.config.minHoursSinceLast) {
101
- return false;
102
- }
103
- }
104
- // Check success rate
105
- if (this.config.minSuccessRate) {
106
- const successCount = this.accumulatedAnalyses.filter((a) => a.success).length;
107
- const successRate = successCount / this.accumulated.length;
108
- if (successRate < this.config.minSuccessRate) {
109
- return false;
110
- }
111
- }
112
- return true;
113
- }
114
- /**
115
- * Run batch learning on accumulated trajectories
116
- */
117
- async runBatchLearning() {
118
- if (this.accumulated.length === 0) {
119
- return {
120
- trajectoriesProcessed: 0,
121
- playbooksExtracted: 0,
122
- experiencesPruned: 0,
123
- successRate: 0,
124
- };
125
- }
126
- // Extract playbooks: workspace-based when runner available, heuristic otherwise
127
- let playbooksAdded = 0;
128
- const existingPlaybooks = await this.memory.playbooks.getAll();
129
- const playbookExtraction = await this.extractPlaybooks(existingPlaybooks);
130
- // Add new playbooks
131
- for (const playbook of playbookExtraction.new) {
132
- const exists = await this.memory.playbooks.exists(playbook.name, this.config.deduplicationThreshold);
133
- if (!exists) {
134
- await this.memory.playbooks.add(playbook);
135
- playbooksAdded++;
136
- }
137
- }
138
- // Apply updates to existing playbooks
139
- for (const update of playbookExtraction.updates) {
140
- if (update.refinement) {
141
- await this.memory.playbooks.addRefinement(update.id, update.refinement.context, update.refinement.addition, update.refinement.source);
142
- }
143
- if (update.newTrigger) {
144
- const playbook = await this.memory.playbooks.get(update.id);
145
- if (playbook && !playbook.applicability.triggers.includes(update.newTrigger)) {
146
- playbook.applicability.triggers.push(update.newTrigger);
147
- await this.memory.playbooks.add(playbook);
148
- }
149
- }
150
- if (update.newAntiPattern) {
151
- const playbook = await this.memory.playbooks.get(update.id);
152
- if (playbook && !playbook.applicability.antiPatterns.includes(update.newAntiPattern)) {
153
- playbook.applicability.antiPatterns.push(update.newAntiPattern);
154
- await this.memory.playbooks.add(playbook);
155
- }
156
- }
157
- }
158
- // Prune experiences if needed
159
- const pruned = await this.memory.experiences.prune({
160
- maxCount: this.config.maxExperiences,
161
- });
162
- // Calculate success rate
163
- const successCount = this.accumulatedAnalyses.filter((a) => a.success).length;
164
- const successRate = successCount / this.accumulated.length;
165
- // Clear accumulated and update time
166
- const trajectoriesProcessed = this.accumulated.length;
167
- this.accumulated = [];
168
- this.accumulatedAnalyses = [];
169
- this.lastBatchTime = new Date();
170
- return {
171
- trajectoriesProcessed,
172
- playbooksExtracted: playbooksAdded,
173
- experiencesPruned: pruned.totalPruned,
174
- successRate,
175
- };
176
- }
177
- /**
178
- * Run playbook extraction via the workspace template.
179
- * Falls back to heuristic extractor on failure.
180
- */
181
- async extractPlaybooks(existingPlaybooks) {
182
- if (this.taskRunner) {
183
- try {
184
- const result = await this.taskRunner.run(playbookExtractionTemplate, {
185
- trajectories: this.accumulated,
186
- analyses: this.accumulatedAnalyses,
187
- existingPlaybooks,
188
- });
189
- return result.output;
190
- }
191
- catch (error) {
192
- console.error('Workspace-based playbook extraction failed, falling back to heuristic:', error instanceof Error ? error.message : error);
193
- }
194
- }
195
- return this.playbookExtractor.extract(this.accumulated, this.accumulatedAnalyses, existingPlaybooks);
196
- }
197
- /**
198
- * Get accumulated trajectory count
199
- */
200
- getAccumulatedCount() {
201
- return this.accumulated.length;
202
- }
203
- /**
204
- * Get accumulated trajectories with their analyses.
205
- * Read-only view — does not clear the accumulator.
206
- */
207
- getAccumulated() {
208
- return this.accumulated.map((trajectory, i) => ({
209
- trajectory,
210
- analysis: this.accumulatedAnalyses[i],
211
- }));
212
- }
213
- /**
214
- * Clear accumulated trajectories
215
- */
216
- clearAccumulated() {
217
- this.accumulated = [];
218
- this.accumulatedAnalyses = [];
219
- }
220
- /**
221
- * Update configuration
222
- */
223
- updateConfig(config) {
224
- this.config = { ...this.config, ...config };
225
- if (config.creditStrategy) {
226
- this.analyzer.setStrategy(config.creditStrategy);
227
- }
228
- }
229
- }
230
- /**
231
- * Create a learning pipeline
232
- */
233
- export function createLearningPipeline(memory, config) {
234
- return new LearningPipeline(memory, config);
235
- }
236
- //# sourceMappingURL=pipeline.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"pipeline.js","sourceRoot":"","sources":["../../src/learning/pipeline.ts"],"names":[],"mappings":"AAMA,OAAO,EAEL,cAAc,GAEf,MAAM,eAAe,CAAC;AACvB,OAAO,EAEL,uBAAuB,GACxB,MAAM,yBAAyB,CAAC;AAEjC,OAAO,EAAE,0BAA0B,EAAE,MAAM,+CAA+C,CAAC;AA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