Project / 2026 / active
Sledge
A SQLite-backed event and work engine that stays consistent across retries, restarts, and failures.
TorkBot kept turning “do this later” into a systems problem. A useful agent cannot forget promised work because its process restarted, nor can it casually do the same thing twice.
Sledge stores events and durable work in SQLite. Handlers run transactionally, while retries, leases, timers, and projections survive process restarts. It is the work engine under my agent projects.
State now, work later, one commit
A user.created event can update the queryable user table and schedule an email as one atomic action:
events: {
'user.created': async ({ event, actions }) => {
await actions.index('upsertUser', event.payload);
await actions.enqueue(
'welcome-email.send',
event.payload,
{ workKey: `welcome:${event.payload.userId}` },
);
},
}
If the transaction fails, neither effect exists. Once it commits, the queued work remains eligible across restarts and uses its work key to resist duplicate scheduling.
Wake up, drain the work, disappear
A process does not need to stay resident to use the durable queue:
const quiescence = await opened.ledger.runWorkersUntilQuiescent({
configureQueue: () => ({ maxInFlight: 8 }),
scheduler,
signal,
});
console.log(quiescence.nextEligibleAtMs);
That shape fits alarms, cron invocations, and other hosts that wake briefly. SQLite holds the durable truth between activations; the timer only needs to ask the ledger when to wake again.