> 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/specs/phase24-session05-scrying-and-alert-focus/implementation-notes.md).

# Implementation Notes

**Session ID**: `phase24-session05-scrying-and-alert-focus` **Package**: apps/web **Started**: 2026-07-08 17:24 **Last Updated**: 2026-07-08 17:52

***

## Session Progress

| Metric              | Value     |
| ------------------- | --------- |
| Tasks Completed     | 18 / 18   |
| Estimated Remaining | 0 minutes |
| Blockers            | 0         |

***

### Task T018 - Validate ASCII and LF requirements

**Started**: 2026-07-08 17:51 **Completed**: 2026-07-08 17:52 **Duration**: 1 minute

**Notes**:

* Validated session artifacts and touched web files for ASCII encoding and LF endings.

**Files Changed**:

* `.spec_system/specs/phase24-session05-scrying-and-alert-focus/implementation-notes.md` - recorded encoding evidence.
* `.spec_system/specs/phase24-session05-scrying-and-alert-focus/tasks.md` - marked T018 complete and completion checklist ready.

**Verification**:

* Command/check: `file ...; LC_ALL=C grep -nI '[^[:print:][:space:]]' ...; grep -nI $'\\r' ...`
  * Result: PASS - 10 files reported ASCII text/source and no non-ASCII or CRLF matches were found.
  * Evidence: Command printed `ASCII_LF_PASS 10 files`.
* UI product-surface check: N/A - encoding command only.
* UI craft check: N/A - encoding command only.

***

### Task T017 - Run root format check

**Started**: 2026-07-08 17:50 **Completed**: 2026-07-08 17:51 **Duration**: 1 minute

**Notes**:

* Ran root Biome format check.
* Fixed one wrapping issue in `Battlefield.test.tsx`, then reran successfully.

**Files Changed**:

* `apps/web/tests/Battlefield.test.tsx` - applied Biome wrapping for the test helper signature.
* `.spec_system/specs/phase24-session05-scrying-and-alert-focus/implementation-notes.md` - recorded format evidence.
* `.spec_system/specs/phase24-session05-scrying-and-alert-focus/tasks.md` - marked T017 complete.

**Verification**:

* Command/check: `npm run format:check`
  * Result: PASS - Biome checked 787 files with no fixes applied on rerun.
  * Evidence: Initial format failure was limited to one helper signature and was repaired.
* UI product-surface check: N/A - formatting command only.
* UI craft check: N/A - formatting command only.

***

### Task T016 - Run web package typecheck

**Started**: 2026-07-08 17:49 **Completed**: 2026-07-08 17:50 **Duration**: 1 minute

**Notes**:

* Ran the exact package typecheck command from the task checklist.

**Files Changed**:

* `.spec_system/specs/phase24-session05-scrying-and-alert-focus/implementation-notes.md` - recorded typecheck evidence.
* `.spec_system/specs/phase24-session05-scrying-and-alert-focus/tasks.md` - marked T016 complete.

**Verification**:

* Command/check: `npm --workspace apps/web run typecheck`
  * Result: PASS - `tsc -b --noEmit` exited successfully for `@factionos/web`.
  * Evidence: Command completed with exit code 0.
* UI product-surface check: N/A - verification command only.
* UI craft check: N/A - verification command only.

***

### Task T015 - Run focused Vitest targets

**Started**: 2026-07-08 17:48 **Completed**: 2026-07-08 17:49 **Duration**: 1 minute

**Notes**:

* Ran the exact focused target set from the task checklist.

**Files Changed**:

* `.spec_system/specs/phase24-session05-scrying-and-alert-focus/implementation-notes.md` - recorded test evidence.
* `.spec_system/specs/phase24-session05-scrying-and-alert-focus/tasks.md` - marked T015 complete.

**Verification**:

* Command/check: `npm test -- apps/web/tests/scryingAndAlertFocus.test.ts apps/web/tests/Battlefield.test.tsx apps/web/tests/BattlefieldInteraction.test.tsx`
  * Result: PASS - 3 test files passed, 49 tests passed.
  * Evidence: Vitest reported all focused scrying, Battlefield, and interaction targets passed.
