# The docs agent

Living documentation written with OpenSpec, and an agent that answers only from it and cites the section, so anyone at Blue Onion can learn how the platform works.

- **Where**: Blue Onion
- **Status**: Shipped
- **Year**: 2026
- **My part**: Brought OpenSpec to the team; built the docs agent

## The problem

Blue Onion had run for years with little technical documentation. Knowledge of how the platform works sat with a few people, in old threads and in the code. A question meant waiting for an engineer.

## Write the change down first

I introduced spec-driven development with OpenSpec. An engineer, or their coding agent, writes each change down as a proposal and a spec before building it, and the spec is updated when the change ships. So the docs describe the platform as it is, because they are part of how it changes.[^1] The team now writes most of the specs, and builds against them.

## An agent that cites

On top of the specs sits the docs agent. Anyone at the company, technical or not, can ask it how a part of the platform works. It answers only from the docs and links each fact to the exact section it came from. If the docs don’t say, it says so rather than guessing. A wrong citation is easy to spot and fix; a confident guess isn’t.

It reads two sets of docs: the app’s specs, and the data pipeline’s docs, which the pipeline publishes on every merge to master. It treats what it reads as data, never as instructions, so a line in a doc can’t steer it.

## Search by meaning and by exact words

A question like “how does a refund reach the ledger” needs search by meaning. A question that names a table or a job needs the exact word. The agent does both: vector search with PgVector and Postgres full-text search, merged into one ranking. On a test set of twelve real questions, keyword search alone found the right section for none of them, and the hybrid search for eleven.

## Built on Console’s plumbing

The docs agent reuses the client, the streaming and the tool framework of [Console](https://joaoramires.xyz/projects/console/index.md), with three tools of its own: list the docs, search them, read one. Its index adds only new or changed sections, on its own queue, so it never takes capacity from customer answers. The same page has a reader for the docs, with their diagrams.

## Built with

- OpenSpec
- RubyLLM
- Gemini (Vertex AI)
- PgVector
- PostgreSQL full-text search

[^1]: It’s the same habit as writing the design doc before the code, applied to every change instead of the big ones.
