@oiyonet/task-ledger
v1.0.0
Published
Deterministic event-sourced task ledger and multi-agent coordination engine for AI coding workflows. 100% zero-dependency.
Maintainers
Readme
@oiyonet/task-ledger
Deterministic event-sourced task ledger and multi-agent coordination engine for AI coding workflows. 100% zero-dependency.
Built by OIYO Lab to solve multi-agent race conditions, conflicting file writes, and session coordination across diverse AI coding runtimes (Claude Code, OpenAI Codex, Google Antigravity/Gemini, and Grok).
🌟 Why Event-Sourced Ledger for AI Agents?
Traditional file locking mechanisms (flock, lockfiles) fail in complex agentic workflows:
- No Provenance: Locks don't tell you who took the lock, what step they are on, or why they touched a file.
- Deadlocks: When an agent times out or crashes mid-step, locks remain orphaned indefinitely.
- No Cryptographic Integrity: File locks can be overwritten or deleted without an audit trail.
@oiyonet/task-ledger treats agent coordination as an append-only, cryptographic Merkle-chain of events (.agents/ledger.jsonl). Every task claim, file mutation, verification step, and release is immutably recorded with SHA-256 chaining.
📦 Installation
# Global CLI
npm install -g @oiyonet/task-ledger
# Or run instantly via npx
npx @oiyonet/task-ledger status🚀 Quick Start (CLI)
1. Claim a Task with File Lock Declarations
agent-ledger claim --runtime claude --task task-101 --files src/auth.ts,src/user.ts --msg "Implementing JWT auth"If another agent (e.g., codex) attempts to claim overlapping files:
agent-ledger claim --runtime codex --task task-102 --files src/user.ts
# ❌ Claim Rejected: File conflict: 'src/user.ts' is already locked by task 'task-101' (claude).2. Record Intermediate Steps & File Mutations
agent-ledger record --runtime claude --task task-101 --event FILE_MUTATE --files src/middleware.ts --msg "Added auth middleware"
agent-ledger record --runtime claude --task task-101 --event VERIFICATION_PASS --msg "12 unit tests passed"3. Check Real-Time Multi-Agent Status
agent-ledger statusOutput:
📊 Task Ledger Status (Total Events: 3)
Ledger: /workspace/.agents/ledger.jsonl
Active Tasks (1):
• [PASSED] task-101 (claude)
Claimed: 2026-11-14T03:30:00Z | Last: 2026-11-14T03:32:15Z
Files (3): src/auth.ts, src/user.ts, src/middleware.ts
Message: "12 unit tests passed"4. Release Task
agent-ledger release --runtime claude --task task-101 --msg "Merged to main"5. Verify Ledger Cryptographic Chain
agent-ledger verify
# ✅ Cryptographic chain verification PASS: 4 events verified with 0 tampering.6. Break Stalled Tasks (Deadlock Prevention)
agent-ledger break --task task-101 --reason "Agent session terminated without cleanup"💻 Programmatic TypeScript / Node.js API
import { TaskLedger } from '@oiyonet/task-ledger';
const ledger = new TaskLedger({
ledgerPath: '.agents/ledger.jsonl',
deadlockThresholdMinutes: 45,
});
// Claim task
const res = ledger.claim('gemini', 'refactor-db', ['src/db.ts']);
if (!res.success) {
console.error(res.error);
}
// Derive live state
const state = ledger.deriveState();
console.log(state.activeTasks);
// Verify chain
const audit = ledger.verifyChain();
assert(audit.valid);🌐 Powered by OIYO Lab
@oiyonet/task-ledger is an open-source foundational system developed and maintained by OIYO Lab.
Explore our companion developer tools at tools.oiyo.net and deep technical engineering articles on blog.oiyo.net.
License
MIT © OIYO Lab
