Flint is the engineering-lead cockpit I built for myself and run every day. It is where I test the orchestration model first, before I recommend any part of it to a team. This article covers the architecture only: what the pieces are and why they fit together the way they do. It does not cover what is inside it.
The design goal was to be useful with almost no operating cost, and to let several different AI tools work with the same system without each one needing its own integration.
One API, two frontends
Flint is a Next.js web dashboard and a native SwiftUI iOS app with widgets. Both talk to one API. There is no separate mobile backend.
The rule that follows is simple: any page's data must be available from a GET endpoint, and mutations are POST endpoints that the phone uses directly. When I add a feature, the web page and the app consume the same route. That keeps the two from drifting, and it means every feature is also available to scripts and agents for free, because anything the app can call, a tool can call.
The app runs on one small EC2 instance behind a load balancer, with the infrastructure in Terraform, and deploys by GitHub Actions on push to main.
A database that scales to zero
Data lives in Aurora Serverless v2 Postgres, with the schema defined in Drizzle as the single source of truth. Serverless v2 can scale down to zero capacity when idle, and that is the property that shaped other decisions.
The clearest example: a per-minute uptime check on a cron was removed because it kept the database awake, which blocked scaling to zero. An always-on check that costs more than the thing it checks is a bad trade. The lesson I took from it is to look at what every scheduled job touches before adding it. A cron that wakes the database every minute turns an idle system into an always-on one.
The same thinking applies elsewhere. Engines that might have been separate services run in-process instead, and the remaining cron jobs run through a single wrapper that logs failures and raises one alert per failing job until it is acknowledged. The cron explainer on this site is handy if you want to sanity check a schedule.
One CLI that every AI uses
Flint has a command line tool that reads and writes the same data the dashboard shows. Claude Code uses it. The dashboard's chat uses the same data layer. Other assistants can too.
The value of one CLI is consistency. There is one set of commands, with one set of validations, so any AI that learns it can operate the system the same way. When one tool behaves differently from another, the system drifts. It is the same reason I prefer a repository's existing scripts over hand-rolled commands: the abstraction is where the rules live.
A related habit: before any write, the agent checks the expected shape of the collection against the schema definition and a recent entry. Drizzle's schema is the reference, and an agent that writes the wrong shape gets pointed back to it.
A shared AI memory table
Different AI tools forget everything between sessions, and they do not know what the others learned. Flint keeps one memory table that all of them read and write. Each entry has a name, content, a type, tags and which AI wrote it.
- A correction given to one assistant is known to all of them.
- Writes are upserts by name, so a memory has one current version rather than a pile of near-duplicates.
- A tag can archive an entry, keeping it as history while removing it from search and from the context loaded at the start of a session.
- At the start of a session, the agent loads the corrections and preferences before it does anything.
Rules and mistakes live in the database too, not in a file, for the same reason: anything an AI forgot was never stored where all of them could find it.
An hourly cloud agent with a scoped token
A Claude routine on claude.ai runs every hour and works through Flint's inbox. It cannot reach the database. It can reach Flint only through a narrow HTTP API:
- One bearer token, stored as a secure parameter and compared in constant time, that grants only these routes.
- A fixed set of routes: read context, read pending items, process one item, record an event, report a run. Nothing reads arbitrary tables, and nothing deletes.
- One database transaction per decision, and writes are idempotent, so a retry cannot double-apply.
- An audit row for every call, with references and no bodies, and one row per run.
- A rate limit per hour.
- A kill switch: one setting turns every route into a refusal.
That is how I think about giving an agent access in general. Do not hand it the database and ask it to behave. Give it a small, auditable surface where the dangerous operations do not exist.
New items trigger the agent within minutes instead of waiting for the hour, under guards that stop overlapping runs: a minimum wait, a minimum gap between attempts, a check that no run is in progress and a cap per hour. The local sessions never run the inbox loop themselves. They read what the agent has already done.
LISTEN/NOTIFY to wake live sessions
A live Claude Code session should learn about new events without polling. Postgres has a built-in mechanism for it: LISTEN and NOTIFY. A trigger raises a notification when something relevant is written, and a small script waits for one.
The script runs as a background job, exits on the first event and wakes the session, which handles it and starts the script again. That avoids a polling loop that would hit the database every few seconds, which matters for a database that is supposed to be able to sleep.
What I would copy for a team
- One API behind every client, so humans, apps and agents use the same surface.
- Infrastructure that scales to zero, and a habit of checking what each scheduled job keeps awake.
- One CLI as the only door agents use for writes.
- A shared memory, so a correction is made once.
- Agents behind narrow, audited APIs with a kill switch, not direct database access.
- Events that push, instead of polling.
None of it is large. It runs lean on purpose: one small instance, a database that sleeps, and engines that live in the app. If you track what your own AI runs cost, the LLM cost calculator on this site is a good place to start.