1import { UltraContext } from 'ultracontext'
2const uc = new UltraContext({ apiKey: 'uc_...' })
3
4// Build conversation history (schemaless)
5await uc.append('ctx_123', { role: 'user', content: '...' })
6await uc.append('ctx_123', { role: 'assistant', content: '...' })
7
8// Changes to existing messages create versions
9await uc.update('ctx_123', { id: 'msg_1', content: 'Updated system prompt' }) // v2
10
11// Rollback and branch from any point
12const { data } = await uc.get('ctx_123', { version: 0 })
13const branch = await uc.create({ from: 'ctx_123', version: 1 })
14
15// Use with any LLM framework
16const response = await generateText({ model, messages: data })