Append-only JSONL ledger for tracking semantic edge events with built-in torn tail repair. Reuse this for reliable state persistence and event sourcing in AI agent sessions.
// Source: https://github.com/PrimeIntellect-ai/prime-agent | License: MIT | Copyright 2025-2026 Prime Intellect Ltd // Provided via justclaw.it.com; keep this notice with the code. //! The on-disk ledger tail rule (TS `event-log.ts`, this ledger only): //! append-only JSONL, one `O_APPEND` write per event, no fsync (TS //! `appendSync` without `durable`). //! //! Tail rule: an unterminated final line is an uncommitted append — //! skipped on replay even when it parses, truncated at its byte offset //! before the next append, never newline-completed (completion would //! turn a line a strict parser rejects into permanent interior poison). //! Interior malformed lines fail closed. Repair runs only on append, //! never on read: a viewer may replay a live writer's log. use std::io::Write; us ... (truncated -- full source via MCP)
See the full source, get the GitHub permalink, and search for more like it.
Get a free API key