Memory Policy (Commit Flags)
Overview
Memory Policy controls what happens when a lifecycle task fails during a conversation turn. By default, failed task output (stack traces, HTTP error bodies, raw error messages) is written to conversation memory and becomes visible to the LLM on subsequent turns. This pollutes the LLM's context with noise it can't act on.
Strict Write Discipline solves this by marking failed task output as uncommitted — excluded from the LLM's view — and injecting a concise error digest that the LLM can understand and react to.
Configuration
Memory Policy is configured at the agent level in the agent configuration JSON:
{
"memoryPolicy": {
"strictWriteDiscipline": {
"enabled": true,
"onFailure": "digest"
}
}
}Options
enabled
boolean
false
Enable strict write discipline — while this is false, onFailure has no effect
onFailure
string
"digest"
What to do with failed task output
Failure Modes
digest
Default mode — failed task output is marked uncommitted (hidden from LLM). A concise error digest is injected so the LLM knows what failed and can adapt. Recommended.
exclude_all
Failed task output is marked uncommitted. No error digest is injected. The LLM sees nothing about the failure.
keep_all
Opt-in backwards-compatible mode — failed task output remains committed and visible to the LLM.
How It Works
Without Strict Write Discipline (Default)
With Strict Write Discipline (digest mode)
Commit Flags
Every piece of data in conversation memory (IData<T>) carries a committed flag:
committed = true (default)
Data is included in the LLM's context window
committed = false
Data is stored in memory but excluded from the LLM's context
When strict write discipline is enabled and a task fails:
All data written by the failed task during that turn is marked
committed = falseThe conversation output added by the failed task is rolled back
An error digest replaces the raw output
A
task_failed_<taskId>action is emitted for behavior rule routing
Error Digest Format
The error digest is stored as a special output type:
The UI can render error digests with distinct styling (warning icon, collapsible panel). The LLM receives the concise text summary rather than raw error noise.
Behavior Rule Integration
When a task fails with strict write discipline enabled, the action task_failed_<taskId> is emitted. You can use this in behavior rules to route to fallback logic:
Best Practices
Enable
digestmode for production agents — It prevents LLM context pollution while preserving observabilityUse behavior rules for graceful degradation — React to
task_failed_*actions to provide fallback responsesMonitor error digests — They appear in conversation memory for debugging even though the LLM only sees the summary
Set
keep_allfor development — Full error output is useful during agent development and debugging
See Also
Architecture — Lifecycle pipeline and conversation memory model
Conversation Memory — How data flows through the pipeline
Behavior Rules — Routing based on actions and conditions
Last updated
Was this helpful?