Skip to content

Docs

Finish

When the work on a unit is committed and its tests pass, you finish it with /bk:done. Finishing checks the tests and writes a completion record: a permanent note in the spec tree of what was built, against which approved versions, and with which test results.

While you work, every commit and every test is tied to the unit, so finishing can find them.

  1. Let Claude commit while the unit is active. Every commit it makes ends with the unit’s line:

    Add the reset endpoint
    BuildKeel-Unit: TK-001
  2. Commit in a terminal if you want to. With stamping your own commits on, the default, your commits get the same line.

  3. Put the test case’s ID in square brackets in the name of each test that checks it:

    it("emails a reset link [US-001-TC1]", async () => {
    // ...
    });

    A test may carry several IDs.

A commit without the unit’s line still counts for the unit when it is on the unit’s branch; /bk:done asks you about those (see Commits without a unit line).

The test cases that apply to a task are its own plan’s and its story’s (see Tests and traceability). In a Spec-driven tree, tests carry the scenario’s ID, such as [AUTH-R3-S1].

Claude runs the tests with a JUnit XML report and gives the report to BuildKeel, which shows where each test case stands.

  1. Run the tests with a JUnit XML report written under .buildkeel/, which keeps it out of git. Most test runners can write one:

    Test runner Command
    Vitest npx vitest run --reporter=default --reporter=junit --outputFile.junit=.buildkeel/junit.xml
    Jest npx jest --reporters=default --reporters=jest-junit, with JEST_JUNIT_OUTPUT_FILE=.buildkeel/junit.xml
    pytest pytest --junitxml=.buildkeel/junit.xml
    Node’s test runner node --test --test-reporter=spec --test-reporter-destination=stdout --test-reporter=junit --test-reporter-destination=.buildkeel/junit.xml
    Go gotestsum --junitfile .buildkeel/junit.xml
    Maven, Gradle already written under target/surefire-reports/ or build/test-results/
  2. Let Claude record the report with BuildKeel.

    BuildKeel matches each test to its test case by the ID in its name, or by a recorded match for a test written before BuildKeel (see Tests and traceability).

  3. Read where each test case stands:

    Recorded test results
    TK-001: 1 of 3 test cases passes, 1 fails, 1 without a current passing or failing result.
    Read .buildkeel/junit.xml: 2 tests, 2 tagged with a test case. Results are recorded for this working tree only (local results).
    TDD:
    - TK-001-TC1: passed with no red run on record. If a reason applies (characterization, refactor, no behavior), state it with exceptions; otherwise finishing reports it.
    - US-001-TC1: red run recorded, with only test files changed since the last commit. Commit the test on its own now, before the code that makes it pass.
    Test cases of TK-001 (local results):
    - TK-001-TC1 Endpoint validates its input: passed
    - US-001-TC1 Link arrives (from US-001-TP): failed: test/reset.test.ts > emails a reset link [US-001-TC1]
    - US-001-TC2 Link expires (from US-001-TP): no tagged test, left for the story

Each test case is:

  • passed: every test tagged with it that ran passed;
  • failed: a test tagged with it failed;
  • not run: a test in the code carries its tag, or is matched to it, but no report since has run it;
  • stale: the code, or the test plan, changed after the tests ran. Committing exactly the code that was tested does not make a result stale;
  • no tagged test: no test carries its ID yet, and none is matched to it.

A result that comes from a matched test alone says so, such as - US-E001-TC1 Link sent (from US-E001-TP): passed, through its recorded match. When the unit is finished, the match of a test that now carries its test case’s ID is dropped, in the same commit as the completion record:

Finishing a unit with a matched test
- Dropped the recorded match of US-E001-TC1 to test/reset.test.ts > emails a reset link: the test now carries [US-E001-TC1] in its name.

Results are local: they are kept in .buildkeel/ in your working tree, never committed, and only the completion record shares them.

BuildKeel reminds you to run /bk:done when the work looks done. Neither reminder blocks anything.

When the work is done. In a Spec-driven tree, ticking a change’s last task tells Claude to say so:

The last task ticked
Every task of CH-002 "Reset links expire" is done: tell the user they can run /bk:done to finish it.

