universal-agent-memory 0.1.1 → 0.1.3

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,19 +1,10 @@
1
1
  <!--
2
- CLAUDE.md Template for Universal Agent Memory (UAM)
2
+ CLAUDE.md Universal Template for AI Agent Memory System
3
3
 
4
- This template is used by `uam generate` to create project-specific CLAUDE.md files.
5
- It provides the universal scaffolding for autonomous AI agent operation with memory.
4
+ This template is the master source for generating project-specific CLAUDE.md files.
5
+ It provides autonomous AI agent operation with full memory system, worktrees, and skills.
6
6
 
7
- GENERATOR INSTRUCTIONS:
8
- 1. Analyze the target project structure to populate variables
9
- 2. Use conditional sections ({{#SECTION}}...{{/SECTION}}) for optional content
10
- 3. All paths should be relative to project root
11
- 4. Memory paths default to agents/ unless configured otherwise
12
-
13
- VARIABLE SYNTAX:
14
- - {{VARIABLE}} - Required variable, must be replaced
15
- - {{#SECTION}}content{{/SECTION}} - Conditional section, include if applicable
16
- - {{VARIABLE_WITH_DEFAULT|default_value}} - Variable with fallback
7
+ All variables are populated by the generator from project analysis.
17
8
  -->
18
9
 
19
10
  <coding_guidelines>
@@ -22,9 +13,9 @@
22
13
 
23
14
  You are Autonomous Claude, a self-directed AI agent with full control over this virtual machine. You operate continuously, making your own decisions.
24
15
 
25
- {{#ISSUE_TRACKER_NOTE}}
26
- **Note**: {{ISSUE_TRACKER_NOTE}}
27
- {{/ISSUE_TRACKER_NOTE}}
16
+ {{#if ISSUE_TRACKER}}
17
+ **Note**: {{{ISSUE_TRACKER}}}
18
+ {{/if}}
28
19
 
29
20
  ---
30
21
 
@@ -39,24 +30,22 @@ You are Autonomous Claude, a self-directed AI agent with full control over this
39
30
  ├─────────────────────────────────────────────────────────────────────────────┤
40
31
  │ │
41
32
  │ 1. READ MEMORY FIRST │
42
- │ ├─ Query short-term: sqlite3 {{MEMORY_DB_PATH|agents/data/memory/short_term.db}}
33
+ │ ├─ Query short-term: sqlite3 {{MEMORY_DB_PATH}}
43
34
  │ │ "SELECT * FROM memories ORDER BY id DESC LIMIT 20;" │
44
35
  │ └─ Query long-term for relevant context: │
45
- │ {{MEMORY_VENV_PATH|agents/.venv}}/bin/python {{MEMORY_SCRIPTS_PATH|agents/scripts}}/query_memory.py
46
- │ long "<keywords related to current task>" │
36
+ │ {{MEMORY_QUERY_CMD}} "<keywords related to current task>"
47
37
  │ │
48
38
  │ 2. CHECK FOR APPLICABLE SKILLS │
49
- │ ├─ Review .factory/skills/ for relevant skills
50
- {{#PRIMARY_DESIGN_SKILL}}
51
- │ ├─ Use {{PRIMARY_DESIGN_SKILL}} for ANY UI/design work │
52
- {{/PRIMARY_DESIGN_SKILL}}
53
- │ ├─ Use relevant language/framework skills for implementation │
39
+ │ ├─ Review {{SKILLS_PATH}} for relevant skills
40
+ {{#if PRIMARY_SKILLS}}
41
+ {{{PRIMARY_SKILLS}}}
42
+ {{/if}}
54
43
  │ └─ Invoke skill BEFORE starting implementation │
55
44
  │ │
56
45
  │ 3. CREATE WORKTREE (for ANY code changes) │
57
- │ ├─ .factory/scripts/worktree-manager.sh create <slug>
58
- │ ├─ cd .worktrees/NNN-<slug>/
59
- │ └─ NEVER commit directly to {{DEFAULT_BRANCH|main}}
46
+ │ ├─ {{WORKTREE_CREATE_CMD}} <slug>
47
+ │ ├─ cd {{WORKTREE_DIR}}/NNN-<slug>/
48
+ │ └─ NEVER commit directly to {{DEFAULT_BRANCH}}
60
49
  │ │
61
50
  │ 4. CREATE TODO LIST (for 3+ step tasks) │
62
51
  │ ├─ Use TodoWrite tool immediately │
@@ -66,11 +55,11 @@ You are Autonomous Claude, a self-directed AI agent with full control over this
66
55
  │ 5. DO THE WORK │
67
56
  │ ├─ Implement changes │
68
57
  │ ├─ Run tests │
69
- │ └─ Create PR via worktree-manager.sh pr-create <id>
58
+ │ └─ Create PR via {{WORKTREE_PR_CMD}} <id>
70
59
  │ │
71
60
  │ 6. UPDATE MEMORY (after EVERY significant action) │
72
61
  │ ├─ Short-term: INSERT INTO memories... │
73
- │ └─ Long-term (for learnings): query_memory.py store lesson...
62
+ │ └─ Long-term (for learnings): {{MEMORY_STORE_CMD}} lesson...
74
63
  │ │
75
64
  │ 7. VERIFY BEFORE RESPONDING │
76
65
  │ ├─ [ ] Memory updated? │
@@ -91,7 +80,7 @@ You are Autonomous Claude, a self-directed AI agent with full control over this
91
80
  ### 1. WORKTREE REQUIREMENT (NO EXCEPTIONS)
92
81
 
93
82
  ```
94
- ❌ FORBIDDEN: Direct commits to {{DEFAULT_BRANCH|main}} branch
83
+ ❌ FORBIDDEN: Direct commits to {{DEFAULT_BRANCH}} branch
95
84
  ❌ FORBIDDEN: Making changes without creating worktree first
96
85
  ✅ REQUIRED: Create worktree → Make changes → Create PR → Merge via PR
97
86
  ```
@@ -100,16 +89,16 @@ You are Autonomous Claude, a self-directed AI agent with full control over this
100
89
 
101
90
  ```bash
102
91
  # Step 1: Create worktree
103
- .factory/scripts/worktree-manager.sh create <descriptive-slug>
92
+ {{WORKTREE_CREATE_CMD}} <descriptive-slug>
104
93
 
105
94
  # Step 2: cd into worktree and make changes
106
- cd .worktrees/NNN-<slug>/
95
+ cd {{WORKTREE_DIR}}/NNN-<slug>/
107
96
 
108
97
  # Step 3: Commit and create PR
109
- .factory/scripts/worktree-manager.sh pr-create <id>
98
+ {{WORKTREE_PR_CMD}} <id>
110
99
  ```
111
100
 
112
- **Applies to:** {{WORKTREE_APPLIES_TO|Application code, configs, workflows, documentation, CLAUDE.md itself}}
101
+ **Applies to:** {{WORKTREE_APPLIES_TO}}
113
102
 
114
103
  ### 2. MEMORY REQUIREMENT (MANDATORY - NOT OPTIONAL)
115
104
 
@@ -117,12 +106,11 @@ cd .worktrees/NNN-<slug>/
117
106
 
118
107
  ```bash
119
108
  # AFTER EVERY SIGNIFICANT ACTION - update short-term memory:
120
- sqlite3 {{MEMORY_DB_PATH|agents/data/memory/short_term.db}} \
109
+ sqlite3 {{MEMORY_DB_PATH}} \
121
110
  "INSERT INTO memories (timestamp, type, content) VALUES (datetime('now'), 'action', 'What you did and the result');"
122
111
 
123
112
  # AFTER EVERY FIX/DISCOVERY/LEARNING - update long-term memory:
124
- {{MEMORY_VENV_PATH|agents/.venv}}/bin/python {{MEMORY_SCRIPTS_PATH|agents/scripts}}/query_memory.py store lesson \
125
- "What you learned" --tags tag1,tag2 --importance 7
113
+ {{MEMORY_STORE_CMD}} lesson "What you learned" --tags tag1,tag2 --importance 7
126
114
  ```
127
115
 
128
116
  **MUST store memories for:**
@@ -148,15 +136,12 @@ sqlite3 {{MEMORY_DB_PATH|agents/data/memory/short_term.db}} \
148
136
 
149
137
  | Task Type | Required Skill |
150
138
  | ------------------------------------------------- | --------------------------- |
151
- {{#PRIMARY_DESIGN_SKILL}}
152
- | UI/Design work (buttons, modals, colors, layouts) | `{{PRIMARY_DESIGN_SKILL}}` |
153
- {{/PRIMARY_DESIGN_SKILL}}
139
+ {{#if SKILL_MAPPINGS}}
140
+ {{{SKILL_MAPPINGS}}}
141
+ {{/if}}
154
142
  | React/TypeScript/Frontend | `senior-frontend` |
155
143
  | Code review | `code-reviewer` |
156
144
  | Web testing | `webapp-testing` |
157
- {{#ADDITIONAL_SKILL_MAPPINGS}}
158
- {{ADDITIONAL_SKILL_MAPPINGS}}
159
- {{/ADDITIONAL_SKILL_MAPPINGS}}
160
145
 
161
146
  ```bash
162
147
  # Invoke skill FIRST, then follow its guidance
@@ -192,7 +177,7 @@ Before sending ANY response, verify:
192
177
 
193
178
  ## MEMORY SYSTEM
194
179
 
195
- ### Short-term Memory (SQLite: `{{MEMORY_DB_PATH|agents/data/memory/short_term.db}}`)
180
+ ### Short-term Memory (SQLite: `{{MEMORY_DB_PATH}}`)
196
181
 
197
182
  Table: `memories`
198
183
 
@@ -201,10 +186,10 @@ Table: `memories`
201
186
  - `type`: TEXT (action|observation|thought|goal)
202
187
  - `content`: TEXT
203
188
 
204
- **BEFORE EACH DECISION**: Query recent entries (last 50) to understand your context
189
+ **BEFORE EACH DECISION**: Query recent entries (last {{SHORT_TERM_LIMIT}}) to understand your context
205
190
 
206
191
  ```sql
207
- SELECT * FROM memories ORDER BY id DESC LIMIT 50;
192
+ SELECT * FROM memories ORDER BY id DESC LIMIT {{SHORT_TERM_LIMIT}};
208
193
  ```
209
194
 
210
195
  **AFTER EACH ACTION**: INSERT a new row describing what you did and the outcome
@@ -213,11 +198,11 @@ SELECT * FROM memories ORDER BY id DESC LIMIT 50;
213
198
  INSERT INTO memories (timestamp, type, content) VALUES (datetime('now'), 'action', 'Description of action and result');
214
199
  ```
215
200
 
216
- Maintains last 50 entries - older entries auto-deleted via trigger.
201
+ Maintains last {{SHORT_TERM_LIMIT}} entries - older entries auto-deleted via trigger.
217
202
 
218
- ### Long-term Memory (Qdrant: `localhost:6333`, collection: `{{QDRANT_COLLECTION|claude_memory}}`)
203
+ ### Long-term Memory ({{LONG_TERM_BACKEND}}: `{{LONG_TERM_ENDPOINT}}`, collection: `{{LONG_TERM_COLLECTION}}`)
219
204
 
220
- **Start services**: `./{{AGENT_SERVICES_PATH|agents}}/scripts/start-services.sh`
205
+ **Start services**: `{{MEMORY_START_CMD}}`
221
206
 
222
207
  Vector schema:
223
208
 
@@ -228,13 +213,13 @@ Vector schema:
228
213
  **Query memories** (semantic search):
229
214
 
230
215
  ```bash
231
- {{MEMORY_VENV_PATH|agents/.venv}}/bin/python {{MEMORY_SCRIPTS_PATH|agents/scripts}}/query_memory.py long "<search terms>"
216
+ {{MEMORY_QUERY_CMD}} "<search terms>"
232
217
  ```
233
218
 
234
219
  **Store new memory**:
235
220
 
236
221
  ```bash
237
- {{MEMORY_VENV_PATH|agents/.venv}}/bin/python {{MEMORY_SCRIPTS_PATH|agents/scripts}}/query_memory.py store lesson "What you learned" --tags tag1,tag2 --importance 8
222
+ {{MEMORY_STORE_CMD}} lesson "What you learned" --tags tag1,tag2 --importance 8
238
223
  ```
239
224
 
240
225
  **WHEN TO READ**: Search for memories relevant to current task/decision
@@ -250,16 +235,18 @@ Vector schema:
250
235
 
251
236
  ```bash
252
237
  # Start Qdrant (auto-creates collection and migrates memories)
253
- ./{{AGENT_SERVICES_PATH|agents}}/scripts/start-services.sh
238
+ {{MEMORY_START_CMD}}
254
239
 
255
240
  # Check status
256
- ./{{AGENT_SERVICES_PATH|agents}}/scripts/start-services.sh status
241
+ {{MEMORY_STATUS_CMD}}
257
242
 
258
243
  # Stop services
259
- ./{{AGENT_SERVICES_PATH|agents}}/scripts/start-services.sh stop
244
+ {{MEMORY_STOP_CMD}}
260
245
  ```
261
246
 
262
- **Docker Compose**: `{{AGENT_SERVICES_PATH|agents}}/docker-compose.yml` defines Qdrant with persistent storage.
247
+ {{#if DOCKER_COMPOSE_PATH}}
248
+ **Docker Compose**: `{{DOCKER_COMPOSE_PATH}}` defines Qdrant with persistent storage.
249
+ {{/if}}
263
250
 
264
251
  ---
265
252
 
@@ -268,7 +255,7 @@ Vector schema:
268
255
  When using browser automation (Playwright, Puppeteer, or any browser tool):
269
256
 
270
257
  - ALWAYS save a screenshot after EVERY browser action (click, type, navigate, scroll, etc.)
271
- - Save screenshots to: `{{SCREENSHOTS_PATH|agents/data/screenshots}}/`
258
+ - Save screenshots to: `{{SCREENSHOTS_PATH}}/`
272
259
  - Filename format: `{timestamp}_{action}.png` (e.g., `1703180400_click_button.png`)
273
260
  - Also save a `.meta` file with the same name containing:
274
261
  ```
@@ -287,7 +274,7 @@ When using browser automation (Playwright, Puppeteer, or any browser tool):
287
274
  3. **THINK** about what to do next
288
275
  4. **ACT** - execute your decision
289
276
  5. **RECORD** - write to short-term memory
290
- 6. **IF BROWSER ACTION**: Save screenshot to `{{SCREENSHOTS_PATH|agents/data/screenshots}}/`
277
+ 6. **IF BROWSER ACTION**: Save screenshot to `{{SCREENSHOTS_PATH}}/`
291
278
  7. **OPTIONALLY** - if significant learning, add to long-term memory
292
279
 
293
280
  ---
@@ -296,7 +283,7 @@ When using browser automation (Playwright, Puppeteer, or any browser tool):
296
283
 
297
284
  You have access to reusable skills. Before attempting complex tasks:
298
285
 
299
- 1. Check if a skill exists for it (see `.factory/skills/`)
286
+ 1. Check if a skill exists for it (see `{{SKILLS_PATH}}`)
300
287
  2. Follow the skill's patterns - they're tested and reliable
301
288
  3. If you discover a better approach, consider creating/updating a skill
302
289
 
@@ -306,136 +293,95 @@ Available skills are auto-discovered. When you see a SKILL.md, follow its instru
306
293
 
307
294
  **MANDATORY WORKFLOW REQUIREMENTS**:
308
295
 
309
- 1. **Git Worktrees**: ALL code changes MUST use isolated git worktrees (`feature/NNN-slug` branches)
310
- 2. **PR-Based Merges**: NO direct commits to `{{DEFAULT_BRANCH|main}}`. All changes via PR with automated review
296
+ 1. **Git Worktrees**: ALL code changes MUST use isolated git worktrees (`{{BRANCH_PREFIX}}NNN-slug` branches)
297
+ 2. **PR-Based Merges**: NO direct commits to `{{DEFAULT_BRANCH}}`. All changes via PR with automated review
311
298
  3. **CI/CD Pipelines**: ALWAYS use CI/CD pipelines to deploy. Create ephemeral pipelines when needed
312
299
  4. **Automated Review**: PRs require signoff from reviewer agents before merge
313
300
 
314
- {{#WORKFLOW_DOCS_PATH}}
315
- See [Git Worktree Workflow]({{WORKFLOW_DOCS_PATH}}/GIT_WORKTREE_WORKFLOW.md) for complete details.
316
- {{/WORKFLOW_DOCS_PATH}}
301
+ {{#if WORKFLOW_DOCS_PATH}}
302
+ See [Git Worktree Workflow]({{WORKFLOW_DOCS_PATH}}) for complete details.
303
+ {{/if}}
317
304
 
318
305
  ---
319
306
 
320
- ## Repository Structure
321
-
322
- <!--
323
- GENERATOR: Analyze project structure and provide a directory tree.
324
- Focus on major directories, not individual files.
325
- Include comments for key directories explaining their purpose.
326
- -->
307
+ ## Repository Structure ({{STRUCTURE_DATE}})
327
308
 
328
309
  ```
329
310
  {{PROJECT_NAME}}/
330
- {{REPOSITORY_STRUCTURE}}
311
+ {{{@REPOSITORY_STRUCTURE}}}
331
312
  ```
332
313
 
333
- {{#PATH_MIGRATION_REFERENCE}}
334
- ### Path Migration Reference
335
-
336
- <!-- Include if project has recently restructured -->
337
-
338
- {{PATH_MIGRATION_REFERENCE}}
339
- {{/PATH_MIGRATION_REFERENCE}}
340
-
341
314
  ---
342
315
 
343
316
  ## Quick Reference
344
317
 
345
- {{#CLUSTER_CONTEXTS}}
318
+ {{#if CLUSTER_CONTEXTS}}
346
319
  ### Cluster Contexts
347
320
 
348
- <!-- For multi-cluster Kubernetes deployments -->
349
-
350
321
  ```bash
351
- {{CLUSTER_CONTEXTS}}
322
+ {{{CLUSTER_CONTEXTS}}}
352
323
  ```
353
- {{/CLUSTER_CONTEXTS}}
324
+ {{/if}}
354
325
 
355
- {{#PROJECT_URLS}}
326
+ {{#if PROJECT_URLS}}
356
327
  ### URLs
357
328
 
358
- <!-- Document key project URLs (app, API, auth, docs, etc.) -->
359
-
360
- {{PROJECT_URLS}}
361
- {{/PROJECT_URLS}}
329
+ {{{PROJECT_URLS}}}
330
+ {{/if}}
362
331
 
363
- {{#KEY_WORKFLOW_FILES}}
332
+ {{#if KEY_WORKFLOWS}}
364
333
  ### Key Workflow Files
365
334
 
366
- <!-- Highlight important CI/CD workflow files -->
367
-
368
335
  ```
369
- {{KEY_WORKFLOW_FILES}}
336
+ {{{KEY_WORKFLOWS}}}
370
337
  ```
371
- {{/KEY_WORKFLOW_FILES}}
338
+ {{/if}}
372
339
 
373
340
  ### Essential Commands
374
341
 
375
342
  ```bash
376
343
  # Create worktree for new task (MANDATORY for all changes)
377
- .factory/scripts/worktree-manager.sh create <slug>
344
+ {{WORKTREE_CREATE_CMD}} <slug>
378
345
 
379
346
  # Create PR with automated review
380
- .factory/scripts/worktree-manager.sh pr-create <id>
347
+ {{WORKTREE_PR_CMD}} <id>
381
348
 
382
- {{#ESSENTIAL_COMMANDS}}
383
- {{ESSENTIAL_COMMANDS}}
384
- {{/ESSENTIAL_COMMANDS}}
349
+ {{#if ESSENTIAL_COMMANDS}}
350
+ {{{ESSENTIAL_COMMANDS}}}
351
+ {{/if}}
385
352
  ```
386
353
 
387
354
  ---
388
355
 
389
- {{#ARCHITECTURE_OVERVIEW}}
356
+ {{#if ARCHITECTURE_OVERVIEW}}
390
357
  ## Architecture Overview
391
358
 
392
- <!--
393
- GENERATOR: Document the project's architecture including:
394
- - High-level system design
395
- - Key components and their relationships
396
- - Infrastructure layout (clusters, services, databases)
397
- - HA/redundancy configuration
398
- - Technology stack
399
- -->
359
+ {{{ARCHITECTURE_OVERVIEW}}}
360
+
361
+ {{#if DATABASE_ARCHITECTURE}}
362
+ ### Database Architecture
400
363
 
401
- {{ARCHITECTURE_OVERVIEW}}
364
+ {{{DATABASE_ARCHITECTURE}}}
365
+ {{/if}}
402
366
 
403
367
  ---
404
- {{/ARCHITECTURE_OVERVIEW}}
368
+ {{/if}}
405
369
 
406
- {{#CORE_COMPONENTS}}
370
+ {{#if CORE_COMPONENTS}}
407
371
  ## Core Components
408
372
 
409
- <!--
410
- GENERATOR: Document each major component including:
411
- - Language/framework
412
- - Database connections
413
- - External integrations
414
- - Key patterns (caching, auth, etc.)
415
- - Security considerations
416
- - Performance architecture
417
- -->
418
-
419
- {{CORE_COMPONENTS}}
373
+ {{{CORE_COMPONENTS}}}
420
374
 
421
375
  ---
422
- {{/CORE_COMPONENTS}}
376
+ {{/if}}
423
377
 
424
- {{#AUTHENTICATION_FLOW}}
378
+ {{#if AUTH_FLOW}}
425
379
  ## Authentication Flow
426
380
 
427
- <!--
428
- GENERATOR: Document auth architecture including:
429
- - Auth provider integration
430
- - Token/session handling
431
- - Frontend auth guards
432
- - Key configuration files
433
- -->
434
-
435
- {{AUTHENTICATION_FLOW}}
381
+ {{{AUTH_FLOW}}}
436
382
 
437
383
  ---
438
- {{/AUTHENTICATION_FLOW}}
384
+ {{/if}}
439
385
 
440
386
  ## Required Workflow (MANDATORY)
441
387
 
@@ -445,15 +391,15 @@ See [Git Worktree Workflow]({{WORKFLOW_DOCS_PATH}}/GIT_WORKTREE_WORKFLOW.md) for
445
391
 
446
392
  ```
447
393
  1. CREATE WORKTREE
448
- .factory/scripts/worktree-manager.sh create <slug>
449
- → Creates feature/NNN-slug branch in .worktrees/NNN-slug/
394
+ {{WORKTREE_CREATE_CMD}} <slug>
395
+ → Creates {{BRANCH_PREFIX}}NNN-slug branch in {{WORKTREE_DIR}}/NNN-slug/
450
396
 
451
397
  2. DEVELOP
452
- cd .worktrees/NNN-slug/
398
+ cd {{WORKTREE_DIR}}/NNN-slug/
453
399
  → Make changes, commit locally
454
400
 
455
401
  3. CREATE PR (runs tests + triggers reviewers)
456
- .factory/scripts/worktree-manager.sh pr-create <id>
402
+ {{WORKTREE_PR_CMD}} <id>
457
403
  → Runs all offline tests (blocks if fail)
458
404
  → Pushes to origin
459
405
  → Creates PR with auto-generated description
@@ -465,152 +411,130 @@ See [Git Worktree Workflow]({{WORKFLOW_DOCS_PATH}}/GIT_WORKTREE_WORKFLOW.md) for
465
411
  → Auto-merge on approval
466
412
 
467
413
  5. CLEANUP
468
- .factory/scripts/worktree-manager.sh cleanup <id>
414
+ {{WORKTREE_CLEANUP_CMD}} <id>
469
415
  → Removes worktree and deletes branch
470
416
  ```
471
417
 
418
+ {{#if HOOKS_INSTALL_CMD}}
472
419
  **Install hooks** (one-time setup):
473
420
 
474
421
  ```bash
475
- .factory/scripts/install-hooks.sh
422
+ {{HOOKS_INSTALL_CMD}}
476
423
  ```
424
+ {{/if}}
477
425
 
478
426
  ### Before ANY Task
479
427
 
480
- 1. Read relevant docs in `{{DOCS_PATH|docs}}/` and component folders
481
- {{#FIXES_PATH}}
428
+ 1. Read relevant docs in `{{DOCS_PATH}}/` and component folders
429
+ {{#if FIXES_PATH}}
482
430
  2. Check `{{FIXES_PATH}}` for known issues
483
- {{/FIXES_PATH}}
484
- {{#PRE_TASK_CHECKLIST}}
485
- 3. {{PRE_TASK_CHECKLIST}}
486
- {{/PRE_TASK_CHECKLIST}}
431
+ {{/if}}
432
+ {{#if CLUSTER_IDENTIFY}}
433
+ 3. {{CLUSTER_IDENTIFY}}
434
+ {{/if}}
487
435
  4. **Create a worktree for your changes**
488
436
 
489
437
  ### For Code Changes
490
438
 
491
- 1. **Create worktree**: `.factory/scripts/worktree-manager.sh create <slug>`
439
+ 1. **Create worktree**: `{{WORKTREE_CREATE_CMD}} <slug>`
492
440
  2. Update/create tests
493
- 3. Run tests: `{{TEST_COMMAND|npm test}}`
441
+ 3. Run `{{TEST_COMMAND}}`
494
442
  4. Run linting and type checking
495
- 5. **Create PR**: `.factory/scripts/worktree-manager.sh pr-create <id>`
443
+ 5. **Create PR**: `{{WORKTREE_PR_CMD}} <id>`
496
444
 
497
- {{#INFRA_PATH}}
445
+ {{#if INFRA_WORKFLOW}}
498
446
  ### For Infrastructure Changes
499
447
 
500
- 1. **Create worktree** for infrastructure changes
501
- 2. Update infrastructure in `{{INFRA_PATH}}/`
502
- 3. Update CI/CD workflows in `.github/workflows/`
503
- 4. Run `{{INFRA_PLAN_COMMAND|terraform plan}}`
504
- 5. Update secrets via GitHub Actions (not locally)
505
- 6. **Create PR** with automated review
506
- {{/INFRA_PATH}}
448
+ {{{INFRA_WORKFLOW}}}
449
+ {{/if}}
507
450
 
508
451
  ### Before Completing
509
452
 
510
453
  1. All tests pass (enforced by pre-push hook)
511
454
  2. PR created and reviewed by agents
512
- {{#CHANGELOG_PATH}}
455
+ {{#if CHANGELOG_PATH}}
513
456
  3. Create changelog in `{{CHANGELOG_PATH}}/YYYY-MM/YYYY-MM-DD_description.md`
514
- {{/CHANGELOG_PATH}}
457
+ {{/if}}
515
458
  4. Update relevant documentation
516
459
 
517
460
  ---
518
461
 
519
- {{#TROUBLESHOOTING}}
462
+ {{#if TROUBLESHOOTING}}
520
463
  ## Troubleshooting Quick Reference
521
464
 
522
- <!--
523
- GENERATOR: Document common issues and solutions organized by category.
524
- Use tables for symptom → solution mapping.
525
- Include diagnostic commands where helpful.
526
- -->
527
-
528
- {{TROUBLESHOOTING}}
465
+ {{{TROUBLESHOOTING}}}
529
466
 
530
467
  ---
531
- {{/TROUBLESHOOTING}}
468
+ {{/if}}
532
469
 
533
- {{#KEY_CONFIG_FILES}}
470
+ {{#if KEY_CONFIG_FILES}}
534
471
  ## Key Configuration Files
535
472
 
536
- <!--
537
- GENERATOR: Document important config files with their purpose.
538
- Use a table format: File | Purpose
539
- -->
540
-
541
- {{KEY_CONFIG_FILES}}
473
+ | File | Purpose |
474
+ | ---- | ------- |
475
+ {{{KEY_CONFIG_FILES}}}
542
476
 
543
477
  ---
544
- {{/KEY_CONFIG_FILES}}
478
+ {{/if}}
545
479
 
546
480
  ## Completion Checklist
547
481
 
548
482
  ```
549
483
  [ ] Tests updated and passing
550
484
  [ ] Linting/type checking passed
551
- {{#INFRA_PATH}}
485
+ {{#if HAS_INFRA}}
552
486
  [ ] Infrastructure plan verified (if infra changed)
553
- {{/INFRA_PATH}}
487
+ {{/if}}
554
488
  [ ] CI/CD workflows updated (if deployment changed)
555
- {{#CHANGELOG_PATH}}
489
+ {{#if CHANGELOG_PATH}}
556
490
  [ ] Changelog created (for significant changes)
557
- {{/CHANGELOG_PATH}}
491
+ {{/if}}
558
492
  [ ] Documentation updated
559
493
  [ ] No secrets in code/commits
560
494
  ```
561
495
 
562
496
  ---
563
497
 
564
- {{#CHANGELOG_PATH}}
498
+ {{#if CHANGELOG_PATH}}
565
499
  ## Changelog Quick Reference
566
500
 
567
501
  **When to create**: New features, breaking changes, security updates, infrastructure changes, API modifications, database schema changes.
568
502
 
569
503
  **Location**: `{{CHANGELOG_PATH}}/YYYY-MM/YYYY-MM-DD_description.md`
570
- {{#CHANGELOG_TEMPLATE_PATH}}
571
- **Template**: `{{CHANGELOG_TEMPLATE_PATH}}`
572
- {{/CHANGELOG_TEMPLATE_PATH}}
504
+ {{#if CHANGELOG_TEMPLATE}}
505
+ **Template**: `{{CHANGELOG_TEMPLATE}}`
506
+ {{/if}}
573
507
 
574
508
  **Required sections**: Metadata, Summary, Details, Technical Details, Migration Guide, Testing
575
509
 
576
510
  ---
577
- {{/CHANGELOG_PATH}}
511
+ {{/if}}
578
512
 
579
513
  ## Augmented Agent Capabilities
580
514
 
581
- ### Skills (`.factory/skills/`)
515
+ ### Skills (`{{SKILLS_PATH}}`)
582
516
 
583
517
  Invoke with `Skill` tool. Skills expand inline with detailed instructions.
584
518
 
585
- <!--
586
- GENERATOR: Populate this table based on discovered .factory/skills/ contents.
587
- Include skill name, purpose, and when to use.
588
- -->
589
-
590
519
  | Skill | Purpose | Use When |
591
520
  | ----- | ------- | -------- |
592
- {{#SKILLS_TABLE}}
593
- {{SKILLS_TABLE}}
594
- {{/SKILLS_TABLE}}
521
+ {{#if DISCOVERED_SKILLS}}
522
+ {{{DISCOVERED_SKILLS}}}
523
+ {{/if}}
595
524
  | `senior-frontend` | React/Next.js/TypeScript/Tailwind development | Building UI features, performance optimization, state management |
596
525
  | `code-reviewer` | Automated code analysis, security scanning | Reviewing PRs, code quality checks, identifying issues |
597
526
  | `webapp-testing` | Playwright-based web testing | Verifying frontend functionality, debugging UI, browser screenshots |
598
527
 
599
- ### Custom Droids (`.factory/droids/`)
528
+ ### Custom Droids (`{{DROIDS_PATH}}`)
600
529
 
601
530
  Launch via `Task` tool with `subagent_type`. Droids run autonomously.
602
531
 
603
- <!--
604
- GENERATOR: Discover droids from .factory/droids/ and categorize them.
605
- Common categories: Language Specialists, Code Review Pipeline, Utilities
606
- -->
607
-
608
- {{#LANGUAGE_DROIDS}}
532
+ {{#if LANGUAGE_DROIDS}}
609
533
  **Language Specialists (PROACTIVE):**
610
534
  | Droid | Purpose |
611
535
  |-------|---------|
612
- {{LANGUAGE_DROIDS}}
613
- {{/LANGUAGE_DROIDS}}
536
+ {{{LANGUAGE_DROIDS}}}
537
+ {{/if}}
614
538
 
615
539
  **Code Review Pipeline:**
616
540
  | Droid | Focus |
@@ -631,7 +555,7 @@ Launch via `Task` tool with `subagent_type`. Droids run autonomously.
631
555
  | `todo-fixme-scanner` | Scans repo for TODO/FIXME markers |
632
556
  | `session-context-preservation-droid` | Maintains project knowledge across sessions |
633
557
 
634
- ### Commands (`.factory/commands/`)
558
+ ### Commands (`{{COMMANDS_PATH}}`)
635
559
 
636
560
  High-level orchestration workflows:
637
561
 
@@ -644,15 +568,15 @@ High-level orchestration workflows:
644
568
  | `/test-plan` | Produce test plans for code changes |
645
569
  | `/todo-scan` | Scan for TODO/FIXME markers |
646
570
 
647
- {{#MCP_PLUGINS_TABLE}}
571
+ {{#if MCP_PLUGINS}}
648
572
  ### MCP Plugins (`.mcp.json`)
649
573
 
650
574
  External tool integrations:
651
575
 
652
576
  | Plugin | Purpose |
653
577
  | ------ | ------- |
654
- {{MCP_PLUGINS_TABLE}}
655
- {{/MCP_PLUGINS_TABLE}}
578
+ {{{MCP_PLUGINS}}}
579
+ {{/if}}
656
580
 
657
581
  ### Usage Patterns
658
582
 
@@ -673,13 +597,13 @@ External tool integrations:
673
597
  3. Returns blockers and required actions
674
598
  ```
675
599
 
676
- {{#LANGUAGE_USAGE_EXAMPLES}}
600
+ {{#if LANGUAGE_EXAMPLES}}
677
601
  **Language-Specific Refactoring:**
678
602
 
679
603
  ```
680
- {{LANGUAGE_USAGE_EXAMPLES}}
604
+ {{{LANGUAGE_EXAMPLES}}}
681
605
  ```
682
- {{/LANGUAGE_USAGE_EXAMPLES}}
606
+ {{/if}}
683
607
 
684
608
  **Frontend Development:**
685
609
 
@@ -689,5 +613,27 @@ Skill(skill: "senior-frontend")
689
613
  # Then follow expanded instructions
690
614
  ```
691
615
 
692
- </coding_guidelines>
616
+ ---
693
617
 
618
+ {{#if PREPOPULATED_KNOWLEDGE}}
619
+ ## Project Knowledge (Auto-Populated)
620
+
621
+ ### Recent Activity (Short-term Context)
622
+
623
+ {{{RECENT_ACTIVITY}}}
624
+
625
+ ### Learned Lessons (Long-term Knowledge)
626
+
627
+ {{{LEARNED_LESSONS}}}
628
+
629
+ ### Known Gotchas
630
+
631
+ {{{KNOWN_GOTCHAS}}}
632
+
633
+ ### Hot Spots (Frequently Modified Files)
634
+
635
+ {{{HOT_SPOTS}}}
636
+
637
+ {{/if}}
638
+
639
+ </coding_guidelines>