Backend Migration from Jarvis r1 [EPIC] #121

Closed
opened 2026-01-30 21:27:37 +00:00 by jason.woltje · 2 comments
Owner

Migrate production-ready backend features from jarvis r1 to Mosaic Stack.

Overview

Port multi-provider LLM, OpenTelemetry, Personality backend, MCP infrastructure, and workspace-scoped configuration from ~/src/jarvis to ~/src/mosaic-stack.

Migration Phases

  1. Phase 1: LLM Abstraction (5-7 days)
  2. Phase 2: Personality Backend (2-3 days)
  3. Phase 3: OpenTelemetry (3-4 days)
  4. Phase 4: MCP Integration (2-3 days)
  5. Phase 5: Workspace LLM Config (1-2 days)

Timeline

Total: ~12-14 days (hybrid parallel approach)

Documentation

See for complete specification.

This epic tracks all backend migration work from jarvis r1.

Migrate production-ready backend features from jarvis r1 to Mosaic Stack. ## Overview Port multi-provider LLM, OpenTelemetry, Personality backend, MCP infrastructure, and workspace-scoped configuration from ~/src/jarvis to ~/src/mosaic-stack. ## Migration Phases 1. **Phase 1**: LLM Abstraction (5-7 days) 2. **Phase 2**: Personality Backend (2-3 days) 3. **Phase 3**: OpenTelemetry (3-4 days) 4. **Phase 4**: MCP Integration (2-3 days) 5. **Phase 5**: Workspace LLM Config (1-2 days) ## Timeline Total: ~12-14 days (hybrid parallel approach) ## Documentation See for complete specification. ## Related Issues This epic tracks all backend migration work from jarvis r1.
jason.woltje added this to the M4-LLM (0.0.4) milestone 2026-01-30 23:40:48 +00:00
Author
Owner

EPIC Breakdown Complete

This EPIC has been broken down into 8 actionable sub-issues:

Phase 1: LLM Abstraction Layer (5-7 days)

  • #308 - Implement multi-provider LLM abstraction layer (2-3 days)
  • #309 - Implement LLM usage tracking and analytics (1-2 days)
  • #310 - Implement OpenTelemetry tracing for LLM operations (2 days) requires #312

Phase 2: Personality Backend (2-3 days)

  • #311 - Migrate personality system backend (2-3 days)

Phase 3: OpenTelemetry Infrastructure (3-4 days)

  • #312 - Implement core OpenTelemetry infrastructure (2 days)
  • #313 - Implement FastAPI and agent tracing instrumentation (1-2 days) requires #312

Phase 4: MCP Integration (2-3 days)

  • #314 - Implement MCP (Model Context Protocol) infrastructure (2-3 days)

Phase 5: Workspace LLM Configuration (1-2 days)

  • #315 - Implement workspace-scoped LLM configuration (1-2 days) requires #308

Implementation Order

Recommended sequence:

  1. Start with #312 (OpenTelemetry core) - foundation for tracing
  2. Parallel: #308 (LLM abstraction) + #311 (Personality) + #314 (MCP)
  3. After #312 done: #310 (LLM tracing) + #313 (Agent tracing)
  4. After #308 done: #309 (LLM usage) + #315 (Workspace config)

Total Estimated Time: 13-19 days

Dependencies

All sub-issues are ready for implementation. See detailed breakdown in docs/scratchpads/121-backend-migration-breakdown.md

## EPIC Breakdown Complete This EPIC has been broken down into 8 actionable sub-issues: ### Phase 1: LLM Abstraction Layer (5-7 days) - #308 - Implement multi-provider LLM abstraction layer (2-3 days) - #309 - Implement LLM usage tracking and analytics (1-2 days) - #310 - Implement OpenTelemetry tracing for LLM operations (2 days) *requires #312* ### Phase 2: Personality Backend (2-3 days) - #311 - Migrate personality system backend (2-3 days) ### Phase 3: OpenTelemetry Infrastructure (3-4 days) - #312 - Implement core OpenTelemetry infrastructure (2 days) - #313 - Implement FastAPI and agent tracing instrumentation (1-2 days) *requires #312* ### Phase 4: MCP Integration (2-3 days) - #314 - Implement MCP (Model Context Protocol) infrastructure (2-3 days) ### Phase 5: Workspace LLM Configuration (1-2 days) - #315 - Implement workspace-scoped LLM configuration (1-2 days) *requires #308* ## Implementation Order **Recommended sequence:** 1. Start with #312 (OpenTelemetry core) - foundation for tracing 2. Parallel: #308 (LLM abstraction) + #311 (Personality) + #314 (MCP) 3. After #312 done: #310 (LLM tracing) + #313 (Agent tracing) 4. After #308 done: #309 (LLM usage) + #315 (Workspace config) **Total Estimated Time:** 13-19 days ## Dependencies - #310 depends on #312 - #313 depends on #312 - #315 depends on #308 All sub-issues are ready for implementation. See detailed breakdown in `docs/scratchpads/121-backend-migration-breakdown.md`
Author
Owner

