> 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/phase22-session02-hero-attention-reducer/tasks.md).

# Task Checklist

**Session ID**: `phase22-session02-hero-attention-reducer` **Total Tasks**: 21 **Estimated Duration**: 3-4 hours **Created**: 2026-07-05

***

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

***

## Setup (3 tasks)

* [x] T001 \[S2202] Verify Session 01 validation evidence and dependency scope (`.spec_system/specs/phase22-session01-projection-contract/validation.md`)
* [x] T002 \[S2202] Review current projection contract, guards, and reducer seam (`apps/web/src/lib/gameProjection.ts`)
* [x] T003 \[S2202] Review protocol event shapes for hero, flare, legacy permission, guarded-action, and command-center permission inputs (`packages/protocol/src/events.ts`)

***

## Foundation (4 tasks)

* [x] T004 \[S2202] Add serializable attention ref types, defaults, validation guards, and Session 01 shape normalization with privacy-safe aggregate fields (`apps/web/src/lib/gameProjection.ts`)
* [x] T005 \[S2202] Add immutable hero projection helpers for creation, merge, and earned-field preservation with same-reference no-op behavior (`apps/web/src/lib/gameProjection.ts`)
* [x] T006 \[S2202] Add alert-focus ordering helpers for flare, gate, siege, ram, skirmisher, and new-camp tiers with deterministic tie-breaks (`apps/web/src/lib/gameProjection.ts`)
* [x] T007 \[S2202] Add typed Vitest event builders for hero lifecycle, flare, and gate reducer inputs (`apps/web/tests/gameProjection.test.ts`)

***

## Implementation (7 tasks)

* [x] T008 \[S2202] Implement hero lifecycle reduction for `internal_hero_spawn`, `roster_update`, and `hero_dismissed` with aggregate preservation and no roster source-of-truth copy (`apps/web/src/lib/gameProjection.ts`)
* [x] T009 \[S2202] Implement `awaiting_input` flare recording with prompt exclusion, ceremony window updates, duplicate-event handling, and replay-safe no-accumulation behavior (`apps/web/src/lib/gameProjection.ts`)
* [x] T010 \[S2202] Implement `input_received` flare clearing and `swiftCommand` mean updates with replay reconciliation but no replay progress minting (`apps/web/src/lib/gameProjection.ts`)
* [x] T011 \[S2202] Implement legacy `permission_request` and `permission_response` gate refs with rationale/detail exclusion and terminal clearing (`apps/web/src/lib/gameProjection.ts`)
* [x] T012 \[S2202] Implement `guarded_action_update` gate reconciliation for pending proposals and terminal proposal clearing with schema-aligned state handling (`apps/web/src/lib/gameProjection.ts`)
* [x] T013 \[S2202] Implement `command_center_permission_update` gate reconciliation for requested/in-flight entries and terminal entry clearing with exhaustive state handling (`apps/web/src/lib/gameProjection.ts`)
* [x] T014 \[S2202] Wire reducer finalization through `recomputeAlertFocus` while preserving exact state reference when no aggregate value changed (`apps/web/src/lib/gameProjection.ts`)

***

## Testing (7 tasks)

* [x] T015 \[S2202] Add tests for reducer purity, same-reference unchanged events, hero creation, roster reconciliation, and dismissal preservation (`apps/web/tests/gameProjection.test.ts`)
* [x] T016 \[S2202] Add tests for flare creation, duplicate flare handling, flare clearing, swift-command mean calculations, and replay-safe no-accumulation (`apps/web/tests/gameProjection.test.ts`)
* [x] T017 \[S2202] Add tests for legacy permission, guarded-action, and command-center permission gate refs, terminal clearing, and duplicate snapshot handling (`apps/web/tests/gameProjection.test.ts`)
* [x] T018 \[S2202] Add tests for `recomputeAlertFocus` priority promotion across flare, gate, siege, ram, skirmisher, new-camp, and null states (`apps/web/tests/gameProjection.test.ts`)
* [x] T019 \[S2202] Add parser compatibility and serialization privacy tests for attention refs and excluded prompt/rationale/detail strings (`apps/web/tests/gameProjection.test.ts`)
* [x] T020 \[S2202] Run focused reducer test command and fix any failures (`npm test -- apps/web/tests/gameProjection.test.ts`)
* [x] T021 \[S2202] Run web typecheck and ASCII/LF validation for changed code and session artifacts (`npm --workspace @factionos/web run typecheck`)

***

## 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 `implement` 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/phase22-session02-hero-attention-reducer/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.
