> For the complete documentation index, see [llms.txt](https://ai-os-and-trend-finder.gitbook.io/ai-os-and-trend-finder-docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://ai-os-and-trend-finder.gitbook.io/ai-os-and-trend-finder-docs/.spec_system/archive/sessions/phase40-session15-ministry-config-analytics-and-save-ux/tasks.md).

# Task Checklist

**Session ID**: `phase40-session15-ministry-config-analytics-and-save-ux` **Total Tasks**: 22 **Estimated Duration**: 3-4 hours **Created**: 2026-07-03

***

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

***

## Setup (2 tasks)

* [x] T001 \[S4015] Verify current Ministry shell, admin MoA action, model selector refresh contract, and model-intelligence fixture shape before edits (`src/components/hermes/ministry/ministry-save-copy-shell.tsx`, `src/hooks/use-hermes-admin.ts`, `src/components/hermes/chat/chat-types.ts`, `src/lib/hermes-demo-data.ts`)
* [x] T002 \[S4015] Prepare Ministry save/copy and analytics test fixtures for quoted model IDs, missing config, admin-disabled, demo-disabled, save success, and safe error states (`src/components/hermes/ministry/__tests__/ministry-config.test.ts`, `src/components/hermes/ministry/__tests__/ministry-analytics.test.ts`, `src/components/hermes/ministry/__tests__/ministry-builder.test.tsx`)

***

## Foundation (5 tasks)

* [x] T003 \[S4015] \[P] Create pure MoA config helpers that build validated Hermes v0.17 save payloads, YAML preview, and copy prompt text with schema-shaped input and explicit error mapping (`src/components/hermes/ministry/ministry-config.ts`)
* [x] T004 \[S4015] \[P] Create pure Ministry analytics helpers for cost, speed, benchmark, role coverage, fallback detection, provenance labels, and deterministic sorting (`src/components/hermes/ministry/ministry-analytics.ts`)
* [x] T005 \[S4015] Extend Ministry types for generated config, analytics summaries, validation results, save/copy feedback, and admin action props (`src/components/hermes/ministry/ministry-types.ts`)
* [x] T006 \[S4015] Export the new Ministry helper APIs for colocated tests without widening unrelated Hermes imports (`src/components/hermes/ministry/index.ts`)
* [x] T007 \[S4015] Add focused config and analytics unit coverage for YAML roundtrip, special-character IDs, missing seats, duplicate rows, fallback metrics, and live-vs-snapshot provenance (`src/components/hermes/ministry/__tests__/ministry-config.test.ts`, `src/components/hermes/ministry/__tests__/ministry-analytics.test.ts`)

***

## Implementation (8 tasks)

* [x] T008 \[S4015] Replace draft-only analytics with completed Ministry analytics cards, sorted row summaries, and static-versus-live provenance copy with explicit loading, empty, error, and demo-safe states (`src/components/hermes/ministry/ministry-analytics-shell.tsx`)
* [x] T009 \[S4015] Wire `MinistryBuilder` to derive config and analytics inputs from the active draft and reset save/copy feedback when draft data changes (`src/components/hermes/ministry/ministry-builder.tsx`)
* [x] T010 \[S4015] Pass the existing Hermes admin result into the Ministry builder while preserving current Pantheon persona state and workflows (`src/components/hermes/hermes-pantheon.tsx`, `src/components/hermes/ministry/ministry-builder.tsx`)
* [x] T011 \[S4015] Enable YAML and prompt copy controls with clipboard fallback and safe failure copy while keeping diagnostics out of the user-facing surface (`src/components/hermes/ministry/ministry-save-copy-shell.tsx`)
* [x] T012 \[S4015] Enable admin-gated MoA save through `admin.moa.savePreset` with duplicate-trigger prevention while in-flight (`src/components/hermes/ministry/ministry-save-copy-shell.tsx`)
* [x] T013 \[S4015] Render setup-required, admin-disabled, token-gated, offline, demo-disabled, validation-failure, pending, success, and safe error save states with product-facing copy only (`src/components/hermes/ministry/ministry-save-copy-shell.tsx`)
* [x] T014 \[S4015] Preserve model refresh after save by proving or extending `HERMES_QUERY_KEYS.models` invalidation on MoA save success (`src/hooks/use-hermes-admin.ts`, `src/hooks/__tests__/use-hermes-admin.test.tsx`)
* [x] T015 \[S4015] Keep chat selector MoA option behavior compatible with refreshed `models.mixtures` after a saved preset appears (`src/components/hermes/chat/chat-types.ts`, `src/components/hermes/chat/__tests__/hermes-chat-tab.test.tsx`)

***

## Testing (7 tasks)

* [x] T016 \[S4015] Test Ministry save/copy shell rendering for admin-disabled, token-gated, offline, demo-disabled, missing-config, and validation-failure states (`src/components/hermes/ministry/__tests__/ministry-builder.test.tsx`)
* [x] T017 \[S4015] Test copy success, clipboard fallback, and redacted copy failure behavior without raw exception text (`src/components/hermes/ministry/__tests__/ministry-builder.test.tsx`)
* [x] T018 \[S4015] Test direct save success, pending duplicate prevention, safe error copy, and generated request payload shape (`src/components/hermes/ministry/__tests__/ministry-builder.test.tsx`)
* [x] T019 \[S4015] Test model query invalidation after MoA save and selector rendering for refreshed MoA mixtures (`src/hooks/__tests__/use-hermes-admin.test.tsx`, `src/components/hermes/chat/__tests__/hermes-chat-tab.test.tsx`)
* [x] T020 \[S4015] Add a Hermes Pantheon route smoke for Ministry save/copy controls, demo read-only copy, and mobile layout stability (`tests/e2e/hermes-agent.spec.ts`)
* [x] T021 \[S4015] Run focused automated checks for Ministry, Hermes admin hook, chat selector, and Hermes route smoke (`bunx vitest run src/components/hermes/ministry/__tests__/ministry-config.test.ts src/components/hermes/ministry/__tests__/ministry-analytics.test.ts src/components/hermes/ministry/__tests__/ministry-builder.test.tsx src/hooks/__tests__/use-hermes-admin.test.tsx src/components/hermes/chat/__tests__/hermes-chat-tab.test.tsx`, `bunx playwright test tests/e2e/hermes-agent.spec.ts`)
* [x] T022 \[S4015] Run required project checks and ASCII/LF validation for planning and touched implementation files (`bun run typecheck`, `bun run lint`, `perl -ne 'exit 1 if /[^\x00-\x7F]/' .spec_system/specs/phase40-session15-ministry-config-analytics-and-save-ux/spec.md .spec_system/specs/phase40-session15-ministry-config-analytics-and-save-ux/tasks.md src/components/hermes/ministry/ministry-config.ts src/components/hermes/ministry/ministry-analytics.ts`)

***

## 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` (next step in 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://ai-os-and-trend-finder.gitbook.io/ai-os-and-trend-finder-docs/.spec_system/archive/sessions/phase40-session15-ministry-config-analytics-and-save-ux/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.
