Anti-Patterns

Hidden State Coupling

Anti-pattern: agent workflows read or write undeclared shared state (caches, env vars, process globals) instead of explicit inputs and outputs.

Problem

When the shared state mutates in unexpected ways, dependent workflows experience silent retry storms, duplicated side effects, or behavior changes nobody can trace. Postmortems are slow because the coupling is invisible to readers of the agent code. Reproduction in test environments often fails because tests bypass the shared singleton.

Solution

Pass all inputs as arguments to the workflow function. Where shared state is genuinely needed (caches, feature flags), route it through a typed accessor with version stamping and structured logging. Treat the agent run as a pure-ish function of its declared inputs so replay produces the same result. Pair with stateless-reducer-agent and provenance-ledger to make every state read auditable.

When to use

  • Never. Cite when reviewing workflows that read undeclared globals.
  • Pass shared state explicitly through a versioned, observable accessor.
  • Stamp every cache read with the cache version in the agent log.

Open the full interactive page

Diagram, neighbourhood map, code examples, related patterns and full provenance.

Related