universal-agent-memory 1.9.0 → 2.0.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.
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Hybrid Adaptive Context Selector for UAM (Option 4)
|
|
3
3
|
*
|
|
4
|
-
* VERSION:
|
|
4
|
+
* VERSION: 2.0.0 - 21 Model Outcome Success Optimizations
|
|
5
5
|
*
|
|
6
6
|
* Combines task classification with time-budget awareness, runtime monitoring,
|
|
7
7
|
* and historical benefit tracking for optimal context loading decisions.
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Hybrid Adaptive Context Selector for UAM (Option 4)
|
|
3
3
|
*
|
|
4
|
-
* VERSION:
|
|
4
|
+
* VERSION: 2.0.0 - 21 Model Outcome Success Optimizations
|
|
5
5
|
*
|
|
6
6
|
* Combines task classification with time-budget awareness, runtime monitoring,
|
|
7
7
|
* and historical benefit tracking for optimal context loading decisions.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "universal-agent-memory",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "2.0.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
|
|
1
|
+
<!-- CLAUDE.md v2.0.0 - 21 Model Outcome Success Optimizations -->
|
|
2
2
|
<coding_guidelines>
|
|
3
3
|
|
|
4
4
|
# {{PROJECT_NAME}} - Autonomous Agent Guide
|
|
@@ -18,288 +18,269 @@
|
|
|
18
18
|
|
|
19
19
|
---
|
|
20
20
|
|
|
21
|
-
##
|
|
21
|
+
## ENVIRONMENT SNAPSHOT (Optimization #21 - RUN FIRST)
|
|
22
22
|
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
23
|
+
**First command in ANY task:**
|
|
24
|
+
```bash
|
|
25
|
+
python3 --version 2>/dev/null; which pip3 gcc g++ make node npm git curl 2>/dev/null | head -10
|
|
26
|
+
```
|
|
27
|
+
Takes <2s, prevents 30-60s of tool discovery later.
|
|
28
|
+
|
|
29
|
+
---
|
|
30
|
+
|
|
31
|
+
## CONTEXT BUDGET CONTROL (Optimization #14)
|
|
32
|
+
|
|
33
|
+
| Task Size | Action |
|
|
34
|
+
|-----------|--------|
|
|
35
|
+
| Simple (<200 words, 1 file) | Skip Pattern Router, go direct |
|
|
36
|
+
| Medium (multi-file, tests) | 1-line classification only |
|
|
37
|
+
| Complex (multi-service) | Full router with patterns |
|
|
38
|
+
| Timeout <120s | Skip all protocol blocks |
|
|
26
39
|
|
|
27
40
|
---
|
|
28
41
|
|
|
29
42
|
## VERIFIER-FIRST PRINCIPLE (Optimization #5 - HIGHEST IMPACT)
|
|
30
43
|
|
|
31
|
-
**37% of failures are format/output mismatches
|
|
44
|
+
**37% of failures are format/output mismatches.**
|
|
32
45
|
|
|
33
46
|
BEFORE implementing ANY task with tests/verifier:
|
|
34
|
-
1. **READ the verifier/test code FIRST**
|
|
47
|
+
1. **READ the verifier/test code FIRST**
|
|
35
48
|
2. **EXTRACT**: expected file paths, output format, return values
|
|
36
49
|
3. **CREATE stub outputs** matching expected format immediately
|
|
37
|
-
4. **
|
|
38
|
-
5. **RUN verifier after EACH change**
|
|
50
|
+
4. **RUN verifier after EACH change**
|
|
39
51
|
|
|
40
52
|
```bash
|
|
41
|
-
# Example: Task expects cli_tool and output.txt
|
|
42
53
|
echo '#!/usr/bin/env python3\nprint("stub")' > cli_tool && chmod +x cli_tool
|
|
43
|
-
|
|
44
|
-
|
|
54
|
+
./verifier.sh # Confirm detected BEFORE implementing
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
---
|
|
58
|
+
|
|
59
|
+
## DEPENDENCY PRE-FLIGHT (Optimization #12)
|
|
60
|
+
|
|
61
|
+
**Before writing code, check and install:**
|
|
62
|
+
```bash
|
|
63
|
+
# Check critical deps
|
|
64
|
+
which python3 pip3 gcc make cmake node npm git curl wget || echo "MISSING"
|
|
65
|
+
# Install missing (budget 20% of time for setup)
|
|
66
|
+
pip3 install -q numpy scipy 2>/dev/null # Example
|
|
45
67
|
```
|
|
46
68
|
|
|
47
69
|
---
|
|
48
70
|
|
|
49
71
|
## INSTANT REFUSE CHECK (Optimization #6)
|
|
50
72
|
|
|
51
|
-
Before Pattern Router, check
|
|
73
|
+
Before Pattern Router, check IMPOSSIBLE conditions:
|
|
52
74
|
- "implement GPT/LLM in <10KB" → IMPOSSIBLE (weights exceed limit)
|
|
53
75
|
- "compress X to Y bytes" where entropy(X) > Y → IMPOSSIBLE (Shannon limit)
|
|
54
76
|
- "solve NP-hard optimally at scale" → IMPOSSIBLE (complexity)
|
|
55
77
|
|
|
56
|
-
If matched: Create `IMPOSSIBLE.md
|
|
78
|
+
If matched: Create `IMPOSSIBLE.md`, move on. Do NOT attempt.
|
|
57
79
|
|
|
58
80
|
---
|
|
59
81
|
|
|
60
|
-
##
|
|
82
|
+
## DOMAIN RESEARCH FIRST (Optimization #16)
|
|
61
83
|
|
|
62
|
-
**
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
Do not claim correctness you haven't verified.
|
|
67
|
-
Do not handle only the happy path.
|
|
68
|
-
```
|
|
69
|
-
|
|
70
|
-
**Output:** Assumptions → Code (smaller than expected) → "Handles/Does NOT handle"
|
|
84
|
+
**For unfamiliar domains (games, crypto, rendering, compilers):**
|
|
85
|
+
1. Search for EXISTING solutions/examples first (10% time budget)
|
|
86
|
+
2. Adapt proven approach rather than inventing from scratch
|
|
87
|
+
3. Only implement from theory if no examples found
|
|
71
88
|
|
|
72
89
|
---
|
|
73
90
|
|
|
74
|
-
## PATTERN ROUTER (
|
|
91
|
+
## PATTERN ROUTER (Optimization #20 - CONDITIONAL)
|
|
75
92
|
|
|
76
|
-
|
|
93
|
+
**Simple tasks:** Skip entirely
|
|
94
|
+
**Medium tasks:** Print only:
|
|
77
95
|
```
|
|
78
|
-
===
|
|
79
|
-
Task: [summary]
|
|
80
|
-
Classification: [file-creation|constraint|adversarial|pipeline|impossible]
|
|
81
|
-
PATTERNS: P12:[Y/N] P17:[Y/N] P20:[Y/N] P11:[Y/N] P18:[Y/N]
|
|
82
|
-
ACTIVE: [list YES only]
|
|
83
|
-
=== END ===
|
|
96
|
+
=== TASK: [summary] | CLASS: [type] | ACTIVE: [P-numbers] ===
|
|
84
97
|
```
|
|
85
|
-
|
|
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)
|
|
98
|
+
**Complex tasks:** Full router with pattern listing
|
|
91
99
|
|
|
92
100
|
---
|
|
93
101
|
|
|
94
|
-
## PATTERNS
|
|
102
|
+
## CORE PATTERNS (P1-P11)
|
|
95
103
|
|
|
96
|
-
### Core (P1-P11)
|
|
97
104
|
| P | Name | Trigger | Action |
|
|
98
105
|
|---|------|---------|--------|
|
|
99
|
-
| 1 | EnvIsolation | Any task |
|
|
100
|
-
| 2 | Recipe | Complex task | Convert to numbered steps |
|
|
106
|
+
| 1 | EnvIsolation | Any task | `which tool` before use |
|
|
101
107
|
| 3 | StateProtect | Modifies config/db | `cp file file.bak` FIRST |
|
|
102
|
-
| 4 | ToolSpec | Ambiguous how | Specify exact tool+flags |
|
|
103
108
|
| 5 | Impossible | Compression/ML/search | Detect early, refuse |
|
|
104
|
-
| 6 | RecencyBias | Critical rules | Put at END of context |
|
|
105
|
-
| 7 | Classify | Any task | State-sensitive→backup, Tool→specify |
|
|
106
109
|
| 8 | CLIoverLib | Uncertain env | `subprocess` > library import |
|
|
107
|
-
|
|
|
108
|
-
|
|
109
|
-
|
|
110
|
+
| 11 | PreComputed | Chess/crypto/ML | **Use library, NOT custom**: python-chess, scipy, zlib, hashlib |
|
|
111
|
+
|
|
112
|
+
---
|
|
113
|
+
|
|
114
|
+
## OUTPUT PATTERNS (P12-P16)
|
|
110
115
|
|
|
111
|
-
### Output (P12-P16)
|
|
112
116
|
| P | Name | Trigger | Action |
|
|
113
117
|
|---|------|---------|--------|
|
|
114
|
-
| 12 | **OEV** | Creates files | `ls -la` verify ALL outputs exist
|
|
115
|
-
| 13 | IRL | Tests partial pass | Fix specific failure, re-run
|
|
116
|
-
|
|
|
117
|
-
|
|
118
|
-
|
|
118
|
+
| 12 | **OEV** | Creates files | `ls -la` verify ALL outputs exist |
|
|
119
|
+
| 13 | IRL | Tests partial pass | Fix specific failure, re-run |
|
|
120
|
+
| 16 | **TFE+** | Any output | Create WORKING minimal outputs FIRST |
|
|
121
|
+
|
|
122
|
+
---
|
|
123
|
+
|
|
124
|
+
## CONSTRAINT PATTERNS (P17-P20)
|
|
119
125
|
|
|
120
|
-
### Constraint (P17-P20)
|
|
121
126
|
| P | Name | Trigger | Action |
|
|
122
127
|
|---|------|---------|--------|
|
|
123
|
-
| 17 | **CE** | "exactly/only/
|
|
124
|
-
| 18 | MTP | Multi-step | Identify tool per stage, chain |
|
|
125
|
-
| 19 | ITR+ | Impossible markers | REFUSE immediately, create IMPOSSIBLE.md |
|
|
128
|
+
| 17 | **CE** | "exactly/only/must" | Extract constraints, print checklist |
|
|
126
129
|
| 20 | **AT** | "bypass/break/exploit" | Attacker mindset, enumerate vectors |
|
|
127
130
|
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
| 22 | GRF | Git recovery | `cp -r .git .git.bak` FIRST, then `git fsck` |
|
|
133
|
-
| 23 | CID | Compress impossible | Refuse if target < Shannon limit |
|
|
134
|
-
| 24 | PCC | Polyglot | Search existing examples first |
|
|
135
|
-
| 25 | SCP | Multi-service | Configure in dependency order, test each |
|
|
136
|
-
| 26 | NMI | >50% tests pass | Focus on specific failures, 30% time reserved |
|
|
137
|
-
|
|
138
|
-
### Verification (P27-P31)
|
|
131
|
+
---
|
|
132
|
+
|
|
133
|
+
## DOMAIN PATTERNS (P21-P26)
|
|
134
|
+
|
|
139
135
|
| P | Name | Trigger | Action |
|
|
140
136
|
|---|------|---------|--------|
|
|
141
|
-
|
|
|
142
|
-
|
|
|
143
|
-
|
|
|
144
|
-
|
|
145
|
-
|
|
137
|
+
| 21 | CEI | Chess | Use Stockfish, NOT custom FEN parsing |
|
|
138
|
+
| 22 | GRF | Git recovery | `cp -r .git .git.bak` FIRST |
|
|
139
|
+
| 26 | **NMI** | >50% tests pass | **MANDATORY**: Focus on specific failures |
|
|
140
|
+
|
|
141
|
+
---
|
|
142
|
+
|
|
143
|
+
## EXECUTION PATTERNS (P32-P36)
|
|
146
144
|
|
|
147
|
-
### Execution (P32-P36)
|
|
148
145
|
| P | Name | Trigger | Action |
|
|
149
146
|
|---|------|---------|--------|
|
|
150
147
|
| 32 | CEV | CLI tool | Test `./script` not `python script` |
|
|
151
|
-
|
|
|
152
|
-
| 34 | ISP | Image analysis | Use recognition tools, not reasoning |
|
|
153
|
-
| 35 | **DFA** | Encode+decoder given | Read decoder FIRST, match format exactly, test round-trip BEFORE optimizing |
|
|
148
|
+
| 35 | **DFA** | Decoder given | Read decoder FIRST, test round-trip |
|
|
154
149
|
| 36 | CDR | Competition | Research strategies BEFORE implementing |
|
|
155
150
|
|
|
156
151
|
---
|
|
157
152
|
|
|
158
|
-
##
|
|
153
|
+
## AGGRESSIVE NEAR-MISS ENFORCEMENT (Optimization #11 - CRITICAL)
|
|
159
154
|
|
|
160
|
-
**
|
|
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
|
|
155
|
+
**26% of failures are near-misses (60-89% tests pass). This fixes them.**
|
|
165
156
|
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
157
|
+
**HARD GATES - Cannot proceed if violated:**
|
|
158
|
+
1. **If pass rate >60% but <100%: You are NOT done. ITERATE.**
|
|
159
|
+
2. **Print after EVERY test run:** `TESTS: X/Y passed (Z% - need 100%)`
|
|
160
|
+
3. **If remaining failures ≤2: Enter SINGLE-FAILURE-FOCUS mode**
|
|
161
|
+
4. **NEVER say "done" with passing tests <100%**
|
|
162
|
+
|
|
163
|
+
**Time Budget:**
|
|
164
|
+
```
|
|
165
|
+
Total: 300s → Reserve 90s minimum for iteration
|
|
166
|
+
Total: 120s → Reserve 36s minimum for iteration
|
|
167
|
+
Total: 60s → Reserve 18s minimum for iteration
|
|
172
168
|
```
|
|
173
169
|
|
|
174
170
|
---
|
|
175
171
|
|
|
176
|
-
##
|
|
177
|
-
|
|
178
|
-
**Cannot say "done" until ALL pass:**
|
|
172
|
+
## SINGLE-ERROR FOCUS MODE (Optimization #13 - CRITICAL)
|
|
179
173
|
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
174
|
+
**When exactly 1-2 tests fail:**
|
|
175
|
+
1. **Copy the FULL failing test function source**
|
|
176
|
+
2. **Copy the FULL error trace**
|
|
177
|
+
3. **Diff:** What does test expect vs what you produce?
|
|
178
|
+
4. **Fix ONLY that delta. Touch NOTHING else.**
|
|
179
|
+
5. **Re-run immediately after fix**
|
|
185
180
|
|
|
186
181
|
```bash
|
|
187
|
-
#
|
|
188
|
-
#
|
|
182
|
+
# NEVER do broad refactoring when close to passing
|
|
183
|
+
# ONLY fix the specific assertion that fails
|
|
189
184
|
```
|
|
190
185
|
|
|
191
186
|
---
|
|
192
187
|
|
|
193
|
-
##
|
|
188
|
+
## TEST OUTPUT DIFFING (Optimization #15)
|
|
194
189
|
|
|
195
|
-
**
|
|
196
|
-
```
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
☑/☐ If CLI tool: tested as `./script` not `python script`
|
|
202
|
-
☑/☐ Constraints from task satisfied
|
|
203
|
-
=== END ===
|
|
190
|
+
**When test fails with wrong output:**
|
|
191
|
+
```bash
|
|
192
|
+
# Save and diff actual vs expected
|
|
193
|
+
./program > /tmp/actual.out 2>&1
|
|
194
|
+
diff expected.out /tmp/actual.out | head -20
|
|
195
|
+
# Fix ONLY the differences shown
|
|
204
196
|
```
|
|
205
197
|
|
|
206
|
-
**If ANY box is ☐, FIX IT before proceeding.**
|
|
207
|
-
|
|
208
198
|
---
|
|
209
199
|
|
|
210
|
-
##
|
|
200
|
+
## COMPLETION GATES (MANDATORY)
|
|
211
201
|
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
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
|
|
202
|
+
| Gate | Check | If Fail |
|
|
203
|
+
|------|-------|---------|
|
|
204
|
+
| 1 | Output files exist (`ls -la`) | CREATE immediately |
|
|
205
|
+
| 2 | Constraints satisfied | FIX violations |
|
|
206
|
+
| 3 | **Tests 100% pass** | **ITERATE - not done** |
|
|
223
207
|
|
|
224
208
|
---
|
|
225
209
|
|
|
226
|
-
##
|
|
227
|
-
|
|
228
|
-
**CRITICAL: This protocol converted 2 failing tasks to passing in v1.3.0**
|
|
229
|
-
|
|
230
|
-
When >50% of tests pass but not all:
|
|
231
|
-
1. **STOP and assess** - You are close to success, do NOT restart
|
|
232
|
-
2. **Read EXACT failure message** for each failing test - copy the error verbatim
|
|
233
|
-
3. **Fix ONLY the specific failing test** - do not refactor passing code
|
|
234
|
-
4. **Re-run tests IMMEDIATELY** after each single fix
|
|
235
|
-
5. **MANDATORY: Reserve 30% of time budget** for this iteration loop
|
|
236
|
-
6. **Repeat** until 100% pass or time exhausted
|
|
237
|
-
7. **Never give up** on a task that is >50% passing - small fixes flip outcomes
|
|
210
|
+
## PRE-COMPLETION CHECKLIST (Optimization #1)
|
|
238
211
|
|
|
239
|
-
**
|
|
212
|
+
**PRINT before saying "done":**
|
|
240
213
|
```
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
214
|
+
=== COMPLETION ===
|
|
215
|
+
☑/☐ All outputs verified: `ls -la`
|
|
216
|
+
☑/☐ Tests: X/Y passed (must be 100%)
|
|
217
|
+
☑/☐ If CLI: tested as `./script`
|
|
218
|
+
☑/☐ If compression: round-trip tested
|
|
219
|
+
=== END ===
|
|
244
220
|
```
|
|
245
221
|
|
|
222
|
+
**If ANY ☐: FIX before proceeding.**
|
|
223
|
+
|
|
246
224
|
---
|
|
247
225
|
|
|
248
|
-
##
|
|
226
|
+
## FAILURE TRIAGE (Optimization #4)
|
|
249
227
|
|
|
250
|
-
| Error
|
|
251
|
-
|
|
252
|
-
|
|
|
253
|
-
|
|
|
254
|
-
|
|
|
255
|
-
|
|
|
256
|
-
|
|
|
257
|
-
|
|
|
258
|
-
|
|
|
228
|
+
| Error Type | Instant Fix |
|
|
229
|
+
|------------|-------------|
|
|
230
|
+
| `missing-file` | Create it immediately |
|
|
231
|
+
| `wrong-format` | Read expected format from test |
|
|
232
|
+
| `wrong-value` | Add debug output, check algorithm |
|
|
233
|
+
| `timeout` | Reduce scope, submit partial |
|
|
234
|
+
| `ModuleNotFoundError: X` | `pip install X` |
|
|
235
|
+
| `Permission denied` | `chmod +x file` |
|
|
236
|
+
| `command not found: X` | `apt-get install X` |
|
|
237
|
+
|
|
238
|
+
**NEVER refactor passing code while fixing failures.**
|
|
259
239
|
|
|
260
240
|
---
|
|
261
241
|
|
|
262
|
-
##
|
|
242
|
+
## PARTIAL CREDIT MAXIMIZATION (Optimization #17)
|
|
243
|
+
|
|
244
|
+
**When time running out (last 20%):**
|
|
245
|
+
1. Do NOT start new approaches
|
|
246
|
+
2. Ensure ALL passing tests still pass (regression check)
|
|
247
|
+
3. Make ONE targeted fix for highest-likelihood failing test
|
|
248
|
+
4. Submit current state rather than nothing
|
|
263
249
|
|
|
264
|
-
|
|
250
|
+
---
|
|
265
251
|
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
252
|
+
## DECODER-FIRST PROTOCOL (P35 - MANDATORY)
|
|
253
|
+
|
|
254
|
+
When a task provides a decoder/validator:
|
|
255
|
+
1. **READ decoder source FIRST**
|
|
256
|
+
2. **Extract exact format** (headers, encoding, byte order)
|
|
257
|
+
3. **Test round-trip IMMEDIATELY**: `original == decode(encode(original))`
|
|
258
|
+
4. **Never optimize until round-trip passes**
|
|
273
259
|
|
|
274
260
|
```bash
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
./script.py --help # Test as verifier runs it (NOT python3 script.py)
|
|
261
|
+
chmod +x ./script.py
|
|
262
|
+
head -1 ./script.py # Verify shebang: #!/usr/bin/env python3
|
|
263
|
+
./script.py --help # Test as verifier runs it
|
|
279
264
|
```
|
|
280
265
|
|
|
281
266
|
---
|
|
282
267
|
|
|
283
|
-
## ERROR RECOVERY
|
|
268
|
+
## ERROR RECOVERY
|
|
284
269
|
|
|
285
|
-
On any test failure or error:
|
|
286
270
|
1. **Read exact error message** - do not guess
|
|
287
|
-
2. **
|
|
288
|
-
3. **
|
|
289
|
-
4. **
|
|
290
|
-
5. **If timeout**: reduce scope, submit partial solution
|
|
291
|
-
6. **Never repeat a failed command** without modification
|
|
271
|
+
2. **Same error twice?** Change approach completely
|
|
272
|
+
3. **Dependency missing?** Install it
|
|
273
|
+
4. **Timeout approaching?** Submit best partial
|
|
292
274
|
|
|
293
275
|
---
|
|
294
276
|
|
|
295
|
-
## TIME BUDGET
|
|
296
|
-
|
|
297
|
-
For complex tasks (compilation, VM, multi-service):
|
|
298
|
-
- **20%** - Environment assessment (deps, tools, constraints)
|
|
299
|
-
- **50%** - Core implementation
|
|
300
|
-
- **30%** - Iteration, debugging, test fixes
|
|
277
|
+
## TIME BUDGET
|
|
301
278
|
|
|
302
|
-
|
|
279
|
+
| Phase | Allocation |
|
|
280
|
+
|-------|------------|
|
|
281
|
+
| Environment setup | 20% |
|
|
282
|
+
| Core implementation | 50% |
|
|
283
|
+
| **Iteration/debugging** | **30% (MANDATORY)** |
|
|
303
284
|
|
|
304
285
|
---
|
|
305
286
|
|
|
@@ -312,74 +293,45 @@ L3 Semantic │ {{LONG_TERM_BACKEND}}│ search │ ~50ms
|
|
|
312
293
|
L4 Knowledge│ SQLite entities/rels │ graph │ <20ms
|
|
313
294
|
```
|
|
314
295
|
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
296
|
+
---
|
|
297
|
+
|
|
298
|
+
## FAILURE MEMORY (Optimization #19)
|
|
299
|
+
|
|
300
|
+
**If this exact task was attempted before:**
|
|
301
|
+
1. Load previous failure report from memory
|
|
302
|
+
2. Do NOT use the approach that failed
|
|
303
|
+
3. Start from the approach that got closest to success
|
|
321
304
|
|
|
322
305
|
---
|
|
323
306
|
|
|
324
307
|
{{#unless IS_BENCHMARK}}
|
|
325
308
|
## WORKTREE WORKFLOW
|
|
326
309
|
|
|
327
|
-
**ALL changes use worktrees. NO EXCEPTIONS.**
|
|
328
|
-
|
|
329
310
|
```bash
|
|
330
|
-
{{WORKTREE_CREATE_CMD}} <slug> # Creates
|
|
331
|
-
cd {{WORKTREE_DIR}}/NNN-<slug>/
|
|
311
|
+
{{WORKTREE_CREATE_CMD}} <slug> # Creates worktree
|
|
332
312
|
git add -A && git commit -m "type: description"
|
|
333
313
|
{{WORKTREE_PR_CMD}} <id> # Creates PR
|
|
334
|
-
{{WORKTREE_CLEANUP_CMD}} <id> # After merge
|
|
335
314
|
```
|
|
336
315
|
|
|
337
316
|
---
|
|
338
317
|
|
|
339
|
-
## MULTI-AGENT
|
|
340
|
-
|
|
341
|
-
**Before claiming work:**
|
|
342
|
-
```bash
|
|
343
|
-
uam agent overlaps --resource "<files>"
|
|
344
|
-
```
|
|
345
|
-
|
|
346
|
-
| Risk | Action |
|
|
347
|
-
|------|--------|
|
|
348
|
-
| none/low | Proceed |
|
|
349
|
-
| medium | Announce, coordinate |
|
|
350
|
-
| high/critical | Wait or split |
|
|
351
|
-
|
|
352
|
-
---
|
|
353
|
-
|
|
354
318
|
## DROIDS
|
|
355
319
|
|
|
356
320
|
| Droid | Use For |
|
|
357
321
|
|-------|---------|
|
|
358
322
|
| security-auditor | OWASP, secrets, injection |
|
|
359
323
|
| code-quality-guardian | SOLID, complexity |
|
|
360
|
-
| performance-optimizer | Algorithms, memory |
|
|
361
|
-
| documentation-expert | JSDoc, README |
|
|
362
324
|
| debug-expert | Dependency conflicts |
|
|
363
325
|
| sysadmin-expert | Kernel, QEMU, networking |
|
|
364
|
-
| ml-training-expert | Model training, MTEB |
|
|
365
326
|
|
|
366
327
|
{{/unless}}
|
|
367
328
|
---
|
|
368
329
|
|
|
369
330
|
{{#if HAS_INFRA}}
|
|
370
|
-
## INFRASTRUCTURE
|
|
331
|
+
## INFRASTRUCTURE
|
|
371
332
|
|
|
372
333
|
**Secrets in GitHub → use pipelines for secret-dependent ops.**
|
|
373
|
-
|
|
374
|
-
| Task | Pipeline |
|
|
375
|
-
|------|----------|
|
|
376
|
-
| Terraform | `iac-terraform-cicd.yml` |
|
|
377
|
-
| kubectl ops | `ops-approved-operations.yml` |
|
|
378
|
-
| One-time | `ops-create-ephemeral.yml` |
|
|
379
|
-
|
|
380
|
-
**Two-phase:** Local proof (no secrets) → IaC parity (via pipeline)
|
|
381
|
-
|
|
382
|
-
**PROHIBITED locally:** `terraform apply`, `kubectl apply/delete`, `kubectl create secret`
|
|
334
|
+
**PROHIBITED locally:** `terraform apply`, `kubectl apply/delete`
|
|
383
335
|
|
|
384
336
|
{{/if}}
|
|
385
337
|
---
|
|
@@ -392,8 +344,6 @@ uam agent overlaps --resource "<files>"
|
|
|
392
344
|
{{LINT_COMMAND}} # Lint
|
|
393
345
|
```
|
|
394
346
|
|
|
395
|
-
**Paths:** Memory: `{{MEMORY_DB_PATH}}` | Skills: `{{SKILLS_PATH}}` | Droids: `{{DROIDS_PATH}}`
|
|
396
|
-
|
|
397
347
|
---
|
|
398
348
|
|
|
399
349
|
{{#if HAS_PROJECT_MD}}
|
|
@@ -410,13 +360,6 @@ uam agent overlaps --resource "<files>"
|
|
|
410
360
|
## Architecture
|
|
411
361
|
{{{ARCHITECTURE_OVERVIEW}}}
|
|
412
362
|
{{/if}}
|
|
413
|
-
|
|
414
|
-
{{#if ESSENTIAL_COMMANDS}}
|
|
415
|
-
## Commands
|
|
416
|
-
```bash
|
|
417
|
-
{{{ESSENTIAL_COMMANDS}}}
|
|
418
|
-
```
|
|
419
|
-
{{/if}}
|
|
420
363
|
{{/if}}
|
|
421
364
|
|
|
422
365
|
---
|
|
@@ -425,15 +368,10 @@ uam agent overlaps --resource "<files>"
|
|
|
425
368
|
## COMPLETION CHECKLIST
|
|
426
369
|
|
|
427
370
|
```
|
|
428
|
-
☐ Tests pass
|
|
371
|
+
☐ Tests 100% pass
|
|
429
372
|
☐ Lint/typecheck pass
|
|
430
373
|
☐ Worktree used (not {{DEFAULT_BRANCH}})
|
|
431
|
-
☐ Memory updated
|
|
432
374
|
☐ PR created
|
|
433
|
-
☐ Reviews passed
|
|
434
|
-
{{#if HAS_INFRA}}
|
|
435
|
-
☐ IaC parity verified
|
|
436
|
-
{{/if}}
|
|
437
375
|
☐ No secrets in code
|
|
438
376
|
```
|
|
439
377
|
|
|
@@ -443,15 +381,9 @@ uam agent overlaps --resource "<files>"
|
|
|
443
381
|
|
|
444
382
|
```
|
|
445
383
|
MERGE → DEPLOY → MONITOR → FIX (iterate until 100%)
|
|
446
|
-
|
|
447
|
-
1. MERGE: PR approved → merge to {{DEFAULT_BRANCH}} → delete branch
|
|
448
|
-
2. DEPLOY: CI/CD runs → check status → confirm live
|
|
449
|
-
3. MONITOR: Check logs → verify functionality → smoke tests
|
|
450
|
-
4. FIX: New worktree → fix → GOTO 1
|
|
451
|
-
5. COMPLETE: Update memory → close tasks
|
|
452
384
|
```
|
|
453
385
|
|
|
454
|
-
**Never "done" until:** PR merged + deployed + verified
|
|
386
|
+
**Never "done" until:** PR merged + deployed + verified
|
|
455
387
|
{{/unless}}
|
|
456
388
|
|
|
457
389
|
---
|
|
@@ -477,28 +409,16 @@ MERGE → DEPLOY → MONITOR → FIX (iterate until 100%)
|
|
|
477
409
|
|
|
478
410
|
---
|
|
479
411
|
|
|
480
|
-
## FINAL DIRECTIVES (
|
|
412
|
+
## FINAL DIRECTIVES (HIGHEST PRIORITY - READ LAST)
|
|
481
413
|
|
|
482
|
-
1. **READ verifier/test BEFORE implementing**
|
|
483
|
-
2. **`ls -la` ALL outputs BEFORE saying done**
|
|
484
|
-
3. **If >50% tests pass, ITERATE** - do NOT restart
|
|
485
|
-
4. **Use libraries, not custom
|
|
486
|
-
5. **
|
|
414
|
+
1. **READ verifier/test BEFORE implementing**
|
|
415
|
+
2. **`ls -la` ALL outputs BEFORE saying done**
|
|
416
|
+
3. **If >50% tests pass, ITERATE** - do NOT restart
|
|
417
|
+
4. **Use libraries, not custom** - python-chess, scipy, zlib
|
|
418
|
+
5. **Same error twice = CHANGE APPROACH**
|
|
419
|
+
6. **NEVER say done if tests <100%** - iterate until pass
|
|
487
420
|
|
|
488
|
-
**P17 Active
|
|
489
|
-
|
|
490
|
-
=== CONSTRAINTS ===
|
|
491
|
-
☐ constraint1 ☐ constraint2
|
|
492
|
-
☑ constraint1: PASS/FAIL
|
|
493
|
-
=== END ===
|
|
494
|
-
```
|
|
495
|
-
|
|
496
|
-
**P20 Active? Print:**
|
|
497
|
-
```
|
|
498
|
-
=== ADVERSARIAL ===
|
|
499
|
-
Target: [filter/protection]
|
|
500
|
-
Vectors: case, encoding, null, context-break
|
|
501
|
-
=== END ===
|
|
502
|
-
```
|
|
421
|
+
**P17 Active?** Print: `=== CONSTRAINTS: ☐ c1 ☐ c2 → ☑ c1: PASS ===`
|
|
422
|
+
**P20 Active?** Print: `=== ADVERSARIAL: Target: [X] Vectors: case,encoding,null ===`
|
|
503
423
|
|
|
504
424
|
</coding_guidelines>
|