Generate specs from code

For an existing codebase, Tracemoor can have the AI write functional specifications (FS) from the code. The AI produces drafts. A draft becomes a spec only when a person accepts it.

Tracemoor decides which symbols belong to one draft. The AI reads the code of these symbols and writes the text. The anchors of a draft are the symbols Tracemoor chose, not symbols the AI picked.

There are three ways to start:

WayUse it for
Decompose › Generate specOne draft for one group of symbols, through the chat.
SweepDrafts for many groups in one run.
+ New Reverse-Spec RunA draft run for a symbol list you enter.

All drafts end up in the Drafts tab.

The AI needs Brave mode to write drafts.

Find groups of symbols

Decompose (or View › Capability Decomposition) opens Capability Decomposition. It splits the code into capabilities: groups of symbols that together do one thing.

  1. Click Decompose in the toolbar of the Specs view.
  2. Choose the strategy:
    • entry_point: one group per entry point (command, handler, main) with the functions it calls.
    • cluster: one group per cluster of the call graph.
  3. Optional: enter a cluster ID to limit the groups to one cluster, or filter the list by text.

Capability Decomposition with entry_point candidates in Weatherreport

Each card shows the group's symbols, the seed symbol it started from and a score. The score is highest for groups of 5 to 15 symbols and drops for smaller or larger groups. Small projects produce small groups with low scores.

Generate one draft

  1. In Capability Decomposition, click Generate spec on a card.
  2. The chat opens with a prepared request that names the symbols. Add instructions if needed, for example the language of the spec.
  3. Send the message.

The AI reads the code and creates the draft with the tool reverse_spec_create_draft. For profiles with a template (GAMP 5 has one for each type) the draft follows the template's sections, for example Functional Purpose, Inputs, Outputs and Acceptance Criteria.

Generate drafts for the whole project

Sweep (or View › Baseline Sweep) creates one draft per group.

  1. Click Sweep.
  2. Choose the strategy (cluster or entry_point).
  3. Choose the mode: gaps_only skips groups whose symbols are already anchored, regenerate_all takes every group.
  4. Optional: enter a number under max items to limit the run.
  5. Optional: tick dry-run to try the run without the AI. It writes placeholder drafts.
  6. Click Start.

How the run proceeds depends on Backend Mode in the Claude tab of the AI settings (see Providers):

  • Subscription mode (interactive PTY): Tracemoor lists the planned items. Tick the ones to generate and click Run selected (N). Each item runs in its own new chat session. Do not use the chat until Chat sweep running… disappears. Your previous session is restored at the end.
  • Extra Cost (claude -p per-token API): the run starts in the background. The status line shows progress, for example running · 3/10 done · 0 skipped · 0 failed. Pause, Resume and Cancel control it.

In both cases, Show in graph colours the symbols of the items in the Graph view by status. The ↻ button of an item generates it again on the next Resume.

Start a run for selected symbols

  1. In the Drafts tab, click + New Reverse-Spec Run.
  2. Under Scope, enter a label for the run, for example cluster:7 or a file path.
  3. Under Symbol anchors, add the symbols.
  4. Leave Dry-run ticked for a first try. Untick it for real drafts.
  5. Click Start Run.

A run without dry-run starts claude -p in the background, which is billed per token. In subscription mode Tracemoor refuses such a run and asks you to switch the backend or to use dry-run. Use Generate spec or Sweep instead.

Review drafts

The Drafts tab lists every pending draft, whichever way it was created. Drafts that the AI wrote through the chat appear after Refresh.

Drafts tab with two pending FS drafts

ActionEffect
PreviewShows title, type, confidence, file and the full text.
AcceptTurns the draft into a spec: final ID (for example FS-DRAFT-001 becomes FS-CKNZZP), file in the type folder, status draft. The proposed symbols become its anchors.
DiscardDeletes the draft. Asks first.
ReformulateSends your feedback to the chat, which writes a new draft.

The accepted spec keeps ai_generated, ai_confidence, ai_run_id and accepted_from_draft_id in its frontmatter. Link it to its requirement and test case afterwards, see Link specs.

Have a draft rewritten

  1. In the draft's row, click Reformulate.
  2. Enter what is wrong with the draft.
  3. Click Send to AI.

Reformulate dialog with reviewer feedback

The chat input now holds a request with your feedback and the draft's anchors. Send it. The AI creates a new draft. The old draft stays in the list until you discard it.

Accept many drafts at once

The bar of the Drafts tab sets the conditions for Bulk accept…:

ControlCondition
conf ≥Minimum confidence, from 0 to 1.
anchors ≥Minimum number of anchors.
testsAt least one proposed test anchor.

Click Bulk accept…. Tracemoor names the number of matching drafts and asks before it accepts them. The conditions are kept per project.

Confidence ↓ sorts the list, the slider ≤ N % hides drafts above a confidence. With rows ticked, Show in graph and Discard selected act on the selection.

Suggested order for an existing codebase

  1. Run Sweep with cluster, gaps_only and dry-run to see how many groups there are.
  2. Run it again without dry-run, starting with a small max items.
  3. Accept the drafts with high confidence through Bulk accept….
  4. Review the others with Preview, rewrite them with Reformulate or discard them.
  5. Write the user requirements and link the accepted FS to them and to test cases.