Skip to content

refactor: shared feedback templates + preserve plan title on deny (#296)#298

Merged
backnotprop merged 7 commits into
mainfrom
improve/feedback-prompt
Mar 16, 2026
Merged

refactor: shared feedback templates + preserve plan title on deny (#296)#298
backnotprop merged 7 commits into
mainfrom
improve/feedback-prompt

Conversation

@backnotprop
Copy link
Copy Markdown
Owner

@backnotprop backnotprop commented Mar 15, 2026

Summary

  • Unified plan deny feedback into a shared template (packages/shared/feedback-templates.ts) so all three integrations (Claude Code hook, OpenCode plugin, Pi extension) send identical directive framing to the agent
  • Added explicit instruction to preserve the plan title (first # heading) on resubmission, fixing version history diffs — closes How does Versions work? #296
  • Restructured the deny preamble from a dense paragraph into verdict → directive → rules list
  • Added optional planFilePath parameter so Pi can tell the agent to read the plan file before editing
  • Vendored the template into apps/pi-extension/ so source installs work without build:pi
  • 5 contract-level tests covering cross-integration consistency, verbatim preservation, empty input, title preservation, and the plan file hint

Test plan

  • Deny a plan in Claude Code hook — verify agent receives strong directive framing and does not rename the title
  • Deny a plan in OpenCode — verify identical output (modulo tool name)
  • Deny a plan in Pi — verify output includes "Read {planFilePath}" rule
  • bun test passes (5 tests)
  • Source install Pi extension without running build:pi — verify it loads without crash

🤖 Generated with Claude Code

backnotprop and others added 3 commits March 15, 2026 11:08
The deny/feedback prompts sent to LLM agents were duplicated as inline
string templates in hook, opencode-plugin, and pi-extension — each with
different tone and framing. The hook's directive style (from #224) was
the most effective at getting agents to address feedback. This extracts
all feedback text into @plannotator/shared/feedback-templates and has
every integration import from the single source of truth.

Closes #215 follow-up (propagates fix to OpenCode and Pi).

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…tion

Tests now verify: cross-integration consistency, verbatim feedback
preservation, empty input handling, and that approved messages don't
contain directive language. Wording can change freely without breaking
tests.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Version history slugs are derived from the plan's first # heading.
When the agent renames the heading after a deny, the version chain
breaks and the user loses diffs. The deny template now tells the
agent not to change the title unless explicitly asked.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@backnotprop backnotprop changed the title refactor: shared feedback templates across all integrations refactor: shared feedback templates + preserve plan title on deny (#296) Mar 15, 2026
backnotprop and others added 4 commits March 15, 2026 11:17
Break the dense single-paragraph preamble into structured sections:
verdict, directive, and rules list. Easier for agents to parse.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Hook and OpenCode plugin imported from @plannotator/shared/feedback-templates
without declaring it as a dependency. Worked locally but failed in CI.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Scope-crept into code review/annotate feedback which introduced a double
heading regression and dropped integration-specific strings. Reverts those
paths to their original inline strings; shared module now only covers
plan deny feedback.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Add optional planFilePath to planDenyFeedback so Pi can tell the agent
to read the plan file before editing. Check in a vendored copy of the
template so Pi source installs work without running build:pi first.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@backnotprop backnotprop merged commit 908ea9c into main Mar 16, 2026
5 checks passed
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.

How does Versions work?

1 participant