> For the complete documentation index, see [llms.txt](https://faction-os.gitbook.io/faction-os-docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://faction-os.gitbook.io/faction-os-docs/.spec_system/archive/sessions/phase19-session15-metrics-and-notifications/tasks.md).

# Task Checklist

**Session ID**: `phase19-session15-metrics-and-notifications` **Total Tasks**: 22 **Estimated Duration**: 3-4 hours **Created**: 2026-06-27

***

## Progress Summary

| Metric          | Value   |
| --------------- | ------- |
| Tasks Completed | 22 / 22 |
| Tasks Remaining | 0       |
| Blockers        | 0       |

***

Legend: `[x]` completed; `[ ]` pending; `[P]` parallelizable; `[SNNMM]` session ref; `TNNN` task ID.

***

## Setup (2 tasks)

* [x] T001 \[S1915] Verify Session 15 prerequisites, completed Sessions 04, 05, 06, 09, 10, and 14 artifacts, current metric/notification PRD scope, and hosted-service no-claim security boundaries (`.spec_system/PRD/phase_19/session_15_metrics_and_notifications.md`, `.spec_system/CONSIDERATIONS.md`, `.spec_system/SECURITY-COMPLIANCE.md`)
* [x] T002 \[S1915] Inspect current command-center usage, notification readiness, attention, server route, web notification, hosted-operation, cost projection, and session import paths before changing contracts (`packages/protocol/src/orchestrationCommandCenter.ts`, `apps/server/src/managers/orchestrationCommandCenter.ts`, `apps/server/src/routes/commandCenter.ts`, `apps/web/src/lib/notifications.ts`, `apps/web/src/lib/hostedOperations.ts`, `apps/web/src/lib/costProjection.ts`, `apps/server/src/lib/claudeSessionImport.ts`, `apps/server/src/lib/codexSessionImport.ts`)

***

## Foundation (5 tasks)

* [x] T003 \[S1915] Extend command-center protocol contracts for metric kinds, rollup targets, notification channels, routing categories, payload categories, subscription statuses, readiness requirements, and blocked raw-field rejection (`packages/protocol/src/orchestrationCommandCenter.ts`)
* [x] T004 \[S1915] Add protocol event and parser tests for enriched usage metrics, notification readiness, subscription payloads, routing categories, compact WebSocket events, and no raw payload leakage (`packages/protocol/tests/orchestrationCommandCenter.test.ts`, `packages/protocol/tests/events.test.ts`)
* [x] T005 \[S1915] \[P] Create the usage metrics manager for deterministic aggregation across plans, tasks, attention, permissions, executions, reviews, channels, provider imports, queue age, blocked age, latency, and executor utilization (`apps/server/src/managers/usageMetricsManager.ts`)
* [x] T006 \[S1915] \[P] Create notification routing helpers for preferences, local categories, VAPID readiness, Web Push subscription validation, consent, idempotency, and payload minimization (`apps/server/src/lib/notificationRouting.ts`)
* [x] T007 \[S1915] Add focused server helper tests for aggregation, readiness, subscription validation, consent gating, duplicate-trigger prevention, and redacted output (`apps/server/tests/usageMetricsManager.test.ts`, `apps/server/tests/notificationRouting.test.ts`)

***

## Server Implementation (5 tasks)

* [x] T008 \[S1915] Wire usage metrics refresh and mutation behavior into the command-center manager and existing usage update event path with schema-validated input and explicit error mapping (`apps/server/src/managers/orchestrationCommandCenter.ts`, `apps/server/src/lib/commandCenterValidation.ts`)
* [x] T009 \[S1915] Add the missing usage mutation and refresh route while preserving auth, rate limits, body caps, root and `/api` mounting, duplicate-trigger prevention while in-flight, and compact WebSocket updates (`apps/server/src/routes/commandCenter.ts`)
* [x] T010 \[S1915] Add notification preference, readiness, subscribe, and unsubscribe routes with authorization inherited from the local server boundary and disabled/unavailable defaults when VAPID or consent is missing (`apps/server/src/routes/commandCenterNotifications.ts`, `apps/server/src/server.ts`)
* [x] T011 \[S1915] Connect bounded provider usage import fields and mission artifact estimates to metric aggregation without storing raw transcripts, prompts, terminal output, provider payloads, or absolute paths (`apps/server/src/lib/claudeSessionImport.ts`, `apps/server/src/lib/codexSessionImport.ts`, `apps/server/src/lib/missionArtifacts.ts`)
* [x] T012 \[S1915] Add server route and manager tests for usage refresh, usage POST, notification readiness, subscribe/unsubscribe gating, hydration frame counts, WebSocket updates, idempotency, and no raw echo (`apps/server/tests/commandCenterManager.test.ts`, `apps/server/tests/commandCenterRoutes.test.ts`, `apps/server/tests/commandCenterNotifications.test.ts`)

***

## Web Implementation (6 tasks)

* [x] T013 \[S1915] Add web API clients for metrics refresh, usage mutations, notification preferences, readiness, subscribe, and unsubscribe with timeout, offline, invalid-response, stale, and duplicate-conflict error mapping (`apps/web/src/lib/orchestrationApi.ts`)
* [x] T014 \[S1915] Extend web store and WebSocket parsing for enriched metrics, notification readiness, preferences, subscription state, malformed payload rejection before mutation, and selected-detail preservation on refresh (`apps/web/src/store/useGameStore.ts`, `apps/web/src/store/useWsClient.ts`)
* [x] T015 \[S1915] Create pure web metric and notification view helpers for rollup cards, cost projection labels, attention risk/severity buckets, age buckets, mobile filters, readiness copy, and safe product-facing labels (`apps/web/src/lib/commandCenterMetrics.ts`, `apps/web/src/lib/commandCenterUi.ts`)
* [x] T016 \[S1915] Create the Metrics and Notifications panel with task, hero, plan, queue, executor, provider, cost, attention, local notification, and Web Push readiness sections with explicit loading, empty, error, and offline states (`apps/web/src/components/orchestration/MetricsAndNotificationsPanel.tsx`)
* [x] T017 \[S1915] Extend local notification routing for command-center approval, question, blocked-task, failed-task, and review-gate categories with hidden-tab service-worker delivery, denied/restricted/revoked fallback handling, and duplicate-trigger prevention while in-flight (`apps/web/src/lib/notifications.ts`, `apps/web/src/lib/useNotifications.ts`, `apps/web/src/lib/commandCenterNotifications.ts`)
* [x] T018 \[S1915] Wire attention summary, severity distribution, mobile filters, metrics refresh, readiness controls, hosted-operation copy, settings entry points, and the Metrics tab into the Orchestration shell without active push or analytics claims (`apps/web/src/components/orchestration/OrchestrationHeader.tsx`, `apps/web/src/components/orchestration/AttentionWorkbench.tsx`, `apps/web/src/components/orchestration/CommandCenterPanes.tsx`, `apps/web/src/components/orchestration/OrchestrationShell.tsx`, `apps/web/src/components/SettingsDrawer.tsx`, `apps/web/src/lib/hostedOperations.ts`)

***

## Testing And Documentation (4 tasks)

* [x] T019 \[S1915] Add web tests for metrics helpers, notification routing, Metrics panel states, Orchestration panel wiring, API clients, store normalization, local notifications, hidden-tab routing, hosted-operation copy, accessibility labels, and product-facing copy (`apps/web/tests/commandCenterMetrics.test.ts`, `apps/web/tests/commandCenterNotifications.test.ts`, `apps/web/tests/MetricsAndNotificationsPanel.test.tsx`, `apps/web/tests/OrchestrationPanel.test.tsx`, `apps/web/tests/orchestrationApi.test.ts`, `apps/web/tests/commandCenterStore.test.ts`, `apps/web/tests/notifications.test.ts`, `apps/web/tests/useNotifications.test.tsx`, `apps/web/tests/hostedOperations.test.ts`)
* [x] T020 \[S1915] Update API and package docs for command-center metrics, usage refresh, notification readiness, local notification routing, Web Push subscribe/unsubscribe gating, consent/VAPID requirements, and unchanged no-claim boundaries (`docs/api/README_api.md`, `apps/server/README_server.md`, `apps/web/README_web.md`, `packages/protocol/README_protocol.md`)
* [x] T021 \[S1915] Run focused protocol, server, and web tests for metric contracts, aggregation, notification routing, routes, API helpers, store, panel, local notifications, and hosted-operation no-claim copy (`npm test -- orchestrationCommandCenter events usageMetricsManager notificationRouting commandCenterManager commandCenterRoutes commandCenterNotifications commandCenterMetrics commandCenterNotifications MetricsAndNotificationsPanel OrchestrationPanel orchestrationApi commandCenterStore notifications useNotifications hostedOperations`)
* [x] T022 \[S1915] Run package/workspace validation and ASCII/LF checks, then record implementation notes, command evidence, runtime verification, security posture, and remaining no-claim states for creview/validate handoff (`npm --workspace packages/protocol run typecheck`, `npm --workspace apps/server run typecheck`, `npm --workspace apps/web run typecheck`, `npm run format:check`, `npm run lint`, `npm test`, `.spec_system/specs/phase19-session15-metrics-and-notifications/implementation-notes.md`, `.spec_system/specs/phase19-session15-metrics-and-notifications/security-compliance.md`)

***

## Completion Checklist

* [x] All tasks marked `[x]`
* [x] All tests and checks passing
* [x] All files ASCII-encoded with LF line endings
* [x] implementation-notes.md updated
* [x] Ready for `creview` to continue the implement -> creview -> validate sequence

***

## Next Steps

Run the `creview` workflow step.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://faction-os.gitbook.io/faction-os-docs/.spec_system/archive/sessions/phase19-session15-metrics-and-notifications/tasks.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
