Problem Statement
Astra needs to treat context as a compiled artifact, not accidental concatenation. Large tool outputs should be referenced, not pushed raw into prompts. Reviewable output (diffs, test reports, artifacts) should be first-class.
Proposed Solution
Implement the context compilation, artifact management, and reviewable output layer:
Core Components
-
ContextCompiler - Pipeline from candidates to manifest:
Candidates -> Rank -> Budget zones -> Render -> Hash -> Manifest -> PromptRequestRecord
- Zones: system, policy, workspace, plan/todo, recent tail, retrieved facts, tool previews, artifacts, skills, tool schemas
- Dropped items recorded with reason and recovery reference
-
Prompt Request Record - Delta-aware LLM request storage:
- renderer_version, model_profile, base_prompt_ref, delta_refs[]
- chunk_hashes[], token_counts_by_zone, redaction_policy_hash, rendered_hash
- Split stable zones into content-addressed chunks
- Record per-turn deltas: user input, assistant tail, tool result preview, workspace diff
-
ArtifactLedger - All large outputs become artifacts:
- Full tool stdout/stderr, patches/diffs, screenshots, test reports
- Sandbox data diffs, generated files, context manifests, replay bundles
- Hot preview metadata + colder full bodies
-
Tool Result Quality Firewall:
- Empty, stale, partial, sentinel, over-large outputs flagged
- Summary + ref instead of raw blob in prompt
-
Progressive Loading Tools:
- artifact.fetch, session_history_search, session_history_around, todo.expand
- Enable low-context models and long-running sessions
-
Tool Schema Budget Optimization:
- Full, compact, deferred, hidden schemas
- Model-window profiles
-
Reviewable Output Model:
- Diff, test report, artifact bundle, decision log, PR-ready summary
- Cloud repo branch lifecycle: checkout, patch, commit, push branch, PR
-
SDK/Webhook Protocol:
- Background run creation, wait resolution, artifact review, external approval
Implementation Checklist
Acceptance Criteria
- Context manifest shows every included/dropped item with reason
- Large tool outputs stored as artifacts, summarized in prompt
- Prompt delta storage avoids duplicating stable chunks
- Tool schema budgets configurable per model
- Progressive loading tools work for long sessions
- Reviewable outputs include diffs, test reports, artifacts
- SDK/webhook can trigger and respond to runs
Dependencies
References
- Architecture doc: plans/web-agent-architecture-roi-todos-2026-05-18.md
- Section: "P3: Context, artifact, and reviewable output" (items 31-43)
- Section: "Vertical slice D: fork/replay/debug"
- Section: "Treat context as a compiled artifact"
Non-Goals
- Do NOT implement full debugger here (P5)
- Do NOT implement skill evolution here (P6)
- Do NOT implement tri-layer checkpoint here (P5)
- Do NOT implement automatic memory promotion here (P6)
Problem Statement
Astra needs to treat context as a compiled artifact, not accidental concatenation. Large tool outputs should be referenced, not pushed raw into prompts. Reviewable output (diffs, test reports, artifacts) should be first-class.
Proposed Solution
Implement the context compilation, artifact management, and reviewable output layer:
Core Components
ContextCompiler - Pipeline from candidates to manifest:
Prompt Request Record - Delta-aware LLM request storage:
ArtifactLedger - All large outputs become artifacts:
Tool Result Quality Firewall:
Progressive Loading Tools:
Tool Schema Budget Optimization:
Reviewable Output Model:
SDK/Webhook Protocol:
Implementation Checklist
Acceptance Criteria
Dependencies
References
Non-Goals