Build a crypto-options engine on an existing engineering system.
Options OS is a specification-driven repository for building crypto-options trading engines with Claude Code or Codex. It combines reusable financial libraries, an options-native domain model, venue adapters, engine specifications, agent execution controls, and conformance tooling.
You define the trading system. Options OS translates that definition into engineering contracts, resolves the required framework components, controls implementation, and verifies the resulting engine against the system it claims to implement.
What the repository provides.
options-os/
├── .agents/ shared agent capabilities
├── .claude/ Claude Code integration
├── .codex/ Codex integration
├── .docs/ operational documentation
├── .legal/ commercial licence and notices
├── .vscode/ editor configuration
├── execution/
│ ├── backlog/
│ ├── done/
│ ├── in-work/
│ ├── queued/
│ ├── support/
│ ├── EXECUTION_PROTOCOL.md
│ └── README.md
├── packages/
│ ├── adapter-deribit/
│ ├── libs/
│ └── ruff.toml
├── specifications/
│ ├── framework/
│ ├── libs/
│ └── README.md
├── tools/
│ ├── codemap/
│ ├── controls/
│ ├── flatten/
│ ├── lint/
│ ├── probes/
│ ├── scraper/
│ └── tree/
├── AGENTS.md
├── CLAUDE.md
├── INVARIANTS.md
├── PROFILE.md
├── Makefile
└── README.md
| Repository area | Provides |
|---|---|
| Domain model | Shared identifiers, units, instruments, prices, volatility, Greeks, structures, portfolios, orders, and lifecycle types. |
| Quantitative libraries | Pricing, volatility, Greeks, surfaces, portfolio aggregation, costs, PnL, mandates, risk, and hedging. |
| Trading foundations | Market-quality evaluation, trading models, order programs, messaging, configuration, logging, and notifications. |
| Venue boundary | Shared adapter contracts and a Deribit reference implementation covering market data, orders, fills, positions, errors, and reconciliation. |
| Specification system | Trading-system definition, engine contracts, venue contracts, library contracts, assemblies, and dependency bindings. |
| Agentic build layer | Shared controls, skills, hooks, and workflows for Claude Code and Codex. |
| Verification | Architecture enforcement, tests, readiness checks, code mapping, and contract-to-implementation conformance. |
Reusable options-system capabilities.
The framework is implemented as separate libraries with explicit contracts and dependency boundaries. Libraries establish facts, plans, and verdicts. They do not own strategy policy.
| Capability | Libraries | Responsibility |
|---|---|---|
| Canonical domain | canonical |
Shared quantitative vocabulary, identifiers, units, primitives, enums, and immutable domain objects. |
| Infrastructure | config, logger, message-bus, notification |
Configuration, observability, and explicit communication boundaries. |
| Market domain | instrument, price-facts, market-quality |
Normalized instruments, qualified prices, freshness, validity, and market-quality classifications. |
| Quantitative model | quant-pricing, quant-volatility, quant-greeks, quant-surface |
Valuation, implied volatility, sensitivities, smiles, skew, term structure, and surface facts. |
| Portfolio economics | quant-cost, pnl-algebra, quant-portfolio |
Fees, spread, slippage, funding, carry, PnL, and portfolio-level exposure aggregation. |
| Risk and hedging | mandate, risk-kernel, hedging |
Mandate evaluation, risk verdicts, residual exposure, hedge targets, and hedge plans. |
| Trading and execution | trading-model, order-algebra, adapter-core |
Trading facts, order programs, lifecycle contracts, adapter capabilities, and runtime substrate. |
The hedging library can produce a hedge plan. The risk kernel can produce a verdict. The engine decides whether to hedge, reduce risk, reject an entry, or halt.
Financial meaning is separated from effects.
Options OS structures reusable code through a progression from domain vocabulary to controlled interaction with the outside world.
primitives → enums → objects → algebra + laws
↓
morphisms
↓
pipelines
↓
programs
↓
interpreter
↓
effects
↓
runtime → world
| Layer | Owns |
|---|---|
| Primitives and enums | Units, identifiers, and closed semantic alternatives. |
| Objects | Immutable financial and operational values. |
| Algebra and laws | Pure calculations, identities, aggregation, and comparison. |
| Morphisms and pipelines | Pure transformations and their named composition. |
| Programs | Instructions and causal order represented as data. |
| Interpreters | Translation of programs into explicit capabilities. |
| Effects | Network, database, clock, filesystem, and mutable state. |
| Runtime | Dependency selection, scheduling, supervision, and resources. |
Effects begin at the interpreter boundary. Pricing, portfolio, risk, and order meaning remain testable without opening a network connection, reading a database, or importing a venue client.
Trading intent becomes an engineering contract.
The entry point is a structured trading-system definition. It records the strategy thesis, market observations, inputs, setup and signal rules, candidate construction, entries, exits, portfolio allocation, risk, hedging, order lifecycle, reconciliation, recovery, and runtime modes.
The accepted definition is translated into three coordinated engine contracts:
| Contract | Owns |
|---|---|
| Engine specification | Strategy meaning, facts, state, decisions, risk, attribution, and variation points. |
| Operations specification | Lifecycles, book, execution, persistence, degraded operation, reconciliation, recovery, and replay. |
| Scenario specification | Decision cases, lifecycle episodes, failures, restart, isolation, performance, and controlled-runtime evidence. |
Venue specifications separately own venue-native capabilities and behaviour. Library specifications own reusable financial meaning. Assembly bindings resolve the engine contract against selected libraries, venues, and infrastructure without redefining them.
trading definition
↓
engine contracts
↓
venue + library contracts
↓
assembly + bindings
↓
resolved contract map
The repository controls how agents change the system.
Claude Code and Codex consume the same engineering authority, shared agent capabilities, and completion rules. The agent does not reconstruct the architecture from code or decide what “done” means while implementing.
| Component | Responsibility |
|---|---|
| Agent contracts | Give Claude Code and Codex the same repository execution rules. |
| Skills | Supply specialized procedures for specification, construction, integration, auditing, and repair. |
| Hooks and controls | Enforce repository rules before, during, and after agent actions. |
| Execution protocol | Converts an accepted plan into dependency-closed implementation packets with one progress authority. |
| Verification workflows | Build, change, repair, certify, and evaluate release readiness. |
Repository workflows
build-systemchange-systemcorrect-defectcertify-trading-buildrelease-readiness
Work is implemented as the smallest dependency-closed causal cut. Every affected consumer, contract, and verification surface is updated within the same cut.
Prove the complete engine lifecycle.
Deribit market data
↓
normalized option instruments
↓
strategy facts and decision
↓
canonical order program
↓
adapter interpretation
↓
orders, fills and positions
↓
portfolio, PnL and risk
↓
exit or settlement
↓
restart and reconciliation
The first engine should use one venue, one underlying, one book, and one explicit operating policy. This exercises the actual seams where trading engines fail: financial identity, order state, partial fills, fees, position adoption, risk, settlement, restart, and venue reconciliation.
Additional venues and strategies come after this spine is coherent.
Compare accepted meaning with implemented behaviour.
specifications
↓
types + schemas
↓
invariants + architecture rules
↓
unit + property tests
↓
integration + contract tests
↓
lifecycle + acceptance scenarios
↓
static analysis + quality gates
↓
runtime evidence
↓
conformance
Options OS generates distinct evidence artifacts for distinct questions:
| Artifact | Question answered |
|---|---|
| Blueprint manifest | Which contracts, providers, bindings, and topology were selected? |
| Contract map | Which accepted rules must the implementation satisfy? |
| Readiness result | Which decisions, capabilities, or evidence still block the build? |
| Code map | Where does each rule exist in code, configuration, and tests? |
| Conformance result | Which rules are covered, missing, contradictory, or unverifiable? |
A similarly named module is not implementation evidence. The code must preserve the rule’s inputs, units, state transitions, failure behaviour, and invariants.
The exact procedures ship with the repository.
The private documentation turns the public architecture into an executable workflow:
- Verified installation and package provisioning
- Complete repository map and dependency graph
- Field-by-field trading-system definition
- Specification acceptance and assembly procedures
- Vertical-spine implementation map
- Copyable Claude Code and Codex directives
- Executable verification and conformance commands
- Venue probes, troubleshooting, security, and support
The public documentation exposes the architecture and construction model. The licensed repository contains the authoritative specifications, schemas, controls, generators, and operating procedures.
Repository access: bella@leanos.tech