Skip to content

[Bug]: /constitution prepends a new Sync Impact Report HTML comment on every run, growing agent context unboundedly #4431

Description

@Vir3s

Bug Description

The /constitution command is instructed to produce a Sync Impact Report and prepend it as an HTML comment at the top of .specify/memory/constitution.md (Step 4 of the Outline section in templates/commands/constitution.md, commit 7b2f3684):

"Produce a Sync Impact Report (prepend as an HTML comment at top of the constitution file after update)

HTML comments are invisible in rendered Markdown but are fully present in the raw file. Because the instruction says "prepend" and says nothing about removing a previous report, each invocation of /constitution stacks another block above the last. Every agent or command that loads .specify/memory/constitution.md at runtime, including /specify, /review, and any extension hooks registered under before_constitution or after_constitution, reads the raw file and pays a growing token cost for accumulated historical changelog data that has no governance value at inference time.

Steps to Reproduce

  1. Initialise a project and run /constitution to create an initial .specify/memory/constitution.md.
  2. Make a minor amendment (e.g. reword one principle) and run /constitution again.
  3. Repeat step 2 a third time.
  4. Open .specify/memory/constitution.md and inspect the raw file (not the rendered preview).

Expected Behavior

The file contains at most one Sync Impact Report comment, representing the most recent update. On each run the previous comment is overwritten, not accumulated. Alternatively, the report is not written to the constitution file at all, because the information (version change, modified/added/removed sections, deferred TODOs) is already surfaced in the Step 7 summary output to the user, which is the natural place to derive a commit message from.

Actual Behavior

Each run prepends a new block abovw the previous one. After n runs the raw file contains n stacked report blocks. Any agent loading the constitution for downstream work reads all of them, spending tokens on historical diffs that are irrelevant to the current task.

Specify CLI Version

v1.0.4

AI Agent

Claude Code

Operating System

macOS

Python Version

Python 3.14.7

Error Logs

Additional Context

No response

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions