Tools
Worker
brico-worker turns features the Scanner captured into type-checked bricks in your Vault.
Previewbrico-worker is the back end for the Scanner. It takes the features you selected in the browser and, for each one:
- claims the job from a Postgres queue;
- asks a model to implement the feature from the evidence the scanner observed;
- typechecks the result against the endpoints that were actually seen;
- sends the compiler errors back to the model for repair, up to three attempts by default;
- publishes the brick to your Vault as an ordinary module.
The result is a normal brick. brico list, brico add and the terminal UI treat it like any other.
Requirements
- Go, to build or run it from source;
- a Postgres 16 database with the BricoWerx migrations applied (
db/migrate.sh); - a Mistral API key;
node_modulesin the repository, so generated code is typechecked against real framework types.
Run it locally
export DATABASE_URL='postgres://brico_app:…@localhost:5432/brico'
export MISTRAL_API_KEY='…'
./db/migrate.sh # idempotent; run it on every upgrade
cd engine
go run ./cmd/brico-worker # poll for jobs and serve the extensionIf DATABASE_URL or MISTRAL_API_KEY isn’t set, the worker reads it from db/.env.local in the repository. While it runs, the extension’s side panel reports it as ready, with its model and Vault.
Flags
| Flag | Default | Description |
|---|---|---|
-once | off | Process one job and exit. Useful as a smoke test. |
-poll | 5s | How often to look for queued jobs. |
-attempts | 3 | Generate, typecheck and repair attempts per job. |
-vault | BRICO_VAULT or the configured Vault | Where finished bricks are published. |
-repo | found by walking up | Repository root, used to find db/.env.local and node_modules. |
-listen | 127.0.0.1:7717 | Loopback address for the extension. Pass an empty value to turn the bridge off. |
MISTRAL_MODEL overrides the model. The default is codestral-latest.
The extension bridge
The worker serves a small HTTP API on loopback for the extension:
| Endpoint | Purpose |
|---|---|
GET /v1/health | Is the worker up, and which model and Vault does it use? |
POST /v1/captures | Submit the selected features as a capture; queues one job per feature |
GET /v1/jobs | Job status, which the side panel polls |
It only binds to a loopback address and refuses anything else.
Hosted deployment
docker build -f engine/Dockerfile.worker -t brico-worker .
docker run -e DATABASE_URL -e MISTRAL_API_KEY brico-worker -once # smoke testA hosted worker runs with -listen "", so the bridge is off and jobs arrive only through the database. The repository’s render.yaml deploys the database, migrations and worker together. Fly and Railway use the same image.
Review what it generates
A model writes worker bricks from observed evidence. They are typechecked before they are published, but typechecking is not a security review. Read a generated brick before you ship it.