STMAA: directing the development of a complex software system with AI
A personal R&D project that turned an ambitious goal — building a systematic-trading framework — into a structured process covering requirements, architecture, AI-assisted development, testing, operational controls and documented audits.
Context and challenge
STMAA (Structural Trading Multi-Agent Architecture) started as an experimental project for quantitative research, portfolio-weight generation, backtesting, risk controls and broker integration in a Paper environment. The challenge was not simply to implement a strategy: it was to coordinate interdependent components and make data, decisions, operational state, results and limitations verifiable.
The project was developed by one person through an iterative workflow with AI assistants. This required a method for breaking down complex goals, maintaining context, controlling changes and distinguishing generated code from software that had actually been verified.
My role
I directed the project and coordinated its AI-assisted development lifecycle. My contribution focused on:
- Defining objectives, functional requirements and operational constraints.
- Breaking the system into components, setting priorities and making design decisions.
- Defining risk controls, fail-closed behaviour and boundaries the system must not cross.
- Coordinating implementation through AI assistants, dedicated branches and pull requests.
- Evaluating tests, CI results, audits and evidence before accepting changes.
- Documenting limitations, anomalies, findings and residual risks instead of presenting unproven results as successes.
The code was produced through an AI-assisted workflow. I do not claim to have manually written every component: the documented contribution is the ability to define the problem, direct the process, evaluate outputs and require proportionate verification.
System architecture
The framework separates its main responsibilities: market-data ingestion and validation, feature engineering, PPO strategy, risk overlay, execution engine, state persistence and monitoring.
- Market data and validity/freshness checks.
- Strategy and portfolio-weight generation.
- Position, exposure and drawdown limits.
- Separation between research logic and broker integration.
- SQLite persistence, events and execution lifecycle.
- Terminal dashboard with local read-only providers.
Stack and tools
Python 3.12, PyTorch, Stable-Baselines3, Gymnasium, pandas, NumPy, SQLite, the Alpaca Paper API and the Textual terminal interface. The quality workflow includes pytest, Ruff, GitHub Actions and security checks such as Gitleaks, Bandit and Semgrep.
The repository also contains technical documentation, versioned contracts, benchmark reports, operational runbooks and regression tests.
Development and control method
Work was organised into short, verifiable cycles:
- Define: problem, scope, requirements and acceptance criteria.
- Implement: focused changes on dedicated branches through pull requests.
- Verify: targeted tests, CI and security scans relevant to each change.
- Evaluate: compare expected behaviour with observed evidence; unexecuted tests remain explicitly identified.
- Consolidate: document outcomes, limitations and residual risks before proceeding.
A central project rule is fail-closed behaviour: when critical data or state is missing, stale or inconsistent, the affected path must be blocked rather than assuming favourable conditions.
Scale and verifiable evidence
At the documented 5 December 2026 baseline, the repository contained 276 tracked files: 76 application Python files and 139 Python test files.
- Model distribution: PPO loading verified from a clean clone, including artifact-integrity checks.
- Onboarding: phase P2 closed as PASS WITH RESIDUAL RISKS; the wizard, diagnostics and preflight are documented.
- Operational reliability: P3.1–P3.4 closed within their documented scopes, covering isolated backup/restore, update/rollback procedure, recovery and incident runbook.
- Paper Shadow Pilot: an authorised two-hour, read-only session with 111 heartbeats, 111 shadow observations and 111 PPO inferences; zero STOP/ERROR events and no orders or exposure generated by the pilot.
- Quality: pull requests with CI workflows and security checks completed successfully; these results apply to the individual PRs and commits, not to an overall certification.
Quantitative results and what they do not prove
The documented quantitative validation included 11 folds and three PPO seeds (42, 7 and 21), for 33 runs. Results showed seed sensitivity and did not establish a robust, generalisable strategy advantage over benchmarks. Reported averages are descriptive per-fold figures, not chained or compounded returns.
For this reason, STMAA is not presented as a profitable trading system. Controlled Paper validation remains open: P4.1 passed the shadow pilot, while P4.2 is blocked after a fail-closed check stopped an attempt before submission was confirmed because of invalid price data. Further PPO research is deferred and frozen.
Skills and learning demonstrated
- Technical project direction and requirements/priorities management.
- AI-assisted development workflows and coordination of AI assistants/agents.
- Architectural reasoning about components, boundaries and dependencies.
- Definition of acceptance criteria and evaluation of test evidence.
- Risk-oriented thinking, failure handling and limitation documentation.
- GitHub lifecycle management: branches, pull requests, CI, review and consolidation.
The main lesson is that AI can accelerate software production, but it does not replace the responsibility of defining scope, evaluating evidence and deciding when a result is genuinely acceptable.
Project status and limitations
STMAA remains an experimental/alpha project. It is not certified, is not declared production-ready or live-trading-ready, does not manage client capital and has not demonstrated profitability. Tests and internal audits cover specific scopes and are not equivalent to independent validation or an absolute security guarantee.