state-consistency-investigator
Skill8 starsChanged 6 months agoMITView on GitHub
Specialized investigator for diagnosing state consistency failures: replication lag, cache staleness, event ordering issues, cross-service data divergence, and eventual consistency bugs. Dispatched by debug-conductor.
In this repository129 other files it gives its agents.
- AGENTS.mdAGENTS.md
- guidance/AGENTS.mdAGENTS.md
- CLAUDE.mdCLAUDE.md
- guidance/CLAUDE.mdCLAUDE.md
- .github/copilot-instructions.mdCopilot instructions
- blast-radius-checkSkill
- brainstormingSkill
- branch-flow-gateSkill
- branch-sync-gateSkill
- codebase-reconSkill
- codeowners-drift-auditSkill
- code-review-batterySkill
- cognitive-complexity-refactoringSkill
- debateSkill
- debug-conductorSkill
- dispatching-parallel-agentsSkill
- domain-buildSkill
- evidence-adjudicatorSkill
- executing-plansSkill
- external-cli-auditSkill
- feature-developmentSkill
- field-rename-verificationSkill
- finishing-a-development-branchSkill
- git-branch-conventionsSkill
- gitlab-cliSkill
- hotfix-charterSkill
- implementation-trackerSkill
- incident-revert-reviewSkill
- infra-config-investigatorSkill
- investigation-stateSkill
- kernel-splitSkill
- llm-behavior-investigatorSkill
- llm-skill-reviewSkill
- merge-authorization-gateSkill
- micro-harsh-reviewSkill
- output-verificationSkill
- pre-commit-gateSkill
- progressive-code-review-gateSkill
- progressive-harsh-reviewSkill
- providing-code-reviewSkill
- pr-triage-gateSkill
- push-authorization-gateSkill
- receiving-code-reviewSkill
- reproduction-experiment-investigatorSkill
- requesting-code-reviewSkill
- requirements-validation-pmSkill
- requirements-validationSkill
- scope-tripwireSkill
- session-handoffSkill
- skills-hierarchy-tuningSkill
- sp-bughuntSkill
- subagent-driven-developmentSkill
- systematic-debuggingSkill
- test-driven-developmentSkill
- timeline-trace-investigatorSkill
- token-estimationSkill
- unified-commit-gateSkill
- using-git-worktreesSkill
- using-superpowersSkill
- verification-before-completionSkill
- The first 60 shown.
The file
We split this skill into the rules it gives an agent
6 rules. About 0 are common, 6 are distinctive, and 0 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈6
Distinctive · estimate
This author's own choices. Worth a look.
0
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 69
Check historical lag: is it steady or spiking?
- Distinctive: line 73
Check if lag explains the observed inconsistency window
- Distinctive: line 78
Verify events were published in correct order
- Distinctive: line 79
Verify events were consumed in correct order
- Distinctive: line 87
Check cache TTL vs. invalidation timing
- Distinctive: line 91
Check cache hit rate: sudden drops may indicate invalidation storms
≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
State Consistency Investigator
Role: Diagnose state consistency failures across services: stale reads, replication lag, event ordering, cache-vs-source divergence. Dispatched by:
debug-conductor— never invoked directly by user. Evidence type:StateEvidence(seeskills/_shared/evidence-schema.md)
When to Use
Dispatched by debug-conductor when the incident involves data inconsistency — stale reads, replication lag, cache staleness, event reordering, or cross-service state divergence.
Investigation Protocol
Step 1: Identify the Consistency Boundary
- Which data entities are affected? (user profiles, order records, account settings)
- Which services read this data? (source of truth vs. replicas vs. caches)
- What consistency model is expected? (strong, eventual, read-after-write)
- What propagation paths exist? (DB replication, event bus, cache invalidation, API sync)
Step 2: Cross-Source Comparison
For each affected entity:
- Query the source of truth (primary DB) — what's the current value?
- Query each consumer (replica DB, cache, downstream service) — what do they see?
- Record discrepancies with timestamps:
{
"inconsistencies": [
{
"entity": "customer:C-1001:phone",
"sourceA": "primary-db",
"sourceB": "replica-db",
"valueA": "+1-555-0199",
"valueB": "+1-555-0100"
}
]
}Step 3: Replication Lag Assessment
- Measure current replication lag (primary → replica)
- Check historical lag: is it steady or spiking?
- Compare lag SLA vs. actual:
- Average within SLA but P99 outside? (intermittent issue)
- Lag correlated with load patterns? (peak hours)
- Check if lag explains the observed inconsistency window
Step 4: Event Ordering Audit
- Inspect the event/message bus for the affected entity
- Verify events were published in correct order
- Verify events were consumed in correct order
- Check for:
- Duplicate events (at-least-once delivery)
- Lost events (check consumer acknowledgment)
- Reordered events (partition key mismatch, consumer parallelism)
Step 5: Cache Behavior Analysis
- Check cache TTL vs. invalidation timing
- Trace the invalidation flow: event received → cache key deleted → next read
- Identify: does the cache-miss read go to source of truth or replica?
- Critical pattern: Cache invalidation works, but re-fill reads stale replica → re-caches stale data
- Check cache hit rate: sudden drops may indicate invalidation storms
Step 6: Produce Evidence
{
"inconsistencies": [ /* cross-source comparison results */ ],
"replicationLag": { "primaryToReplica": 4500, "measured": "ISO-8601" },
"eventOrdering": [
{ "expected": ["update", "invalidate", "read"], "actual": ["update", "read", "invalidate"], "divergencePoint": 1 }
],
"staleReads": [
{ "query": "SELECT phone FROM profiles WHERE id=C-1001", "staleValue": "+1-555-0100", "currentValue": "+1-555-0199", "lagMs": 4500 }
]
}Stop Conditions
- Inconsistency source identified (replication lag, cache re-fill, event ordering)
- 3 cross-source comparison checks completed
- Token budget exhausted
- Wall-clock limit (5 minutes)
Escalation Conditions
- Multiple unrelated inconsistencies with no common cause (may indicate data corruption)
- Replication lag within SLA but inconsistency persists (not a lag issue — something else)
- Event bus shows correct delivery but consumer state is wrong (consumer bug)
Common Patterns This Investigator Detects
| Pattern | Evidence Shape |
| Stale replica read | Primary has new value, replica has old; lag > consistency window |
| Cache re-fill from replica | Cache invalidated correctly, but refill reads stale replica |
| Event reordering | Events consumed in different order than published |
| Invalidation race | Read arrives between invalidation and re-fill → cache miss → stale read |
| Dual-write inconsistency | Two services write same entity independently; values diverge |
| Eventual consistency window violation | Consumer reads during propagation delay |
Failure Modes
| Mode | Symptom | Recovery |
| Timing sensitivity | Bug only appears under specific timing | Test with artificial delays |
| Stale read | Reading from replica during lag | Read from primary for verification |
| Event ordering | Assuming ordered delivery | Check for out-of-order events explicitly |
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