* UI product-surface check: PASS - focused UI tests passed.
* UI craft check: PASS - reduced-motion and alert/scrying visual state tests passed.

***

### Task T014 - Add reduced-motion and accessible-state interaction tests

**Started**: 2026-07-08 17:46 **Completed**: 2026-07-08 17:48 **Duration**: 2 minutes

**Notes**:

* Added reduced-motion coverage for channeling posture, accessible token copy, static scrying treatment, and exactly one static alert focus ring.
* Fixed the default interaction fixture so ordinary active-state tests stay below the scrying threshold.

**Files Changed**:

* `apps/web/tests/BattlefieldInteraction.test.tsx` - added reduced-motion scrying and single focus tests plus deterministic event-log setup.
* `.spec_system/specs/phase24-session05-scrying-and-alert-focus/implementation-notes.md` - recorded task evidence.
* `.spec_system/specs/phase24-session05-scrying-and-alert-focus/tasks.md` - marked T014 complete.

**Verification**:

* Command/check: `npm test -- apps/web/tests/BattlefieldInteraction.test.tsx`
  * Result: PASS - 1 test file passed, 7 tests passed.
  * Evidence: Initial fixture failures were fixed by making the default mission fresh; rerun passed.
* Command/check: `sed -n '1,280p' apps/web/tests/BattlefieldInteraction.test.tsx`
  * Result: PASS - tests assert reduced-motion channeling badge/aria, no motion classes, single alert ring, and static focus summary.
  * Evidence: Test setup resets fake timers and event log.
* UI product-surface check: PASS - tests assert product-facing accessible state copy.
* UI craft check: PASS - reduced-motion parity is covered for both channeling posture and alert focus.

***

### Task T013 - Add Battlefield component tests

**Started**: 2026-07-08 17:44 **Completed**: 2026-07-08 17:46 **Duration**: 2 minutes

**Notes**:

* Added integration coverage for channeling appearance, clearing on recent activity, single alert ring rendering, focus promotion, and ten event-free minutes with no urgency ring.
* Adjusted the existing active-mission accessible-name test to use fresh activity so it remains a non-channeling case.

**Files Changed**:

* `apps/web/tests/Battlefield.test.tsx` - added scrying/alert tests and deterministic event-log setup.
* `.spec_system/specs/phase24-session05-scrying-and-alert-focus/implementation-notes.md` - recorded task evidence.
* `.spec_system/specs/phase24-session05-scrying-and-alert-focus/tasks.md` - marked T013 complete.

**Verification**:

* Command/check: `npm test -- apps/web/tests/Battlefield.test.tsx`
  * Result: PASS - 1 test file passed, 35 tests passed.
  * Evidence: Vitest reported `apps/web/tests/Battlefield.test.tsx (35 tests)`.
* Command/check: `sed -n '1,1275p' apps/web/tests/Battlefield.test.tsx`
  * Result: PASS - new tests assert channeling badge/aria, clearing, one alert ring, promotion from ram to skirmisher, and no alert ring during ten-minute calm.
  * Evidence: Tests use fake timers and explicit store state, no hosted services.
* UI product-surface check: PASS - tests assert channeling accessible labels avoid the raw mission prompt.
* UI craft check: PASS - tests cover stable state badges and product-facing alert summaries.

***

### Task T012 - Neutralize competing urgency pulse styles

**Started**: 2026-07-08 17:42 **Completed**: 2026-07-08 17:43 **Duration**: 1 minute

**Notes**:

* Converted active hero ring pulse to a static glow.
* Converted awaiting-input ping to a static dashed ring.
* Removed the live skirmisher pulse animation while preserving its static marker glow.
* Left combat playback as bounded short-lived effects, not persistent urgency pulses.

**Files Changed**:

* `apps/web/src/index.css` - re-scoped active, awaiting, error, and live skirmisher motion so persistent urgency is centralized in the alert-focus ring.
* `.spec_system/specs/phase24-session05-scrying-and-alert-focus/implementation-notes.md` - recorded task evidence.
* `.spec_system/specs/phase24-session05-scrying-and-alert-focus/tasks.md` - marked T012 complete.

**Verification**:

* Command/check: `npm run format:check`
  * Result: PASS - Biome checked 787 files with no fixes applied.
  * Evidence: Final formatted CSS/TS tree passed root formatting.
* Command/check: `rg -n "battlefield-token\\[data-state=\"active\"\\]|battlefield-token-ping|battlefield-live-skirmisher-motion|battlefield-alert-focus-motion" apps/web/src/index.css`
  * Result: PASS - active/awaiting/live skirmisher treatments are static; only `.battlefield-alert-focus-motion .battlefield-alert-focus-core` owns the persistent alert pulse.
  * Evidence: Existing reduced-motion overrides still remove new alert/scrying animations.
* UI product-surface check: PASS - no visual diagnostics or runtime labels were introduced.
* UI craft check: PASS - non-urgent static twins remain visible through ring, dashed, badge, and glow treatments.

***

### Task T011 - Add scrying, alert focus, and reduced-motion styles

**Started**: 2026-07-08 17:38 **Completed**: 2026-07-08 17:42 **Duration**: 4 minutes

**Notes**:

* Added scrying rune circle, channeling badge styling, single alert focus ring, alert label, and reduced-motion static twins.
* Kept dimensions bounded with fixed rem sizing and no viewport-scaled font sizes.

**Files Changed**:

* `apps/web/src/index.css` - added scrying rune, alert ring, channeling badge, reduced-motion static treatment, and keyframes.
* `apps/web/src/components/battlefield/Battlefield.tsx` - formatting fix from root format check.
* `apps/web/src/lib/scryingAndAlertFocus.ts` - formatting fix from root format check.
* `.spec_system/specs/phase24-session05-scrying-and-alert-focus/implementation-notes.md` - recorded task evidence.
* `.spec_system/specs/phase24-session05-scrying-and-alert-focus/tasks.md` - marked T011 complete.

**Verification**:

* Command/check: `npm run format:check`
  * Result: PASS - Biome checked 787 files with no fixes applied.
  * Evidence: Initial wrap-only format findings in `Battlefield.tsx` and `scryingAndAlertFocus.ts` were fixed before the passing rerun.
* Command/check: `sed -n '560,920p' apps/web/src/index.css` and `sed -n '1160,1225p' apps/web/src/index.css`
  * Result: PASS - CSS includes `.battlefield-scrying-rune`, `.battlefield-token-state-badge-channeling`, `.battlefield-alert-focus-ring`, reduced-motion overrides, and keyframes.
  * Evidence: Alert and scrying animations have static reduced-motion states.
* UI product-surface check: PASS - visible copy remains `channeling` and focus labels from helper; no diagnostics were added.
* UI craft check: PASS - stable rem-based marker sizes, bounded label width, uppercase chip treatment matching battlefield vocabulary.

***

### Task T010 - Integrate channeling posture into HeroToken

**Started**: 2026-07-08 17:36 **Completed**: 2026-07-08 17:38 **Duration**: 2 minutes

**Notes**:

* Passed the derived scrying view into each hero token.
* Updated visible badge, data attributes, selected-state copy, and accessible state detail to use `channeling` while preserving the underlying hero state.
* Avoided appending raw mission prompts to channeling token accessible labels.

**Files Changed**:

* `apps/web/src/components/battlefield/Battlefield.tsx` - added scrying map, token props, channeling treatment, data attributes, badge class, and aria copy.
* `.spec_system/specs/phase24-session05-scrying-and-alert-focus/implementation-notes.md` - recorded task evidence.
* `.spec_system/specs/phase24-session05-scrying-and-alert-focus/tasks.md` - marked T010 complete.

**Verification**:

