Polytraders Dev Guide
internal
v3 spine Phase 1 · Shared contracts 9 demo-wired · 0 shadow-ready · 0 production-live · 100 pending · 109 total 15/33 infra tasks the plan status board

The Plan

One page — the v3 build plan, the 11 runtime stages it ships, and the 109 bots assigned to each. The earlier four roadmap pages have been folded into this one.

BUILD ORDER 8 phases P1 → P8, each with an exit gate P1 Shared contracts P2 Data normalisation P3 Reporting P4 Core risk P5 Execution rails P6 One strategy P7 Replay + gov P8 More strategies we ship in this order currently in Phase 1 ship RUNTIME LOOP 11 stages instrument truth → monitoring S1 reg S2 ing S3 state S4 sig S5 fair S6 exec S7 risk S8 OMS S9 inv S10 rpl S11 mon loop runs forever in production S7 is the only trading gate run BOT LIBRARY 109 bots frozen at v3 scope intel 17 disc 6 strat 24 risk 19 exec 15 sec 9 gov 19 9 demo-wired · 100 awaiting

Where we are

Phase 1 — Shared contracts is in progress.

Frozen typed wire objects and the reason-code registry. Every other phase imports from here.

Bot library

109 bots, frozen at v3 scope. 9 demo-wired against the synthetic feed.

0 shadow-ready, 0 production-live yet — we never overstate readiness.

Browse

11 stages · 5 classes · 7 layers · by readiness

How to read this page
  • Phases (P1–P8) are the build order. Each phase has an exit gate that must be green before the next phase starts.
  • Stages (S1–S11) are the runtime loop — instrument truth → ingestion → state → signals → fair value → execution estimate → decision → OMS → inventory → replay → monitoring.
  • Phases ship stages. Most phases unlock multiple stages — the matrix below shows which.
  • Bots are the 109 decision modules. Each bot lives in exactly one phase and one or more stages. We never call a bot "done" — nothing is production-live.
  • Done · In progress · Locked · Pending apply to phases. Demo-wired applies to bots (reference impl exists against the synthetic feed; no fixtures yet).

Phase × Stage matrix

Each ● marks a phase that advances a runtime stage. Cell colour reflects phase state.

Phase ↓ · Stage →S1S2S3S4S5S6S7S8S9S10S11Bots
P1 Shared contracts0 bots
P2 Data normalisation26 bots
P3 Reporting & event store6 bots
P4 Core risk17 bots
P5 Execution rails24 bots
P6 One simple strategy1 bot
P7 Governance & replay12 bots
P8 Additional strategies23 bots

The eight phases in detail

Phase 1

Shared contracts

in progress ◀ we are here

Frozen typed wire objects and the reason-code registry. Every other phase imports from here.

Bots in this phase · no bots in this phase

15/17 infra tasks done
Exit gate

Contracts package verifies green. Schemas page renders from manifest. Mock adapter validates fixtures against the published schemas.

Infra tasks (15/17)
StateIDTask
donep1.contracts-packageCreate packages/polytraders-contracts with TS + JSON schemas
donep1.schema-manifestschemas/manifest.json is the single source of truth for the dev guide
donep1.verify-scripttests/verify-contracts.js — every TS file pairs with a schema, every schema has $id/title/description
donep1.dev-guide-reads-manifest/standards/schemas reads from the manifest, not from inline strings
donep1.reason-code-patternAll reason codes match ^(INTEL|DISC|STRAT|RISK|EXEC|SEC|GOV)_[A-Z0-9_]+$ — enforced by schema
donep1.three-score-modelThree-score model (docs/impl/runtime) added to every bot page
donep1.capital-impact-fieldcapital_impact added to every bot — Critical / Direct / Indirect
donep1.quarantine-modeQuarantine mode added to risk/exec/sec bot mode_support
donep1.deprecated-statusDeprecated status supported with tombstone renderer
donep1.status-board/roadmap/status — by-bot, by-phase, by-task views
donep1.v3-plan-page/roadmap/v3 — 8-phase timeline with done / in-progress / locked / pending pills
donep1.system-health-barThin strip under topnav showing v3 phase + counts on every page
donep1.definition-of-done/standards/definition-of-done — what counts as readiness, what does not
donep1.forbidden-pattern-docsForbidden pattern: do not score documentation completeness as readiness
donep1.forbidden-pattern-riskForbidden pattern: do not allow risk to evaluate orders before strategy emits an OrderIntent
pendingp1.cli-bot-newCLI: pt-bot new <slug> — scaffolds a bot from the matching class template
pendingp1.mock-adapterMock CLOB v2 adapter playing recorded fixtures through the contracts
Phase 2

