> 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/phase23-session06-battlefield-camp-layer/implementation-notes.md).

# Implementation Notes

**Session ID**: `phase23-session06-battlefield-camp-layer` **Package**: apps/web **Started**: 2026-07-05 20:11 **Last Updated**: 2026-07-05 21:28

***

## Session Progress

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

***

## Task Log

### 2026-07-05 - Session Start

**Environment verified**:

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

***

### Task T001 - Verify analyzer state, prerequisites, package context, and base commit

**Started**: 2026-07-05 20:10 **Completed**: 2026-07-05 20:11 **Duration**: 1 minute

**Notes**:

* Analyzer selected `phase23-session06-battlefield-camp-layer` with package `apps/web`; spec header also declares `Package: apps/web`.
* Base commit `9bd52bab83a07b4ca415b0d864f8df491d9b1194` matches current `HEAD`; prerequisites Sessions 02, 03, 05, and 22/05 are marked complete in the spec.
* Shell default Node was `v24.14.0`; `nvm use 26.2.0` resolves the repo-required runtime for verification commands.

**Files Changed**:

* `.spec_system/specs/phase23-session06-battlefield-camp-layer/implementation-notes.md` - created session progress log and T001 evidence.

**Verification**:

* Command/check: `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.18-codex/skills/apex-spec/scripts/analyze-project.sh --json; fi`
  * Result: PASS - current session, package list, phase state, and candidate session data returned.
  * Evidence: `current_session` is `phase23-session06-battlefield-camp-layer`; session dir exists with `spec.md` and `tasks.md`; package stub is `apps/web`.
* Command/check: `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.18-codex/skills/apex-spec/scripts/check-prereqs.sh --json --env --package apps/web; fi`
  * Result: PASS - spec system, jq, git, package directory, package manifest, and npm workspace manager checks passed.
  * Evidence: checker returned `"overall": "pass"` and no issues.
* Command/check: `source "$HOME/.nvm/nvm.sh" && nvm install 26.2.0 && nvm use 26.2.0 && node -v && npm -v`
  * Result: PASS - declared runtime is available.
  * Evidence: output showed `v26.2.0` and npm `11.16.0`.
* Command/check: `git rev-parse HEAD` and `git merge-base --is-ancestor 9bd52bab83a07b4ca415b0d864f8df491d9b1194 HEAD`
  * Result: PASS - base commit is current and an ancestor of `HEAD`.
  * Evidence: `git rev-parse HEAD` returned `9bd52bab83a07b4ca415b0d864f8df491d9b1194`; merge-base check printed `base-is-ancestor`.
* UI product-surface check: N/A - setup verification only.
* UI craft check: N/A - setup verification only.

***

### Task T002 - Review battlefield layering and reduced-motion hooks

**Started**: 2026-07-05 20:11 **Completed**: 2026-07-05 20:12 **Duration**: 1 minute

**Notes**:

* Existing board order is backdrop/grid, empty terrain button at `z-10`, hero token container at `z-20`, then remote and achievement overlays.
* Empty terrain clearing is disabled when no hero is selected and remains a native button with a focus-visible ring.
* Reduced motion is driven by `reduceMotion`, `battlefield2d-reduce-motion`, and `data-reduced-motion`; CSS already disables token and achievement animations in that mode.

**Files Changed**:

* `.spec_system/specs/phase23-session06-battlefield-camp-layer/implementation-notes.md` - added T002 review evidence.
* `.spec_system/specs/phase23-session06-battlefield-camp-layer/tasks.md` - marked T002 complete.

**Verification**:

* Command/check: `sed -n '1,760p' apps/web/src/components/battlefield/Battlefield.tsx`
  * Result: PASS - board layering, hero token rendering, clear-selection button, and reduced-motion prop usage inspected.
  * Evidence: `battlefield-empty-clear` is `absolute inset-0 z-10`; hero token wrapper is `absolute inset-0 z-20`; frame receives `battlefield2d-reduce-motion` and `data-reduced-motion`.
* Command/check: `sed -n '220,560p' apps/web/src/index.css`
  * Result: PASS - battlefield token state styles, focus rings, and reduced-motion animation overrides inspected.
  * Evidence: `.battlefield2d-reduce-motion` disables token and achievement animations while preserving static state rings.
* Command/check: `sed -n '1,760p' apps/web/tests/Battlefield.test.tsx`
  * Result: PASS - existing tests cover hero selection, empty-terrain clearing, fallback rendering, and reduced-motion state.
  * Evidence: tests assert clear button behavior and `battlefield2d-reduce-motion` class presence.
* UI product-surface check: PASS - reviewed battlefield labels and layer copy; no new surface copy added in this task.
* UI craft check: PASS - existing hierarchy and reduced-motion behavior understood for integration.

***

### Task T003 - Review Quest Board camp focus and Banish store actions

**Started**: 2026-07-05 20:12 **Completed**: 2026-07-05 20:13 **Duration**: 1 minute

**Notes**:

* `focusQuestBoardCamp(input)` normalizes camp id, issue ids, labels, sector label, and tier label, then expands the existing Quest Board surface.
* `banishQuestBoardCamp()` uses the current focus, selects dismissable current issue cards, guards camp and issue action keys while pending, performs bounded dismiss calls, and rolls back failed optimistic removals.
* Battlefield wiring should pass focus input first, then call `banishQuestBoardCamp()` without duplicating mutation semantics.

**Files Changed**:

* `.spec_system/specs/phase23-session06-battlefield-camp-layer/implementation-notes.md` - added T003 store-action evidence.
* `.spec_system/specs/phase23-session06-battlefield-camp-layer/tasks.md` - marked T003 complete.

**Verification**:

* Command/check: `rg -n "focusQuestBoardCamp|clearQuestBoardCampFocus|banishQuestBoardCamp|questBoardCamp|Banish|banish" apps/web/src/store/useGameStore.ts`
  * Result: PASS - relevant store interfaces, selectors, and implementations located.
  * Evidence: focus/Banish declarations are at `useGameStore.ts`; implementation starts at `focusQuestBoardCamp(input)` and `async banishQuestBoardCamp()`.
* Command/check: `sed -n '1508,1605p' apps/web/src/store/useGameStore.ts` and `sed -n '3500,3625p' apps/web/src/store/useGameStore.ts`
  * Result: PASS - normalizers, target selectors, duplicate-pending checks, optimistic removal, and rollback paths inspected.
  * Evidence: `isQuestBoardCampBanishPending` checks camp and issue action keys; `banishQuestBoardCamp` returns false for duplicates and clears action keys in `finally`.
* Command/check: `sed -n '450,690p' apps/web/tests/questBoardStore.test.ts`
  * Result: PASS - existing tests prove focus filtering, no projection side effects, optimistic cleanup, rollback, partial failure, and duplicate rejection.
  * Evidence: tests assert no `localStorage` writes, projection identity unchanged, and duplicate Banish avoids fetch.
* UI product-surface check: PASS - existing Quest Board action copy is product-facing; battlefield will reuse it rather than expose diagnostics.
* UI craft check: PASS - callback path preserves same-instance focused Quest Board behavior.

***

### Task T004 - Create CampLayer props, tier copy, test ids, and shell

**Started**: 2026-07-05 20:14 **Completed**: 2026-07-05 20:18 **Duration**: 4 minutes

**Notes**:

* Added presentation-only `CampLayer` with explicit props, tier copy, count/roster test ids, and no projection or store knowledge.
* Shell exposes reduced-motion and roster-mode attributes without rendering marker controls yet.
* Applied a Biome-requested function-signature formatting fix.

**Files Changed**:

* `apps/web/src/components/battlefield/CampLayer.tsx` - created component props, tier copy, test-id helpers, and layer shell.
* `.spec_system/specs/phase23-session06-battlefield-camp-layer/implementation-notes.md` - added T004 implementation evidence.
* `.spec_system/specs/phase23-session06-battlefield-camp-layer/tasks.md` - marked T004 complete.

**Verification**:

* Command/check: `source "$HOME/.nvm/nvm.sh" && nvm use 26.2.0 >/dev/null && npm --workspace @factionos/web run typecheck`
  * Result: PASS - web TypeScript project accepts the new file contract.
  * Evidence: `tsc -b --noEmit` completed successfully.
* Command/check: `source "$HOME/.nvm/nvm.sh" && nvm use 26.2.0 >/dev/null && npx biome check apps/web/src/components/battlefield/CampLayer.tsx`
  * Result: PASS after fix - focused Biome check passed.
  * Evidence: first run reported one format-only signature change; after applying it, output was `Checked 1 file in 3ms. No fixes applied.`
* UI product-surface check: PASS - shell contains only hidden count/roster text and product-facing scanner camp labels.
* UI craft check: PASS - component remains unrendered in the app until marker layout and CSS are added.
* BQC Fixes:
  * Accessibility and platform compliance: explicit props keep future controls native and testable (`apps/web/src/components/battlefield/CampLayer.tsx`).

***

### Task T005 - Implement deterministic sector-cell and entrenched edge placement helpers

**Started**: 2026-07-05 20:18 **Completed**: 2026-07-05 20:22 **Duration**: 4 minutes

**Notes**:

* Added pure helpers that map ranked camp `sector.cell` values onto the 24-cell battlefield grid.
* Entrenched camps using selector metadata `placement: "edge"` are pushed to a stable board edge while preserving their sector-derived row/column context.
* Added defensive fallback placement only for missing or invalid sector cells; normal rendering stays selector-led.

**Files Changed**:

* `apps/web/src/components/battlefield/CampLayer.tsx` - added placement constants, `resolveCampPlacement`, `campPlacementStyle`, cell guard, edge placement, and stable fallback cell helper.
* `.spec_system/specs/phase23-session06-battlefield-camp-layer/implementation-notes.md` - added T005 evidence.
* `.spec_system/specs/phase23-session06-battlefield-camp-layer/tasks.md` - marked T005 complete.

**Verification**:

* Command/check: `source "$HOME/.nvm/nvm.sh" && nvm use 26.2.0 >/dev/null && npx biome check apps/web/src/components/battlefield/CampLayer.tsx`
  * Result: PASS after fixes - focused Biome check passed.
  * Evidence: initial run flagged formatting; final output was `Checked 1 file in 3ms. No fixes applied.`
* Command/check: `source "$HOME/.nvm/nvm.sh" && nvm use 26.2.0 >/dev/null && npm --workspace @factionos/web run typecheck`
  * Result: PASS after fixes - TypeScript accepts the placement helpers.
  * Evidence: initial run found an insufficient `sectorCell` narrowing; final `tsc -b --noEmit` completed successfully.
* UI product-surface check: PASS - no debug or raw issue data is rendered; helpers only compute marker placement.
* UI craft check: PASS - field and edge coordinates leave margins for labels and hero foregrounding.
* BQC Fixes:
  * Contract alignment: added explicit `typeof sectorCell === "number"` guard before accepting selector cell data (`apps/web/src/components/battlefield/CampLayer.tsx`).