* Command/check: `npm --workspace @factionos/web run typecheck`
  * Result: PASS - TypeScript build completed with `tsc -b --noEmit`.
  * Evidence: New token props and `ScryingHeroView` usage typechecked.
* Command/check: `sed -n '450,810p' apps/web/src/components/battlefield/Battlefield.tsx`
  * Result: PASS - channeling state appears in badge text, `data-scrying`, `data-scrying-state`, selected label, and accessible state detail.
  * Evidence: `buildHeroAriaLabel` omits raw mission prompt when channeling and uses product-facing `active mission channeling` copy.
* UI product-surface check: PASS - channeling copy is product-facing and no debug/diagnostic copy was added.
* UI craft check: PASS - badge uses existing hero state-badge location and stable dimensions.
* BQC Fixes: Error information boundaries - channeling accessible labels do not expose raw mission prompts.

***

### Task T009 - Pass derived presentations into layer ordering

**Started**: 2026-07-08 17:35 **Completed**: 2026-07-08 17:36 **Duration**: 1 minute

**Notes**:

* Derived the combined scrying/alert presentation from visible heroes, missions, event log, projection state, live Legion, ranked camps, and existing coordinate maps.
* Rendered `ScryingAndAlertFocusLayer` after live threats and before hero tokens in DOM, with `z-[28]` so visual focus sits above live/combat playback while pointer events remain disabled.

**Files Changed**:

* `apps/web/src/components/battlefield/Battlefield.tsx` - wired helper inputs and rendered `ScryingAndAlertFocusLayer`.
* `apps/web/src/components/battlefield/ScryingAndAlertFocusLayer.tsx` - set board-internal layer z-order to `z-[28]`.
* `.spec_system/specs/phase24-session05-scrying-and-alert-focus/implementation-notes.md` - recorded task evidence.
* `.spec_system/specs/phase24-session05-scrying-and-alert-focus/tasks.md` - marked T009 complete.

**Verification**:

* Command/check: `npm --workspace @factionos/web run typecheck`
  * Result: PASS - TypeScript build completed with `tsc -b --noEmit`.
  * Evidence: Combined presentation inputs align with store, projection, live Legion, and camp coordinate contracts.
* Command/check: `sed -n '200,490p' apps/web/src/components/battlefield/Battlefield.tsx` and `sed -n '1,80p' apps/web/src/components/battlefield/ScryingAndAlertFocusLayer.tsx`
  * Result: PASS - layer is rendered with `pointer-events-none`; no existing hero, camp, or wraith click handlers changed.
  * Evidence: `CampLayer`, `LiveLegionLayer`, hero buttons, and remote overlay remain mounted through their existing native controls.
* UI product-surface check: PASS - layer text is product-facing and contains no debug/readiness/runtime copy.
* UI craft check: PASS - layer is absolute and stable; visual styling lands with CSS task.

***

### Task T008 - Wire one shared Battlefield clock with cleanup

**Started**: 2026-07-08 17:33 **Completed**: 2026-07-08 17:35 **Duration**: 2 minutes

**Notes**:

* Added one `Battlefield` clock state using `SCRYING_CLOCK_TICK_MS`.
* Added interval cleanup on unmount through the owning `Battlefield` effect; child layers create no timers.

**Files Changed**:

* `apps/web/src/components/battlefield/Battlefield.tsx` - added shared battlefield clock state/effect.
* `apps/web/src/components/battlefield/ScryingAndAlertFocusLayer.tsx` - adjusted board-internal z-order for upcoming layer wiring.
* `.spec_system/specs/phase24-session05-scrying-and-alert-focus/implementation-notes.md` - recorded task evidence.
* `.spec_system/specs/phase24-session05-scrying-and-alert-focus/tasks.md` - marked T008 complete.

**Verification**:

* Command/check: `npm --workspace @factionos/web run typecheck`
  * Result: PASS - TypeScript build completed with `tsc -b --noEmit`.
  * Evidence: Shared clock state, interval effect, and helper imports typechecked.
* Command/check: `sed -n '120,330p' apps/web/src/components/battlefield/Battlefield.tsx`
  * Result: PASS - exactly one scrying clock interval is created in `Battlefield`, and cleanup calls `window.clearInterval`.
  * Evidence: No interval or timeout was added to `ScryingAndAlertFocusLayer`.
* UI product-surface check: PASS - no clock or timer diagnostics are rendered.
* UI craft check: PASS - clock is implementation-only and does not change layout by itself.
* BQC Fixes: Resource cleanup - interval ownership stays in `Battlefield` and releases on unmount.

***

### Task T007 - Create board-internal scrying and alert focus layer

**Started**: 2026-07-08 17:31 **Completed**: 2026-07-08 17:33 **Duration**: 2 minutes

**Notes**:

* Added a thin `ScryingAndAlertFocusLayer` renderer with product-facing summaries, scrying rune markers, and exactly one alert ring when a target exists.
* Layer is `pointer-events-none` so existing hero, camp, and live threat controls remain reachable.

**Files Changed**:

* `apps/web/src/components/battlefield/ScryingAndAlertFocusLayer.tsx` - added board-internal layer component and test-id helpers.
* `.spec_system/specs/phase24-session05-scrying-and-alert-focus/implementation-notes.md` - recorded task evidence.
* `.spec_system/specs/phase24-session05-scrying-and-alert-focus/tasks.md` - marked T007 complete.

**Verification**:

* Command/check: `npm --workspace @factionos/web run typecheck`
  * Result: PASS - TypeScript build completed with `tsc -b --noEmit`.
  * Evidence: New JSX component and helper prop contracts typechecked.
* Command/check: `sed -n '1,180p' apps/web/src/components/battlefield/ScryingAndAlertFocusLayer.tsx`
  * Result: PASS - layer renders summaries, scrying markers, calm state text, and one alert focus ring from `presentation.alertFocus`.
  * Evidence: No timers, no state writes, and `pointer-events-none` is present.
* UI product-surface check: PASS - visible copy is product-facing (`channeling`, board focus labels); no diagnostics or scaffolding copy.
* UI craft check: PASS - component is board-internal, stable-positioned, and reduced-motion-aware through data/classes; visual polish lands with CSS task.

***

### Task T006 - Write pure derivation tests

**Started**: 2026-07-08 17:29 **Completed**: 2026-07-08 17:31 **Duration**: 2 minutes

**Notes**:

* Added focused Vitest coverage for threshold edges, recent activity clearing, inactive/no-mission filtering, projection timestamp fallback, bounded labels, all alert focus kinds, stale refs, and ten event-free minutes without urgency.

**Files Changed**:

* `apps/web/tests/scryingAndAlertFocus.test.ts` - added pure helper tests.
* `.spec_system/specs/phase24-session05-scrying-and-alert-focus/implementation-notes.md` - recorded task evidence and checkpoint.
* `.spec_system/specs/phase24-session05-scrying-and-alert-focus/tasks.md` - marked T006 complete.

**Verification**:

* Command/check: `npm test -- apps/web/tests/scryingAndAlertFocus.test.ts`
  * Result: PASS - 1 test file passed, 7 tests passed.
  * Evidence: Vitest reported `apps/web/tests/scryingAndAlertFocus.test.ts (7 tests)`.
* Command/check: `sed -n '1,360p' apps/web/tests/scryingAndAlertFocus.test.ts`
  * Result: PASS - tests assert no focus on null/stale refs, one target per focus input, and calm scrying when `alertFocus` is null.
  * Evidence: Test cases exercise `flare`, `gate`, `siege`, `ram`, `skirmisher`, and `newCamp`.
* UI product-surface check: N/A - pure helper tests only.
* UI craft check: N/A - pure helper tests only.

***

## Checkpoints

### Checkpoint 1 - Foundation Helper Complete

**At**: 2026-07-08 17:31 **Tasks complete**: 6 / 18 **Checks run**:

* `npm --workspace @factionos/web run typecheck` - PASS after helper implementation.
* `npm test -- apps/web/tests/scryingAndAlertFocus.test.ts` - PASS, 7 tests. **Spec drift check**: PASS - work remains limited to presentation-only scrying and alert focus; no protocol events, server routes, storage keys, audio behavior, or reward logic added. **Next task**: T007 - create the board-internal `ScryingAndAlertFocusLayer`.

***

### Checkpoint 2 - Battlefield Wiring And Styling Complete

**At**: 2026-07-08 17:44 **Tasks complete**: 12 / 18 **Checks run**:

* `npm --workspace @factionos/web run typecheck` - PASS after component wiring and styling phase.
* `npm run format:check` - PASS, 787 files checked. **Spec drift check**: PASS - work remains presentation-only; no projection priority changes, protocol events, storage keys, routes, audio behavior, or reward logic added. **Next task**: T013 - add Battlefield component coverage for scrying and alert focus.

***

## Final Implementation Summary

**Completed**: 2026-07-08 17:52 **Tasks Completed**: 18 / 18 **Blockers**: 0

**Delivered**:

* Pure scrying and alert-focus derivation in `apps/web/src/lib/scryingAndAlertFocus.ts`.
* Board-internal `ScryingAndAlertFocusLayer` with product-facing summaries, channeling runes, and one alert ring.
* `Battlefield` shared clock, helper wiring, hero-token channeling state, and layer ordering.
* CSS for channeling badge, scrying rune, alert focus ring, reduced-motion twins, and static non-urgent state treatments.
* Focused helper, component, and reduced-motion interaction coverage.

**Final checks**:

* `npm test -- apps/web/tests/scryingAndAlertFocus.test.ts apps/web/tests/Battlefield.test.tsx apps/web/tests/BattlefieldInteraction.test.tsx` - PASS, 3 files / 49 tests.
* `npm --workspace apps/web run typecheck` - PASS.
* `npm run format:check` - PASS, 787 files checked.
* ASCII/LF validation command - PASS, 10 files.
* `git diff --check` - PASS.

**Next command**: `creview`

***

### Task T005 - Implement alert focus target resolution

**Started**: 2026-07-08 17:27 **Completed**: 2026-07-08 17:29 **Duration**: 2 minutes

**Notes**:

* Added `resolveAlertFocusTarget` and `buildScryingAndAlertFocusPresentation`.
* Mapped focus kinds to existing coordinates: flare/gate hero coordinates, gate fallback keep anchor, siege/ram anchors, live skirmisher coordinates, and camp coordinates.
* Kept projection `alertFocus` as the only priority authority.

**Files Changed**:

* `apps/web/src/lib/scryingAndAlertFocus.ts` - implemented alert target resolution and combined presentation builder.
* `.spec_system/specs/phase24-session05-scrying-and-alert-focus/implementation-notes.md` - recorded task evidence.
* `.spec_system/specs/phase24-session05-scrying-and-alert-focus/tasks.md` - marked T005 complete.

**Verification**:

* Command/check: `npm --workspace @factionos/web run typecheck`
  * Result: PASS - TypeScript build completed with `tsc -b --noEmit`.
  * Evidence: Imports from projection, live Legion, and camp contracts typechecked.
* Command/check: `sed -n '1,320p' apps/web/src/lib/scryingAndAlertFocus.ts`
  * Result: PASS - resolver handles flare, gate, siege, ram, skirmisher, and newCamp with deterministic null for stale missing refs.
  * Evidence: No local priority recomputation; switch branches only map the existing `alertFocus`.
* UI product-surface check: N/A - pure helper module only.
* UI craft check: N/A - pure helper module only.

***

### Task T004 - Implement per-hero scrying activity derivation

**Started**: 2026-07-08 17:25 **Completed**: 2026-07-08 17:27 **Duration**: 2 minutes

**Notes**:

* Added `buildScryingHeroViews` to derive channeling heroes from active heroes, active mission records, matching hero/mission event-log entries, and bounded fallback timestamps.
* Kept labels product-facing by using bounded hero/state copy only; mission prompts and event payloads are not rendered.

**Files Changed**:

* `apps/web/src/lib/scryingAndAlertFocus.ts` - implemented scrying derivation and safe label helpers.
* `.spec_system/specs/phase24-session05-scrying-and-alert-focus/implementation-notes.md` - recorded task evidence.
* `.spec_system/specs/phase24-session05-scrying-and-alert-focus/tasks.md` - marked T004 complete.

**Verification**:

* Command/check: `npm --workspace @factionos/web run typecheck`
  * Result: PASS - TypeScript build completed with `tsc -b --noEmit`.
  * Evidence: Protocol event union narrowing and exported helper types typechecked.
* Command/check: `sed -n '1,220p' apps/web/src/lib/scryingAndAlertFocus.ts`
  * Result: PASS - helper checks active mission presence, ignores inactive heroes, applies `> SCRYING_SILENCE_THRESHOLD_MS`, and sorts deterministic output.
  * Evidence: Per-hero event matching covers tool, mission, hero, input, and permission request activity without consuming raw payload labels.
* UI product-surface check: N/A - pure helper module only.
* UI craft check: N/A - pure helper module only.
* BQC Fixes: Contract alignment - kept projection `lastEventAt` as a final fallback only so unrelated global events do not reset a hero that already has mission or hero activity timestamps.

***

### Task T003 - Create presentation types and named constants

**Started**: 2026-07-08 17:24 **Completed**: 2026-07-08 17:25 **Duration**: 1 minute

**Notes**:

* Added the pure helper module skeleton with the design threshold constant (`SCRYING_SILENCE_THRESHOLD_MS = 20_000`), shared clock cadence, label bounds, and view/input contracts.

**Files Changed**:

* `apps/web/src/lib/scryingAndAlertFocus.ts` - added exported presentation types and constants.
* `.spec_system/specs/phase24-session05-scrying-and-alert-focus/implementation-notes.md` - recorded task evidence.
* `.spec_system/specs/phase24-session05-scrying-and-alert-focus/tasks.md` - marked T003 complete.

**Verification**:

* Command/check: `sed -n '1,70p' docs/game-design/09-risk-boredom-and-integrity-audit.md`
  * Result: PASS - design source defines scrying posture after more than 20 seconds of active mission silence.
  * Evidence: Constant uses `20_000` ms.
* Command/check: `sed -n '1,120p' apps/web/src/lib/scryingAndAlertFocus.ts`
  * Result: PASS - module exports threshold, tick, label bounds, scrying view, alert focus target, and helper input contracts.
  * Evidence: Types compile structurally against existing protocol/projection imports.
* UI product-surface check: N/A - pure type module only.
* UI craft check: N/A - pure type module only.

***

### Task T002 - Confirm current alert-focus and hero-activity contracts

**Started**: 2026-07-08 17:24 **Completed**: 2026-07-08 17:24 **Duration**: 1 minute

**Notes**:

* Confirmed `GameProjection.alertFocus` is recomputed by projection state and prioritizes flare, gate, siege, ram, skirmisher, then new camp.
* Confirmed `useGameStore` exposes heroes, missions, event log, and game projection slices consumed by `Battlefield`.
* Confirmed existing projection tests cover focus priority and clearing behavior for the projection layer.

**Files Changed**:

* `.spec_system/specs/phase24-session05-scrying-and-alert-focus/implementation-notes.md` - recorded setup evidence.
* `.spec_system/specs/phase24-session05-scrying-and-alert-focus/tasks.md` - marked T002 complete.

**Verification**:

* Command/check: `sed -n '1,230p' apps/web/src/lib/gameProjection.ts` and `sed -n '1200,1320p' apps/web/src/lib/gameProjection.ts`
  * Result: PASS - projection types include `GameProjectionAlertFocus`, `GameProjectionAttention`, `lastEventAt`, and deterministic focus selectors.
  * Evidence: `recomputeAlertFocus` delegates to flare, gate, and live projection focus selectors.
