Add cross-project pattern registry for retrieval-augmented generalization

- Create patterns/ directory with README, manifest, and 10 initial patterns
  covering Ollama JSON fallback, API escaping, deprecation, PTY auth,
  queue-poll, LLM-as-parser, credential rotation, reverse proxy binding,
  human approval gates, and transient retry.
- Wire pattern loading into architecture/pipeline.js based on task tags.
- Update architecture/orchestrator.js to load patterns and surface them in
  the system prompt.
- Update MEMORY.md, ARCHITECTURE.md, and CONTEXT.md to document the registry
  and record the decision.
This commit is contained in:
JC Beasley
2026-08-06 12:46:09 -07:00
parent d8989f9371
commit 0bd719ab91
17 changed files with 676 additions and 32 deletions
+23 -3
View File
@@ -29,7 +29,7 @@ User preferences, confirmed decisions, validated fixes. Stored in:
- **Structured Memory** (`memory/items/`) - JSON with metadata
- **Project Memory** (`Projects/*/memory/`) - Per-project facts
- **Vector DB** (future) - Semantic search for similar tasks
- **Cross-Project Patterns** (`patterns/`) - Reusable technical patterns loaded by the preprocessing pipeline
**Priority: HIGH** — Loaded at session start, refreshed as needed.
@@ -64,10 +64,11 @@ Step 2: LOAD PREFERENCES
Step 3: LOAD RELEVANT MEMORY
├── Vector search for similar past tasks
├── Load project STATUS.md
── Load recent DECISIONS.md entries
── Load recent DECISIONS.md entries
└── Load matching cross-project patterns from `patterns/` registry
Step 4: BUILD CONTEXT PACKET
├── Priority order: Rules → Prefs → Memory → Task
├── Priority order: Rules → Prefs → Memory → Patterns → Task
└── Truncate to fit context window
```
@@ -182,6 +183,25 @@ Enforce structure at system level:
---
## Cross-Project Pattern Registry
The `patterns/` directory stores reusable technical lessons (workarounds, failure modes, design choices) that recur across projects. The preprocessing pipeline loads matching patterns into the context packet based on the task input.
### How it works
1. `architecture/pipeline.js` reads `patterns/patterns.json`.
2. It matches task input against pattern `tags` and `affected_projects`.
3. Matching pattern files are injected as context with priority 6 (above generic memory, below project status).
4. Agents receive the pattern content and can apply the documented countermeasure.
### Adding patterns
1. Create `patterns/<pattern-id>.md` using the standard template.
2. Add an entry to `patterns/patterns.json`.
3. Test retrieval: `node architecture/pipeline.js "your task description"`.
This enables **generalization**: an agent encountering a new task can recognize a known shape and reuse a proven fix.
---
## Implementation Status
| Component | Status | Location |