fable-agent/PHASES/phase-05-state-accumulator.md

816 B

Phase 5: State Accumulator

Purpose: Append-only event log that tracks every iteration of every loop. TS Module: src/tier2-primitives/loops/state-accumulator.ts

What It Does

  • Records every iteration with full phase output and metrics
  • Aggregates roll-ups: avg duration, quality, success rate, improvement delta
  • Tracks trends: improving, stable, or degrading across iterations
  • Produces point-in-time snapshots

Data Shape

Each iteration records: number, phase, plan, executed, observation, reflection, refinement, metrics (durationMs, successRate, qualityScore, improvementDelta), timestamp.

Key Rules

  • The accumulator is the loop's memory — without it, dreaming has no data
  • Take a snapshot before dreaming (pins the state at dream time)
  • Load from store when resuming a session