Skip to content

feat: structured content blocks for user messages#158

Merged
esceptico merged 1 commit intomainfrom
feat/content-blocks
Mar 29, 2026
Merged

feat: structured content blocks for user messages#158
esceptico merged 1 commit intomainfrom
feat/content-blocks

Conversation

@esceptico
Copy link
Copy Markdown
Owner

  • new ContextContent pydantic model with content_type, content, metadata fields
  • user messages support typed content blocks instead of XML-in-string hacks
  • time gap converted from XML injection to a time_since_last_message context block
  • all LLM providers (openai, anthropic, gemini) render context blocks as semantic XML with metadata attributes
  • history endpoint returns context blocks as structured data
  • _retain_user_content strips context blocks on re-entry (non-mutating)
  • render_context() in core/content.py is the single rendering point

- Add ContextContent pydantic model (content_type, content, metadata)
- Replace XML-in-string context with typed content blocks
- Time gap is now a context block (time_since_last_message), not XML injection
- All three LLM providers render context blocks as semantic XML tags
- History endpoint returns context blocks as structured data
- render_context() generates XML with attributes from metadata
- _retain_user_content() strips context blocks on re-entry (non-mutating)
@esceptico esceptico merged commit 69cf58d into main Mar 29, 2026
4 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.

1 participant