Skip to content

feat(aikit): carry prompt content and sections in transcript system messages - #115

Merged
sanchitrk merged 2 commits into
canaryfrom
claude/cod-101-blocking-issue-f0edf2
Oct 30, 2026
Merged

sanchitrk merged 2 commits into
canaryfrom
claude/cod-101-blocking-issue-f0edf2

Conversation

@sanchitrk

@sanchitrk sanchitrk commented Oct 30, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Transcript system messages could only change tools. They now also change the system prompt, so a prompt section can change mid-conversation without re-rendering the leading prompt.

  • SystemMessage gains content (instructions from that point on) and sections (named, replaced by name, null removes one).
  • Replaying system messages on top of Context.systemPrompt gives the current prompt (Transcript.getCurrentSystemPrompt). A removed section added again goes last.
  • In place: models with the new supportsMidConvoSystemMessages compat flag, on our own Responses transport, keep the leading prompt and get each change as a developer message (Updated system prompt section "name": …). The cached prefix survives.
  • Folded: every other transport (the AI SDK adapters) gets the current prompt as its leading system prompt, a cache miss on a change.
  • A prompt update and a tool removal in one system message go out as one developer message.
  • modelgen sets supportsMidConvoSystemMessages for the Codex and Copilot Responses models that accept developer messages mid-conversation. In-place tool declarations (changes) now require it; every model with supportsAdditionalTools also gets the flag, so nothing changes in practice.
  • The context estimate counts prompt changes in system messages.

The harness does not emit sections yet; that is the next change.

CHANGELOG.md notes both additions under [Unreleased] → @codeworksh/aikit.

Testing

  • Unit: replay, framed updates, re-added sections, leading-prompt resolution, and the Responses wire (in place vs folded, prefix kept, combined update and removal) in test/transcript.test.ts.
  • Live: test/e2e/sections.e2e.test.ts changes a codeword section from alpha to bravo mid-conversation; all six providers answer bravo. Artifacts in test/e2e/__artifacts__/sections.*.json: openai-codex and github-copilot /responses in place, anthropic, openai, google and openrouter folded.
  • tools.added, codex and github-copilot e2e suites still pass.
  • vp check, aikit and harness typecheck, aikit and harness unit tests pass.

A local models.gen.json needs regenerating with aikit modelgen to pick up the new flag.

🤖 Generated with Claude Code

sanchitrk and others added 2 commits October 30, 2026 22:12
…essages

System messages now carry `content` and named `sections` (null removes
one) next to tool changes. Replaying them on top of `Context.systemPrompt`
gives the current prompt. Models with `supportsMidConvoSystemMessages`
on our Responses transport get each change in place as a developer
message, so the cached prefix survives; every other transport gets the
current prompt as its leading system prompt.

The catalog sets the new flag for the Codex and Copilot Responses
models that accept developer messages mid-conversation, and in-place
tool declarations (`changes`) now require it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…elog

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@sanchitrk
sanchitrk merged commit 48358e0 into canary Oct 30, 2026
2 checks passed
@sanchitrk
sanchitrk deleted the claude/cod-101-blocking-issue-f0edf2 branch October 30, 2026 16:54
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