***

### Task T006 - Render native camp marker buttons with accessible labels and chips

**Started**: 2026-07-05 20:22 **Completed**: 2026-07-05 20:27 **Duration**: 5 minutes

**Notes**:

* Rendered each ranked camp as a native inspect button positioned by the placement helpers.
* Accessible names include tier, sector label, HP, and current issue count.
* Visible copy stays compact and product-facing: tier, sector, HP chip, and issue-count chip only.

**Files Changed**:

* `apps/web/src/components/battlefield/CampLayer.tsx` - added marker rendering, inspect button callback, sector labels, accessible-name helper, HP helper, and chip/test-id elements.
* `.spec_system/specs/phase23-session06-battlefield-camp-layer/implementation-notes.md` - added T006 evidence.
* `.spec_system/specs/phase23-session06-battlefield-camp-layer/tasks.md` - marked T006 complete.

**Verification**:

* Command/check: `source "$HOME/.nvm/nvm.sh" && nvm use 26.2.0 >/dev/null && npm --workspace @factionos/web run typecheck`
  * Result: PASS - web TypeScript project accepts native marker rendering.
  * Evidence: `tsc -b --noEmit` completed successfully.
* Command/check: `source "$HOME/.nvm/nvm.sh" && nvm use 26.2.0 >/dev/null && npx biome check apps/web/src/components/battlefield/CampLayer.tsx`
  * Result: PASS after fix - focused Biome check passed.
  * Evidence: first run requested one line break; final output was `Checked 1 file in 5ms. No fixes applied.`
* UI product-surface check: PASS - marker copy contains no raw issue titles, prompts, paths beyond safe sector labels, diagnostics, or debug wording.
* UI craft check: PASS - compact labels and chips are structured for battlefield scanning and later CSS treatment.
* BQC Fixes:
  * Accessibility and platform compliance: marker interaction is a native `button` with a complete accessible name (`apps/web/src/components/battlefield/CampLayer.tsx`).

***

### Task T007 - Add sibling dry Banish controls without nested interactive elements

**Started**: 2026-07-05 20:27 **Completed**: 2026-07-05 20:30 **Duration**: 3 minutes

**Notes**:

* Added a separate Banish button as a sibling of the inspect button for each camp marker.
* Banish controls delegate `campId` and `issueIds` to props; they do not implement duplicate prevention, optimistic removal, or rollback locally.
* Click handlers stop propagation so terrain clearing and inspect activation do not fire from Banish clicks.

**Files Changed**:

* `apps/web/src/components/battlefield/CampLayer.tsx` - added sibling dry Banish control with accessible name and callback delegation.
* `.spec_system/specs/phase23-session06-battlefield-camp-layer/implementation-notes.md` - added T007 evidence.
* `.spec_system/specs/phase23-session06-battlefield-camp-layer/tasks.md` - marked T007 complete.

**Verification**:

* Command/check: `source "$HOME/.nvm/nvm.sh" && nvm use 26.2.0 >/dev/null && npx biome check apps/web/src/components/battlefield/CampLayer.tsx`
  * Result: PASS - focused Biome check passed.
  * Evidence: output was `Checked 1 file in 4ms. No fixes applied.`
* Command/check: `source "$HOME/.nvm/nvm.sh" && nvm use 26.2.0 >/dev/null && npm --workspace @factionos/web run typecheck`
  * Result: PASS - web TypeScript project accepts the sibling Banish callback path.
  * Evidence: `tsc -b --noEmit` completed successfully.
* UI product-surface check: PASS - Banish copy is product-facing and contains no raw issue or diagnostic detail.
* UI craft check: PASS - Banish action is visually secondary to inspect and prepared for CSS treatment.
* BQC Fixes:
  * Duplicate action prevention: mutation semantics stay delegated to the existing store action that already guards in-flight camp and issue dismissals (`apps/web/src/components/battlefield/CampLayer.tsx`).

***

### Task T008 - Expose camp layer data hooks

**Started**: 2026-07-05 20:30 **Completed**: 2026-07-05 20:34 **Duration**: 4 minutes

**Notes**:

* Added explicit data hooks for layer count, roster mode, visible limit, reduced-motion state, marker identity, placement, rank, HP, max HP, issues, muted, and entrenched metadata.
* Added a per-marker reduced-motion hook so tests can assert static equivalents without depending on CSS parsing.

**Files Changed**:

* `apps/web/src/components/battlefield/CampLayer.tsx` - expanded data attributes and test ids for layer, marker, placement, and reduced-motion assertions.
* `.spec_system/specs/phase23-session06-battlefield-camp-layer/implementation-notes.md` - added T008 evidence.
* `.spec_system/specs/phase23-session06-battlefield-camp-layer/tasks.md` - marked T008 complete.

**Verification**:

* Command/check: `source "$HOME/.nvm/nvm.sh" && nvm use 26.2.0 >/dev/null && npx biome check apps/web/src/components/battlefield/CampLayer.tsx`
  * Result: PASS - focused Biome check passed.
  * Evidence: output was `Checked 1 file in 5ms. No fixes applied.`
* Command/check: `source "$HOME/.nvm/nvm.sh" && nvm use 26.2.0 >/dev/null && npm --workspace @factionos/web run typecheck`
  * Result: PASS - web TypeScript project accepts the expanded hooks.
  * Evidence: `tsc -b --noEmit` completed successfully.
* UI product-surface check: PASS - hooks are attributes/hidden status only and add no visible diagnostics.
* UI craft check: PASS - tests can inspect layout behavior without adding visible implementation telemetry.
* BQC Fixes:
  * Contract alignment: marker attributes mirror selector fields needed by battlefield tests (`apps/web/src/components/battlefield/CampLayer.tsx`).

***

### Checkpoint - Foundation Complete

**At**: 2026-07-05 20:35

**Checks**:

* Command/check: `source "$HOME/.nvm/nvm.sh" && nvm use 26.2.0 >/dev/null && npm test -- apps/web/tests/Battlefield.test.tsx`
  * Result: PASS - existing battlefield suite still passes before CampLayer integration.
  * Evidence: 1 test file passed, 17 tests passed.
* Command/check: `sed -n '20,320p' .spec_system/specs/phase23-session06-battlefield-camp-layer/spec.md`
  * Result: PASS - objectives, scope, success criteria, and testing strategy re-read.
  * Evidence: no scope drift found; current work remains presentation-only and does not add protocol/storage/server/art/reward behavior.

**Next Task**: T009 - Add CSS-only camp marker, tier, chip, muted, edge-placement, and focus-visible styles.

***

### Task T009 - Add CSS-only camp marker, tier, chip, muted, edge, and focus styles

**Started**: 2026-07-05 20:35 **Completed**: 2026-07-05 20:40 **Duration**: 5 minutes

**Notes**:

* Added the camp layer z-index band, marker positioning, edge anchoring, muted treatment, tier-specific CSS-only silhouettes, chips, secondary Banish styling, and focus-visible shadows.
* Styling uses CSS variables and existing cockpit colors rather than new assets.

**Files Changed**:

* `apps/web/src/index.css` - added camp layer, marker, button, chip, tier, muted, edge, responsive, and focus-visible styles.
* `.spec_system/specs/phase23-session06-battlefield-camp-layer/implementation-notes.md` - added T009 evidence.
* `.spec_system/specs/phase23-session06-battlefield-camp-layer/tasks.md` - marked T009 complete.

**Verification**:

* Command/check: `source "$HOME/.nvm/nvm.sh" && nvm use 26.2.0 >/dev/null && npx biome check apps/web/src/index.css`
  * Result: PASS after fix - focused Biome CSS check passed.
  * Evidence: first run requested `clip-path` wrapping; final output was `Checked 1 file in 5ms. No fixes applied.`
* UI product-surface check: PASS - styles add no visible debug copy, diagnostics, or raw issue details.
* UI craft check: PASS - marker hierarchy uses tier size/color, compact chips, muted entrenched treatment, edge anchoring, and visible focus states.
* BQC Fixes:
  * Accessibility and platform compliance: focus-visible styling covers both inspect and Banish controls (`apps/web/src/index.css`).

***

### Task T010 - Add reduced-motion camp styles

**Started**: 2026-07-05 20:40 **Completed**: 2026-07-05 20:43 **Duration**: 3 minutes

**Notes**:

* Added marker-specific reduced-motion rules that remove animation, transition, and hover travel from camp controls.
* Static tier silhouettes, labels, HP chips, and issue chips remain visible in reduced-motion mode.

**Files Changed**:

* `apps/web/src/index.css` - added camp reduced-motion overrides for marker, inspect, Banish, silhouette, chips, and muted treatment.
* `.spec_system/specs/phase23-session06-battlefield-camp-layer/implementation-notes.md` - added T010 evidence.
* `.spec_system/specs/phase23-session06-battlefield-camp-layer/tasks.md` - marked T010 complete.

**Verification**:

* Command/check: `source "$HOME/.nvm/nvm.sh" && nvm use 26.2.0 >/dev/null && npx biome check apps/web/src/index.css`
  * Result: PASS - focused Biome CSS check passed.
  * Evidence: output was `Checked 1 file in 6ms. No fixes applied.`
* UI product-surface check: PASS - reduced-motion rules add no visible diagnostics or development copy.
* UI craft check: PASS - reduced-motion mode keeps static marker, tier, HP, issue, and muted presentation visible.
* BQC Fixes:
  * Accessibility and platform compliance: camp controls no longer rely on transition or hover travel for meaning in reduced-motion mode (`apps/web/src/index.css`).

***

### Task T011 - Derive ranked visible camps in Battlefield

**Started**: 2026-07-05 20:43 **Completed**: 2026-07-05 20:49 **Duration**: 6 minutes

**Notes**:

* `Battlefield` now reads `gameProjection` and `questSuggestions` from the store and derives `rankedCamps` via `rankVisibleLegionCamps`.
* Added a narrow Quest Board card adapter for issue freshness context; it uses dismissable issue ids and timestamps only, not rich issue copy.
* Board data attributes expose current camp count and visible limit for focused assertions before the visual layer is inserted.

**Files Changed**:

* `apps/web/src/components/battlefield/Battlefield.tsx` - added projection/card selectors, issue-context adapter, ranked camp memo, and board data hooks.
* `.spec_system/specs/phase23-session06-battlefield-camp-layer/implementation-notes.md` - added T011 evidence.
* `.spec_system/specs/phase23-session06-battlefield-camp-layer/tasks.md` - marked T011 complete.

**Verification**:

* Command/check: `source "$HOME/.nvm/nvm.sh" && nvm use 26.2.0 >/dev/null && npx biome check apps/web/src/components/battlefield/Battlefield.tsx`
  * Result: PASS - focused Biome check passed.
  * Evidence: output was `Checked 1 file in 7ms. No fixes applied.`
* Command/check: `source "$HOME/.nvm/nvm.sh" && nvm use 26.2.0 >/dev/null && npm --workspace @factionos/web run typecheck`
  * Result: PASS - web TypeScript project accepts the selector integration.
  * Evidence: `tsc -b --noEmit` completed successfully.
* Command/check: `source "$HOME/.nvm/nvm.sh" && nvm use 26.2.0 >/dev/null && npm test -- apps/web/tests/Battlefield.test.tsx`
  * Result: PASS - existing battlefield suite still passes.
  * Evidence: 1 test file passed, 17 tests passed.
* UI product-surface check: PASS - no new visible copy; no raw issue details are rendered.
* UI craft check: PASS - derivation remains hidden until the styled layer is inserted.
* BQC Fixes:
  * Contract alignment: ranking consumes the existing `GameProjection` camps/sectors and Quest Board issue ids without creating a parallel camp source (`apps/web/src/components/battlefield/Battlefield.tsx`).

***

### Task T012 - Wire camp inspection to Quest Board focus

**Started**: 2026-07-05 20:49 **Completed**: 2026-07-05 20:54 **Duration**: 5 minutes

**Notes**:

* Added `handleInspectCamp` in `Battlefield` to call `focusQuestBoardCamp` with camp id, issue ids, safe sector label, tier label, and a compact focus label.
* Added local sector/tier helpers scoped to Battlefield integration; the store remains responsible for focus normalization and opening the Quest Board.

**Files Changed**:

* `apps/web/src/components/battlefield/Battlefield.tsx` - added Quest Board focus selector, inspect callback, and camp label helpers.
* `.spec_system/specs/phase23-session06-battlefield-camp-layer/implementation-notes.md` - added T012 evidence.
* `.spec_system/specs/phase23-session06-battlefield-camp-layer/tasks.md` - marked T012 complete.

**Verification**:

* Command/check: `source "$HOME/.nvm/nvm.sh" && nvm use 26.2.0 >/dev/null && npm --workspace @factionos/web run typecheck`
  * Result: PASS - web TypeScript project accepts the focus callback.
  * Evidence: `tsc -b --noEmit` completed successfully.
* Command/check: `source "$HOME/.nvm/nvm.sh" && nvm use 26.2.0 >/dev/null && npx biome check apps/web/src/components/battlefield/Battlefield.tsx`
  * Result: PASS after fix - focused Biome check passed.
  * Evidence: first run requested ternary wrapping; final output was `Checked 1 file in 7ms. No fixes applied.`
* UI product-surface check: PASS - focus labels use only tier and safe sector labels.
* UI craft check: PASS - inspection opens the existing focused Quest Board surface instead of duplicating issue cards.
* BQC Fixes:
  * Contract alignment: Battlefield callback matches `QuestBoardCampFocusInput` and delegates focus behavior to the store (`apps/web/src/components/battlefield/Battlefield.tsx`).

***

### Task T013 - Wire dry Banish entry to existing Quest Board action

**Started**: 2026-07-05 20:54 **Completed**: 2026-07-05 20:57 **Duration**: 3 minutes

**Notes**:

* Refactored camp focus into `focusBattlefieldCamp` so inspection and Banish share the same focus input.
* Added `handleBanishCamp`, which focuses the camp first and then calls the existing `banishQuestBoardCamp()` store action when focus succeeds.
* The callback does not add progress, rewards, camp damage, projection writes, or duplicate-trigger logic.

**Files Changed**:

* `apps/web/src/components/battlefield/Battlefield.tsx` - added Banish store selector, shared focus helper, and dry Banish callback.
* `.spec_system/specs/phase23-session06-battlefield-camp-layer/implementation-notes.md` - added T013 evidence.
* `.spec_system/specs/phase23-session06-battlefield-camp-layer/tasks.md` - marked T013 complete.

**Verification**:

* Command/check: `source "$HOME/.nvm/nvm.sh" && nvm use 26.2.0 >/dev/null && npx biome check apps/web/src/components/battlefield/Battlefield.tsx`
  * Result: PASS - focused Biome check passed.
  * Evidence: output was `Checked 1 file in 6ms. No fixes applied.`
* Command/check: `source "$HOME/.nvm/nvm.sh" && nvm use 26.2.0 >/dev/null && npm --workspace @factionos/web run typecheck`
  * Result: PASS - web TypeScript project accepts the focus-then-Banish callback.
  * Evidence: `tsc -b --noEmit` completed successfully.
* UI product-surface check: PASS - no new visible copy or diagnostics are introduced.
* UI craft check: PASS - Banish reuses the focused Quest Board flow rather than creating a separate surface.
* BQC Fixes:
  * Duplicate action prevention: `handleBanishCamp` delegates to `banishQuestBoardCamp`, where in-flight action keys and rollback behavior already exist (`apps/web/src/components/battlefield/Battlefield.tsx`).

***

### Task T014 - Insert CampLayer between terrain clearing and hero tokens

**Started**: 2026-07-05 20:57 **Completed**: 2026-07-05 21:00 **Duration**: 3 minutes

**Notes**:

* Mounted `CampLayer` immediately after the `battlefield-empty-clear` button and before the hero token layer.
* Layer order now keeps terrain clearing at `z-10`, camps at `z-[15]`, and heroes at `z-20`.
* Passed ranked camps, reduced-motion state, inspect callback, and Banish callback into the presentation component.

**Files Changed**:

* `apps/web/src/components/battlefield/Battlefield.tsx` - imported and mounted `CampLayer` in the board layer stack.
* `.spec_system/specs/phase23-session06-battlefield-camp-layer/implementation-notes.md` - added T014 evidence.
* `.spec_system/specs/phase23-session06-battlefield-camp-layer/tasks.md` - marked T014 complete.

**Verification**:

* Command/check: `source "$HOME/.nvm/nvm.sh" && nvm use 26.2.0 >/dev/null && npx biome check apps/web/src/components/battlefield/Battlefield.tsx`
  * Result: PASS - focused Biome check passed.
  * Evidence: output was `Checked 1 file in 7ms. No fixes applied.`
* Command/check: `source "$HOME/.nvm/nvm.sh" && nvm use 26.2.0 >/dev/null && npm --workspace @factionos/web run typecheck`
  * Result: PASS - web TypeScript project accepts the mounted layer.
  * Evidence: `tsc -b --noEmit` completed successfully.
* Command/check: `source "$HOME/.nvm/nvm.sh" && nvm use 26.2.0 >/dev/null && npm test -- apps/web/tests/Battlefield.test.tsx`
  * Result: PASS - existing battlefield suite still passes with the mounted layer.
  * Evidence: 1 test file passed, 17 tests passed.
* UI product-surface check: PASS - mounted layer renders product camp controls only when projection camps exist.
* UI craft check: PASS - z-index band follows the spec and keeps heroes foregrounded.

***

### Task T015 - Preserve empty-terrain clear-selection behavior

**Started**: 2026-07-05 21:00 **Completed**: 2026-07-05 21:03 **Duration**: 3 minutes

**Notes**:

* No additional source change was needed for this task.
* Empty terrain remains the `z-10` clear button, disabled when no hero is selected.
* Camp inspect and Banish controls stop click propagation, so camp activation does not trigger terrain clearing.

**Files Changed**:

* `.spec_system/specs/phase23-session06-battlefield-camp-layer/implementation-notes.md` - added T015 evidence.
* `.spec_system/specs/phase23-session06-battlefield-camp-layer/tasks.md` - marked T015 complete.

**Verification**:

* Command/check: `rg -n "battlefield-empty-clear|stopPropagation|CampLayer|disabled=\\{!selectedHeroId\\}" apps/web/src/components/battlefield/Battlefield.tsx apps/web/src/components/battlefield/CampLayer.tsx apps/web/tests/Battlefield.test.tsx`
  * Result: PASS - clear button and propagation boundaries inspected.
  * Evidence: empty clear remains disabled with `!selectedHeroId`; camp inspect and Banish handlers call `event.stopPropagation()`.
* Command/check: `source "$HOME/.nvm/nvm.sh" && nvm use 26.2.0 >/dev/null && npm test -- apps/web/tests/Battlefield.test.tsx`
  * Result: PASS - current battlefield clear-selection suite still passes.
  * Evidence: 1 test file passed, 17 tests passed.
* UI product-surface check: PASS - no visible copy added.
* UI craft check: PASS - terrain clearing remains a background affordance below camp controls.
* BQC Fixes:
  * Accessibility and platform compliance: camp controls and terrain clear remain separate native controls (`apps/web/src/components/battlefield/Battlefield.tsx`, `apps/web/src/components/battlefield/CampLayer.tsx`).

***

### Task T016 - Add Champion Mode copy and attributes

**Started**: 2026-07-05 21:03 **Completed**: 2026-07-05 21:07 **Duration**: 4 minutes

**Notes**:

* Added `data-champion-mode`, roster mode, and visible-limit attributes to the layer and marker wrappers.
* Added hidden product-facing Champion Mode copy for solo and duo rosters using `your champion` and `your duo` language.
* The summary reports visible scanner fronts only; it does not expose a repository-wide debt counter.

**Files Changed**:

* `apps/web/src/components/battlefield/CampLayer.tsx` - added Champion Mode attributes and accessible summary copy.
* `.spec_system/specs/phase23-session06-battlefield-camp-layer/implementation-notes.md` - added T016 evidence.
* `.spec_system/specs/phase23-session06-battlefield-camp-layer/tasks.md` - marked T016 complete.

**Verification**:

* Command/check: `source "$HOME/.nvm/nvm.sh" && nvm use 26.2.0 >/dev/null && npm --workspace @factionos/web run typecheck`
  * Result: PASS - web TypeScript project accepts Champion Mode hooks.
  * Evidence: `tsc -b --noEmit` completed successfully.
* Command/check: `source "$HOME/.nvm/nvm.sh" && nvm use 26.2.0 >/dev/null && npx biome check apps/web/src/components/battlefield/CampLayer.tsx`
  * Result: PASS after fix - focused Biome check passed.
  * Evidence: first run requested helper signature wrapping; final output was `Checked 1 file in 5ms. No fixes applied.`
* UI product-surface check: PASS - copy is product-facing and avoids repository-wide debt totals.
* UI craft check: PASS - Champion Mode is exposed accessibly without adding a visible counter that competes with battlefield markers.

***

### Task T017 - Keep camp marker copy product-facing and safe

**Started**: 2026-07-05 21:07 **Completed**: 2026-07-05 21:12 **Duration**: 5 minutes

**Notes**:

