rename: retire the stage1-* family for the r-family (r-sma / r-breakout / r-meanrev)

The stage1 ordinal has been dead vocabulary since the C10 reframe dropped
the two-stage research model: a 1 structurally implies a 2 that no longer
exists. The family is renamed by its live discriminator - the R yardstick -
with members named by their signal, uniform with their signal-named
siblings (sma, macd, momentum):

- selectors: stage1-r -> r-sma, stage1-breakout -> r-breakout,
  stage1-meanrev -> r-meanrev (old tokens are usage errors, exit 2 - no
  silent alias)
- identifiers: Strategy::RSma/RBreakout/RMeanRev, HarnessKind::RSma,
  r_sma_*/r_breakout_*/r_meanrev_*, wrap_r, run_signal_r, RGrid, R_SMA_*
- persisted identity: the sma_signal composite (param prefix
  sma_signal.fast.length / .slow.length; fixtures regenerated; content-ids
  shift - no test pins a literal hash, the registry parses no record names)
- e2e test files git-mv'd to r_sma_e2e / r_breakout_e2e / r_meanrev_e2e
- dead Stage-1/Stage-2 prose reworded to post-C10 vocabulary across
  rustdoc, Cargo.tomls, ledger live lines, and the glossary (historical
  entries stay; fieldtests corpus untouched)
- CLAUDE.md invariant 7 rewritten to record the ratified C10 reframe
  faithfully (the token-swap alone would have laundered the retired
  gated-currency/realistic-broker design into unmarked live prose); the
  unbacked account-mode clause dropped

Verification: cargo build/test --workspace green (51 targets), clippy
-D warnings clean, doc build clean, acceptance grep gate leaves exactly
the one resampling-stage false positive (harness.rs), smoke: --harness
r-sma runs, --harness stage1-r exits 2 with the new usage line.

Decision log: forks and rationale recorded on the issue (reconciliation
+ implementation-phase comments).

closes #174
This commit is contained in:
2026-07-02 12:03:09 +02:00
parent e1b04439c0
commit 4de6d5cbad
22 changed files with 582 additions and 583 deletions
+24 -25
View File
@@ -84,31 +84,30 @@ design decision, not a refactor, and belongs in the ledger.
makes a live external call mid-replay. (See `~/.claude/CLAUDE.md` for the
IONOS consent rule: external LLM calls happen at the recording/live-source
edge, with explicit per-session consent, never inside a backtest.)
7. **Strategy output is a directional bias stream; risk-based execution and
realistic brokers are decoupled downstream layers; signal quality is measured
in R.** The DAG expresses one state at t (C8: ≤1 record per `eval`), so a
strategy's primary, backtestable output is a signed, bounded **bias** `f64 ∈
[-1,+1]` per cycle — direction (sign) + conviction (magnitude, optional),
**unsized** (not an equity curve, not a position, not a size). Sizing leaves the
strategy: a decoupled **risk-based execution** layer `bias → stop-rule → Sizer →
Veto → position-management` (the **RiskExecutor** composite, per symbol, nested
in a Broker/Account composite) turns bias + a protective **stop** into a sized
intent. The **stop defines the risk unit R** (1R = the loss if stopped).
**Signal quality is measured in R** (R-multiples / expectancy), the account- and
instrument-agnostic yardstick — **Stage 1**: flat-1R sizing, feed-forward, no
equity feedback, the primary research loop. **Currency P&L is Stage 2** (deploy
viability): fixed-fractional sizing reads equity (compounding) → realistic
brokers apply real frictions → currency equity, entered only after `E[R] > 0`.
The single feedback (equity → Sizer) is cut by a `z⁻¹` register on the **fill
edge** (mark-to-market stays a same-cycle price read), encapsulated in the
executor composite; flat-1R vs compounding is a **structural axis** (C11). The
broker-independent **position-event table** (`event_ts, action[buy/sell/close],
position_id, instrument_id, volume`) remains the **decoupled, derived** Stage-2
audit layer — the first difference of the *book* (`deal = target book
in_flight`), a computed table (not a per-`eval` output, since one decision
instant may yield >1 event) — feeding realistic brokers. Brokers/executors are
ordinary downstream nodes, never part of the strategy; account mode
(netting/hedging) is a composition constraint.
7. **Strategy output is a directional bias stream; risk-based execution is a
decoupled downstream layer; signal quality is measured in R.** The DAG
expresses one state at t (C8: ≤1 record per `eval`), so a strategy's primary,
backtestable output is a signed, bounded **bias** `f64 ∈ [-1,+1]` per cycle —
direction (sign) + conviction (magnitude, optional), **unsized** (not an
equity curve, not a position, not a size). Sizing leaves the strategy: a
decoupled **risk-based execution** layer `bias → stop-rule →
position-management` (the **RiskExecutor** composite, per symbol; the **Veto**
an optional documented pre-trade-gate seam) turns bias + a protective **stop**
into a managed position, in R. The **stop defines the risk unit R** (1R = the
loss if stopped). **Signal quality is measured in R** (R-multiples /
expectancy), the account- and instrument-agnostic yardstick — the research
loop is **pure feed-forward**: flat-1R, gross R → net R via the composable
cost-model graph (C10), no Sizer, no equity feedback, no `z⁻¹` register.
**Money is a live/deploy-edge concern**: currency P&L, fixed-fractional
sizing, and compounding are post-hoc money-management transforms of the net-R
sequence at the deploy/account layer, and the live broker is an **I/O
adapter** at the recording/deploy edge (C11/C13), never part of the strategy.
The broker-independent **position-event table** (`event_ts,
action[buy/sell/close], position_id, instrument_id, volume`) survives as the
**decoupled, derived** deploy/reconciliation audit artifact — the first
difference of the *book* (`deal = target book in_flight`), a computed
table (not a per-`eval` output, since one decision instant may yield >1
event).
8. **Deploy artifacts are frozen.** Hot-reload (cdylib) is an authoring-loop
tool only. The live bot is a statically-linked, versioned, frozen artifact —
never hot-swapped (audit trail: this bot = this commit).