pi-taskflow 0.0.28
Granular-reuse release. v0.0.27 proved the incremental-recompute cost win — v0.0.28 makes it far larger and trivial to opt into. Invalidation drops from whole-flow to per-phase and per-item, and a single flag flips an entire flow into cross-run reuse.
⚡ Smarter invalidation
- Per-phase fingerprint (
v3:phasefp) — edit one phase, only it and its dependents re-run. An independent sibling keeps its cache hit. - Per-item
mapcaching — change 1 of N items, only that item re-executes. The other N−1 are served for $0.
🎛️ One-flag opt-in
incrementalflag (flow-level andrunarg) — defaults every phase to cross-run reuse, no per-phase annotation needed. Per-phasecacheand blocked types (gate/approval/loop/tournament) still win; default stays the saferun-only.
🔍 See what got reused
- Reuse reporting — the end-of-run report and
/tf recomputenow show reused-vs-executed counts plus a per-phase Why trace:▲ rerun · ✂ cutoff · ✓ reused · ✗ failed, with← causedBy.
Implementation details & soundness
v3:phasefphashes the phase plus its transitivedependsOn ∪ fromclosure, replacing the whole-flowv2:flowdefhash.cacheKeysemits a 4-tier read ladder (v3:phasefpwrite →v2:flowdef→ bare flowdef → legacy, all read-only) so the upgrade is additive — no miss-storm for unchanged flows. Fail-open: any per-phase error degrades that phase to the whole-flow hash. Falls back to whole-flow when per-phase invalidation can't be statically guaranteed (flow-widecontextSharing, anyshareContextphase in the closure,join: "any", or sub-flow inner phases). —extensions/flowir/phasefp.ts- Per-item keys omit the structural fingerprint (which hashes the whole
oversource) so changing one item no longer moves every key; they fold[phase.id, it.agent, model, it.task]+ the world-state tail. Disabled (whole-map only) underrun-only/offscope,shareContext/ flow-widecontextSharing, or inside a runtime-generated sub-flow. phaseFingerprintnow stripscache,retry,concurrency,final— none changes a phase's output, so a no-op config tweak no longer falsely invalidates.- Reuse reporting reports a dollar figure only for within-run reuse (where prior usage is preserved); cross-run hits are counted without an invented saving. —
summarizeReuse/RecomputeDecisioninextensions/runtime.ts
Tests: 804 → 846 (+42) across 46 files — new cache-phasefp, cache-peritem, incremental-flag, reuse-summary suites. Typecheck clean.
Upgrade: drop-in. The 4-tier cache ladder reads old entries; nothing to migrate.