* Audited camp marker copy and attributes for banned diagnostics, raw issue detail, broad path, provider, terminal, prompt, transcript, secret, and debt-counter language.
* Removed an obsolete no-op `void onBanishCamp` statement after confirming Banish is now wired.
* `rg` hits were false positives such as CSS `clip-path`, class names, or existing unrelated token styles.

**Files Changed**:

* `apps/web/src/components/battlefield/CampLayer.tsx` - removed obsolete no-op statement and completed copy-safety review.
* `.spec_system/specs/phase23-session06-battlefield-camp-layer/implementation-notes.md` - added T017 evidence.
* `.spec_system/specs/phase23-session06-battlefield-camp-layer/tasks.md` - marked T017 complete.

**Verification**:

* Command/check: `rg -n "debug|diagnostic|payload|prompt|transcript|terminal|absolute|path|file|provider|secret|token|stdout|stderr|debt|remaining|raw" apps/web/src/components/battlefield/CampLayer.tsx apps/web/src/index.css`
  * Result: PASS - no unsafe camp marker copy found.
  * Evidence: hits were class/CSS false positives such as `clip-path`, `battlefield-token`, and existing reduced-motion comments.
* Command/check: `source "$HOME/.nvm/nvm.sh" && nvm use 26.2.0 >/dev/null && npx biome check apps/web/src/components/battlefield/CampLayer.tsx apps/web/src/index.css`
  * Result: PASS - focused Biome checks passed.
  * Evidence: output was `Checked 2 files in 5ms. No fixes applied.`
* Command/check: `source "$HOME/.nvm/nvm.sh" && nvm use 26.2.0 >/dev/null && npm --workspace @factionos/web run typecheck`
  * Result: PASS - web TypeScript project still passes after cleanup.
  * Evidence: `tsc -b --noEmit` completed successfully.
* UI product-surface check: PASS - visible camp copy is limited to scanner camp/front labels, tier, sector, HP, issue count, and Banish.
* UI craft check: PASS - copy remains compact and scan-focused.
* BQC Fixes:
  * Product surface discipline: removed obsolete implementation-only no-op and confirmed marker copy avoids diagnostics/raw details (`apps/web/src/components/battlefield/CampLayer.tsx`).

***

### Task T018 - Add camp rendering, accessibility, chip, and ordering tests

**Started**: 2026-07-05 21:12 **Completed**: 2026-07-05 21:19 **Duration**: 7 minutes

**Notes**:

* Added camp projection and Quest Board card fixtures for Battlefield tests.
* Added coverage for layer count, board camp count, ranked selector order, accessible camp name, tier label, HP chip, issue chip, and sector label.

**Files Changed**:

* `apps/web/tests/Battlefield.test.tsx` - added camp fixtures and rendering/order test.
* `.spec_system/specs/phase23-session06-battlefield-camp-layer/implementation-notes.md` - added T018 evidence.
* `.spec_system/specs/phase23-session06-battlefield-camp-layer/tasks.md` - marked T018 complete.

**Verification**:

* Command/check: `source "$HOME/.nvm/nvm.sh" && nvm use 26.2.0 >/dev/null && npm test -- apps/web/tests/Battlefield.test.tsx`
  * Result: PASS - focused suite covers new rendering/order test.
  * Evidence: 1 test file passed, 20 tests passed.
* Command/check: `source "$HOME/.nvm/nvm.sh" && nvm use 26.2.0 >/dev/null && npm --workspace @factionos/web run typecheck`
  * Result: PASS - test fixture types are valid.
  * Evidence: `tsc -b --noEmit` completed successfully.
* Command/check: `source "$HOME/.nvm/nvm.sh" && nvm use 26.2.0 >/dev/null && npx biome check apps/web/tests/Battlefield.test.tsx`
  * Result: PASS after fix - focused Biome check passed.
  * Evidence: final output was `Checked 1 file in 7ms. No fixes applied.`
* UI product-surface check: PASS - test fixtures assert only tier, HP, issue count, and safe sector copy.
* UI craft check: PASS - ordering and chip assertions support scan-friendly marker readability.

***

### Task T019 - Add camp inspect, keyboard, Banish, and terrain clearing tests

**Started**: 2026-07-05 21:19 **Completed**: 2026-07-05 21:21 **Duration**: 2 minutes

**Notes**:

* Added coverage for click inspection, keyboard activation, focus input shape, dry Banish fetch entry, and selected-hero clearing through empty terrain while camps are present.
* The test asserts Banish uses the existing issue dismiss endpoint and store feedback rather than projection side effects.

**Files Changed**:

* `apps/web/tests/Battlefield.test.tsx` - added camp interaction/Banish/terrain test and JSON response helper.
* `.spec_system/specs/phase23-session06-battlefield-camp-layer/implementation-notes.md` - added T019 evidence.
* `.spec_system/specs/phase23-session06-battlefield-camp-layer/tasks.md` - marked T019 complete.

**Verification**:

* Command/check: `source "$HOME/.nvm/nvm.sh" && nvm use 26.2.0 >/dev/null && npm test -- apps/web/tests/Battlefield.test.tsx`
  * Result: PASS - interaction and dry Banish test passed in the focused suite.
  * Evidence: 1 test file passed, 20 tests passed.
* Command/check: `source "$HOME/.nvm/nvm.sh" && nvm use 26.2.0 >/dev/null && npm --workspace @factionos/web run typecheck`
  * Result: PASS - interaction fixture and fetch stub types are valid.
  * Evidence: `tsc -b --noEmit` completed successfully.
