Prepare your files
An Archemist project is a folder of text files. You write them once, zip the folder, and upload it on the homepage. Not keen on writing YAML? Let your AI do it.
What you upload
Three kinds of file, each answering one question:
| File | Answers |
|---|---|
architecture.yaml | What components exist, and how do they connect? |
| Contracts (OpenAPI, AsyncAPI) | What does each service's interface say? You may already have these. |
Flows *.flow.yaml | What happens, step by step, in a business scenario? This is what gets animated. |
my-project/
architecture.yaml required, at the top
contracts/
orders.openapi.yaml OpenAPI 3.1, one per HTTP service
events.asyncapi.yaml AsyncAPI 3, only if you use WebSockets
flows/
place-order.flow.yaml one file per business flow
Zip the folder. architecture.yaml can be at the top of the ZIP or inside a single folder. Only its location is fixed: every other path is whatever architecture.yaml points to.
Quickstart: the smallest useful project
Three components (web app, API, database), one API operation and one flow with two outcomes: the book is found, or it is not.
Open it in an editor and change names to match your system. These are its three files:
architecture.yaml
schemaVersion: archemist/v1
project:
id: bookshop
name: Bookshop Quickstart
version: v1
description: >-
The smallest useful Archemist project: a web app, one API and a database,
with one flow showing a successful lookup and a missing book.
classification: sample
groups:
- { id: client, label: Client, order: 0 }
- { id: app, label: Application, order: 1 }
- { id: data, label: Data, order: 2 }
components:
- id: web-app
name: Web App
type: frontend
group: client
responsibility: Shows a book's details page
description: Browser application that looks up a book when a visitor opens its page.
- id: bookshop-api
name: Bookshop API
type: service
group: app
responsibility: Serves book data over HTTP
description: Reads books from the database and returns them as JSON.
implementationStatus: implemented
reviewStatus: reviewed
contracts:
http: [contracts/bookshop.openapi.yaml]
- id: postgres
name: PostgreSQL
type: database
group: data
responsibility: Stores books
description: Relational database holding the books table.
resources:
tables:
- name: books
owner: bookshop-api
columns: |
id text PK
title text NOT NULL
author text NOT NULL
connections:
- id: c-web-api
from: web-app
to: bookshop-api
protocol: http
purpose: Look up a book by id.
operations: [getBook]
- id: c-api-db
from: bookshop-api
to: postgres
protocol: database
purpose: Read a book row.
interactions:
- { label: SELECT books, note: Read one book by id }
flows:
- flows/get-book.flow.yamlcontracts/bookshop.openapi.yaml
openapi: 3.1.0
info:
title: Bookshop API
version: "1.0"
paths:
/books/{bookId}:
parameters:
- name: bookId
in: path
required: true
schema:
type: string
example: book_42
get:
operationId: getBook
summary: Read one book.
responses:
"200":
description: The book.
content:
application/json:
schema:
$ref: "#/components/schemas/Book"
example:
id: book_42
title: The Pragmatic Programmer
author: Andrew Hunt
"404":
description: No book has this id.
content:
application/json:
schema:
$ref: "#/components/schemas/Error"
example:
error:
code: NOT_FOUND
message: No book with this id.
components:
schemas:
Book:
type: object
required: [id, title, author]
additionalProperties: false
properties:
id:
type: string
title:
type: string
author:
type: string
Error:
type: object
required: [error]
properties:
error:
type: object
required: [code, message]
properties:
code:
type: string
message:
type: stringflows/get-book.flow.yaml
schemaVersion: archemist/v1
flow:
id: get-book
name: Look up a book
group: Books
purpose: Show a book's details page.
summary: >-
One request travels from the web app to the API, which reads a row from the
database and answers.
scenarios:
- id: success
name: Book found
kind: success
summary: The book exists and its details come back.
events:
- id: e1
type: http.request
from: web-app
to: bookshop-api
connection: c-web-api
operation: getBook
summary: The web app asks for book_42.
pathParams: { bookId: book_42 }
- id: e2
type: database.query
from: bookshop-api
to: postgres
connection: c-api-db
operation: SELECT
table: books
summary: The API reads the row.
inputs: { id: book_42 }
sql: SELECT id, title, author FROM books WHERE id = $1;
- id: e3
type: database.result
replyTo: e2
rowCount: 1
summary: The database returns one row.
output:
rowCount: 1
rows:
- id: book_42
title: The Pragmatic Programmer
author: Andrew Hunt
- id: e4
type: http.response
replyTo: e1
status: 200
outcome: success
summary: The API returns the book.
body:
id: { $fromEvent: { event: e3, path: "output.rows[0].id" } }
title: { $fromEvent: { event: e3, path: "output.rows[0].title" } }
author: { $fromEvent: { event: e3, path: "output.rows[0].author" } }
- id: not-found
name: Book not found
kind: failure
summary: No book has this id, so the API answers 404.
events:
- id: e1
type: http.request
from: web-app
to: bookshop-api
connection: c-web-api
operation: getBook
summary: The web app asks for a book that does not exist.
pathParams: { bookId: book_999 }
- id: e2
type: database.query
from: bookshop-api
to: postgres
connection: c-api-db
operation: SELECT
table: books
summary: The API looks for the row.
inputs: { id: book_999 }
sql: SELECT id, title, author FROM books WHERE id = $1;
- id: e3
type: database.result
replyTo: e2
rowCount: 0
outcome: failure
summary: The database finds nothing.
output:
rowCount: 0
rows: []
- id: e4
type: http.response
replyTo: e1
status: 404
outcome: failure
summary: The API returns 404.
body:
error:
code: NOT_FOUND
message: No book with this id.The architecture file
Every file starts with schemaVersion: archemist/v1. It then declares the project, groups (zones drawn behind components), components, connections and the flows files.
Components
components:
- id: bookshop-api # stable id, used everywhere else
name: Bookshop API
type: service # frontend | service | worker | database | cache | queue
# | object-storage | external-system
group: app # one of the groups you declared
responsibility: Serves book data over HTTP # one line, shown on the card
description: Reads books from the database. # a paragraph, shown in the inspector
implementationStatus: implemented # planned | implemented | deprecated
reviewStatus: reviewed # draft | reviewed
contracts:
http: [contracts/bookshop.openapi.yaml] # what this component SERVES
Be strict about names. Fields are checked, so a misspelled or unknown field is an error rather than being ignored. Ids are what everything else refers to, so keep them stable, lowercase and hyphenated.
contracts lists what a component serves. If a gateway only forwards an operation, list it under routes instead.
Connections
connections:
- id: c-web-api
from: web-app
to: bookshop-api
protocol: http # http | websocket | database | redis | object-storage | ssh
purpose: Look up a book by id.
operations: [getBook] # the operationIds that travel on this connection
The protocol decides the extra fields: operations for HTTP, channel and messages for WebSocket, and interactions (labels such as SELECT books) for database, Redis, object storage and SSH.
A database, cache or storage component can also declare resources (tables, keys, objects). Once it does, flows may only touch what it declares, which catches a table renamed in one place only.
Contracts
- HTTP: OpenAPI 3.1 only. OpenAPI 3.0 and Swagger 2 are refused because they describe schemas differently. Convert them to 3.1 first.
- Every operation needs a unique
operationId. Flows refer to operations by it. - Add schemas and examples for the responses your flows use. Examples must satisfy their schemas.
- Document every status code a flow returns, including failures such as 404 or 409.
- WebSocket: AsyncAPI 3 (a documented subset). Skip it if you have no WebSockets.
Flows
A flow file tells one story. It holds scenarios, which are named alternatives such as "it worked", "it failed" and "it retried". Each scenario is a plain ordered list of events. There are no parallel steps, branches or loops.
- id: e1
type: http.request
from: web-app
to: bookshop-api
connection: c-web-api
operation: getBook # an operationId from the OpenAPI file
summary: The web app asks for book_42.
pathParams: { bookId: book_42 }
- id: e4
type: http.response
replyTo: e1 # a reply names its request; it never repeats from/to
status: 200 # must be documented under the operation's responses
summary: The API returns the book.
Requests and responses are separate events, so a request can stay open while the service calls a database. A reply points back with replyTo.
| Event type | Use it for |
|---|---|
http.request / http.response | Call and reply over HTTP, checked against the OpenAPI contract. |
database.query / database.result | A SQL statement and its result. SQL is shown, never run. |
redis.command / redis.result | A Redis command and its reply. |
storage.operation / storage.result | An object-storage read or write. |
websocket.connect / message / disconnect | WebSocket events, checked against an AsyncAPI contract. |
ssh.command / ssh.result | A remote command and its exit code. |
processing | Work done inside one component, with no network call. |
Reuse values instead of retyping them
body:
id: { $fromEvent: { event: e3, path: "output.rows[0].id" } }
The value is copied from an earlier event in the same scenario. Nothing else is evaluated.
Fixing errors
If a file does not compile, the homepage lists every problem with the file and location. Fix them and upload again. Each message has a code; these are the common ones:
| Code | Meaning | Fix |
|---|---|---|
openapi.version-unsupported | The contract is OpenAPI 3.0 or Swagger 2. | Convert it to OpenAPI 3.1 (openapi: 3.1.0). |
openapi.missing-operation-id | An operation has no operationId. | Add a unique operationId to every operation; flows refer to it. |
operation.wrong-receiver | A request is sent to a component that neither serves nor forwards that operation. | Send it to the component whose contracts.http lists it. Through a gateway, add the operation under the gateway's routes. |
flow.response-status-undocumented | A response uses a status code the operation does not document. | Add that status under responses in the OpenAPI file, or correct the flow. |
flow.example-schema-violation | An example in a flow does not match the schema. | Check required fields, types and additionalProperties: false in the schema. |
flow.request-parameter-missing | A path, query or header value the contract requires is missing. | Add it, for example under pathParams. |
flow.reply-to-mismatched-type | A reply answers the wrong kind of request. | http.response answers http.request, database.result answers database.query, and so on. |
flow.unknown-table | A flow touches a table the database component does not declare. | Add it under the component's resources.tables, or fix the name. |
architecture.unknown-component | An id points at a component that does not exist. | Check the spelling against the component's id. |
source.structure-invalid | A field is misspelled, unknown, or has the wrong shape. | Fields are strict. The message names the field and location. |
bundle.architecture-missing | No architecture.yaml was found. | Put it at the top of the ZIP, or inside a single folder in the ZIP. |
The red error box on the homepage has a Copy errors for your AI button. Paste the result into your AI chat and it can fix the files for you.
Use AI to write it
Copy the prompt below into Claude, ChatGPT, Cursor or any AI agent. It teaches the assistant the exact Archemist format, so it can write the files from your codebase or from a description of your system.
- Paste the prompt as your first message (or save it as a skill, see below).
- Describe your system, or give the agent access to your repository: "Document the checkout flow of this codebase."
- Zip what it writes and upload it on the homepage.
- If there are errors, press Copy errors for your AI, paste them back, and ask for the corrected files.
---
name: archemist-architecture-author
description: Write the source files for Archemist (archemist.app) - architecture.yaml, OpenAPI 3.1 / AsyncAPI 3 contracts and flow files - from a codebase or a description of a system, so the user can zip them and upload them to get an interactive architecture report.
---
# Writing an Archemist project
Archemist (https://archemist.app) turns a folder of YAML files into an interactive
architecture report: a system diagram, API details, and animated request flows.
Your job is to **write that folder** for the user, from their codebase or from
what they tell you about their system. Archemist validates the files strictly,
so follow the format below exactly.
## How to work
1. **Understand the system first.** If you can see a codebase, read it: services,
routes, database tables, queues, outgoing calls. If not, ask the user short,
concrete questions: What are the components (frontend, services, databases,
queues)? How do they talk (HTTP, WebSocket, SQL, Redis, object storage, SSH)?
Which two or three business flows matter most?
2. **Start small.** Begin with 3 to 8 components and 1 to 3 flows. A small project
that validates is worth more than a large one that does not. Add more later.
3. **Write the files** in this order: `architecture.yaml` (components and
connections), then one OpenAPI file per HTTP service, then the flow files.
4. **Do not invent facts.** If something is inferred rather than read from code,
set `classification: proposed` on the project, and say what you assumed in your
reply. Use `implementationStatus: planned` for things that do not exist yet.
5. **Never put real secrets or personal data in examples.** Use placeholders such
as `Bearer <example-token>`, `user_123`, `jane@example.com`.
6. **Deliver a folder tree** and every file in full. Tell the user to zip the
folder (with `architecture.yaml` at the top, or inside one folder) and upload it
at https://archemist.app. If they paste back error messages, fix exactly those.
## Project layout
```
my-project/
architecture.yaml required, at the root
contracts/
users.openapi.yaml OpenAPI 3.1, one per HTTP service
events.asyncapi.yaml AsyncAPI 3.0, only if you use WebSockets
flows/
create-user.flow.yaml one file per business flow
```
Only `architecture.yaml` has a fixed location; every other path is whatever
`architecture.yaml` names. Use `.yaml`. Limits: 8 MB zip, 400 files, 2 MB per file.
**Fields are strict.** An unknown or misspelled field is an error. Every
`architecture.yaml` and `*.flow.yaml` starts with `schemaVersion: archemist/v1`.
## architecture.yaml
```yaml
schemaVersion: archemist/v1
project:
id: my-system # stable, kebab-case
name: My System
version: v1
description: One or two sentences.
classification: proposed # sample | proposed | documented
groups: # zones drawn behind components, left to right
- { id: client, label: Client, order: 0 }
- { id: app, label: Application, order: 1 }
components:
- id: api # stable kebab-case id; flows reference it
name: API
type: service # frontend | service | worker | database | cache | queue | object-storage | external-system
group: app
responsibility: One line shown on the card
description: A paragraph shown in the inspector.
implementationStatus: implemented # planned | implemented | deprecated
reviewStatus: reviewed # draft | reviewed
contracts: # what this component SERVES
http: [contracts/api.openapi.yaml]
messages: [contracts/events.asyncapi.yaml] # WebSocket only
routes: [other-service/createThing] # operations it FORWARDS but does not serve (e.g. a gateway)
connections:
- id: c-web-api # unique
from: web-app
to: api
protocol: http # http | websocket | database | redis | object-storage | ssh
purpose: Why they talk.
operations: [getThing] # http: operationIds carried on this connection
# websocket: channel: /ws/x messages: [msg.name]
# database / redis / object-storage / ssh:
# interactions: [{ label: "SELECT things", note: "read" }]
flows:
- flows/get-thing.flow.yaml
```
A **database, cache or object-storage** component may declare `resources`
(`tables`, `keys`, `objects`). Once it declares any, flows may only touch the ones
it declares, which catches renamed tables. Table example:
`resources: { tables: [{ name: books, owner: api, columns: "id text PK" }] }`.
## Contracts
* **HTTP: OpenAPI 3.1 only** (`openapi: 3.1.0`). 3.0 and Swagger 2 are refused.
* Every operation needs a unique **`operationId`**; flows reference it.
* Give schemas and **examples** for the responses flows use. Every example must
satisfy its schema (watch `required`, `additionalProperties: false`, types).
* A flow may only return a status code the operation **documents** under
`responses`. Document the failure statuses (404, 409, 422, ...) your flows use.
* **WebSocket: AsyncAPI 3.0** (a documented subset). Skip it if there is no WebSocket.
## Flows (flows/*.flow.yaml)
```yaml
schemaVersion: archemist/v1
flow:
id: get-thing
name: Look up a thing
group: Things # grouping in the sidebar
purpose: One sentence.
summary: A short paragraph.
scenarios: # named alternatives, NOT branches
- id: success
name: Found
kind: success # success | failure | retry
summary: What happens.
events: [ ... ]
```
Write one scenario for the happy path and one for the most important failure
(`kind: failure`); add `kind: retry` if retries matter. Each scenario is a plain
ordered list. **No parallel steps, branches or loops** (they are refused).
Every event has `id` (unique within the scenario), `type`, and a one-sentence
`summary`. Request and response are **separate events**. A response names its
request with `replyTo` and never repeats `from` or `to`.
| type | key fields |
| --- | --- |
| `http.request` | `from`, `to`, `connection`, `operation`, `pathParams`, `query`, `headers`, `body` |
| `http.response` | `replyTo`, `status` (must be documented), `outcome`, `body` |
| `database.query` | `from`, `to`, `connection`, `operation` (SELECT...), `table`, `inputs`, `sql` |
| `database.result` | `replyTo`, `rowCount`, `output` |
| `redis.command` / `redis.result` | `command`, `key`, `payload` / `replyTo`, `result` |
| `storage.operation` / `storage.result` | `operation` (PUT/GET), `key`, `meta` / `replyTo`, `result` |
| `websocket.connect` / `.message` / `.disconnect` | `from`, `to`, `connection`, `message`, `channel`, `payload` |
| `ssh.command` / `ssh.result` | `command`, `paths` / `replyTo`, `exitCode`, `output` |
| `processing` | `component`, `title`, `input`, `output` (work inside one component) |
Rules that cause most errors:
* `from`, `to` and `component` must be component ids; `connection` must be a
connection id that links those two components.
* An `http.request` must be sent **to a component that serves or routes** that
operation (`contracts.http` or `routes`). Through a gateway, send to the
gateway and list the operation under the gateway's `routes`.
* Provide a value for every `{placeholder}` in the path, and every required
query parameter, header and body.
* A reply answers the right kind of request (`http.response` to `http.request`,
`database.result` to `database.query`, and so on) and comes after it.
* To reuse a value from an earlier event instead of retyping it:
`{ $fromEvent: { event: e3, path: "output.rows[0].id" } }`. The event must be
earlier in the same scenario. Nothing else is evaluated.
* Keep flows short, roughly 4 to 15 events.
## A complete, valid example
This project passes Archemist's strictest validation. Mirror its structure.
#### `architecture.yaml`
```yaml
schemaVersion: archemist/v1
project:
id: bookshop
name: Bookshop Quickstart
version: v1
description: >-
The smallest useful Archemist project: a web app, one API and a database,
with one flow showing a successful lookup and a missing book.
classification: sample
groups:
- { id: client, label: Client, order: 0 }
- { id: app, label: Application, order: 1 }
- { id: data, label: Data, order: 2 }
components:
- id: web-app
name: Web App
type: frontend
group: client
responsibility: Shows a book's details page
description: Browser application that looks up a book when a visitor opens its page.
- id: bookshop-api
name: Bookshop API
type: service
group: app
responsibility: Serves book data over HTTP
description: Reads books from the database and returns them as JSON.
implementationStatus: implemented
reviewStatus: reviewed
contracts:
http: [contracts/bookshop.openapi.yaml]
- id: postgres
name: PostgreSQL
type: database
group: data
responsibility: Stores books
description: Relational database holding the books table.
resources:
tables:
- name: books
owner: bookshop-api
columns: |
id text PK
title text NOT NULL
author text NOT NULL
connections:
- id: c-web-api
from: web-app
to: bookshop-api
protocol: http
purpose: Look up a book by id.
operations: [getBook]
- id: c-api-db
from: bookshop-api
to: postgres
protocol: database
purpose: Read a book row.
interactions:
- { label: SELECT books, note: Read one book by id }
flows:
- flows/get-book.flow.yaml
```
#### `contracts/bookshop.openapi.yaml`
```yaml
openapi: 3.1.0
info:
title: Bookshop API
version: "1.0"
paths:
/books/{bookId}:
parameters:
- name: bookId
in: path
required: true
schema:
type: string
example: book_42
get:
operationId: getBook
summary: Read one book.
responses:
"200":
description: The book.
content:
application/json:
schema:
$ref: "#/components/schemas/Book"
example:
id: book_42
title: The Pragmatic Programmer
author: Andrew Hunt
"404":
description: No book has this id.
content:
application/json:
schema:
$ref: "#/components/schemas/Error"
example:
error:
code: NOT_FOUND
message: No book with this id.
components:
schemas:
Book:
type: object
required: [id, title, author]
additionalProperties: false
properties:
id:
type: string
title:
type: string
author:
type: string
Error:
type: object
required: [error]
properties:
error:
type: object
required: [code, message]
properties:
code:
type: string
message:
type: string
```
#### `flows/get-book.flow.yaml`
```yaml
schemaVersion: archemist/v1
flow:
id: get-book
name: Look up a book
group: Books
purpose: Show a book's details page.
summary: >-
One request travels from the web app to the API, which reads a row from the
database and answers.
scenarios:
- id: success
name: Book found
kind: success
summary: The book exists and its details come back.
events:
- id: e1
type: http.request
from: web-app
to: bookshop-api
connection: c-web-api
operation: getBook
summary: The web app asks for book_42.
pathParams: { bookId: book_42 }
- id: e2
type: database.query
from: bookshop-api
to: postgres
connection: c-api-db
operation: SELECT
table: books
summary: The API reads the row.
inputs: { id: book_42 }
sql: SELECT id, title, author FROM books WHERE id = $1;
- id: e3
type: database.result
replyTo: e2
rowCount: 1
summary: The database returns one row.
output:
rowCount: 1
rows:
- id: book_42
title: The Pragmatic Programmer
author: Andrew Hunt
- id: e4
type: http.response
replyTo: e1
status: 200
outcome: success
summary: The API returns the book.
body:
id: { $fromEvent: { event: e3, path: "output.rows[0].id" } }
title: { $fromEvent: { event: e3, path: "output.rows[0].title" } }
author: { $fromEvent: { event: e3, path: "output.rows[0].author" } }
- id: not-found
name: Book not found
kind: failure
summary: No book has this id, so the API answers 404.
events:
- id: e1
type: http.request
from: web-app
to: bookshop-api
connection: c-web-api
operation: getBook
summary: The web app asks for a book that does not exist.
pathParams: { bookId: book_999 }
- id: e2
type: database.query
from: bookshop-api
to: postgres
connection: c-api-db
operation: SELECT
table: books
summary: The API looks for the row.
inputs: { id: book_999 }
sql: SELECT id, title, author FROM books WHERE id = $1;
- id: e3
type: database.result
replyTo: e2
rowCount: 0
outcome: failure
summary: The database finds nothing.
output:
rowCount: 0
rows: []
- id: e4
type: http.response
replyTo: e1
status: 404
outcome: failure
summary: The API returns 404.
body:
error:
code: NOT_FOUND
message: No book with this id.
```
## Before you hand the files over, check
- [ ] `architecture.yaml` is at the root and every document has `schemaVersion: archemist/v1`.
- [ ] No unknown fields, and ids are unique and referenced exactly as written.
- [ ] Each HTTP operation has an `operationId`, schemas and examples, and is listed
on the right component and connection.
- [ ] Every status a flow returns is documented in the OpenAPI `responses`.
- [ ] Every request goes to the component that serves or routes the operation.
- [ ] Every request has a matching reply, and examples satisfy their schemas.
- [ ] No secrets or real personal data; assumptions are stated in your reply.
If you can run commands and have the `archemist` CLI, run `archemist validate <folder>`.
Otherwise the user uploads the zip at https://archemist.app, and any errors shown
there (file, location and a suggestion each) can be pasted back to you to fix.
In Claude Code: save the file as .claude/skills/archemist/SKILL.md in your project (or in ~/.claude/skills/archemist/ for all projects) and ask "write an Archemist project for this repo". In any other assistant, pasting it as the first message works the same way.
proposed and to list its assumptions.Limits
- A ZIP up to 8 MB, 400 files, and 2 MB per file. Readable types:
.yaml,.yml,.json,.md. - OpenAPI 3.1 and AsyncAPI 3 (a documented subset). Remote
$reflinks are not followed, so keep referenced files inside the ZIP. - Archemist reads documents only. It never runs your code, calls your services or connects to your database.