On-demand audit and analysis of agent orchestration flows via Sentinel Protocol
/plugin marketplace add ekson73/multi-agent-os/plugin install multi-agent-os@multi-agent-osThis skill inherits all available tools. When active, it can use any tool Claude has access to.
Provides on-demand analysis of agent orchestration flows. While Sentinel's automatic hooks handle continuous monitoring, this skill enables deep analysis when explicitly requested.
/audit <scope> [options]
| Scope | Description | Example |
|---|---|---|
session | Full audit of current session | /audit session |
agent <id> | Audit specific agent | /audit agent Claude-PO-86fa-001 |
task <id> | Audit specific task | /audit task task-001 |
flow | Delegation flow visualization | /audit flow |
anomalies | List all detected anomalies | /audit anomalies |
health | Calculate health score | /audit health |
| Option | Description | Example |
|---|---|---|
--verbose | Include full trace details | /audit session --verbose |
--export | Export to markdown file | /audit session --export |
--since <timestamp> | Filter by time | /audit anomalies --since 2026-01-06T19:00 |
--severity <level> | Filter by severity | /audit anomalies --severity HIGH |
| Command | Description | Example |
|---|---|---|
/audit config | Show current configuration | /audit config |
/audit validate | Validate trace against schema | /audit validate |
/audit compliance | Check hook compliance | /audit compliance |
/audit index | Show session index | /audit index |
/audit rebuild-index | Rebuild session index | /audit rebuild-index |
Read .claude/audit/session_{current_session}.jsonl
Parse JSONL entries into structured data
IF scope == "session":
data = all_entries
ELIF scope == "agent":
data = filter(entries, agent_id == target)
ELIF scope == "task":
data = filter(entries, task_id == target)
ELIF scope == "flow":
data = extract_delegation_chain(entries)
ELIF scope == "anomalies":
data = filter(entries, has_anomaly == true)
ELIF scope == "health":
data = calculate_health_score(entries)
FOR each entry in data:
- Parse trace metadata
- Extract metrics
- Identify patterns
- Calculate aggregates
Compose structured markdown report
Include visualizations where applicable
Add recommendations based on findings
/audit session)## Audit Report — Session {session_id}
### Session Summary
| Metric | Value |
|--------|-------|
| Session ID | {session_id} |
| Started | {start_time} |
| Duration | {duration} |
| Agents spawned | {agent_count} |
| Tasks executed | {task_count} |
| Delegations | {delegation_count} |
| Anomalies | {anomaly_count} |
| Health Score | {health_score}/100 |
### Agent Activity
| Agent | Tasks | Success | Errors | Avg Duration |
|-------|-------|---------|--------|--------------|
| {agent_id} | {count} | {success}% | {errors} | {avg_ms}ms |
### Delegation Chain
```mermaid
graph TD
A[Orchestrator] --> B[Agent-1]
A --> C[Agent-2]
B --> D[Sub-agent-1]
| Time | Agent | Rule | Severity | Description |
|---|---|---|---|---|
| {ts} | {agent} | {rule} | {severity} | {description} |
| Component | Score | Notes |
|---|---|---|
| Loop-free | +{n} | {status} |
| Depth compliant | +{n} | {status} |
| Error-free | -{n} | {status} |
| Performance | +{n} | {status} |
| Total | {total} |
### Agent Audit (`/audit agent <id>`)
```markdown
## Agent Audit — {agent_id}
### Agent Profile
| Field | Value |
|-------|-------|
| Agent ID | {agent_id} |
| Type | {agent_type} |
| Parent | {parent_id} |
| Created | {created_at} |
| Status | {status} |
### Task History
| Task ID | Description | Duration | Result |
|---------|-------------|----------|--------|
| {id} | {desc} | {ms}ms | {success/fail} |
### Metrics
- **Total tasks**: {count}
- **Success rate**: {rate}%
- **Avg duration**: {ms}ms
- **Total tokens**: {tokens}
### Anomalies (if any)
{anomaly_list}
### Chain Context
Parent: {parent} └─ This Agent: {self} └─ Children: {children}
/audit flow)## Delegation Flow Analysis
### Visual Flow
```mermaid
sequenceDiagram
participant User
participant Orch as Orchestrator
participant A1 as Agent-1
participant A2 as Agent-2
User->>Orch: Request
Orch->>A1: Delegate task-1
A1-->>Orch: Result
Orch->>A2: Delegate task-2
A2-->>Orch: Result
Orch-->>User: Final response
{mermaid_dependency_graph}
{step_1} → {step_2} → {step_3}
### Anomalies Audit (`/audit anomalies`)
```markdown
## Anomaly Report — Session {session_id}
### Summary
- **Total anomalies**: {count}
- **HIGH severity**: {high_count}
- **MEDIUM severity**: {medium_count}
- **LOW severity**: {low_count}
### Anomaly Log
#### 🔴 HIGH Severity
| # | Time | Agent | Rule | Description | Action Taken |
|---|------|-------|------|-------------|--------------|
| 1 | {ts} | {agent} | RULE-001 | Loop detected | Blocked |
#### 🟡 MEDIUM Severity
| # | Time | Agent | Rule | Description | Action Taken |
|---|------|-------|------|-------------|--------------|
| 2 | {ts} | {agent} | RULE-003 | Task drift | Logged |
#### 🟢 LOW Severity
| # | Time | Agent | Rule | Description | Action Taken |
|---|------|-------|------|-------------|--------------|
| 3 | {ts} | {agent} | RULE-006 | Agent mismatch | Suggested |
### Pattern Analysis
{identified_patterns}
### Recommendations
1. {recommendation_1}
2. {recommendation_2}
/audit health)## Health Score — Session {session_id}
### Overall Score
┌────────────────────────────────────────────────────────────┐ │ │ │ HEALTH SCORE: {score}/100 │ │ │ │ ████████████████████░░░░░░░░░░ {score}% │ │ │ │ Status: {EXCELLENT|GOOD|FAIR|POOR} │ │ │ └────────────────────────────────────────────────────────────┘
### Score Breakdown
| Factor | Impact | Notes |
|--------|--------|-------|
| Base score | 100 | Starting point |
| Loop-free delegations | +{n} | {count} clean delegations |
| Depth compliance | +0 | All within limit |
| No error cascades | +0 | No consecutive errors |
| Stagnation incidents | -{n} | {count} slow executions |
| Agent mismatches | -{n} | {count} suboptimal selections |
| **Final Score** | **{total}** | |
### Interpretation
{interpretation_text}
### Trend (if multiple sessions)
Session 1: ████████░░ 80/100 Session 2: █████████░ 92/100 Session 3: ███████░░░ 75/100 (current)
Input:
/audit session
Output:
## Audit Report — Session Claude-Orch-Prime-20260106-86fa
### Session Summary
| Metric | Value |
|--------|-------|
| Session ID | Claude-Orch-Prime-20260106-86fa |
| Started | 2026-01-06T19:00:00-03:00 |
| Duration | 1h 15m |
| Agents spawned | 3 |
| Tasks executed | 2 |
| Delegations | 2 |
| Anomalies | 0 |
| Health Score | 98/100 |
### Agent Activity
| Agent | Tasks | Success | Errors | Avg Duration |
|-------|-------|---------|--------|--------------|
| Claude-Orch-Prime-20260106-86fa | 2 | 100% | 0 | N/A |
| Claude-PO-86fa-001 | 1 | 100% | 0 | 45s |
| Claude-Editor-86fa-002 | 1 | 100% | 0 | 30s |
### Delegation Chain
```mermaid
graph TD
A[Orch-Prime-86fa] --> B[PO-86fa-001]
A --> C[Editor-86fa-002]
No anomalies detected.
### Example 2: Anomaly Investigation
**Input**:
/audit anomalies --severity HIGH
**Output**:
```markdown
## Anomaly Report — HIGH Severity Only
### Summary
- **HIGH severity anomalies**: 1
### Anomaly Log
| # | Time | Agent | Rule | Description | Action Taken |
|---|------|-------|------|-------------|--------------|
| 1 | 2026-01-06T19:30:00 | Claude-Dev-86fa-003 | RULE-001 | Loop detected: same task delegated twice | Blocked |
### Root Cause Analysis
The Dev agent attempted to re-delegate a code review task that it had already received. This created a potential infinite loop.
**Chain at detection**:
Orch → Dev → Dev (BLOCKED)
### Recommendations
1. Review task decomposition for Dev agent
2. Consider adding explicit "no-delegate" constraint for simple tasks
3. Verify Dev agent's context preparation includes anti-loop metadata
This skill integrates with:
| File | Purpose |
|---|---|
.claude/sentinel/config.json | Configuration settings |
.claude/sentinel/schema/trace_schema.json | Trace validation schema |
.claude/sentinel/schema/alert_schema.json | Alert format schema |
.claude/sentinel/lib/trace_writer.md | Persistence patterns |
.claude/sentinel/lib/alert_handler.md | Alert patterns |
.claude/audit/session_index.json | Session lookup index |
/audit config)## Current Sentinel Configuration
### Detection Thresholds
| Parameter | Value | Default |
|-----------|-------|---------|
| loop.similarity_threshold | 0.85 | 0.85 |
| depth.max_delegation_depth | 3 | 3 |
| drift.relevance_threshold | 0.50 | 0.50 |
| stagnation.timeout_ms | 300000 | 300000 |
### Enforcement Mode
Current: `soft` (log violations, allow continuation)
### Alert Channels
- in_conversation: enabled
- slack: disabled
/audit compliance)## Hook Compliance Report — Session {session_id}
### Compliance Score: {score}%
### Hook Coverage
| Hook | Expected | Actual | Coverage |
|------|----------|--------|----------|
| PRE_DELEGATE | 10 | 10 | 100% |
| POST_DELEGATE | 10 | 9 | 90% |
| ON_ERROR | 2 | 2 | 100% |
### Missing Traces
| Time | Expected Hook | Agent | Notes |
|------|---------------|-------|-------|
| 21:30:45 | POST_DELEGATE | Dev-001 | No return trace found |
### Recommendations
1. Ensure all delegations have matching return traces
--since option/audit config command/audit validate command/audit compliance command/audit index command/audit rebuild-index commandAudit Skill v1.1.0 | Part of Sentinel Protocol | Claude-Orch-Prime-20260106-86fa