Skip to content

feat(orchestrate): source per-trade R from the book, behind --edge-decay - #16

Merged
mspinola merged 1 commit into
mainfrom
claude/orchestrate-trade-r-source
Aug 2, 2026
Merged

feat(orchestrate): source per-trade R from the book, behind --edge-decay#16
mspinola merged 1 commit into
mainfrom
claude/orchestrate-trade-r-source

Conversation

@mspinola

@mspinola mspinola commented Aug 2, 2026

Copy link
Copy Markdown
Owner

#15 landed EdgeDecayTrigger with nothing to feed it. This adds the substrate half.

The protocol gains a third method

.reoptimize()                    -> Reoptimization
.realized_r_since(since, params) -> periodic R since the incumbent went live
.trade_r_since(since, params)    -> per-TRADE R over that same window  [--edge-decay only]

Sourced over the same ledger-defined window as the periodic series, for the same reason that window comes off the ledger rather than the book: a series measured over the wrong span is a silently wrong answer rather than an error.

The two series stay separate all the way down. Periodic is resampled onto the grid the drift envelope was built on; per-trade is not aggregated at all.

--edge-decay is opt-in and off by default

This is the part that matters for the live job. EdgeDecayTrigger fails open, so switching it on for a book that has no frozen baseline yet makes every cycle fire and re-optimize — which taxes the honest N for no information, since every re-optimization is variants added to the SearchSpaceLog.

A baseline is only written on a promotion, so the correct sequence is:

  1. teach the book trade_r_since and a Reoptimization.baseline
  2. let one promotion happen
  3. then turn the flag on

Enabling it any earlier is strictly worse than leaving it off.

It refuses rather than monitoring nothing

With --edge-decay set and no trade_r_since on the book, the CLI exits with a clear message. Passing an empty series instead would let the trigger fail open and produce a cycle that looks monitored and is not — the exact failure this module is shaped to avoid.

Verification

  • 392 tests pass (+4), ruff check crucible_stack tests clean
  • Runs against the real published crucible 0.5.0 now, no PYTHONPATH needed

The npf side (trade_r_since on the trend book, plus a frozen baseline from reoptimize) is a companion change in the private repo. npf/scripts/orchestrate_trend.sh is deliberately not changed: the flag stays off until a baseline exists on the ledger.

🤖 Generated with Claude Code

EdgeDecayTrigger landed in #15 with nothing to feed it. This adds the substrate
half: a third method on the book protocol and the CLI plumbing to reach it.

    .trade_r_since(since, params) -> per-TRADE R since the incumbent went live

Sourced over the same ledger-defined window as the periodic series, for the same
reason that window comes off the ledger rather than the book: a series measured
over the wrong span is a silently wrong answer rather than an error.

The flag is OPT-IN and off by default, which is the important part. EdgeDecayTrigger
fails open, so switching it on for a book with no frozen baseline makes every
cycle fire and re-optimize, taxing the honest N for no information. A baseline is
only written on a promotion, so the sequence is: teach the book trade_r_since and
a Reoptimization.baseline, let one promotion happen, then turn the flag on.

With --edge-decay set and no trade_r_since on the book, this refuses with a clear
message rather than passing an empty series. An empty series would let the trigger
fail open and produce a cycle that looks monitored and is not, which is the failure
this whole module is shaped to avoid.

The two R series stay separate all the way down: periodic onto the envelope's
grid, per-trade not aggregated at all.

392 tests pass (+4). ruff clean.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@mspinola
mspinola merged commit 85ff006 into main Aug 2, 2026
1 check passed
@mspinola
mspinola deleted the claude/orchestrate-trade-r-source branch August 2, 2026 21:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant