| name | agent-chief-attention-guard |
| description | Use Agent Chief to filter and manage AI agent notifications, alerts, and events with local-first LLM-based attention management |
| triggers | ["set up agent chief to filter my notifications","configure chief to manage agent interruptions","add event sources to agent chief","create a custom chief policy for my workflow","integrate my agent with chief's dispatch system","check what chief would interrupt me about","tune chief's decision thresholds","review chief's learned preferences"] |
Agent Chief — Local-First Attention Guard
Skill by ara.so — AI Agent Skills collection.
Agent Chief is a local-first attention management layer that sits between you and all your agents, alerts, and event sources. It uses a three-stage filtering engine (hard rules → similarity classifier → LLM judge) to decide whether to interrupt you, batch into a digest, dispatch to agents, or curate into memory. Everything runs locally with explainable decisions and zero telemetry.
Installation
uvx agent-chief demo
uv tool install agent-chief
pip install agent-chief
Core Commands
chief init
chief run
chief demo
chief trace evt_20260706_1040_ab12
chief policy
chief report
chief eval
chief eval --learning
chief eval --cohort
chief eval --compare v1 v2
Configuration
Chief stores everything under ~/.chief/ (configurable via CHIEF_HOME):
~/.chief/
├── config.toml # Core configuration
├── POLICY.md # Human-readable learned policy (editable!)
├── chief.db # SQLite: events, decisions, memory
└── .env # LLM API keys (optional for local models)
Minimal config.toml
[llm]
backend = "deepseek"
api_key_env = "DEEPSEEK_API_KEY"
[scenes]
deep_work = { threshold = 0.85, active_hours = "9-12,14-17" }
available = { threshold = 0.60 }
sleeping = { threshold = 0.95, active_hours = "23-7" }
commute = { threshold = 0.75, active_hours = "8-9,17-18" }
[behavior]
shadow_days = 7
batch_window_minutes = 30
max_batch_size = 10
Environment Variables
export DEEPSEEK_API_KEY="your_key_here"
export OPENAI_API_KEY="your_key_here"
export CHIEF_HOME="/custom/path"
Sending Events to Chief
HTTP API
import httpx
response = httpx.post("http://127.0.0.1:7800/v1/events", json={
"source": "my-monitor",
"title": "Disk usage above 90%",
"body": "The /var partition is at 92% capacity on prod-server-3",
"topic": "infra.alerts",
"severity": "warning",
"metadata": {
"server": "prod-server-3",
"partition": "/var",
"usage_pct": 92
}
})
decision = response.json()
print(f"Route: {decision['route']}")
print(f"Score: {decision['score']:.2f}")
print(f"Reason: {decision['reason']}")
Python SDK
from agent_chief import ChiefClient
client = ChiefClient()
decision = client.propose_event(
source="github-watcher",
title="PR #482 merged to main",
body="Feature: Add OAuth login flow\nAuthor: @alice\n+240 -18",
topic="dev.github",
metadata={"pr_number": 482, "author": "alice"}
)
if decision.route == "interrupt":
print(f"🔔 Chief says interrupt: {decision.reason}")
elif decision.route == "dispatch":
print(f"🤖 Dispatched to: {decision.agent_id}")
Model Context Protocol (MCP)
Chief exposes an MCP server for Claude Desktop and other MCP clients:
{
"mcpServers": {
"chief": {
"command": "chief",
"args": ["mcp"]
}
}
}
Then in Claude:
Use Chief to propose this event: "Nightly backup completed successfully"
Agent Integration Patterns
Heartbeat Agent with Chief
import time
from agent_chief import ChiefClient
chief = ChiefClient()
def check_system_health():
"""Your existing health check logic"""
return {
"status": "healthy",
"cpu": 45.2,
"memory": 62.1,
"disk": 78.5
}
while True:
health = check_system_health()
decision = chief.propose_event(
source="health-monitor",
title=f"System health: {health['status']}",
body=f"CPU: {health['cpu']}% | Memory: {health['memory']}% | Disk: {health['disk']}%",
topic="infra.monitoring",
severity="info" if health['status'] == "healthy" else "warning"
)
if decision.route == "interrupt":
print(f"🚨 {decision.reason}")
time.sleep(300)
CI/CD Integration
from agent_chief import ChiefClient
def on_build_complete(build_result):
chief = ChiefClient()
decision = chief.propose_event(
source="github-actions",
title=f"Build {'✓ passed' if build_result.success else '✗ failed'}: {build_result.branch}",
body=f"Commit: {build_result.commit_sha[:8]}\nDuration: {build_result.duration}s",
topic="dev.ci",
severity="info" if build_result.success else "error",
metadata={
"branch": build_result.branch,
"commit": build_result.commit_sha,
"duration": build_result.duration,
"tests_failed": build_result.failures
}
)
return decision
Dispatch with Verification
Chief can dispatch work to your agents and verify completion:
from agent_chief import ChiefClient
client = ChiefClient()
client.register_agent(
agent_id="log-analyzer",
capabilities=["analyze_logs", "suggest_fix"],
verification="command:grep -q 'Analysis complete' /tmp/analysis.log"
)
def handle_dispatch(task):
analyze_logs(task.event.metadata["log_file"])
write_report("/tmp/analysis.log")
Policy Editing
Chief learns from your ±1 feedback and distills preferences into POLICY.md. You can hand-edit this file:
# Chief Attention Policy
## Topic Preferences (EMA-learned)
- dev.ci: +0.15 (↑ after 3 positive signals)
- infra.monitoring: -0.20 (↓ after 5 negative signals)
- social.twitter: -0.50 (manually set)
## Hard Rules
- BLOCK: source=heartbeat AND body contains "all clear"
- ALWAYS_INTERRUPT: severity=critical AND topic=infra.prod
- BATCH: topic=dev.github.prs AND severity=info
Changes take effect immediately — no restart needed. Chief reconciles your edits with learned weights.
Tracing Decisions
Every decision is fully traceable:
$ chief trace evt_20260706_1040_ab12
CI failed on main: test_auth_flow broken by PR
route dispatch at stage 3 in scene deep_work (confidence 0.85)
score 0.87 urgency=0.90 relevance=0.90 actionability=0.85 novelty=0.80 confidence=0.90
┌────────────┬───────┬──────────────────────┐
│ stage │ ms │ note │
│ stage1 │ 0.1 │ no hard rule fired │
│ associate │ 1.2 │ 0 memory hits │
│ judge │ 812.4 │ backend deepseek │
│ route │ 0.3 │ routed dispatch │
└────────────┴───────┴──────────────────────┘
tokens: 1104 in (704 cached) / 96 out · prompt v1 · cost $0.000301
Working with Scenes
Scenes are your contexts (working, sleeping, commuting). Chief uses them to adjust interrupt thresholds:
from agent_chief import ChiefClient
client = ChiefClient()
client.set_scene("deep_work")
decision1 = client.propose_event(
source="slack",
title="New message in #random",
scene="available"
)
decision2 = client.propose_event(
source="slack",
title="New message in #random",
scene="deep_work"
)
Common Patterns
RSS Feed Integration
import feedparser
from agent_chief import ChiefClient
chief = ChiefClient()
for entry in feedparser.parse("https://example.com/feed.xml").entries:
chief.propose_event(
source="rss.example",
title=entry.title,
body=entry.summary[:500],
topic="news.tech",
metadata={"url": entry.link}
)
Cron Job Notifications
from agent_chief import ChiefClient
import subprocess
chief = ChiefClient()
result = subprocess.run(["backup-script.sh"], capture_output=True)
chief.propose_event(
source="cron.backups",
title=f"Nightly backup {'succeeded' if result.returncode == 0 else 'FAILED'}",
body=result.stdout.decode() if result.returncode == 0 else result.stderr.decode(),
topic="infra.backups",
severity="info" if result.returncode == 0 else "error"
)
Training the Policy
from agent_chief import ChiefClient
client = ChiefClient()
decision = client.propose_event(
source="twitter",
title="New mention",
body="@you nice work on that PR!"
)
client.feedback(decision.id, thumbs_up=True)
client.feedback(decision.id, thumbs_up=False)
Troubleshooting
Chief won't interrupt in shadow mode
This is intentional. For the first 7 days (or 50 graded samples), Chief only simulates interrupts. Check the digest for ⚡ would have: interrupted annotations and grade them with ✓/✗. Run chief report to see graduation status.
High LLM costs
- Use DeepSeek (cheap) or local Ollama models
- Check cache hit rate:
chief trace <id> shows "X cached" tokens
- Tune stage-1 rules to block more before LLM: edit
POLICY.md
- Most events (75%) should die at stage 1/2 (microseconds/milliseconds)
Events not routing as expected
chief trace evt_<id>
chief debug --event '{"title": "...", "body": "..."}'
chief policy
chief reset --learning-only
Daemon won't start
lsof -i :7800
chief run --port 8000
tail -f ~/.chief/logs/chief.log
LLM backend errors
Chief degrades gracefully to rules-only routing when the LLM is unavailable. Check:
chief debug --test-llm
chief run --rules-only
Verification failing for dispatched tasks
import subprocess
result = subprocess.run(["your-verify-command"], capture_output=True)
print(result.returncode, result.stdout, result.stderr)
client.register_agent(
agent_id="my-agent",
capabilities=["task"],
verification="llm:Did the agent complete the task successfully?"
)
Testing Your Integration
import pytest
from agent_chief import ChiefClient
@pytest.fixture
def chief():
return ChiefClient(test_mode=True)
def test_critical_alert_interrupts(chief):
decision = chief.propose_event(
source="test",
title="Production down",
severity="critical",
topic="infra.prod"
)
assert decision.route == "interrupt"
assert decision.score >= 0.90
def test_heartbeat_blocked(chief):
decision = chief.propose_event(
source="heartbeat",
title="System check",
body="All systems operational, no issues to report"
)
assert decision.route == "block"
Advanced: Custom Judge Prompts
Chief's LLM judge uses versioned prompt templates. To experiment:
cp ~/.chief/judge/templates/v1/system.jinja2 ~/.chief/judge/templates/v2/system.jinja2
vim ~/.chief/judge/templates/v2/system.jinja2
chief eval --compare v1 v2
chief config set judge.prompt_version v2
Resources
- Demo replay:
chief demo (24 events, fully offline)
- Evaluation suite:
chief eval --help
- Policy reference:
~/.chief/POLICY.md
- Metrics: Every decision includes token count and USD cost
- Learning curve:
chief eval --learning shows 0% → 100% convergence
- Cohort benchmark:
chief eval --cohort (100-user dataset)