coreytrading
An LLM-agent trading-operations system with reviewed, auditable state changes
Background
LLMs are useful for reading evidence and writing analysis, but they shouldn't move state or money directly. The design question was how to let them collaborate on research while code keeps full control over data, maths and writes.
Architecture
Scheduler → host controller → evidence capture (broker and market caches, valuation ledgers; frozen and hashed) → role workers (Claude / Codex, structured JSON only, no workspace or broker access) → host validation (policy, freshness, revision) → controlled card writer → receipts → human review and manual execution.
Key Highlights
Each agent receives a frozen, hashed evidence snapshot and must return schema-validated JSON
State changes go through a controlled writer: before-image backup, revision check, prepared receipt, and hash-based reconciliation instead of blind retries
Role-to-model routing with an explicit model and effort per call; call budgets (2 concurrent, 12 per rolling hour)
Exchange-calendar-gated scheduled jobs: pre-market briefing, post-close transition, a code-rendered macro lens, weekly review
~121K lines of Python with ~2,900 automated tests
Key Implementations
Models propose, code disposes
Workers get frozen evidence and return structured proposals; the host validates them against policy and the target's current revision before a controlled writer applies them.
Why: Model output is untrusted input. Validation, revision checks and receipts make every change explainable and reversible.
Uncertain writes are reconciled, not retried
Every write has a prepared receipt with before/after hashes; after a crash, recovery compares hashes and updates the receipt rather than repeating the write.
Why: The same idempotency discipline I used for payouts at work, applied to a single-user system.