Summary
Milestone M2: the first concrete Target — the Archimedes strategy_spec DSL — used to prove the
whole pipeline against a real validity oracle. Implements the DSL grammar (BNF), the derivation→spec
builder, semantic repair, a Rust validity check mirroring validate_strategy_spec, and the
enum-conformance guard (D6) so the grammar can't drift from strategy_dsl.py. Fitness is
synthetic/Rust in this phase (the real backtrader + rigor-gate fitness arrives with the later
Python-bridge phase, D7).
Spec: https://github.com/mnemonik-dev/genetic_algorithms/blob/main/docs/technical-reference/gggp-implementation-spec.md (§5)
DSL source of truth: Archimedes backend/archimedes/services/strategy_dsl.py. BNF: gggp-grammar-tech-review.md §3.
Scope
src/targets/archimedes.rs implementing Target:
grammar() — the DSL CFG: indicators {sma,ema,rsi,realized_vol,momentum}, cmp {gt,lt,gte,lte},
logic {and,or,not}, rebalance {daily,weekly,monthly}, sizing
{full_invested_when_in_market, equal_weight, inverse_vol, volatility_target}, price operands,
period Int[1,10000], annual_pct Float(0,1], tickers via FromSet.
build() — derivation → exact strategy_spec JSON; inject source_arxiv_ids from
GrammarConfig.metadata (provenance carried, not searched); set look_ahead_safe = true.
repair() — clamp period→[1,10000], ensure ≥1 asset, annual_pct>0, parameter_variants len∈[2,8], dedupe.
validate() — Rust port of the structural checks in validate_strategy_spec.
examples/evolve_faber.rs — evolve with the Archimedes target + a synthetic fitness.
- Tests: validity-invariant, mapping-roundtrip (Faber), repair, enum-conformance.
Acceptance criteria
Verify
cargo test -p evoforge-grammar
cargo run -p evoforge-grammar --example evolve_faber
Anti-goals (do NOT)
- Do not call Python or import the real backtest/rigor gate (D7 → later phase); fitness is synthetic.
- Do not widen the DSL's indicator/operator set (that touches the live Archimedes interpreter — separate, review-gated change).
- Do not add NSGA-II (D5), one-point crossover (D2 → M3), resume (D4), or PyO3 (D7).
- Do not modify
evoforge core or strategy_dsl.py.
Notes
Depends on M1 (#2). After this, the GE pipeline is end-to-end provable in pure Rust; M3 (operators)
and M4 (release) follow, then the separate Python-bridge phase wires the real Archimedes fitness.
Summary
Milestone M2: the first concrete
Target— the Archimedesstrategy_specDSL — used to prove thewhole pipeline against a real validity oracle. Implements the DSL grammar (BNF), the derivation→spec
builder, semantic repair, a Rust validity check mirroring
validate_strategy_spec, and theenum-conformance guard (D6) so the grammar can't drift from
strategy_dsl.py. Fitness issynthetic/Rust in this phase (the real backtrader + rigor-gate fitness arrives with the later
Python-bridge phase, D7).
Spec: https://github.com/mnemonik-dev/genetic_algorithms/blob/main/docs/technical-reference/gggp-implementation-spec.md (§5)
DSL source of truth: Archimedes
backend/archimedes/services/strategy_dsl.py. BNF:gggp-grammar-tech-review.md§3.Scope
src/targets/archimedes.rsimplementingTarget:grammar()— the DSL CFG: indicators{sma,ema,rsi,realized_vol,momentum}, cmp{gt,lt,gte,lte},logic
{and,or,not}, rebalance{daily,weekly,monthly}, sizing{full_invested_when_in_market, equal_weight, inverse_vol, volatility_target}, price operands,period
Int[1,10000],annual_pct Float(0,1], tickers viaFromSet.build()— derivation → exactstrategy_specJSON; injectsource_arxiv_idsfromGrammarConfig.metadata(provenance carried, not searched); setlook_ahead_safe = true.repair()— clampperiod→[1,10000], ensure ≥1 asset,annual_pct>0,parameter_variantslen∈[2,8], dedupe.validate()— Rust port of the structural checks invalidate_strategy_spec.examples/evolve_faber.rs— evolve with the Archimedes target + a synthetic fitness.Acceptance criteria
cargo test -p evoforge-grammar→0 failed.ArchimedesTarget::validate(100%, 0 failures).FABER_2007_SPECexactly.period/ emptyasset_universe/annual_pct<=0are repairedto specs that then validate.
(
INDICATOR_NAMES,COMPARISON_OPS,LOGIC_OPS,REBALANCE_FREQUENCIES,POSITION_SIZING_TYPES).The expected values are pinned in the test (with a comment pointing at
strategy_dsl.py); the testfails if the grammar diverges. (Since Python isn't imported here, the DSL values are mirrored as
constants — divergence from the real file is caught at review against the cited source.)
cargo fmt --check+clippy -D warningsclean.Verify
Anti-goals (do NOT)
evoforgecore orstrategy_dsl.py.Notes
Depends on M1 (#2). After this, the GE pipeline is end-to-end provable in pure Rust; M3 (operators)
and M4 (release) follow, then the separate Python-bridge phase wires the real Archimedes fitness.