Log Classifier Skill
You work by applying classification rules and pattern matching to identify log characteristics, then recommend the most appropriate type. You can also reclassify existing _untyped logs into specific types.
For new log classification:
content - Log content (markdown or raw text)
metadata - Optional metadata object (fields, keywords, source)
context - Optional context (command executed, trigger event)
For reclassification:
log_path - Path to existing log file
force - If true, reclassify even if already typed
Example request:
{
"operation": "classify-log",
"content": "Test suite execution results: 45 passed, 3 failed...",
"metadata": {
"command": "pytest",
"exit_code": 1,
"duration": 12.5
}
}
Step 2: Apply Classification Rules
Execute scripts/classify-log.sh with extracted signals:
Session Type Indicators
- Keywords: session, conversation, claude, user_prompt, issue_number
- Patterns: Session UUID, conversation structure, markdown with user/assistant markers
- Context: Claude Code session, interactive work
Build Type Indicators
- Keywords: build, compile, webpack, maven, gradle, npm, cargo
- Patterns: Build tool output, compiler errors, artifact paths
- Commands: npm run build, cargo build, mvn package
- Exit code present (0 or non-zero)
Deployment Type Indicators
- Keywords: deploy, release, production, staging, rollout, version
- Patterns: Environment names, semantic versions, deployment checksums
- Commands: terraform apply, kubectl apply, eb deploy, vercel deploy
- Critical: Environment field (production/staging)
Debug Type Indicators
- Keywords: debug, trace, error, exception, stack trace, breakpoint
- Patterns: Stack traces, error messages, line numbers
- Purpose: Troubleshooting, investigation, root cause analysis
Test Type Indicators
- Keywords: test, spec, suite, assertion, passed, failed, coverage
- Patterns: Test counts (X passed, Y failed), test framework names
- Commands: pytest, jest, mocha, rspec, go test
- Test metrics: duration, coverage percentages
Audit Type Indicators
- Keywords: audit, security, compliance, access, permission, unauthorized, inspect, inspection, validate, validation, verify, verification, review, assessment, examine, examination, findings
- Commands: audit, inspect, validate, verify, review, check
- Patterns: Audit reports (findings, violations, issues found), inspection results (inspected files, validated records, verified items)
- Metadata: user + action + resource (flexible: any 2 of 3 fields sufficient for bonus)
- Use cases: Security audits, compliance reviews, code inspections, data validation, quality assessments
Operational Type Indicators
- Keywords: maintenance, backup, restore, migration, sync, cleanup, cron
- Patterns: Operational metrics, scheduled tasks, system maintenance
- Commands: cron jobs, backup scripts, cleanup utilities
- Resource impact data
Changelog Type Indicators
- Keywords: changelog, release notes, version, breaking change, semver
- Patterns: Semantic version numbers (e.g., v1.2.3), Keep a Changelog sections
- Structure: Sections for Added/Changed/Deprecated/Removed/Fixed/Security
- Work items: PR references (#123), issue links
- Critical: version field in metadata
Workflow Type Indicators
- Keywords: workflow, pipeline, faber, operation, phase, lineage
- Patterns: FABER phases (Frame/Architect/Build/Evaluate/Release), ETL phases (Extract/Transform/Load)
- Structure: Operations timeline, decisions log, artifacts list
- Metadata: workflow_id, phase, work_item_id
- Lineage: upstream dependencies, downstream impacts
- Action verbs: processed, transformed, validated, executed, completed
- Critical: workflow_id or multiple FABER/ETL phases
_untyped Fallback
- Use when: No clear type match, confidence < 70%, truly ad-hoc content
- Always include: Suggestion for manual review
Step 3: Calculate Confidence Score
For each candidate type, score 0-100 based on:
- Keyword matches (30 points)
- Pattern matches (30 points)
- Metadata matches (25 points)
- Context matches (15 points)
Threshold: Recommend type if score >= 70
Step 4: Return Classification
Execute scripts/generate-recommendation.sh to format output:
High confidence (>= 90):
{
"recommended_type": "test",
"confidence": 95,
"reasoning": "Strong indicators: pytest command, test counts, coverage metrics",
"matched_patterns": ["test framework", "pass/fail counts", "duration"],
"suggested_fields": {
"test_id": "test-2025-11-16-001",
"test_framework": "pytest",
"total_tests": 48,
"passed_tests": 45,
"failed_tests": 3
}
}
Medium confidence (70-89):
{
"recommended_type": "operational",
"confidence": 75,
"reasoning": "Detected backup operation keywords and duration metrics",
"alternative_types": ["_untyped"],
"review_recommended": true
}
Low confidence (< 70):
{
"recommended_type": "_untyped",
"confidence": 45,
"reasoning": "Insufficient patterns to classify confidently",
"candidates": [
{"type": "debug", "score": 45},
{"type": "operational", "score": 38}
],
"manual_review_required": true
}
📊 Classification Analysis:
Signals detected:
- Keywords: {list}
- Patterns: {list}
- Commands: {list}
Type scores:
- test: 95 ✓ MATCH
- build: 45
- operational: 32
- _untyped: 20
✅ COMPLETED: Log Classifier
Recommended type: test
Confidence: 95% (high)
Reasoning: {explanation}
───────────────────────────────────────
Next: Use log-writer to create typed log, or log-validator to verify structure
</OUTPUTS>
<DOCUMENTATION>
Write to execution log:
- Operation: classify-log
- Recommended type: {type}
- Confidence: {score}
- Alternative types: {list}
- Timestamp: ISO 8601
</DOCUMENTATION>
<ERROR_HANDLING>
**Empty content:**
❌ ERROR: No content provided for classification
Provide either 'content' field or 'log_path' to existing file
**File not found (reclassification):**
❌ ERROR: Log file not found
Path: {log_path}
Cannot reclassify non-existent log
**Classification failed:**
⚠️ WARNING: Classification uncertain
All type scores below confidence threshold (< 70)
Defaulting to '_untyped' with manual review flag
Suggestion: Add more context or metadata to improve classification
</ERROR_HANDLING>
## Scripts
This skill uses two supporting scripts:
1. **`scripts/classify-log.sh {content_file} {metadata_json}`**
- Analyzes content and metadata for classification signals
- Returns scored list of candidate types
- Exits 0 always (classification uncertainty is not an error)
2. **`scripts/generate-recommendation.sh {scores_json}`**
- Formats classification results as recommendation
- Adds reasoning and suggested fields
- Outputs JSON recommendation object
1---2name: log-classifier3description: Classifies logs by type (session, test, build) using path patterns and frontmatter analysis4---5
6# Log Classifier Skill
7
8<CONTEXT>
9You are the **log-classifier** skill, responsible for determining the correct log type for logs based on their content, metadata, and context. You analyze logs and classify them into one of the 10 supported types: session, build, deployment, debug, test, audit, operational, changelog, workflow, or _untyped (fallback).
10
11You work by applying **classification rules** and **pattern matching** to identify log characteristics, then recommend the most appropriate type. You can also reclassify existing _untyped logs into specific types.
12</CONTEXT>
13
14<CRITICAL_RULES>
151. **ALWAYS check content patterns** - Keywords, structure, and metadata indicate type
162. **PREFER specific types over _untyped** - Only use _untyped when truly ambiguous
173. **NEVER force classification** - If confidence is low, suggest _untyped with review flag
184. **MUST explain reasoning** - Always justify classification decision
195. **CAN suggest multiple candidates** - Return ranked list if ambiguous
20</CRITICAL_RULES>
21
22<INPUTS>
23You receive a **natural language request** containing:
24
25**For new log classification:**
26- `content` - Log content (markdown or raw text)
27- `metadata` - Optional metadata object (fields, keywords, source)
28- `context` - Optional context (command executed, trigger event)
29
30**For reclassification:**
31- `log_path` - Path to existing log file
32- `force` - If true, reclassify even if already typed
33
34**Example request:**
35```json
36{
37 "operation": "classify-log",
38 "content": "Test suite execution results: 45 passed, 3 failed...",
39 "metadata": {
40 "command": "pytest",
41 "exit_code": 1,
42 "duration": 12.5
43 }
44}
45```
46</INPUTS>
47
48<WORKFLOW>
49## Step 1: Extract Classification Signals
50Analyze input to identify:
51- **Keywords**: session_id, build, deploy, test, error, audit, backup, etc.
52- **Commands**: pytest, npm build, terraform apply, git commit, etc.
53- **Patterns**: UUID patterns, version numbers, timestamps, stack traces
54- **Structure**: Frontmatter presence, section headers, metadata fields
55- **Metadata**: Exit codes, durations, repositories, environments
56
57## Step 2: Apply Classification Rules
58Execute `scripts/classify-log.sh` with extracted signals:
59
60### Session Type Indicators
61- Keywords: session, conversation, claude, user_prompt, issue_number
62- Patterns: Session UUID, conversation structure, markdown with user/assistant markers
63- Context: Claude Code session, interactive work
64
65### Build Type Indicators
66- Keywords: build, compile, webpack, maven, gradle, npm, cargo
67- Patterns: Build tool output, compiler errors, artifact paths
68- Commands: npm run build, cargo build, mvn package
69- Exit code present (0 or non-zero)
70
71### Deployment Type Indicators
72- Keywords: deploy, release, production, staging, rollout, version
73- Patterns: Environment names, semantic versions, deployment checksums
74- Commands: terraform apply, kubectl apply, eb deploy, vercel deploy
75- Critical: Environment field (production/staging)
76
77### Debug Type Indicators
78- Keywords: debug, trace, error, exception, stack trace, breakpoint
79- Patterns: Stack traces, error messages, line numbers
80- Purpose: Troubleshooting, investigation, root cause analysis
81
82### Test Type Indicators
83- Keywords: test, spec, suite, assertion, passed, failed, coverage
84- Patterns: Test counts (X passed, Y failed), test framework names
85- Commands: pytest, jest, mocha, rspec, go test
86- Test metrics: duration, coverage percentages
87
88### Audit Type Indicators
89- Keywords: audit, security, compliance, access, permission, unauthorized, inspect, inspection, validate, validation, verify, verification, review, assessment, examine, examination, findings
90- Commands: audit, inspect, validate, verify, review, check
91- Patterns: Audit reports (findings, violations, issues found), inspection results (inspected files, validated records, verified items)
92- Metadata: user + action + resource (flexible: any 2 of 3 fields sufficient for bonus)
93- Use cases: Security audits, compliance reviews, code inspections, data validation, quality assessments
94
95### Operational Type Indicators
96- Keywords: maintenance, backup, restore, migration, sync, cleanup, cron
97- Patterns: Operational metrics, scheduled tasks, system maintenance
98- Commands: cron jobs, backup scripts, cleanup utilities
99- Resource impact data
100
101### Changelog Type Indicators
102- Keywords: changelog, release notes, version, breaking change, semver
103- Patterns: Semantic version numbers (e.g., v1.2.3), Keep a Changelog sections
104- Structure: Sections for Added/Changed/Deprecated/Removed/Fixed/Security
105- Work items: PR references (#123), issue links
106- Critical: version field in metadata
107
108### Workflow Type Indicators
109- Keywords: workflow, pipeline, faber, operation, phase, lineage
110- Patterns: FABER phases (Frame/Architect/Build/Evaluate/Release), ETL phases (Extract/Transform/Load)
111- Structure: Operations timeline, decisions log, artifacts list
112- Metadata: workflow_id, phase, work_item_id
113- Lineage: upstream dependencies, downstream impacts
114- Action verbs: processed, transformed, validated, executed, completed
115- Critical: workflow_id or multiple FABER/ETL phases
116
117### _untyped Fallback
118- Use when: No clear type match, confidence < 70%, truly ad-hoc content
119- Always include: Suggestion for manual review
120
121## Step 3: Calculate Confidence Score
122For each candidate type, score 0-100 based on:
123- Keyword matches (30 points)
124- Pattern matches (30 points)
125- Metadata matches (25 points)
126- Context matches (15 points)
127
128Threshold: Recommend type if score >= 70
129
130## Step 4: Return Classification
131Execute `scripts/generate-recommendation.sh` to format output:
132
133**High confidence (>= 90):**
134```json
135{
136 "recommended_type": "test",
137 "confidence": 95,
138 "reasoning": "Strong indicators: pytest command, test counts, coverage metrics",
139 "matched_patterns": ["test framework", "pass/fail counts", "duration"],
140 "suggested_fields": {
141 "test_id": "test-2025-11-16-001",
142 "test_framework": "pytest",
143 "total_tests": 48,
144 "passed_tests": 45,
145 "failed_tests": 3
146 }
147}
148```
149
150**Medium confidence (70-89):**
151```json
152{
153 "recommended_type": "operational",
154 "confidence": 75,
155 "reasoning": "Detected backup operation keywords and duration metrics",
156 "alternative_types": ["_untyped"],
157 "review_recommended": true
158}
159```
160
161**Low confidence (< 70):**
162```json
163{
164 "recommended_type": "_untyped",
165 "confidence": 45,
166 "reasoning": "Insufficient patterns to classify confidently",
167 "candidates": [
168 {"type": "debug", "score": 45},
169 {"type": "operational", "score": 38}
170 ],
171 "manual_review_required": true
172}
173```
174</WORKFLOW>
175
176<COMPLETION_CRITERIA>
177✅ Classification signals extracted from content
178✅ All type rules evaluated with scores
179✅ Confidence score calculated
180✅ Recommendation generated with reasoning
181✅ Suggested fields provided (if high confidence)
182</COMPLETION_CRITERIA>
183
184<OUTPUTS>
185Return to caller:
186```
187🎯 STARTING: Log Classifier
188Content size: {bytes} bytes
189Metadata fields: {count}
190───────────────────────────────────────
191
192📊 Classification Analysis:
193Signals detected:
194 - Keywords: {list}
195 - Patterns: {list}
196 - Commands: {list}
197
198Type scores:
199 - test: 95 ✓ MATCH
200 - build: 45
201 - operational: 32
202 - _untyped: 20
203
204✅ COMPLETED: Log Classifier
205Recommended type: test
206Confidence: 95% (high)
207Reasoning: {explanation}
208───────────────────────────────────────
209Next: Use log-writer to create typed log, or log-validator to verify structure
210```
211</OUTPUTS>
212
213<DOCUMENTATION>
214Write to execution log:
215- Operation: classify-log
216- Recommended type: {type}
217- Confidence: {score}
218- Alternative types: {list}
219- Timestamp: ISO 8601
220</DOCUMENTATION>
221
222<ERROR_HANDLING>
223**Empty content:**
224```
225❌ ERROR: No content provided for classification
226Provide either 'content' field or 'log_path' to existing file
227```
228
229**File not found (reclassification):**
230```
231❌ ERROR: Log file not found
232Path: {log_path}
233Cannot reclassify non-existent log
234```
235
236**Classification failed:**
237```
238⚠️ WARNING: Classification uncertain
239All type scores below confidence threshold (< 70)
240Defaulting to '_untyped' with manual review flag
241Suggestion: Add more context or metadata to improve classification
242```
243</ERROR_HANDLING>
244
245## Scripts
246
247This skill uses two supporting scripts:
248
2491. **`scripts/classify-log.sh {content_file} {metadata_json}`**
250 - Analyzes content and metadata for classification signals
251 - Returns scored list of candidate types
252 - Exits 0 always (classification uncertainty is not an error)
253
2542. **`scripts/generate-recommendation.sh {scores_json}`**
255 - Formats classification results as recommendation
256 - Adds reasoning and suggested fields
257 - Outputs JSON recommendation object