universal-agent-memory 1.7.0 → 1.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "universal-agent-memory",
3
- "version": "1.7.0",
3
+ "version": "1.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",
@@ -1,4 +1,4 @@
1
- <!-- CLAUDE.md v10.14-opt - 10 Model Outcome Success Optimizations -->
1
+ <!-- CLAUDE.md v10.15-opt - 10 Model Outcome Success Optimizations -->
2
2
  <coding_guidelines>
3
3
 
4
4
  # {{PROJECT_NAME}} - Autonomous Agent Guide
@@ -18,6 +18,43 @@
18
18
 
19
19
  ---
20
20
 
21
+ ## CONTEXT PRIORITY (Optimization #2)
22
+
23
+ For time-sensitive tasks (scheduling, logic puzzles, math, <60s timeout):
24
+ - SKIP pattern analysis, go STRAIGHT to implementation
25
+ - Pattern Router is OPTIONAL for pure reasoning tasks
26
+
27
+ ---
28
+
29
+ ## VERIFIER-FIRST PRINCIPLE (Optimization #5 - HIGHEST IMPACT)
30
+
31
+ **37% of failures are format/output mismatches. This fixes them.**
32
+
33
+ BEFORE implementing ANY task with tests/verifier:
34
+ 1. **READ the verifier/test code FIRST** - understand exact expectations
35
+ 2. **EXTRACT**: expected file paths, output format, return values
36
+ 3. **CREATE stub outputs** matching expected format immediately
37
+ 4. **THEN implement** the actual logic
38
+ 5. **RUN verifier after EACH change**
39
+
40
+ ```bash
41
+ # Example: Task expects cli_tool and output.txt
42
+ echo '#!/usr/bin/env python3\nprint("stub")' > cli_tool && chmod +x cli_tool
43
+ echo '0' > output.txt
44
+ ./verifier.sh # Confirm files detected BEFORE implementing
45
+ ```
46
+
47
+ ---
48
+
49
+ ## INSTANT REFUSE CHECK (Optimization #6)
50
+
51
+ Before Pattern Router, check these IMPOSSIBLE conditions:
52
+ - "implement GPT/LLM in <10KB" → IMPOSSIBLE (weights exceed limit)
53
+ - "compress X to Y bytes" where entropy(X) > Y → IMPOSSIBLE (Shannon limit)
54
+ - "solve NP-hard optimally at scale" → IMPOSSIBLE (complexity)
55
+
56
+ If matched: Create `IMPOSSIBLE.md` with explanation, move on. Do NOT attempt.
57
+
21
58
  ---
22
59
 
23
60
  ## CODE FIELD
@@ -34,8 +71,6 @@ Do not handle only the happy path.
34
71
 
35
72
  ---
36
73
 
37
- ---
38
-
39
74
  ## PATTERN ROUTER (MANDATORY FIRST)
40
75
 
41
76
  Before ANY work, print:
@@ -48,7 +83,11 @@ ACTIVE: [list YES only]
48
83
  === END ===
