/piflow:memory-slicesfrom piflow
Reads and writes per-node memory lessons with recurrence counts and code cross-references. Triggers when the optimizer needs to check a node's failure history before editing, or when maintaining the memory.md set.
Ships in piflow. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
A memory slice is a node's small, capped set of standing lessons: what this node has gotten wrong, the ROOT
why, and the durable prevention — each lesson carrying a cross-run recurrence count and a [[okf-slice]]
cross-reference to the code it concerns. It is a distillation, never a run transcript or a changelog. The lessons
live in template-scoped memory.md — one per node (.piflow/<wf>/template/nodes/<id>/memory.md) plus one
system-level (.piflow/<wf>/template/memory.md); the design/rationale is
docs/research/memory/piflow-memory-v1.md §5a (the two legs) + piflow-memory-v1.5.md §6 (the MEMORIZE step in the
overlord loop) — cite it, don't restate it. This skill is the OPERATIONAL procedure for the two things you do with
memory.
The two legs, one pattern. okf-slices (Leg B) answers where the code is / how it works; memory-slices
(Leg A) answers what went wrong here, why, and how often. The optimizer uses BOTH: memory-slices tells triage
"this node has failed this way N times → SKILL, not LAPSE, and here's the lesson"; the lesson's [[okf-slice]]
link hands the fixer the code map. Substrate is shared with Leg B: git (the deep, unbounded session log —
skillsys/flowCommit commits) + the run traces (runs/<id>/, the raw material MEMORIZE distills) + codegraph
via the OKF cross-ref. This "the commit message IS the record" move is the 2026 git-native-memory pattern — Lore (arXiv 2603.15566) restructures commit messages via git-trailers into decision records (constraints / rejected-alternatives / directives / verification); GitOfThoughts (arXiv 2606.14470) records scores as git-notes and merges a memory branch, and its finding that recalled memory helps only when a new case is >0.8 similar to a past one is exactly why we key on same-signature RECURRENCE; Projectmem (arXiv 2606.12329) is a grep-able append-only event log whose "you tried this before — it failed" judgment layer IS our recurrence signal, built. Do NOT confuse this template-scoped optimizer memory with two neighbours: (a) the
run-scoped, forward-INJECTED MEMORY.<node>.md some products write for in-run coordination (opposite semantics —
never touch it here); (b) the memoryDir session hub (~/.claude/.../memory) that OKF slices already read for
their code lessons-cluster. This skill owns only the template memory.md.
Why this exists: without a bounded, cross-run record, every optimizer round re-discovers the same defect and can't tell a one-off slip from a real skill gap — so it either never edits (misses SKILL defects) or edits on a single slip (rots the corpus). Memory is only useful if (a) you can FIND the right lesson + its recurrence and (b) it is FRESH and SMALL. This skill is both halves.
Use when triage is about to bucket a defect, or a fixer is about to edit a node, and you need the node's standing
record instead of re-deriving it. This is the reader that fills the triage.ts SKILL-vs-LAPSE deferral.
Procedure (stop at the first step that resolves):
memory.md (.piflow/<wf>/template/nodes/<node>/memory.md) and match the symptom against
its lessons. RANK by where the match lands — a lesson whose Symptom/signature matches OWNS the query;
a bare prose mention is a WEAK match. If the defect's fix-surface is cross-node (a hand-off/contract), also
read the system memory.md.recurrence: counter, corroborated by the run trail (grep the signature across
runs/*/ reports/traces) and git (git log --grep=<signature> over skillsys/flowCommit commits). The
COUNT is the signal; the prose is the explanation. Grep accuracy depends on a DISCIPLINED, controlled-vocabulary
signature — CommitDistill (arXiv 2605.18284) shows an un-disciplined git mine needs a calibrated abstention
threshold to stay correct; prefer stamping the count as a git-note on the landing commit (GitOfThoughts) so it is
git-auditable and mergeable, not only in the memory.md frontmatter. If nothing matches → recurrence 0 (first occurrence).[[okf-slice]] is only current if that slice is. Run the OKF gate for the linked slice —
cd .agents/okf/topics && node _generate.mjs --check <okf-key> — and read the signal (see okf-slices MODE A
for HEALTH vs DRIFT). HEALTH: on the linked slice ⇒ the code the lesson describes MOVED: the lesson's
prevention may no longer apply → flag it code-shifted, don't hand it over as settled. ok/DRIFT ⇒ the
lesson's code anchor still holds.[[okf-slice]], and the freshness verdict. The count drives the bucket —
recurrence 0 → LAPSE (default-when-unsure, protect the corpus); recurrence ≥ threshold with a prevention the
node already had → SKILL (the prose was right, executor slipped again → routing/tier, not a prose edit);
recurrence ≥ threshold with NO prevention yet → SKILL (author the missing rule). A code-shifted lesson
routes toward FUNCTIONALITY/ARCH, not SKILL.Recurrence ≠ certainty. A count says the symptom repeated, NOT that the same ROOT caused it. Before you let a
high count force SKILL, confirm the roots match (same trace signature, same fix-surface) — two different bugs with
one symptom are two LAPSEs, not one SKILL. When the roots diverge, report ambiguous and default to LAPSE.
FIND output shape (what you return to triage/the fixer): { node, lesson? (symptom/root/prevention), recurrence: N, okfSlice?, freshness: fresh | code-shifted | none, suggestedBucket, confidence }. If no lesson, say so plainly
(recurrence 0) — never invent one.
FIND bar (must hold): you cited a REAL lesson (or honestly reported recurrence 0); the recurrence count was
COMPUTED from traces/git, not asserted; you confirmed roots match before calling recurrence a SKILL signal (else
ambiguous→LAPSE); you ran --check on the linked OKF slice and reported freshness; you returned the signal
triage needs (bucket + evidence), not the whole file; you did NOT present a stale/code-shifted or invented lesson
as settled.
Use when the optimizer's MEMORIZE step runs, after a fix lands, when the cap is hit, or when asked "is this stale / where should this lesson live." Memory has two surfaces, split by write-authority × freshness — keep them distinct:
skillsys(<node>)/flowCommit commit whose
message IS the record (Symptom → Root → Fix → Prevention). NEVER hand-keep a changelog file — that is the #1
memory-rot; git is the generated log. git is QUERIED (log/grep/blame), never loaded wholesale into context.The write authority + the update rule. Only the optimizer's MEMORIZE step (and a human) writes memory.md — disjoint from the node it describes. The rule is ACE incremental-delta, never full-rewrite:
recurrence: 1, a [[okf-slice]] link, and the distilled Symptom/Root/Prevention);recurrence, sharpen the prevention) when the same signature recurs;[[okf-slice]] went HEALTH
and the prevention no longer applies).
This append / update / retire shape is ExpeL's insight-pool operations (ADD / EDIT / UPVOTE / DOWNVOTE, arXiv
2308.10144) — our recurrence counter IS ExpeL's vote weight — and Mem0's ADD/UPDATE/DELETE with newer-wins (arXiv
2504.19413). Zep/Graphiti invalidates rather than deletes (arXiv 2501.13956), but git is already our invalidation
ledger, so memory.md can hard-remove a retired lesson without losing history.
Do NOT LLM-rewrite the whole file into a fresh summary — full-rewrite consolidation causes measured context
collapse (ACE, arXiv 2510.04618; A-MEM, arXiv 2502.12110, DOES let a new note evolve/rewrite existing linked notes,
but that optimizes retrieval recall for an unbounded, runtime-INJECTED store — the wrong move for our bounded,
optimizer-only, read-whole corpus; do not read it as license to rewrite lessons). When the cap is exceeded,
compaction is a SEPARATE, out-of-band pass that RETIRES discrete lowest-value entries (by age × non-recurrence ×
graduated-to-git), never a re-summarization. The ~40-line cap and the retire-metric weights are TUNABLE defaults,
not laws — the eviction surveys (Du et al. arXiv 2505.00675; the LLM-agent-memory surveys) settle the AXIS
(age × importance × recurrence), not the constant.Where a lesson lives (the assignment rule) — by the four-way triage bucket, i.e. by blast radius:
| Lesson's fix-surface (bucket) | Home |
|---|---|
LAPSE / SKILL / FUNCTIONALITY (edit is inside ONE node's envelope or owns/readScope) | that node's memory.md |
| ARCH / COORDINATION (a hand-off, a shared contract, a cross-node wiring) | the system memory.md |
| Mirror Leg B: the bucket that selects the fixer's edit-surface also selects which memory.md the lesson lands in. | |
| The node + system split is SOTA-endorsed — G-Memory (NeurIPS 2025), the Wu & Shu MAS-memory survey, SAMEP (arXiv | |
2507.10562). RESOLVED: the human-session memoryDir hub stays SEPARATE — the MAS-memory literature is unanimous | |
| that isolation-by-default + an access-controlled shared tier beats a merged pool, and merging a human-facing | |
| conversational hub into this optimizer-facing per-node store would break the invariants below. The ONE open grain | |
| item is an optional per-vertical MIDDLE tier (G-Memory's query/team tier) we currently fold into "system" — add it, | |
| tuple-namespaced à la LangMem, only if per-vertical lessons recur. |
Cadences:
[[okf-slice]],
and stamp the recurrence. This is the write; it is out-of-band, never an in-DAG node.okf --check; any lesson whose [[okf-slice]] is HEALTH-flagged → mark code-shifted for the next MEMORIZE to
re-validate or retire. The memory drift gate is not separate machinery — it RIDES the OKF gate through the link.To WRITE a lesson (the delta shape): a lesson block =
### <symptom signature> · recurrence: N · [[okf-slice-key]] · Root: one line · Prevention: the
durable rule (positive recipe for SKILL, prohibition+rationalization for a discipline lapse — match the form to the
failure type, see agentic-prompt-design §0b). Keep it pointer + semantics: link the slice, cite the trace
path:line, do NOT paste the code or the transcript.
--check before trusting it; a stale/code-shifted lesson is actively harmful.--check and report
freshness, and return the triage signal (bucket + evidence) not a dump?docs/research/memory/piflow-memory-v1.md §5a (two legs) · piflow-memory-v1.5.md §6
(the MEMORIZE step + the overlord loop) · §3 (the four-way triage the assignment rule mirrors)..claude/skills/okf-slices/SKILL.md; a lesson's
[[okf-slice-key]] is a key under .agents/okf/topics/.packages/core/src/optimize/triage.ts:14 (SKILL ← cross-run recurrence, DEFERRED).packages/core/src/memory/{skeleton,seed}.ts; piflowctl memory scaffold <template>.docs/research/memory/memory-substrate-sota-2026-06-30.md
(git-native substrate — Lore/GitOfThoughts/Projectmem/CommitDistill · the substrate comparison · the ExpeL/ACE/Mem0
update-rule + eviction SOTA · G-Memory/Wu-&-Shu MAS scoping). RESOLVED there: flat-markdown-on-git is the right
substrate (vector/graph/SQL is overkill for a bounded, read-whole, optimizer-written corpus; Mastra semantic-recall
targets an unbounded conversational corpus we do not have); the memoryDir hub stays separate. STILL OPEN (tunable,
not law): the ~40-line cap constant + retire-metric weights, and the optional per-vertical tier.piflowctl memory find|check
verb (a deriveRecurrence() alongside the generator's deriveLessons()), then add this skill to the
piflowctl skills install bundle.What SKILL.md sets; muted values are Claude Code's defaults
Generated from the plugin's indexed repository (blueif16/piflow) — no native marketplace selected
npx claudepluginhub p/blueif16-piflow15 skills in this plugin
/iso-hero-illustrationMethod for authoring the piflow hand-authored 2.5D ISOMETRIC hero SVGs (atom = one node, substrate = the DAG, protein = the self-improve loop, and any new metaphor) so every shape AND decoration is grounded in the canonical design doc and named — never decorative, never illogical. TRIGGER before creating or revising ANY iso hero illustration under site-piflow/components/iso/: the order is DOC → named component spec → CONFIRM with the user → draw. Use when asked to draw/fix the atom, substrate, protein, add a metaphor, or when a render "looks terrible / illogical / decorative". Pairs with piflow-web-design (brand) + premium-saas-stack (bar); the workspace + kit + research live in site-piflow/components/iso/_gen/./okf-slicesTHE DEFAULT pathway to understand this codebase — any setting, any logic, any lifecycle, at any level, INCLUDING how much of the codebase is mapped/covered in the first place. Load this FIRST whenever you (or a sub-agent) are about to explain, investigate, or answer any question about how a part of this system works — BEFORE reaching for `ls`/`grep`/`find`, or recalling a CLI invocation from memory instead of loading the skill. Running the right command without loading this skill first is still the ad-hoc re-derivation this skill exists to prevent. If a question feels like "a quick lookup I can just answer" rather than "understanding the system," that feeling is the cue to invoke this skill, not a reason to skip it. TRIGGER on any understanding intent, at any granularity: "understand <area>", "how does <subsystem> work", "where do I change X", "which files own Y", a question about the state/coverage/completeness of the codebase map itself, explaining a config/setting/flow, or an optimizer/fixer about to edit a subsystem; (MAINTAIN) when/how to update the map, blast scope, staleness, the drift gate; (SETUP) a repo has NO `.agents/okf/` yet (FIND errors "not set up") or a stale/older engine. Once loaded it contains every command (CLI and standalone) — no external crib needed. Works on ANY repo — SETUP (MODE S) seeds the substrate from the engine this skill carries under `assets/`, needing nothing but `node`. Slices are OPTIMIZER-FACING reference, NEVER injected into a worker node's runtime prompt — this skill is how the out-of-band fixer reads them on demand./piflow-enhancePi Flow · ENHANCE — improve an existing, running pi-flow workflow the disciplined way: turn a spotted flaw, a recurring finding, or human feedback into ONE atomic, generalizing change via capture→route→edit→verify→ approve→commit, never a one-off hack. Owns the criteria fixture (the per-node quality bar) and Companion-Mode judging. Use to "improve a wave/node", "fix a recurring failure in the pipeline", "the generated output is wrong — fix the system not the case", "edit the skill vs edit the chain", "score / triage / fix a finished run", "run the optimize loop", "auto-improve a node from its trace". Also owns the METHOD-LIBRARY sync (Leg C, ~/Desktop/best-designs-for-agentic-system): consult the matching card before any edit, write the outcome back to its Applications after any land. To CREATE a workflow use piflow-init; to RUN one use piflow-start. The canonical capture→route→edit method is the hermes-skill-system skill; this COMPOSES it and pins the piflow-specific precedence + the autonomous SCORE→TRIAGE→FIX→GATE→LAND loop./piflow-fixerPi Flow · FIXER — the default playbook staged into EVERY substrate fixer spawn, the human-facing fix protocol, and the orchestrator contract for a whole feedback cycle; it turns one assigned issue + an isolated candidate git worktree of its node into a staged, gate-proven repair. LOAD/FOLLOW when: you are the fixer agent handed a `nodes/<node>/issues/<name>.md` dispatch; you are the ONE agent running a full cycle over returned run feedback; or a human repairing one node's defect asks "how do I route this fix", "why did my guidance get ignored", "did the fix actually move anything". The spine is the issue lifecycle open→active→fix-landed→verifying (only `optimize adopt` lands it to `resolved`); per-stage depth lives in references/ (triage · demand-levers · verification · orchestrator · playbook-maintenance). This is the fixer's procedure — NOT the enhance/hermes triad (disabled on this path)./piflow-gatePi Flow · GATE — the base agent that judges whether ONE fixer's candidate edit actually fixed its issue, and decides its fate: STAGE it for a human to adopt, or REJECT it back to a fresh fixer. The third agent of the optimize loop and the last: triage NAMES the defect, the fixer SOLVES it, the GATE judges the fix — the issue file is the boundary object through all three, and the loop always runs them in that order. The CLI spawns this agent over the PROVED candidate via `piflowctl optimize verify --node <id>` (the standalone gate-only re-check — there is NO `optimize gate` verb), or INLINE during `piflowctl optimize fix --node <id>` on the full-tier soft path, equipped with this skill. LOAD / FOLLOW when: you ARE the gate/verify turn over a fixer's candidate; you must decide ACCEPT-and-stage vs REJECT-and-drop-back; you must audit a fix for reward-hacking / a band-aid / teaching-to-the-test; or a human asks "did the fix actually work", "is this a real fix or a hack", "why was the candidate rejected", "what does the retry get told", "who decides a fix is good". The gate JUDGES ONLY — it never fixes (that is piflow-fixer) and never adopts (that is the human's separate, explicit step). It is blind to the fixer's reasoning by construction. This is the JUDGMENT half — the independent verifier that keeps a self-editing loop honest./piflow-initPi Flow · INIT — create a structured workflow (a DAG of producer/verify nodes coordinating through the filesystem) and stand it up to run as a fleet of efficient pi agents (pi.dev / earendil-works/pi) driven by non-Claude coding-plan models, with Claude Code as the single console. The source of truth is a structured workflow TEMPLATE (`.piflow/<wf>/template/`); the `@piflow/core` SDK loads it into a WorkflowSpec and runs it one `pi` per node. INIT triages your starting point — PORT an existing Claude `.js`, IMPORT another engine's workflow (n8n/YAML/JSON), or COMPOSE fresh — then builds the template and the per-repo runner. Use to "create/author a pi-flow workflow", "stand up the runner in a repo", "port my Claude workflow to pi", "import an n8n workflow", "run my workflow on a non-Claude model", "pi-runner". To RUN/monitor an existing workflow use piflow-start; to IMPROVE one use piflow-enhance.Other plugins' skills for the same job