Expand description
Dynamic Context Pipeline
A ContextPipeline solves the context-forgetting problem in
long-running AI tasks. Instead of relying solely on a static
ContextSnapshot captured at
Run start, a ContextPipeline accumulates incremental
ContextFrames throughout the workflow.
§Position in Lifecycle
② Intent (Active) ← content analyzed
│
▼
ContextPipeline created ← seeded with IntentAnalysis frame
│
▼
③ Plan (Plan.pipeline → Pipeline, Plan.fwindow = visible range)
│ steps execute
▼
Frames accumulate ← StepSummary, CodeChange, ToolCall, ...
│
▼
Replan? → new Plan with updated fwindowThe pipeline is created after an Intent’s content is analyzed
(step ②) but before a Plan exists. The initial
IntentAnalysis frame captures the
AI’s structured interpretation, which serves as the foundation
for Plan creation. The Plan then references
this pipeline via pipeline and records the visible frame range
via fwindow. During execution, frames accumulate to track
step-by-step progress.
§Relationship to Other Objects
Intent ──plan──→ Plan ──pipeline──→ ContextPipeline
│ │
[PlanStep₀, ...] [IntentAnalysis, StepSummary, ...]
│ ▲
iframes/oframes ──────────────┘| From | Field | To | Notes |
|---|---|---|---|
| Plan | pipeline | ContextPipeline | 0..1 |
| PlanStep | iframes | ContextFrame IDs | consumed context |
| PlanStep | oframes | ContextFrame IDs | produced context |
The pipeline itself has no back-references — it is a passive
container. PlanSteps own the
association via iframes and oframes.
§Eviction
When max_frames > 0 and the limit is exceeded, the oldest
evictable frame is removed. IntentAnalysis and Checkpoint
frames are protected from eviction — they always survive.
§Purpose
- Context Continuity: Maintains a rolling window of high-value context for the agent’s working memory across Plan steps.
- Incremental Updates: Unlike the static ContextSnapshot, the pipeline grows as work progresses, capturing step summaries, code changes, and tool results.
- Bounded Memory:
max_frames+ eviction ensures the pipeline doesn’t grow unboundedly in long-running workflows. - Replan Support: When replanning occurs, a new Plan can
reference the same pipeline with an updated
fwindowthat includes frames accumulated since the previous plan.
Structs§
- Context
Frame - A single context frame — a compact summary captured at a point in time during the AI workflow.
- Context
Pipeline - A dynamic context pipeline that accumulates
ContextFrames throughout an AI workflow.
Enums§
- Frame
Kind - The kind of context captured in a
ContextFrame.