Guide Overview
After this guide, you’ll be able to:- Replace messages mid-conversation (e.g. system prompts)
- Delete messages mid-conversation
- Track every context change
Why Edit Contexts?
You want to tweak the system prompt. But first, the ritual. Copy it somewhere. Just in case. Make the edit. Test. It’s worse. What was the prompt before? You’re debugging blind—reconstructing from memory. And editing without losing the audit trail? A pain. What if you could skip the ritual? Edit anything. Never lose the original. Every change tracked. Rewind anytime. Effortlessly. UltraContext gives you that out of the box. Update or delete any message with a single API call. Every change creates a new version. The original is preserved. Add metadata to track why. Full audit trail, full control. Zero complexity. Edit freely. The system remembers.Editing Contexts
Updates and deletes automatically create new versions. This means you can always rewind to any mutation point.Appends don’t create new versions. Using
before and at is enough to travel back in time for them. Update Messages
Update by message ID or index:Update multiple messages
Partial updates
Updates are partial by default. Only the fields you specify get changed. Everything else stays intact.Delete Messages
Soft delete vs hard delete — one method, two behaviors.
- Soft delete —
uc.delete(contextId, ids). Removes messages from the current version but creates a new version; deleted messages are preserved in prior versions and recoverable viauc.get(contextId, { version: N }). - Hard delete —
uc.delete(contextId, { permanent: true }). Wipes the entire context, all versions, all messages. Irreversible.
Delete multiple messages
Including Metadata
Examples
Replace System Prompt
Undo Last Message
Remove the last message from the conversation.Delete Entire Context
Permanently delete a context and all its versions.Delete Multiple Contexts
Permanently delete up to 100 contexts in one call.See also: Fork & Clone Contexts
For major changes, consider forking instead of editing.