/piflow:piflow-enhancefrom piflow
Improves existing pi-flow workflows via capture→route→edit→verify→approve→commit. Applies precedence rules (edit SKILLs not node bodies, generalize every change) and owns the autonomous SCORE→TRIAGE→FIX→GATE→LAND optimize loop for trace-driven node edits.
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.
The canonical improvement method is the
hermes-skill-systemskill (capture → route → edit → verify → human-approve → commit → record). Load it first for any by-hand edit; this skill COMPOSES it (it does NOT fork that method) and adds two piflow-specific things hermes doesn't know: the precedence rules below, and the AUTONOMOUS optimize loop (piflowctl optimize …) that turns a finished run's trace into staged, gate-proven node edits. (Paths are relative to the piflow repo root,~/Desktop/piflow.)
A workflow is a living system; a flaw, a recurring finding, or user feedback on a run is a trigger to evolve it. The piflow-specific precedence rules (the part hermes doesn't know):
references/ file > new skill.grep the old shape clean.<repo>/.agents/skill-system-criteria.md — the per-node, human-judged QUALITY bar (the criteria fixture).
Complement to the mechanical Output Contract: the contract checks the artifact exists; the criteria say
whether it is good. Never injected into a node prompt (that teaches-to-the-test and voids the clean-room
signal) — it is a JUDGING reference only.<repo>/.agents/skill-system-map.md (composition) + <repo>/.agents/skill-system-io-map.md (the
producer→consumer ledger) — keep these CURRENT; a stale map is the real failure mode.Portable, cross-product METHOD knowledge lives OUTSIDE this repo in the design library
(~/Desktop/best-designs-for-agentic-system): problem-indexed cards (Trigger → Practice → Evidence →
Applications). The library is ONE of four practice homes; a consult ROUTES the question to the home that
owns it and reads it fresh. Cards are OPTIMIZER-PLANE reference — NEVER inject a card into a worker
node's runtime prompt (same law as the criteria fixture and memory.md).
1 · CONSULT — BLOCKING, at the route step (both loops), before authoring any fix or fixture. FIND first:
cd ~/Desktop/best-designs-for-agentic-system/cards && node _generate.mjs --find "<symptom>" (--json =
ranked list). Then route by question kind to the home that OWNS the answer:
| Question kind | Home to consult |
|---|---|
| Which portable METHOD solves this problem class | the library cards (the FIND above) |
| Template/marker format · how to FILL a field · Output-Contract grammar | piflow-init "The laws" + reference/artifact-contract.md |
| How this CODE works · where to change it | .agents/okf/ slices via piflowctl understand <subsystem> (okf-slices) |
| Has THIS node failed this way before · what we learned HERE | per-node/template memory.md via memory-slices (Leg A) |
Author the fix per the matched card's Practice. A fix that CONTRADICTS a proven/adopted card must state | |
| the reason in the commit body OR fix the card first — never ship the contradiction silently. |
2 · GAP — a FIND miss (or no home owns the class) → dispatch a research agent BEFORE fixing, never invent
the method inline. Brief shape: problem statement (the symptom class) · what the trace shows (evidence +
node/run refs) · sources to sweep (arXiv/practitioner + the sibling cards it borders) · deliverable = ONE
card per cards/_TEMPLATE.md (Trigger · Practice · cited Evidence · Applications). The card lands first,
then the fix applies it.
3 · WRITE-BACK — after a VERIFIED land, the lesson goes to its ONE home, per layered-instruction-homes,
smallest durable edit: a portable method → new/extended card (append ONE dated Applications line — win OR
under-delivery — card(<key>): applied — <outcome>; an under-delivery flips status and queues the card as
the next fix target); a field-emission rule → the FILL hint / init law; a product-local lesson → the node's
memory.md.
Seam status: consult + write-back is THIS skill's by-hand contract now. Autonomous seam TO-BUILD at the CLI
only (core stays library-blind): matched card → fixer DefectScope beside the Leg-A recurrence + Leg-B
code-map (pointer + resolve-at-read, as enrichCodeMap, packages/cli/src/optimize-fix.ts), a
[[card:<key>]] backref in MEMORIZE blocks, and the Applications write-back at optimize --adopt.
When you're babysitting a run, the orchestrator + human ARE the verifier: judge every stage's artifact vs the GOLD sample + its criteria-fixture entry as it lands, fix at the canonical owner, rerun the suffix. Full procedure: piflow-init → "Companion Mode (dev-time)".
Companion Mode is the human improvement loop; this is its autonomous sibling — it reads a FINISHED run's
.pi trace + the product's recorded verify reports, scores every node, triages each failure into one of four
buckets, has a context-isolated fixer edit a CANDIDATE COPY, and lets a deterministic gate decide. It is the
hermes loop with the capture+route steps MECHANIZED and the edit step BOUNDED + MEASURED — same law (one
generalizing change, the human is the eye, the oracle is immutable), executed as a command instead of by hand.
This loop IS the production path. NEVER write a throwaway replay/fix/score script — every step below is a
piflowctl subcommand or a product binding module that the CLI dynamic-imports. Ad-hoc bash here re-improvises
a tested seam and bypasses the gate (the whole point of the loop), so it is forbidden. (And as everywhere in
piflow: use the global piflowctl bin, never node …/packages/cli/dist/cli.js.)
1 · SCORE + TRIAGE (read-only, lands nothing) — always run this first to see the worklist:
piflowctl optimize <rundir> [--json] # default: the rendered routing markdown (the auto HERMES-ROUTING.md)
# --json: the raw { run, scores, defects } worklist for a driver
2 · FIX → GATE → LAND (stages a manifest; lands NOTHING live):
piflowctl optimize --fix <rundir> --binding <module> \
[--node <substr>] # scope the worklist to ONE node (the live oracle is expensive — build+browser per
# candidate; a targeted first run is both the cost bound and the safety scope)
[--watch] [--watch-json] # stream the FIX→GATE→LAND events live (see the 9-event order below); --watch-json = JSONL
[--auto-adopt] # default OFF — see the OUTCOME-gated accept rule; without it, EVERY win only STAGES
[--staging-dir <d>] # where the manifest lands (default: <rundir>/optimize/staging/manifest.json)
[--edit-budget n] # max fixer ATTEMPTS this round (the "learning rate"/cost cap; default 4)
[--token-budget n] # cumulative token cap; the driver stops before the next attempt once reached
The model PROPOSES + SCORES; deterministic CODE decides, bounds, and lands. The control flow is straight-line:
prepareCandidate → candidateRef); the scorer reads the copy; the gate compares copy-vs-base. The live
file is touched ONLY by the separate adopt step (below), which backs it up first (<basename>.bak).≥1 edit applied AND candidate > base on a
val slice the fixer never saw — this strict bar (not the round count) is what stops self-edit DRIFT
(autonomous self-editing measured +0.0pp WITHOUT it). An unmeasurable/abstained score CANNOT auto-accept →
it routes to the human. FUNCTIONALITY carries a STRICTER gate: a code edit's higher blast radius means the
product's OWN build/tests/typecheck must ALSO pass, not just a score bump.manifest.json (per-record: node · bucket · decision · gate reason/delta/landPolicy). It lands nothing.
Physical adoption — backup-then-overwrite the live file from a candidate copy — is the explicit, reversible
follow-up the human runs after reading the manifest. "The loop never mutates the live file" is the invariant.--auto-adopt is default OFF, and even with it ON it only adopts edits the gate marks auto-adopt-eligible:
{ oracle, copyScope, fixer })The LIVE stages cannot live in @piflow/core (it is product-agnostic — see CLAUDE.md "Data & SDK boundaries"),
so each product ships ONE binding module that the CLI dynamic-imports (--binding <module>; a local path or a
package specifier). It MUST export three functions; the CLI validates them on load:
oracle — re-verify a candidate build → a raw verify report (game-omni: runMilestoneVerify2 + npm build + the browser). This is the held-out scorer.copyScope — copy the node's editable scope to a candidate dir (the minimal owns/readScope set + rebuild).fixer — the context-isolated claude -p that edits the candidate copy per defect bucket. Its model
comes from the deep tier of ~/.piflow/model-tiers.json (the strongest model authors the fix). It is
MEASURED, not trusted — the gate decides whether its edit lands; a no-op or non-improving edit is
discarded and never re-proposed.mineOpts — customize the default trace miner's node→milestone map / val·train split.)game-omni is the reference binding — packages/verify/optimize/ (in the game-omni repo, NOT in
@piflow/core): scope.mjs (copyScope), binding-live.mjs (live oracle+fixer), binding-dry.mjs (a
no-model dry binding for wiring tests). Read it before authoring a new product's binding; don't reinvent the shape.
piflowctl optimize --fix IS the production path; if you reach for node replay.mjs or a bespoke score/fix loop, STOP — extend
the binding instead.piflowctl optimize --fix <rundir> --binding <module> --watch.--watch streams, in order:
triaged → candidate-prepared → fixer-started → fixer-trace* → fixer-done → scored → gated → landed → stopped (fixer-trace* repeats per fixer step).sleep/tail -f/throwaway script anywhere; the live file was never edited (only a staged
manifest, adopted as a separate backed-up step); the oracle/criteria fixture was untouched.hermes-skill-system skill — the canonical capture→route→edit→verify→approve→commit loop + the
node-validation loop (references/node-validation-loop.md). This is the method; load it first.--watch
reuses; the run-monitoring rules (no sleep/tail polling) apply identically here.docs/design/ (this repo) — the design canon, when an improvement is an architectural change not a wave edit.piflowctl optimize [--fix]) — it mechanizes capture+route and bounds+measures the edit, staging a gate-proven manifest.
Both obey one law: ONE generalizing change, an IMMUTABLE oracle, and the human is the eye on what lands.What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
15 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/./memory-slicesPer-node MEMORY slices (Leg A — self/history) — FIND a node's standing lessons + cross-run RECURRENCE before the optimizer edits it, and MAINTAIN the memory.md set so it stays honest, bounded, and never rots. The Leg-A twin of `okf-slices` (Leg B — world/code): a memory lesson `[[links]]` the OKF code slice it concerns, so its freshness gate rides that slice's `--check`. TRIGGER on either intent: (FIND) the out-of-band triage/fixer needs "has this node failed THIS way before, how often, and what did we learn?" — the LAPSE-vs-SKILL signal — before bucketing or editing a node; or (MAINTAIN) someone runs the MEMORIZE step, asks when/how memory.md is updated, what a lesson's scope is, whether a lesson is stale, or WHERE a lesson should live (per-node vs system). Works on any repo with template-scoped `memory.md` (`.piflow/<wf>/template/{memory.md, nodes/<id>/memory.md}`; config in `.agents/okf/okf.config.json`). Memory is OPTIMIZER-FACING reference, NEVER injected into a worker node's runtime prompt — this skill is how the out-of-band optimizer reads and writes it.Generated from the plugin's indexed repository (blueif16/piflow) — no native marketplace selected
npx claudepluginhub p/blueif16-piflowOther plugins' skills for the same job