docs: 2026-07-08 full-day sync — alignment audit, Set E, refund harvesters, calibration reset

README: Set E + fresh-book framing in 'system today', /live page in the
dashboard row, --bank in the ops table, book-reset procedure row, gotchas
12-15 (three cache cursors, res_t is endDate metadata / price is the sold
discriminator / redeemable is resolution truth, refund-harvester
archetype, single-writer state-surgery rule). FINDINGS: three new
sections — aligning the three books (7/9 cross-check, honest 29.1k->17.4k,
Set E selection), the refund harvesters, the calibration experiment
(in-sample warning + bank-size ceiling effect). HANDOFF rev 3: fresh
pickup with watch-list, rejected-with-evidence list, Phase 2 framing.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
jaxperro
2026-07-08 17:02:33 -04:00
parent a186d5a839
commit a690323f68
4 changed files with 240 additions and 99 deletions
+67 -82
View File
@@ -1,98 +1,83 @@
# Session handoff — 2026-07-08 (rev 2: Phase 1 COMPLETE)
# Session handoff — 2026-07-08 (rev 3: books aligned, Set E live, fresh $1k)
Self-contained pickup for a fresh session. Read [README.md](README.md) gotchas
111, [FINDINGS.md](FINDINGS.md), and [LIVE_ROLLOUT.md](LIVE_ROLLOUT.md) first.
Project memory (`polymarket-resolution-truth`, `polymarket-us-expansion`) has
deeper history; the repo is authoritative.
Self-contained pickup for a fresh session (human or AI). Read
[README.md](README.md) gotchas 115, [FINDINGS.md](FINDINGS.md) (especially
the three 2026-07-08 sections at the end), and [LIVE_ROLLOUT.md](LIVE_ROLLOUT.md).
The repo is authoritative; project memory has deeper history.
## Where things stand (all green)
- **Live paper bot**: Fly.io app `wwf-copybot`, region `arn` (Stockholm),
push mode. Following **Set E** (2026-07-08 PM): LSB1, imwalkinghere,
Kruto2027, 0xbadaf319, gkmgkldfmg, AIcAIc, 1kto1m — 7 volume wallets chosen
by the ALIGNED honest replay (Set E $24.4k/+2338% vs Set D $17.4k/+1636%
30d; every member positive in the shared book; 42021/BikesAreTheBikes
dropped as mid-pack, oliman2/leegunner excluded by the anti-survivorship
audit — oliman2's true lifetime is ~$19k, not PM's $112k; leegunner is
elite lifetime but replays NEGATIVE for a copier, 7.6-day holds). Caveat:
newcomers gkmgkldfmg z=2.05 / 1kto1m z=2.4 sit near the selection gate
floor — watch their forward month. `flyctl logs --app wwf-copybot`.
- **P&L is honest end-to-end** (sharps All-Time = realized track record +
abandoned-loser fold-in; Open P&L = in-flight exposure — see rev 1 in git
history for the full derivation).
- **Ledger reconciles** (`ledger_drift` 0.00, self-checked every heartbeat AND
after every trade — see below).
- **Daily pipeline** (launchd 08:00) runs the corrected code; exits cache
incremental (86/96 wallets `complete`).
- **Live paper bot**: Fly.io `wwf-copybot`, region `arn` (Stockholm), push
mode, ONE machine. Following **Set E** (7 volume wallets): LSB1,
imwalkinghere, Kruto2027, 0xbadaf319, gkmgkldfmg, AIcAIc, 1kto1m.
`flyctl logs --app wwf-copybot`.
- **The book is a fresh $1,000, reset 2026-07-08 ~20:45 UTC** — this is the
CALIBRATION EXPERIMENT: measure the live-to-backtest ratio for Set E with
every fix live from day one; that ratio (not the replay %) sizes real money.
Old book (Jun 25 → Jul 8, +$229.79) is in git history +
`archive/copybot_fills.pre-reset-2026-07-08.jsonl`.
- **The three books agree by construction** (2026-07-08 alignment work):
same W/L/R/S taxonomy (win% = held-to-resolution only), same
sold-vs-redeem price discriminator (redeem prints exactly the payout), same
pinned floors, same follow set. Row-level cross-check bot↔backtest: 7/9
exact, 0 absent, 2 legit execution diffs. Sharps table reproduces PM's
per-position books to the dollar; PM's LEADERBOARD is the biased number.
- **Dashboards**: [jaxperro.com/trading](https://jaxperro.com/trading) =
paper book + backtest + sharps; [jaxperro.com/live](https://jaxperro.com/live)
= REAL MONEY page (NOT STARTED until Phase 2). Shared renderer:
`jaxperro/trading/copybot-section.js`. `?botFeed=`/`?rmFeed=` query params
override feeds for local testing.
- **Daily pipeline** (Mac launchd 08:00, fires on wake — typically ~10:00)
re-derives everything under the new rules: entries cursors now invalidate
daily, `_open_split` folds by the `redeemable` flag, `rtally` splits SOLD.
- **Backtest**: `portfolio.py` takes `--bank` (backtest.json `"bank"`).
Published feed stays at $1,000 to match the paper book. $500 run: +2728%
(small banks compound faster — their-bet ceilings bind later).
## DONE 2026-07-08 (this session) — the proper fix + Phase 1 closeout
## Watch list (the standing question: does Set E hold up?)
**Orphan/cash-debit seam CLOSED (Option A, commit 167a0b9).** The mechanism
that created the $+36.35 drift orphan is fixed, not just guarded:
- `on_wallet_activity` now records EVERY drained buy fill: the tok-match keeps
`_record_lag` (real lag/slippage); leftovers get `_record_untracked_buy`
(bet record synthesized from the fill, conds from the position, audit line
with `"untracked":true`). `reconcile_exits`' drain does the same instead of
discarding returned buys.
- `check_book()` asserts the invariant **after every trade and at boot**:
every `my_pos` token ⇒ bet record + conds entry + cash debited. Records and
conds self-correct in place. The cash leg heals ONLY at boot
(`check_book(heal_cash=True)`, called after `bot.seed()`) and ONLY when
`ledger_drift` matches ONE un-vouched position's cost+fee within
max($0.10, 1%) — vouched = fills-ledger BUY line for the token, or a real
`_record_lag` record (`their_price` set). A drift that matches nothing stays
a loud `⚠ LEDGER DRIFT`, never papered over.
- Supporting plumbing: `my_pos` entries carry `cond` (engine stamps it on
OPEN/ADD); fills-ledger BUY lines carry `token`; `_synth_bet` (shared with
`write_feed`) estimates the fee with the same `taker_fee` formula
`_drain_fills` charges, so a synthesized record over correctly-debited cash
closes to drift 0 — and a never-debited orphan shows drift = cost+fee
exactly, which is what the heal keys on.
- Tested: 6-case harness (untracked booking, synth+conds, matching heal,
non-matching refusal, vouched exclusion, multi-orphan refusal) all pass;
dry-run against the real state was a clean no-op (drift $0.0055, nothing
touched). Deployed; heartbeats clean.
**Phase 1 is 8/8 DONE** (LIVE_ROLLOUT.md): 1.1 feed separation, 1.2 env
secrets, 1.3 live deps in the worker image (py-clob-client==0.34.6 +
web3==7.16.0 in fly.Dockerfile, import-verified via `flyctl ssh console`),
1.4 on-chain cash anchor, 1.5 fatal geocheck, 1.6 exit retries, 1.7 config
sync, 1.8 dashboard REAL MONEY section (jaxperro `trading/index.html` commit
871e56e — fourth board chip + section reading `live/copybot_live_real.json`,
shared `copybotSection()` renderer, ledger drift/adjustments surfaced on both
books, verified against a mode:"live" feed copy and the 404 NOT STARTED
empty-state; `?rmFeed=`/`?botFeed=` query params override feeds for testing).
- **AIcAIc** — held-win only 42%; his edge is sell-timing (most lag-fragile
class). First demotion candidate.
- **1kto1m** (z=2.4) and **gkmgkldfmg** (z=2.05) — near the gate floor;
strong month, shallow statistical edge.
- Re-ranking is cheap: the per-wallet replay harness pattern is in FINDINGS
("Aligning the three books"); `python3 live/portfolio.py --wallets 0x…
--days 30 --out /tmp/w.json` per candidate, then combined-set runs.
- Rejected-with-evidence (don't re-add without new facts): oliman2 (true
lifetime ~$19k), leegunner (negative to copy), 0xb0E43B/ArbTraderRookie
(refund harvesters — real edge, uncopyable margins), lma0o0o0o (negative in
the shared book), Winnertraders (6.6-day capital locks).
## Next: Phase 2 — funding (USER ONLY)
Everything before real money is done. Per LIVE_ROLLOUT.md: fund the live
wallet (test size, rule 0.6 caps stay at $5/trade · $25/day · $30 exposure),
then Phase 3 preflight (`preflight_live.py`), Phase 4 supervised first fill,
Phase 5 edge-case matrix. The typed-phrase interlock (rule 0.7) is the human
checkpoint — never automated.
Phase 1 is 8/8 complete (LIVE_ROLLOUT.md). Before funding, the user should
decide the stranding tolerance explicitly: real money turns the primary risk
from P&L into the ACCOUNT (US person routing orders via Stockholm through the
geoblock — a frozen wallet is a different loss category than a losing bet).
Caps stay $5/trade · $25/day · $30 exposure until Phase 6. Then Phase 3
preflight (`preflight_live.py`) → Phase 4 supervised first fill → Phase 5
edge-case matrix. The typed-phrase interlock is the human checkpoint — never
automated.
## Standing to-dos (user-only or external)
- **ROTATE THE LEAKED ALCHEMY KEY.** A real key briefly hit the public repo
(`config.live.example.json`, removed from HEAD but in git history). Generate a
new key at dashboard.alchemy.com, then update `alchemy_key` in the local
gitignored `config.json` AND the `ALCHEMY_RPC_URL` Fly secret
(`flyctl secrets set ALCHEMY_RPC_URL=...`). Blocks nothing but is a live key.
- Delete the stopped Railway project `magnificent-kindness` when comfortable
(saves the idle spend; the Fly worker fully replaced it).
- **ROTATE THE LEAKED ALCHEMY KEY** (config.live.example.json git history).
New key at dashboard.alchemy.com → update gitignored `config.json` AND
`flyctl secrets set ALCHEMY_RPC_URL=...`.
- Delete the stopped Railway project `magnificent-kindness` when comfortable.
## Operational quick-reference
- Change the follow set: edit `live/copybot.paper.json` `wallets`, then
- **Change the follow set**: edit `live/copybot.paper.json` wallets
`./live/deploy_bot.sh` (validates → pins floors → syncs Alchemy webhook →
restarts Fly → confirms banner). `backtest.json` should mirror it.
- Backtest any set: `python3 live/portfolio.py --wallets 0xa,0xb --days 30
--out /tmp/t.json`.
- Never keep 2 Fly machines (2 book-writers): `flyctl scale count 1`.
- Cache is single-writer; don't run cache-touching scripts while the daily
pipeline or a regen is running.
- Bot commits its own state/feed every few minutes — always
`git pull --rebase --autostash` before pushing.
- Image changes (fly.Dockerfile) need `flyctl deploy --remote-only`; code-only
changes just need a push + `flyctl apps restart` (start.sh clones main).
restarts Fly → confirms banner). Keep `backtest.json` mirrored.
- **State surgery (reset/repair the book)**: `flyctl machine stop` FIRST,
push the new state, `flyctl apps restart`, then VERIFY the first heartbeat
shows the book you wrote (gotcha 15: the bot's memory wins conflicts by
design, and a boot clone can read a stale GitHub replica for a few seconds).
- Never 2 Fly machines (`flyctl scale count 1`) — one book, one writer.
- Cache is single-writer; don't run cache-touching scripts during the daily
pipeline or a regen. Three cursors per wallet (gotcha 12).
- Bot commits its own state/feed — `git pull --rebase --autostash` before
pushing. Image changes (fly.Dockerfile, host/) need
`flyctl deploy --remote-only`; code/config changes just push + restart.