ledger-consistency

Audit software state transitions for balancing counterparts and derived view consistency.

2|Updated Apr 30, 2026
One-click install
npx skills add https://github.com/NlightNFotis/skills --skill ledger-consistency
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: ledger-consistency
Source: https://github.com/NlightNFotis/skills/tree/main/ledger-consistency
Command: npx skills add https://github.com/NlightNFotis/skills --skill ledger-consistency

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill helps you find bugs caused by inconsistent state across lifecycles, counters, queues, events, retries, and external systems. It is designed for situations where something was acquired but never released, counted twice, lost in transit, or allowed to drift away from the authoritative source of truth.

Core Features & Use Cases

  • Ledger-style state auditing: Maps every important transition to its required counterpart, such as acquire/release, enqueue/dequeue, emit/handle, or charge/refund.
  • Defect detection framework: Systematically checks for leaks, orphans, duplicates, drift, and impossible states, then turns findings into concrete invariants and reconciliation rules.
  • Cross-boundary reconciliation: Useful for reviewing distributed flows involving databases, caches, queues, payment providers, search indexes, or replicated systems where retries and partial failures can silently corrupt state.
  • Use Case: If your service shows mismatched queue counts, duplicated payments, lingering sessions, or resources that never clean up after cancellation or crashes, this Skill gives you a structured review process to identify the broken counterpart and define automatic safeguards.

Quick Start

Ask the ledger-consistency skill to audit a specific lifecycle such as pending jobs, open connections, payment state, or event delivery and identify missing counterparts, drift, and invariants to enforce.

Frequently Asked Questions about ledger-consistency

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I debug state drift and mismatched counts in distributed systems?

Reconcile state drift in distributed systems by mapping every lifecycle mutation to its required counterpart, then checking for leaks, orphans, duplicates, and impossible states. This structured audit identifies broken transitions across queues, caches, and replicated records.

What is ledger-style state reconciliation for event-driven architectures?

Ledger-style state reconciliation audits event-driven architectures by verifying that every emit has a matching handle, every acquire has a release, and derived views match authoritative records. It systematically detects silent corruption from retries and partial failures.

How do I enforce idempotency and prevent duplicate processing in retry logic?

Enforce idempotency in retry logic by defining runtime-checkable invariants that detect duplicate events and orphaned transactions. Reconciliation jobs then verify that derived state matches authoritative records and flag mismatches before they cause outages.

Why are my queue counts mismatched and sessions lingering after crashes?

Queue count mismatches and lingering sessions after crashes occur when lifecycle transitions lack balancing counterparts for acquire and release operations. A consistency audit traces failure paths to identify missing cleanup logic and define automatic reconciliation safeguards.

Does this consistency review approach work for external system synchronization?

This consistency review works for external system synchronization by reconciling cross-boundary flows involving payment providers, search indexes, and databases. It evaluates idempotency, traces failure paths, and defines invariants to catch drift between authoritative sources and derived views.

When should I not use ledger consistency audits for software state transitions?

Avoid ledger consistency audits when state transitions are purely functional with no side effects, or when the system lacks identifiable authoritative versus derived state. The framework requires traceable lifecycle mutations and cross-boundary dependencies to effectively detect drift.