Background
The "bootstrap" pattern (popularized by openclaw) gives agents a startup sequence — read memory, load identity, check state — before responding. Today this is a static block in agent.md that the model follows on good faith. It works, but it's brittle: the model can skip steps, the sequence can't adapt to runtime conditions, and there's no way to inject fresh state after the agent has started.
Proposal
Use toc-native's runtime configurability to make bootstrap a first-class runtime concern, not a prompt convention.
Pre-session hooks: Before the agent's first turn, the runtime executes a bootstrap sequence that:
- Resolves and injects context (memory files, recent logs, project state)
- Dynamically assembles
agent.md from fragments based on current conditions (e.g., skip deploy instructions if no deploy is in progress)
- Sets runtime variables the agent can reference mid-session
Mid-session state updates: The runtime can patch the agent's context window during a session:
- Memory writes propagate back as updated context, not just files the agent hopes to re-read
- External events (PR merged, deploy failed, teammate message) inject state without the agent polling
Declarative bootstrap config:
bootstrap:
- load: memory://today
- load: memory://longterm
- load: identity://soul
- eval: scripts/resolve-active-context.sh # outputs YAML merged into runtime state
- condition:
if: git.has_uncommitted_changes
load: context://wip-summary
Why this matters
Static bootstrap is a ceiling. The agent reads its instructions once and hopes they're complete. Dynamic bootstrap means the runtime assembles the right context for the right moment — the agent starts every session with exactly what it needs, nothing it doesn't, and can receive updates as the world changes.
This is also the path to agents that genuinely improve over sessions rather than just remembering — the runtime can analyze past session performance and adjust bootstrap context accordingly.
Relation to #171
Context pointers (#171) solve fetching external docs. This issue solves orchestrating when and how context gets assembled and updated. They're complementary — pointers are a building block, bootstrap orchestration is the control plane.
Background
The "bootstrap" pattern (popularized by openclaw) gives agents a startup sequence — read memory, load identity, check state — before responding. Today this is a static block in agent.md that the model follows on good faith. It works, but it's brittle: the model can skip steps, the sequence can't adapt to runtime conditions, and there's no way to inject fresh state after the agent has started.
Proposal
Use toc-native's runtime configurability to make bootstrap a first-class runtime concern, not a prompt convention.
Pre-session hooks: Before the agent's first turn, the runtime executes a bootstrap sequence that:
agent.mdfrom fragments based on current conditions (e.g., skip deploy instructions if no deploy is in progress)Mid-session state updates: The runtime can patch the agent's context window during a session:
Declarative bootstrap config:
Why this matters
Static bootstrap is a ceiling. The agent reads its instructions once and hopes they're complete. Dynamic bootstrap means the runtime assembles the right context for the right moment — the agent starts every session with exactly what it needs, nothing it doesn't, and can receive updates as the world changes.
This is also the path to agents that genuinely improve over sessions rather than just remembering — the runtime can analyze past session performance and adjust bootstrap context accordingly.
Relation to #171
Context pointers (#171) solve fetching external docs. This issue solves orchestrating when and how context gets assembled and updated. They're complementary — pointers are a building block, bootstrap orchestration is the control plane.