EPIC #121 successfully completed. All 8 sub-issues have been implemented and verified.

Completion Summary

Status: 8/8 sub-issues complete (100%)

Sub-Issues Completed:

  1. #308 - Multi-provider LLM abstraction (pre-existing, 185 tests, 95.32% coverage)
  2. #309 - LLM usage tracking and analytics (implemented, commit b836940, 20 tests, 90.8% coverage)
  3. #310 - LLM telemetry decorator (pre-existing, integrated with #312)
  4. #311 - Personality system backend (pre-existing, 26 tests, 100% coverage)
  5. #312 - OpenTelemetry core infrastructure (implemented, commit 6516843, 74 tests passing)
  6. #313 - FastAPI/agent tracing instrumentation (implemented, commit 6de631c, 25 tests, 90-91% coverage)
  7. #314 - MCP infrastructure (pre-existing, 85 tests, 90.9% coverage)
  8. #315 - Workspace-scoped LLM configuration (pre-existing, 34 tests, 100% coverage)

Implementation Details

New Code Delivered:

  • OpenTelemetry core infrastructure (apps/api/src/telemetry/)
  • FastAPI tracing instrumentation (apps/coordinator/src/telemetry.py, tracing_decorators.py)
  • LLM usage tracking system (apps/api/src/llm-usage/)
  • Prisma schema updates (LlmUsageLog model)

Pre-Existing Verified:

  • Multi-provider LLM abstraction (Ollama, Claude, OpenAI)
  • Personality system with workspace scoping
  • MCP (Model Context Protocol) infrastructure
  • Workspace-scoped LLM configuration with hierarchy

Quality Metrics:

  • Total Tests: 400+ tests passing across all modules
  • Coverage: 85%+ on all new code, many modules at 90-100%
  • Zero linting errors (ruff, ESLint)
  • Zero type checking errors (mypy, TypeScript)
  • Security reviews: All approved, no vulnerabilities
  • All code committed to develop branch

Commits:

  • b836940 - feat(#309): LLM usage tracking and analytics
  • 6516843 - feat(#312): OpenTelemetry core infrastructure
  • 6de631c - feat(#313): FastAPI and agent tracing instrumentation

Architecture:

  • Distributed tracing with OpenTelemetry (OTLP exporter)
  • Multi-provider LLM abstraction layer
  • Workspace-scoped configuration hierarchy
  • MCP tool integration
  • Usage analytics and cost tracking
  • Personality management system

All code is production-ready and on the develop branch.

EPIC #121 successfully completed. All 8 sub-issues have been implemented and verified. ## Completion Summary **Status:** 8/8 sub-issues complete (100%) **Sub-Issues Completed:** 1. ✅ #308 - Multi-provider LLM abstraction (pre-existing, 185 tests, 95.32% coverage) 2. ✅ #309 - LLM usage tracking and analytics (implemented, commit b836940, 20 tests, 90.8% coverage) 3. ✅ #310 - LLM telemetry decorator (pre-existing, integrated with #312) 4. ✅ #311 - Personality system backend (pre-existing, 26 tests, 100% coverage) 5. ✅ #312 - OpenTelemetry core infrastructure (implemented, commit 6516843, 74 tests passing) 6. ✅ #313 - FastAPI/agent tracing instrumentation (implemented, commit 6de631c, 25 tests, 90-91% coverage) 7. ✅ #314 - MCP infrastructure (pre-existing, 85 tests, 90.9% coverage) 8. ✅ #315 - Workspace-scoped LLM configuration (pre-existing, 34 tests, 100% coverage) ## Implementation Details **New Code Delivered:** - OpenTelemetry core infrastructure (apps/api/src/telemetry/) - FastAPI tracing instrumentation (apps/coordinator/src/telemetry.py, tracing_decorators.py) - LLM usage tracking system (apps/api/src/llm-usage/) - Prisma schema updates (LlmUsageLog model) **Pre-Existing Verified:** - Multi-provider LLM abstraction (Ollama, Claude, OpenAI) - Personality system with workspace scoping - MCP (Model Context Protocol) infrastructure - Workspace-scoped LLM configuration with hierarchy **Quality Metrics:** - Total Tests: 400+ tests passing across all modules - Coverage: 85%+ on all new code, many modules at 90-100% - Zero linting errors (ruff, ESLint) - Zero type checking errors (mypy, TypeScript) - Security reviews: All approved, no vulnerabilities - All code committed to develop branch **Commits:** - b836940 - feat(#309): LLM usage tracking and analytics - 6516843 - feat(#312): OpenTelemetry core infrastructure - 6de631c - feat(#313): FastAPI and agent tracing instrumentation **Architecture:** - Distributed tracing with OpenTelemetry (OTLP exporter) - Multi-provider LLM abstraction layer - Workspace-scoped configuration hierarchy - MCP tool integration - Usage analytics and cost tracking - Personality management system All code is production-ready and on the develop branch.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: mosaic/stack#121