Planning
Vitruvyan Docs
Intake + Edge Refactor & Integration Plan
Date: February 16, 2026
Status: Planning Baseline (pre-implementation)
Scope: Refactor Intake and integrate as default interoperability layer in Vitruvyan Core
1. Mission
Refactor Intake into a robust, streams-native, pre-epistemic acquisition layer and integrate it with the new Edge architecture under infrastructure/edge, preserving strict separation of concerns and enabling multi-platform deployment.
2. Non-Negotiable Architectural Decisions
- Intake remains pre-epistemic only:
- No NER
- No embeddings
- No semantic relevance judgments
- Event transport is Redis Streams only (no Pub/Sub fallback).
- MCP is control-plane/H2M only, not intake data-plane.
- Orthodoxy validates governance invariants, but does not replace intake runtime responsibilities.
- File upload/acquisition remains in dedicated intake/edge services; LangGraph orchestration triggers flow but does not become file-transfer infrastructure.
3. Target Architecture
External Sources (H2M + M2M) -> Edge Gateway -> Local Policy + Local Outbox -> Core Streams -> Intake -> Codex -> Pattern Weavers -> Memory Orders -> Vault Keepers
Core components:
services/api_edge_gateway: ingress adapters, local queue/outbox, replay engine, telemetry.infrastructure/edge/oculus_prime/core: media-specific agents + canonical evidence/event contracts.service intake API: upload + ingestion endpoints + retrieval.StreamBus: intake event emission + downstream consumption with consumer groups.- Governance checkpoints: Orthodoxy rulepacks for edge/intake events.
4. Refactor Workstreams
WS-1: Contract & Schema Alignment
- Freeze canonical
Evidence Pack v1fields. - Freeze canonical
intake.evidence.created v1schema. - Align SQL schema, agent payloads, and retrieval APIs to one naming convention.
- Add contract tests to prevent drift.
WS-2: Streams Migration
- Replace publish/subscribe logic with StreamBus emit/consume APIs.
- Introduce consumer groups, ack, retry policy, dead-letter streams.
- Add idempotency persistence strategy (DB uniqueness + key checks).
WS-3: Intake Runtime Stabilization
- Fix import-path and packaging inconsistencies.
- Normalize all agents to a single persistence/event emission contract.
- Remove legacy assumptions and mixed schemas.
- Keep append-only immutability guarantees.
WS-4: Edge Gateway MVP
- Implement ingress adapters:
- HTTP/Webhook
- MQTT
- File watcher
- Add local outbox (
SQLite) with deterministic replay. - Add offline mode behavior (
buffer -> replay -> ack). - Expose operational endpoints:
/health,/status,/metrics.
WS-5: Security & Governance Hardening
- Device identity model.
- mTLS edge-core transport.
- Signed payload + anti-replay (
nonce+ timestamp window). - Policy-driven authorization per adapter/source.
- Orthodoxy invariants for edge-originated intake events.
WS-6: LangGraph Integration
- Add
intake_nodeas orchestration trigger path (intent/routing), not binary transport layer. - Support orchestrated intake invocation and evidence ID propagation.
- Keep downstream Sacred Flow unchanged after intake event.
WS-7: Multi-Platform Optimization
- Runtime profiles:
eco,balanced,performance. - Resource caps by deployment profile.
- Packaging targets:
- Docker (VPS/server)
- systemd (mini PC/SBC)
- lightweight relay profile (mobile/embedded bridge)
WS-8: Observability & Operability
- Metrics:
- ingest throughput
- stream lag
- retry rate
- DLQ rate
- replay backlog
- Structured logs with correlation IDs.
- Runbooks for failure/recovery and reconnect behavior.
5. Implementation Phases
Phase 0 (Week 1): Contract Freeze
Deliverables:
- Frozen contracts: Evidence Pack, Intake Event, Edge Envelope/Policy/Capability.
- ADRs: MCP role, Streams-only, Offline semantics, Security baseline.
- Acceptance tests definition.
Phase 1 (Week 2-3): Intake Core Refactor
Deliverables:
- Agent/event/schema alignment completed.
- API retrieval and persistence consistency.
- Contract tests green.
Phase 2 (Week 4): Streams-Native Transition
Deliverables:
- Full StreamBus migration.
- Retry + DLQ mechanisms active.
- Consumer-group processing verified.
Phase 3 (Week 5-6): Edge Gateway MVP
Deliverables:
- HTTP+MQTT ingress operational.
- Local outbox + replay working in offline/online transitions.
- Health/status/metrics endpoints available.
Phase 4 (Week 7): Governance + Security
Deliverables:
- mTLS and signed payload validation.
- Orthodoxy rulepack for edge-intake flow.
- Audit trail completeness checks.
Phase 5 (Week 8): LangGraph Integration + E2E
Deliverables:
intake_nodeintegration in orchestration flow.- End-to-end ingestion test from upload to downstream event chain.
- Documentation and operational handoff.
Phase 6 (Week 9): Multi-Platform Validation
Deliverables:
- Deployment profile certification (
eco,balanced,performance). - Benchmarks across constrained and standard devices.
- Final go-live recommendation.
6. Acceptance Criteria
- Delivery reliability >= 99.5% under intermittent connectivity.
- Duplicate downstream processing <= 0.1% via idempotency controls.
- Offline buffering and replay with no data loss in tested scenarios.
- Intake layer remains semantically neutral (pre-epistemic compliance).
- MCP used only for edge control-plane operations.
- Streams observability provides actionable lag/retry/DLQ visibility.
- Multi-platform deployments pass runtime stability checks.
7. Risks and Mitigations
- Schema drift between code and DB
- Mitigation: contract tests + migration gating.
- Legacy Pub/Sub residues
- Mitigation: explicit deprecation checklist and CI grep guard.
- MCP-intake coupling regression
- Mitigation: ADR + dependency boundary checks.
- Offline replay inconsistencies
- Mitigation: deterministic queue ordering + replay idempotency verification suite.
- Performance issues on constrained hardware
- Mitigation: profile-based runtime tuning + batch/interval controls.
8. First Execution Sprint (Recommended)
- Finalize and freeze contract documents.
- Refactor
event_emitter+ SQL schema alignment. - Implement one canonical path end-to-end:
- document ingest
- evidence pack insert
- streams event emit
- downstream consumer ack
- Add base metrics dashboard (ingest/lag/retry).
- Publish conformance report for go/no-go to next phase.
9. Immediate Next Documents
EDGE_INTEROPERABILITY_CONTRACT_V1.md(freeze from draft).- JSON schemas:
edge_evidence_envelope_v1.jsonedge_policy_v1.jsonedge_capability_v1.json
- ADR set:
ADR-EDGE-001MCP role boundaryADR-EDGE-002Streams-only transportADR-EDGE-003Offline replay semanticsADR-EDGE-004Edge security baseline