.agents/agentdb-state-manager/SKILL.md
Persistent state management using AgentDB (DuckDB) for workflow analytics and checkpoints. Provides read-only analytics cache synchronized from TODO_*.md files, enabling: - Complex dependency graph queries - Historical workflow metrics - Context checkpoint storage/recovery - State transition analysis Use when: Data gathering and analysis for workflow state tracking Triggers: "analyze workflow", "query state", "checkpoint", "workflow metrics"
npx skillsauth add stharrold/bingo agentdb-state-managerInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
The AgentDB State Manager provides persistent database storage for workflow state tracking using DuckDB through Claude Code's AgentDB integration. This skill enables:
Primary source of truth: TODO_*.md files (AgentDB is an analytics cache)
Primary purpose: Data gathering and analysis
Workflow phase: Cross-phase (Utilities) - All phases (1-6)
Use this skill when:
Triggered by keywords: "analyze workflow", "query state", "checkpoint", "workflow metrics", "task dependencies"
Phase integration: Cross-phase (Utilities)
This skill integrates with all workflow phases:
Phase 0 (Setup):
Phase 1 (Planning - BMAD):
Phase 2 (Specification + Implementation):
Phase 3 (Quality):
Phase 4 (Integration):
Phase 5 (Release):
Phase 6 (Hotfix):
Context checkpoints (all phases):
Orchestrator integration:
This skill follows the local workflow system patterns which extend official Claude Code skill specifications:
Official Claude Code Skills:
Local Pattern Extensions:
file_structure:
frontmatter:
directory_organization:
These extensions support the multi-phase workflow system while maintaining compatibility with core Claude Code concepts.
TODO_*.md (source of truth)
↓
sync_todo_to_db.py
↓
AgentDB (DuckDB)
↓
query_state.py / analyze_metrics.py
↓
Analytics results
AgentDB requires a session ID for database identification. This skill uses:
Method: Timestamp-based (reproducible)
from datetime import datetime
import hashlib
# Generate session ID from current timestamp
current_time = datetime.utcnow().isoformat()
session_id = hashlib.md5(current_time.encode()).hexdigest()[:16]
# Example: "f8e7d6c5b4a39281"
Rationale: Provides reproducible session IDs across agent invocations within the same timeframe, balancing uniqueness with reproducibility.
Core principle: NEVER UPDATE or DELETE records - always INSERT new records
Primary table: workflow_records
CREATE TABLE IF NOT EXISTS workflow_records (
record_id UUID PRIMARY KEY DEFAULT uuid(),
record_datetimestamp TIMESTAMP DEFAULT current_timestamp,
object_id VARCHAR NOT NULL, -- Stable ID for workflow object
object_type VARCHAR NOT NULL, -- 'feature', 'task', 'epic', etc.
object_state VARCHAR NOT NULL, -- '20_in-progress', '99_done', etc.
object_metadata JSON -- Framework, dependencies, etc.
);
CREATE INDEX idx_records_object
ON workflow_records(object_id, record_datetimestamp DESC);
Current state query pattern:
-- Get latest state for each object
SELECT DISTINCT ON (object_id)
object_id, object_type, object_state, object_metadata
FROM workflow_records
WHERE object_type = 'task'
ORDER BY object_id, record_datetimestamp DESC;
# Initialize database schema and load state definitions
python .claude/skills/agentdb-state-manager/scripts/init_database.py
What it does:
# Sync all TODO_*.md files to database
python .claude/skills/agentdb-state-manager/scripts/sync_todo_to_db.py
# Sync specific TODO file
python .claude/skills/agentdb-state-manager/scripts/sync_todo_to_db.py \
TODO_feature_20251023T143000Z_my-feature.md
What it does:
# Get current state of all workflows
python .claude/skills/agentdb-state-manager/scripts/query_state.py
# Query specific workflow
python .claude/skills/agentdb-state-manager/scripts/query_state.py \
--slug my-feature
# Query task dependencies
python .claude/skills/agentdb-state-manager/scripts/query_state.py \
--dependencies --task impl_003
What it does:
# Generate metrics report
python .claude/skills/agentdb-state-manager/scripts/analyze_metrics.py
# Historical trends
python .claude/skills/agentdb-state-manager/scripts/analyze_metrics.py \
--trends --days 30
# Bottleneck analysis
python .claude/skills/agentdb-state-manager/scripts/analyze_metrics.py \
--bottlenecks
What it does:
# Store checkpoint at 100K tokens
python .claude/skills/agentdb-state-manager/scripts/checkpoint_manager.py \
store --todo TODO_feature_*.md
# List available checkpoints
python .claude/skills/agentdb-state-manager/scripts/checkpoint_manager.py list
# Restore from checkpoint
python .claude/skills/agentdb-state-manager/scripts/checkpoint_manager.py \
restore --checkpoint-id <uuid>
What it does:
✓ DO: Treat TODO_*.md files as source of truth ✗ DON'T: Modify TODO files based on AgentDB state
Rationale: Files are git-tracked and permanent; AgentDB sessions last 24 hours
✓ DO: Run sync_todo_to_db.py after every TODO file update ✗ DON'T: Let AgentDB state drift from file state
Rationale: AgentDB is a cache - it must stay synchronized
✓ DO: Use AgentDB for dependency graphs, metrics, historical analysis ✗ DON'T: Use for simple current state queries (parse TODO file instead)
Rationale: Minimize token overhead - use database for queries that justify the cost
✓ DO: Always INSERT new records for state changes ✗ DON'T: UPDATE or DELETE existing records
Rationale: Preserves full history for temporal analysis
✓ DO: Re-initialize at session start if needed ✗ DON'T: Assume AgentDB persists across days
Rationale: 24-hour auto-deletion - treat as ephemeral cache
Purpose: Initialize AgentDB schema and load state definitions When to run: First use in a session, or if schema corrupted Token cost: ~300-400 tokens
Purpose: Sync TODO_*.md files to AgentDB When to run: After every TODO file update Token cost: ~200-300 tokens per TODO file
Purpose: Query current workflow state and dependencies When to run: Complex state queries (dependency graphs, critical paths) Token cost: ~100-200 tokens per query
Purpose: Historical metrics and trend analysis When to run: End of phase, workflow retrospectives Token cost: ~400-600 tokens (complex queries)
Purpose: Store/restore context checkpoints When to run: At 100K token threshold, or before context reset Token cost: ~200-400 tokens (store + verify)
Complex dependency query:
Same query:
Savings: ~3,500 tokens (92% reduction) for complex queries
Before AgentDB:
After AgentDB:
Savings: ~3,050 tokens (92% reduction)
This skill implements the MIT Agent Synchronization Pattern based on:
Meng, E., & Jackson, D. (2025). "What You See Is What It Does: A Structural Pattern for Legible Software." Onward! at SPLASH 2025. arXiv:2508.14511v1. https://arxiv.org/abs/2508.14511
Key concepts from the paper:
agent_synchronizations table)The pattern improves incrementality, integrity, and transparency in multi-agent workflows.
v1.0.0 (2025-11-02):
development
Enforces quality gates: 80% test coverage, passing tests, successful builds, semantic versioning. Runs before PR creation. Use when: Running tests, checking coverage, validating quality, versioning Triggers: run tests, check coverage, quality gates, version bump
tools
Meta-skill (Phase 0) for bootstrapping new repositories with workflow system. Interactive callable tool that copies skills, documentation, and standards from source repository. Use when: Starting a new project that needs the workflow system Triggers: "initialize new repository", "bootstrap workflow", "replicate workflow system"
data-ai
Manages git operations: worktree creation, branch management, commits, PRs, semantic versioning, daily rebase workflow, and PR feedback handling. Use when: Creating branches/worktrees, committing, pushing, versioning, handling PR feedback Triggers: create worktree, commit, push, rebase, version, PR, PR feedback
tools
Interactive callable tool that creates BMAD planning documents (requirements, architecture, epics) in main repository on contrib branch. Three-persona Q&A system generates comprehensive planning before feature development. Use when: On contrib branch, planning phase, need requirements/architecture Triggers: plan feature, requirements, architecture, BMAD