learning-distill
Skill7 starsChanged 2 months agoMITView on GitHub
Read a completed temporary session bundle from `.agents/sessions/` and distill durable repo knowledge - descriptive lessons become curated OpenWiki pages, prescriptive agent-behavior lessons stay in `.agents/`. Use only after task-closeout has produced a bundle and when the goal is to separate stable guidance from temporary task notes.
- Reads credentials
In this repository8 other files it gives its agents.
- .agents/AGENTS.mdAGENTS.md
- AGENTS.mdAGENTS.md
- CLAUDE.mdCLAUDE.md
- aksk-bootstrapSkill
- aksk-initSkill
- docs-lintSkill
- task-closeoutSkill
- verify-installSkill
The file
Show its rules and text
We split this skill into the rules it gives an agent
18 rules. About 0 are common, 7 are distinctive, and 11 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈7
Distinctive · estimate
This author's own choices. Worth a look.
11
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 19
Before writing any wiki output, verify all of the following.
- Very specific: line 34
Read the canonical task/session identifier from the task_id field in the bundle's summary.json.
- Very specific: line 38
Run once per target repo after this skill folder is present under .agents/skills/learning-distill/.
- Very specific: line 42
Ensure .agents/playbooks/ exists.
- Very specific: line 44
If .agents/AGENTS.md is missing, copy bootstrap/AGENTS.md into place.
- Very specific: line 45
Ensure .agents/.gitignore contains exactly these two lines (merge if absent, do not remove unrelated rules):
- Distinctive: line 50
Run the aksk-bootstrap peer-tool check and wiki-contract attachment (see Prerequisites) so the wiki side of distillation is ready.
- Very specific: line 68
Do not copy task history into .agents/AGENTS.md.
- Very specific: line 72
No duplication with OpenSpec: if a candidate decision restates or overlaps a requirement that already exists in openspec/specs/, do not …
- Very specific: line 74
Use .agents/playbooks/ for durable multi-step procedures.
- Very specific: line 87
Search related existing knowledge with grep over openwiki/ (page bodies are plain Markdown) before comparing manually.
- Distinctive: line 102
Write the page under the correct curated tree following that guidance and the OKF frontmatter rules above, then validate it:
- Distinctive: line 126
Do not modify source code outside the knowledge layer.
- Distinctive: line 127
Do not invent new repo rules unsupported by task evidence.
- Very specific: line 128
Do not expand .agents/AGENTS.md with rationale or narrative.
- Distinctive: line 129
Do not copy secrets, private identifiers, personal data, or long raw output into durable docs or wiki pages.
- Very specific: line 130
Never edit OpenWiki-owned files: index.md files, run metadata (.last-update.json), or anything outside the curated trees except through …
- Distinctive: line 131
Prefer small edits over large rewrites.
≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Learning Distill
Goal
Convert raw task evidence into concise, durable repo knowledge, routed by kind:
- Descriptive (facts, rationale, architecture, troubleshooting patterns, repo decisions) -> OKF pages under the curated wiki trees
openwiki/{decisions,troubleshooting}/andopenwiki/. - Prescriptive (agent behavior rules, procedures) ->
.agents/AGENTS.mdor.agents/playbooks/.
Distillation never invokes openwiki --update; it authors pages directly and refreshes indexes deterministically.
Prerequisites (fail closed)
Before writing any wiki output, verify all of the following; on failure stop without writing and print the remediation:
openspec/openwikibinaries on PATH:node .agents/skills/aksk-bootstrap/scripts/check_peer_tools.mjs openspec openwikiopenwiki/INSTRUCTIONS.mdexists AND carries the AKSK contract markers (AKSK:WIKI-CONTRACT). If missing or stub-only, run the attachment:node .agents/skills/aksk-bootstrap/scripts/attach_wiki_contract.mjs
Inputs
- session bundle directory under
.agents/sessions/ .agents/AGENTS.md,.agents/playbooks/openwiki/INSTRUCTIONS.md(curation contract: curated trees and rules)- existing curated pages under
openwiki/
Read the canonical task/session identifier from the task_id field in the bundle's summary.json. Do not infer identity from the session folder name.
Skill initialization (before first distillation)
Run once per target repo after this skill folder is present under .agents/skills/learning-distill/. Idempotent.
- Resolve the repo root (the directory containing
.git/). - Ensure
.agents/exists. - Ensure
.agents/playbooks/exists. If.agents/playbooks/README.mdis missing, copybootstrap/playbooks/README.mdinto place. - Ensure
.agents/sessions/exists. If.agents/sessions/README.mdis missing, copybootstrap/sessions/README.mdinto place. - If
.agents/AGENTS.mdis missing, copybootstrap/AGENTS.mdinto place. Never overwrite an existing one. - Ensure
.agents/.gitignorecontains exactly these two lines (merge if absent, do not remove unrelated rules):sessions/* !sessions/README.md - Run the aksk-bootstrap peer-tool check and wiki-contract attachment (see Prerequisites) so the wiki side of distillation is ready.
The kit's durable knowledge base lives in the wiki; this skill no longer seeds any .agents/docs/ scaffold.
Classification categories
Classify each candidate lesson as one of:
- ephemeral
- AGENTS guidance
- playbook
- decision record (curated wiki page)
- troubleshooting record (curated wiki page)
- descriptive lesson (any other curated wiki page)
Distillation rules
- Preserve only stable, reusable knowledge. Reject low-confidence or one-off lessons.
- Do not copy task history into
.agents/AGENTS.md. - Decision records ->
openwiki/decisions/<slug>.md; troubleshooting records ->openwiki/troubleshooting/<slug>.md; other descriptive lessons -> a topical page underopenwiki/. The filename stem is the entry identity; keep it unique within its tree. - Wiki page frontmatter follows OpenWiki OKF (
type,title,description,tags,timestamp) plus AKSK extensions:aksk_status(accepted,superseded, orprovisional) on decision pages; optionalaksk_superseded_by; optionalaksk_depends_onlisting qualified slugs (decisions/<slug>,troubleshooting/<slug>). - Cross-references between knowledge pages use relative Markdown links; superseded pages point at their successor via
aksk_superseded_byplus a link. - No duplication with OpenSpec: if a candidate decision restates or overlaps a requirement that already exists in
openspec/specs/, do not create or extend a wiki page for it; cite the spec capability instead. Wiki pages record facts and rationale; requirements live only in OpenSpec. - Curated-page preservation: treat trees marked curated in
INSTRUCTIONS.mdas preserve-and-link targets - update AKSK-authored content in place; link generated material to it rather than overwriting it; never dropaksk_*frontmatter fields. - Use
.agents/playbooks/for durable multi-step procedures; add to.agents/AGENTS.mdonly if the lesson is broad, stable, concise, and actionable.
Finding session bundles (gitignore)
Per-task folders under .agents/sessions/ are gitignored (only README.md is tracked). Many search tools skip ignored paths by default.
Do not conclude there are no bundles based on an ignore-aware search alone. Locate bundles with at least one ignore-blind method: filesystem listing (ls, find) or ripgrep with --no-ignore-vcs.
Then read each candidate's summary.json: treat task_id as canonical and filter using distillation state fields (distilled, status, distillation_status). Do not select a bundle from its folder name.
Procedure
- Locate and read the session bundle (see above); read
summary.jsonfortask_id. - Search related existing knowledge with grep over
openwiki/(page bodies are plain Markdown) before comparing manually. For decision- or requirement-shaped candidates, also searchopenspec/specs/- a rule already codified as a SHALL requirement there must not be duplicated as a wiki page. - Compare candidates against existing knowledge; remove duplication.
- Classify each lesson.
For wiki-bound lessons: load authoring guidance at runtime from the installed package, then author the page directly. With
NPM_ROOT="$(npm root -g)":Load upstream authoring guidance (use
initfor new pages,updatefor edits):NPM_ROOT="$(npm root -g)" node --input-type=module -e ' import { pathToFileURL } from "node:url"; import path from "node:path"; const m = await import(pathToFileURL(path.join(process.env.NPM_ROOT, "openwiki/dist/agent/prompt.js")).href); console.log(m.createSystemPrompt(process.argv[1] ?? "init")); ' initWrite the page under the correct curated tree following that guidance and the OKF frontmatter rules above, then validate it:
NPM_ROOT="$(npm root -g)" node --input-type=module -e ' import { readFileSync } from "node:fs"; import { pathToFileURL } from "node:url"; import path from "node:path"; const fm = await import(pathToFileURL(path.join(process.env.NPM_ROOT, "openwiki/dist/okf/frontmatter.js")).href); const file = process.argv[1]; console.log(JSON.stringify(fm.validateOkfFrontmatter(readFileSync(file, "utf8"), file))); ' openwiki/<path>.mdFix every reported issue before continuing.
- Draft minimal updates to
.agents/AGENTS.mdor playbooks for prescriptive lessons. - Refresh wiki indexes deterministically (never via the CLI):
node .agents/skills/aksk-bootstrap/scripts/sync_wiki_indexes.mjs - Mark the session bundle as distilled (its
summary.jsonflags).
There is no activity log to append; accountability lives in the bundle flags and git history.
Constraints
- Do not modify source code outside the knowledge layer.
- Do not invent new repo rules unsupported by task evidence.
- Do not expand
.agents/AGENTS.mdwith rationale or narrative. - Do not copy secrets, private identifiers, personal data, or long raw output into durable docs or wiki pages.
- Never edit OpenWiki-owned files:
index.mdfiles, run metadata (.last-update.json), or anything outside the curated trees except through deterministic index sync. - Prefer small edits over large rewrites.
AGENTS criteria
A lesson belongs in .agents/AGENTS.md only if it is high confidence, broadly useful in this repo, likely to recur, concise, and actionable.
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.

