Skip to content

Conversation

@takai
Copy link
Owner

@takai takai commented Jan 19, 2026

This PR addresses the issue where the model prepends conversational explanations instead of outputting only the intended structured result (e.g. a Git commit message), even when explicitly instructed otherwise.
Fixes #1.

The root cause was fragmented and inconsistent prompt construction. Output-suppression rules were duplicated across multiple convention assets and combined via manual string concatenation, which reduced their effectiveness and made behavior sensitive to language and environment.

This change migrates prompt construction to a single template-based system. All output rules are centralized and applied consistently at the system level, with a clearly defined structure that separates instructions, context, diff, and expected output. This makes it harder for the model to ignore or reinterpret the constraints.

Key changes include:

  • Replacing ad-hoc string building with a Go text/template–based prompt.
  • Centralizing output-only rules in the template and removing redundant rules from convention assets.
  • Introducing a PromptData struct for explicit, maintainable data passing.
  • Adding a safe fallback path if template rendering fails.
  • Expanding tests to validate prompt structure and the presence of critical output rules.

With this structure, the model is consistently guided to start directly with the commit subject and suppress conversational preambles, regardless of terminal language or locale.

- Replace manual string building with template system for better
  maintainability and consistency
- Remove redundant output rules from convention asset files, now
  centralized in template
- Add PromptData struct for cleaner template data passing
- Improve error handling with fallback concatenation
- Expand test coverage to validate template sections and output rules
@takai takai merged commit 2253831 into main Jan 19, 2026
1 check passed
@takai takai deleted the fix/suppress_conversational_preambles branch January 19, 2026 12:23
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] Claude Haiku includes unnecessary conversational preamble in Japanese environment

2 participants