Skip to content

docs(templates): clarify /constitution's Sync Impact Report is temporary, review-only material (#4431) - #4432

Open
chelsealong wants to merge 2 commits into
github:mainfrom
chelsealong:fix/4431-constitution-sync-report-stacking
Open

docs(templates): clarify /constitution's Sync Impact Report is temporary, review-only material (#4431)#4432
chelsealong wants to merge 2 commits into
github:mainfrom
chelsealong:fix/4431-constitution-sync-report-stacking

Conversation

@chelsealong

Copy link
Copy Markdown
Contributor

Fixes #4431

Problem

templates/commands/constitution.md (Step 4 of the Outline section) instructed
agents to "prepend" the Sync Impact Report as an HTML comment at the top of
.specify/memory/constitution.md, with no instruction to remove a previous
report first. Because HTML comments are invisible in rendered Markdown but
fully present in the raw file, every /constitution run stacked another
<!-- ... --> report block on top of the last one. Any agent or extension
hook that loads the raw constitution file at runtime (/specify, /review,
before_constitution/after_constitution hooks, etc.) pays a growing,
unbounded token cost reading historical changelog data that has no
governance value at inference time.

Fix

Step 4 now explicitly instructs the agent to remove any existing HTML
comment at the top of the file before adding the new Sync Impact Report,
so the file never carries more than one report — it is replaced, not
stacked.

This is a one-line-of-behavior instruction change to the command template
(templates/commands/constitution.md); no other copies of this text exist
in the repo.

Test plan

Added tests/test_constitution_template_sync_report.py, which asserts the
Step 4 instructions require removing any prior Sync Impact Report comment
rather than only prepending.

  • Confirmed the test fails against the pre-fix template
    (git checkout HEAD~1 -- templates/commands/constitution.md):
    tests/test_constitution_template_sync_report.py::test_sync_impact_report_step_instructs_removing_prior_report FAILED
    AssertionError: assert ('never stack' in '...' or 'not stack' in '...')
    
  • Restored the fix and confirmed the test passes:
    tests/test_constitution_template_sync_report.py::test_sync_impact_report_step_instructs_removing_prior_report PASSED
    1 passed in 0.18s
    
  • Ran the full suite: uv run --extra test pytest -q
    7705 passed, 12 skipped, 48 warnings in 499.34s (0:08:19)
    

AI disclosure

This change, including the code, tests, and this PR description, was
generated autonomously by an AI coding agent (Claude, model: claude-sonnet-5)
acting on behalf of the repository owner, with no line-by-line human review
prior to commit.

Assisted-by: Claude (model: claude-sonnet-5, autonomous)

…ithub#4431)

Step 4 of the constitution command only said to prepend the Sync Impact
Report as an HTML comment, with no instruction to remove a previous one.
Each run therefore added another report block on top of the last,
growing the raw file (and the token cost of reading it) without bound.
Now the step explicitly requires removing any existing report comment
before adding the new one.

Assisted-by: Claude (model: claude-sonnet-5, autonomous)
@chelsealong
chelsealong requested a review from mnriem as a code owner September 3, 2026 18:23

@mnriem mnriem left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As indicated by the comment on the issue please change this to a documentation issue

Per review on github#4432/github#4431: the growth this fixed isn't a functional
bug in the intended workflow — the report is scratch material for
human review and is expected to be removed before the constitution
file is committed. Step 4 now says so explicitly, alongside the
existing replace-not-stack instruction for runs where a prior report
was left in place.
@chelsealong chelsealong changed the title fix(templates): stop /constitution from stacking Sync Impact Reports (#4431) docs(templates): clarify /constitution's Sync Impact Report is temporary, review-only material (#4431) Sep 3, 2026
@chelsealong

Copy link
Copy Markdown
Contributor Author

Agreed, retitled as a docs clarification. Pushed 609dc58: Step 4 now states explicitly that the Sync Impact Report is temporary, review-only material expected to be removed before the constitution file is committed, alongside the existing replace-not-stack instruction for runs where a report was left in place (templates/commands/constitution.md). Test suite still green (tests/test_constitution_template_sync_report.py).

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.

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

2 participants