MILTON.Platform
MILTON.Platform provides the fundamental, domain-agnostic technical infrastructure for the MILTON distributed application. It is one of only two shared libraries in the solution (alongside MILTON.ServiceDefaults), carefully designed to avoid coupling microservices through shared business contracts.
Architectural Intent
The primary architectural guardrail for this library is strict domain ignorance.
MILTON.Platform contains no domain entities, no Data Transfer Objects (DTOs), and no message contracts. Any concept that intrinsically understands documents, clustering, projects, or inter-service wire formats belongs in a specific service’s boundaries.
By enforcing this boundary, we ensure that adding a dependency on MILTON.Platform never inadvertently couples two services together. MILTON.DocumentGenerator, MILTON.API, and MILTON.GitOperations all reference this library to share technical plumbing without sharing domain knowledge.
Core Infrastructure Components
1. The AI Client Abstraction (MILTON.Platform.AI)
The AI infrastructure is modeled around the IAIService, offering a unified interface for OpenAI-compatible interactions (chat, JSON-enforced grammar, embeddings, clustering, and preset-based generation).
Crucially, it consumes a purely technical AiPresetConfig. It knows nothing about the MILTON Project or domain-specific LLM presets; caller services must decrypt and map their domain-specific configurations onto this technical boundary before invocation.
2. S3 Claim-Check Store (MILTON.Platform.Storage)
To prevent RabbitMQ from being overwhelmed by large payloads (such as generated document text or source code), MILTON.Platform implements the Claim-Check Pattern.
When a service needs to pass a large payload to another, it stores the payload in the milton-claimcheck S3 bucket via IClaimCheckStore, and passes only the returned lightweight reference key over the message bus.
sequenceDiagram participant API as MILTON.API (Producer) participant S3 as S3 (milton-claimcheck) participant Bus as RabbitMQ / Wolverine participant Worker as MILTON.DocumentGenerator (Consumer) API->>S3: PutAsync(LargePayload) S3-->>API: Returns claim-check Key (e.g., claimcheck/123.json) API->>Bus: Publish Message { ClaimCheckKey: "claimcheck/123.json" } Bus->>Worker: Deliver Message Worker->>S3: GetAsync("claimcheck/123.json") S3-->>Worker: Returns LargePayload Worker->>S3: DeleteAsync("claimcheck/123.json")
3. S3 Repository File Store (MILTON.Platform.Storage)
Instead of relying on a fragile shared filesystem, MILTON distributes cloned Git repositories via S3. The IRepoFileStore handles uploading and retrieving raw file contents from the milton-repos bucket.
MILTON.GitOperations clones the repositories and uploads the files, while consumers like the Python clustering service or MILTON.DocumentGenerator can fetch files contextually using the RepoScope identifier.
graph TD Git[MILTON.GitOperations] -->|UploadRepositoryAsync| S3[(milton-repos Bucket)] S3 -->|ReadFileAsync| API[MILTON.API] S3 -->|ReadFileAsync| DocGen[MILTON.DocumentGenerator]
Summary
MILTON.Platform is the engine room of the application. It provides the heavy lifting for AI interactions and distributed storage, adhering strictly to the philosophy that shared libraries should provide capabilities, not contracts.