Lists and filters logs by type, status, date range, and work item with frontmatter parsing
Lists and filters log files by type, status, and date range with frontmatter parsing. Use when users need to find, review, or analyze logs across the repository.
/plugin marketplace add fractary/claude-plugins/plugin install fractary-logs@fractaryThis skill inherits all available tools. When active, it can use any tool Claude has access to.
scripts/discover-logs.shscripts/format-output.shYou work with ALL log types, applying type-aware filtering and enrichment using metadata from types/{log_type}/ directories.
</CONTEXT>
<CRITICAL_RULES>
Filters:
log_type - Filter by type (session, build, deployment, debug, test, audit, operational, _untyped, or "all")status - Filter by status (active, completed, failed, archived)date_from - Filter logs created after this date (ISO 8601)date_to - Filter logs created before this date (ISO 8601)limit - Maximum number of logs to return (default: 50)offset - Skip first N logs (for pagination)Display options:
format - "table" (default), "json", "summary", or "detailed"sort_by - "date" (default), "title", "type", "status"sort_order - "desc" (default) or "asc"group_by - Optional grouping ("type", "status", "date")Example request:
{
"operation": "list-logs",
"log_type": "test",
"status": "failed",
"limit": 10,
"format": "table"
}
</INPUTS>
<WORKFLOW>
## Step 1: Discover Log Files
Execute `scripts/discover-logs.sh`:
- Scan `.fractary/logs/` directory
- Find all `*.md` files
- Group by type (subdirectory structure)
- Return list of log file paths
If log_type filter specified, only scan .fractary/logs/{log_type}/
For each discovered log:
--- markers)Filter logs based on request criteria:
Type filter:
if [[ "$log_type" != "all" ]]; then
filter logs where frontmatter.log_type == "$log_type"
fi
Status filter:
if [[ -n "$status" ]]; then
filter logs where frontmatter.status == "$status"
fi
Date range filter:
if [[ -n "$date_from" ]]; then
filter logs where frontmatter.date >= "$date_from"
fi
if [[ -n "$date_to" ]]; then
filter logs where frontmatter.date <= "$date_to"
fi
Sort filtered logs based on criteria:
If limit/offset specified:
offset logslimit logsFor each log, load type's retention policy:
types/{log_type}/retention-config.jsonExecute scripts/format-output.sh {format} {logs_json}:
Table format:
TYPE TITLE STATUS DATE AGE
────────────────────────────────────────────────────────────────────────
session Fix authentication bug active 2025-11-16 Today
test Unit test execution failed 2025-11-15 1 day
build Production build v2.1.0 completed 2025-11-14 2 days
deployment Deploy to staging completed 2025-11-14 2 days
Total: 4 logs (filtered from 47)
JSON format:
{
"logs": [
{
"path": ".fractary/logs/session/session-001.md",
"log_type": "session",
"title": "Fix authentication bug",
"log_id": "session-001",
"status": "active",
"date": "2025-11-16T10:30:00Z",
"age_days": 0,
"retention": {
"expires_at": "2025-11-23T10:30:00Z",
"days_until_expiry": 7,
"status": "active"
}
}
],
"metadata": {
"total": 4,
"filtered_from": 47,
"limit": 50,
"offset": 0,
"has_more": false
}
}
Summary format:
Log Summary
───────────────────────────────────────
Total logs: 47
By type:
- session: 12 logs (3 active, 9 archived)
- build: 15 logs (0 active, 15 archived)
- test: 8 logs (1 failed, 7 completed)
- deployment: 6 logs (6 completed)
- debug: 3 logs (1 active, 2 archived)
- audit: 2 logs (2 completed)
- operational: 1 log (1 completed)
By status:
- active: 5
- completed: 37
- failed: 2
- archived: 3
Retention:
- Expiring soon (< 7 days): 8
- Active: 35
- Expired: 4
Detailed format: Shows full frontmatter + first 3 lines of body for each log </WORKFLOW>
<COMPLETION_CRITERIA> ✅ All log files discovered in requested types ✅ Frontmatter parsed for all valid logs ✅ Filters applied correctly ✅ Results sorted by requested criteria ✅ Output formatted in requested format ✅ Pagination metadata included (if applicable) </COMPLETION_CRITERIA>
<OUTPUTS> Return to caller: ``` 🎯 STARTING: Log Lister Filters: log_type={type}, status={status}, limit={limit} Format: {format} ───────────────────────────────────────📁 Discovering logs in .fractary/logs/ Found: 47 logs across 7 types
🔍 Applying filters:
Matched: 4 logs
[Formatted output here]
✅ COMPLETED: Log Lister Listed: 4 logs (filtered from 47) Types: session (2), test (2) ─────────────────────────────────────── Next: Use log-validator to check specific log, or log-archiver to archive old logs
</OUTPUTS>
<DOCUMENTATION>
Write to execution log:
- Operation: list-logs
- Filters applied: {filters}
- Total logs found: {total}
- Logs returned: {count}
- Format: {format}
- Timestamp: ISO 8601
</DOCUMENTATION>
<ERROR_HANDLING>
**No logs directory:**
⚠️ WARNING: Logs directory not found Path: .fractary/logs/ No logs to list. Use log-writer to create logs first.
**No logs match filters:**
ℹ️ INFO: No logs match the specified filters Filters: log_type={type}, status={status} Total logs available: {total} Suggestion: Try broader filters or check log types with "list-logs --all"
**Malformed frontmatter (non-fatal):**
⚠️ WARNING: Skipping log with malformed frontmatter Path: {log_path} Error: {parse error} Continuing with remaining logs...
**Invalid log type filter:**
❌ ERROR: Unknown log type '{type}' Valid types: session, build, deployment, debug, test, audit, operational, _untyped, all
</ERROR_HANDLING>
## Scripts
This skill uses two supporting scripts:
1. **`scripts/discover-logs.sh {log_type_filter} {status_filter} {date_from} {date_to}`**
- Discovers all log files matching filters
- Parses frontmatter for filtering
- Returns JSON array of log metadata
- Handles malformed logs gracefully
2. **`scripts/format-output.sh {format} {logs_json}`**
- Formats log list in requested format
- Supports table, json, summary, detailed
- Adds retention information
- Calculates relative dates (age)