* UI product-surface check: PASS - test verifies same-instance Quest Board focus behavior without rendering raw issue details on the battlefield.
* UI craft check: PASS - keyboard and pointer behavior use the same native button activation path.
* BQC Fixes:
  * Accessibility and platform compliance: added keyboard activation coverage for camp inspect controls (`apps/web/tests/Battlefield.test.tsx`).
  * Duplicate action prevention: Banish coverage exercises the existing store path instead of adding a local mutation path (`apps/web/tests/Battlefield.test.tsx`).

***

### Task T020 - Add Champion Mode, z-order, reduced-motion, and entrenched tests

**Started**: 2026-07-05 21:21 **Completed**: 2026-07-05 21:22 **Duration**: 1 minute

**Notes**:

* Added coverage for solo Champion Mode visible limit, champion copy, camp layer z-index below hero layer, reduced-motion marker hook, and entrenched muted edge placement.
* The test confirms lower-priority camps are not rendered when solo roster limits apply.

**Files Changed**:

* `apps/web/tests/Battlefield.test.tsx` - added Champion Mode/reduced-motion/entrenched/z-order test.
* `.spec_system/specs/phase23-session06-battlefield-camp-layer/implementation-notes.md` - added T020 evidence.
* `.spec_system/specs/phase23-session06-battlefield-camp-layer/tasks.md` - marked T020 complete.

**Verification**:

* Command/check: `source "$HOME/.nvm/nvm.sh" && nvm use 26.2.0 >/dev/null && npm test -- apps/web/tests/Battlefield.test.tsx`
  * Result: PASS - Champion Mode and reduced-motion test passed in the focused suite.
  * Evidence: 1 test file passed, 20 tests passed.
* Command/check: `source "$HOME/.nvm/nvm.sh" && nvm use 26.2.0 >/dev/null && npm --workspace @factionos/web run typecheck`
  * Result: PASS - all new test assertions typecheck.
  * Evidence: `tsc -b --noEmit` completed successfully.
* UI product-surface check: PASS - Champion Mode copy avoids repository-wide debt counters.
* UI craft check: PASS - tests assert hero foregrounding, reduced-motion static hooks, and entrenched edge presentation.
* BQC Fixes:
  * Accessibility and platform compliance: reduced-motion marker state is explicitly asserted (`apps/web/tests/Battlefield.test.tsx`).

***

### Task T021 - Run focused web verification for battlefield rendering

**Started**: 2026-07-05 21:23 **Completed**: 2026-07-05 21:24 **Duration**: 1 minute

**Notes**:

* Ran the required focused Battlefield test command after all camp rendering and interaction tests were added.

**Files Changed**:

* `.spec_system/specs/phase23-session06-battlefield-camp-layer/implementation-notes.md` - added T021 evidence.
* `.spec_system/specs/phase23-session06-battlefield-camp-layer/tasks.md` - marked T021 complete.

**Verification**:

* Command/check: `source "$HOME/.nvm/nvm.sh" && nvm use 26.2.0 >/dev/null && npm test -- apps/web/tests/Battlefield.test.tsx`
  * Result: PASS - focused Battlefield suite passed.
  * Evidence: 1 test file passed, 20 tests passed.
* UI product-surface check: PASS - focused tests cover product-facing camp rendering and interactions.
* UI craft check: PASS - focused tests include readability hooks, Champion Mode limits, reduced motion, z-order, and entrenched placement.

***

### Task T022 - Run typecheck, formatting, ASCII, and LF checks

**Started**: 2026-07-05 21:24 **Completed**: 2026-07-05 21:28 **Duration**: 4 minutes

**Notes**:

* Ran the required final verification checks for the changed session files and workspace formatting.
* All checks passed; no unrelated formatting issue was found.

**Files Changed**:

* `.spec_system/specs/phase23-session06-battlefield-camp-layer/implementation-notes.md` - added T022 evidence.
* `.spec_system/specs/phase23-session06-battlefield-camp-layer/tasks.md` - marked T022 and completion checklist complete.

**Verification**:

* Command/check: `source "$HOME/.nvm/nvm.sh" && nvm use 26.2.0 >/dev/null && npm --workspace @factionos/web run typecheck`
  * Result: PASS - web TypeScript project passes.
  * Evidence: `tsc -b --noEmit` completed successfully.
* Command/check: `source "$HOME/.nvm/nvm.sh" && nvm use 26.2.0 >/dev/null && npm run format:check`
  * Result: PASS - workspace formatting check passed.
  * Evidence: Biome checked 778 files with no fixes applied.
* Command/check: `git diff --check`
  * Result: PASS - no whitespace errors.
  * Evidence: command exited successfully with no output.
* Command/check: `perl -ne 'if (/[^\\x00-\\x7F]/) { print "$ARGV:$.:$_"; $bad=1 } END { exit($bad ? 1 : 0) }' [changed files]`
  * Result: PASS - changed files are ASCII-only.
  * Evidence: command exited successfully with no output.
* Command/check: `perl -ne 'if (/\\r/) { print "$ARGV:$.:CRLF\\n"; $bad=1 } END { exit($bad ? 1 : 0) }' [changed files]`
  * Result: PASS - changed files use LF line endings.
  * Evidence: command exited successfully with no output.
* UI product-surface check: PASS - final changed UI files contain product-facing camp marker copy only.
* UI craft check: PASS - final verification covers type, format, whitespace, encoding, and focused Battlefield behavior.

***


---

# 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/phase23-session06-battlefield-camp-layer/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.
