Skip to content
K2 Chat

Engineering / From event to evidence

The system behind
the conversation.

A document workspace is also a lifecycle problem. Ownership, versions, retries, and source eligibility have to stay aligned while work moves between services.

Distributed processing.
Hosted model execution.

The application distributes ingestion across queues and compute jobs. Embeddings and generation come from hosted APIs.

Download project brief PDF

01 / The architecture

Separate the fast conversation
from the work behind it.

The Next.js client calls a Hono API on Cloudflare Workers. Cognito authenticates users; DynamoDB owns document state. Explore how an upload becomes usable evidence.

01 / Worker · Cognito

Establish ownership before processing.

An authenticated upload creates a tenant-owned DynamoDB record with an opaque object key, version, and job identity. An object event identifies work; it does not grant authority to process it.

02 / The decisions

The important details
live at the boundaries.

AUTHORITY

An index entry is not permission.

Tenant-owned document records determine which version is current and ready. Versioned passages and cached citations are checked before reuse.

CONCURRENCY

Old work must stay old.

Conditional state writes bind work to a source, version, and job. Workflow executions use separate intermediate paths so retries cannot silently share output.

MODEL CONTRACT

Dimensions are only the shape.

Gemini document and query embeddings share a model space. Switching to another model requires reindexing, even when the vector lengths match.

03 / Reproducible evidence

A corpus you can inspect.
A result you can reproduce.

The v2 corpus describes a fictional ML workspace. Its facts are test material, separate from the application's operating configuration.

11synthetic documents
38labeled questions
8unanswerable cases
SHA-256sealed source & label files
DEVELOPMENT REFERENCE / LEXICAL RETRIEVAL

The baseline includes its limitations.

This fixed lexical reference uses no gold labels or model calls. It scores 14 development questions. It retrieves most labeled evidence, while failing to abstain correctly on the two unanswerable development questions.

Download evaluation summary
Recall@5
91.7%
Precision@5
23.3%
MRR@5
0.697
Abstention
0.0%

Reference-retriever results only. These figures do not measure generated-answer accuracy, deployed application performance, latency, or cost. Precision uses a fixed K denominator.

04 / Reliability in practice

Make the failure modes
part of the implementation.

Focused checks exercise document ownership, replaced jobs, stale context, embedding shape, complete vector deletion, and corpus integrity. The release passed all seven repository CI jobs.

A separate bounded synthetic ingestion run produced 224 ready vectors from 100,000 tokens with matching document/version metadata. That observation establishes ingestion correctness for that run; throughput, answer quality, and cost need their own measurements.

The website and example walkthrough work independently of cloud ingestion. Live document processing depends on configured AWS and model-provider access. Legacy vectors produced with an earlier embedding fallback require reindexing.