Skip to content

feat(conversation-memory): add file-based logging system - #420

Merged
baleen37 merged 1 commit into
mainfrom
fix/conversion-memory
Feb 5, 2026
Merged

feat(conversation-memory): add file-based logging system#420
baleen37 merged 1 commit into
mainfrom
fix/conversion-memory

Conversation

@baleen37

@baleen37 baleen37 commented Feb 5, 2026

Copy link
Copy Markdown
Owner

Summary

  • Add file-based logging system for debugging conversation-memory plugin
  • Logs stored in ~/.config/conversation-memory/logs/YYYY-MM-DD.log
  • Track API calls, token usage, summarization progress, and errors

Changes

  • logger.ts: New module with logInfo, logError, logWarn, logDebug functions
  • paths.ts: Added getLogDir() and getLogFilePath() functions
  • summarizer.ts: Log API calls, token usage, and summarization results
  • indexer.ts: Log errors during summary generation

Key Design Decision

logError() writes to file only (no stderr) to prevent error details from leaking into LLM context when run as a CLI tool. This addresses the concern that stderr output can be captured and included in the LLM's prompt.

Log Format

[2026-02-05T14:23:45.123Z] [INFO] API call started {"model":"haiku","apiUrl":"default","hasToken":false}
[2026-02-05T14:23:47.456Z] [INFO] Summarization completed (direct) {"filename":"...","wordCount":42,"inputTokens":1234,"outputTokens":56}

Test Plan

  • Run conversation-memory sync to verify logging works
  • Check log file created at ~/.config/conversation-memory/logs/
  • Verify errors are logged to file only (no stderr pollution)

🤖 Generated with Claude Code

Summary by CodeRabbit

  • New Features

    • Added comprehensive logging system for conversation memory operations with file-based storage and configurable debug mode.
    • Enhanced summarization workflow with detailed logging for API calls, chunk processing, and completion tracking.
  • Improvements

    • Improved error reporting with enhanced context and file traceability for better debugging and monitoring.

- Add logger.ts with logInfo, logError, logWarn, logDebug functions
- Log files stored in ~/.config/conversation-memory/logs/YYYY-MM-DD.log
- logError() writes to file only (no stderr) to prevent LLM context contamination
- Track API calls, token usage, summarization progress, and errors
- Add filename parameter to summarizeConversation() for better log context

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Feb 5, 2026

Copy link
Copy Markdown

Caution

Review failed

The pull request is closed.

📝 Walkthrough

Walkthrough

Adds structured file-based logging infrastructure to the conversation-memory plugin. Introduces a logger module with LogLevel enum and four logging functions (logInfo, logWarn, logError, logDebug). Updates indexer and summarizer to integrate logging, adds path utilities for log file management, and enhances summarizeConversation with a filename parameter for improved traceability.

Changes

Cohort / File(s) Summary
Logging Infrastructure
plugins/conversation-memory/src/core/logger.ts
New structured logger module with LogLevel enum, LogEntry interface, and four public logging functions (logInfo, logWarn, logError, logDebug). Supports file-based logging with timestamps, optional error serialization, and environment-gated debug logging. Includes internal helpers for formatting and file I/O.
Path Utilities
plugins/conversation-memory/src/core/paths.ts
Adds two utility functions: getLogDir() to ensure and return log directory under superpowers config path, and getLogFilePath() to build daily log file paths using YYYY-MM-DD format.
Indexer Integration
plugins/conversation-memory/src/core/indexer.ts
Integrates logging utilities and error reporting. Updates three summarizeConversation calls to pass filename/path context as third parameter for better traceability (in indexConversations, indexSession, and indexUnprocessed functions).
Summarizer Enhancements
plugins/conversation-memory/src/core/summarizer.ts
Adds filename parameter to summarizeConversation signature and integrates comprehensive logging throughout: API call lifecycle tracking, trivial conversation detection, chunk-level failure reporting, and hierarchical synthesis completion with token usage metrics.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~15 minutes

Possibly related PRs

Suggested labels

enhancement

Poem

🐰 Hop along, dear logs now flow,
Through paths and summarizers' glow,
Structured traces, file by file,
Debugging made worthwhile! 🌱

✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch fix/conversion-memory

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@baleen37
baleen37 merged commit ebaae1d into main Feb 5, 2026
4 of 5 checks passed
@baleen37
baleen37 deleted the fix/conversion-memory branch February 5, 2026 06:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant