Phase 3.5 extraction & assembly

Wrap budget/retrieval/scorer/packer/formatter into ContextAssemblyService gRPC server with a four-level degradation ladder (L0–L3), each independently testable via fault injection.

Milestone 3.5.C.6 — gRPC Service Skeleton and Degradation Contract

Status: Planned
Goal: Track C — Context Assembly Engine
Phase: 3.5 — Extraction & Context Assembly
Estimated effort: 3 days
Track: Track C — Context Assembly Engine
Depends on: Milestone 3.5.C.5 (context formatter)


Why This Milestone Exists

Wraps Track C's budget/retrieval/scorer/packer/formatter internals into the actual ContextAssemblyService gRPC server, and locks down exactly what "graceful degradation" means operationally.


Degradation Ladder

LevelTriggerBehaviorResponse signal
L0 — FullAll retrieval sources respond within budgetDirective + hot + cold memories, full scoring/packingcontext_assembly_fallback=false
L1 — Cold-search degradedCold pgvector/HNSW search exceeds its sub-deadlineHot cache + directive only, cold results droppedAssemblyMetrics.candidates_evaluated reflects hot-only count
L2 — Memory degradedBoth hot and cold sources fail/timeoutDirective-only contextwas_truncated=false, memories_included=0
L3 — Full degradedgRPC call itself times out (45ms) or connection refusedProxy uses original, unmodified messagesX-IBEX-Context-Fallback: true

Orientation (indicative)

Named paths, package layouts, libraries, schemas, env vars, and commands anywhere on this page are rough sketches for orientation — inspiration and a baseline, not a required change list.

During implementation, expect to:

  • open the live tree and follow existing patterns before inventing new ones
  • research current constraints (latency, tenancy, deploy shape, libraries) more deeply than this page can
  • advance the design beyond the sketch where measurement or code reality says so
  • land work in different filenames, merged packages, deferred docs, or new surfaces when the situation calls for it

Prefer outcomes over matching any particular file tree or command sequence.

Areas that may be involved (situational — not a checklist):

  • Context assembly service
  • Tokenizer registry / counting

Success signals

Outcome-oriented signals that the milestone is in good shape. Exact filenames, package layouts, and commands may differ from any sketches above.

  • Each degradation level has a dedicated unit test with a fault-injected dependency
  • AssemblyMetrics populated accurately at every level (not just L0)
  • GRPC server enforces its own internal 40ms retrieval deadline independently of the proxy's 45ms client-side timeout
  • Load test: sustained 500 RPS against AssembleContext with p99 < 50ms on a 100K-memory corpus
  • Repo guards / CI checks still pass

Prerequisites

  • Milestones 3.5.C.1–3.5.C.5
Edit on GitHub

Last updated on

On this page

0%