> 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-session01-pure-camp-reconciliation/tasks.md).

# Task Checklist

**Session ID**: `phase23-session01-pure-camp-reconciliation` **Total Tasks**: 18 **Estimated Duration**: 3-4 hours **Created**: 2026-07-05

***

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

***

## Setup (2 tasks)

* [x] T001 \[S2301] Verify existing projection and scanner issue contracts (`apps/web/src/lib/gameProjection.ts`, `packages/protocol/src/suggestions.ts`)
* [x] T002 \[S2301] Create the pure Legion camp module scaffold with type-only imports (`apps/web/src/lib/legionCamps.ts`)

***

## Foundation (5 tasks)

* [x] T003 \[S2301] Define reconciliation and base ranking input/output types with types matching declared contracts (`apps/web/src/lib/legionCamps.ts`)
* [x] T004 \[S2301] Define severity weights, tier thresholds, sector budget, and entrenchment constants with exhaustive severity handling (`apps/web/src/lib/legionCamps.ts`)
* [x] T005 \[S2301] Implement safe relative issue path normalization and sector label sanitization (`apps/web/src/lib/legionCamps.ts`)
* [x] T006 \[S2301] Implement deterministic hash, sector id, and cell helpers with previous-cell preservation (`apps/web/src/lib/legionCamps.ts`)
* [x] T007 \[S2301] Create test factories for codebase issues, previous camps, and previous sectors (`apps/web/tests/legionCamps.test.ts`)

***

## Implementation (7 tasks)

* [x] T008 \[S2301] Implement severity weight and camp tier helpers (`apps/web/src/lib/legionCamps.ts`)
* [x] T009 \[S2301] Implement sector derivation and coalescing with bounded sector budget, deeper safe splitting, `Borderlands` grouping, and deterministic ordering (`apps/web/src/lib/legionCamps.ts`)
* [x] T010 \[S2301] Implement camp grouping with sorted unique issue ids and aggregate HP (`apps/web/src/lib/legionCamps.ts`)
* [x] T011 \[S2301] Implement `maxHp` and `scarredPct` preservation for camps that persist across snapshots (`apps/web/src/lib/legionCamps.ts`)
* [x] T012 \[S2301] Implement entrenchment increment and reset based on issue membership and HP equality (`apps/web/src/lib/legionCamps.ts`)
* [x] T013 \[S2301] Implement `reconcileLegionCamps` clean snapshot, removal, new camp, and changed camp outputs (`apps/web/src/lib/legionCamps.ts`)
* [x] T014 \[S2301] Implement base `rankVisibleLegionCamps` with entrenched metadata and stable ordering (`apps/web/src/lib/legionCamps.ts`)

***

## Testing (4 tasks)

* [x] T015 \[S2301] Add severity, tier, aggregate HP, and sorted issue id tests (`apps/web/tests/legionCamps.test.ts`)
* [x] T016 \[S2301] Add sector coalescing tests for small repos, large repos, `Borderlands`, safe relative labels, stable ordering, and stable cells (`apps/web/tests/legionCamps.test.ts`)
* [x] T017 \[S2301] Add entrenchment, previous value preservation, clean snapshot, and aggregate-only privacy tests (`apps/web/tests/legionCamps.test.ts`)
* [x] T018 \[S2301] Run focused tests, web typecheck, format check, and ASCII/LF validation (`npm test -- apps/web/tests/legionCamps.test.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://faction-os.gitbook.io/faction-os-docs/.spec_system/archive/sessions/phase23-session01-pure-camp-reconciliation/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.
