# ADR 0002 — The Agentic Strategy Factory

Status: accepted (vision); building incrementally.
Supersedes the "single agent" framing of the first agentic layer.

## Context

The goal is not "find an edge" or "run one research agent on demand". It is a **standing factory**:
a fleet of agents that *continuously* seek opportunities and create strategies that may work *in a
particular market regime*, feeding a persistent, adaptively-allocated **multi-strategy book**. Edges
decay and regimes shift, so the population of strategies must be continuously bred, validated, deployed,
monitored, and retired — like a systematic fund's research floor, but agentic.

## The one constraint everything is designed around: multiple-testing at fleet scale

We proved it small: 48 blind candidates pushed the honest deflated-Sharpe bar to ~1.7 Sharpe and nothing
survived. A fleet searching *constantly* makes the effective trial count explode — a naive "search
everything always" factory is a **false-positive machine**. More search → higher penalty → less real
alpha. The architecture must therefore be built around four disciplines (they are the moat):

1. **Structured search, not flat brute-force.** Agents search within economically-motivated families ×
   regimes. A theory-grounded regime-fit hypothesis carries a prior that legitimately lowers its
   multiple-testing burden; a blind grid does not.
2. **Regime-conditioning as structure.** Evaluating a strategy *within* its regime is more powerful
   (finds specialists invisible on the full sample) AND more disciplined (a theory-driven split, not a
   data-mined one).
3. **Forward-validation as the un-gameable filter.** The gauntlet is a cheap *pre-filter*; backtest
   survivors are *hypotheses*. Real-time paper tracking cannot be multiple-tested away. Only K strategies
   can be forward-tracked at once → that slot budget is a natural throttle on the effective search.
4. **Global trial accounting.** The store records every hypothesis ever tested; deflation uses that
   global N. Honest at scale, even when the honest answer is "forward-validate the few that survive".

## Decision — layered architecture

- **Regime layer** (new): causal classifier labelling market state (volatility × trend, later cross-asset
  risk-on/off). Strategies are discovered and tagged *conditional on regime*.
- **Fleet orchestrator** (new): spawns N concurrent specialist agents (trend-hunter, meanrev-hunter,
  vol-hunter, new-market-scout), assigns territories (regime × family × market), collects + dedups
  findings, and re-tasks toward gaps (uncovered regimes) and decay (deployed strategies losing their edge).
  Runs continuously.
- **Strategy-lifecycle store** (new): the persistent backbone. Each strategy carries its spec, regime
  tags, per-regime verdict, status (discovered → forward-tracking → deployed → monitored → retired), live
  track record, and contributes to the global trial count.
- **Forward-validation pipeline** (new): daily paper-NAV per promoted candidate; the real filter;
  slot-budgeted.
- **Regime-conditional execution** (extends the existing book/execution): detect today's regime → activate
  the matching deployed specialists → net to a book → route to IBKR.

Reused as-is: gauntlet (→ per-regime, global-N pre-filter), discovery (→ an agent's inner loop), portfolio
book + combine_returns (→ the execution book), agent + tools (→ the unit worker), survivor library (→ the
lifecycle store).

## Build order

1. Regime layer (foundational; reshapes gauntlet + discovery).
2. Strategy-lifecycle store (regime tags + status + global N).
3. Fleet orchestrator (concurrent specialist agents, continuous, gap+decay-driven).
4. Forward-validation pipeline (slot-budgeted, the real filter).
5. Regime-conditional execution.
6. Later: composable strategy primitives + sandboxed code-generation (open-ended creation).

## Consequences

- The factory is honest by construction: it will often conclude "nothing new survives — keep
  forward-tracking the current specialists." That restraint IS the alpha.
- It becomes a *running system*, not a CLI tool: an orchestrator daemon + workers + store + the data and
  execution layers. This is the "infra layer".
- Open-ended code-generating agents are powerful but raise overfitting and code-safety risks; they come
  last, behind the strongest discipline (global-N deflation + forward-validation + sandboxing).
