sessionknit
v0.0.4
Published
Durable, DAG-shaped session persistence that survives parallel tool calls and mid-turn interruption.
Downloads
384
Readme
SessionKnit (TypeScript)
Part of LoopEngine — a runtime for defining and running AI agents through a transparent ReAct loop — handling durable, DAG-shaped session logs with crash-interruption detection. Works standalone too, no dependency on LoopEngine itself.
See the root README for the pitch, the prior-art table, and the scope decisions. This file only covers what's specific to running the code.
Install
npm installQuickstart
npm run quickstartimport { FileStorage, SessionKnit } from './src/index.js'
const sessionknit = new SessionKnit(new FileStorage('./sessions'), {
hasUnresolvedToolCall: (m) => m.toolCalls?.some((c) => !c.result) ?? false,
buildContinuation: (m) => ({ role: 'user', content: 'Continue from where you left off.' }),
})
await sessionknit.append(sessionId, { id, parentId, message })
const { messages, resumedAfterInterruption } = await sessionknit.resume(sessionId)Test / build
npm test # vitest
npm run build # tsc -> dist/Status
Chain reconstruction, topology repair, the async write-behind queue, and
interruption detection are real and tested. Published as
sessionknit on npm.
