# M4.2-Infrastructure Token Usage Tracking **Milestone:** M4.2-Infrastructure (0.0.4) **Total Issues:** 18 (1 EPIC, 3 security, 14 implementation) **Total Estimated Budget:** ~712,000 tokens ## Individual Issue Tracking ### Issue 162 - [EPIC] Mosaic Component Architecture - **Estimate:** 0 tokens (tracker only) - **Actual:** N/A - **Variance:** N/A - **Agent ID:** manual - **Status:** pending (closes when all child issues complete) - **Notes:** Parent issue tracking all INFRA issues --- ### Issue 163 - [INFRA-001] Add BullMQ dependencies - **Estimate:** 15,000 tokens (haiku) - **Actual:** _pending_ - **Variance:** _pending_ - **Agent ID:** _pending_ - **Status:** pending - **Dependencies:** none - **Notes:** Simple dependency addition, verify compatibility with ioredis/Valkey --- ### Issue 164 - [INFRA-002] Database schema for job tracking - **Estimate:** 40,000 tokens (sonnet) - **Actual:** _pending_ - **Variance:** _pending_ - **Agent ID:** _pending_ - **Status:** pending - **Dependencies:** none - **Notes:** Prisma schema for runner_jobs, job_steps, job_events --- ### Issue 165 - [INFRA-003] BullMQ module setup - **Estimate:** 45,000 tokens (sonnet) - **Actual:** _pending_ - **Variance:** _pending_ - **Agent ID:** _pending_ - **Status:** pending - **Dependencies:** #163 - **Notes:** Configure BullMQ to use VALKEY_URL, create queue definitions --- ### Issue 166 - [INFRA-004] Stitcher module structure - **Estimate:** 50,000 tokens (sonnet) - **Actual:** _pending_ - **Variance:** _pending_ - **Agent ID:** _pending_ - **Status:** pending - **Dependencies:** #165 - **Notes:** Workflow orchestration wrapper for OpenClaw --- ### Issue 167 - [INFRA-005] Runner jobs CRUD and queue submission - **Estimate:** 55,000 tokens (sonnet) - **Actual:** _pending_ - **Variance:** _pending_ - **Agent ID:** _pending_ - **Status:** pending - **Dependencies:** #164, #165 - **Notes:** Job lifecycle management, BullMQ queue submission --- ### Issue 168 - [INFRA-006] Job steps tracking - **Estimate:** 45,000 tokens (sonnet) - **Actual:** _pending_ - **Variance:** _pending_ - **Agent ID:** _pending_ - **Status:** pending - **Dependencies:** #164, #167 - **Notes:** Granular step tracking within jobs (SETUP, EXECUTION, VALIDATION, CLEANUP) --- ### Issue 169 - [INFRA-007] Job events and audit logging - **Estimate:** 55,000 tokens (sonnet) - **Actual:** _pending_ - **Variance:** _pending_ - **Agent ID:** _pending_ - **Status:** pending - **Dependencies:** #164, #167 - **Notes:** Event sourcing pattern, PostgreSQL + Valkey Streams + Pub/Sub --- ### Issue 170 - [INFRA-008] mosaic-bridge module for Discord - **Estimate:** 55,000 tokens (sonnet) - **Actual:** _pending_ - **Variance:** _pending_ - **Agent ID:** _pending_ - **Status:** pending - **Dependencies:** #166 - **Notes:** Discord.js bot connection, command forwarding, thread management --- ### Issue 171 - [INFRA-009] Chat command parsing - **Estimate:** 40,000 tokens (sonnet) - **Actual:** _pending_ - **Variance:** _pending_ - **Agent ID:** _pending_ - **Status:** pending - **Dependencies:** #170 - **Notes:** Command grammar parsing, shared across Discord/Mattermost/Slack --- ### Issue 172 - [INFRA-010] Herald status updates - **Estimate:** 50,000 tokens (sonnet) - **Actual:** _pending_ - **Variance:** _pending_ - **Agent ID:** _pending_ - **Status:** pending - **Dependencies:** #169, #170 - **Notes:** Status reporting via bridge to chat channels, PR comments --- ### Issue 173 - [INFRA-011] WebSocket gateway for job events - **Estimate:** 45,000 tokens (sonnet) - **Actual:** _pending_ - **Variance:** _pending_ - **Agent ID:** _pending_ - **Status:** pending - **Dependencies:** #169 - **Notes:** Extend existing WebSocket gateway, subscription management --- ### Issue 174 - [INFRA-012] SSE endpoint for CLI consumers - **Estimate:** 40,000 tokens (sonnet) - **Actual:** _pending_ - **Variance:** _pending_ - **Agent ID:** _pending_ - **Status:** pending - **Dependencies:** #169 - **Notes:** Server-Sent Events for CLI, Valkey Pub/Sub integration --- ### Issue 175 - [INFRA-013] End-to-end test harness - **Estimate:** 65,000 tokens (sonnet) - **Actual:** _pending_ - **Variance:** _pending_ - **Agent ID:** _pending_ - **Status:** pending - **Dependencies:** All Phase 1-4 - **Notes:** Happy path, error handling, chat integration tests --- ### Issue 176 - [INFRA-014] Integration with M4.1 coordinator - **Estimate:** 75,000 tokens (opus) - **Actual:** _pending_ - **Variance:** _pending_ - **Agent ID:** _pending_ - **Status:** pending - **Dependencies:** All M4.2 issues - **Notes:** Complex integration requiring opus-level reasoning --- ### Issue 179 - fix(security): Update Node.js dependencies - **Estimate:** 12,000 tokens (haiku) - **Actual:** _pending_ - **Variance:** _pending_ - **Agent ID:** _pending_ - **Status:** pending - **Dependencies:** none - **Notes:** cross-spawn, glob, tar vulnerabilities (HIGH) --- ### Issue 180 - fix(security): Update pnpm in Dockerfiles - **Estimate:** 10,000 tokens (haiku) - **Actual:** _pending_ - **Variance:** _pending_ - **Agent ID:** _pending_ - **Status:** pending - **Dependencies:** none - **Notes:** pnpm 10.19.0 -> 10.27.0 (HIGH) --- ### Issue 181 - fix(security): Update Go stdlib in postgres image - **Estimate:** 15,000 tokens (haiku) - **Actual:** _pending_ - **Variance:** _pending_ - **Agent ID:** _pending_ - **Status:** pending - **Dependencies:** none - **Notes:** Go stdlib vulnerabilities, may require investigation --- ## Phase Summaries ### Security Issues (Wave 0) - **Estimated:** 37,000 tokens - **Actual:** _pending_ - **Variance:** _pending_ - **Issues:** #179, #180, #181 ### Phase 1: Core Infrastructure - **Estimated:** 100,000 tokens - **Actual:** _pending_ - **Variance:** _pending_ - **Issues:** #163, #164, #165 ### Phase 2: Stitcher Service - **Estimated:** 205,000 tokens - **Actual:** _pending_ - **Variance:** _pending_ - **Issues:** #166, #167, #168, #169 ### Phase 3: Chat Integration - **Estimated:** 145,000 tokens - **Actual:** _pending_ - **Variance:** _pending_ - **Issues:** #170, #171, #172 ### Phase 4: Real-time Status - **Estimated:** 85,000 tokens - **Actual:** _pending_ - **Variance:** _pending_ - **Issues:** #173, #174 ### Phase 5: Integration - **Estimated:** 140,000 tokens - **Actual:** _pending_ - **Variance:** _pending_ - **Issues:** #175, #176 ### EPIC Tracker - **Estimated:** 0 tokens (manual) - **Actual:** N/A - **Variance:** N/A - **Issues:** #162 ## Overall Summary - **Total Estimated:** 712,000 tokens - **Total Actual:** _pending_ - **Overall Variance:** _pending_ - **Estimation Accuracy:** _pending_ ## Code Review & QA Tracking | Issue | Code Review Agent | QA Agent | Review Status | QA Status | | ----- | ----------------- | --------- | ------------- | --------- | | #163 | _pending_ | _pending_ | _pending_ | _pending_ | | #164 | _pending_ | _pending_ | _pending_ | _pending_ | | #165 | _pending_ | _pending_ | _pending_ | _pending_ | | #166 | _pending_ | _pending_ | _pending_ | _pending_ | | #167 | _pending_ | _pending_ | _pending_ | _pending_ | | #168 | _pending_ | _pending_ | _pending_ | _pending_ | | #169 | _pending_ | _pending_ | _pending_ | _pending_ | | #170 | _pending_ | _pending_ | _pending_ | _pending_ | | #171 | _pending_ | _pending_ | _pending_ | _pending_ | | #172 | _pending_ | _pending_ | _pending_ | _pending_ | | #173 | _pending_ | _pending_ | _pending_ | _pending_ | | #174 | _pending_ | _pending_ | _pending_ | _pending_ | | #175 | _pending_ | _pending_ | _pending_ | _pending_ | | #176 | _pending_ | _pending_ | _pending_ | _pending_ | | #179 | _pending_ | _pending_ | _pending_ | _pending_ | | #180 | _pending_ | _pending_ | _pending_ | _pending_ | | #181 | _pending_ | _pending_ | _pending_ | _pending_ | ## Execution Log _Execution events will be logged here as work progresses._ ``` [2026-02-01 HH:MM] Orchestrator initialized [2026-02-01 HH:MM] Implementation plan created [2026-02-01 HH:MM] Token tracking initialized ``` ## Notes _Observations and learnings will be recorded here._