Skip to content

Strategy application context — when each strategy applies, and when it must not fire - #7

Merged
AetherAI3 merged 1 commit into
mainfrom
feat/strategy-application-context-pinned
Aug 6, 2026
Merged

Strategy application context — when each strategy applies, and when it must not fire#7
AetherAI3 merged 1 commit into
mainfrom
feat/strategy-application-context-pinned

Conversation

@AetherAI3

@AetherAI3 AetherAI3 commented Aug 6, 2026

Copy link
Copy Markdown
Owner

Gives every library strategy the context needed to decide when it applies and when it must not fire.

One commit, 15 files, comments only — no IR, no source, no packaging changes.

The problem

Every library strategy carried two or three lines restating its own entry condition:

// Classic RSI oversold reversal (Pine: ta.rsi(close, 14) < 30).
// Buy when the 14-period RSI dips below 30.

That has zero selection value. It says what the strategy does, never when it applies — and a consumer reading this corpus already has the condition from the compiled IR. So the header was spending tokens to repeat something the reader already knew, while the thing it actually needed to decide was absent.

The change

Each header now states:

  • the regime it belongs to, and the regimes where it must not fire
  • conditions that must hold before it is considered
  • invalidation — what makes it wrong, stated before entry
  • its shape on the chart and the timeframe it operates on
  • the near-neighbour it gets confused with
  • the instrument class its thresholds were calibrated on

That last field is not documentation. A consumer retargets a published rule to whatever instrument is live but carries its thresholds across unchanged, so the hazard is wrong-regime numbers transplanted between instrument classes — and this header is the only place a rejection can be expressed.

Concrete cases the headers now name:

  • roc_momentum — ROC > 5 is an ordinary hour for BTC and a limit-move event for an index future.
  • bb_squeeze_breakoutBB_WIDTH < 4 is an absolute percentage; on a quieter instrument it is permanently satisfied and stops discriminating at all.
  • atr_volatility_halt — the worst case, and counterintuitive. Carried across unchanged this breaker does not misfire, it never fires, and the volatility brake silently disappears.
  • golden_cross — marked a regime filter, not an entry. It is true for months, so firing it as a trigger fires on every bar of a bull market.
  • volume_spike_confirmation is a strict subset of rsi_oversold_reversal, and williams_r_reversal is the inverted stochastic_oversold. Both pairs agreeing is one idea counted twice, not confirmation — now stated where the selection is made.

Verification

Comments cannot change compiled output, so the source/IR conformance guard was never at risk — but it was verified rather than assumed:

  • 0 non-comment lines changed; strategy bodies are byte-identical
  • source/IR conformance guard passes; the corpus loads through a consumer's catalog reader — 21 strategies (15 library + 6 examples), 17 directional
  • Nano suite 339 passed, 2 skipped
  • 15 of 15 library entries carry both REGIME: and CALIBRATED ON:
  • ASCII-clean — em-dashes introduced while authoring were normalised, since the library had been pure ASCII

Cost

The rendered catalog grows to roughly 4.9k tokens for a consumer that loads the whole library each cycle. That is the price of a selection filter and is the intended trade, but it is a real per-cycle cost worth watching.

🤖 Generated with Claude Code

Each library strategy carried a two- or three-line header restating the
condition its IR already encodes. That is zero selection value: it says what
the strategy does, never when it applies or when it must not fire.

ATS reads this block verbatim (llmre/nano_catalog.py reads the leading //
comment block and renders it beside the compiled intent) and it is the only
place a rejection can be expressed, because the proposal engine retargets a
published rule to the live instrument but carries its thresholds unchanged.

Each header now states the regime it belongs to and the regimes where it must
NOT fire, the conditions that must hold first, what invalidates it, its shape
on the chart, the near-neighbour it gets confused with, and the instrument
class its thresholds were calibrated on.

That last field is the one that prevents silent damage. Several thresholds do
not travel: ROC > 5 is an ordinary hour for BTC and a limit move for an index
future, and BB_WIDTH < 4 is an absolute percentage that stops discriminating
on a quieter instrument. ATR_PCT > 5 is the worst case — carried across
unchanged it does not misfire, it never fires, and the volatility brake
silently disappears.

Comments only. No IR changes, so the source/IR conformance guard is unaffected.
@AetherAI3 AetherAI3 changed the title Strategy application context, and catch main up to the 1.0.0 line Strategy application context — when each strategy applies, and when it must not fire Aug 6, 2026
@AetherAI3
AetherAI3 merged commit ca9c7a6 into main Aug 6, 2026
5 checks passed
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