feat: context blocks — configurable per-message context injection#118
Merged
feat: context blocks — configurable per-message context injection#118
Conversation
Add contextBlocks field to RepoConfig — a Record<string, string> mapping block names to resolved file paths. Relative paths are resolved against REPO_PATH, absolute paths pass through unchanged. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Returns { [name]: { path, sizeBytes } } for each configured context
block. Size computed via statSync (0 if file not found).
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Add contextBlocks to WS SendMessage and InterruptMessage schemas - Extend assemblePrompt() to read context block files, wrap in <context> tags with preamble, and separate with ---CONTEXT_END--- - Gracefully skips unknown names and missing files Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…ptChat Pass contextBlocks from WS messages through to assemblePrompt at all call sites — skill resolution, passthrough, and interrupt paths. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Store context block names on user messages for UI display. The USER_SEND reducer action now accepts contextNames which are preserved on the FinishedMessage for rendering in the user bubble. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- ContextPicker: multi-select dropdown triggered by @ button, fetches available blocks from /api/config, shows name + file size - ChatInput: @ button in command strip, context pills row above textarea, contextBlocks passed through onSend/onInterrupt and cleared after send - UserBubble: compact "@ Name1, Name2" line when context was attached - ChatView: wires contextBlocks into WS payload and USER_SEND dispatch Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…ming - Escape XML-unsafe characters in context block name/source attributes - Truncate context block files exceeding 100 KB with warning - Remove no-op handleToggle useCallback wrapper in ContextPicker - Dispatch USER_SEND on interrupt so context annotation shows in bubble - Rename contextNames → contextBlocks across all frontend files - Add tests for XML-unsafe names and size limit truncation Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
contextBlocksfrom.mitzo.json— maps names to file paths (relative or absolute)/api/configexposes available blocks with file sizes for the frontend picker<context>XML blocks with a preamble ("The user has attached the following reference files…") and---CONTEXT_END---separator before the user's messagecontextBlocksflows through all WS →startChat/sendToChat/interruptChat→assemblePromptpaths@button in command strip opens a multi-select ContextPicker, selected blocks shown as removable pills above the textarea, cleared after send. User bubble shows compact@ Name1, Name2annotationConfig example
{ "contextBlocks": { "workflow": "context/workflow.md", "org": "/absolute/path/org_structure.md" } }Test plan
contextBlocksto a repo's.mitzo.json, verify picker shows entries with sizes@ nameannotation🤖 Generated with Claude Code