In Full SDLC, recording the test results says the same once every test case that applies to the unit passes and its work is committed.

Before you share unfinished work. When Claude is about to run git push, gh pr create or gh pr merge while a unit is active, BuildKeel tells it, and the command goes ahead:

Before a push
BuildKeel: CH-002 "Reset links expire" is not finished: tell the user to run /bk:done before merging. The command goes ahead.

In Claude Code a hook adds this before the command runs. Antigravity cannot add a note before a command, so there the agent is told right after the command ran, at its next step, and its instructions also ask it to remind you before it pushes. A push you make in a terminal gets no reminder.

Finishing checks the unit, shows you what it will record, and writes nothing until you confirm.

  1. Run /bk:done.

    /bk:done

    Run on its own, Claude asks what to finish; press Enter for the active unit. In a Spec-driven tree, see Finishing a change.

  2. Let Claude run the tests again if the code changed since they last ran. It then checks the unit without writing anything.

  3. If the unit has had no final review, let Claude run it, by fresh reviewers, and answer each finding before the finish (see Reviews and the fix loop). A task built in a run already has one when its review after the task covers its latest commit.

  4. If the unit’s branch has commits without a BuildKeel-Unit line, press Enter to count them all for the unit, or choose the ones to leave out.

  5. Read the preview of what finishing will record.

  6. Confirm in plain text, or fix what it reports first.

For a defect, Claude also offers to close it without a fix, such as a duplicate or a change in behavior; see Small fixes, defects and spikes.

When something the done gate checks is missing, nothing is written, and every reason is listed with what to do (see What must be true).

When the unit’s branch has commits without a BuildKeel-Unit line, Claude lists them and asks what to do with them. Commits left out are named in the completion record, and BuildKeel stops counting them for the unit. Commits stamped with another unit stay with that unit. Nothing in git history is changed.

Before writing anything, Claude shows what finishing will do, in its reply, and asks you in plain text to confirm:

/bk:done
TK-001 "Reset endpoint" v1 can be finished. Finishing will:
- write its completion record in the spec tree, built against US-001@v1, EP-01@v1, BI-01@v1, with a summary of its test runs; its record files (working notes, test-run summaries, reviews and the rest) go into it in full and leave the tree
- commit only those files in the spec repo as "done: TK-001 v1", without pushing
- release its claim on this machine and clear the active unit here; the code branch is left as it is
The finish goes ahead with 2 warnings from the done gate:
1. TK-001-TC1 has no red run: no recorded run shows its test failing before the code.
To fix: Next time, record a failing run of the test while only test files have changed, and commit the test before the code; or state an exception for TK-001-TC1 if one applies (characterization, refactor, no behavior).
2. TK-001 has no final review.
To fix: Run the final review by fresh reviewers, as /bk:done does, before finishing.
Commits for the unit in this repo: 2.
Stamped with its BuildKeel-Unit line:
- dcc6036 Add the reset endpoint
1 commit on bk/TK-001-reset-endpoint has no BuildKeel-Unit line. It counts for the unit unless the user leaves it out:
- c8a80a6 Fix lint
Files: src/lint.ts, src/reset.ts, test/reset.test.ts
Not merged into main yet; the record is written before the merge and stays valid after a squash.
Test cases of TK-001 (local results):
- TK-001-TC1 Endpoint validates its input: passed
- US-001-TC1 Link arrives (from US-001-TP): passed
- US-001-TC2 Link expires (from US-001-TP): no tagged test, left for the story
What it built: Built: as planned, checked against <id> (/reset: text found)
TDD and the checks on tests:
- TK-001-TC1: no red run
- US-001-TC1: red at <id>, green at <id>
Revert check: not run yet. Run it with manage action revert-check before finishing, so the report shows whether the tests need the code.
Test-file diff: no assertion was removed or weakened since each test was added.
Coverage: no run recorded a coverage report, so the changed lines were not checked for coverage.
Reviews: TK-001 has no final review yet. Run it now, before finishing: the final review always runs.
No findings.
Left for the story: US-001-TC2 has no test yet; US-001 cannot be finished until every test case in US-001-TP passes.

