@miller-tech/uap 1.104.0 → 1.104.2

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.
@@ -0,0 +1,902 @@
1
+ <!doctype html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="UTF-8" />
5
+ <meta name="viewport" content="width=device-width, initial-scale=1.0" />
6
+ <title>Universal Agent Memory Generator - Create AGENT.md for AI Assistants</title>
7
+ <style>
8
+ :root {
9
+ --bg: #0d1117;
10
+ --surface: #161b22;
11
+ --border: #30363d;
12
+ --text: #c9d1d9;
13
+ --text-muted: #8b949e;
14
+ --primary: #58a6ff;
15
+ --success: #3fb950;
16
+ --warning: #d29922;
17
+ }
18
+ * {
19
+ box-sizing: border-box;
20
+ margin: 0;
21
+ padding: 0;
22
+ }
23
+ body {
24
+ font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
25
+ background: var(--bg);
26
+ color: var(--text);
27
+ line-height: 1.6;
28
+ padding: 20px;
29
+ max-width: 1200px;
30
+ margin: 0 auto;
31
+ }
32
+ h1 {
33
+ color: var(--primary);
34
+ margin-bottom: 10px;
35
+ }
36
+ h2 {
37
+ color: var(--text);
38
+ margin: 20px 0 10px;
39
+ font-size: 1.2em;
40
+ }
41
+ h3 {
42
+ color: var(--text-muted);
43
+ font-size: 1em;
44
+ margin: 15px 0 8px;
45
+ }
46
+ p {
47
+ color: var(--text-muted);
48
+ margin-bottom: 15px;
49
+ }
50
+ .header {
51
+ text-align: center;
52
+ padding: 20px 0 30px;
53
+ border-bottom: 1px solid var(--border);
54
+ margin-bottom: 30px;
55
+ }
56
+ .container {
57
+ display: grid;
58
+ grid-template-columns: 1fr 1fr;
59
+ gap: 30px;
60
+ }
61
+ @media (max-width: 900px) {
62
+ .container {
63
+ grid-template-columns: 1fr;
64
+ }
65
+ }
66
+ .panel {
67
+ background: var(--surface);
68
+ border: 1px solid var(--border);
69
+ border-radius: 8px;
70
+ padding: 20px;
71
+ }
72
+ .form-group {
73
+ margin-bottom: 15px;
74
+ }
75
+ label {
76
+ display: block;
77
+ color: var(--text);
78
+ margin-bottom: 5px;
79
+ font-weight: 500;
80
+ }
81
+ input[type='text'],
82
+ input[type='url'],
83
+ textarea,
84
+ select {
85
+ width: 100%;
86
+ padding: 10px 12px;
87
+ background: var(--bg);
88
+ border: 1px solid var(--border);
89
+ border-radius: 6px;
90
+ color: var(--text);
91
+ font-size: 14px;
92
+ }
93
+ input:focus,
94
+ textarea:focus,
95
+ select:focus {
96
+ outline: none;
97
+ border-color: var(--primary);
98
+ }
99
+ textarea {
100
+ min-height: 80px;
101
+ resize: vertical;
102
+ font-family: inherit;
103
+ }
104
+ .checkbox-group {
105
+ display: flex;
106
+ flex-wrap: wrap;
107
+ gap: 15px;
108
+ margin: 10px 0;
109
+ }
110
+ .checkbox-item {
111
+ display: flex;
112
+ align-items: center;
113
+ gap: 8px;
114
+ }
115
+ .checkbox-item input[type='checkbox'] {
116
+ width: 18px;
117
+ height: 18px;
118
+ accent-color: var(--primary);
119
+ }
120
+ button {
121
+ background: var(--primary);
122
+ color: #fff;
123
+ border: none;
124
+ padding: 12px 24px;
125
+ border-radius: 6px;
126
+ font-size: 14px;
127
+ font-weight: 600;
128
+ cursor: pointer;
129
+ transition: opacity 0.2s;
130
+ }
131
+ button:hover {
132
+ opacity: 0.9;
133
+ }
134
+ button.secondary {
135
+ background: var(--surface);
136
+ border: 1px solid var(--border);
137
+ color: var(--text);
138
+ }
139
+ .button-group {
140
+ display: flex;
141
+ gap: 10px;
142
+ margin-top: 20px;
143
+ }
144
+ #output {
145
+ background: var(--bg);
146
+ border: 1px solid var(--border);
147
+ border-radius: 6px;
148
+ padding: 15px;
149
+ font-family: 'Fira Code', 'Consolas', monospace;
150
+ font-size: 12px;
151
+ white-space: pre-wrap;
152
+ overflow-x: auto;
153
+ max-height: 600px;
154
+ overflow-y: auto;
155
+ }
156
+ .tag {
157
+ display: inline-block;
158
+ background: var(--border);
159
+ color: var(--text-muted);
160
+ padding: 2px 8px;
161
+ border-radius: 12px;
162
+ font-size: 12px;
163
+ margin: 2px;
164
+ }
165
+ .info-box {
166
+ background: rgba(88, 166, 255, 0.1);
167
+ border: 1px solid rgba(88, 166, 255, 0.3);
168
+ border-radius: 6px;
169
+ padding: 12px;
170
+ margin: 15px 0;
171
+ font-size: 13px;
172
+ }
173
+ .tabs {
174
+ display: flex;
175
+ gap: 5px;
176
+ margin-bottom: 15px;
177
+ }
178
+ .tab {
179
+ padding: 8px 16px;
180
+ background: transparent;
181
+ border: 1px solid var(--border);
182
+ border-radius: 6px 6px 0 0;
183
+ color: var(--text-muted);
184
+ cursor: pointer;
185
+ }
186
+ .tab.active {
187
+ background: var(--surface);
188
+ color: var(--primary);
189
+ border-bottom-color: var(--surface);
190
+ }
191
+ .section {
192
+ display: none;
193
+ }
194
+ .section.active {
195
+ display: block;
196
+ }
197
+ .copy-btn {
198
+ position: absolute;
199
+ top: 10px;
200
+ right: 10px;
201
+ padding: 6px 12px;
202
+ font-size: 12px;
203
+ }
204
+ .output-container {
205
+ position: relative;
206
+ }
207
+ .success-msg {
208
+ color: var(--success);
209
+ font-size: 12px;
210
+ margin-top: 5px;
211
+ }
212
+ </style>
213
+ </head>
214
+ <body>
215
+ <div class="header">
216
+ <h1>🤖 Universal Agent Memory Generator</h1>
217
+ <p>
218
+ Create AGENT.md or CLAUDE.md files for AI coding assistants<br />
219
+ <span class="tag">claude.ai</span>
220
+ <span class="tag">factory.ai</span>
221
+ <span class="tag">Claude Code</span>
222
+ <span class="tag">VSCode</span>
223
+ </p>
224
+ </div>
225
+
226
+ <div class="container">
227
+ <div class="panel">
228
+ <div class="tabs">
229
+ <button class="tab active" data-tab="project">Project</button>
230
+ <button class="tab" data-tab="platforms">Platforms</button>
231
+ <button class="tab" data-tab="advanced">Advanced</button>
232
+ </div>
233
+
234
+ <!-- Project Tab -->
235
+ <div id="project" class="section active">
236
+ <div class="form-group">
237
+ <label for="projectName">Project Name *</label>
238
+ <input type="text" id="projectName" placeholder="my-awesome-project" required />
239
+ </div>
240
+
241
+ <div class="form-group">
242
+ <label for="description">Description</label>
243
+ <textarea
244
+ id="description"
245
+ placeholder="A brief description of your project..."
246
+ ></textarea>
247
+ </div>
248
+
249
+ <div class="form-group">
250
+ <label for="languages">Languages</label>
251
+ <input type="text" id="languages" placeholder="TypeScript, Python, Go" />
252
+ </div>
253
+
254
+ <div class="form-group">
255
+ <label for="frameworks">Frameworks</label>
256
+ <input type="text" id="frameworks" placeholder="React, FastAPI, Next.js" />
257
+ </div>
258
+
259
+ <h3>Commands</h3>
260
+ <div class="form-group">
261
+ <label for="testCmd">Test Command</label>
262
+ <input type="text" id="testCmd" placeholder="npm test" value="npm test" />
263
+ </div>
264
+ <div class="form-group">
265
+ <label for="lintCmd">Lint Command</label>
266
+ <input type="text" id="lintCmd" placeholder="npm run lint" value="npm run lint" />
267
+ </div>
268
+ <div class="form-group">
269
+ <label for="buildCmd">Build Command</label>
270
+ <input type="text" id="buildCmd" placeholder="npm run build" value="npm run build" />
271
+ </div>
272
+ </div>
273
+
274
+ <!-- Platforms Tab -->
275
+ <div id="platforms" class="section">
276
+ <h3>Target Platform</h3>
277
+ <div class="form-group">
278
+ <select id="targetPlatform">
279
+ <option value="web">Web (claude.ai, factory.ai) → AGENT.md</option>
280
+ <option value="desktop">Desktop (Claude Code, VSCode) → CLAUDE.md</option>
281
+ </select>
282
+ </div>
283
+
284
+ <div class="info-box">
285
+ <strong>Web platforms</strong> generate a streamlined AGENT.md focused on code review
286
+ and context.<br />
287
+ <strong>Desktop platforms</strong> generate a full CLAUDE.md with memory system,
288
+ commands, and workflows.
289
+ </div>
290
+
291
+ <h3>URLs (optional)</h3>
292
+ <div class="form-group">
293
+ <label for="repoUrl">Repository URL</label>
294
+ <input type="url" id="repoUrl" placeholder="https://github.com/org/repo" />
295
+ </div>
296
+ <div class="form-group">
297
+ <label for="docsUrl">Documentation URL</label>
298
+ <input type="url" id="docsUrl" placeholder="https://docs.example.com" />
299
+ </div>
300
+ <div class="form-group">
301
+ <label for="apiUrl">API URL</label>
302
+ <input type="url" id="apiUrl" placeholder="https://api.example.com" />
303
+ </div>
304
+ </div>
305
+
306
+ <!-- Advanced Tab -->
307
+ <div id="advanced" class="section">
308
+ <h3>Components</h3>
309
+ <div class="form-group">
310
+ <label for="components">Project Components (one per line)</label>
311
+ <textarea
312
+ id="components"
313
+ placeholder="frontend - React app in /src&#10;backend - FastAPI in /api&#10;infra - Terraform in /infra"
314
+ ></textarea>
315
+ </div>
316
+
317
+ <h3>Databases</h3>
318
+ <div class="form-group">
319
+ <label for="databases">Databases (one per line: type - purpose)</label>
320
+ <textarea
321
+ id="databases"
322
+ placeholder="PostgreSQL - Main database&#10;Redis - Caching"
323
+ ></textarea>
324
+ </div>
325
+
326
+ <h3>Include Sections (Desktop only)</h3>
327
+ <div class="checkbox-group">
328
+ <label class="checkbox-item">
329
+ <input type="checkbox" id="includeMemory" checked />
330
+ <span>Memory System</span>
331
+ </label>
332
+ <label class="checkbox-item">
333
+ <input type="checkbox" id="includeBrowser" checked />
334
+ <span>Browser Usage</span>
335
+ </label>
336
+ <label class="checkbox-item">
337
+ <input type="checkbox" id="includeWorktree" checked />
338
+ <span>Git Worktree</span>
339
+ </label>
340
+ <label class="checkbox-item">
341
+ <input type="checkbox" id="includeDecision" checked />
342
+ <span>Decision Loop</span>
343
+ </label>
344
+ </div>
345
+
346
+ <h3>Custom Sections</h3>
347
+ <div class="form-group">
348
+ <label for="customSections">Additional content (markdown)</label>
349
+ <textarea
350
+ id="customSections"
351
+ placeholder="## Custom Section&#10;Your custom content here..."
352
+ ></textarea>
353
+ </div>
354
+ </div>
355
+
356
+ <div class="button-group">
357
+ <button onclick="generateOutput()">Generate</button>
358
+ <button class="secondary" onclick="resetForm()">Reset</button>
359
+ </div>
360
+ </div>
361
+
362
+ <div class="panel">
363
+ <h2>Generated Output</h2>
364
+ <div class="output-container">
365
+ <button class="copy-btn secondary" onclick="copyOutput()">📋 Copy</button>
366
+ <div id="output">
367
+ Fill in the project details and click "Generate" to create your agent context file.
368
+ </div>
369
+ </div>
370
+ <div id="copySuccess" class="success-msg" style="display: none">✓ Copied to clipboard!</div>
371
+
372
+ <div class="info-box" style="margin-top: 20px">
373
+ <strong>Next steps:</strong>
374
+ <ol style="margin: 10px 0 0 20px; color: var(--text-muted)">
375
+ <li>Copy the generated content</li>
376
+ <li>Create <code>AGENT.md</code> or <code>CLAUDE.md</code> in your repo root</li>
377
+ <li>Paste the content and commit</li>
378
+ <li>Your AI assistant will now have project context!</li>
379
+ </ol>
380
+ </div>
381
+ </div>
382
+ </div>
383
+
384
+ <script>
385
+ // Tab switching
386
+ document.querySelectorAll('.tab').forEach((tab) => {
387
+ tab.addEventListener('click', () => {
388
+ document.querySelectorAll('.tab').forEach((t) => t.classList.remove('active'));
389
+ document.querySelectorAll('.section').forEach((s) => s.classList.remove('active'));
390
+ tab.classList.add('active');
391
+ document.getElementById(tab.dataset.tab).classList.add('active');
392
+ });
393
+ });
394
+
395
+ function generateOutput() {
396
+ const platform = document.getElementById('targetPlatform').value;
397
+ const isWeb = platform === 'web';
398
+
399
+ const projectName = document.getElementById('projectName').value || 'my-project';
400
+ const description = document.getElementById('description').value;
401
+ const languages = document.getElementById('languages').value;
402
+ const frameworks = document.getElementById('frameworks').value;
403
+ const testCmd = document.getElementById('testCmd').value || 'npm test';
404
+ const lintCmd = document.getElementById('lintCmd').value || 'npm run lint';
405
+ const buildCmd = document.getElementById('buildCmd').value || 'npm run build';
406
+
407
+ const repoUrl = document.getElementById('repoUrl').value;
408
+ const docsUrl = document.getElementById('docsUrl').value;
409
+ const apiUrl = document.getElementById('apiUrl').value;
410
+
411
+ const componentsRaw = document.getElementById('components').value;
412
+ const databasesRaw = document.getElementById('databases').value;
413
+ const customSections = document.getElementById('customSections').value;
414
+
415
+ const includeMemory = document.getElementById('includeMemory').checked;
416
+ const includeBrowser = document.getElementById('includeBrowser').checked;
417
+ const includeWorktree = document.getElementById('includeWorktree').checked;
418
+ const includeDecision = document.getElementById('includeDecision').checked;
419
+
420
+ let output = '<coding_guidelines>\n\n';
421
+ output += `# ${isWeb ? 'AGENT.md' : 'CLAUDE.md'} - ${projectName} Development Guide\n\n`;
422
+ output += `You are Autonomous Claude, a self-directed AI agent with full control over this environment. You operate continuously, making your own decisions.\n`;
423
+
424
+ if (description) {
425
+ output += `\n> ${description}\n`;
426
+ }
427
+
428
+ output += '\n---\n\n';
429
+
430
+ // CRITICAL DECISION LOOP - THE CORE OF THE TEMPLATE
431
+ output += `## ⚠️⚠️⚠️ CRITICAL: READ THIS FIRST - EVERY SINGLE TIME ⚠️⚠️⚠️\n\n`;
432
+ output += `**YOU MUST FOLLOW THE DECISION LOOP BELOW FOR EVERY ACTION. NO EXCEPTIONS.**\n\n`;
433
+ output += `\`\`\`\n`;
434
+ output += `┌─────────────────────────────────────────────────────────────────────────────┐\n`;
435
+ output += `│ MANDATORY DECISION LOOP │\n`;
436
+ output += `│ (Execute this for EVERY task) │\n`;
437
+ output += `├─────────────────────────────────────────────────────────────────────────────┤\n`;
438
+ output += `│ │\n`;
439
+ output += `│ 1. READ MEMORY FIRST │\n`;
440
+ if (isWeb) {
441
+ output += `│ ├─ Check localStorage for recent context │\n`;
442
+ output += `│ └─ Review .uap/memory/ for relevant learnings │\n`;
443
+ } else {
444
+ output += `│ ├─ Query short-term: sqlite3 ./agents/data/memory/short_term.db │\n`;
445
+ output += `│ │ "SELECT * FROM memories ORDER BY id DESC LIMIT 20;" │\n`;
446
+ output += `│ └─ Query long-term: uam memory query "<keywords>" │\n`;
447
+ }
448
+ output += `│ │\n`;
449
+ output += `│ 2. CHECK FOR APPLICABLE SKILLS │\n`;
450
+ output += `│ ├─ Review .factory/skills/ for relevant skills │\n`;
451
+ output += `│ ├─ Use design skill for ANY UI/design work │\n`;
452
+ output += `│ └─ Invoke skill BEFORE starting implementation │\n`;
453
+ output += `│ │\n`;
454
+ if (isWeb) {
455
+ output += `│ 3. CREATE FEATURE BRANCH (for ANY code changes) │\n`;
456
+ output += `│ ├─ git checkout -b feature/<descriptive-slug> │\n`;
457
+ output += `│ └─ NEVER commit directly to main │\n`;
458
+ } else {
459
+ output += `│ 3. CREATE WORKTREE (for ANY code changes) │\n`;
460
+ output += `│ ├─ uam worktree create <slug> │\n`;
461
+ output += `│ ├─ cd .worktrees/NNN-<slug>/ │\n`;
462
+ output += `│ └─ NEVER commit directly to main │\n`;
463
+ }
464
+ output += `│ │\n`;
465
+ output += `│ 4. CREATE TODO LIST (for 3+ step tasks) │\n`;
466
+ output += `│ ├─ Use TodoWrite tool immediately │\n`;
467
+ output += `│ ├─ Update status after EACH step │\n`;
468
+ output += `│ └─ Mark completed items immediately │\n`;
469
+ output += `│ │\n`;
470
+ output += `│ 5. DO THE WORK │\n`;
471
+ output += `│ ├─ Implement changes │\n`;
472
+ output += `│ ├─ Run tests │\n`;
473
+ if (isWeb) {
474
+ output += `│ └─ Create PR via GitHub/GitLab UI │\n`;
475
+ } else {
476
+ output += `│ └─ Create PR via uam worktree pr <id> │\n`;
477
+ }
478
+ output += `│ │\n`;
479
+ output += `│ 6. UPDATE MEMORY (after EVERY significant action) │\n`;
480
+ if (isWeb) {
481
+ output += `│ ├─ Short-term: Update localStorage context │\n`;
482
+ output += `│ └─ Long-term: Create memory file in .uap/memory/ │\n`;
483
+ } else {
484
+ output += `│ ├─ Short-term: INSERT INTO memories... │\n`;
485
+ output += `│ └─ Long-term: uam memory store lesson... │\n`;
486
+ }
487
+ output += `│ │\n`;
488
+ output += `│ 7. VERIFY BEFORE RESPONDING │\n`;
489
+ output += `│ ├─ [ ] Memory updated? │\n`;
490
+ output += `│ ├─ [ ] ${isWeb ? 'Feature branch' : 'Worktree'} used? │\n`;
491
+ output += `│ ├─ [ ] PR created (not direct commit)? │\n`;
492
+ output += `│ ├─ [ ] Todos updated? │\n`;
493
+ output += `│ └─ [ ] Skills consulted? │\n`;
494
+ output += `│ │\n`;
495
+ output += `└─────────────────────────────────────────────────────────────────────────────┘\n`;
496
+ output += `\`\`\`\n\n`;
497
+ output += `---\n\n`;
498
+
499
+ // MANDATORY RULES section
500
+ output += `## ⛔ MANDATORY RULES - ZERO TOLERANCE ⛔\n\n`;
501
+ output += `**FAILURE TO FOLLOW THESE RULES IS A CRITICAL ERROR. STOP AND RE-READ IF UNSURE.**\n\n`;
502
+
503
+ if (isWeb) {
504
+ output += `### 1. BRANCH REQUIREMENT (NO EXCEPTIONS)\n\n`;
505
+ output += `\`\`\`\n`;
506
+ output += `❌ FORBIDDEN: Direct commits to main branch\n`;
507
+ output += `❌ FORBIDDEN: Making changes without creating branch first\n`;
508
+ output += `✅ REQUIRED: Create branch → Make changes → Create PR → Merge via PR\n`;
509
+ output += `\`\`\`\n\n`;
510
+ output += `**Before ANY code change:**\n\n`;
511
+ output += `\`\`\`bash\n`;
512
+ output += `# Step 1: Create feature branch\n`;
513
+ output += `git checkout -b feature/<descriptive-slug>\n\n`;
514
+ output += `# Step 2: Make changes, commit\n`;
515
+ output += `git add . && git commit -m "feat: description"\n\n`;
516
+ output += `# Step 3: Push and create PR\n`;
517
+ output += `git push -u origin feature/<descriptive-slug>\n`;
518
+ output += `# Create PR via GitHub/GitLab UI\n`;
519
+ output += `\`\`\`\n\n`;
520
+ output += `**Applies to:** All code, configs, workflows, documentation\n\n`;
521
+ } else {
522
+ output += `### 1. WORKTREE REQUIREMENT (NO EXCEPTIONS)\n\n`;
523
+ output += `\`\`\`\n`;
524
+ output += `❌ FORBIDDEN: Direct commits to main branch\n`;
525
+ output += `❌ FORBIDDEN: Making changes without creating worktree first\n`;
526
+ output += `✅ REQUIRED: Create worktree → Make changes → Create PR → Merge via PR\n`;
527
+ output += `\`\`\`\n\n`;
528
+ output += `**Before ANY code change:**\n\n`;
529
+ output += `\`\`\`bash\n`;
530
+ output += `# Step 1: Create worktree\n`;
531
+ output += `uam worktree create <descriptive-slug>\n\n`;
532
+ output += `# Step 2: cd into worktree and make changes\n`;
533
+ output += `cd .worktrees/NNN-<slug>/\n\n`;
534
+ output += `# Step 3: Commit and create PR\n`;
535
+ output += `uam worktree pr <id>\n`;
536
+ output += `\`\`\`\n\n`;
537
+ output += `**Applies to:** All code, configs, workflows, documentation\n\n`;
538
+ }
539
+
540
+ output += `### 2. MEMORY REQUIREMENT (MANDATORY - NOT OPTIONAL)\n\n`;
541
+ output += `**You MUST update memory. This is not a suggestion.**\n\n`;
542
+ if (isWeb) {
543
+ output += `\`\`\`bash\n`;
544
+ output += `# AFTER EVERY SIGNIFICANT ACTION - update context:\n`;
545
+ output += `# Store in localStorage or recommend committing to .uap/memory/\n\n`;
546
+ output += `# AFTER EVERY FIX/DISCOVERY/LEARNING - create memory file:\n`;
547
+ output += `# .uap/memory/{YYYY-MM-DD}_{type}_{short-id}.json\n`;
548
+ output += `\`\`\`\n\n`;
549
+ } else {
550
+ output += `\`\`\`bash\n`;
551
+ output += `# AFTER EVERY SIGNIFICANT ACTION - update short-term memory:\n`;
552
+ output += `sqlite3 ./agents/data/memory/short_term.db \\\n`;
553
+ output += ` "INSERT INTO memories (timestamp, type, content) VALUES (datetime('now'), 'action', 'What you did and the result');"\n\n`;
554
+ output += `# AFTER EVERY FIX/DISCOVERY/LEARNING - update long-term memory:\n`;
555
+ output += `uam memory store lesson "What you learned" --tags tag1,tag2 --importance 7\n`;
556
+ output += `\`\`\`\n\n`;
557
+ }
558
+ output += `**MUST store memories for:**\n\n`;
559
+ output += `- ✅ Every bug fix (root cause + solution)\n`;
560
+ output += `- ✅ Every infrastructure change\n`;
561
+ output += `- ✅ Every architecture decision\n`;
562
+ output += `- ✅ Every gotcha or workaround discovered\n`;
563
+ output += `- ✅ Every performance optimization\n`;
564
+ output += `- ✅ Every deployment issue and resolution\n`;
565
+ output += `- ✅ Every API behavior discovery\n\n`;
566
+ output += `**Importance scale:**\n\n`;
567
+ output += `- 9-10: Critical system knowledge (will break things if forgotten)\n`;
568
+ output += `- 7-8: Important patterns and fixes\n`;
569
+ output += `- 5-6: Useful context and learnings\n`;
570
+ output += `- 3-4: Minor observations\n\n`;
571
+
572
+ output += `### 3. SKILLS REQUIREMENT (CHECK BEFORE IMPLEMENTING)\n\n`;
573
+ output += `**Before starting ANY implementation, check if a skill applies:**\n\n`;
574
+ output += `| Task Type | Required Skill |\n`;
575
+ output += `|-----------|---------------|\n`;
576
+ output += `| UI/Design work (buttons, modals, colors, layouts) | \`design-expert\` |\n`;
577
+ output += `| React/TypeScript/Frontend | \`senior-frontend\` |\n`;
578
+ output += `| Code review | \`code-reviewer\` |\n`;
579
+ output += `| Web testing | \`webapp-testing\` |\n\n`;
580
+ output += `\`\`\`bash\n`;
581
+ output += `# Invoke skill FIRST, then follow its guidance\n`;
582
+ output += `Skill(skill: "design-expert")\n`;
583
+ output += `\`\`\`\n\n`;
584
+
585
+ output += `### 4. TODO LIST REQUIREMENT\n\n`;
586
+ output += `- Create todo list for multi-step tasks (3+ steps)\n`;
587
+ output += `- Update status IMMEDIATELY after completing each item\n`;
588
+ output += `- Never let todos go stale (update every 5-10 tool calls)\n`;
589
+ output += `- Use TodoWrite tool, not manual tracking\n\n`;
590
+
591
+ output += `### 5. VERIFICATION BEFORE EVERY RESPONSE\n\n`;
592
+ output += `Before sending ANY response, verify:\n\n`;
593
+ output += `\`\`\`\n`;
594
+ output += `┌─────────────────────────────────────────────────────────────┐\n`;
595
+ output += `│ CHECKLIST - Complete before responding: │\n`;
596
+ output += `├─────────────────────────────────────────────────────────────┤\n`;
597
+ output += `│ [ ] Read memory at start of task? │\n`;
598
+ output += `│ [ ] Checked for applicable skills? │\n`;
599
+ output += `│ [ ] Used ${isWeb ? 'feature branch' : 'worktree'} for code changes? │\n`;
600
+ output += `│ [ ] Updated short-term memory after actions? │\n`;
601
+ output += `│ [ ] Stored learnings in long-term memory? │\n`;
602
+ output += `│ [ ] Updated todo list status? │\n`;
603
+ output += `│ [ ] Created PR (not direct commit)? │\n`;
604
+ output += `└─────────────────────────────────────────────────────────────┘\n`;
605
+ output += `\`\`\`\n\n`;
606
+ output += `---\n\n`;
607
+
608
+ // Memory System - EXACT structure from template
609
+ output += `## MEMORY SYSTEM\n\n`;
610
+
611
+ if (isWeb) {
612
+ output += `### Short-term Memory (localStorage)\n\n`;
613
+ output += `Key: \`agent_context_${projectName}\`\n\n`;
614
+ output += `Structure:\n`;
615
+ output += `\`\`\`json\n`;
616
+ output += `{\n`;
617
+ output += ` "memories": [\n`;
618
+ output += ` {"timestamp": "ISO8601", "type": "action|observation|thought|goal", "content": "..."}\n`;
619
+ output += ` ],\n`;
620
+ output += ` "maxEntries": 50\n`;
621
+ output += `}\n`;
622
+ output += `\`\`\`\n\n`;
623
+ output += `**BEFORE EACH DECISION**: Review recent memories for context\n`;
624
+ output += `**AFTER EACH ACTION**: Add a memory describing what you did and the outcome\n\n`;
625
+ output += `Maintains last 50 entries - older entries should be pruned.\n\n`;
626
+ output += `### Long-term Memory (Repository: \`.uap/memory/\`)\n\n`;
627
+ output += `Memories stored as JSON files in the project repository.\n\n`;
628
+ output += `File format: \`{YYYY-MM-DD}_{type}_{short-id}.json\`\n`;
629
+ output += `\`\`\`json\n`;
630
+ output += `{\n`;
631
+ output += ` "id": "uuid",\n`;
632
+ output += ` "timestamp": "ISO8601",\n`;
633
+ output += ` "type": "fact|lesson|skill|discovery|preference",\n`;
634
+ output += ` "content": "Learning or discovery",\n`;
635
+ output += ` "tags": ["tag1", "tag2"],\n`;
636
+ output += ` "importance": 8\n`;
637
+ output += `}\n`;
638
+ output += `\`\`\`\n\n`;
639
+ } else {
640
+ output += `### Short-term Memory (SQLite: \`./agents/data/memory/short_term.db\`)\n\n`;
641
+ output += `Table: \`memories\`\n\n`;
642
+ output += `- \`id\`: INTEGER PRIMARY KEY\n`;
643
+ output += `- \`timestamp\`: TEXT (ISO8601)\n`;
644
+ output += `- \`type\`: TEXT (action|observation|thought|goal)\n`;
645
+ output += `- \`content\`: TEXT\n\n`;
646
+ output += `**BEFORE EACH DECISION**: Query recent entries (last 50) to understand your context\n\n`;
647
+ output += `\`\`\`sql\n`;
648
+ output += `SELECT * FROM memories ORDER BY id DESC LIMIT 50;\n`;
649
+ output += `\`\`\`\n\n`;
650
+ output += `**AFTER EACH ACTION**: INSERT a new row describing what you did and the outcome\n\n`;
651
+ output += `\`\`\`sql\n`;
652
+ output += `INSERT INTO memories (timestamp, type, content) VALUES (datetime('now'), 'action', 'Description of action and result');\n`;
653
+ output += `\`\`\`\n\n`;
654
+ output += `Maintains last 50 entries - older entries auto-deleted via trigger.\n\n`;
655
+ output += `### Long-term Memory (Qdrant: \`localhost:6333\`, collection: \`agent_memory\`)\n\n`;
656
+ output += `**Start services**: \`uam memory start\`\n\n`;
657
+ output += `Vector schema:\n\n`;
658
+ output += `- \`id\`: UUID\n`;
659
+ output += `- \`vector\`: 384-dim embedding (all-MiniLM-L6-v2)\n`;
660
+ output += `- \`payload\`: {type, tags[], content, importance (1-10), timestamp}\n\n`;
661
+ output += `**Query memories** (semantic search):\n\n`;
662
+ output += `\`\`\`bash\n`;
663
+ output += `uam memory query "search terms"\n`;
664
+ output += `\`\`\`\n\n`;
665
+ output += `**Store new memory**:\n\n`;
666
+ output += `\`\`\`bash\n`;
667
+ output += `uam memory store lesson "What you learned" --tags tag1,tag2 --importance 8\n`;
668
+ output += `\`\`\`\n\n`;
669
+ }
670
+ output += `**WHEN TO READ**: Search for memories relevant to current task/decision\n`;
671
+ output += `**WHEN TO WRITE**: Only store significant learnings:\n\n`;
672
+ output += `- Discoveries about your environment/capabilities\n`;
673
+ output += `- Successful strategies that worked\n`;
674
+ output += `- Failed approaches to avoid repeating\n`;
675
+ output += `- Important facts learned\n`;
676
+ output += `- Skills or tools mastered\n\n`;
677
+
678
+ if (!isWeb) {
679
+ output += `### Agent Services Setup\n\n`;
680
+ output += `\`\`\`bash\n`;
681
+ output += `# Start services (auto-creates collection and migrates memories)\n`;
682
+ output += `uam memory start\n\n`;
683
+ output += `# Check status\n`;
684
+ output += `uam memory status\n\n`;
685
+ output += `# Stop services\n`;
686
+ output += `uam memory stop\n`;
687
+ output += `\`\`\`\n\n`;
688
+ }
689
+ output += `---\n\n`;
690
+
691
+ // Browser usage
692
+ if (!isWeb && includeBrowser) {
693
+ output += `## BROWSER USAGE\n\n`;
694
+ output += `When using browser automation (Playwright, Puppeteer, or any browser tool):\n\n`;
695
+ output += `- ALWAYS save a screenshot after EVERY browser action (click, type, navigate, scroll, etc.)\n`;
696
+ output += `- Save screenshots to: \`agents/data/screenshots/\`\n`;
697
+ output += `- Filename format: \`{timestamp}_{action}.png\` (e.g., \`1703180400_click_button.png\`)\n`;
698
+ output += `- Also save a \`.meta\` file with the same name containing:\n`;
699
+ output += ` \`\`\`\n`;
700
+ output += ` url: {current_url}\n`;
701
+ output += ` title: {page_title}\n`;
702
+ output += ` action: {what_you_did}\n`;
703
+ output += ` \`\`\`\n`;
704
+ output += `- Take a screenshot BEFORE and AFTER any significant visual change\n\n`;
705
+ output += `---\n\n`;
706
+ }
707
+
708
+ // Decision Loop summary
709
+ output += `## DECISION LOOP\n\n`;
710
+ output += `1. **READ** short-term memory (recent context)\n`;
711
+ output += `2. **QUERY** long-term memory (semantic search for relevant past learnings)\n`;
712
+ output += `3. **THINK** about what to do next\n`;
713
+ output += `4. **ACT** - execute your decision\n`;
714
+ output += `5. **RECORD** - write to short-term memory\n`;
715
+ if (!isWeb && includeBrowser) {
716
+ output += `6. **IF BROWSER ACTION**: Save screenshot to \`/agents/data/screenshots/\`\n`;
717
+ output += `7. **OPTIONALLY** - if significant learning, add to long-term memory\n\n`;
718
+ } else {
719
+ output += `6. **OPTIONALLY** - if significant learning, add to long-term memory\n\n`;
720
+ }
721
+ output += `---\n\n`;
722
+
723
+ // Skills section
724
+ output += `## SKILLS\n\n`;
725
+ output += `You have access to reusable skills. Before attempting complex tasks:\n\n`;
726
+ output += `1. Check if a skill exists for it (see \`.factory/skills/\`)\n`;
727
+ output += `2. Follow the skill's patterns - they're tested and reliable\n`;
728
+ output += `3. If you discover a better approach, consider creating/updating a skill\n\n`;
729
+ output += `Available skills are auto-discovered. When you see a SKILL.md, follow its instructions.\n\n`;
730
+ output += `---\n\n`;
731
+
732
+ // Workflow requirements
733
+ output += `**MANDATORY WORKFLOW REQUIREMENTS**:\n\n`;
734
+ if (isWeb) {
735
+ output += `1. **Feature Branches**: ALL code changes MUST use isolated feature branches (\`feature/description\`)\n`;
736
+ output += `2. **PR-Based Merges**: NO direct commits to \`main\`. All changes via PR\n`;
737
+ output += `3. **Code Review**: PRs should be reviewed before merge\n\n`;
738
+ } else {
739
+ output += `1. **Git Worktrees**: ALL code changes MUST use isolated git worktrees (\`feature/NNN-slug\` branches)\n`;
740
+ output += `2. **PR-Based Merges**: NO direct commits to \`main\`. All changes via PR with automated review\n`;
741
+ output += `3. **CI/CD Pipelines**: ALWAYS use CI/CD pipelines to deploy. Create ephemeral pipelines when needed\n`;
742
+ output += `4. **Automated Review**: PRs require signoff from reviewer agents before merge\n\n`;
743
+ }
744
+ output += `---\n\n`;
745
+
746
+ // Components
747
+ if (componentsRaw) {
748
+ output += `## Architecture\n\n`;
749
+ const components = componentsRaw.split('\n').filter((c) => c.trim());
750
+ for (const comp of components) {
751
+ const [name, ...descParts] = comp.split(' - ');
752
+ const desc = descParts.join(' - ');
753
+ output += `### ${name.trim()}\n${desc ? desc.trim() : ''}\n\n`;
754
+ }
755
+ output += `---\n\n`;
756
+ }
757
+
758
+ // Databases
759
+ if (databasesRaw) {
760
+ output += `## Data Layer\n\n`;
761
+ const databases = databasesRaw.split('\n').filter((d) => d.trim());
762
+ for (const db of databases) {
763
+ output += `- **${db.trim()}**\n`;
764
+ }
765
+ output += `\n---\n\n`;
766
+ }
767
+
768
+ // URLs
769
+ if (repoUrl || docsUrl || apiUrl) {
770
+ output += `## Project URLs\n\n`;
771
+ if (repoUrl) output += `- **Repository**: ${repoUrl}\n`;
772
+ if (docsUrl) output += `- **Documentation**: ${docsUrl}\n`;
773
+ if (apiUrl) output += `- **API**: ${apiUrl}\n`;
774
+ output += `\n---\n\n`;
775
+ }
776
+
777
+ // Required Workflow section
778
+ output += `## Required Workflow (MANDATORY)\n\n`;
779
+ if (isWeb) {
780
+ output += `### Git Branch Workflow (ALL Changes)\n\n`;
781
+ output += `**Every code change MUST follow this workflow:**\n\n`;
782
+ output += `\`\`\`\n`;
783
+ output += `1. CREATE BRANCH\n`;
784
+ output += ` git checkout -b feature/<description>\n`;
785
+ output += ` → Creates isolated feature branch\n\n`;
786
+ output += `2. DEVELOP\n`;
787
+ output += ` → Make changes, commit locally\n`;
788
+ output += ` → Keep commits atomic and well-described\n\n`;
789
+ output += `3. CREATE PR\n`;
790
+ output += ` git push -u origin feature/<description>\n`;
791
+ output += ` → Push to remote\n`;
792
+ output += ` → Create PR via GitHub/GitLab UI\n\n`;
793
+ output += `4. CODE REVIEW\n`;
794
+ output += ` → Request review from team members\n`;
795
+ output += ` → Address feedback\n\n`;
796
+ output += `5. MERGE & CLEANUP\n`;
797
+ output += ` → Merge PR after approval\n`;
798
+ output += ` → Delete feature branch\n`;
799
+ output += `\`\`\`\n\n`;
800
+ } else {
801
+ output += `### Git Worktree Workflow (ALL Changes)\n\n`;
802
+ output += `**Every code change MUST follow this workflow:**\n\n`;
803
+ output += `\`\`\`\n`;
804
+ output += `1. CREATE WORKTREE\n`;
805
+ output += ` uam worktree create <slug>\n`;
806
+ output += ` → Creates feature/NNN-slug branch in .worktrees/NNN-slug/\n\n`;
807
+ output += `2. DEVELOP\n`;
808
+ output += ` cd .worktrees/NNN-slug/\n`;
809
+ output += ` → Make changes, commit locally\n\n`;
810
+ output += `3. CREATE PR (runs tests + triggers reviewers)\n`;
811
+ output += ` uam worktree pr <id>\n`;
812
+ output += ` → Runs all offline tests (blocks if fail)\n`;
813
+ output += ` → Pushes to origin\n`;
814
+ output += ` → Creates PR with auto-generated description\n`;
815
+ output += ` → Triggers reviewer agents\n\n`;
816
+ output += `4. AUTOMATED REVIEW\n`;
817
+ output += ` → Reviewer agents run in parallel (quality, security, performance, tests)\n`;
818
+ output += ` → PR labeled: reviewer-approved OR needs-work\n`;
819
+ output += ` → Auto-merge on approval\n\n`;
820
+ output += `5. CLEANUP\n`;
821
+ output += ` uam worktree cleanup <id>\n`;
822
+ output += ` → Removes worktree and deletes branch\n`;
823
+ output += `\`\`\`\n\n`;
824
+ }
825
+
826
+ // For Code Changes
827
+ output += `### For Code Changes\n\n`;
828
+ output += `1. **Create ${isWeb ? 'branch' : 'worktree'}**: ${isWeb ? '`git checkout -b feature/<slug>`' : '`uam worktree create <slug>`'}\n`;
829
+ output += `2. Update/create tests\n`;
830
+ output += `3. Run tests: \`${testCmd}\`\n`;
831
+ output += `4. Run linting: \`${lintCmd}\`\n`;
832
+ output += `5. **Create PR**: ${isWeb ? 'Push and create via UI' : '`uam worktree pr <id>`'}\n\n`;
833
+
834
+ output += `### Before Completing\n\n`;
835
+ output += `1. All tests pass\n`;
836
+ output += `2. PR created and reviewed\n`;
837
+ output += `3. Documentation updated (if applicable)\n\n`;
838
+ output += `---\n\n`;
839
+
840
+ // Commands (both platforms)
841
+ output += `## Quick Reference\n\n`;
842
+ output += `### Essential Commands\n\n`;
843
+ output += `\`\`\`bash\n`;
844
+ output += `# Testing\n${testCmd}\n\n`;
845
+ output += `# Linting\n${lintCmd}\n\n`;
846
+ output += `# Building\n${buildCmd}\n`;
847
+ output += `\`\`\`\n\n`;
848
+ output += `---\n\n`;
849
+
850
+ // Custom sections
851
+ if (customSections) {
852
+ output += customSections + '\n\n---\n\n';
853
+ }
854
+
855
+ // Completion Checklist
856
+ output += `## Completion Checklist\n\n`;
857
+ output += `\`\`\`\n`;
858
+ output += `[ ] Tests updated and passing\n`;
859
+ output += `[ ] Linting/type checking passed\n`;
860
+ output += `[ ] ${isWeb ? 'Feature branch' : 'Worktree'} used for changes\n`;
861
+ output += `[ ] PR created (not direct commit)\n`;
862
+ output += `[ ] Memory updated with learnings\n`;
863
+ output += `[ ] Documentation updated\n`;
864
+ output += `[ ] No secrets in code/commits\n`;
865
+ output += `\`\`\`\n\n`;
866
+
867
+ output += `---\n\n`;
868
+ output += `**Languages**: ${languages || 'Not specified'}\n`;
869
+ output += `**Frameworks**: ${frameworks || 'Not specified'}\n\n`;
870
+ output += `</coding_guidelines>`;
871
+
872
+ document.getElementById('output').textContent = output;
873
+ }
874
+
875
+ function copyOutput() {
876
+ const output = document.getElementById('output').textContent;
877
+ navigator.clipboard.writeText(output).then(() => {
878
+ const msg = document.getElementById('copySuccess');
879
+ msg.style.display = 'block';
880
+ setTimeout(() => (msg.style.display = 'none'), 2000);
881
+ });
882
+ }
883
+
884
+ function resetForm() {
885
+ document
886
+ .querySelectorAll('input[type="text"], input[type="url"], textarea')
887
+ .forEach((el) => {
888
+ if (!['testCmd', 'lintCmd', 'buildCmd'].includes(el.id)) {
889
+ el.value = '';
890
+ }
891
+ });
892
+ document.querySelectorAll('input[type="checkbox"]').forEach((el) => (el.checked = true));
893
+ document.getElementById('targetPlatform').value = 'web';
894
+ document.getElementById('output').textContent =
895
+ 'Fill in the project details and click "Generate" to create your agent context file.';
896
+ }
897
+
898
+ // Generate on load with defaults
899
+ generateOutput();
900
+ </script>
901
+ </body>
902
+ </html>