universal-agent-memory 2.3.0 → 2.4.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.
@@ -125,7 +125,7 @@ async function buildContext(analysis, config) {
125
125
  // Build relevant patterns (pruned by project type to save tokens)
126
126
  const relevantPatterns = buildRelevantPatterns(analysis);
127
127
  // Template version for reproducibility
128
- const TEMPLATE_VERSION = '10.17-opt';
128
+ const TEMPLATE_VERSION = '10.18-opt';
129
129
  return {
130
130
  // Project basics
131
131
  PROJECT_NAME: analysis.projectName || config.project.name,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "universal-agent-memory",
3
- "version": "2.3.0",
3
+ "version": "2.4.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,7 +1,8 @@
1
- <!-- CLAUDE.md v2.3.0 - 39 Model Outcome Success Optimizations -->
1
+ <!-- CLAUDE.md v2.4.0 - 46 Model Outcome Success Optimizations -->
2
2
  <!-- Optimizations #22-27: Template Compression, Structured Iteration, Inline Domain Knowledge, Early Impossibility Exit, Conditional Context, Remove Emphasis Theater -->
3
3
  <!-- Optimizations #28-34: Mandatory Verifier Loop, Decoder-First Gate, Context Stripping, Environment Check, Schema Diff, State Protection, Conditional Domain -->
4
4
  <!-- Optimizations #35-39: Incremental Output Checkpoint, Last-Mile Debugging, Automated Round-Trip Gate, Token Budget, Failure-Weighted Domain -->
5
+ <!-- Optimizations #40-46: Code Field Restore, Pattern Router, Full 36-Pattern Reference, Critical Reminders, Infra Pipelines, Paths Reference, Reviews Gate -->
5
6
  <coding_guidelines>
6
7
 
7
8
  # {{PROJECT_NAME}} - Autonomous Agent Guide
@@ -18,6 +19,34 @@
18
19
 
19
20
  ---
20
21
 
22
+ ## CODE FIELD (#40)
23
+
24
+ **Before writing code:** State assumptions, bound scope, identify edge cases.
25
+
26
+ ```
27
+ Do not write code before stating assumptions.
28
+ Do not claim correctness you haven't verified.
29
+ Do not handle only the happy path.
30
+ ```
31
+
32
+ **Output:** Assumptions → Code (smaller than expected) → "Handles/Does NOT handle"
33
+
34
+ ---
35
+
36
+ ## PATTERN ROUTER (MANDATORY FIRST) (#41)
37
+
38
+ Before ANY work, print:
39
+ ```
40
+ === PATTERN ROUTER ===
41
+ Task: [summary]
42
+ Classification: [file-creation|constraint|adversarial|pipeline|impossible]
43
+ PATTERNS: P12:[Y/N] P17:[Y/N] P20:[Y/N] P11:[Y/N] P35:[Y/N]
44
+ ACTIVE: [list YES only]
45
+ === END ===
46
+ ```
47
+
48
+ ---
49
+
21
50
  ## FIRST: IMPOSSIBILITY CHECK (#25)
22
51
 
23
52
  Before any work, check if task is impossible:
@@ -119,25 +148,70 @@ Never: say "done" at <100% | refactor passing code | start new approach when >80
119
148
 
120
149
  ---
121
150
 
122
- ## PATTERNS (Merged P12+P16, P13+P26, +#28-34)
123
-
124
- | ID | Trigger | Action |
125
- |----|---------|--------|
126
- | P1 | Any task | `which tool` before use |
127
- | P3 | Modifies config/db | `cp file file.bak` first |
128
- | P5 | Compression/ML/search | Detect impossible early |
129
- | P8 | Uncertain env | `subprocess` > library import |
130
- | P11 | Chess/crypto/ML | Use library: python-chess, scipy, zlib, hashlib |
131
- | P12 | Creates files | `ls -la` verify all outputs exist |
132
- | P13 | Tests partial pass | Fix specific failure, re-run (merged with P26) |
133
- | P17 | "exactly/only/must" | Extract constraints, print checklist |
134
- | P20 | "bypass/break/exploit" | Attacker mindset, enumerate vectors |
135
- | P22 | Git recovery | `cp -r .git .git.bak` first |
136
- | P32 | CLI tool | Test `./script` not `python script` |
137
- | P35 | Decoder given | **BLOCKING**: Read decoder, round-trip MUST pass first |
138
- | P37 | Output format specified | Diff output schema vs test expectations before verifier |
139
- | P38 | Recovery/forensics task | COPY ALL artifacts before ANY read operation |
140
- | P39 | Tests use separate env | Check Dockerfile; pip installs may not persist |
151
+ ## PATTERNS REFERENCE (#42)
152
+
153
+ ### Core (P1-P11)
154
+ | P | Trigger | Action |
155
+ |---|---------|--------|
156
+ | 1 | Any task | `which tool` before use |
157
+ | 2 | Complex task | Convert to numbered recipe steps |
158
+ | 3 | Modifies config/db | `cp file file.bak` FIRST |
159
+ | 4 | Ambiguous how | Specify exact tool+flags |
160
+ | 5 | Compression/ML/search | Detect impossible early, refuse |
161
+ | 6 | Critical rules | Put at END of context (recency bias) |
162
+ | 7 | Any task | Classify: state-sensitive→backup, tool→specify |
163
+ | 8 | Uncertain env | `subprocess` > library import |
164
+ | 9 | Non-text data | Convert→standard format first |
165
+ | 10 | Security filter | Allow-list ONLY, never blacklist |
166
+ | 11 | Chess/crypto/ML | Use library: python-chess, scipy, zlib, hashlib |
167
+
168
+ ### Output (P12-P16)
169
+ | P | Trigger | Action |
170
+ |---|---------|--------|
171
+ | 12 | Creates files | `ls -la` verify ALL outputs exist before done |
172
+ | 13 | Tests partial pass | Fix specific failure, re-run, iterate (merged P26) |
173
+ | 14 | Format specified | Validate output matches spec exactly |
174
+ | 15 | Exception thrown | Read full trace, fix error, re-run |
175
+ | 16 | Any output task | `touch` placeholders FIRST, then implement |
176
+
177
+ ### Constraint (P17-P20)
178
+ | P | Trigger | Action |
179
+ |---|---------|--------|
180
+ | 17 | "exactly/only/must" | Extract constraints, print checklist |
181
+ | 18 | Multi-step | Identify tool per stage, chain |
182
+ | 19 | Impossible markers | REFUSE immediately, create IMPOSSIBLE.md |
183
+ | 20 | "bypass/break/exploit" | Attacker mindset, enumerate vectors |
184
+
185
+ ### Domain (P21-P26)
186
+ | P | Trigger | Action |
187
+ |---|---------|--------|
188
+ | 21 | Chess | Use Stockfish: `stockfish` with FEN |
189
+ | 22 | Git recovery | `cp -r .git .git.bak` FIRST, then `git fsck` |
190
+ | 23 | Compress impossible | Refuse if target < Shannon limit |
191
+ | 24 | Polyglot | Search existing examples first |
192
+ | 25 | Multi-service | Configure in dependency order, test each |
193
+ | 26 | >50% tests pass | Focus on specific failures, 30% time reserved |
194
+
195
+ ### Verification (P27-P31)
196
+ | P | Trigger | Action |
197
+ |---|---------|--------|
198
+ | 27 | Output dir constraint | Remove non-required files before done |
199
+ | 28 | Service task | `curl` test BEFORE claiming done |
200
+ | 29 | "all/both/every" | Find ALL solutions, not just first |
201
+ | 30 | "% threshold" | Iterate until threshold met |
202
+ | 31 | Transform task | Round-trip: `original == decompress(compress(original))` |
203
+
204
+ ### Execution (P32-P39)
205
+ | P | Trigger | Action |
206
+ |---|---------|--------|
207
+ | 32 | CLI tool | Test `./script` not `python script` |
208
+ | 33 | Numerical | Multiple seeds, edge cases, tolerance 1e-6 |
209
+ | 34 | Image analysis | Use recognition tools, not reasoning |
210
+ | 35 | Decoder given | **BLOCKING**: Read decoder, round-trip MUST pass first |
211
+ | 36 | Competition | Research strategies BEFORE implementing |
212
+ | 37 | Output format specified | Diff output schema vs test expectations before verifier |
213
+ | 38 | Recovery/forensics | COPY ALL artifacts before ANY read operation |
214
+ | 39 | Tests use separate env | Check Dockerfile; pip installs may not persist |
141
215
 
142
216
  ---
143
217
 
@@ -344,10 +418,19 @@ uam agent overlaps --resource "<files>"
344
418
  {{/unless}}
345
419
 
346
420
  {{#if HAS_INFRA}}
347
- ## INFRASTRUCTURE
421
+ ## INFRASTRUCTURE (#43)
422
+
423
+ **Secrets in GitHub → use pipelines for secret-dependent ops.**
348
424
 
349
- Secrets in GitHub. Use pipelines for secret-dependent ops.
350
- Prohibited locally: `terraform apply`, `kubectl apply/delete`
425
+ | Task | Pipeline |
426
+ |------|----------|
427
+ | Terraform | `iac-terraform-cicd.yml` |
428
+ | kubectl ops | `ops-approved-operations.yml` |
429
+ | One-time | `ops-create-ephemeral.yml` |
430
+
431
+ **Two-phase:** Local proof (no secrets) → IaC parity (via pipeline)
432
+
433
+ **PROHIBITED locally:** `terraform apply`, `kubectl apply/delete`, `kubectl create secret`
351
434
  {{/if}}
352
435
 
353
436
  ## COMMANDS
@@ -358,6 +441,8 @@ Prohibited locally: `terraform apply`, `kubectl apply/delete`
358
441
  {{LINT_COMMAND}} # Lint
359
442
  ```
360
443
 
444
+ **Paths:** Memory: `{{MEMORY_DB_PATH}}` | Skills: `{{SKILLS_PATH}}` | Droids: `{{DROIDS_PATH}}`
445
+
361
446
  ---
362
447
 
363
448
  {{#if HAS_PROJECT_MD}}
@@ -374,12 +459,19 @@ Prohibited locally: `terraform apply`, `kubectl apply/delete`
374
459
  ## Architecture
375
460
  {{{ARCHITECTURE_OVERVIEW}}}
376
461
  {{/if}}
462
+
463
+ {{#if ESSENTIAL_COMMANDS}}
464
+ ## Commands
465
+ ```bash
466
+ {{{ESSENTIAL_COMMANDS}}}
467
+ ```
468
+ {{/if}}
377
469
  {{/if}}
378
470
 
379
471
  ---
380
472
 
381
473
  {{#unless IS_BENCHMARK}}
382
- ## COMPLETION CHECKLIST
474
+ ## COMPLETION CHECKLIST (#45)
383
475
 
384
476
  ```
385
477
  [ ] Tests 100% pass
@@ -387,6 +479,7 @@ Prohibited locally: `terraform apply`, `kubectl apply/delete`
387
479
  [ ] Worktree used (not {{DEFAULT_BRANCH}})
388
480
  [ ] Memory updated
389
481
  [ ] PR created
482
+ [ ] Reviews passed
390
483
  {{#if HAS_INFRA}}
391
484
  [ ] IaC parity verified
392
485
  {{/if}}
@@ -431,16 +524,33 @@ Never done until: PR merged + deployed + verified
431
524
 
432
525
  ---
433
526
 
434
- ## FINAL DIRECTIVES
435
-
436
- 1. Read verifier/test before implementing
437
- 2. If decoder provided: round-trip MUST pass before optimizing (BLOCKING)
438
- 3. `ls -la` all outputs before saying done
439
- 4. Diff output schema vs test expectations before running verifier
440
- 5. If >50% tests pass, iterate - do not restart
441
- 6. Use libraries, not custom code
442
- 7. Same error twice = change approach
443
- 8. Run verifier minimum 3 times before declaring done
444
- 9. Never done if tests <100%
527
+ ## CRITICAL REMINDERS (READ LAST - RECENCY BIAS P6) (#44)
528
+
529
+ 1. **BACKUP FIRST**: `cp file file.bak` before ANY modification
530
+ 2. **CHECK ENV**: `which tool` before using
531
+ 3. **CLI > LIBRARIES**: Use subprocess when uncertain
532
+ 4. **VERIFY OUTPUTS**: `ls -la` ALL expected files before "done"
533
+ 5. **ITERATE**: On partial test pass, fix specific failure, re-run (P26)
534
+ 6. **CREATE > EXPLAIN**: Missing output? CREATE it, don't explain
535
+ 7. **REFUSE IMPOSSIBLE**: Compression below Shannon limit → IMPOSSIBLE.md
536
+ 8. **DECODER FIRST**: When decoder/validator provided, READ IT FIRST (P35)
537
+ 9. **ERROR ESCALATION**: Same error twice → change approach completely
538
+ 10. **TIME BUDGET**: Reserve 30% for iteration/debugging
539
+
540
+ **P17 Active? Print:**
541
+ ```
542
+ === CONSTRAINTS ===
543
+ [ ] constraint1 [ ] constraint2
544
+ [x] constraint1: PASS/FAIL
545
+ === END ===
546
+ ```
547
+
548
+ **P20 Active? Print:**
549
+ ```
550
+ === ADVERSARIAL ===
551
+ Target: [filter/protection]
552
+ Vectors: case, encoding, null, context-break
553
+ === END ===
554
+ ```
445
555
 
446
556
  </coding_guidelines>