49
84
  ```
50
85
 
51
- ---
86
+ **P11 ENFORCEMENT (Optimization #3):** If task involves chess/stats/crypto/compression → P11=Y is MANDATORY
87
+ - Chess: python-chess + stockfish (NOT custom FEN parsing)
88
+ - Statistics: scipy.stats, R CRAN packages (NOT custom implementations)
89
+ - Compression: zlib, lz4, brotli (NOT custom Huffman/arithmetic)
90
+ - Crypto: hashlib, pycryptodome (NOT custom implementations)
52
91
 
53
92
  ---
54
93
 
@@ -67,7 +106,7 @@ ACTIVE: [list YES only]
67
106
  | 8 | CLIoverLib | Uncertain env | `subprocess` > library import |
68
107
  | 9 | FormatPipeline | Non-text data | Convert→standard format first |
69
108
  | 10 | Whitelist | Security filter | Allow-list ONLY, never blacklist |
70
- | 11 | PreComputed | Chess/crypto/ML | Search existing solution FIRST |
109
+ | 11 | PreComputed | Chess/crypto/ML | **MANDATORY**: Use library, NOT custom |
71
110
 
72
111
  ### Output (P12-P16)
73
112
  | P | Name | Trigger | Action |
@@ -76,7 +115,7 @@ ACTIVE: [list YES only]
76
115
  | 13 | IRL | Tests partial pass | Fix specific failure, re-run, iterate |
77
116
  | 14 | OFV | Format specified | Validate output matches spec |
78
117
  | 15 | ER | Exception thrown | Read trace, fix error, re-run |
79
- | 16 | TFE | Any output task | `touch` placeholders FIRST, then implement |
118
+ | 16 | **TFE+** | Any output task | Create WORKING minimal outputs FIRST, then enhance |
80
119
 
81
120
  ### Constraint (P17-P20)
82
121
  | P | Name | Trigger | Action |
@@ -116,6 +155,22 @@ ACTIVE: [list YES only]
116
155
 
117
156
  ---
118
157
 
158
+ ## OUTPUT-FIRST DEVELOPMENT (Optimization #8 - P16 Upgraded)
159
+
160
+ **BEFORE complex implementation:**
161
+ 1. Create ALL expected output files with minimal valid content
162
+ 2. Run verifier to confirm files are detected
163
+ 3. THEN replace with real implementation
164
+ 4. Run verifier after EACH replacement
165
+
166
+ ```bash
167
+ # Example: Task says "create cli_tool and prediction.txt"
168
+ echo '#!/usr/bin/env python3\nprint("hello")' > cli_tool && chmod +x cli_tool
169
+ echo '0.5' > prediction.txt
170
+ ./verifier.sh # Confirm both detected
171
+ # THEN implement real logic
172
+ ```
173
+
119
174
  ---
120
175
 
121
176
  ## COMPLETION GATES (MANDATORY)
@@ -135,6 +190,37 @@ ACTIVE: [list YES only]
135
190
 
136
191
  ---
137
192
 
193
+ ## MANDATORY PRE-COMPLETION CHECKLIST (Optimization #1)
194
+
195
+ **BEFORE saying "done", PRINT this checklist:**
196
+ ```
197
+ === COMPLETION VERIFICATION ===
198
+ ☑/☐ All output files verified with `ls -la`
199
+ ☑/☐ Tests run and all pass
200
+ ☑/☐ If compression: round-trip tested
201
+ ☑/☐ If CLI tool: tested as `./script` not `python script`
202
+ ☑/☐ Constraints from task satisfied
203
+ === END ===
204
+ ```
205
+
206
+ **If ANY box is ☐, FIX IT before proceeding.**
207
+
208
+ ---
209
+
210
+ ## FAILURE TRIAGE LOOP (Optimization #4 - Prescriptive Iteration)
211
+
212
+ When tests fail:
213
+ 1. **Copy EXACT error message** (not paraphrase)
214
+ 2. **Classify error type:**
215
+ - `missing-file` → create it immediately
216
+ - `wrong-format` → read expected format from test/verifier
217
+ - `wrong-value` → check algorithm logic, add debug output
218
+ - `timeout` → reduce scope, submit partial
219
+ - `dependency` → pip install / apt-get
220
+ 3. **Apply specific fix** for that error type
221
+ 4. **Re-run ONLY the failing test**
222
+ 5. **NEVER refactor passing code** while fixing failures
223
+
138
224
  ---
139
225
 
140
226
  ## NEAR-MISS ITERATION PROTOCOL (P26 ENFORCED - MANDATORY)
@@ -157,13 +243,20 @@ Total time: 120s → Iteration budget: 36s minimum
157
243
  Total time: 60s → Iteration budget: 18s minimum
158
244
  ```
159
245
 