Besides the commits, files and test results, the preview shows:

  • What it built: the task’s Built line, checked against its last commit. When the code delivers something other than the plan, Claude says what was built and why, and the line says “changed”, with the reason. Something the task was to deliver and did not is named as missing.
  • TDD and the checks on tests: each test case’s red and green runs, or its stated exception; the revert check; the test-file diff; the changed lines no test ran; and mutation testing when the team has turned it on. See TDD evidence.

In Full SDLC, a test case with no red run, or a test that passes without the unit’s code, is a finding of the done gate’s TDD check: a warning by default, or a refusal when the team sets the check to block. See TDD evidence. Coverage is never gated.

Once the unit is finished, carry on from where finishing leaves you.

  1. Push the unit’s branch and open a pull request as usual. You stay on the unit’s branch.

  2. Accept the next unit Claude offers, if you want to build it now.

    When another unit under the same parent is ready to start, such as the story’s next task, Claude names it and offers to start it. If you agree, its branch is stacked on this unit’s branch, so it has this work before it is merged (see Its branch).

  3. Or run /bk:build to build every ready unit in turn.

After finishing:

  • The unit’s claim is released, and there is no active unit in this working tree.

  • The unit’s context keeps listing its code, from git and from its completion record.

  • /bk:build, asked to show what can be started, lists finished units under Done.

  • In a Spec-driven tree, finishing a standalone defect offers to link it to a requirement its fix’s files implement. See Small fixes, defects and spikes.

  • A unit is finished once per approved version. Starting or finishing it again is refused, naming its completion record:

    /bk:build TK-001
    TK-001 cannot be started.
    - TK-001 v1 was finished on 2026-10-01 by Jane Doe <jane@example.com> (tasks/TK-001/completions/20261001T141200Z-jane-doe.yaml).
    To fix: Save a change to TK-001 with save_draft and approve the new version with /bk:approve TK-001; then it can be started and finished again. Or record the follow-up as a defect with /bk:new defect, or as an ad-hoc unit with /bk:build and a description of the change.

A story built through tasks, or an epic, is never started: its work is done in the units under it. Once they are all done, finish it by name.

  1. Finish every unit under it.

  2. Merge the work, and run the tests again in this repository.

  3. Run /bk:done with its ID:

    /bk:done US-001
  4. Read the preview and confirm, as for any unit.

What must be true:

  • Every unit under it must be finished at its approved version in force: its tasks, any defects attached to it or to them, and for an epic, its stories. A defect closed without a fix counts as done (see Small fixes, defects and spikes). An open one is named, with what to do: start it and finish it, or finish it in the working tree where it is in progress.
  • Every test case of its own test plan must pass. A test case with a tagged test in this repository needs a current passing result here, so run the tests after the work is merged. A test case delivered only in another code repository counts as passed when the completion record of the unit that delivered it says it passed.
  • An epic needs no test plan of its own; when it has one, its test cases must pass the same way.
  • Nothing under it may be suspect: no unit under it, and no test case in its plan or theirs. See When a requirement changes.

Its completion record lists the units under it with their records, and each test case with where it passed:

children:
- unit: TK-001
version: 1
record: tasks/TK-001/completions/20261001T141200Z-jane-doe.yaml
- unit: TK-002
version: 1
record: tasks/TK-002/completions/20261001T160500Z-sam-lee.yaml

The done gate checks the unit before anything is written:

  • The working tree has no uncommitted changes, and is on the unit’s branch.
  • The unit is not suspect: built against a version of something above it that has changed since. Decide it first with /bk:impact (see When a requirement changes).
  • Every test case of the unit’s own test plan has a tagged test and a current passing result. For a task, that is the task’s plan, at the version recorded last; for a story built without tasks, the story’s plan.
  • A test case the task takes from its story’s plan must pass once a test is tagged with it. Until someone writes that test, it is left for the story: it does not stop the task, but the story cannot be finished until every one of its test cases passes. So the first task under a story can finish before the whole story works.
  • A story built without tasks has no open defect under it: each is finished, or closed without a fix. A task is not held up by its own defects; the story above it is.
  • Its review findings: a High or Medium finding neither fixed, parked nor rejected, or no final review by fresh reviewers, is reported by the review-findings check. That check has its own mode, warn by default, so it is shown and does not stop the finish unless your team sets it to block (see Reviews and the fix loop).
  • A task needs at least one passing test case, its own or its story’s. A task with no test plan of its own, none of whose tests is tagged with a story test case, is refused: nothing shows its work is tested. Give it a test plan whose test cases cover the task, or tag a test with the story test case it delivers.

