knowledge-update
Skill1 starsChanged 51 days agoMITView on GitHub
Extract domain knowledge from the current session and store it in the project's domain_*.md memory files. Updates facts, adds hypotheses, increments confirmation counts, promotes hypotheses to rules at 5+ confirmations, and syncs promoted rules into CLAUDE.md for enforcement. Run at the end of a work session.
3 other projects use a version of this.
Adopted by
Most recently taken up by
- melocalex/agent-knowledge-demotheir own version, first seen Oct 25, 2026
- openai/pluginstheir own version, first seen Oct 13, 2026
- vercel/vercel-plugintheir own version, first seen Oct 8, 2026
Other versions3 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 3
- openai/plugins★ 7.8ksame name
- vercel/vercel-plugin★ 328same name
- melocalex/agent-knowledge-demo★ 0same name
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
The file
Show its rules and text
We split this skill into the rules it gives an agent
13 rules. 0 are common, 9 are distinctive, and 4 are very specific to this project.
0
Common
Most of the 3 edited versions we read keep these.
9
Distinctive
This author's own choices. Worth a look.
4
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 12
Run at the end of a session with /knowledge-update when:
- Distinctive: line 22
Run these two bash checks first — do not skip or infer:
- Distinctive: line 43
Look at what was worked on.
- Distinctive: line 45
Only create a new domain file if the work clearly belongs to a different domain than existing ones.
- Distinctive: line 57
Add to the hypotheses table with confirmation count 1
- Distinctive: line 79
Locate CLAUDE.md: Check BOTH possible locations, not just the first hit:
- Distinctive: line 87
Only one exists → use it.
- Very specific: line 90
If it doesn't, nothing to reconcile — proceed normally with .claude/CLAUDE.md.
- Very specific: line 91
If it does, this is drift (two independently-maintained managed blocks — can happen when a repo's root CLAUDE.md predates a later .claude/ …
- Very specific: line 103
If the markers don't exist yet in CLAUDE.md, append them (and the header from rules_template.md) now.
- Distinctive: line 117
Only include domains that have at least one rule.
- Distinctive: line 119
If a rule was demoted this session, remove it from the block.
- Distinctive: line 150
After a session fixing a Notion API pagination bug:
“Common” is measured: kept by at least 6 in 10 of the 3 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Knowledge Update
Extract what was learned in this session and persist it to the project's domain memory files.
When to Use
Run at the end of a session with /knowledge-update when:
- You just completed a non-trivial task
- You encountered a surprising bug, API quirk, or pattern
- Something worked differently than expected
- A previous hypothesis was confirmed or contradicted
How It Works
Step 1 — Locate the memory folder
Run these two bash checks first — do not skip or infer:
test -d .git && echo "git=yes" || echo "git=no"
test -d .claude/memory && echo "memory=yes" || echo "memory=no"Decision based on the output:
| git | memory | Action |
| yes | yes | Use .claude/memory/ |
| yes | no | Run mkdir -p .claude/memory/ then use it |
| no | — | Fall back to ~/.claude/projects/<project-slug>/memory/ |
Do not silently fall back to ~/.claude/projects/ just because .claude/memory/ hasn't been created yet. If it's a git repo, create the folder. The ~/.claude/projects/ path is reserved for non-repo contexts only (e.g. a scratch folder with no .git).
If the repo is (or is about to become) public/open-source, keep using repo-local .claude/memory/ — don't reroute to ~/.claude/projects/ just because the repo is public. Instead, make sure .claude/ is listed in .gitignore so the memory files stay local-only and never get published. If .gitignore exists but doesn't already exclude .claude/, add it as part of this step.
Step 1b — Identify the domain
Look at what was worked on. Map it to an existing domain file in the resolved memory folder, or decide if a new one is needed.
Only create a new domain file if the work clearly belongs to a different domain than existing ones.
Step 2 — Extract insights from the session
Review the conversation and identify:
Facts (certain, repeatable, no ambiguity):
- API behaviors, schema details, confirmed constraints
- "Property names are case-sensitive" — not "I think they might be"
Hypotheses (pattern seen, not confirmed enough):
- Things that worked once or twice but need more evidence
- Add to the hypotheses table with confirmation count 1
Confirmations (a hypothesis proved true again):
- Find the matching row in the hypotheses table
- Increment the confirmation count
Contradictions (a rule proved wrong):
- Move it back to Hypotheses with a note
Step 3 — Apply promotion logic
- Hypothesis with 5+ confirmations → move to Rules section
- Rule contradicted by new data → move back to Hypotheses with a note explaining what contradicted it
Step 4 — Update the domain file(s)
Edit the relevant domain_*.md file(s) in the memory folder resolved in Step 1. If creating a new domain file, also add it to MEMORY.md in the same folder.
Step 5 — Sync rules into CLAUDE.md
Rules carry enforcement weight only when they live in CLAUDE.md, not just in domain files. After any promotion or demotion, rebuild the rules block in the project's CLAUDE.md.
Locate CLAUDE.md: Check BOTH possible locations, not just the first hit:
test -f .claude/CLAUDE.md && echo ".claude/CLAUDE.md=yes" || echo ".claude/CLAUDE.md=no"
test -f CLAUDE.md && echo "CLAUDE.md=yes" || echo "CLAUDE.md=no"
grep -l "rules-start" .claude/CLAUDE.md CLAUDE.md 2>/dev/null- Only one exists → use it.
- Neither exists → create
.claude/CLAUDE.md. - Both exist →
.claude/CLAUDE.mdis the canonical one going forward, but do not just overwrite the root file blind. Check whether the rootCLAUDE.mdalso has arules-start/rules-endblock:- If it doesn't, nothing to reconcile — proceed normally with
.claude/CLAUDE.md. - If it does, this is drift (two independently-maintained managed blocks — can happen when a repo's root
CLAUDE.mdpredates a later.claude/migration). Before touching anything:- Diff the two blocks. For every rule present in root's block but absent from
.claude/CLAUDE.md's block, add it to the matching domain's## Rulessection in.claude/memory/domain_*.mdfirst (create the domain file if it doesn't exist) — do not let a rule disappear just because it lived in the "wrong" file. - Rebuild
.claude/CLAUDE.md's block per the process below, now covering the reconciled rule set. - Strip the
rules-start/rules-endblock out of the rootCLAUDE.md(keep any surrounding prose), replacing it with a one-line pointer:`.claude/CLAUDE.md` — enforced rules synced from domain memory (single source of truth). - Report the consolidation explicitly to the user (which rules were recovered from root, if any) — do not do this silently.
- Diff the two blocks. For every rule present in root's block but absent from
- If it doesn't, nothing to reconcile — proceed normally with
Find the managed block in .claude/CLAUDE.md — the section between these markers:
<!-- rules-start -->
<!-- rules-end -->If the markers don't exist yet in CLAUDE.md, append them (and the header from rules_template.md) now.
Rebuild the block from scratch using the Rules sections from this project's domain_*.md files only:
<!-- rules-start -->
## <domain_name>
- <rule>
- <rule>
<!-- repeat for each domain_*.md in this project that has rules -->
<!-- rules-end -->Only include domains that have at least one rule. Omit domains with no rules. Replace the entire block content — do not append.
If a rule was demoted this session, remove it from the block. If a rule was promoted, add it.
New domain file template:
---
name: <Domain> domain knowledge
description: Facts, hypotheses, and confirmed rules about <domain> in <project>
type: domain
domain: <domain_name>
---
## Facts
## Hypotheses
| Hypothesis | Confirmations | Last seen |
|---|---|---|
## Rules
_(none yet)_What NOT to store
- Information already in code comments or build instructions
- Things easily found by reading the current files
- Step-by-step how-to guides (those belong in instruction docs, not domain memory)
- Ephemeral task details from this session only
Example output
After a session fixing a Notion API pagination bug:
Domain: notion_api
New fact:has_morecan be true even whennext_cursoris null if the last page is exactly 100 items — always check both
Hypothesis confirmed (2→3): Filtering bylast_edited_timeis more reliable than filtering by a Done date field
No promotions — no hypothesis reached 5 confirmations
Then edit domain_notion_api.md accordingly.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

