From knowledge-distillery
Commits changes with an auto-generated message and attaches a structured session summary as a git note for the Knowledge Distillery evidence pipeline. Replaces the default commit workflow in knowledge-distillery-enabled projects. Use whenever the user says 'commit', 'save changes', 'git commit', or invokes any commit action — this ensures every commit carries session context for downstream knowledge extraction.
npx claudepluginhub ether-moon/knowledge-distillery --plugin knowledge-distilleryThis skill uses the workspace's default tool permissions.
Commit workflow that creates a normal git commit AND attaches a memento session summary as a git note on `refs/notes/commits`. The downstream pipeline (mark-evidence, collect-evidence, extract-candidates) reads these notes as evidence for knowledge distillation.
Searches, retrieves, and installs Agent Skills from prompts.chat registry using MCP tools like search_skills and get_skill. Activates for finding skills, browsing catalogs, or extending Claude.
Checks Next.js compilation errors using a running Turbopack dev server after code edits. Fixes actionable issues before reporting complete. Replaces `next build`.
Guides code writing, review, and refactoring with Karpathy-inspired rules to avoid overcomplication, ensure simplicity, surgical changes, and verifiable success criteria.
Share bugs, ideas, or general feedback.
Commit workflow that creates a normal git commit AND attaches a memento session summary as a git note on refs/notes/commits. The downstream pipeline (mark-evidence, collect-evidence, extract-candidates) reads these notes as evidence for knowledge distillation.
Replaces the default commit workflow when the knowledge-distillery plugin is installed.
Bash (git commands + rm -f tmp/vault-refs.jsonl cleanup), Read (for reading tmp/vault-refs.jsonl). No other file writes, no MCP servers, no vault access.
git status --porcelain; echo "---LOG---"; git log --oneline -10; echo "---DIFF---"; git diff HEAD --stat; echo "---BRANCH---"; git branch --show-current
Parse into 5 sections:
M, D, M , D , etc.): always include??): include UNLESS they match sensitive patterns (.env*, credentials*, *.key, *.pem, *.secret, settings.local.json)Also gather session metadata for memento sections 6-7:
tmp/vault-refs.jsonl (if it exists) to identify vault entries used this session. Parse entry_id from each line — these are the entries for which usage signals must be assessed in Step 3.decision: prefix commits on the current branch from this sessionExit if: Status is empty. Report "Nothing to commit." and stop.
feature/PROJ-123-add-auth -> PROJ-123).Reflect on the current session — what was discussed, decided, and encountered — NOT just the diff. The diff is the "what changed"; the memento is the "why and how it was decided."
Generate a 7-section summary following the format and rules in Memento Summary Format below. For sections 6-7:
decision: prefix commits found in Step 1 by slug and SHA. If none, use "None".tmp/vault-refs.jsonl entries from Step 1 combined with your assessment of how each entry was used (followed/outdated/conflicted/insufficient). If none, use "None".For trivial changes (typo fixes, formatting, single-line changes with no technical decisions): produce a minimal summary with "None" in all sections except Context.
Combine staging, commit, and note attachment in a single Bash call. This ensures the PostToolUse hook sees the note already attached when it fires.
Staging rules — never use git add -A or git add .:
git add -u is acceptable as shorthandgit add -u.env*, credentials*, *.key, *.pem, *.secret, settings.local.jsonIMPORTANT — No shell expansion: Avoid $(...), backticks, ${...}, $VAR, $$, and $RANDOM in this Bash call. Claude Code may still require approval when it detects shell expansion, so feed the commit message and memento directly through heredocs and -F - instead.
set -e
git add <file1> <file2> ...
git commit -F - <<'COMMIT_EOF'
<generated message>
COMMIT_EOF
git notes --ref=refs/notes/commits add --force -F - HEAD <<'MEMENTO_EOF'
<generated summary>
MEMENTO_EOF
git log --format='%h %s' -1
After the commit+note command succeeds, push the notes ref so that the downstream pipeline (mark-evidence in CI) can access them:
git push origin refs/notes/commits && echo "Notes push: synced to origin" || echo "Notes push: FAILED"
After the notes push, clear the vault-refs tmp file (best-effort, unconditional):
rm -f tmp/vault-refs.jsonl 2>/dev/null || true
git add <files>: Stage only the files identified in the staging plan. Use git add -u when only tracked files changed.set -e: Fails fast if staging, commit, or note attachment fails inside the multi-step Bash call.git commit -F - <<'COMMIT_EOF': Reads the commit message from stdin without temp files or shell expansion.git notes --ref=refs/notes/commits add --force -F - HEAD <<'MEMENTO_EOF': Attaches the memento from stdin to the commit that was just created.HEAD: References the just-created commit without capturing SHA into a variable.--force: Ensures idempotency if rerun on the same SHA.refs/notes/commits: Matches the ref that mark-evidence and collect-evidence expect.git push origin refs/notes/commits: Pushes notes to remote. Without this, notes exist only locally and the CI pipeline (mark-evidence) cannot detect them. This is a separate Bash call because a push failure should not affect the commit result.If git commit fails (hooks, conflicts, empty), the chain stops — no note is attempted. If git notes add fails, the commit is preserved — report the note failure separately. If git push of notes fails, the commit and local note are preserved — report the push failure separately.
Committed: <sha> <first line of message>
Memento: attached to refs/notes/commits
Notes push: synced to origin
If note attachment failed:
Committed: <sha> <first line of message>
Memento: FAILED — <reason>. Commit succeeded without session note.
If notes push failed:
Committed: <sha> <first line of message>
Memento: attached to refs/notes/commits
Notes push: FAILED. Run `git push origin refs/notes/commits` manually before merging.
The summary MUST follow this exact 7-section markdown structure. All seven sections are required. Use "None" as a single item for any empty section.
## Decisions Made
- [Decision]: [Rationale]
## Problems Encountered
- [Problem]: [How it was resolved or current status]
## Constraints Identified
- [Constraint]: [Why it matters]
## Open Questions
- [Question]: [Context]
## Context
[2-4 sentence paragraph: what was being done, key files, outcome]
## Recorded Decisions
[If record-decision commits were made this session, list slug and SHA. Otherwise "None"]
- `slug` (sha1234): Brief description
## Vault Entries Referenced
[If vault entries were used this session, list each with a signal. Otherwise "None"]
- `entry-id` [signal]: How the entry related to this session's work
Decisions Made — Confirmed choices only:
Problems Encountered — Issues actively worked on:
Constraints Identified — Limitations and boundaries discovered:
Open Questions — Unresolved items:
Context — 2-4 sentence paragraph:
Recorded Decisions — Decision commits from this session:
decision: prefix commits by slug and SHA from git logVault Entries Referenced — Vault entries that influenced this session:
tmp/vault-refs.jsonl + your assessment of usage signalfollowed (applied), outdated (stale), conflicted (contradicted), insufficient (incomplete)For the complete extraction specification with examples, see /knowledge-distillery:memento-summary.
| Failure | Behavior |
|---|---|
| Nothing to commit (clean working tree) | Report "Nothing to commit." Stop. |
git commit fails (hooks, conflicts, empty) | Report error. Do not proceed to note attachment. |
git notes add fails | Report error. Confirm the commit succeeded. |
git push origin refs/notes/commits fails | Report error. Confirm commit and note succeeded. Instruct user to push notes manually. |
| Session context too minimal to summarize | Produce minimal summary (all "None" + one-sentence Context). |
git notes directlyrefs/notes/commits as the notes ref (pipeline compatibility)