Architecture Decision Records

This directory holds ADRs — short, dated documents capturing significant architectural decisions, the alternatives considered, and the rationale for the choice.

The format follows Michael Nygard's original proposal: numbered, markdown, structured. Each ADR is immutable once merged — supersede with a new ADR rather than editing.

#Index

Title Status Date
0001 Hexagonal architecture Accepted 2026-04-15
0002 .mli files for every domain module Accepted 2026-04-16
0003 Custom streams on Seq.t over FRP libraries Accepted 2026-04-17
0004 One Pipeline.run for Backtest and Live Accepted 2026-04-17
0005 Reservations ledger for order lifecycle Accepted 2026-04-18
0006 Per-aggregate domain layout Accepted 2026-04-28
0007 Decimal as canonical string in DTOs Accepted 2026-05-01
0008 Margin model for short selling Accepted 2026-05-02
0009 Portfolio Management bounded context Accepted 2026-05-03
0010 Alpha-mind vs bracket-exit projection on the strategy → PM contract Accepted 2026-05-05
0011 Risk evacuation from Strategy; pre_trade_risk and execution_management BCs; Place_order saga Accepted 2026-05-08
0012 Paper broker as a bounded context; matching engine in Why3-verified domain Accepted 2026-05-14
0013 Time injection: Domain takes timestamps, Application reads from injected Clock Accepted 2026-05-14
0014 ATD-generated wire contracts for cross-BC DTOs Accepted 2026-05-16
0015 Broker domain model Accepted 2026-05-16
0016 Execution-strategy abstraction (closed variant) Accepted 2026-05-17
0017 OrderTicket aggregate + OMS/EMS layering inside execution_management Accepted 2026-05-17
0018 In-memory ticket store as transitional persistence Accepted 2026-05-17
0019 execution_directive provenance: PM authors, PTR passes through, EMS consumes Accepted 2026-05-17
0020 Order_management as a separate Bounded Context Accepted 2026-05-17
0021 Intake gates (kill_switch, rate_limit) belong to pre_trade_risk Accepted 2026-05-17
0022 Order_process_manager owns Account commit and release Accepted 2026-05-17
0023 Broker bar feed into execution_management — one subscriber, two ports Accepted 2026-05-19
0024 Equity-anchored sizing with explicit Risk_config Accepted 2026-05-19
0025 Volatility-target sizing as the first vol-aware policy Accepted 2026-05-19
0026 Bar streams as first-class subscriptions; multi-timeframe routing through domain BCs Proposed 2026-05-20
0027 Adaptive-β pair mean reversion as a sibling policy Accepted 2026-05-24
0028 Progressive reservation drawdown in Account Superseded by 0029 2026-05-24
0029 Single terminal commit: per-trade Trade_executed, one fill_recorded at ticket close Accepted 2026-05-25
0030 Alor broker ACL adapter Accepted 2026-05-25
0031 Layered runtime configuration precedence Accepted 2026-05-25
0032 Order_flow bounded context: footprint analysis on the public tape Accepted 2026-05-27
0033 Finam gRPC broker ACL adapter Accepted 2026-06-04

#Template

Copy this for new ADRs:

# NNNN. Title

**Status**: Proposed | Accepted | Deprecated | Superseded by NNNN
**Date**: YYYY-MM-DD

## Context

What is the situation that prompts this decision? What forces
are at play?

## Decision

What we're going to do.

## Alternatives considered

Other options we looked at, with honest trade-offs.

## Consequences

What becomes easier, what becomes harder, what we'll have to
watch for.

## References

Links to commits, discussions, external sources.

#Numbering

Four-digit left-padded, monotonically increasing. Don't renumber. If an ADR is superseded, the new one references it explicitly and the old one's status becomes Superseded by NNNN.

#When to write an ADR

Write one when the decision:

Skip for:

Rule of thumb: if explaining the decision would take a multi-paragraph git commit message, it probably deserves an ADR.