| name | state-inspector |
| description | Deep state inspection for OpenClaw agents and collectives. Provides memory inspection (agent/collective), session state visualization, consensus ledger audit, workspace integrity check, and state corruption detection. Use when debugging state issues, auditing consensus decisions, or investigating memory corruption. |
State Inspector
When to use this skill
Use this skill when you need to:
- Inspect agent memory state (short-term and long-term)
- Visualize session state across agents
- Audit consensus ledger entries
- Check workspace integrity
- Detect state corruption
- Debug state synchronization issues
- Investigate consensus failures
- Verify collective memory consistency
When NOT to use this skill
Do NOT use this skill when:
- You need to analyze logs (use
log-analyzer skill)
- You need to run system diagnostics (use
system-diagnostics skill)
- You need to recover from corruption (use
corruption-recovery skill)
- You need to manage agent lifecycle (use
agent-lifecycle-manager skill)
- You need to modify state (this is read-only inspection)
Inputs required
Before executing, determine:
- Scope: agent, collective, ledger, or workspace
- Target: specific agent ID or "all"
- Depth: summary or detailed inspection
- Output format: console, JSON, or report file
Workflow
1. Inspect agent memory
./scripts/inspect-state.sh memory --agent steward
./scripts/inspect-state.sh memory --all
./scripts/inspect-state.sh memory --agent <agent-id> --detailed
2. Visualize session state
./scripts/inspect-state.sh session
./scripts/inspect-state.sh session --history
./scripts/inspect-state.sh session --output session.json
3. Audit consensus ledger
./scripts/inspect-state.sh ledger
./scripts/inspect-state.sh ledger --verify
./scripts/inspect-state.sh ledger --search "proposal"
4. Check workspace integrity
./scripts/inspect-state.sh workspace
./scripts/inspect-state.sh workspace --detailed
./scripts/inspect-state.sh workspace --report workspace.json
5. Detect corruption
./scripts/inspect-state.sh scan
./scripts/inspect-state.sh scan --full
./scripts/inspect-state.sh scan --component memory
State Components
Agent Memory
- Short-term: Current session context, recent messages
- Long-term: Persistent knowledge, learned patterns
- Skill state: Active skill execution context
Collective Memory
- Shared context: Cross-agent knowledge
- Consensus state: Triad deliberation results
- Global state: System-wide shared state
Consensus Ledger
- Proposals: Submitted proposals for voting
- Votes: Agent votes on proposals
- Decisions: Finalized consensus decisions
- History: Complete deliberation history
Workspace State
- File integrity: Checksums and modifications
- Directory structure: Expected vs actual
- Configuration state: Config file consistency
Files
Examples
Example 1: Quick state summary
./scripts/inspect-state.sh summary
Example 2: Debug consensus issue
./scripts/inspect-state.sh ledger --since "1h ago" --verify
Example 3: Check memory corruption
./scripts/inspect-state.sh scan --component memory --full
Troubleshooting
Memory inspection fails
- Verify agent is running:
docker ps | grep <agent>
- Check memory directory permissions:
ls -la /app/memory
- Use offline inspection:
./scripts/inspect-state.sh memory --offline
Ledger verification fails
- Check ledger file integrity:
./scripts/inspect-state.sh ledger --verify
- Review recent entries:
./scripts/inspect-state.sh ledger --last 20
- Compare with backups:
./scripts/inspect-state.sh ledger --compare-backup
Workspace check reports issues
- Review specific issues:
./scripts/inspect-state.sh workspace --detailed
- Check recent modifications:
./scripts/inspect-state.sh workspace --recent
- Restore from backup if needed: Use
corruption-recovery skill
Gateway Integration
This skill integrates with the OpenClaw Gateway WebSocket RPC on port 18789:
- State queries can be sent via Gateway RPC
- Real-time state streaming via WebSocket
- State change notifications through Gateway
LiteLLM Integration
State inspection includes LiteLLM session state:
- Active conversation contexts
- Token usage tracking state
- Model session caching state
Common Debugging Scenarios
Agent offline detection and recovery
./scripts/inspect-state.sh memory --agent <agent-id> --export
./scripts/inspect-state.sh memory --agent <agent-id> --compare
Triad deliberation deadlock
./scripts/inspect-state.sh ledger --filter triad --since "1h ago"
./scripts/inspect-state.sh scan --pattern deadlock
Database corruption
./scripts/inspect-state.sh scan --component database
./scripts/inspect-state.sh ledger --full-verify
State synchronization issues
./scripts/inspect-state.sh memory --collective --compare
./scripts/inspect-state.sh scan --pattern divergence