-
Notifications
You must be signed in to change notification settings - Fork 0
Feature Enhanced Logging Tasks
Rick Hightower edited this page Jan 28, 2026
·
1 revision
Feature ID: CRD-001
Spec: .speckit/features/enhanced-logging/spec.md
Plan: .speckit/features/enhanced-logging/plan.md
Status: Complete
Implemented: 2026-01-22 (commit b9faa44)
- Add
EventDetailsenum with tagged variants- Bash variant with
commandfield - Write variant with
file_pathfield - Edit variant with
file_pathfield - Read variant with
file_pathfield - Glob variant with
patternandpathfields - Grep variant with
patternandpathfields - Session variant with
source,reason,transcript_path,cwdfields - Permission variant with
permission_modeand boxedtool_details - Unknown variant with
tool_namefield
- Bash variant with
- Add
ResponseSummarystruct withcontinue(serde-renamed fromcontinue_),reason,context_length - Add
RuleEvaluationstruct withrule_name,matched,matcher_results - Add
MatcherResultsstruct with individual matcher result fields - Add
DebugConfigstruct withenabledflag - Extend
LogEntrywith 4 new optional fields-
event_details: Option<EventDetails> -
response: Option<ResponseSummary> -
raw_event: Option<serde_json::Value>(debug mode only) -
rule_evaluations: Option<Vec<RuleEvaluation>>(debug mode only)
-
- Add
#[serde(skip_serializing_if = "Option::is_none")]for backward compatibility
- Implement
EventDetails::extract()method - Handle Bash events (extract
commandfrom tool_input) - Handle Write events (extract
file_pathorfilePathfrom tool_input) - Handle Edit events (extract
file_pathorfilePathfrom tool_input) - Handle Read events (extract
file_pathorfilePathfrom tool_input) - Handle Glob events (extract
patternandpathfrom tool_input) - Handle Grep events (extract
patternandpathfrom tool_input) - Handle Session events (SessionStart/SessionEnd with source, reason, etc.)
- Implement Unknown fallback for unrecognized tools
- Implement
ResponseSummary::from_response()method - Implement
DebugConfig::new()constructor
- Modify
process_event()signature to accept&DebugConfig - Build
EventDetailsfrom incoming event usingEventDetails::extract() - Build
ResponseSummaryfrom outgoing response usingResponseSummary::from_response() - Conditionally include
raw_eventwhen debug mode enabled - Conditionally include
rule_evaluationswhen debug mode enabled - Modify
evaluate_rules()to returnVec<RuleEvaluation> - Implement
matches_rule_with_debug()function for debug tracking - Track individual matcher results (
tools_matched,extensions_matched, etc.) - Update
LogEntryconstruction with all new fields
- Add
debug_logs: boolfield toSettingsstruct - Add
default_debug_logs()function returningfalse - Update
Settings::default()to includedebug_logs
- Add
--debug-logsglobal CLI flag using clap - Load config to access
settings.debug_logs - Build
DebugConfigfrom CLI flag and config setting - Pass
DebugConfigtoprocess_event()
- Support
CCH_DEBUG_LOGSenvironment variable inDebugConfig::new()
- Test
EventDetails::extract()for Bash events - Test
EventDetails::extract()for Write events (bothfile_pathandfilePath) - Test
EventDetails::extract()for Edit events - Test
EventDetails::extract()for Read events - Test
EventDetails::extract()for Glob events - Test
EventDetails::extract()for Grep events - Test
EventDetails::extract()for Session events - Test
EventDetails::extract()for Unknown tools - Test
ResponseSummary::from_response() - Test
DebugConfig::new()with various flag combinations
- Test normal mode log structure contains
event_detailsandresponse - Test debug mode log contains
raw_eventandrule_evaluations - Test
--debug-logsCLI flag enables debug mode - Test
CCH_DEBUG_LOGS=1environment variable enables debug mode - Test
settings.debug_logs: trueconfig enables debug mode
- Update
docs/USER_GUIDE_CLI.mdwith new log format - Update
docs/USER_GUIDE_CLI.mdwith--debug-logsflag documentation - Update spec acceptance criteria for US5 (log troubleshooting)
| Phase | Status | Tasks | Completed |
|---|---|---|---|
| Phase 1: Data Structures | Complete | 20 | 20 |
| Phase 2: Event Extraction | Complete | 11 | 11 |
| Phase 3: Hook Integration | Complete | 9 | 9 |
| Phase 4: Debug Mode Plumbing | Complete | 7 | 7 |
| Phase 5: Testing | Partial | 15 | 10 |
| Phase 6: Documentation | Deferred | 3 | 0 |
| Total | 87% | 65 | 57 |
This tasks.md was backfilled after implementation to realign with SDD workflow.
Implementation Commit: b9faa44 feat(crd-001): Implement enhanced logging with EventDetails, ResponseSummary, and debug mode
Key Implementation Details:
- All new structs added to
models.rs(lines 460-689) - LogEntry extended with 4 new fields (lines 411-426)
-
matches_rule_with_debug()added tohooks.rs(lines 198-296) -
process_event()now accepts&DebugConfigparameter - Debug mode supported via CLI flag, environment variable, and config setting