# Rebuild the graph from what was written

**Every write is enough on its own to say what the graph is: replay them anywhere and you get the graph Flow serves, and the same answer about what is next.**

The console draws the graph in a browser, with the same package the server computes it with, and the documentation draws each flow by replaying the calls it made. That only means something if the two computations agree. So this flow writes a small feature the ordinary way — pieces filed in one call, a decision holding one of them, a spec cited, work closed with its outcome, a bug triaged from the inbox, an edge and a reference withdrawn — then folds every write it made back into a graph from nothing, and holds it against the one the server derives from its own rows: the same tasks in the same states, the same edges, the same open waits and references, the same order and the same readiness. A meaning that survives only inside one interface is a meaning that can be lost.

Driven by an agent. Every step below is a step in
`packages/server/tests/e2e`, run against a listening server on every pull
request; the calls under each one are what that run executed.

The same flow is playable at https://flow.ttoss.dev/docs/examples/rebuild-the-graph-from-what-was-written.

## 1. Ana points her agent at the repository she works in

- `POST /api/v1/projects` → `201`

## 2. Her agent files a feature as three pieces in one call, two of them waiting on the first

- `POST /api/v1/tasks/batch` → `200`

## 3. A choice nobody has made yet holds the dashboard, as a decision of its own

- `POST /api/v1/tasks/batch` → `200`

## 4. It cites the spec the schema is built from

- `PATCH /api/v1/tasks/batch` → `200`

## 5. The schema ships, with what it achieved

- `PATCH /api/v1/tasks/batch` → `200`

## 6. Ana raises the digest to a commitment without saying why, and it lands flagged

- `PATCH /api/v1/tasks/batch` → `200`

## 7. A bug report arrives in her inbox, linked to the issue it came from

- `POST /api/v1/captures` → `201`

## 8. Ana says it is work, and triage makes it a task that holds the dashboard

- `POST /api/v1/captures/cap_hnxa2bk83f/triage` → `201`

## 9. The digest never needed the schema, so the agent withdraws that edge

- `DELETE /api/v1/task-links?from=task_pj8mrbw512&to=task_ht4vw1bm38&kind=blocks` → `200`

## 10. The spec moved, so it withdraws the old link from the schema

- `DELETE /api/v1/tasks/task_pj8mrbw512/references?url=https%3A%2F%2Fgithub.com%2Fttoss%2Fflow%2Fissues%2F77%2F` → `200`

## 11. Replaying every write from nothing gives the graph Flow serves

- `GET /api/v1/snapshot` → `200`
- `GET /api/v1/tasks/task_pj8mrbw512` → `200`
- `GET /api/v1/tasks/task_hwrq0qdxy5` → `200`
- `GET /api/v1/tasks/task_ht4vw1bm38` → `200`
- `GET /api/v1/tasks/task_dc2agt3nmm` → `200`
- `GET /api/v1/tasks/task_58hsy6t6y6` → `200`

## 12. And the replayed graph answers what is next the way the server does

- `GET /api/v1/order` → `200`
- `GET /api/v1/tasks/task_pj8mrbw512` → `200`
- `GET /api/v1/tasks/task_hwrq0qdxy5` → `200`
- `GET /api/v1/tasks/task_ht4vw1bm38` → `200`
- `GET /api/v1/tasks/task_dc2agt3nmm` → `200`
- `GET /api/v1/tasks/task_58hsy6t6y6` → `200`