160
- **Success Pattern (pytorch-model-cli 3/6→6/6):**
161
- - Test 1 failed: missing shebang → added `#!/usr/bin/env python3`
162
- - Test 2 failed: not executable → added `chmod +x`
163
- - Test 3 failed: wrong output format → matched expected format exactly
164
-
165
246
  ---
166
247
 
248
+ ## ERROR FAST-PATHS (Optimization #10)
249
+
250
+ | Error Pattern | Instant Fix |
251
+ |---------------|-------------|
252
+ | ModuleNotFoundError: X | `pip install X` |
253
+ | Permission denied | `chmod +x file` |
254
+ | command not found: X | `apt-get install X` or `which X` |
255
+ | SyntaxError: shebang | Add `#!/usr/bin/env python3` as line 1 |
256
+ | JSONDecodeError | Validate with `python -m json.tool file.json` |
257
+ | Connection refused | Check service running, correct port |
258
+ | No such file or directory | Create the file/directory first |
259
+
167
260
  ---
168
261
 
169
262
  ## DECODER-FIRST & ROUND-TRIP PROTOCOL (P35 ENFORCED - MANDATORY)
@@ -178,19 +271,8 @@ When a task provides a decoder, validator, or expected output format:
178
271
  5. **Never optimize** until round-trip verification passes
179
272
  6. **If round-trip fails**: debug the format mismatch, do NOT optimize for size/speed
180
273
 
181
- **Round-Trip Verification Script:**
182
- ```bash
183
- # For compression tasks
184
- python3 -c "
185
- import sys; data = open('input','rb').read()
186
- compressed = compress(data); decompressed = decompress(compressed)
187
- assert data == decompressed, f'MISMATCH: {len(data)} vs {len(decompressed)}'
188
- print('Round-trip: PASS')
189
- "
190
- ```
191
-
192
- **For CLI tools (P32):** Always verify execution method matches verifier:
193
274
  ```bash
275
+ # For CLI tools (P32): Always verify execution method matches verifier
194
276
  chmod +x ./script.py # Make executable
195
277
  head -1 ./script.py # Verify shebang exists: #!/usr/bin/env python3
196
278
  ./script.py --help # Test as verifier runs it (NOT python3 script.py)
@@ -198,8 +280,6 @@ head -1 ./script.py # Verify shebang exists: #!/usr/bin/env python3
198
280
 
199
281
  ---
200
282
 
201
- ---
202
-
203
283
  ## ERROR RECOVERY ESCALATION
204
284
 
205
285
  On any test failure or error:
@@ -212,8 +292,6 @@ On any test failure or error:
212
292
 
213
293
  ---
214
294
 
215
- ---
216
-
217
295
  ## TIME BUDGET ALLOCATION
218
296
 
219
297
  For complex tasks (compilation, VM, multi-service):
@@ -225,8 +303,6 @@ If timeout approaching: submit best partial solution rather than nothing.
225
303
 
226
304
  ---
227
305
 
228
- ---
229
-
230
306
  ## MEMORY SYSTEM
231
307
 
232
308
  ```
@@ -243,12 +319,9 @@ sqlite3 {{MEMORY_DB_PATH}} "SELECT * FROM memories ORDER BY id DESC LIMIT 10;"
243
319
  {{MEMORY_STORE_CMD}} "lesson" --importance 8
