AGENT SKILL

write-memory

Executes a vault write handed off by another skill (recall, learn): composes the engram command from the provided fields, runs it, verifies the result, and reports the written note path. Requires a handoff — do not fire on your own judgment that something is worth remembering.

License 许可
Apache-2.0
所属仓库
toejough/engram
最近更新
2026-10-25
Stars
★ 10
Forks
2

01 前言 Front Matter

name
write-memory
description
Executes a vault write handed off by another skill (recall, learn): composes the engram command from the provided fields, runs it, verifies the result, and reports the written note path. Requires a handoff — do not fire on your own judgment that something is worth remembering.

02 资源文件 6

03 SKILL.md 正文

Write Memory — execute a handed-off vault write

You were invoked by a parent skill that already made the judgment (what to write and why). Your job is the write itself: compose, execute, verify, report. Do not re-litigate the parent's judgment; do not decide WHETHER to write.

The handoff contract

The parent provides:

  • kind — fact, feedback, qa, or runbook
  • content fields — by kind, per the blocks below
  • source — human-readable provenance string
  • optional chunk-sources — <source#anchor> chunk IDs (provenance)
  • optional tags — categorical <family> or <family>/<value> strings (kebab-case; fact/feedback/runbook only), e.g. work-kind/rename, tier/cheap, outcome/pass
  • optional supersedes — <basename>|<type>|<claim> (types: updates|narrows|refutes), when the parent determined this write corrects a surfaced note
  • optional position / target — Luhmann placement (top (default), continuation, or sibling) plus the target note ID (required when position is not top), when the parent made a disposition decision. Omitted → --position top (today's default), fact/feedback/runbook only.
  • optional red_flags — task-specific failure modes a general "follow the steps" rule would not catch (runbook only), e.g. "filter-branch on all refs sweeps the backup branch"
  • optional triggers — literal cues in a user's message that should surface this runbook first (runbook only), e.g. /please, "take this end-to-end"

If a required field is missing, ask for it from the in-session parent context — do not invent content on the parent's behalf.

Compose

kind=feedback:

engram learn feedback --slug <kebab-slug> --position <top|continuation|sibling> [--target <id>] \
  --source "<source>" \
  --situation "<retrieval-shaped phrase: when does this apply>" \
  --behavior "<what was done>" --impact "<why it was wrong/costly>" --action "<what to do instead>" \
  [--tag <family>/<value> ...]

kind=fact:

engram learn fact --slug <kebab-slug> --position <top|continuation|sibling> [--target <id>] \
  --source "<source>" \
  --situation "<retrieval-shaped phrase: when does this apply>" \
  --subject "<the thing>" --predicate "<requires / must use / is>" --object "<the standard or value>" \
  [--tag <family>/<value> ...]

--position defaults to top and --target is omitted whenever the parent's handoff doesn't include a position/target (today's behavior, unchanged). Include --target <id> only when position is continuation or sibling; never emit --target alongside --position top.

kind=runbook:

engram learn runbook --slug <kebab-slug> --position <top|continuation|sibling> [--target <id>] \
  --source "<source>" \
  --situation "<retrieval-shaped phrase: when should this runbook be used>" \
  --done-when "<what should be true when the procedure is complete>" \
  --body "<numbered steps, may [[wikilink]] fact/feedback notes to consider>" \
  [--red-flag "<task-specific failure mode>" ...] \
  [--trigger "<literal cue>" ...] \
  [--tag <family>/<value> ...]

Same --position/--target disposition rules as fact/feedback above. One --red-flag per handed-off red_flags entry, in order; omit entirely when the parent's handoff carries no red_flags (no error, no empty flag).

One --trigger per handed-off triggers entry, in order, placed after any --red-flag; omit entirely when the handoff carries none. A trigger is a cue word or phrase the user (or an engram notice) would literally write: a slash form (/please), a multi-word phrase ("take this end-to-end"), or a single distinctive word (curate), at least 3 characters. Matching is case-insensitive, whitespace-collapsed, and whole-word at letter/digit edges, so curate hits "curate" and "/curate" but not "accurate". A single word must be distinctive enough that whole-word matching will not fire on ordinary prose (curate qualifies; "fix", "run", "the" do not). A handed-off single word that is common in ordinary prose → ask the parent for a distinctive cue instead of passing it through, unless the handoff states that over-firing is a deliberate, accepted choice (e.g. "please" on the please runbook, 2026-09-20); then pass it through. Over-firing is tolerable because a trigger hit only makes the runbook a candidate; the agent still judges it against the runbook's own situation, so triggers never replace a well-written --situation.

kind=qa:

engram learn qa \
  --slug "<kebab summary of the question>" \
  --question "<verbatim question>" \
  --answer "<the answer body, copied — no re-derive>" \
  --contributors "<full-basename>" \
  --certainty "<high|medium|low>" \
  --source "<source>"

Append to any kind:

  • one --chunk-source <source#anchor> per provided chunk ID
  • one --tag <t> per provided tag (fact/feedback/runbook only — engram learn qa and engram amend take no --tag; a qa handoff carrying tags → drop them and say so: append the exact line tags dropped: qa takes no tag flags to whatever you output, even command-only output)
  • --supersedes "<basename>|<type>|<claim>" if provided (repeatable)
  • for qa: one --contributors <full-basename> per basename the parent provided

Rules:

  • Never mix fact flags (--subject/--predicate/--object), feedback flags (--behavior/--impact/--action), or runbook flags (--done-when/--body/--red-flag/--trigger) in one command.
  • Never hand-author a vocab/<term> tag or a Supersedes: backlink — the binary assigns vocab terms automatically as vocab/<term> entries in the tags: list, and writes the Supersedes: body line itself when --supersedes is passed. This does NOT restrict inline [[basename]] prose citations: hand-type one directly in --body or --object whenever the parent's handoff content calls for citing a fact/feedback note — ordinary authoring, no CLI mechanism does it for you. Handed-off --tag categoricals ride the same tags: list as vocab but are NOT vocab: pass them through exactly as provided; never invent tags and never write the vocab/ namespace yourself.

Execute, verify, report

Run the command. On success the CLI prints the written note path(s).

  • CLI error → read it, fix exactly the named problem (missing/typo'd flag, bad value), retry. Max 2 retries.
  • Success → report the printed note path(s) to the parent flow in one line.
  • Still failing after retries → report the exact command and the CLI error verbatim. Never silently skip a handed-off write.

04 同仓库更多 Skills

toejough
toejough/engram

recall

Use after any user request that might entail more than a single tool call or anything more than quick, shallow thinking. This surfaces relevant memories that are VITAL to recall for a good user experience and a greater chance at first-pass success for the user's request.

★ 10
toejough
toejough/engram

recall

Use after any user request that might entail more than a single tool call or anything more than quick, shallow thinking. This surfaces relevant memories that are VITAL to recall for a good user experience and a greater chance at first-pass success for the user's request.

★ 10
toejough
toejough/engram

recall

Use after any user request that might entail more than a single tool call or anything more than quick, shallow thinking. This surfaces relevant memories that are VITAL to recall for a good user experience and a greater chance at first-pass success for the user's request.

★ 10
toejough
toejough/engram

learn

Use after work begun with recall, or any work requiring more than one tool call or non-trivial thought. Use immediately for explicit save requests ("remember this", "save that", "note for next time"), and the moment a review, failing check, or user correction confirms a lesson; capture it before applying the fix. Also use at session end when a presented conclusion, design, or finding was later overturned or corrected. Use when a specific approach is confirmed: the user praises a reusable behavior, or an uncertain choice succeeds with observable evidence. This preserves lessons for future recall.

★ 10
toejough
toejough/engram

test-driven-development

Use when implementing any feature or bugfix, before writing implementation code

测试与质量
★ 10
toejough
toejough/engram

route

Use when you are about to dispatch a subagent and must decide its agent type, model, and effort level. Triggers on any delegation decision, and when you recognize a unit is too large for one focused agent and needs decomposition before dispatch.

★ 10