Building the office: system design and an engineering team for an AI investment house
How Owl of Wall Street's CTO agent and I designed the systems behind the company: a website that keeps content and looks apart, data tools as a command line, and a user-facing advisor that runs on the Claude Code harness itself. Then a small engineering team of agents, and the first task it shipped.
The last post ended with two problems. The first approved article sat in a git repository where nobody could read it. And the agents kept hitting the same data gaps: the clearest was the Anthropic prospectus, a 14 MB filing that five agents tried and failed to read, because the web tool stops at 10 MB.
Both are engineering problems, so this week was the CTO agent’s first real work. The CTO is an agent I talk to directly rather than one the weekly workflow calls. We spent two sessions on the system design, then on how engineering itself should be staffed, and then put the first task through the new team.
Three systems
Owl needs three things built. Everything else, like the payment rails and which models run the advisor, waits until it matters.
| System | What it does | Choice |
|---|---|---|
| Website | Where readers find the weekly insights, the educational curriculum and the track record | A static site built with Astro, from the Markdown already in the repository |
| Data tools | What the agents use instead of hunting through web search: filings, prices, index data | A command-line tool, owl-data, written in Python |
| Advisor | The user-facing agent on Telegram that turns goals into a portfolio | The Claude Code harness itself, run by our own worker |
The CTO’s working method made this go quickly. For every decision it gives two or three options in a table, with cost, effort, risk and how easy the choice is to reverse, and a recommendation. I decide. Each decision becomes a short decision record in the repository, written so an outside engineer could follow it. Five records came out of these two sessions.
The website: content and looks kept apart
I want the site to look professional, not like a default blog theme. I also wanted a clean split: the research and editorial agents write the content, and a separate designer agent decides how each piece looks on the site, without being able to change what it says.
The framework question turned out to be the easy part. How polished a site looks comes from its design system (typography, layout, colour, components), not from the framework. Astro was the natural fit for a content site: it builds plain HTML from the Markdown and YAML already in the repository, ships no JavaScript unless a component needs it, and has no limits on design.
The split works in layers:
| Layer | Who owns it | What it is |
|---|---|---|
| Content | Research and editorial agents | The article itself, fact-checked and approved by me as today |
| Design system | Built once, approved by me | Layouts, typography and components such as the view box and chart figures |
| Presentation | The designer agent, each time an article is published | A small file next to the article: layout, which components go where, later images |
The designer never edits the article file, and that is enforced in code, not just in its instructions: a hook checks every file the agent tries to write and blocks anything outside its own paths. Its one strict content rule: a chart may only use numbers that appear in the article.
For now the site runs only on my machine. When I decide to publish, it moves to a free static host.
Data tools as a command line
The agents are Claude Code agents, so their natural interface is the shell. A command-line tool beats the alternatives for them: it costs nothing in context until it is used, --help documents it on demand, and the output can be piped and searched. It is also easy for me to use by hand.
The tool follows a few rules that come straight from the fact-checking problems of the first runs:
- Every value carries its provenance: the source, the URL, the date it refers to and when it was fetched. The Fact-Checker can trace any number back to where it came from.
- Free public sources only. No paid data licences. Each source sits behind its own interface, so swapping one means writing one small adapter.
- Fetch on demand, cache, and respect each source’s terms. No bulk extraction.
It is written in Python, which I know best and where the data libraries are. The code inside follows a strict layering: the core logic never touches the network or the disk directly; those sit at the edges and can be replaced. That rule is now checked automatically on every change, for a reason that comes up below.
The advisor: Claude Code as the backend
This was the decision I was most excited about, and it started as an idea I half expected the CTO to talk me out of.
The original plan was the usual one: an API endpoint, with an agent framework behind it running the conversation. But Anthropic published a piece on building always-on agents, and it made me ask: why build an agent harness at all? Claude Code already has the best one I have used. It manages context, compacts long conversations, loads skills, runs subagents and supports hooks. So the advisor could simply be a Claude Code agent, and a Telegram message is just an event that starts a run.
The CTO’s answer was that this is less unusual than it sounds. Anthropic’s Agent SDK is the Claude Code harness packaged as a library. The agent gets the same capabilities as the CLI; we get permission checks, our own tools and session handling as ordinary Python code.
The shape:
| Step | What happens |
|---|---|
| 1 | A Telegram adapter polls for new messages and writes each one to an inbox table. It polls outward, so no port is opened on my network |
| 2 | A single worker picks up messages. It runs several conversations at once, but at most one run per user, so two quick messages don’t get two parallel answers |
| 3 | Every message passes a deterministic gateway and a screening agent before it reaches the advisor |
| 4 | The worker resumes that user’s session and runs the advisor, which uses the data tools, the planning engine and a reply tool |
| 5 | Check-ins and reminders sit in a timers table and arrive as inbox events like any message |
Email or Discord later means writing another adapter in front of the same inbox.
The security debate. A user-facing agent with real tools, running on my own hardware, takes untrusted text from strangers. My instinct was to put a security layer in front: a filter, possibly an agent, that blocks bad messages before the advisor sees them, rather than limiting what the advisor can do. The CTO agreed the filter is worth having, but argued it cannot be the only defence, for two reasons. Injected instructions can also arrive after the filter, through a web page or a document the advisor reads. And detection is probabilistic; one miss would hand my machine to an attacker.
We settled on keeping both: the screening layer, plus limits on what a successful attack could reach, not on what the agent can do. The advisor keeps its full toolset, but runs in one long-lived container that cannot see the rest of my machine or network and holds no secrets.
User data stays in the database. I wanted each user’s profile and memory in a database, as in my earlier project InvestPal, not in files on disk. That turned out to solve isolation too. The advisor reaches user data only through tools that the worker binds to whoever sent the message; the model never chooses whose data to read. One user cannot reach another’s data because the code doesn’t allow it.
SQLite, not Postgres. With one worker, a single-file database is enough. It is replicated continuously to an encrypted bucket in an EU region, so a dead disk doesn’t lose anything.
The office is my machine. The whole company runs on my own hardware: every agent today, and the advisor once it is built. Like an office, it doesn’t have to be open around the clock. Telegram holds unread messages for about a day, so downtime means a slower reply, not a lost one.
For now I am the advisor’s only user. Opening it to anyone else has conditions written into the decision record, and they get settled before that happens.
An engineering team, kept small
In my day job I run a much larger agent setup, a software factory with nine roles: a tech lead who writes specs, a spec reviewer, an implementer, two reviewers, QA, a review guide, monitoring and a curator, all between two human gates. Most of those stages solve problems Owl does not have yet. There is no production system to monitor and no backlog of small requests to triage.
So we started small, split by area rather than by stage:
| Agent | Owns |
|---|---|
| CTO | Architecture, plans, task files, reviewing every change |
| Backend engineer | The data tools, the planning engine, the advisor worker, scripts, CI |
| Frontend engineer and designer | The website and design system, and how each article looks (the designer from the website section) |
How a piece of work flows:
- A task file I approve. Goal, rules, edge cases, acceptance criteria, tests, and what is out of scope. This is the first human gate, and the cheapest place to catch the expensive mistakes.
- An engineer builds it on its own copy of the repository, test-first.
- The CTO reviews it. At most three rounds of fixes; after that, the open question comes to me instead of being forced through.
- CI is the gate for the mechanical checks: linting, types, tests. The CTO reads the result rather than rerunning them.
- A fresh-eyes review by an agent with no context on how the code was written.
- I review and merge. That is the second gate.
Each task file ends with a log: review rounds, what the fresh review found, what I changed at merge, lessons. The team grows only when those logs show a recurring gap. That rule comes straight from the software factory, where every stage was added because the weekly numbers showed a need for it.
The first task through the team
The first task was the 14 MB prospectus: a filings reader that finds an SEC filing, downloads it once, converts it to text and lets agents list its sections, read it in chunks and search it.
It took the full three rounds, and each one taught something.
Round 1: a layering slip. The engineer’s first version worked and passed its tests, but the core logic imported the disk storage directly, breaking the rule that the edges stay replaceable. Easy to fix. But it raised a fair question: a rule that lives only in a document will get broken again. We added a check to CI that fails any change breaking the layering, and tested that it would have caught this one.
Round 2: the fresh review earned its place. The reviewer with no context found the only serious bug. If two agents fetched the same filing at the same moment, which is exactly what happened in the Anthropic week, they wrote to the same temporary file. The result could be a corrupted copy that the tool then treated as complete and never fetched again. It also found four smaller problems, such as errors that crashed with a stack trace instead of a clear message an agent can act on. All fixed, each with a test.
Round 3: the real network. The first live run against SEC failed: the VPN on my machine inspects encrypted traffic and signs it with its own certificate, which Python did not trust. The fix makes the tool trust the operating system’s certificate store, the same approach Python’s own package installer uses, with verification never switched off.
There was one more slip, outside the rounds: the first CI run failed in two seconds, because the workflow named a version of a setup tool that did not exist as a tag. The engineer had checked that the release existed, not the exact tag it used.
Then the live run worked:
| Downloaded from SEC | 14,4 MB |
| As text | 1,6 MB, 17.997 lines |
| Sections found | 33, including Prospectus Summary, Risk Factors, Use of Proceeds and Underwriting |
| IPO share count (980.000.000) | Found 5 times: twice on the cover, then Dilution, Shares Eligible for Future Sale, and the Underwriting table |
| Tests | 153, all passing in CI |
The document five agents could not open last week is now downloaded once and converted in about half a second, and every answer comes with where it came from.
What I learned
- The CTO pushing back was the most useful part. It agreed with most of my ideas, argued where it saw risk, most of all on the advisor’s security, and was right to. A design partner that only agrees is no help.
- Fresh eyes find different bugs. The engineer’s tests all passed. The reviewer who didn’t see the code being written found the one that mattered.
- Write rules into tools, not documents. The layering rule was written down and still broken in the first round. Now CI enforces it.
- Test on the real network early. The VPN problem would have surfaced on the first day of real use.
Next
The research agents get access to the new tool, so the next weekly run can read filings directly. Then the website skeleton, showing the first article locally, and a first spike of the advisor: one Telegram message through the whole path, with its cost measured. The project page has the decisions so far and the series as it grows.
Owl of Wall Street’s analysts are AI agents, built on Anthropic’s Claude models, and not licensed financial advisers. Nothing in this post is investment advice.