Add feedback loop for cross-project pattern registry

- Create scripts/utils/propose-pattern.js to propose new patterns or
  extend existing ones based on a newly applied workaround/fix.
- Default to dry-run preview; --apply writes files only after human review.
- Matches against existing patterns via keyword overlap and proposes an
  update when the shape is similar enough, or a new pattern file otherwise.
- Update patterns/README.md with feedback-loop instructions.
- Update MEMORY.md to document the plasticity loop.
- Update CONTEXT.md decisions log and current tasks.
This commit is contained in:
JC Beasley
2026-08-06 12:52:47 -07:00
parent 0bd719ab91
commit 66215eaf76
4 changed files with 329 additions and 2 deletions
+26 -2
View File
@@ -60,9 +60,33 @@ Links to other patterns that often appear together.
1. **Manual reference** — read the registry before designing a new integration or workflow.
2. **Automatic retrieval**`architecture/pipeline.js` loads relevant patterns into the context packet based on keyword matching against the task input.
3. **Skill/worfklow design** — when a new workaround is applied, propose a new pattern entry if the underlying shape is reusable.
3. **Skill/workflow design** — when a new workaround is applied, propose a new pattern entry if the underlying shape is reusable.
## Adding or Updating a Pattern
## Feedback Loop: Proposing New Patterns
When an agent applies a workaround or fixes a recurring failure, it should ask: *"is this lesson reusable across projects?"* If yes, run the proposal helper:
```bash
node scripts/utils/propose-pattern.js \
--task "n8n workflow sends LLM-generated text to LinkedIn" \
--fix "JSON.stringify the post body and validate with JSON.parse before the HTTP Request node" \
--projects "linkedin-automation" \
--symptom "LinkedIn API returns malformed JSON payload errors" \
--root-cause "LLM output contains unescaped quotes and newlines"
```
The helper:
1. Loads the existing `patterns/patterns.json` manifest.
2. Compares the new lesson against existing patterns using keyword overlap.
3. Proposes either:
- **An update** to an existing pattern (e.g., add an affected project), or
- **A new pattern** file + manifest entry.
4. Outputs a preview. By default it is **dry-run only**.
5. If the preview looks right, run the same command with `--apply` to write the files.
After applying, run `node architecture/pipeline.js "sample query"` to verify the new or updated pattern is retrievable.
## Adding or Updating a Pattern Manually
1. Create or edit the `.md` file.
2. Update `patterns.json` with id, tags, related patterns, and affected projects.