The brain
The brain is Forven's sole orchestrator — it routes strategies through the pipeline, dispatches agents, enforces gates, and keeps persistent notes and lessons.
The brain is the single coordinator at the centre of Forven. Every strategy that moves through the pipeline and every piece of work an agent produces passes through it. The brain is hub-and-spoke: agents return their output to the brain, the brain decides what happens next, and agents never task each other directly.
This page is for operators who want to understand what the brain actually does — how it routes a strategy from stage to stage, what guardrails it enforces, and how its memory and lessons accumulate over time.
Forven is a research tool. Nothing here predicts results, and nothing here is financial advice. Any numbers below are illustrative defaults from the app, not targets or promises.
What the brain is
The brain is not a traditional LLM agent. It is deterministic routing logic plus policy enforcement. It receives strategy containers from the pipeline, dispatches them to specialised agents, and drives lifecycle transitions through the real pipeline stages:
quick_screen → gauntlet → paper → live_graduated(The public site sometimes calls the paper stage a "candidate" — internally and throughout these docs it is paper.)
At each step the brain enforces quality gates before it lets a strategy advance: overfitting detection, backtest verification, and a runtime-loadability check. Capital-consuming transitions stop at an operator approval gate. The brain cannot override those gates itself.
Where you see it
- Strategies page — the stage column and the transition modal show the brain's routing decisions.
- Brain tab — its memory and lessons (see below).
- Approvals queue — the promotions and code changes the brain has queued for your review.
Hub-and-spoke orchestration
The brain dispatches work to four specialised agent roles:
| Agent | Responsibility |
|---|---|
strategy-developer | Code design and strategy authoring |
simulation-agent | Backtesting and gauntlet runs |
risk-manager | Approval and fill gating |
execution-trader | Live signal emission |
Each agent has role-specific tools and permissions. They do not call one another — every result returns to the brain, which decides the next action. This is the core safety property of the architecture: there is one place where decisions are made and audited.
The lifecycle loop
A typical strategy journey under brain orchestration:
- A user or agent registers a strategy (
create_strategy), which defaults to thequick_screenstage. - The brain evaluates the quality gates — overfitting and metrics integrity.
- If the strategy clears the
quick_screenguardrails, the brain can auto-promote it to the gauntlet (or block it on a gate failure). - The gauntlet runs the robustness suite — walk-forward analysis, parameter perturbation, Monte Carlo — and the brain samples the resulting robustness score.
- If the gauntlet passes, the brain queues a
strategy_promotion_approvalto move the strategy to paper. This requires an operator click unlessauto_approve_promotionsis set. - Once approved, the strategy enters paper trading. The
risk-managergates fills; the strategy never places orders directly. - If paper performance holds up, the brain queues a second approval — promotion to
live_graduated, which consumes real capital. - If a strategy fails any gate, the brain archives or rejects it and queues a
failure_post_mortemtask for analysis. - The brain records the outcome (success or failure) back to
brain_decisionsfor the audit trail.
Quality gates and guardrails
The brain enforces a set of automated guardrails before any advancement. These are deliberately fail-closed — when evidence is missing, the brain rejects rather than advances. The full gate reference lives in promotion gates; the brain-relevant guardrails are:
- Overfitting rejection — if in-sample vs out-of-sample Sharpe diverges by more than
1.5x(a training-overfit signature), or in-sample is negative while out-of-sample is positive (selection bias), the strategy is rejected. If walk-forward ran but out-of-sample results are missing, it is rejected too. - Drawdown ceiling — a max drawdown above
30%rejects. - Sharpe floor — a Sharpe below
0.3rejects. - Backtest-before-promotion — a strategy cannot be promoted without verified backtest results.
- Runtime loadability — the strategy module must load cleanly before paper or live admission.
- Regime safeguards — long entries are blocked in a downtrend.
These thresholds are illustrative defaults; quick_screen gates are tunable via the pipeline configuration.
The hardest guardrail runs below the brain in the research daemon: the kill-switch flattens all positions autonomously on a 10% drawdown, with no approval required. The brain respects that flag — it does not get a vote.
Brain memory
The brain keeps a single persistent operational note — its memory — that it injects into its own system prompt at the start of every cycle.
- It is a singleton row (
brain_memory) with a hard cap ofMAX_MEMORY_CHARS = 2000characters. - It supports
set,add, andremoveoperations. - It is never silently truncated. Exceeding the cap raises
BrainMemoryTooLargeError— the brain must trim its own notes deliberately. - Every mutation is recorded in
brain_memory_historywith before/after excerpts in the audit log.
Memory is wrapped in a cacheable fence so the prompt-cache hit rate can be tracked: when memory is unchanged between cycles, the leading prompt hash matches and the cache hits; when the brain rewrites its memory, the hash changes and the cache misses (expected). Diagnostics surfaces the resulting hit_rate = hits / (hits + misses).
This is distinct from the memory bank, which is the broader quant-skills knowledge store. Brain memory is the orchestrator's own small scratchpad.
Brain lessons
Separately from its 2000-char memory, the brain records lessons — durable self-judgments it forms while analysing strategy lifecycles.
Each lesson is a structured entry:
{
"situation_pattern": "...",
"lesson_text": "...",
"evidence_decisions": ["..."],
"confidence": 0.0
}confidenceranges from0to1.0.- Lessons are searchable with FTS5 full-text search by pattern or topic.
- Operators can view and edit lessons in the Lessons tab on the Brain page.
- The brain reads its highest-confidence lessons back into context so they influence future decisions.
The loop is deliberate: the brain observes outcomes, writes down what it learned, and re-reads the strongest lessons next time. Process discipline, made persistent.
Agent tasks and approval gates
The brain creates tasks and assigns them to agents. Task types include code_change, config_change, strategy_archive, code_fix, and post_mortem.
Tasks that change code or promote a strategy toward capital require an operator approval. The gate fires when:
- The task type is in
approval_required_task_types, and - The actor is not a direct human/operator action — actors in
{api, manual, user, ui}bypass the gate, because those represent explicit operator intent.
When the gate fires, the brain creates an approval row (for example approval_type = strategy_promotion_approval or strategy_dethrone_recommendation) with status pending_approval. You review it in the Approvals queue, see the strategy metrics and the brain's reasoning, and click Approve or Reject. On approval, the task transitions to running and the assigned agent executes it; the result is persisted to output_data and the cost is recorded. On rejection, the task stays pending and can be re-submitted or cancelled.
The brain cannot self-approve a capital transition. That is the line between an autonomous researcher and an autonomous trader, and the brain stays on the research side of it.
How the brain runs LLM calls
The brain and its agents route every LLM call through a configurable provider priority list with automatic fallback. You bring your own keys (BYOK), and the brain auto-retries down the chain on transient errors or rate limits. Auxiliary tasks (compression, recall, post-mortem) can use cheaper routing than primary reasoning.
Spend is bounded by an opt-in daily cost cap (agent_daily_cost_cap_usd, default 0 = disabled) that gates new task launches once today's total is reached. The full detail lives in models & providers and cost controls.
Caveats (beta)
- The brain is the orchestrator, not a trader. Agents emit signals and proposals; humans and the
risk-managergate every fill, and the research daemon owns the autonomous hard risk controls. - Brain memory is hard-capped at 2000 characters and will error rather than truncate — keep it tight.
- The agent layer (including the brain's LLM-driven dispatch) is part of the Forged tier; beta unlocks it for everyone.
- How much the brain acts on its own depends on your autonomy mode — in manual mode autonomous jobs are frozen, and the brain only routes work you initiate.
Forven is a local-first research lab, not a profit engine. Out-of-sample survival and process discipline are the point; past results do not predict future outcomes, and nothing here is financial advice.
Related
- Agents — the specialised roles the brain dispatches to.
- The research daemon — the autonomous loop and hard risk controls beneath the brain.
- Memory bank — the broader quant-skills knowledge store.
- Approvals — the queue that gates code changes and capital promotions.
Going live safely
The disciplined checklist before any real capital — paper→live gate, exchange test, shared-wallet pooling, phantom recovery, and the decay kill-switch.
Models & providers (BYOK)
Configure bring-your-own-key LLM routing in Forven — providers, primary and fallback chains, per-provider auth, and auxiliary task routing.