Memory and State Management

Memory and State Management

Procedural Memory — Stack

Procedural memory › Stack

29 of 69 in this book · 2 min read

Technology landscape as of 2026-10-10. Knowledge cutoff May 2026.

Selection criteria

You are choosing how re-usable know-how is represented, how safely it can be replayed, and how quickly a bad one can be taken out of circulation.

  • Replay safety. Whether the representation can be executed without a human reading it first, and what the containment is when it does the wrong thing.
  • Parameterisation. Whether the mechanism separates the shape of a routine from the values it was captured with, since a routine that carries last week's record identifiers is a hazard.
  • Versioning and rollback. Whether a routine has a version that can be pinned, compared, and withdrawn, or whether editing it changes behaviour everywhere immediately.
  • Outcome attribution. Whether the system can tell which routine was used on a run, which is the precondition for ever demoting one.
  • Environment binding. Whether a routine can be tied to the deployment, tenant, or version it was learned against, and refuses to run elsewhere.
  • Review surface. Whether a human can read, diff, and approve a routine before it becomes something the agent will apply unsupervised.
  • Invalidation latency. How long it takes for a withdrawal to take effect across every agent that may have cached it.

Options

Option Best for Watch out for
Prose playbooks retrieved into the prompt Open-ended tasks where the environment changes faster than any script could Advisory only; the model may ignore or misapply it, and there is no way to tell which happened
Versioned code or scripts in a repository, retrieved by task match (generated functions, Voyager-style skill libraries) Deterministic, repeatable operations against a stable interface Generated code is an execution surface; sandboxing, review, and dependency drift all become your problem
Parameterised call sequences in a declarative format (a JSON or YAML step list the runtime executes) Routines over a known tool set where replay must be auditable Expressiveness runs out quickly; conditionals and error handling push it towards being a programming language
Workflow definitions in an orchestration engine (Temporal, Airflow, Step Functions, n8n) Routines that are long-running, need retries, and must survive process restarts Heavyweight for small lessons; authoring is a deploy, which defeats the point of learning one at runtime
Few-shot exemplars of successful trajectories retrieved by similarity Improving model behaviour without committing to executable artefacts Exemplars teach style as much as substance; a bad one is hard to attribute and harder to withdraw
Agent-framework skill or tool registries that accept runtime registration Agents that genuinely compose new capabilities while running Runtime registration means the tool surface differs between replicas; naming collisions and stale registrations are common
Managed prompt and routine registries with versioning (prompt-management platforms, feature-flag systems used for the same purpose) Teams that need review, staged rollout, and instant withdrawal of a routine Another control plane in the hot path; a withdrawal is only as fast as its propagation and cache settings