244
320
  ```
245
321
 
246
- **Schema columns:** id, timestamp, type, content, project_id, importance (1-10)
247
-
248
- ---
249
-
250
322
  ---
251
323
 
324
+ {{#unless IS_BENCHMARK}}
252
325
  ## WORKTREE WORKFLOW
253
326
 
254
327
  **ALL changes use worktrees. NO EXCEPTIONS.**
@@ -263,8 +336,6 @@ git add -A && git commit -m "type: description"
263
336
 
264
337
  ---
265
338
 
266
- ---
267
-
268
339
  ## MULTI-AGENT
269
340
 
270
341
  **Before claiming work:**
@@ -280,24 +351,6 @@ uam agent overlaps --resource "<files>"
280
351
 
281
352
  ---
282
353
 
283
- ---
284
-
285
- ## DECISION LOOP
286
-
287
- ```
288
- 0. CLASSIFY → backup? tool? steps?
289
- 1. PROTECT → cp file file.bak
290
- 2. MEMORY → query relevant context
291
- 3. AGENTS → check overlaps
292
- 4. SKILLS → check {{SKILLS_PATH}}
293
- 5. WORKTREE → create, work, PR
294
- 6. VERIFY → gates pass
295
- ```
296
-
297
- ---
298
-
299
- ---
300
-
301
354
  ## DROIDS
302
355
 
303
356
  | Droid | Use For |
@@ -310,6 +363,7 @@ uam agent overlaps --resource "<files>"
310
363
  | sysadmin-expert | Kernel, QEMU, networking |
311
364
  | ml-training-expert | Model training, MTEB |
312
365
 
366
+ {{/unless}}
313
367
  ---
314
368
 
315
369
  {{#if HAS_INFRA}}
@@ -367,6 +421,7 @@ uam agent overlaps --resource "<files>"
367
421
 
368
422
  ---
369
423
 
424
+ {{#unless IS_BENCHMARK}}
370
425
  ## COMPLETION CHECKLIST
371
426
 
372
427
  ```
@@ -384,8 +439,6 @@ uam agent overlaps --resource "<files>"
384
439
 
385
440
  ---
386
441
 
387
- ---
388
-
389
442
  ## COMPLETION PROTOCOL
390
443
 
391
444
  ```
@@ -399,6 +452,7 @@ MERGE → DEPLOY → MONITOR → FIX (iterate until 100%)
399
452
  ```
400
453
 
401
454
  **Never "done" until:** PR merged + deployed + verified working
455
+ {{/unless}}
402
456
 
403
457
  ---
404
458
 
@@ -423,20 +477,13 @@ MERGE → DEPLOY → MONITOR → FIX (iterate until 100%)
423
477
 
424
478
  ---
425
479
 
426
- ## CRITICAL REMINDERS (READ LAST)
427
-
428
- 1. **BACKUP FIRST**: `cp file file.bak` before ANY modification
429
- 2. **CHECK ENV**: `which tool` before using
430
- 3. **CLI > LIBRARIES**: Use subprocess when uncertain
431
- 4. **VERIFY OUTPUTS**: `ls -la` ALL expected files before "done"
432
- 5. **ITERATE**: On partial test pass, fix specific failure, re-run (P26) - **MANDATORY 30% time**
433
- 6. **CREATE > EXPLAIN**: Missing output? CREATE it, don't explain
434
- 7. **REFUSE IMPOSSIBLE**: Compression below Shannon limit → IMPOSSIBLE.md
435
- 8. **DECODER FIRST**: When decoder/validator provided, READ IT FIRST (P35)
436
- 9. **ERROR ESCALATION**: Same error twice → change approach completely
437
- 10. **TIME BUDGET**: Reserve 30% for iteration/debugging
438
- 11. **LIBRARY FIRST**: For chess use python-chess+stockfish, for stats use CRAN packages, for compression use zlib/lz4
439
- 12. **CLI EXECUTION**: Test `./script` not `python script.py` - add shebang + chmod +x (P32)
480
+ ## FINAL DIRECTIVES (Optimization #7 - HIGHEST PRIORITY, READ LAST)
481
+
482
+ 1. **READ verifier/test BEFORE implementing** - understand exact expected format
483
+ 2. **`ls -la` ALL outputs BEFORE saying done** - 37% of failures are missing files
484
+ 3. **If >50% tests pass, ITERATE** - do NOT restart, fix specific failures
485
+ 4. **Use libraries, not custom implementations** - python-chess, scipy, zlib
486
+ 5. **When same error twice, CHANGE APPROACH COMPLETELY** - don't retry same fix
440
487
 
441
488
  **P17 Active? Print:**
442
489
  ```