A map, not a log.
Every message is a place. Every reply, a direction. Pan the canvas. Follow a thread.
Branch into the question you almost didn't ask.
- Branch anywhere — reply from any node; each path stays intact.
- Spatial layout — ideas spread out instead of stacking up.
- Thought nodes — reasoning stays visible without cluttering the path.
- Live streaming — watch tokens land in place as the model thinks.
Two components. That's it.
```bash
npm install traek
```
```svelte
<script lang="ts">
import {
TraekCanvas,
TraekEngine,
DEFAULT_TRACK_ENGINE_CONFIG
} from 'traek';
const engine = new TraekEngine(DEFAULT_TRACK_ENGINE_CONFIG);
// Canvas calls this with the text the user typed
// and the node they're replying from (for branching).
function onSendMessage(input, fromNode) {
const userNode = engine.addNode(input, 'user', {
parentIds: fromNode?.id ? [fromNode.id] : []
});
const assistantNode = engine.addNode('', 'assistant', {
// Parent defaults to the active node (the new user message),
// so replies naturally branch from the message you answered.
autofocus: true
});
// stream chunks into assistantNode.content here...
}
</script>
<TraekCanvas {engine} {onSendMessage} />
```