Skip to content

Add notes and record the written Compilation - #67

Merged
raghubetina merged 4 commits into
mainfrom
long-run/notes
Nov 22, 2026
Merged

raghubetina merged 4 commits into
mainfrom
long-run/notes

Conversation

@raghubetina

@raghubetina raghubetina commented Nov 22, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Adds notes and lets reports and notes cover the generated application's whole life, inside the open 0.10.0 entry.

  • firstdraft note unstated_request, firstdraft note unclear_guidance, and firstdraft note wrong_output send a
    note to POST /v1/projects/{project_id}/notes, with options named after the note's fields. Each reads the pinned
    Project, so it needs the Plan's first push; reads the account first and sends nothing with reports off; keeps each
    field only in its shape (plain words of at most 300 characters, a Skill page, a diagnostic code, a file in the
    application, a lowercase UUIDv7); prints the exact JSON and what it left out; sends it once; and never retries.
    A needed field with nothing left after shaping is a local refusal, note_incomplete.
  • firstdraft start names notes only when reports are on: the first sentence of REPORTS_ON_LINES names them, and a
    new NOTES_ON_LINES follows it with the three kinds, when to send one, and the content rule.
  • plan compile and compilation download record the Compilation whose code they wrote in compilation.json beside
    the Project's state.json (in the archive at .firstdraft/design/.firstdraft/ after root adoption). state.json
    keeps its firstdraft.cli-state/1 format. report progress, report failure, and a note about generated code take
    the Compilation ID as optional and use the last recorded one; with neither, they send nothing
    (compilation_not_recorded).
  • sendReport and the CLI's report path are shared by reports and notes rather than copied.
  • test/fixtures/note-shapes.json lists accepted and refused values for every note field and for whole notes. It is a
    byte-for-byte copy of the service's file, as the failure-report fixture is, and test/note-shapes.test.js tests the
    CLI's shaping against it.

The API contract stays in the 0.9.x range: release/compatibility.json does not change. The notes endpoint is not on
the First Draft service's main yet; the tests use the repository's fake service.

Docs: updated docs/commands.md (command map, What the CLI sends, start's sentences, the Compilation record, report
usage, Send notes, Service endpoints), docs/errors.md (report and note errors, error index), README.md, and the
CHANGELOG's 0.10.0 entry

Review: Codex, approve (3 rounds, 7 findings: 4 fixed, 3 recorded below as known limits). Antigravity, 1 round, approve (1 low finding, already recorded below as a known limit)

Known limits

  • The record names the Compilation whose code the CLI last recorded for the Project, wherever that code went.
    Trigger: a Project that writes two outputs, such as a second plan compile --output from .firstdraft/design after
    root adoption; a report from the first output then names the later Compilation unless an ID is given. The preview
    names the Compilation before anything is sent.
  • A record that cannot be written leaves any earlier record in place, so a later session's report or note without an
    ID names the earlier Compilation. Trigger: a filesystem error writing compilation.json after the code is in place.
    The command's warning names the new Compilation to pass; its temporary file also stays in the ignored planning
    folder.
  • The record's location is found as reports find the Project: an adopted root is one whose .firstdraft/ has no
    state.json. Trigger: an artifact that itself contains .firstdraft/state.json, which the Compiler does not emit.
  • The record is written for whichever Project's state is in the folder when the code is in place. Trigger: replacing
    .firstdraft with another Project's state while plan compile or compilation download runs.
  • A note's acknowledgment is checked as a report's is, by its stored ID and Compilation, not by its Project or kind.
    Trigger: a 201 from something other than First Draft that carries a note with a valid ID and the expected
    Compilation.

Validation

  • npm audit: found 0 vulnerabilities
  • npm run check: passed (typecheck, lint, format, 383 tests, pack check, packed-package smoke)
  • Hosted checks on effb9b5: Docs line, Node 22.0 on Linux, macOS, and Windows, and Node 24 quality all pass

A person who agrees to reports also agrees to notes: short, fixed-
field accounts of where First Draft itself fell short, so the
service learns which requests a Plan cannot state, which guidance
misled the agent, and which output was wrong. A note belongs to the
Project, so an agent can send one during the interview, before any
Compile.

The three note commands reuse the report path: the account is read
first and nothing is checked or sent with reports off, each field
keeps only its shape, and the exact body is printed and sent once.
start names notes only when reports are on, so the agent of a person
who said no hears nothing about them.

Reports and notes now cover the application's whole life. A later
session no longer has the Compilation ID that plan compile printed,
so plan compile and compilation download record it in a new file
beside state.json, which keeps its format and moves with the
planning state into the archive under root adoption. A report, or a
note about generated code, uses that record unless an ID is given,
and sends nothing when there is neither.
The command reference said a note reads no file, but it reads the
Project's state and, for generated code without an ID, the
Compilation record. The README said both commands send nothing with
reports off, but each still reads the account. And when the record
cannot be written, the earlier one stays, so the warning and the
reference now say a later report may name an earlier Compilation.
After a record write fails, the record still names an earlier
Compilation, so start, the report help, and the wrong_output help
now say that omitting the ID uses the Compilation the CLI last
recorded, not the one it last wrote.
The CLI and the First Draft service had each written their own
examples of what a note's fields may hold. Each side passed the
other's, but two files can drift apart unseen. The fixture is now a
copy of the service's file, byte for byte, as the failure-report
fixture is, so both sides test the same strings. Prettier leaves it
alone for the same reason.
@raghubetina
raghubetina marked this pull request as ready for review November 22, 2026 04:00
@raghubetina
raghubetina merged commit 10c5f2a into main Nov 22, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant