Skip to main content
ELI5: you declare policy about state (context budget, stage outputs); Cadence threads the plumbing (provider session ids, response chaining, handoffs) so you never manage raw provider state.

Who does what

AspectYou (workflow author)Cadence/harness
Provider session/response chaining (e.g. previous_response_id)Nothing — never put these in workflow.mdThreaded automatically per run; handoffs link runs via the event chain
Context carried into a runcontext block (budgeted brief)Compiles and injects it
Stage-to-stage outputsstate_machine with per-stage output_schemaValidates and passes typed outputs between stages
Long-term knowledgeWrite to Think (store/canvas/workpad tools)Persists in your Think vault, queryable later
Run history/auditNothingSession ledger — an append-only projection of every harness event (tokens, costs, tool calls, resumes)

The session ledger (read-only truth)

Every run emits typed events; the ledger chains them (event_idparent_event_id), records usage/cost per event, and links runs across handoffs. It is a projection, never a store: nothing reads it to make dispatch decisions, so you can rebuild it from the event stream at any time. Use it for audit (“what did this run cost, which tools fired”), not for state.

Carrying context into a run

context:
  brief: |
    Repo uses Cadence workflows; tests live in tests/.
  budget_tokens: 4000

Passing typed state between stages

state_machine:
  start: research
  stage_order: [research, implement]
  states:
    research:
      output_schema:
        type: object
        properties:
          findings: { type: array, items: { type: string } }
        required: [findings]
  on_event:
    research_completed: implement
  terminal_states: [done]
The implement stage receives findings as validated input — no prompt glue, no provider state juggling.

When to use what

You wantUse
Agent remembers facts across runsThink store / workpad tools
Stage B consumes stage A’s resultstate_machine + output_schema
Seed a run with backgroundcontext block
Audit cost/usageSession ledger (read-only)

See also