Docs that keep up with the API | Rhizome
rhizome

Docs that keep up with the API

Example workflow · · markdown

Docs written after the code ships have to reverse-engineer decisions the code already made. Docs written alongside it need to hear about every change.

At a glance

Setup
Claude Code builds an export API in the API repo. Codex writes the guide in a separate docs repo, at the same time.
Rhizome
list_sessions to find the exact session, subscribe to follow its progress, send for one question the guide can’t answer.
Code path
Two repos, two PRs, plain git. Rhizome never moves files.
Result
One docs PR, revised through two contract changes (202 with a status URL, 410 on expiry), ready for review with the API PR.

The situation

Take an example API for asynchronous exports (not a Rhizome endpoint). A client creates an export, polls the job, and downloads the result when it’s ready.

Claude Code is implementing it in the API repository. The user asks Codex, working in the documentation repository, to write the guide while the implementation is still in progress. Both sessions already run on their own; neither launched the other.

The challenge

The guide has to describe a contract that isn’t finished yet:

  • → The contract moves. The first description is “returns a job ID, then poll”. Later, creation returns 202 Accepted with a statusUrl, and downloadUrl only appears once the job is ready.
  • → Edge cases aren’t decided yet. What a client should do when an export expires isn’t in the code when the guide is drafted.
  • → Two repos, two agents. Codex can read the API branch if it has access. It can’t see what the implementing session is deciding, or when.
  • → Release timing. The API and its docs should be reviewed and published together, not weeks apart.

Without Rhizome

The usual options all leave someone carrying the contract between two sessions by hand:

  • → Write the docs after merge. Someone reconstructs why creation returns 202 and when downloadUrl appears. Late changes get lost between code review and the guide.
  • → Write them early, once. The guide documents “returns a job ID” and is wrong by the time the API is reviewed. Nothing tells the docs session the contract changed.
  • → Relay by hand. The user copies each change from Claude Code into Codex, and asks about expiry over Slack. Every relay is a chance to drop a detail.
  • → Guess the edge case. The docs agent fills the gap with plausible behavior, like “retry the download”, that the API doesn’t support.

How Rhizome helped

  1. 01 Find and follow the exact session. Codex calls list_sessions and checks agent type, project and session name against the export work. Once it’s sure, it calls subscribe with that session’s exact ID. A repository name alone isn’t enough.
  2. 02 Draft from the first contract. An update arrives: “The export endpoint will return a job ID. Clients will poll the job endpoint until the download is ready.” Codex outlines create → poll → download, opens a draft docs PR, and marks status codes, fields and errors as open instead of inventing them.
  3. 03 Catch the late change. Another update: “Creation now returns 202 Accepted with a status URL. The download URL only appears once the job is ready.” Codex checks the API branch diff and schema, then revises the guide on the same docs PR.
  4. 04 Ask instead of guessing. The guide needs expiry behavior, so Codex uses send to ask that exact session: “What should clients do when an export expires?” Until a reply arrives, expiry stays an open item.
  5. 05 Turn the answer into guidance. The reply: “An expired export returns 410. Start a new export; retrying the expired download will not renew it.” Codex checks it against the implementation and adds a recovery section.
  6. 06 Align at ready-for-review. When the API session reports it’s ready for review, Codex re-checks the guide against the branch and schema, runs the docs build, link and example checks, and lists what it validated and what still needs review on the PR.
Claude Code edits the API repo and Codex edits the docs repo. Codex follows selected Claude activity through Rhizome and exchanges targeted questions and replies; separate git arrows lead to separate PRs.
The subscription carries selected API activity to Codex. Questions and replies are direct messages. Each agent updates its own PR through git. Open full-size SVG. Scroll sideways to see the full diagram.
One docs PR, revised as the contract changes Example workflow. On the left, the API session's contract changes: v1 returns a job ID, v2 returns 202 with a statusUrl, an answer that expired exports return 410, then ready for review. Each change reaches Codex through Rhizome, as a subscription update or a direct reply, and becomes a commit on the same docs PR: draft guide, revised create and polling, expiry recovery, then validation. Codex also sends a direct question about expiry and marks it open until the answer arrives. The API PR and the docs PR are reviewed together. 02 / EXAMPLE WORKFLOW One docs PR, revised as the contract changes API SESSION · CLAUDE CODE VIA RHIZOME DOCS PR · CODEX v1 contract Returns a job ID; clients poll subscription update Draft guide Status codes, errors marked open v2 contract Creation returns 202 + statusUrl; downloadUrl only once ready subscription update Revise create + polling After reading branch + schema direct question “What happens when an export expires?” Expiry marked open Asked, not guessed Answer Expired export → 410; start a new one direct reply Add expiry recovery New export, poll the new statusUrl Ready for review Implementation complete subscription update Validate, mark ready Docs build, links, examples API PR Docs PR reviewed together Example workflow. Each ● is a commit pushed through git to the same docs PR. People decide when to merge.
Example workflow, not a historical timeline. Every dot is a commit on the same docs PR; the open dot is a question asked instead of a guess. Open full-size SVG. Scroll sideways to see the full diagram.

The outcome

  • → One docs PR, revised in place. Draft, then the 202 and statusUrl change, then 410 recovery. The commits show how the contract evolved.
  • → No guessed behavior. Expiry is documented from the implementer’s answer, checked against the code.
  • → Reviewed together. The API PR and the docs PR stay separate, so reviewers can read the code and its explanation side by side and agree on release timing. Rhizome doesn’t merge either one.

The client flow the guide ends up documenting ({job_id} stands for the ID returned by creation):

POST /exports
→ 202 Accepted
{ "jobId": "{job_id}", "statusUrl": "/exports/{job_id}" }

GET /exports/{job_id}
→ 200 OK
{ "status": "pending" }

GET /exports/{job_id}
→ 200 OK
{ "status": "ready", "downloadUrl": "/exports/{job_id}/download" }

GET /exports/{job_id}/download  (after expiration)
→ 410 Gone

Recovery: POST /exports, then poll the new statusUrl.

Rough edges and limits

  • → Updates aren’t diffs. A subscription carries selected assistant activity and activity markers, not transcripts, reasoning or file contents. Codex still has to read the API branch and schema; if it can’t, verification stays open.
  • → Following can have gaps. A new subscription starts from now. Reconnects, bounded queues and restarts can drop events. When updates go quiet, check the subscription state and the branch, and ask rather than fill the gap.
  • → Sent isn’t answered. A successful send means the message was queued, not that it was read or answered.
  • → Ready isn’t tested. A “ready for review” update doesn’t mean tests pass or the feature shipped. Validation is a step Codex runs, not something it receives.

Try it on one feature

  1. 01 Pick a feature whose API contract is still changing, with docs in a separate repo or session.
  2. 02 Start the docs session and have it find and subscribe to the implementing session by exact ID.
  3. 03 Open a draft docs PR early, with unknowns marked as open.
  4. 04 Ask the implementing session directly for anything the guide can’t safely infer. Review and release both PRs together.

A prompt to start with, in the docs session:

Write the guide for <feature> in this repo. Find the session implementing it,
confirm it's the right one, and subscribe. Keep unknowns open in a draft PR,
check each contract change against the API branch before editing, and ask
that session directly instead of guessing.