* Command/check: `sed -n '640,730p' apps/web/src/store/useGameStore.ts` and `sed -n '2740,2795p' apps/web/src/store/useGameStore.ts`
  * Result: PASS - store keeps `eventLog`, heroes, missions, and game projection; `applyEvent` appends timestamped events before projection folding.
  * Evidence: `ReplayEntry` is `{ at: number; event: ServerEvent }`, matching helper input needs.
* Command/check: `rg -n "alertFocus|lastEventAt|attention" apps/web/tests/gameProjection.test.ts`
  * Result: PASS - tests assert focus priority, clearing, persistence parsing, and last-event updates.
  * Evidence: Existing tests include focus clearing from ram to skirmisher, camp fallback, and null focus.
* UI product-surface check: N/A - task only inspected contracts.
* UI craft check: N/A - task only inspected contracts.

***

### Task T001 - Verify prerequisite session artifacts and live battlefield files

**Started**: 2026-07-08 17:22 **Completed**: 2026-07-08 17:24 **Duration**: 2 minutes

**Notes**:

* Confirmed Session 03 and Session 04 validation artifacts both report PASS.
* Confirmed `Battlefield.tsx` currently wires camps, scanner state, live Legion, hero tokens, combat playback, remote overlays, and achievement layers.

**Files Changed**:

* `.spec_system/specs/phase24-session05-scrying-and-alert-focus/implementation-notes.md` - recorded setup evidence.
* `.spec_system/specs/phase24-session05-scrying-and-alert-focus/tasks.md` - marked T001 complete.

**Verification**:

* Command/check: `sed -n '1,260p' .spec_system/specs/phase24-session03-live-enemy-presentation/validation.md`
  * Result: PASS - validation report has `Result: PASS` and 20/20 tasks complete.
  * Evidence: Prior live enemy layer deliverables and focused/full tests passed in that report.
* Command/check: `sed -n '1,260p' .spec_system/specs/phase24-session04-combat-playback-effects-layer/validation.md`
  * Result: PASS - validation report has `Result: PASS` and 22/22 tasks complete.
  * Evidence: Prior combat playback deliverables, focused tests, typecheck, and format checks passed in that report.
* Command/check: `sed -n '1,807p' apps/web/src/components/battlefield/Battlefield.tsx`
  * Result: PASS - component contains existing layer ordering, hero token controls, and timer cleanup patterns needed by this session.
  * Evidence: Inspected `CampLayer`, `ScannerStateLayer`, `LiveLegionLayer`, hero layer, `CombatPlaybackLayer`, remote overlay, and achievement cleanup effects.
* UI product-surface check: N/A - task only inspected existing surfaces.
* UI craft check: N/A - task only inspected existing surfaces.

***

## Task Log

### 2026-07-08 - Session Start

**Environment verified**:

* [x] Prerequisites confirmed
* [x] Tools available
* [x] Directory structure ready

**Evidence**:

* `if [ -d .spec_system/scripts ]; then bash .spec_system/scripts/analyze-project.sh --json; else bash /home/aiwithapex/.codex/plugins/cache/apexdev/apex-spec/2.2.19-codex/skills/apex-spec/scripts/analyze-project.sh --json; fi`
  * Result: PASS - current session `phase24-session05-scrying-and-alert-focus`, monorepo true, package `apps/web`.
* `if [ -d .spec_system/scripts ]; then bash .spec_system/scripts/check-prereqs.sh --json --env --package apps/web; else bash /home/aiwithapex/.codex/plugins/cache/apexdev/apex-spec/2.2.19-codex/skills/apex-spec/scripts/check-prereqs.sh --json --env --package apps/web; fi`
  * Result: PASS - spec system, jq, git, workspace npm, and `apps/web` manifest present.

***


---

# 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/specs/phase24-session05-scrying-and-alert-focus/implementation-notes.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.
