← Back to Leaderboard
TMaxHu-xuan

MaxHu-xuan/task-state-guard

An embedded SQLite ledger for reconciling stale task and delivery states

View on GitHub ↗
AI FrameworkQuickstart ↓
Engineering Health (Methodology)
B+ · 69/100
Maintenance Activity
● Updated 1mo ago
Latest Release
v0.1.0
Commercial License Check
Apache-2.0 · Commercial Friendly

Automated SPDX check for reference only — not legal advice. Disclaimer

Maintenance26/35
Fork Adoption6/25
Release Cadence17/20
License Clarity20/20
Self-HostedCLI
Total Stars
★ 982
24h Growth
+0
7d Growth
+0
Forks
11

GitHub Star History

Full-history star trajectory from GitHub official history. Switch ranges or hover any point for exact counts.

MaxHu-xuan/task-state-guard Star History (2026-08-23 - 2026-12-03) ALL-TIME STAR HISTORY (2026-08 – 2026-12) +980 in 102d · avg +10/day 1k 519 0 2026-08-23: ★ 22026-09-05: ★ 1852026-09-12: ★ 3082026-09-19: ★ 4592026-09-26: ★ 5562026-10-03: ★ 6742026-10-10: ★ 7752026-10-17: ★ 8902026-10-24: ★ 9802026-10-31: ★ 9802026-11-07: ★ 9802026-11-14: ★ 9822026-11-21: ★ 9822026-11-28: ★ 9822026-12-03: ★ 982 ★ 982 08-23 10-13 12-03

Evidence-Backed Technical Brief

AI Deep Review

Architecture & Core Mechanics

TaskStateGuard is a Python SDK and CLI around an embedded SQLite ledger, not an agent execution runtime. The Ledger API records lifecycle transitions; the CLI gives operators a separate path to reconcile stale records and check health. Tasks move through queued and running and can close from either state as succeeded, failed, timed_out, or cancelled. Terminal writes are immutable: repeating the same outcome is idempotent, but conflicting outcomes are rejected.

Delivery remains pending until the task is terminal and delivery can be closed. A delivery-required task needs a real transport acknowledgement to become delivered; an internal task with no direct delivery obligation can close only as not_applicable. Runtime code uses only the Python standard library, with no network or telemetry path. There are no framework-specific adapters, so the integrating runtime owns the mapping from worker events and transport acknowledgements to ledger writes.

Key Capabilities & Differentiators

Reconciliation evaluates deadlines and active grace periods to mark stale tasks timed_out while leaving fresh tasks alone. Once the delivery grace expires for a terminal task, unreconciled user-facing delivery can close as failed, while delivery for an internal task closes as not_applicable. reconcile --dry-run uses the same rules as apply and reports aggregate counts without modifying tasks, events, or the database.

doctor checks SQLite quick_check, foreign keys, the exact schema, state semantics, finite timestamps, parent-child relations, and expected event chains. It reports aggregate counts and exits with status 1 on inconsistency. The ledger has no supported fields for prompts, messages, task bodies, or model output, but ordinary status commands can expose UUIDs and timestamps. Optional SHA-256 payload fingerprints are correlatable and may be guessable for low-entropy inputs.

Trade-offs & Limitations

Compared with a task queue or workflow engine, this narrower design is useful when an existing runtime already executes jobs but cannot reliably distinguish stale work from completed work, or completion from delivery. Its idempotency applies to recorded state, not to external side effects. It does not resume computation, schedule retries, or guarantee exactly-once execution or delivery. If the host already has reliable execution and delivery records with auditable reconciliation, a second ledger may add more integration work than value.

A dry run is a point-in-time assessment, not a lock or reservation: concurrent workers and elapsed time can change what a later apply will do. Reconciliation runs only when invoked. The database must live on a local filesystem with stable file identity and SQLite-compatible locking, not a network or mapped drive. Processes under the same OS identity are trusted, so file permissions do not isolate mutually untrusted workers sharing that identity.

Hardware & Deployment Guide

Run it locally on CPython 3.11–3.14, as a CLI in an isolated virtual environment or as a library embedded in the host application. Install from PyPI once the release is available there, or use python -m pip install . from a verified checkout. The v0.1.0 release is alpha. The checkout includes a synthetic preview/apply/recheck/doctor demo that is not packaged in the wheel. On Linux and macOS, the tool checks ownership and modes and tightens database sidecars to 0600. On Windows, pre-create a private service-account directory and explicitly opt in with allow_external_acl=True or --allow-external-acl before the subcommand; neither verifies the DACL.

