THE_PROJECT Built the Bouncer Before the Building
A spec-first personal AI agent where the most finished code is a gateway that verifies credentials nothing can yet issue.
- THE_PROJECT is a personal AI agent where the only finished component is the gate that guards everything else.
- The gateway verifies session tokens before the service that mints them exists, and its own file header admits it.
- The process is the artifact: a spec declared source of truth, 390 planned tasks, and a dated change log built under an explicit AI-agent contract.
- The security posture is real but incomplete, fail-closed by default with no pre-auth throttle, no key rotation, and no freshness check on issued-at.
Open session-token.ts in the API gateway and the first thing you read is an admission. The gateway holds no signer. It cannot mint a session token. It can only check one.
The service that would issue those tokens, the identity service, is a .gitkeep file. So is the agent runtime, the policy engine, the model gateway, and every domain service. THE_PROJECT has one contributor and one star, and its most carefully written code is a doorman standing in front of an empty building.
// The gateway holds no signer.
// The identity service mints the tokens. This file only verifies them.
//
// Token format:
// v1.<base64url(JSON claims)>.<base64url(HMAC-SHA256("v1." + payload))>
This is not an oversight. It is a deliberate ordering. The gateway has to be correct before the thing it guards exists, which means it ships untestable end to end. There is no issuer to generate fixtures against. The verifier was written to a spec, not to a running system.
That single line is the whole repo in miniature. Almost nothing runs. The part that does run is the part that says no.
What NOVA Is Meant to Be
THE_PROJECT is the repository name. The product is NOVA, a self-hosted personal AI agent. The README lists the surface it is aiming at: inbox, calendar, tasks, notes, expenses, trips, automations, and resume-driven job discovery.
Three design rules govern it. Local models come first, with Ollama and qwen3.5:2b as the starting target. Every external action passes a policy check, an approval step, and an audit record. Services stay small instead of collapsing into a monolith.
The intended user is a technically capable individual who wants a personal assistant whose data and actions stay under their control. Not a team. Not an enterprise. One person, their own hardware, their own rules.
- 390 tasks in the build plan
- 11 phases to get through them
- 22 planning documents behind the spec
- 1 service with real code in it
The Plan Is the Product
The nova/ directory is a monorepo inside the repo, with its own apps/, services/, packages/, infra/, and docs/. In placeholder form it is deliberately wide and shallow. Dozens of .gitkeep files reserve space for services that do not exist yet. A layout checker, check_layout.py, runs in CI to enforce the shape before the code arrives.
The plan is enormous and dated. docs/plan/ holds 22 files, including a claims ledger and a coverage map. The build is split into 11 phases and 390 tasks. changes/ holds roughly 20 dated entries between 2026-10-11 and 2026-10-22, one file per decision or change.
The most interesting artifact is the contract the AI agents work under. AGENTS.md and .opencode/agents/the-project.md define what an agent may do. A graphify skill under .opencode/skills/ gives the tooling a reusable capability. One change entry records tuning the custom primary agent itself, which is a quiet signal that the tooling is being shaped as carefully as the product.
This is what spec-first development looks like when an AI agent is doing the typing. The spec is declared the source of truth. The plan comes before the code. The change log reads like a ship's log. And the reason the gate is the only finished thing is that the gate was specified first.
Inside the Gateway
proxy.ts is the one function that answers every request exactly once, in a fixed order. Next.js 16 renamed the middleware convention to proxy, and this file matches /api/:path*.
The order is the design. Trace resolution runs first, so every answer, including errors, carries trace headers. Then a pre-auth rate limit keyed by address. Then a branch: /api/internal/ goes one way, everything else goes another. Internal requests verify a service JWT. Session requests verify a session token, apply a per-user rate limit, and check CSRF on unsafe methods. Then the request is passed downstream, or it fails closed with a fixed 503.
The trick sits in the final step. Both pass() and passService() begin by deleting every context header the client might have sent, then re-set only the values the gateway itself verified. A client cannot claim to be a user. It cannot claim a tenant, a channel, or a trace ID. passService also deletes the raw authorization header so the service token never leaks into handler context.
function pass(request, claims) {
const headers = new Headers(request.headers);
// WHY: a client must never set the context headers. The proxy owns them.
headers.delete("x-nova-user-id");
headers.delete("x-nova-tenant");
headers.delete("x-nova-channel");
headers.delete("x-nova-trace-id");
headers.delete("authorization");
headers.set("x-nova-user-id", claims.sub);
// ...set only verified values, then forward
}
The token format is custom and short: v1.<base64url( claims)>.<base64url(HMAC-SHA256)>. The verifier splits it into exactly three parts, checks the version string, and requires canonical base64url by re-encoding and comparing, which blocks malleable encodings where two different strings decode to the same bytes.
The comparison step is the one people get wrong. Both the expected HMAC and the supplied signature are hashed with SHA-256 before timingSafeEqual. Each digest is 32 bytes, so the comparison never throws on a length mismatch and never leaks a length. Then each claim is type-checked, and expiry is enforced. CSRF is bound to a claim inside the session and to the nova_csrf cookie, with an Origin check on the side.
One more decision is worth naming. The internal and session branches split on path, not on credential type. Internal routes never see a session. Human routes never accept a service token as a session. That removes a whole class of confusion before it can be written.
What the Gate Doesn't Do
The honesty in this repo is part of its character, so the gaps deserve the same treatment as the strengths.
- Pre-auth limiting only runs when trustProxyHops is at least 1. At the default of 0, clientAddress returns unknown and the per-address limiter is skipped, so an unauthenticated flood is not throttled by default.
- There is one HMAC secret and no key ID. Rotation would need a coordinated cutover. The v1 prefix is a migration path, not a rotation mechanism.
- iat is type-checked but never checked for freshness. Only expiry is enforced, so there is no clock-skew window.
- The payload is base64, not encrypted. Anyone holding the token can read the csrf claim, which is safe only if the session cookie stays HttpOnly and the token never reaches an untrusted context.
- Most services are placeholders. None of this has been exercised against a real issuer.
The Honest Comparison
Where NOVA sits depends on what you are actually buying. The real bet is local models, an approval gate on every action, an audit record on every action, and data that never leaves your hardware. The price of that bet is visible in the last column.
| Where your data lives | Who approves actions | Audit trail | Model choice | Does it run today? | |
|---|---|---|---|---|---|
| Hosted assistants (Google, Microsoft, Apple) | Vendor cloud | The vendor's policy, tuned by you | Partial, vendor-held | Vendor models only | Yes |
| Open agent frameworks (LangChain, AutoGPT lineage) | Wherever you deploy it | You, in code you write | Whatever you build | Any, if you wire it | Yes |
| Self-hosted automation suites (n8n, Home Assistant lineage) | Your servers | You, per workflow | Run logs, if enabled | Mostly API models | Yes |
| NOVA | Your servers | An approval gate per action, by design | An audit record per action, by design | Local models first (Ollama) | No |
That last cell is the point. Everything else in the NOVA row is a promise written into a plan. The plan is unusually good. It is still a plan.
What to Watch
A spec this detailed and a gate this careful are a strong start, but they are not the test. The test is the runtime. The interesting question is not whether the gateway can verify a token. It is whether the rest of the system shows up and earns the gate that was built for it.
If the identity service ships, the verifier finally gets an issuer and the whole chain becomes testable end to end. If the runtime ships, NOVA becomes the thing it promised: an agent that asks permission before it acts. That is the one result that would prove the thesis. Everything else is scaffolding, and there is a lot of scaffolding.





