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.
2.5 KiB
2.5 KiB
core/inference — AGENTS.md
Purpose
Provider abstraction and routing for LLM inference: defines InferenceProvider, InferenceRouter, prompt rendering, embedder/tokenizer contracts, and the projection stack for tracking inference history.
Ownership
CORREX kernel team.
Local Contracts
InferenceProvider— interface for making inference calls. Implementations ininfrastructure/(llama.cpp, remote providers).InferenceRouter/DefaultInferenceRouter— selects a provider, applies routing policy, caches provider selection.InferenceRequest/InferenceResponse— request/response types.ResponseFormatcontrols output structure.GenerationConfig— sampling parameters.ModelCapability— capability flags per model (e.g. tool-use, function-calling).PromptRenderer— renders aContextPackinto the provider's prompt format. All SYSTEM-role entries fold into the leading system message; ordering byContextEntry.ordinalfor non-system entries.Embedder/NoopEmbedder— vector embedding interface;NoopEmbedderfor contexts without embedding support.Tokenizer— token counting interface; implementations ininfrastructure/.InferenceStaterebuilt fromInferenceEventsviaDefaultInferenceReducer+InferenceProjector.InferenceRepositorywrapsEventReplayer<InferenceState>.InferenceCancellationToken/CancellationReason— cooperative cancellation model.ProviderHealth— health status reported by a provider.ToolDefinition/ToolCallRequest— types for tool-use in inference requests.- Hard Invariant #7: LLM outputs are untrusted until validated by
core:validation. - Hard Invariant #8: Replay uses
ReplayInferenceProviderincore:kernel— no live LLM calls during replay.
Work Guidance
- Follow the standard Events→State→Reducer→Projector→Repository pattern (see
core/AGENTS.md). DefaultInferenceReduceronly doesstate.copy(...).- Never call a live provider from within this module's domain logic. Provider instantiation is in
infrastructure/. ModelLoadException— thrown when a required model is unavailable. Callers must handle this as a terminal condition for the operation.
Verification
./gradlew :core:inference:test --rerun-tasks
Tests in testing/contracts/ (InferenceProviderContractTest, DefaultInferenceRouterTest) and testing/projections/ (InferenceProjectorTest, InferenceReducerTest) and testing/deterministic/ (PromptRendererOrderingTest).
Child DOX Index
No child AGENTS.md (leaf module).