d26f20c316
Root Child DOX Index assembled, plus a per-module AGENTS.md across the tree (core/*, infrastructure/*, apps/*, testing/*, and docs/examples/frontend/etc), each following the DOX section shape: Purpose, Ownership, Local Contracts, Work Guidance, Verification, Child DOX Index.
1.9 KiB
1.9 KiB
core/context — AGENTS.md
Purpose
Context synthesis, compression, and token budgeting: assembles a ContextPack from layered ContextEntry records, applies compression strategies to fit token budgets, and tracks context state via the standard event-sourcing stack.
Ownership
CORREX kernel team.
Local Contracts
ContextPack/ContextPackBuilder(DefaultContextPackBuilder) — assembles ordered context entries for an inference call.ContextEntry— single context item with aContextLayerordinal for ordering.ContextLayer— enum defining layer priority (system, L0–L3, etc.). All SYSTEM-role entries fold into the leading system message; non-system entries order byContextEntry.ordinal.ContextCompressor(DefaultContextCompressor) — appliesCompressionStrategyto reduce context size withinTokenBudget.CompressionMetadata— records what was compressed and why (non-authoritative; does not replace original events — Hard Invariant #6).ContextStaterebuilt from events viaDefaultContextReducer+ContextProjector.DefaultContextRepositorywrapsEventReplayer<ContextState>.DecisionPointBuilder— constructs context snapshots at decision boundaries.ContextSerializationModule— registers context types for serialization.
Work Guidance
- Follow the standard Events→State→Reducer→Projector→Repository pattern (see
core/AGENTS.md). - Compression output is informational only (Hard Invariant #6). Never replace event-sourced context with a compressed snapshot.
DefaultContextReduceronly doesstate.copy(...).
Verification
./gradlew :core:context:test --rerun-tasks
Tests in testing/projections/ (ContextProjectorTest, DefaultContextReducerTest, DefaultContextPackBuilderTest) and testing/deterministic/ (ContextCompressionDeterminismTest, PromptRendererOrderingTest).
Child DOX Index
No child AGENTS.md (leaf module).