Case study · AI engineering · Software factory
AIMStack: the software factory behind iTradeAIMS
One person can't build and run a licence server, a range of MetaTrader products and a membership website by hand. So I built a factory to do it: a repeatable line where a written spec goes in, AI coding agents build and review the work under fixed rules, and tested, documented software comes out. The agents do the work. I decide what gets built, I read the evidence, and I merge every change.
- Role
- Designer and operator of the factory
- Timeline
- October 2025 – present
- Built with it
- the licence server, Banana EA 7.0, the iTradeAIMS website
- written rules every agent must follow, each tied to a real failure
- 15
- AI coding tools fed from one source: Claude Code, Codex, Cursor, Antigravity
- 4
- skills in 4 plugins: method, network, trading, delivery
- 33
- commits on the factory itself
- 836
- human who merges: me
- 1
The problem
Why this needed building
What goes wrong with AI agents by default
- Agents report "tests pass" or "it's deployed" when it isn't true. They are confident whether or not they are right.
- Two agents editing the same files overwrite each other.
- An agent reviewing its own work, or work from the same model, tends to miss the same mistakes.
- When an agent runs out of credits or context, everything it knew is lost.
What I needed
- Several agents working in parallel without getting in each other's way.
- Every claim backed by output I can check myself.
- Work that survives an agent stopping halfway.
- One set of instructions shared by every tool, so they don't drift apart.
- Decisions with real consequences, such as deploys, payments and merges, stay with me.
Architecture
How it fits together
Select a box to see what it does, or pick a journey and press Play to follow it step by step.
Rule: nothing reaches the main branch without output a person can check.
Each box is a part of the system
Click one to read what it does and why it was built that way.
Key decisions
What I chose, and what I rejected
Each one is a written decision record in the repository.
One writer per isolated workspaceArchitecture
Each writing agent gets its own git worktree, a separate copy of the repository on its own branch. Work moves between agents only as commits.
Rejected: a shared state file with locks that agents had to respect. Agents forgot to take or release locks, and one crash could block everyone. Replacing it needed a new decision record, which supersedes the old one.
The reviewer comes from a different model familyQuality
Code written by one tool is reviewed by another, for example Claude-written code reviewed by Codex or DeepSeek, in a separate workspace, against the exact commit.
Rejected: self-review, and review by the same model, which tend to repeat the writer's assumptions. Also rejected: reviewing uncommitted files, because then nobody can say exactly what was approved.
A claim without output is a guessProcess
'Tests pass', 'it's deployed' and 'the endpoint is up' count only with the command output pasted. Sign-off is tied to a commit, so later changes need a new review.
Rejected: trusting an agent's summary. Summaries were confidently wrong often enough that checking them stopped being optional.
State lives in files, not in an agent's headReliability
Each loop ends by writing a checkpoint, and agent memory is kept as plain files in git and loaded automatically at the start of a session. Any tool can read it, and any agent can take over.
Rejected: relying on chat history or memory that only one tool can see. An agent that dies takes that knowledge with it.
Agents never assign themselves workControl
Only issues I have assigned get worked on. Anything with consequences outside the repository, such as deploys, payments or customer email, needs my yes.
Rejected: letting agents pick up whatever looks useful. That leads to duplicate work, work nobody asked for, and actions I didn't approve.
A factory, not an autopilotControl
The factory makes the work repeatable: every job goes through the same spec, build, cross-review and evidence gate. The decisions stay human. I choose what is built, rule on trade-offs, and approve anything that touches customers, money or production.
Rejected: letting agents run end to end unattended. The incidents below show what agents report when nobody checks.
One skill library, built for every toolEngineering
Skills and instructions are written once and generated as plugins for Claude Code, Codex, Cursor and Antigravity. A skill stays only if a with/without test shows it changes behaviour.
Rejected: copying prompts into each tool by hand, which drifts within weeks. Also rejected: keeping skills that sound useful but change nothing measurable. A 'skill diet' decision cut the library down.
In production
Failures that shaped the rules
Each rule the agents follow exists because something went wrong in real work. These are some of them.
"Zero problems left", but there were fourEvidence
Symptom
An agent reported that a cleanup was complete: zero of a banned pattern remained.
Diagnosis
An independent recount by a second agent found four. The first agent had reported what it expected to find, not what it measured.
Fix
Rule 1: a claim without command output is a guess. Reviewers recount instead of reading the summary.
A passing test guarding a button that no longer existedTesting
Symptom
A test checking for three Activate buttons passed for weeks.
Diagnosis
The button it was meant to protect had been deleted. The count was being met by other buttons on the page. The suite stayed green the whole time.
Fix
Rule 2: before claiming a test protects something, break the code on purpose and watch the test fail, then restore it.
A test mode that made staging always passTesting
Symptom
Every activation test on the staging site passed for months.
Diagnosis
A test-mode switch returned fake success before any real call was made. Three separate production faults were invisible on staging because of it.
Fix
Rule 6: a fake that reports success is worse than an outage. Any pass claim must say which test switches were on.
The version number said one thing, the files said anotherDeployment
Symptom
Production reported an old plugin version.
Diagnosis
Comparing the files showed that two of the three shipped files already matched the latest code. A deploy planned from the version number alone would have shipped the wrong thing.
Fix
Rule 5: compare files by checksum against committed content, never trust a version label.
Access granted when the answer was 'unknown'Security
Symptom
Access checks let people in when a dependency was missing.
Diagnosis
The code treated anything other than an exact 'no' as 'yes', so an empty or missing value granted access.
Fix
Rule 7: security checks fail closed. Removing a check to stop an error is not a fix.
An agent 'fixed' something that was removed on purposeDecisions
Symptom
An agent found a missing button, called it a regression and restored it.
Diagnosis
The button had been removed deliberately, but the old decision record still described the old design. In a diff, a deliberate deletion and an accidental one look the same.
Fix
Rules 3 and 4: check the history before calling something a regression, and update the decision record in the same change that reverses it.
Method
How I built it
- 1
The rules are a short written "constitution". Each rule names the incident that caused it, so agents and people can see why it exists.
- 2
Every process step has to match a published engineering practice (for example Fowler, Feathers, Ousterhout, Nygard's decision records). If a step is made up, it needs its own written reason or it gets removed.
- 3
Skills are tested by running the same task with and without the skill and comparing the results. A skill that doesn't change behaviour gets cut.
- 4
I wrote the rules, the decisions and the acceptance tests. The agents wrote most of the code under that system, and I reviewed and merged it.
- 5
The other case studies on this site came off this line. The Banana EA rebuild, for example, went from audit to tested MT5 engine in 122 commits and 33 merged pull requests over 24 days.
Stack
Technology
- Claude Code
- OpenAI Codex
- Cursor
- Google Antigravity
- Kimi
- DeepSeek
- Claude Code plugins & hooks
- MCP servers
- Git worktrees
- GitHub Issues & Actions
- TypeScript
- PowerShell
- Fly.io
What this means for your team
If your team uses AI coding tools and isn't sure it can trust the output, I can set up the same kind of software factory for you: shared skills and instructions, isolated workspaces, cross-model review, and checks that require evidence before a merge.
I also build Claude Code plugins, skills and MCP servers, and I can review an existing AI-assisted codebase for false claims and weak tests.
This page describes how the factory works only. Internal hosts, credentials and customer data are deliberately left out. AIMStack itself is private; baton, the hand-off tool, is open source.