fix: Claude Code 2.1.1 compatibility + log-level audit + path validation fixes (#614)

* Refactor CLAUDE.md and related files for December 2025 updates

- Updated CLAUDE.md in src/services/worker with new entries for December 2025, including changes to Search.ts, GeminiAgent.ts, SDKAgent.ts, and SessionManager.ts.
- Revised CLAUDE.md in src/shared to reflect updates and new entries for December 2025, including paths.ts and worker-utils.ts.
- Modified hook-constants.ts to clarify exit codes and their behaviors.
- Added comprehensive hooks reference documentation for Claude Code, detailing usage, events, and examples.
- Created initial CLAUDE.md files in various directories to track recent activity.

* fix: Merge user-message-hook output into context-hook hookSpecificOutput

- Add footer message to additionalContext in context-hook.ts
- Remove user-message-hook from SessionStart hooks array
- Fixes issue where stderr+exit(1) approach was silently discarded

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

* Update logs and documentation for recent plugin and worker service changes

- Added detailed logs for worker service activities from Dec 10, 2025 to Jan 7, 2026, including initialization patterns, cleanup confirmations, and diagnostic logging.
- Updated plugin documentation with recent activities, including plugin synchronization and configuration changes from Dec 3, 2025 to Jan 7, 2026.
- Enhanced the context hook and worker service logs to reflect improvements and fixes in the plugin architecture.
- Documented the migration and verification processes for the Claude memory system and its integration with the marketplace.

* Refactor hooks architecture and remove deprecated user-message-hook

- Updated hook configurations in CLAUDE.md and hooks.json to reflect changes in session start behavior.
- Removed user-message-hook functionality as it is no longer utilized in Claude Code 2.1.0; context is now injected silently.
- Enhanced context-hook to handle session context injection without user-visible messages.
- Cleaned up documentation across multiple files to align with the new hook structure and removed references to obsolete hooks.
- Adjusted timing and command execution for hooks to improve performance and reliability.

* fix: Address PR #610 review issues

- Replace USER_MESSAGE_ONLY test with BLOCKING_ERROR test in hook-constants.test.ts
- Standardize Claude Code 2.1.0 note wording across all three documentation files
- Exclude deprecated user-message-hook.ts from logger-usage-standards test

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

* fix: Remove hardcoded fake token counts from context injection

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

* Address PR #610 review issues by fixing test files, standardizing documentation notes, and verifying code quality improvements.

* fix: Add path validation to CLAUDE.md distribution to prevent invalid directory creation

- Add isValidPathForClaudeMd() function to reject invalid paths:
  - Tilde paths (~) that Node.js doesn't expand
  - URLs (http://, https://)
  - Paths with spaces (likely command text or PR references)
  - Paths with # (GitHub issue/PR references)
  - Relative paths that escape project boundary

- Integrate validation in updateFolderClaudeMdFiles loop
- Add 6 unit tests for path validation
- Update .gitignore to prevent accidental commit of malformed directories
- Clean up existing invalid directories (~/, PR #610..., git diff..., https:)

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

* fix: Implement path validation in CLAUDE.md generation to prevent invalid directory creation

- Added `isValidPathForClaudeMd()` function to validate file paths in `src/utils/claude-md-utils.ts`.
- Integrated path validation in `updateFolderClaudeMdFiles` to skip invalid paths.
- Added 6 new unit tests in `tests/utils/claude-md-utils.test.ts` to cover various rejection cases.
- Updated `.gitignore` to prevent tracking of invalid directories.
- Cleaned up existing invalid directories in the repository.

* feat: Promote critical WARN logs to ERROR level across codebase

Comprehensive log-level audit promoting 38+ WARN messages to ERROR for
improved debugging and incident response:

- Parser: observation type errors, data contamination
- SDK/Agents: empty init responses (Gemini, OpenRouter)
- Worker/Queue: session recovery, auto-recovery failures
- Chroma: sync failures, search failures (now treated as critical)
- SQLite: search failures (primary data store)
- Session/Generator: failures, missing context
- Infrastructure: shutdown, process management failures
- File Operations: CLAUDE.md updates, config reads
- Branch Management: recovery checkout failures

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

* fix: Address PR #614 review issues

- Remove incorrectly tracked tilde-prefixed files from git
- Fix absolute path validation to check projectRoot boundaries
- Add test coverage for absolute path validation edge cases

Closes review issues:
- Issue 1: ~/ prefixed files removed from tracking
- Issue 3: Absolute paths now validated against projectRoot
- Issue 4: Added 3 new test cases for absolute path scenarios

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

* build assets and context

---------

Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
Alex Newman
2026-01-07 23:34:20 -05:00
committed by GitHub
parent 687146ce53
commit 2659ec3231
98 changed files with 8927 additions and 3554 deletions
+36 -114
View File
@@ -3,125 +3,47 @@
<!-- This section is auto-generated by claude-mem. Edit content outside the tags. -->
### Jan 3, 2026
**Search.ts**
| ID | Time | T | Title | Read |
|----|------|---|-------|------|
| #36670 | 11:37 PM | ✅ | Resolved merge conflicts by accepting branch changes for 39 files | ~435 |
**GeminiAgent.ts**
| ID | Time | T | Title | Read |
|----|------|---|-------|------|
| #36637 | 10:47 PM | 🟣 | GeminiAgent Analysis Agent Running But Timed Out After 120 Seconds | ~521 |
| #36620 | 10:43 PM | 🔵 | GeminiAgent Implementation Uses Refactored Session ID Properties | ~508 |
| #36213 | 7:28 PM | 🔄 | Refactored GeminiAgent to Use Shared Utilities | ~596 |
**SDKAgent.ts**
| ID | Time | T | Title | Read |
|----|------|---|-------|------|
| #36625 | 10:44 PM | 🔵 | Documentation and Code Reveal Placeholder Detection Pattern | ~583 |
| #36331 | 8:26 PM | 🔵 | SDKAgent Message Processing Flow | ~366 |
| #36212 | 7:27 PM | 🔄 | Refactored SDKAgent to Use Shared ResponseProcessor | ~616 |
**TimelineService.ts**
| ID | Time | T | Title | Read |
|----|------|---|-------|------|
| #36523 | 9:34 PM | 🔴 | Fixed TypeScript Type Import Issues in Worker Services | ~386 |
| #36519 | " | 🔴 | Fixed Type Import Issues Preventing Worker Tests | ~308 |
| #36516 | 9:33 PM | 🔴 | Fixed TypeScript Type Import Issues in Worker Search Modules | ~377 |
**SessionManager.ts**
| ID | Time | T | Title | Read |
|----|------|---|-------|------|
| #36346 | 8:30 PM | 🔄 | Removed pendingProcessingIds Tracking from Message Iterator | ~306 |
| #36345 | " | 🔄 | Removed pendingProcessingIds Initialization in SessionManager | ~281 |
| #36340 | 8:28 PM | 🔵 | Complete Duplicate Bug Analysis via Explore Agent | ~435 |
| #36333 | 8:27 PM | 🔵 | pendingProcessingIds Tracking Across System | ~357 |
| #36314 | 8:25 PM | 🔵 | Message Queue Processing Duplicate Bug Investigation | ~316 |
**SearchManager.ts**
| ID | Time | T | Title | Read |
|----|------|---|-------|------|
| #36323 | 8:25 PM | 🔵 | Message Queue Architecture Scope Expanded | ~302 |
**OpenRouterAgent.ts**
| ID | Time | T | Title | Read |
|----|------|---|-------|------|
| #36214 | 7:30 PM | 🔄 | Refactored OpenRouterAgent to Use Shared Utilities | ~703 |
### Jan 4, 2026
**README.md**
| ID | Time | T | Title | Read |
|----|------|---|-------|------|
| #36942 | 2:43 AM | 🔵 | Recent Context Feature Architecture | ~300 |
**GeminiAgent.ts**
| ID | Time | T | Title | Read |
|----|------|---|-------|------|
| #36924 | 2:25 AM | ✅ | Merged fix/pr-538-followups branch into main with comprehensive updates | ~481 |
| #36914 | 2:24 AM | 🔵 | Recent commit 4d0a10c fixed multiple GitHub issues | ~365 |
| #36845 | 1:44 AM | 🔵 | GeminiAgent Model Configuration and Rate Limiting | ~527 |
| #36829 | 1:40 AM | 🔵 | PR #542 Review Analysis - Multi-Issue Fix Validation | ~562 |
| #36827 | 1:03 AM | ✅ | Branch diff shows 1,293 insertions and 98 deletions across 15 files | ~464 |
| #36790 | 12:49 AM | 🟣 | GitHub Issue #511 Completed - gemini-3-flash Model Support Added | ~482 |
| #36788 | " | 🟣 | Verified gemini-3-flash Three-Location Synchronization | ~331 |
| #36787 | 12:48 AM | 🟣 | Completed gemini-3-flash Support with Runtime Validation | ~382 |
| #36786 | " | 🟣 | Added gemini-3-flash Rate Limit to GEMINI_RPM_LIMITS | ~359 |
| #36785 | " | 🟣 | Added gemini-3-flash Model to GeminiModel Type Union | ~344 |
| #36784 | 12:47 AM | 🔵 | Current Gemini Model Support in GeminiAgent | ~428 |
| #36781 | 12:45 AM | 🔵 | Complete GeminiAgent Model Configuration Gap Analysis | ~552 |
| #36778 | 12:44 AM | 🔵 | GeminiAgent Model Type and RPM Limits Definition | ~395 |
| #36761 | 12:36 AM | ✅ | Created Implementation Plans for Four GitHub Issues | ~507 |
| #36757 | 12:33 AM | 🔵 | Issue #511 Root Cause Identified - Gemini-3-Flash Configuration Mismatch | ~416 |
| #36753 | " | 🔵 | GeminiAgent Implementation Details Examined | ~361 |
**SessionManager.ts**
| ID | Time | T | Title | Read |
|----|------|---|-------|------|
| #36730 | 12:26 AM | ⚖️ | Revised Memory Leak Fix Strategy for Issue #532 | ~412 |
| #36714 | 12:12 AM | 🔵 | Memory Leak Analysis Report for Issue #532 Generated | ~531 |
| #36712 | 12:11 AM | 🔵 | Memory Leak Analysis for Issue #532 Documented | ~646 |
**SDKAgent.ts**
| ID | Time | T | Title | Read |
|----|------|---|-------|------|
| #36716 | 12:13 AM | 🔵 | Issue #514 Orphaned .jsonl Session Files Analysis | ~616 |
| #36713 | 12:11 AM | 🔵 | Issue #520 Stuck Messages Already Resolved | ~569 |
### Jan 5, 2026
**SearchManager.ts**
| ID | Time | T | Title | Read |
|----|------|---|-------|------|
| #38080 | 9:55 PM | 🔴 | Critical Date Preservation Fix for Folder CLAUDE.md Timeline Accuracy | ~534 |
| #38036 | 9:43 PM | 🟣 | Configurable Observation Limits and Enhanced Folder Search | ~418 |
| #37979 | 8:33 PM | 🔴 | Fixed date parsing to use API date headers instead of "today" | ~315 |
| #37978 | " | 🔵 | Regenerated CLAUDE.md files across entire repository | ~268 |
| #37970 | 8:31 PM | 🔴 | Fixed Date Parsing Bug in By-File API Endpoint | ~402 |
| #37654 | 5:51 PM | 🔵 | SearchManager imports logger as foundational dependency for search operations | ~358 |
| #37751 | 6:21 PM | 🔴 | OpenRouterAgent Fully Updated with projectRoot Threading | ~307 |
| #37748 | " | | OpenRouterAgent Observation Handler Updated with lastCwd | ~276 |
| #37746 | 6:20 PM | | GeminiAgent Summary Handler Updated with lastCwd | ~278 |
| #37745 | " | | OpenRouterAgent Init Prompt Call Updated with undefined projectRoot | ~299 |
| #37744 | " | | GeminiAgent First processAgentResponse Updated with lastCwd | ~274 |
| #37743 | " | | Added lastCwd Tracking to OpenRouterAgent | ~265 |
| #37742 | 6:19 PM | ✅ | Phase 3 Started: Added lastCwd Tracking to GeminiAgent | ~291 |
| #37741 | " | 🔵 | OpenRouterAgent Structure Analyzed for Phase 3 Implementation | ~367 |
| #37740 | " | 🔵 | SDKAgent Structure Analyzed for Phase 3 Implementation | ~430 |
| #37739 | 6:18 PM | 🔵 | GeminiAgent Structure Analyzed for Phase 3 Implementation | ~381 |
| #37737 | 6:16 PM | 🔵 | Identified processAgentResponse Callers for Phase 3 | ~275 |
| #37701 | 6:01 PM | 🔵 | Complete cwd data flow traced from hooks through observation processing | ~447 |
| #37421 | 1:06 AM | 🔵 | Identified by-file API endpoint usage across codebase | ~406 |
| #37416 | 1:02 AM | 🔴 | Fixed find_by_file Parameter Handling for Comma-Separated Values | ~375 |
| #37415 | " | 🟣 | SearchManager Parameter Normalization Enhanced for Folder Queries | ~406 |
| #37414 | 1:01 AM | 🔵 | SearchManager findByFile Uses filePath Parameter for File Search | ~429 |
| #37413 | " | 🔵 | Hybrid Search Strategy: Metadata-First with Semantic Ranking | ~475 |
| #37391 | 12:48 AM | ✅ | Staged 23 CLAUDE.md files with mix of new and modified content | ~400 |
| #37390 | 12:47 AM | ✅ | Regenerated 23 CLAUDE.md files in budapest workspace | ~365 |
### Jan 7, 2026
**SettingsManager.ts**
| ID | Time | T | Title | Read |
|----|------|---|-------|------|
| #37665 | 5:52 PM | 🔵 | Codebase uses dependency injection and lazy initialization patterns to avoid circular dependencies | ~548 |
**DatabaseManager.ts**
| ID | Time | T | Title | Read |
|----|------|---|-------|------|
| #37653 | 5:50 PM | 🔵 | DatabaseManager imports logger demonstrating widespread logger dependency | ~363 |
**SessionManager.ts**
| ID | Time | T | Title | Read |
|----|------|---|-------|------|
| #37626 | 5:35 PM | 🔵 | FormatTool Function Usage Across Codebase | ~493 |
| #37538 | 4:45 PM | 🔵 | SessionManager formatTool Call Occurs After Database Persistence | ~351 |
### Jan 6, 2026
**BranchManager.ts**
| ID | Time | T | Title | Read |
|----|------|---|-------|------|
| #38105 | 12:14 AM | 🔵 | Windows Console Popup Flash Issue Documented and Fixed | ~455 |
| #38467 | 10:29 PM | ⚖️ | Log Level Audit Strategy: Tighten ERROR Messages for Runtime Issue Discovery | ~464 |
| #38437 | 10:24 PM | 🔵 | Claude-mem core functionality and logging patterns identified | ~710 |
| #38433 | " | 🔵 | SessionManager Uses ERROR Logging for Database Persistence Failures | ~503 |
| #38431 | " | 🔵 | ERROR-Level Logging Used Across 21 Source Files | ~480 |
| #38425 | " | ⚖️ | Log Level Architecture: Fail-Critical Over Fail-Fast for Chroma | ~467 |
| #38418 | 10:22 PM | 🔵 | ChromaDB Operates as Optional Subsystem with Graceful Degradation | ~586 |
| #38416 | " | 🔵 | ChromaDB Is Critical Not Optional - Log Audit Findings Challenged | ~405 |
| #38405 | 10:07 PM | ⚖️ | DEBUG Log Level Analysis - One Message Requires WARN Promotion | ~819 |
| #38404 | 10:06 PM | ⚖️ | Log Level Audit Analysis - WARN to ERROR Promotion Criteria Established | ~769 |
| #38372 | 9:43 PM | 🔵 | Logging Anti-Pattern Found: Critical Errors Logged as DEBUG Instead of ERROR | ~464 |
| #38354 | 9:10 PM | 🔵 | Provider Selection Architecture and Default Settings Location | ~478 |
| #38353 | " | 🔵 | Session ID Architecture and Message Yielding for SDK Interaction | ~536 |
| #38253 | 7:47 PM | 🔵 | SDK Agent Implementation with Resume Logic | ~1036 |
| #38250 | 7:46 PM | 🔵 | Session Manager Event-Driven Architecture | ~865 |
| #38248 | 7:45 PM | 🔵 | OpenRouter Agent Implementation | ~851 |
</claude-mem-context>