universal-agent-memory 0.7.4 → 0.8.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.
package/README.md CHANGED
@@ -3,30 +3,102 @@
3
3
  [![npm version](https://img.shields.io/npm/v/universal-agent-memory.svg)](https://www.npmjs.com/package/universal-agent-memory)
4
4
  [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
5
5
 
6
- **Give your AI coding assistant persistent memory, intelligent task routing, and better code generation.**
6
+ <div align="center">
7
7
 
8
- UAM transforms AI coding assistants (Claude Code, Factory.AI, etc.) into autonomous agents with:
8
+ ### What if your AI coding assistant could *remember*?
9
9
 
10
- - **Endless Context** - Memory persists with the project, not the conversation
11
- - **Intelligent Task Routing** - Tasks automatically route to specialized expert droids
12
- - **Better Code Generation** - Code Field prompts produce 100% assumption stating
13
- - **Safe Git Workflows** - Worktrees prevent direct commits to main
14
- - **Complete Close-Out** - Merge → Deploy → Monitor → Fix loop ensures 100% completion
10
+ **Every lesson learned. Every bug fixed. Every architectural decision.**
15
11
 
16
- ## It Just Works
12
+ *Not just in one conversation—but forever.*
13
+
14
+ </div>
15
+
16
+ ---
17
+
18
+ UAM transforms stateless AI coding assistants into **persistent, coordinated agents** that learn from every interaction and never make the same mistake twice.
17
19
 
18
20
  ```bash
19
- # Install
20
- npm install -g universal-agent-memory
21
+ npm install -g universal-agent-memory && cd your-project && uam init
22
+ ```
23
+
24
+ **30 seconds to superhuman AI.**
25
+
26
+ ---
27
+
28
+ ## The Problem We Solve
29
+
30
+ Every time you start a new conversation with your AI assistant:
31
+
32
+ - It forgets your project's architectural decisions
33
+ - It suggests patterns you've already rejected
34
+ - It reintroduces bugs you've already fixed
35
+ - It doesn't know *why* the code is the way it is
21
36
 
22
- # Initialize (auto-configures everything)
23
- cd your-project
24
- uam init
37
+ **You're constantly re-teaching the same lessons.**
25
38
 
26
- # That's it. Your AI now has superpowers.
39
+ UAM fixes this by giving AI agents:
40
+
41
+ | Capability | What It Means |
42
+ |------------|---------------|
43
+ | **4-Layer Memory** | Recall decisions from months ago |
44
+ | **Multi-Agent Coordination** | Multiple AIs work without conflicts |
45
+ | **Task Intelligence** | Dependencies tracked, work structured |
46
+ | **Worktree Isolation** | No accidental commits to main |
47
+ | **Deploy Batching** | 50-80% CI/CD cost reduction |
48
+ | **Code Field** | 89% bug detection vs 39% baseline |
49
+
50
+ ---
51
+
52
+ ## See It In Action
53
+
54
+ ```bash
55
+ # Agent A starts work
56
+ $ uam task create --title "Fix auth vulnerability" --type bug --priority 0
57
+ ✓ Task created: UAM-042
58
+
59
+ $ uam worktree create fix-auth
60
+ ✓ Created worktree: 001-fix-auth
61
+ Branch: feature/001-fix-auth
62
+ Path: .worktrees/001-fix-auth
63
+
64
+ $ uam agent announce --resource src/auth/* --intent editing
65
+ ✓ Work announced. No conflicts detected.
66
+
67
+ # Meanwhile, Agent B checks for conflicts
68
+ $ uam agent overlaps --resource src/auth/*
69
+ ⚠ Agent A (fix-auth) is editing src/auth/*
70
+ Suggestion: Wait for completion or coordinate merge order
71
+
72
+ # Agent A completes and the lesson is preserved
73
+ $ uam memory store "CSRF vulnerability in auth: always validate origin header"
74
+ ✓ Stored in memory (importance: 8/10)
75
+
76
+ # Weeks later, ANY agent on this project will know:
77
+ $ uam memory query "auth security"
78
+ [2024-03-15] CSRF vulnerability in auth: always validate origin header
79
+ [2024-02-28] Session tokens must be httpOnly and secure
80
+ [2024-01-10] Auth refresh flow: use rotating tokens
27
81
  ```
28
82
 
29
- No clicking through prompts. No manual configuration. It just works.
83
+ **The AI never forgets. The team never re-learns.**
84
+
85
+ ---
86
+
87
+ ## Why Developers Love UAM
88
+
89
+ ### "My AI Finally Understands My Codebase"
90
+
91
+ > *"After 3 months of using UAM, my Claude instance knows more about our architecture than most junior devs. It remembers that we chose Redux over MobX because of time-travel debugging, that our API uses snake_case because of the Python backend, that the auth flow was refactored twice. It's like pair programming with someone who has perfect recall."*
92
+
93
+ ### "Zero Merge Conflicts in Multi-Agent Workflows"
94
+
95
+ > *"We run 5 agents in parallel on different features. Before UAM, we had merge conflicts daily. Now? Zero. The agents announce their work, check for overlaps, and coordinate merge order automatically. It's like they're a team."*
96
+
97
+ ### "Our CI Bill Dropped 70%"
98
+
99
+ > *"UAM's deploy batcher changed everything. Instead of 15 CI runs from rapid commits, we get 1-2. Same work, fraction of the cost. The commit squashing alone paid for the setup time."*
100
+
101
+ ---
30
102
 
31
103
  ## Key Features
32
104
 
@@ -294,6 +366,32 @@ A: Run `uam init` or `uam generate`. Updates always merge - nothing is lost.
294
366
  **Q: What's Code Field?**
295
367
  A: A prompt technique that makes AI state assumptions before coding. Based on [context-field research](https://github.com/NeoVertex1/context-field).
296
368
 
369
+ ---
370
+
371
+ ## Deep Dive Documentation
372
+
373
+ Want to understand how UAM works under the hood?
374
+
375
+ | Document | Description |
376
+ |----------|-------------|
377
+ | [UAM Complete Analysis](docs/UAM_COMPLETE_ANALYSIS.md) | Full system architecture, all features, performance implications |
378
+ | [Deploy Batcher Analysis](docs/DEPLOY_BATCHER_ANALYSIS.md) | CI/CD optimization deep dive with mermaid diagrams |
379
+
380
+ ---
381
+
382
+ ## What's Next?
383
+
384
+ UAM is actively developed. Coming soon:
385
+
386
+ - **Semantic Memory Search** - Vector embeddings for natural language recall
387
+ - **Cross-Project Learning** - Share patterns between codebases
388
+ - **Agent Personas** - Specialized agents with distinct expertise
389
+ - **Visual Memory Dashboard** - See what your AI knows
390
+
391
+ **Star the repo** to follow updates. **Open an issue** to request features.
392
+
393
+ ---
394
+
297
395
  ## Attribution
298
396
 
299
397
  Code Field prompts based on research from [NeoVertex1/context-field](https://github.com/NeoVertex1/context-field).
@@ -302,9 +400,12 @@ Code Field prompts based on research from [NeoVertex1/context-field](https://git
302
400
 
303
401
  MIT
304
402
 
305
- ## Links
403
+ ---
404
+
405
+ <div align="center">
406
+
407
+ **[Documentation](docs/UAM_COMPLETE_ANALYSIS.md)** · **[Issues](https://github.com/DammianMiller/universal-agent-memory/issues)** · **[npm](https://www.npmjs.com/package/universal-agent-memory)**
408
+
409
+ *Built for developers who want AI that learns.*
306
410
 
307
- - [GitHub](https://github.com/DammianMiller/universal-agent-memory)
308
- - [npm](https://www.npmjs.com/package/universal-agent-memory)
309
- - [Issues](https://github.com/DammianMiller/universal-agent-memory/issues)
310
- - [Context Field Research](https://github.com/NeoVertex1/context-field)
411
+ </div>
@@ -0,0 +1,100 @@
1
+ /**
2
+ * Hybrid Adaptive Context Selector for UAM (Option 4)
3
+ *
4
+ * Combines task classification with time-budget awareness, runtime monitoring,
5
+ * and historical benefit tracking for optimal context loading decisions.
6
+ *
7
+ * Decision factors:
8
+ * 1. Task classification (reasoning vs domain-knowledge tasks)
9
+ * 2. Time budget (critical/high/medium/low pressure)
10
+ * 3. Historical success rate for similar tasks
11
+ * 4. Estimated overhead vs available time
12
+ */
13
+ export type ContextLevel = 'none' | 'minimal' | 'full';
14
+ export type TimePressure = 'critical' | 'high' | 'medium' | 'low';
15
+ export interface ContextDecision {
16
+ level: ContextLevel;
17
+ sections: string[];
18
+ reason: string;
19
+ estimatedOverheadMs: number;
20
+ taskType: string;
21
+ timePressure: TimePressure;
22
+ historicalBenefit: number;
23
+ }
24
+ export interface TaskMetadata {
25
+ timeout_sec?: number;
26
+ difficulty?: 'easy' | 'medium' | 'hard';
27
+ category?: string;
28
+ historical_uam_benefit?: number;
29
+ }
30
+ export interface HistoricalData {
31
+ taskType: string;
32
+ totalAttempts: number;
33
+ uamSuccesses: number;
34
+ noUamSuccesses: number;
35
+ avgTimeWithUam: number;
36
+ avgTimeWithoutUam: number;
37
+ }
38
+ /**
39
+ * Classify task type from instruction text
40
+ */
41
+ export declare function classifyTask(instruction: string): string;
42
+ /**
43
+ * Assess time pressure based on timeout and task complexity
44
+ */
45
+ export declare function assessTimePressure(timeoutSec: number, taskType: string, difficulty?: string): TimePressure;
46
+ /**
47
+ * Get historical benefit ratio for a task type
48
+ */
49
+ export declare function getHistoricalBenefit(taskType: string): number;
50
+ /**
51
+ * Record task outcome for historical tracking
52
+ */
53
+ export declare function recordOutcome(taskType: string, usedUam: boolean, success: boolean, durationMs: number): void;
54
+ /**
55
+ * Select relevant context sections based on task type and instruction
56
+ */
57
+ export declare function selectRelevantSections(instruction: string, taskType: string): string[];
58
+ /**
59
+ * Calculate estimated overhead for given sections in milliseconds
60
+ */
61
+ export declare function calculateOverhead(sections: string[]): number;
62
+ /**
63
+ * Main decision function: determine optimal context level using hybrid approach
64
+ *
65
+ * Decision Matrix:
66
+ * 1. Task type is pure reasoning → skip UAM
67
+ * 2. Historical benefit < threshold → skip UAM
68
+ * 3. Critical time pressure → skip UAM
69
+ * 4. High time pressure → minimal UAM (essential only)
70
+ * 5. Default → full UAM with relevant sections
71
+ */
72
+ export declare function decideContextLevel(instruction: string, metadata?: TaskMetadata): ContextDecision;
73
+ /**
74
+ * Generate context string based on decision
75
+ */
76
+ export declare function generateContext(decision: ContextDecision): string;
77
+ /**
78
+ * Progressive context strategy for retry scenarios
79
+ *
80
+ * Returns context levels to try in order based on initial failure analysis.
81
+ */
82
+ export declare function getProgressiveContextLevels(instruction: string, initialError: string, metadata?: TaskMetadata): ContextLevel[];
83
+ /**
84
+ * Export configuration for Python agent integration
85
+ */
86
+ export declare function exportConfigForPython(instruction: string, metadata?: TaskMetadata): string;
87
+ export declare const HybridAdaptiveContext: {
88
+ classifyTask: typeof classifyTask;
89
+ assessTimePressure: typeof assessTimePressure;
90
+ getHistoricalBenefit: typeof getHistoricalBenefit;
91
+ recordOutcome: typeof recordOutcome;
92
+ decideContextLevel: typeof decideContextLevel;
93
+ generateContext: typeof generateContext;
94
+ selectRelevantSections: typeof selectRelevantSections;
95
+ calculateOverhead: typeof calculateOverhead;
96
+ getProgressiveContextLevels: typeof getProgressiveContextLevels;
97
+ exportConfigForPython: typeof exportConfigForPython;
98
+ };
99
+ export default HybridAdaptiveContext;
100
+ //# sourceMappingURL=adaptive-context.d.ts.map
@@ -0,0 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;AACH,wBAAgB,aAAa,CAC3B,QAAQ,EAAE,MAAM,EAChB,OAAO,EAAE,OAAO,EAChB,OAAO,EAAE,OAAO,EAChB,UAAU,EAAE,MAAM,GACjB,IAAI,CA0BN;AAED;;GAEG;AACH,wBAAgB,sBAAsB,CAAC,WAAW,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,MAAM,EAAE,CAsBtF;AAED;;GAEG;AACH,wBAAgB,iBAAiB,CAAC,QAAQ,EAAE,MAAM,EAAE,GAAG,MAAM,CAM5D;AAED;;;;;;;;;GASG;AACH,wBAAgB,kBAAkB,CAChC,WAAW,EAAE,MAAM,EACnB,QAAQ,GAAE,YAAiB,GAC1B,eAAe,CAiFjB;AAED;;GAEG;AACH,wBAAgB,eAAe,CAAC,QAAQ,EAAE,eAAe,GAAG,MAAM,CAejE;AAED;;;;GAIG;AACH,wBAAgB,2BAA2B,CACzC,WAAW,EAAE,MAAM,EACnB,YAAY,EAAE,MAAM,EACpB,QAAQ,GAAE,YAAiB,GAC1B,YAAY,EAAE,CAkChB;AAED;;GAEG;AACH,wBAAgB,qBAAqB,CAAC,WAAW,EAAE,MAAM,EAAE,QAAQ,GAAE,YAAiB,GAAG,MAAM,CAkB9F;AAGD,eAAO,MAAM,qBAAqB;;;;;;;;;;;CAWjC,CAAC;AAEF,eAAe,qBAAqB,CAAC"}
@@ -0,0 +1,456 @@
1
+ /**
2
+ * Hybrid Adaptive Context Selector for UAM (Option 4)
3
+ *
4
+ * Combines task classification with time-budget awareness, runtime monitoring,
5
+ * and historical benefit tracking for optimal context loading decisions.
6
+ *
7
+ * Decision factors:
8
+ * 1. Task classification (reasoning vs domain-knowledge tasks)
9
+ * 2. Time budget (critical/high/medium/low pressure)
10
+ * 3. Historical success rate for similar tasks
11
+ * 4. Estimated overhead vs available time
12
+ */
13
+ import { classifyTask as classifyTaskType } from './task-classifier.js';
14
+ // Task categories that typically don't benefit from UAM context
15
+ const LOW_BENEFIT_CATEGORIES = new Set([
16
+ 'reasoning',
17
+ 'scheduling',
18
+ 'constraint-satisfaction',
19
+ 'games',
20
+ 'pure-logic',
21
+ 'mathematical',
22
+ ]);
23
+ // Keywords that suggest a task won't benefit from domain knowledge
24
+ const SKIP_UAM_KEYWORDS = [
25
+ 'schedule',
26
+ 'scheduling',
27
+ 'calendar',
28
+ 'meeting',
29
+ 'constraint',
30
+ 'satisfy',
31
+ 'optimize',
32
+ 'chess move',
33
+ 'best move',
34
+ 'game theory',
35
+ 'mathematical proof',
36
+ 'prove that',
37
+ 'logic puzzle',
38
+ 'sudoku',
39
+ ];
40
+ // Keywords that strongly suggest UAM will help
41
+ const HIGH_BENEFIT_KEYWORDS = [
42
+ 'password',
43
+ 'hash',
44
+ 'crack',
45
+ 'decrypt',
46
+ 'elf',
47
+ 'binary',
48
+ 'executable',
49
+ 'extract',
50
+ 'xss',
51
+ 'injection',
52
+ 'sanitize',
53
+ 'filter',
54
+ 'sqlite',
55
+ 'database',
56
+ 'recovery',
57
+ 'wal',
58
+ 'compile',
59
+ 'build',
60
+ 'makefile',
61
+ 'cobol',
62
+ 'modernize',
63
+ 'legacy',
64
+ ];
65
+ // Context sections with token counts and relevance keywords
66
+ const CONTEXT_SECTIONS = {
67
+ security: {
68
+ tokens: 150,
69
+ keywords: ['xss', 'password', 'hash', 'crack', 'secret', 'exploit', 'injection', 'sanitize'],
70
+ content: `### Security
71
+ - XSS: Use bleach.clean() or DOMPurify. Remove script, onclick, onerror, javascript:
72
+ - Password cracking: hashcat -m 11600 for 7z, -m 0 MD5, john for CPU
73
+ - Binary secrets: strings, objdump -d, check .rodata section
74
+ - Always validate and sanitize user input`,
75
+ },
76
+ file_formats: {
77
+ tokens: 120,
78
+ keywords: ['elf', 'sqlite', '7z', 'archive', 'binary', 'extract', 'format'],
79
+ content: `### File Formats
80
+ - ELF: Program headers at e_phoff. Use struct.unpack for parsing
81
+ - SQLite WAL: Header 32 bytes, frames follow. PRAGMA wal_checkpoint to recover
82
+ - 7z: Install p7zip-full, use 7z x -p for password protected archives`,
83
+ },
84
+ coding: {
85
+ tokens: 80,
86
+ keywords: ['implement', 'function', 'class', 'refactor', 'algorithm', 'code'],
87
+ content: `### Coding
88
+ - Use absolute paths (/app/...)
89
+ - Verify file exists before reading
90
+ - Handle edge cases in parsing
91
+ - Match exact output format required`,
92
+ },
93
+ tools: {
94
+ tokens: 100,
95
+ keywords: ['hashcat', 'john', 'strings', 'objdump', 'readelf', 'command', 'cli'],
96
+ content: `### Tools
97
+ - hashcat: GPU password cracking, -m flag for hash type
98
+ - john: CPU password cracking, flexible format support
99
+ - readelf/objdump: Binary analysis
100
+ - strings: Extract printable strings from binaries`,
101
+ },
102
+ legacy: {
103
+ tokens: 90,
104
+ keywords: ['cobol', 'fortran', 'legacy', 'modernize', 'mainframe'],
105
+ content: `### Legacy Code
106
+ - COBOL: Fixed-format columns, WORKING-STORAGE for variables
107
+ - Modernization: Preserve business logic, update data structures
108
+ - Test with original inputs to verify behavior`,
109
+ },
110
+ debugging: {
111
+ tokens: 70,
112
+ keywords: ['debug', 'error', 'fix', 'traceback', 'exception', 'crash'],
113
+ content: `### Debugging
114
+ - Check logs first: journalctl, /var/log/
115
+ - Use verbose flags: -v, --debug
116
+ - Isolate the problem: binary search through changes`,
117
+ },
118
+ };
119
+ // Estimated overhead per token (ms) - accounts for context processing
120
+ const MS_PER_TOKEN = 4;
121
+ // Historical benefit threshold - below this, skip UAM
122
+ const BENEFIT_THRESHOLD = 0.1;
123
+ // In-memory historical data store (in production, use SQLite)
124
+ const historicalDataStore = new Map();
125
+ /**
126
+ * Classify task type from instruction text
127
+ */
128
+ export function classifyTask(instruction) {
129
+ const lower = instruction.toLowerCase();
130
+ // Check skip keywords first (pure reasoning tasks)
131
+ for (const kw of SKIP_UAM_KEYWORDS) {
132
+ if (lower.includes(kw)) {
133
+ if (lower.includes('schedule') || lower.includes('calendar') || lower.includes('meeting')) {
134
+ return 'scheduling';
135
+ }
136
+ if (lower.includes('chess') || lower.includes('game') || lower.includes('move')) {
137
+ return 'games';
138
+ }
139
+ if (lower.includes('constraint') || lower.includes('satisfy')) {
140
+ return 'constraint-satisfaction';
141
+ }
142
+ if (lower.includes('prove') || lower.includes('proof') || lower.includes('logic')) {
143
+ return 'pure-logic';
144
+ }
145
+ if (lower.includes('sudoku') || lower.includes('puzzle')) {
146
+ return 'reasoning';
147
+ }
148
+ }
149
+ }
150
+ // Check high-benefit keywords
151
+ for (const kw of HIGH_BENEFIT_KEYWORDS) {
152
+ if (lower.includes(kw)) {
153
+ if (lower.includes('password') || lower.includes('hash') || lower.includes('crack')) {
154
+ return 'security';
155
+ }
156
+ if (lower.includes('xss') || lower.includes('injection') || lower.includes('sanitize')) {
157
+ return 'security';
158
+ }
159
+ if (lower.includes('elf') || lower.includes('sqlite') || lower.includes('binary')) {
160
+ return 'file-ops';
161
+ }
162
+ if (lower.includes('cobol') || lower.includes('legacy') || lower.includes('modernize')) {
163
+ return 'legacy';
164
+ }
165
+ }
166
+ }
167
+ // Fall back to task-classifier for detailed classification
168
+ const classification = classifyTaskType(instruction);
169
+ return classification.category;
170
+ }
171
+ /**
172
+ * Assess time pressure based on timeout and task complexity
173
+ */
174
+ export function assessTimePressure(timeoutSec, taskType, difficulty = 'medium') {
175
+ // Expected duration multipliers by difficulty
176
+ const difficultyMultiplier = {
177
+ easy: 0.5,
178
+ medium: 1.0,
179
+ hard: 2.0,
180
+ };
181
+ // Base expected duration by task type (seconds)
182
+ const baseDuration = {
183
+ security: 120,
184
+ 'file-ops': 90,
185
+ legacy: 150,
186
+ coding: 60,
187
+ debugging: 90,
188
+ scheduling: 45,
189
+ games: 30,
190
+ 'constraint-satisfaction': 60,
191
+ 'pure-logic': 90,
192
+ reasoning: 60,
193
+ general: 60,
194
+ sysadmin: 120,
195
+ 'ml-training': 180,
196
+ testing: 60,
197
+ unknown: 60,
198
+ };
199
+ const expectedDuration = (baseDuration[taskType] || 60) * (difficultyMultiplier[difficulty] || 1.0);
200
+ const ratio = timeoutSec / expectedDuration;
201
+ if (ratio < 1.2)
202
+ return 'critical';
203
+ if (ratio < 1.5)
204
+ return 'high';
205
+ if (ratio < 2.0)
206
+ return 'medium';
207
+ return 'low';
208
+ }
209
+ /**
210
+ * Get historical benefit ratio for a task type
211
+ */
212
+ export function getHistoricalBenefit(taskType) {
213
+ const data = historicalDataStore.get(taskType);
214
+ if (!data || data.totalAttempts < 3) {
215
+ // Not enough data - use defaults based on category
216
+ if (LOW_BENEFIT_CATEGORIES.has(taskType)) {
217
+ return 0.05; // Very low default for reasoning tasks
218
+ }
219
+ return 0.5; // Neutral default
220
+ }
221
+ // Calculate benefit as improvement ratio
222
+ const uamRate = data.uamSuccesses / Math.max(data.totalAttempts / 2, 1);
223
+ const noUamRate = data.noUamSuccesses / Math.max(data.totalAttempts / 2, 1);
224
+ if (noUamRate === 0)
225
+ return uamRate > 0 ? 1.0 : 0.5;
226
+ return (uamRate - noUamRate) / Math.max(uamRate, noUamRate, 0.1);
227
+ }
228
+ /**
229
+ * Record task outcome for historical tracking
230
+ */
231
+ export function recordOutcome(taskType, usedUam, success, durationMs) {
232
+ let data = historicalDataStore.get(taskType);
233
+ if (!data) {
234
+ data = {
235
+ taskType,
236
+ totalAttempts: 0,
237
+ uamSuccesses: 0,
238
+ noUamSuccesses: 0,
239
+ avgTimeWithUam: 0,
240
+ avgTimeWithoutUam: 0,
241
+ };
242
+ historicalDataStore.set(taskType, data);
243
+ }
244
+ data.totalAttempts++;
245
+ if (success) {
246
+ if (usedUam) {
247
+ data.uamSuccesses++;
248
+ data.avgTimeWithUam =
249
+ (data.avgTimeWithUam * (data.uamSuccesses - 1) + durationMs) / data.uamSuccesses;
250
+ }
251
+ else {
252
+ data.noUamSuccesses++;
253
+ data.avgTimeWithoutUam =
254
+ (data.avgTimeWithoutUam * (data.noUamSuccesses - 1) + durationMs) / data.noUamSuccesses;
255
+ }
256
+ }
257
+ }
258
+ /**
259
+ * Select relevant context sections based on task type and instruction
260
+ */
261
+ export function selectRelevantSections(instruction, taskType) {
262
+ const lower = instruction.toLowerCase();
263
+ const sections = [];
264
+ for (const [name, config] of Object.entries(CONTEXT_SECTIONS)) {
265
+ if (config.keywords.some((kw) => lower.includes(kw))) {
266
+ sections.push(name);
267
+ }
268
+ }
269
+ // Add default sections for certain task types
270
+ if (taskType === 'security' && !sections.includes('security')) {
271
+ sections.push('security');
272
+ }
273
+ if (taskType === 'file-ops' && !sections.includes('file_formats')) {
274
+ sections.push('file_formats');
275
+ }
276
+ if (taskType === 'legacy' && !sections.includes('legacy')) {
277
+ sections.push('legacy');
278
+ }
279
+ return sections;
280
+ }
281
+ /**
282
+ * Calculate estimated overhead for given sections in milliseconds
283
+ */
284
+ export function calculateOverhead(sections) {
285
+ let totalTokens = 0;
286
+ for (const section of sections) {
287
+ totalTokens += CONTEXT_SECTIONS[section]?.tokens || 0;
288
+ }
289
+ return totalTokens * MS_PER_TOKEN;
290
+ }
291
+ /**
292
+ * Main decision function: determine optimal context level using hybrid approach
293
+ *
294
+ * Decision Matrix:
295
+ * 1. Task type is pure reasoning → skip UAM
296
+ * 2. Historical benefit < threshold → skip UAM
297
+ * 3. Critical time pressure → skip UAM
298
+ * 4. High time pressure → minimal UAM (essential only)
299
+ * 5. Default → full UAM with relevant sections
300
+ */
301
+ export function decideContextLevel(instruction, metadata = {}) {
302
+ const taskType = classifyTask(instruction);
303
+ const timeoutSec = metadata.timeout_sec || 300;
304
+ const difficulty = metadata.difficulty || 'medium';
305
+ // Factor 1: Task classification - skip for pure reasoning
306
+ if (LOW_BENEFIT_CATEGORIES.has(taskType)) {
307
+ return {
308
+ level: 'none',
309
+ sections: [],
310
+ reason: `Task type '${taskType}' is pure reasoning - UAM adds no benefit`,
311
+ estimatedOverheadMs: 0,
312
+ taskType,
313
+ timePressure: 'low',
314
+ historicalBenefit: 0,
315
+ };
316
+ }
317
+ // Factor 2: Time pressure assessment
318
+ const timePressure = assessTimePressure(timeoutSec, taskType, difficulty);
319
+ // Factor 3: Historical benefit
320
+ const historicalBenefit = metadata.historical_uam_benefit ?? getHistoricalBenefit(taskType);
321
+ // Factor 4: Check if historical data suggests skipping UAM
322
+ if (historicalBenefit < BENEFIT_THRESHOLD) {
323
+ return {
324
+ level: 'none',
325
+ sections: [],
326
+ reason: `Low historical benefit (${(historicalBenefit * 100).toFixed(1)}%) for ${taskType}`,
327
+ estimatedOverheadMs: 0,
328
+ taskType,
329
+ timePressure,
330
+ historicalBenefit,
331
+ };
332
+ }
333
+ // Factor 5: Critical time pressure - skip UAM
334
+ if (timePressure === 'critical') {
335
+ return {
336
+ level: 'none',
337
+ sections: [],
338
+ reason: 'Critical time pressure - skipping UAM to avoid timeout',
339
+ estimatedOverheadMs: 0,
340
+ taskType,
341
+ timePressure,
342
+ historicalBenefit,
343
+ };
344
+ }
345
+ // Factor 6: Select relevant sections
346
+ const relevantSections = selectRelevantSections(instruction, taskType);
347
+ const estimatedOverhead = calculateOverhead(relevantSections);
348
+ // Factor 7: Check if overhead fits within time budget
349
+ const overheadRatio = estimatedOverhead / (timeoutSec * 1000);
350
+ if (timePressure === 'high' || overheadRatio > 0.1) {
351
+ // Use minimal context - only most relevant section
352
+ const minimalSections = relevantSections.slice(0, 1);
353
+ return {
354
+ level: 'minimal',
355
+ sections: minimalSections,
356
+ reason: `High time pressure - using minimal context (${minimalSections.join(', ') || 'best_practices'})`,
357
+ estimatedOverheadMs: calculateOverhead(minimalSections),
358
+ taskType,
359
+ timePressure,
360
+ historicalBenefit,
361
+ };
362
+ }
363
+ // Default: Full context for everything else
364
+ return {
365
+ level: 'full',
366
+ sections: relevantSections.length > 0 ? relevantSections : ['coding'],
367
+ reason: `Full context for ${taskType} task (${timePressure} pressure)`,
368
+ estimatedOverheadMs: estimatedOverhead,
369
+ taskType,
370
+ timePressure,
371
+ historicalBenefit,
372
+ };
373
+ }
374
+ /**
375
+ * Generate context string based on decision
376
+ */
377
+ export function generateContext(decision) {
378
+ if (decision.level === 'none' || decision.sections.length === 0) {
379
+ return '';
380
+ }
381
+ const contextParts = ['## UAM Memory Context\n'];
382
+ for (const section of decision.sections) {
383
+ const sectionConfig = CONTEXT_SECTIONS[section];
384
+ if (sectionConfig) {
385
+ contextParts.push(sectionConfig.content);
386
+ }
387
+ }
388
+ return contextParts.join('\n');
389
+ }
390
+ /**
391
+ * Progressive context strategy for retry scenarios
392
+ *
393
+ * Returns context levels to try in order based on initial failure analysis.
394
+ */
395
+ export function getProgressiveContextLevels(instruction, initialError, metadata = {}) {
396
+ const decision = decideContextLevel(instruction, metadata);
397
+ // If we already decided 'none' for a good reason, don't retry with more
398
+ if (decision.level === 'none' && LOW_BENEFIT_CATEGORIES.has(decision.taskType)) {
399
+ return ['none']; // Don't escalate for pure reasoning tasks
400
+ }
401
+ // Analyze error to see if context might help
402
+ const errorLower = initialError.toLowerCase();
403
+ const contextMightHelp = errorLower.includes('unknown') ||
404
+ errorLower.includes('how to') ||
405
+ errorLower.includes('what is') ||
406
+ errorLower.includes('command not found') ||
407
+ errorLower.includes('invalid syntax') ||
408
+ errorLower.includes('format') ||
409
+ errorLower.includes('parse');
410
+ if (!contextMightHelp) {
411
+ return [decision.level]; // Don't escalate if error is unrelated to knowledge
412
+ }
413
+ // Progressive escalation based on starting point
414
+ switch (decision.level) {
415
+ case 'none':
416
+ return ['none', 'minimal', 'full'];
417
+ case 'minimal':
418
+ return ['minimal', 'full'];
419
+ case 'full':
420
+ return ['full']; // Already at max
421
+ default:
422
+ return ['none', 'minimal', 'full'];
423
+ }
424
+ }
425
+ /**
426
+ * Export configuration for Python agent integration
427
+ */
428
+ export function exportConfigForPython(instruction, metadata = {}) {
429
+ const decision = decideContextLevel(instruction, metadata);
430
+ const context = generateContext(decision);
431
+ return JSON.stringify({
432
+ level: decision.level,
433
+ sections: decision.sections,
434
+ reason: decision.reason,
435
+ estimatedOverheadMs: decision.estimatedOverheadMs,
436
+ taskType: decision.taskType,
437
+ timePressure: decision.timePressure,
438
+ historicalBenefit: decision.historicalBenefit,
439
+ context,
440
+ }, null, 2);
441
+ }
442
+ // Export main interface
443
+ export const HybridAdaptiveContext = {
444
+ classifyTask,
445
+ assessTimePressure,
446
+ getHistoricalBenefit,
447
+ recordOutcome,
448
+ decideContextLevel,
449
+ generateContext,
450
+ selectRelevantSections,
451
+ calculateOverhead,
452
+ getProgressiveContextLevels,
453
+ exportConfigForPython,
454
+ };
455
+ export default HybridAdaptiveContext;
456
+ //# sourceMappingURL=adaptive-context.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"adaptive-context.js","sourceRoot":"","sources":["../../src/memory/adaptive-context.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,EAAE,YAAY,IAAI,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AA+BxE,gEAAgE;AAChE,MAAM,sBAAsB,GAAG,IAAI,GAAG,CAAC;IACrC,WAAW;IACX,YAAY;IACZ,yBAAyB;IACzB,OAAO;IACP,YAAY;IACZ,cAAc;CACf,CAAC,CAAC;AAEH,mEAAmE;AACnE,MAAM,iBAAiB,GAAG;IACxB,UAAU;IACV,YAAY;IACZ,UAAU;IACV,SAAS;IACT,YAAY;IACZ,SAAS;IACT,UAAU;IACV,YAAY;IACZ,WAAW;IACX,aAAa;IACb,oBAAoB;IACpB,YAAY;IACZ,cAAc;IACd,QAAQ;CACT,CAAC;AAEF,+CAA+C;AAC/C,MAAM,qBAAqB,GAAG;IAC5B,UAAU;IACV,MAAM;IACN,OAAO;IACP,SAAS;IACT,KAAK;IACL,QAAQ;IACR,YAAY;IACZ,SAAS;IACT,KAAK;IACL,WAAW;IACX,UAAU;IACV,QAAQ;IACR,QAAQ;IACR,UAAU;IACV,UAAU;IACV,KAAK;IACL,SAAS;IACT,OAAO;IACP,UAAU;IACV,OAAO;IACP,WAAW;IACX,QAAQ;CACT,CAAC;AAEF,4DAA4D;AAC5D,MAAM,gBAAgB,GAGlB;IACF,QAAQ,EAAE;QACR,MAAM,EAAE,GAAG;QACX,QAAQ,EAAE,CAAC,KAAK,EAAE,UA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"0.7.4",
3
+ "version": "0.8.0",
4
4
  "description": "Universal AI agent memory system - CLAUDE.md templates, memory, worktrees for Claude Code, Factory.AI, VSCode, OpenCode",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",