Skip to content

refactor: split InstructionMessage into multiple system message blocks#707

Merged
FL4TLiN3 merged 3 commits intomainfrom
refactor/split-instruction-message-blocks
Mar 4, 2026
Merged

refactor: split InstructionMessage into multiple system message blocks#707
FL4TLiN3 merged 3 commits intomainfrom
refactor/split-instruction-message-blocks

Conversation

@FL4TLiN3
Copy link
Contributor

@FL4TLiN3 FL4TLiN3 commented Mar 4, 2026

Summary

  • Split createInstructionMessage into 2-3 separate TextParts (preamble+meta, expert instruction, optional skill rules) instead of one concatenated string with --- separators
  • Changed messageToCoreMessage to return ModelMessage[], mapping each instruction TextPart to a separate SystemModelMessage
  • Applied Anthropic cacheControl only to the last system block for optimal prefix caching
  • Updated generating-tool-call.ts to use flatMap for the new array return type
  • Removed unused instructionContentsToCoreContent helper

Test plan

  • bun run typecheck — 24/24 packages pass
  • bun run test — message tests 18/18 pass (pre-existing failures in coordinator/setup-experts unrelated)
  • bun run build — 24/24 packages pass
  • E2E tests — 89/89 pass
  • bun run validate:changeset

🤖 Generated with Claude Code

FL4TLiN3 and others added 3 commits March 4, 2026 22:13
Split the single concatenated instruction string into 2-3 separate
SystemModelMessages for improved prompt clarity and per-block cache control.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…tents

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@FL4TLiN3 FL4TLiN3 merged commit e5e3d99 into main Mar 4, 2026
11 checks passed
@FL4TLiN3 FL4TLiN3 deleted the refactor/split-instruction-message-blocks branch March 4, 2026 22:22
@FL4TLiN3 FL4TLiN3 mentioned this pull request Mar 4, 2026
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.

1 participant