When something is missing, nothing is written, and every reason is listed with what to do:

/bk:done
Finish of TK-001 refused by the done gate: 1 check failed.
1. US-001-TC1 "Link arrives" fails: test/reset.test.ts > emails a reset link [US-001-TC1].
To fix: Fix the code or the test, then run the tests with a JUnit XML report and record it with the BuildKeel test_results tool.

A team can set the done gate to warn (finish anyway and show what failed) or off:

process:
gates:
done: warn

In a Spec-driven tree, defects and ad-hoc units finish the same way, except that a missing regression test is a reminder, not a refusal.

Finishing writes one file in the unit’s directory, completions/<time>-<who>.yaml. Its last part, records, holds the unit’s record files in full (working notes, pauses, test-run summaries with one written now, review findings and answers, switches, handoffs and execution records), and they are removed from the tree; as-built records stay as files, and git history keeps everything. It commits that on its own in the spec repo as done: <ID> v<N>. It is pushed only when autoPush is set in buildkeel.yaml, like approvals; otherwise push the spec repo when you are ready to share it. For how records fit together, see Records and the audit trail.

unit: TK-001
version: 1
ancestors:
- US-001@v1
- EP-01@v1
- BI-01@v1
documents:
EP-01-DD: 1
repo: payments-api
branch: bk/TK-001-reset-endpoint
commits:
- id: c8a80a6f2d5c3e8b9a1f0e7d6c5b4a3928170f6e
subject: Fix lint
by: branch
- id: dcc60364b1e2a7f3c9d8e0b5a4f6c2d1e3b7a9c8
subject: Add the reset endpoint
by: trailer
excluded: []
merged: null
files:
- src/lint.ts
- src/reset.ts
- test/reset.test.ts
tests:
ranAt: c8a80a6f2d5c3e8b9a1f0e7d6c5b4a3928170f6e
plans:
- TK-001-TP@v1
- US-001-TP@v1
cases:
TK-001-TC1:
result: passed
tests:
- test/reset.test.ts > rejects a missing email [TK-001-TC1]
US-001-TC1:
result: passed
tests:
- test/reset.test.ts > emails a reset link [US-001-TC1]
US-001-TC2:
result: no test
note: left for the story
testFirst:
cases:
TK-001-TC1:
red: null
green: c8a80a6
US-001-TC1:
red: 4f1d2c9
green: c8a80a6
passedWithoutCode: []
testChanges: []
untestedLines: []
built:
result: as planned
line: "as planned, checked against c8a80a6 (/reset: text found)"
delivers:
- planned: POST /reset
built: POST /reset
finishedBy: Jane Doe <jane@example.com>
finishedAt: 2026-10-01T14:12:00Z
host: claude-code
Field What it holds
unit, version The unit and the approved version that was finished. Ad-hoc units, defects found while building and every defect in a Spec-driven tree have no version.
ancestors The versions in force above the unit when it was finished: the ones its context showed.
documents The version of each document required of the unit or above it, other than test plans, that the work was built against, as it was when the unit was started, such as the epic’s design document. A newer version that changes what the work is built on makes the unit suspect.
repo, branch The code repository and the unit’s branch.
commits Each commit counted for the unit, with its subject line, and by: trailer (its BuildKeel-Unit line) or by: branch (on the unit’s branch without one).
excluded Commits on the unit’s branch that you left out.
merged The commit that brought the work into the default branch, when it was already merged; otherwise empty.
files The files those commits changed.
tests The commit the results matched, the test plan versions, and each test case’s result with the tests that carry its tag.
testFirst Each test case’s red and green commits, or its stated exception; the test cases whose tests passed without the unit’s code; the weakened tests; and the changed lines no test ran. See TDD evidence.
built For a task, its Built line: whether it was built as planned, changed or missing, and each thing it delivers as planned and as built, with the reason for a change.
finishedBy, finishedAt, host Who finished it (their git identity), when, and in which coding agent.

The record stands on its own: after a squash merge replaces the commit IDs, it still says what was built, against which versions and with which results. Completion records are never edited; the agent is blocked from changing them.

  • The context part. Before you confirm, the preview shows what the unit learned, built from its working notes and what Claude adds from the conversation: decisions and why (with those replaced marked), departures from the plan, dead ends, known limitations, follow-ups with their IDs, and notes for the next person who touches the code. It is kept under context in the completion record, and an archived change carries the same. The next unit that changes the same files is given the notes for the next person when it starts.
  • Working notes. Finishing is a checkpoint: the working notes since the last one are checked and kept in the finishing commit, and Claude lists them in the same reply (see Working notes and threads).
  • Reviews. The completion record keeps the final review and every finding with its reviewer and how it was answered (see Reviews and the fix loop).
  • The Learning loop. When the unit is part of a pattern in the records, such as a file three defects changed, finishing shows it with the records behind it and what Claude proposes, a practice or a note on the code; nothing is saved unless you agree (see The Learning loop).
  • The read-only copy of the glossary, practices and ADRs is refreshed first, when it has changed, in a commit of its own with the unit’s line (see The playbook).

In a Spec-driven tree (see Choose a mode), /bk:done finishes a change by archiving it: its spec changes are merged into the capability specs, each capability it touches gets its next version naming the change, and the change’s files are frozen as its record. See Spec-driven mode in depth.

  1. Run /bk:done CH-002, or run /bk:done on its own with no active unit and pick from the open changes. Those with every task ticked come first, and you can pick several. A change does not have to be the active unit to be finished.
  2. Tick the tasks Claude finds already pass their verification, if you agree.
  3. Read the final review and the preview of what finishing will write.
  4. Choose Fix first or Finish anyway, or Reword the spec, then finish when Claude offers it.
  5. Choose which text to keep for any overlap Claude shows.
  6. Accept or decline the follow-up change for work left open.

Before anything is written, BuildKeel gathers, for Claude and for you:

  • the unticked tasks, each with how it is verified;
  • each capability spec as it will be after the merge: what the change adds or modifies in full, the rest one line each;
  • the design’s Design and Decisions sections;
  • the code linked to the change: its commits (stamped BuildKeel-Unit: CH-002, or on its branch) and the files they changed;
  • where each scenario’s tests stand, and the gaps: scenarios with no tagged test (see Tests and traceability);
  • the consistency check: the proposal and spec changes disagreeing, tasks or the design naming a requirement the change removes, test tags naming no scenario, each with its file and line, ticked tasks whose requirement changed after the tick;
  • the template check, including the capability specs after the merge;
  • the suspects archiving would raise (see When a requirement changes);
  • overlaps: requirements this change modifies or removes that another change archived since its spec change was written.

Nothing here stops the finish. The only things that do are uncommitted changes in the working tree, which the record would leave out, and for the active change, being off its branch.

A task can be done without being ticked. Before showing you anything else, Claude checks each unticked task against the code and the test results, tells you in a line each which now pass their verification, and offers to tick them. Once they are ticked, finishing is previewed again.

Claude then runs the final review by fresh reviewers, as Reviews and the fix loop describes: each requirement and scenario shown as met, partly met or not met with its evidence, the code-quality findings with their severity, and the break-it agent’s failing tests. The findings and how each was answered are kept with the archived change. Claude also keeps a line summing up the review in the completion record.

In the same reply, Claude shows what finishing will write: the capability specs after the merge, with the requirements the change adds or modifies in full and the others by name. Then it asks, in plain text at the end of the reply, whether to Fix first or Finish anyway. Fix first is the default when a High or Medium finding is open, or the checks report something missing, such as a gap or a failing test; otherwise finishing is the default. Finishing anyway is recorded, with what was reported.

When the review finds a gap where the code is right and the spec is not, such as a requirement for a flag the code never needed, Claude also offers Reword the spec, then finish. It shows the requirement’s new text and why, saves it once you agree, and previews again.

Whenever anything is committed or changed after the preview, such as a fix to a docstring, Claude previews again and asks you on the new preview. A preview that no longer matches the change or its code cannot be applied.

When you finish anyway with tasks unticked or gaps reported, the result lists them, and Claude offers a follow-up change to hold them. If you agree, it is drafted and reviewed like any change, starting with its proposal. Either way the change is archived as it is, and its completion record keeps the tasks left unticked (openTasks) and what was reported.

A spec change records the capability version it was written against (base). When another change has given the capability a newer version since, changes to different requirements merge on their own. When both changed the same requirement, Claude shows you both texts:

An overlap
- AUTH-R2: written against AUTH v1; CH-002 changed it in v2.

You choose which text to keep, or how to combine them, and Claude passes your choice when the change is archived. The spec change is rewritten with that text and the version it was merged onto, so the frozen change says exactly what was merged.

Several changes finish oldest first, each with its own review, versions and commit. Each is merged onto the versions the ones before it wrote: when CH-012 and CH-015 both modify AUTH, CH-012 makes AUTH version 4, and CH-015 is checked against version 4 and makes version 5.

/bk:done CH-002
Archived CH-002 "Reset links expire".
- Wrote AUTH v2 (capabilities/AUTH/versions/v2.md), naming CH-002.
- Froze the change: changes/CH-002-reset-links-expire/archive.yaml, and its completion record changes/CH-002-reset-links-expire/completions/20261014T101500Z-jane-doe.yaml (1 commit, 2 files).
- Recorded the tasks left unticked: 1.2, 2.1.
- Committed as "archive: CH-002" (4c1d2e9) in the spec repo.
- Released its claim; there is no active unit in this working tree now.
- The branch bk/CH-002-reset-links-expire is unchanged: push it and open a pull request as usual.

Everything is committed once, as archive: CH-002, and pushed only when autoPush is set:

<spec root>/
capabilities/AUTH/versions/v2.md AUTH after the merge
capabilities/AUTH/versions/v2.yaml its record: the change, the hash, who, when
changes/CH-002-reset-links-expire/archive.yaml the hash of every file of the change
changes/CH-002-reset-links-expire/completions/...yaml the completion record

The archive record freezes the change. Its files, and the capability versions, are never edited: the agent is blocked from changing them, and validation reports one changed, added or removed outside BuildKeel.

change: CH-002
versions:
AUTH: 2
files:
changes/CH-002-reset-links-expire/design.md: sha256:7d1b0c4e9f2a8e3d5c6b7a8f9e0d1c2b3a4f5e6d7c8b9a0f1e2d3c4b5a6f7e8d
changes/CH-002-reset-links-expire/proposal.md: sha256:2b4c6d8e0f1a3b5c7d9e1f3a5b7c9d1e3f5a7b9c1d3e5f7a9b1c3d5e7f9a1b3c
changes/CH-002-reset-links-expire/specs/AUTH.md: sha256:9e8d7c6b5a4f3e2d1c0b9a8f7e6d5c4b3a2f1e0d9c8b7a6f5e4d3c2b1a0f9e8d
changes/CH-002-reset-links-expire/tasks.md: sha256:1a2b3c4d5e6f7a8b9c0d1e2f3a4b5c6d7e8f9a0b1c2d3e4f5a6b7c8d9e0f1a2b
archivedBy: Jane Doe <jane@example.com>
archivedAt: 2026-10-14T10:15:00Z

A change’s completion record has the fields of The completion record, for the change’s commits, files and the scenarios’ results, and these besides:

Field What it holds
versions The capability versions its archiving wrote, such as AUTH: 2. Code linked to the change is thereby linked to them: query on AUTH version 2 lists its commits and files.
requirements The requirements it added or modified. Its code depends on them: a later change to one makes the change suspect.
review The final review as Claude summed it up to you; the fresh reviewers’ findings, and how each was answered, are kept under reviews.
findings What the consistency and template checks reported.
finishedAnyway true when you finished it although something was reported missing.
openTasks The tasks left unticked when it was archived, each with its number and text.