CLI preview requires an existing WAL-mode ledger that already meets permission requirements. For a cleanly closed database without WAL/SHM sidecars, the read-only path verifies two consistent reads of the main file and deserializes a private copy in memory, up to 64 MiB. It fails closed if the file changes during the read or deserialization is unavailable. A safe schema v1 ledger can be previewed without migration; normal apply migrates to v2 by default. Use Ledger(path, read_only=True) when construction itself must also be read-only.

State contract: Task and delivery states close separately; a real transport acknowledgement is required for delivered.
Idempotency: Repeating the same task terminal state is accepted, while a conflicting terminal write is rejected.
Reconciliation: Deadline and grace rules close stale records without turning unknown outcomes into success or delivery confirmation.
Preview: reconcile --dry-run reports aggregate impact without writing the database, tightening file permissions, or migrating schema.
Diagnostics: doctor checks SQLite integrity, exact schema, foreign keys, state semantics, timestamps, parent-child relations, and event chains.
Deployment boundary: Standard-library Python and local SQLite only; Windows requires a caller-managed private DACL that the tool cannot verify.
Best For

Agent runtimes and background workers that already own execution and delivery but need a local, auditable way to close stale records after restarts or timeouts.

Skip If

You need scheduling, automatic retries, checkpoint resumption, exactly-once guarantees, or a ledger shared across hosts.

Reviewed on 2026-12-02 · Grounded in GitHub README, root file tree & releasesMethodology

Quick Start & Installation

Self-HostedCLI
python3 -m venv .venv
. .venv/bin/activate
python -m pip install task-state-guard

Comparison vs. Top Agents & Frameworks Alternatives

Full comparison →
RepositoryStars7d TrendStackLicenseCore Positioning
task-state-guard ★982—PythonApache-2.0An embedded SQLite ledger for reconciling stale task and delivery states
browser-use122.7k+477PythonMITPython REPL and CDP for adaptive browser automation
langgraph45.8k+293PythonMITPython graph orchestration for stateful, resumable agents and workflows
langchain150.4k+290PythonMITModular Python framework for building agents across model providers

AI Context Briefing (for Claude / Cursor / Windsurf)

Standardized architecture summary & quickstart commands ready to paste into coding agents.

Raw .md ↗
curl -sL https://repoforai.com/repo/MaxHu-xuan/task-state-guard.md

Embed Star History Chart & Badges in README.md

Full-history Star History SVGs and velocity cards on GitHub Camo: drop-in replacement for OSSInsight and Star History widgets.

MaxHu-xuan/task-state-guard Star History on RepoForAI

Active README embeds unlock Hot-Tier 6h Telemetry Refresh automatically (zero pay-to-rank).

Frequently Asked Questions about task-state-guard

Where does TaskStateGuard fit into an existing worker?

Record task creation and start through Ledger, then record the terminal outcome when the worker has evidence for it. Mark delivery as delivered only after the transport acknowledges it. Invoke reconciliation separately at startup or during operations; the library does not run a background watcher.

What hardware does it need, and what should we size for?

No GPU or VRAM is needed. This is a standard-library Python and SQLite workload. Size and test for ledger growth, concurrent writes, and reconciliation and diagnostic scan costs. For a cleanly closed database without WAL/SHM sidecars, the read-only fallback is limited to a 64 MiB main file and loads a verified copy into memory; that limit is not a general ledger size cap.

Can we embed it in a commercial, self-hosted product?

Yes. Apache-2.0 permits commercial use and self-hosting; comply with its license and applicable notice requirements when redistributing. There is no runtime network or telemetry path, but local operation does not make the ledger anonymous: protect the database and ordinary CLI output, and omit optional fingerprints where correlation or guessing is a concern.

Should we add it alongside a workflow engine or use the engine alone?

Use your existing engine's state tracking if it already gives operators distinct, evidence-backed execution and delivery states and a way to review stale records before closing them. Add TaskStateGuard when that narrow ledger is missing. It is not a replacement for durable scheduling, retries, computation checkpoints, or transport.

Upstream README & Documentation

This profile focuses on independent engineering analysis and live telemetry. Read the full upstream README, changelog, and examples directly on GitHub.

Maintaining MaxHu-xuan/task-state-guard? Pin to Homepage + competitor /alternatives pages with a custom Cloud/Demo CTA.Feature MaxHu-xuan/task-state-guard on Homepage & Alternatives ($19)
WEEKLY BREAKOUT DIGEST

Top 10 Breakout Open-Source AI Repos, Every Thursday

Signal-only digest of fast-growing AI repos, SPDX license alerts, and architecture picks. Zero spam.

Zero spam · 1-click unsubscribe · Privacy Policy

Saved in your browser · Export Markdown RFC tables or jump into /vs compare