From 53bd105d6b4694c135e59d280dfb8d34bbd72c6e Mon Sep 17 00:00:00 2001 From: Joey Yakimowich-Payne Date: Mon, 20 Apr 2026 18:16:25 -0600 Subject: [PATCH] chore(sisyphus): notepad scaffold for rule-variants epic Seeds .sisyphus/notepads/rule-variants/learnings.md with: - Ground state (master @ a159299, test counts, existing hooks) - Key file anchors verified live (isInCheck, getAllLegalMoves, applyMove turn-flip) so the incoming agent doesn't re-grep - Command cheat sheet (bun run check, vitest, playwright, WS server restart after protocol edits) - T3-learned gotchas (tool cap, dev-server hot-reload, module load order, pre-commit hook discipline) - Empty 'Running progress' section for per-task append-only entries Pairs with .sisyphus/plans/rule-variants-v2.md (execution plan). The agent picking up this epic reads the plan for the WORK and the notepad for the CONTEXT. --- .sisyphus/notepads/rule-variants/learnings.md | 72 +++++++++++++++++++ 1 file changed, 72 insertions(+) create mode 100644 .sisyphus/notepads/rule-variants/learnings.md diff --git a/.sisyphus/notepads/rule-variants/learnings.md b/.sisyphus/notepads/rule-variants/learnings.md new file mode 100644 index 0000000..6c659ae --- /dev/null +++ b/.sisyphus/notepads/rule-variants/learnings.md @@ -0,0 +1,72 @@ +# Rule Variants — Execution Notepad + +Scaffold for the agent picking up `.sisyphus/plans/rule-variants-v2.md`. +APPEND to this file (never overwrite) under timestamped headings as +work progresses. + +## Ground state (master @ a159299) + +- Baseline: 1417 unit tests, 80/80 Playwright. +- Preset-flexibility architecture + starting-layouts + modifier-profiles + T1/T2/T3 all shipped. +- Current preset hooks in `packages/chess/src/presets/registry.ts`: + - `onActivate`, `onDeactivate` + - `onBeforeMove`, `onAfterMove`, `onTurnStart` + - `getExtraMoves`, `filterMoves` + - `onDamage` (via damage pipeline) + - `onCheckGameResult` + - `shouldFilterSelfCheck` + - `describeMoveEffect` + - `pieceAttributes` (declared attrs) +- This epic adds 4 hooks: + - `getRoyalPieces` (A.1) + - `filterLegalMoves` (A.2) + - `shouldAdvanceTurn` (A.3) + - `overridePieceMoves` (A.4) +- New game fact: `HalfMovesThisTurn` on `GAME_ENTITY` (A.3). + +## Key file anchors verified live (April 2026) + +| What | Where | +|---|---| +| isInCheck hardcoded to "king" | `packages/chess/src/rules/check.ts:83` | +| findKingPosition | `packages/chess/src/rules/check.ts` (same file) | +| isCheckmate calls isInCheck | `packages/chess/src/rules/checkmate.ts:80` | +| isStalemate calls isInCheck | `packages/chess/src/rules/stalemate.ts:92,105` | +| getAllLegalMoves aggregation | `packages/chess/src/engine.ts:855` | +| applyMove turn-flip | `packages/chess/src/engine.ts:964` | +| Per-piece move generation | `packages/chess/src/engine.ts` via `PIECE_TYPE_REGISTRY` | +| Preset registry | `packages/chess/src/presets/registry.ts` | +| PIECE_TYPE_REGISTRY | `packages/chess/src/presets/piece-type-registry.ts` | + +## Command cheat sheet + +- `bun run check` — typecheck + lint + vitest (pre-commit hook gate) +- `bun run test` — vitest only (NOT `bun test`) +- `bunx playwright test --reporter=line` — full e2e +- `bunx playwright test e2e/rule-variants.spec.ts --reporter=line` — new suite +- `bun run packages/server/src/index.ts` — WS server for MP e2e +- Fresh server after protocol edits: + `tmux kill-session -t ws-server 2>/dev/null; tmux new-session -d -s ws-server -c /home/joey/Projects/rules 'bun run packages/server/src/index.ts'` + +## T3-learned gotchas (apply here too) + +1. **Tool cap at 200 calls** per delegation. Shard work smaller than + you think — 1 preset = 1 delegation is the sweet spot. +2. **Dev server doesn't hot-reload protocol changes.** Restart the + WS server after every `packages/server/src/protocol.ts` edit. + (This epic adds no protocol changes, but if any creep in via + multiplayer e2e, remember this.) +3. **Playwright auto-starts the dev-http server** via config; don't + start a second one manually. The WS server on :7357 IS separate + and needs the tmux restart above. +4. **`session.insert` is idempotent upsert** — fine to re-seed facts. +5. **Module-load order matters**: `import "./presets/index.js"` at the + top of any consumer that expects all presets to be registered. +6. **Pre-commit hook is non-negotiable**. Green before every commit. + If a commit-message-only retry fails, do a full `bun run check` to + see what regressed. + +## Running progress + +(append entries as you ship tasks, one per task, newest at top)