Data normalisation

locked

Every consumer reads MarketSnapshot, OrderBookSnapshot and the freshness/quality wrappers. No bot consumes raw payloads.

Bots in this phase · 3 demo-wired of 26

disc: 6 · gov: 1 · intel: 17 · risk: 2

0/4 infra tasks done
Exit gate

All Intelligence and Discovery bots read normalised objects only. Three Risk overrides (stale_book, market_halt, api_degradation) cleared.

Infra tasks (0/4)
StateIDTask
pendingp2.contracts-importsReference Intel and Discovery bots import from @polytraders/contracts
pendingp2.fixture-packRecorded CLOB v2 fixture pack covering normal / warning / hard / failure
pendingp2.freshness-budgetsPer-source freshness budgets enforced at adapter boundary
pendingp2.provenance-hashEvery normalised object carries the source response hash
Phase 3

Reporting & event store

locked

ReportEnvelope is the only emit shape. Audit log, builder attribution, heartbeat, SLA, PnL all read from the envelope stream.

0/3 infra tasks done
Exit gate

Every bot in the reference set emits via the envelope. Free-text logging removed.

Infra tasks (0/3)
StateIDTask
pendingp3.envelope-runtimeRuntime emits envelopes with botVersion + configVersion auto-populated
pendingp3.audit-log-consumergov.audit_log consumes the envelope stream end-to-end
pendingp3.lint-no-freetextCI lint rule: no console.log / no free-text logger calls in bot code
Phase 4

Core risk

locked

Kill switch, compliance gate, drawdown, exposure, market quality, stale book, market halt — the pipeline that blocks bad intents before they sign.

Runtime stages advanced

Bots in this phase · 4 demo-wired of 17

risk: 17

0/3 infra tasks done
Exit gate

Every Risk bot emits a RiskVote against valid fixtures. Killswitch + compliance + walletpermissionguard enforced in shadow against last 7 days of intents.

Infra tasks (0/3)
StateIDTask
pendingp4.risk-pipeline-runtimeRuntime applies Risk bots in declared order and short-circuits on REJECT
pendingp4.killswitch-shadowrisk.killswitch running in shadow against historical intents
pendingp4.compliance-shadowrisk.compliance_gate running in shadow against historical intents
Phase 5

Execution rails

locked

Smart router, order shaper, fee/slippage estimator, order lifecycle manager, signing service, wallet permission guard.

Bots in this phase · 1 demo-wired of 24

exec: 15 · sec: 9

0/2 infra tasks done
Exit gate

An OrderIntent can become a SignedOrderRequest end-to-end through the mock adapter with builderCode populated.

Infra tasks (0/2)
StateIDTask
pendingp5.exec-plan-end-to-endOrderIntent → ExecutionPlan → SignedOrderRequest path through the mock adapter
pendingp5.builder-code-coverage100% builderCode coverage — emit fails closed if builderCode is missing
Phase 6

One simple strategy

locked

strat.maker_tight end-to-end. Proves the full Discovery → Intel → Strategy → Risk → Execution → Lifecycle → Governance pipeline.

Bots in this phase · 1 demo-wired of 1

strat: 1

0/1 infra tasks done
Exit gate

strat.maker_tight produces OrderIntents in shadow for 24 hours of fixtures with zero schema-validation failures.

Infra tasks (0/1)
StateIDTask
pendingp6.maker-tight-shadowstrat.maker_tight emits valid OrderIntents in shadow
Phase 7

Governance & replay

locked

Reconciler, replay simulator, config drift detector, incident commander, attribution reporter, PnL reporter, SLA reporter.

Bots in this phase · 0 wired of 12

gov: 12

0/2 infra tasks done
Exit gate

Replay simulator can re-derive every decision from the envelope stream alone.

Infra tasks (0/2)
StateIDTask
pendingp7.replay-from-envelopegov.replay_simulator reconstructs decisions from the envelope stream alone
pendingp7.reconcile-heartbeatgov.reconciler runs on heartbeat against on-chain state
Phase 8

Additional strategies

locked

Only after every other phase is locked. Adding strategies before this point is the most common build-order mistake.

Bots in this phase · 0 wired of 23

strat: 23

0/1 infra tasks done
Exit gate

Three additional Strategy bots in shadow, each emitting through the same pipeline as strat.maker_tight with no special-cased code paths.

Infra tasks (0/1)
StateIDTask
pendingp8.no-new-strategiesHard rule: no new Strategy bots until phases 1–7 lock

Stage → phase reverse lookup

If you’re looking at a stage page and want to know which phase ships it, this is the table. Each stage page also carries this card inline.

What replaced what

This page consolidates four prior pages — they now redirect here: