Add structured --closes metadata for generated pull requests

Author: cr101Created Aug 12, 2026Updated Oct 2, 2026
Labelsenhancementexisting-pr

Problem

PRs generated by no-mistakes can reference an implementation issue in ## Intent without using a GitHub-supported closing keyword. When the PR is merged into the default branch, the completed issue therefore remains open.

For example, a generated body may say Implement issue #95, but GitHub only auto-closes the issue for a closing reference such as Closes #95.

A repository pull request template cannot reliably solve this because no-mistakes supplies the complete PR body. Asking the calling agent to edit the generated body afterward is also fragile: later no-mistakes PR updates may overwrite the edit, and the issue relationship is structured pipeline input rather than prose that should be inferred from --intent.

Proposal

Add a repeatable --closes option when starting a run:

bash
no-mistakes axi run \
  --intent "Validate C05 across production browser conditions" \
  --closes 95

Also expose the equivalent option on any non-AXI command that starts the same pipeline, if applicable.

The PR step should render explicit closing references in a stable section, for example:

markdown
## Issues

Closes #95

Required behavior

  • Accept an issue number, and preferably an owner/repository-qualified issue reference where cross-repository closure is supported.
  • Allow --closes to be repeated for a PR that fully resolves multiple issues.
  • Treat closing references as structured run metadata and persist them across daemon restarts, reattachments, fix rounds, rebases, reruns, and PR body refreshes.
  • Preserve the closing section whenever no-mistakes updates an existing PR body.
  • Deduplicate repeated references and produce deterministic ordering.
  • Validate that each supplied reference is syntactically valid before starting the run.
  • Do not infer closure from arbitrary issue references in --intent, commit messages, branch names, parent issues, or sub-issue relationships.
  • Do not add a closing keyword when --closes is absent. A PR may intentionally be partial work and should then use ordinary references supplied by its author.
  • Before reporting the PR step complete, verify that the current PR body still contains every requested closing reference.
  • Document that GitHub performs automatic closure only when the PR merges into the repository's default branch and the referenced issue is eligible for keyword closure.

Why a dedicated flag

--intent is optimized for review context, not machine-readable issue lifecycle semantics. A dedicated flag avoids accidentally closing parent, related, blocked, or merely referenced issues and gives no-mistakes enough information to preserve the relationship through every PR-body rewrite.

Acceptance criteria

  • A run started with --closes 95 creates or updates a PR whose body contains Closes #95 exactly once.
  • Merging that PR into the default branch closes issue #95 through GitHub's native behavior.
  • Multiple --closes arguments produce one deterministic closing reference per issue.
  • Subsequent pipeline fixes and PR updates retain all closing references.
  • A run without --closes retains current behavior and never guesses which referenced issue to close.
  • CLI help, AXI documentation, and tests cover validation, persistence, deduplication, PR creation, and PR update behavior.

Related

This complements #667, which concerns synthesizing a durable PR description from the final changeset. This proposal is narrower: it adds explicit, structured issue-closing metadata that must survive any PR-description generation strategy.