| name | knowledge-evolution-protocol |
|---|---|
| description | KEP — brain-first retrieval & capture. Use before any non-trivial coding, debugging, or research task: search the brain for prior knowledge first, then capture durable facts (fixes, patterns, gotchas) after learning them. Triggers on 'check the brain', 'remember', 'what do we know about', project/issue/debug context, and any task where prior knowledge would help. |
Mandatory retrieve-before and capture-after workflow using a persistent, searchable
brain/ indexed by QMD.
- Primary:
<brain-root>=${KEP_BRAIN_DIR:-~/.config/opencode/brain/}(collection:opencode). IfKEP_BRAIN_DIRis set, use it — check withecho "$KEP_BRAIN_DIR". - Secondary (auto-detected):
~/.openclaw/workspace/brainif present (collection:openclaw). Search it too; it may hold older shared knowledge.
---
topic: <canonical-topic-name>
queries: [query1, query2, query3]
tags: [tag1, tag2, tag3]
updated: YYYY-MM-DD
---Run before any non-trivial coding / debugging / research. Announce the result inline.
search "<topic>"(BM25 — exact terms, names, commands, errors). Fall back to:vsearch "<topic>"(semantic — described-in-words topics).query "<topic>"(hybrid — expansion + rerank, when precision matters over latency).- Direct:
ls ~/.config/opencode/brain/*<keyword>*.mdthen read.
Read only the top 1–3 hits. Announce:
[brain] searched "<topic>" → N hits
If a hit is used, announce it and read/apply:
[brain] applied <namespace>/<domain>/<name>.md
If the top result is a weak semantic match for an exact term (name/command/error), drop to
search (BM25) immediately — it guarantees exact recall.
Announce at the start:
[brain] capturing <namespace>/<topic>.md
- Search the brain first to avoid duplicates.
- Existing file found → patch the relevant section (dated subsection, or correct + bump
updated). - New topic → create
brain/<namespace>/<domain>/<name>.mdwith frontmatter. - Reindex after every write (update rescans the FS; embed alone misses new files):
If the
qmd update -c opencode qmd embed -c opencode
openclawcollection exists and you edited it, run with-c openclawtoo. - Announce:
[brain] captured <namespace>/<topic>.md (reindexed)
Any resolved issue / bug / debugging breakthrough MUST be recorded before the task is considered done. This is non-negotiable, not a judgment call.
- Write to
<brain-root>/issues/<domain>/<name>.md. - Frontmatter
queriesMUST include the exact error string, the symptom, and the fix terms so the same error is found verbatim next time. - Body MUST contain: symptom, exact error, root cause, fix steps,
updateddate. - Reindex and announce as in the capture workflow above.
---
topic: <issue-name>
queries: ["<exact error string>", "<symptom>", "<fix keyword>"]
tags: [issue, <domain>]
updated: YYYY-MM-DD
---
# Symptom
# Exact error
# Root cause
# Fix stepsAt the end of a significant session, append/update <brain-root>/memory/YYYY-MM-DD.md with
decisions made, new facts captured, and issues fixed — catching anything missed mid-task.
- Secrets, tokens, passwords, private keys, credentials.
- One-off banter with no future value.
- Raw transcript dumps — summarize instead.