# Stream K0: ground the catalogue refactor
(written 2026-09-16 Wed, from the accepted plan `.logs/planning/catalogue-refactor-plan-2026-09-16.md`; short; runs alone, before K1)

**Runs:** alone, first, on the branch `claude/table-layout-db-structure-1d5bc2`, from the
worktree `/srv/apps/dutyfreeprofessor/.claude/worktrees/table-layout-db-structure-1d5bc2` (the
whole refactor lives on this branch until rian merges it for the launch; the checkpoint hook
walks up to this worktree's `.logs/`). Two hours at most.

## Goal
The branch carries master's newest commits and a green check, and the review process every later
stream and the review pass follow is written down once, in `main/docs/REVIEW-PROCESS.md`, so the
certain boundary and the grouping defaults are configuration a person can read and change, never
a rule buried in code or an answer given in chat (plan W11, W12, W13, W14).

## What already exists, so you build on it
- The branch: the 15 Sep build (identity rules v5, the decisions ledger in `overrides`, the review
  field and CLI, the label changes), tested, not deployed; master has three discussion-panel
  commits the branch lacks (`git log --oneline HEAD..master`).
- The plan's section 1 says which of the 15 Sep build is kept, changed or dropped; the walk-through
  `.logs/planning/catalogue-walkthrough-2026-09-16.md` carries rian's words behind every rule.

## Tasks, in order (ids on /plan; record each with `main/scripts/plan-set.py`; commit prefix `K0:`)
1. **K0.1 Rebase onto master.** `git rebase master`; resolve nothing by hand that a test does not
   cover; `main/check.sh` green; commit nothing new (the rebase is the commit). If a conflict needs
   a judgement, stop and write it to the handoff rather than guessing.
2. **K0.2 `main/docs/REVIEW-PROCESS.md` v1.** The one file the Claude review pass reads and every
   later automated pass starts from. Sections, in this order, each a short list a person can edit:
   - **What a rule may do without review** (the certain boundary, plan W14): the brand matched to
     its row; a quantity the parser read as a stated number; an ABV percentage; a pack figure; a
     shop-published option field; the closed concentration vocabulary (EDT, Eau de Toilette, edt
     are one; list every synonym); case, accents, punctuation and glyph folding. Everything else is
     a proposal. Say explicitly that this list is a rules version: changing it is a deploy and a
     rederive, never a quiet edit.
   - **Grouping defaults the pass proposes**, per vertical (plan W12): aged spirits, one product line
     per age; a finish or cask edition, a member of its parent line; a limited edition, proposed as a
     member and confirmed per case; a set or coffret, never a member of the bottle's line;
     concentrations, members of one line; shades, members of one line; wine and champagne, one line
     per vintage; electronics, one line per model family; clothing, one line per style with size and
     colour as attributes. Every default names the walk-through item or the evidence it came from.
   - **What a proposal must carry**: the natural keys (brand slug; listing as shop code plus the
     shop's SKU; a variant by barcode, else by its listings), the text span every proposed value was
     read from, a confidence, and one line of reasoning; a value the raw text does not contain is
     never proposed (empty beats guessed).
   - **What the person spot-checks** (plan W16): every proposal that merges variants or changes a
     comparison; the lowest-confidence proposals per brand; a random sample; the rest may be approved
     in bulk.
   - **Value order for the review**: brands by comparison gain, then the 97 brands holding 53 percent
     of listings, then the rest.
   - **A version line at the top**, bumped whenever a default or the boundary changes; a proposals
     file records the version it followed.
3. **K0.3 The doc gates.** Add `REVIEW-PROCESS.md` to the docs a session reads for catalogue work
   (`agents.md` "Read first", one line; the budget is 140 lines, trim elsewhere if needed) and run
   `python3 main/scripts/docmap.py --write && bash main/docs-check.sh`.

## Owns
`.logs/planning/streams/`(this file only), `main/docs/REVIEW-PROCESS.md`, `agents.md` (one line),
the rebase.

## Must not touch
Every other file. K0 writes no code.

## Rehearsal, acceptance, rollback
No database. Acceptance: `main/check.sh` green on the rebased branch; `REVIEW-PROCESS.md` carries
every default the walk-through recorded (W11, W12, W14, W16) and the certain boundary as a numbered
list; the handoff names the master commit the branch now sits on. Rollback: `git reset` to the
pre-rebase commit, which the handoff names.

## Hand-back
A handoff entry (≤25 lines), `/checkpoint`, and the one line "K0 green; K1 may start".
