Implement @mosaic/brain — typed structured data service with MCP + REST API, JSON file backend, and schema validation via Zod. Collections: tasks, projects, events, agents, tickets, appreciations, missions, mission_tasks. MCP tools: brain_tasks, brain_projects, brain_events, brain_agents, brain_tickets, brain_today, brain_stale, brain_stats, brain_search, brain_audit, brain_missions, brain_mission, brain_mission_tasks, plus mutation tools for all collections. REST API mirrors MCP 1:1 at /v1/*. Bearer token auth with timing-safe comparison. Fastify server with per-request MCP instances (stateless HTTP transport). JSON file storage with proper-lockfile for concurrent access. Also adds Brain* types to @mosaic/types. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
41 lines
1.4 KiB
Markdown
41 lines
1.4 KiB
Markdown
# Scratchpad: @mosaic/brain Structured Data Service
|
|
|
|
**Issue:** #10
|
|
**Branch:** feat/brain-service
|
|
**PRD:** jarvis-brain/docs/planning/MOSAIC-BRAIN-MEMORY-PRD.md
|
|
|
|
## Objective
|
|
|
|
Implement @mosaic/brain as a Fastify service exposing structured data (tasks, projects, events, missions, etc.) via MCP + REST with JSON file backend.
|
|
|
|
## Plan
|
|
|
|
1. [x] Add brain data types to @mosaic/types
|
|
2. [ ] Scaffold packages/brain/ with Fastify + MCP SDK
|
|
3. [ ] Implement JSON file storage adapter with locking
|
|
4. [ ] Implement collections: tasks, projects, events, agents, tickets, appreciations, missions, mission_tasks
|
|
5. [ ] Implement MCP tools (query + mutation + mission)
|
|
6. [ ] Implement REST API (mirrors MCP)
|
|
7. [ ] Bearer token auth middleware
|
|
8. [ ] brain_today computed endpoint
|
|
9. [ ] brain_stale, brain_stats, brain_audit, brain_search, brain_graph
|
|
10. [ ] Dockerfile + docker-compose
|
|
11. [ ] Tests
|
|
12. [ ] Code review
|
|
13. [ ] Commit, push, PR, merge
|
|
|
|
## Progress
|
|
|
|
- 2026-03-10: Issue #10 created, branch created, starting implementation
|
|
|
|
## Risks
|
|
|
|
- Types package already has `Task`/`TaskStatus`/`TaskPriority` for queue — need namespacing
|
|
- Large implementation surface — focus on core CRUD first, computed endpoints second
|
|
|
|
## Decisions
|
|
|
|
- Brain types exported from `@mosaic/types` under `Brain` prefix to avoid queue type conflicts
|
|
- JSON storage uses one file per collection
|
|
- In-memory index rebuilt on startup
|