devteam-logs
npx machina-cli add skill michael-harris/devteam/devteam-logs --openclawSession state: !source "${CLAUDE_PLUGIN_ROOT}/scripts/state.sh" && get_current_session 2>/dev/null || echo "No active session"
Recent events: !sqlite3 .devteam/devteam.db "SELECT type, message FROM events ORDER BY created_at DESC LIMIT 10" 2>/dev/null || echo "No events"
DevTeam Logs Command
Command: /devteam:logs [options]
View execution logs, event history, and debugging information.
Usage
/devteam:logs # Show recent logs
/devteam:logs --session <id> # Show logs for specific session
/devteam:logs --agent <name> # Filter by agent
/devteam:logs --level error # Filter by log level
/devteam:logs --tail 50 # Show last 50 entries
/devteam:logs --export # Export logs to file
Options
| Option | Description |
|---|---|
--session <id> | Filter by session ID |
--agent <name> | Filter by agent name |
--level <level> | Filter by level: debug, info, warn, error |
--tail <n> | Show last N entries (default: 20) |
--since <time> | Show logs since time (e.g., "1h", "30m") |
--export | Export to logs/devteam-TIMESTAMP.log |
--json | Output as JSON |
--verbose | Show full log details |
Your Process
Step 1: Query Events Database
async function getLogs(options) {
let query = `
SELECT
e.id,
e.timestamp,
e.event_type,
e.data,
s.command as session_command,
ar.agent
FROM events e
LEFT JOIN sessions s ON e.session_id = s.id
LEFT JOIN agent_runs ar ON e.session_id = ar.session_id
WHERE 1=1
`
const params = []
if (options.session) {
query += ` AND e.session_id = ?`
params.push(options.session)
}
if (options.agent) {
query += ` AND ar.agent LIKE ?`
params.push(`%${options.agent}%`)
}
if (options.level) {
query += ` AND json_extract(e.data, '$.level') = ?`
params.push(options.level)
}
if (options.since) {
const sinceTime = parseTimeOffset(options.since)
query += ` AND e.timestamp > datetime('now', ?)`
params.push(sinceTime)
}
query += ` ORDER BY e.timestamp DESC LIMIT ?`
params.push(options.tail || 20)
return await db.all(query, params)
}
Step 2: Display Logs
Default Output:
DevTeam Logs
Showing last 20 entries
2026-01-29 10:45:23 [INFO] session_started
Command: /devteam:implement --sprint 1
Session: sess_abc123
2026-01-29 10:45:25 [INFO] agent_started
Agent: backend:api-developer-typescript
Task: TASK-001
Model: sonnet
2026-01-29 10:46:15 [INFO] gate_passed
Gate: tests
Duration: 12s
2026-01-29 10:46:18 [WARN] gate_failed
Gate: lint
Errors: 3
Details: src/api.ts:45 - Missing semicolon
2026-01-29 10:46:45 [INFO] fix_applied
Issue: lint errors
Files: ["src/api.ts"]
2026-01-29 10:47:02 [INFO] gate_passed
Gate: lint
Duration: 8s
2026-01-29 10:47:30 [INFO] task_completed
Task: TASK-001
Iterations: 2
Model: sonnet
2026-01-29 10:47:32 [INFO] session_ended
Status: completed
Duration: 2m 9s
Cost: $0.12
Filter: /devteam:logs --level error
Export: /devteam:logs --export
Error Filter:
/devteam:logs --level error --since 24h
DevTeam Logs - Errors (last 24h)
2026-01-29 09:15:42 [ERROR] agent_failed
Agent: database:developer-python
Task: TASK-003
Error: Migration failed - column already exists
Stack: alembic/operations.py:123
migrations/versions/abc123.py:45
2026-01-28 16:22:18 [ERROR] gate_failed
Gate: tests
Failures: 2
Details:
- test_user_creation: AssertionError
- test_login_flow: TimeoutError
Total errors: 2
Sessions affected: 2
Session Detail:
/devteam:logs --session sess_abc123 --verbose
Session: sess_abc123
Command: /devteam:implement --sprint 1
Status: completed
Timeline
10:45:23.123 session_started
10:45:23.456 phase_changed -> initializing
10:45:24.789 agent_started -> backend:api-developer-typescript
10:45:25.012 phase_changed -> executing
10:45:45.234 tool_call -> Edit (src/api.ts)
10:46:02.456 tool_call -> Bash (npm test)
10:46:15.678 gate_passed -> tests (12s)
10:46:16.890 tool_call -> Bash (npm run lint)
10:46:18.123 gate_failed -> lint (3 errors)
10:46:20.456 fix_task_created -> lint_errors
10:46:45.789 fix_applied -> lint_errors
10:47:02.012 gate_passed -> lint (8s)
10:47:30.234 task_completed -> TASK-001
10:47:32.456 session_ended -> completed
Agents Used
backend:api-developer-typescript | 1m 45s | sonnet | $0.10
lint-fixer | 25s | haiku | $0.02
Quality Gates
tests: passed (12s)
lint: passed (retry after fix)
typecheck: passed (5s)
Tokens
Input: 15,234 tokens
Output: 3,456 tokens
Cost: $0.12
Step 3: Export Logs
/devteam:logs --export --since 7d
Creates: logs/devteam-2026-01-29T104500.log
# DevTeam Execution Log
# Exported: 2026-01-29T10:45:00Z
# Filter: since 7d
# Entries: 156
[2026-01-29T10:45:23.123Z] INFO session_started session_id=sess_abc123 command="/devteam:implement --sprint 1"
[2026-01-29T10:45:25.012Z] INFO agent_started agent=backend:api-developer-typescript model=sonnet task=TASK-001
...
Log Levels
| Level | Description |
|---|---|
debug | Detailed debugging information |
info | General execution information |
warn | Warnings that don't stop execution |
error | Errors that may impact execution |
See Also
/devteam:status- System status and metrics/devteam:status --history- Session history
Source
git clone https://github.com/michael-harris/devteam/blob/main/skills/devteam-logs/SKILL.mdView on GitHub Overview
DevTeam Logs lets you view execution logs, event history, and debugging information across sessions. It helps diagnose failures, monitor workflows, and share incident context by filtering by session, agent, level, or time, and exporting results when needed.
How This Skill Works
Internally, it queries the events database and joins with sessions and agent_runs to assemble a structured log view. It supports options like --session, --agent, --level, --tail, --since, --export, and --json to tailor output and export logs for reporting.
When to Use It
- Investigate a failed run by filtering level=error and viewing recent events
- Audit activity for a specific agent or session
- Tail the last N entries during live debugging
- Export logs to a file for incident reporting
- Get time-bounded logs using --since to analyze recent activity
Quick Start
- Step 1: Run /devteam:logs with your filters (session/agent/level)
- Step 2: Review the listed entries and details in the output
- Step 3: Use --export or --json to save or process programmatically
Best Practices
- Filter by level to focus on errors and warnings
- Use --tail to view recent activity efficiently
- Combine --session and --agent for precise context
- Export logs with --export for sharing with teammates
- Use --json for machine-readable output and scripting
Example Use Cases
- Show the most recent 20 entries: /devteam:logs
- Filter by a session: /devteam:logs --session sess_abc123
- Filter by agent: /devteam:logs --agent backend:api-developer-typescript
- Export errors from the last day: /devteam:logs --level error --since 24h --export
- Output logs as JSON for automation: /devteam:logs --json