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
-26
View File
@@ -1,26 +0,0 @@
<claude-mem-context>
# Recent Activity
<!-- This section is auto-generated by claude-mem. Edit content outside the tags. -->
### Dec 3, 2025
**settings.json**
| ID | Time | T | Title | Read |
|----|------|---|-------|------|
| #19956 | 10:13 PM | 🔵 | No MCP Servers Currently Configured | ~230 |
### Dec 5, 2025
**settings.json**
| ID | Time | T | Title | Read |
|----|------|---|-------|------|
| #20295 | 6:07 PM | 🔵 | Claude Settings Configuration with Plugin Enablement | ~319 |
### Dec 31, 2025
**settings.json**
| ID | Time | T | Title | Read |
|----|------|---|-------|------|
| #34618 | 2:59 PM | 🔵 | Make-Plan and Do Skills Already Configured in Claude Settings | ~373 |
</claude-mem-context>
-157
View File
@@ -1,157 +0,0 @@
<claude-mem-context>
# Recent Activity
<!-- This section is auto-generated by claude-mem. Edit content outside the tags. -->
### Nov 30, 2025
**hidden-sniffing-nest.md**
| ID | Time | T | Title | Read |
|----|------|---|-------|------|
| #17674 | 6:01 PM | ⚖️ | Plan Mode Exited with Finalized Dual-Tag Implementation Strategy | ~692 |
| #17669 | 5:55 PM | ⚖️ | Implementation Plan Updated with User Requirements Clarification | ~735 |
| #17646 | 5:42 PM | ⚖️ | Implementation Plan Created for Dual-Tag System Feature Extraction | ~625 |
### Dec 5, 2025
**distributed-growing-wall-agent-648df112.md**
| ID | Time | T | Title | Read |
|----|------|---|-------|------|
| #20982 | 11:47 PM | 🔵 | Implementation Plan Retrieved: Nine-Phase Selective Hook Refactoring Strategy | ~487 |
| #20373 | 7:00 PM | ⚖️ | Implementation plan created for selective merge of hook refactoring | ~367 |
**distributed-growing-wall.md**
| ID | Time | T | Title | Read |
|----|------|---|-------|------|
| #20375 | 7:02 PM | ✅ | Simplified implementation plan created for primary session | ~346 |
### Dec 7, 2025
**staged-whistling-ember.md**
| ID | Time | T | Title | Read |
|----|------|---|-------|------|
| #21295 | 6:28 PM | ⚖️ | Phase 2 MCP DRY Architecture Plan Created | ~586 |
### Dec 9, 2025
**fancy-purring-horizon.md**
| ID | Time | T | Title | Read |
|----|------|---|-------|------|
| #23061 | 6:17 PM | 🔵 | Claude-Mem Hooks Cleanup Plan Structure Reviewed | ~400 |
### Dec 10, 2025
**abundant-purring-crystal.md**
| ID | Time | T | Title | Read |
|----|------|---|-------|------|
| #23712 | 8:56 PM | ⚖️ | PM2 Replacement Architecture: Bun-based Self-Executable Worker Service | ~825 |
### Dec 12, 2025
**abundant-purring-crystal.md**
| ID | Time | T | Title | Read |
|----|------|---|-------|------|
| #24402 | 8:10 PM | 🔵 | Retrieved PM2 Replacement Architecture Decision from Memory | ~476 |
**concurrent-snuggling-goblet.md**
| ID | Time | T | Title | Read |
|----|------|---|-------|------|
| #24284 | 5:31 PM | 🔵 | PM2 to Bun Migration Plan for Worker Process Management | ~414 |
| #24283 | 5:30 PM | ⚖️ | Six-phase implementation plan created to address PR #248 issues | ~652 |
| #24282 | 5:22 PM | ⚖️ | PR #248 review plan identifies six issues requiring fixes before merge | ~640 |
### Dec 13, 2025
**smooth-whistling-mccarthy.md**
| ID | Time | T | Title | Read |
|----|------|---|-------|------|
| #25444 | 10:02 PM | 🔵 | Error Message Quality Improvement Plan Loaded | ~371 |
### Dec 18, 2025
**indexed-jingling-pinwheel.md**
| ID | Time | T | Title | Read |
|----|------|---|-------|------|
| #29414 | 4:06 PM | 🔵 | Mode-based prompt customization plan has critical scope gaps | ~465 |
### Dec 19, 2025
**precious-bubbling-ember.md**
| ID | Time | T | Title | Read |
|----|------|---|-------|------|
| #30066 | 8:00 PM | 🔵 | RAGTIME Tool Blocking Prevents Observation Hook System | ~596 |
### Dec 20, 2025
**recursive-juggling-clover.md**
| ID | Time | T | Title | Read |
|----|------|---|-------|------|
| #30974 | 7:12 PM | 🔵 | Nonsense Audit Plan Review - Final Issue Remaining | ~375 |
| #30962 | 7:08 PM | 🔴 | Expanded logger.formatTool() to Handle All Tool Types | ~425 |
| #30960 | 7:07 PM | 🔵 | Issue 18 of 20 Identified in Nonsense Audit Plan | ~317 |
| #30935 | 6:56 PM | 🔄 | Removed Ceremonial Wrapper Function in Hook Response System | ~382 |
| #30925 | 6:53 PM | 🔴 | Removed Redundant Try-Catch from getWorkerPort() | ~360 |
| #30916 | 6:49 PM | ✅ | Phase 2 Major Cleanup Milestone Completed | ~364 |
| #30915 | " | 🔴 | SessionRoutes Catch-All Exception Masking Removed | ~345 |
| #30909 | 6:48 PM | 🔵 | Loaded Comprehensive Code Quality Audit Plan | ~402 |
| #30888 | 6:40 PM | ✅ | Phase 2 Progress Updated | ~306 |
| #30887 | " | 🔄 | Tag-Stripping DRY Violation Fixed | ~417 |
| #30881 | 6:37 PM | 🔴 | Eliminated Triple-Duplicated Date/Time Formatting Functions | ~366 |
| #30880 | " | 🔵 | Issue 8: Duplicate Date/Time Formatting Functions in SearchManager | ~214 |
| #30862 | 6:26 PM | 🔴 | Cleanup Hook Error Logging Added | ~297 |
| #30853 | 6:20 PM | 🔴 | Summary Hook Finally Block Error Propagation Fixed | ~323 |
| #30849 | 6:19 PM | 🔵 | Nonsense Audit Plan Identified - Issue 5 Summary Hook Error Masking | ~408 |
| #30842 | 6:18 PM | ✅ | Phase 1 Critical Fixes Marked Complete | ~449 |
| #30841 | 6:17 PM | 🔵 | Code Quality Remediation Plan Structure | ~406 |
| #32289 | 6:09 PM | 🔴 | Vector Search Failures Now Show Explicit Error Messages | ~267 |
**delightful-gliding-hinton.md**
| ID | Time | T | Title | Read |
|----|------|---|-------|------|
| #30519 | 4:48 PM | 🔵 | Plan file contains multi-phase deployment strategy | ~209 |
| #30514 | 4:46 PM | 🟣 | Sequential Phase Execution System for Plan Deployment | ~213 |
### Dec 28, 2025
**cozy-percolating-clover.md**
| ID | Time | T | Title | Read |
|----|------|---|-------|------|
| #33567 | 11:06 PM | 🔴 | Validation of Memory Session Append Bug Fix | ~251 |
**mellow-discovering-meerkat.md**
| ID | Time | T | Title | Read |
|----|------|---|-------|------|
| #33265 | 2:58 PM | 🟣 | Self-spawn pattern for background worker lifecycle management | ~446 |
| #33264 | " | 🟣 | Worker Lifecycle Management PR Created (PR #458) | ~432 |
### Dec 29, 2025
**sprightly-frolicking-tulip.md**
| ID | Time | T | Title | Read |
|----|------|---|-------|------|
| #34215 | 10:08 PM | 🔵 | Retrieved Detailed Cursor Integration Implementation History | ~676 |
| #34124 | 9:09 PM | 🔵 | Cursor Hooks Integration Branch Code Review Completed | ~571 |
| #34098 | 9:03 PM | 🔵 | Cursor Hooks Integration Branch Code Review Completed | ~413 |
| #34087 | 9:00 PM | 🔵 | Comprehensive code review plan for Cursor IDE hooks integration | ~449 |
### Dec 30, 2025
**lively-twirling-garden.md**
| ID | Time | T | Title | Read |
|----|------|---|-------|------|
| #34413 | 1:59 PM | 🔵 | Agent SDK V2 Upgrade Plan Reviewed | ~380 |
### Jan 4, 2026
**gentle-munching-wolf.md**
| ID | Time | T | Title | Read |
|----|------|---|-------|------|
| #36729 | 12:23 AM | ⚖️ | Implementation Plan Created for PR Review Follow-ups and Issue Fixes | ~673 |
### Jan 5, 2026
**rustling-crunching-thimble.md**
| ID | Time | T | Title | Read |
|----|------|---|-------|------|
| #38007 | 9:04 PM | ⚖️ | Created implementation plan for three PR review items | ~373 |
</claude-mem-context>