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
+1 -121
View File
@@ -3,125 +3,5 @@
<!-- This section is auto-generated by claude-mem. Edit content outside the tags. -->
### Dec 21, 2025
**types.ts**
| ID | Time | T | Title | Read |
|----|------|---|-------|------|
| #31766 | 11:11 PM | 🟣 | Expansión de ModePrompts con campos de configuración granular | ~327 |
| #31765 | 11:10 PM | 🔵 | Sistema de configuración de modos con interfaces TypeScript | ~321 |
| #31764 | 11:09 PM | ⚖️ | Consulta arquitectónica con Gemini sobre reconstrucción completa de prompts por modos | ~469 |
| #31704 | 9:37 PM | 🔵 | Mode system architecture discovered in claude-mem | ~457 |
| #31428 | 6:56 PM | 🔵 | Domain Types Define Observation System Interfaces | ~292 |
**ModeManager.ts**
| ID | Time | T | Title | Read |
|----|------|---|-------|------|
| #31747 | 10:43 PM | 🔵 | PR #412 Code Review Identifies Two Critical Bugs in Mode System | ~545 |
| #31746 | 10:42 PM | 🔵 | PR #412 Documentation Audit Identifies Comment Quality Issues | ~535 |
| #31743 | 10:36 PM | 🔵 | PR #412 proposes mode system with inheritance and multilingual support | ~523 |
| #31739 | 10:28 PM | 🟣 | Mode Inheritance System with Parent-Override Pattern | ~373 |
| #31732 | 10:05 PM | 🟣 | Implemented mode inheritance system with parent-override pattern | ~430 |
| #31731 | " | 🟣 | Added deep merge infrastructure for mode inheritance | ~313 |
| #31729 | 9:55 PM | 🟣 | Mode Inheritance Parser Implementation | ~299 |
| #31728 | 9:54 PM | 🔵 | ModeManager System Architecture | ~314 |
| #31727 | " | ⚖️ | Mode Inheritance System for Multilingual Support | ~509 |
| #31725 | 9:51 PM | ⚖️ | Mode Inheritance System Architecture | ~509 |
| #31709 | 9:39 PM | 🔵 | Mode system architecture comprehensively documented | ~588 |
| #31697 | 9:24 PM | 🔵 | Root Cause Found: getPackageRoot() Returns Wrong Directory for ModeManager | ~399 |
| #31662 | 8:56 PM | 🔵 | ModeManager Path Resolution Dependency on getPackageRoot | ~361 |
| #31649 | 8:46 PM | 🟣 | ModeManager singleton implements dynamic mode profile loading | ~363 |
| #31446 | 7:22 PM | 🔵 | ModeManager Loading System Investigation | ~297 |
| #31445 | 7:21 PM | 🔵 | ModeManager Icon Resolution Methods | ~358 |
| #31427 | 6:56 PM | 🔵 | ModeManager Imports ObservationType and ObservationConcept Types | ~192 |
| #31422 | 6:50 PM | 🔵 | Observation Metadata Constants Usage Across Codebase | ~366 |
| #31407 | 6:26 PM | 🔵 | ModeManager provides observation type metadata access methods | ~283 |
### Dec 22, 2025
**types.ts**
| ID | Time | T | Title | Read |
|----|------|---|-------|------|
| #31896 | 7:18 PM | ✅ | Commit amendé avec les nouveaux types pour support multilingue des résumés | ~290 |
| #31895 | " | 🟣 | Ajout de quatre champs de prompts de résumé à l'interface ModePrompts | ~347 |
| #31894 | " | 🔵 | Interface ModePrompts contient les placeholders XML pour résumés | ~354 |
| #31808 | 6:07 PM | 🟣 | Added customizable XML placeholder fields to ModePrompts interface | ~432 |
| #31804 | 4:53 PM | ⚖️ | Refined scope for prompt placeholder extraction to mode configuration | ~439 |
| #31803 | 4:52 PM | 🔵 | Explored prompt system architecture for placeholder customization | ~472 |
| #31800 | 4:51 PM | ⚖️ | Initiated design task to extract hardcoded placeholders into mode configuration | ~441 |
| #31797 | 4:49 PM | 🔵 | ModePrompts interface defines high-level prompt sections but not field placeholders | ~364 |
| #31793 | 4:41 PM | 🔵 | Completed comprehensive exploration of mode system architecture | ~525 |
| #31784 | 4:37 PM | 🔵 | Examined ModeConfig type definitions for prompt customization | ~317 |
**ModeManager.ts**
| ID | Time | T | Title | Read |
|----|------|---|-------|------|
| #31790 | 4:39 PM | 🔵 | Identified files that interact with ModeManager and prompts | ~332 |
| #31785 | 4:37 PM | 🔵 | Examined ModeManager for mode loading and inheritance system | ~286 |
### Dec 23, 2025
**ModeManager.ts**
| ID | Time | T | Title | Read |
|----|------|---|-------|------|
| #32033 | 7:50 PM | ⚖️ | Mode-to-Settings Auto-Sync Architecture Designed | ~583 |
| #32032 | 7:45 PM | 🔵 | Queue System Bug: Mode Loaded Once at Startup Prevents Processing | ~450 |
| #32026 | 7:39 PM | 🔵 | Email Investigation Mode Configuration Located | ~300 |
| #32025 | 7:35 PM | 🔵 | ModeManager Implementation with Inheritance System | ~474 |
### Dec 24, 2025
**ModeManager.ts**
| ID | Time | T | Title | Read |
|----|------|---|-------|------|
| #32214 | 8:17 PM | 🔵 | ModeManager singleton handles mode profiles with inheritance support | ~483 |
### Dec 25, 2025
**ModeManager.ts**
| ID | Time | T | Title | Read |
|----|------|---|-------|------|
| #32701 | 9:00 PM | 🔵 | Test Coverage Report Generated | ~471 |
| #32580 | 8:22 PM | 🔵 | Grep for resetStuckMessages and processing | ~242 |
**types.ts**
| ID | Time | T | Title | Read |
|----|------|---|-------|------|
| #32558 | 8:18 PM | 🔵 | Identified files containing 'summary' or 'Summary' | ~167 |
### Dec 31, 2025
**types.ts**
| ID | Time | T | Title | Read |
|----|------|---|-------|------|
| #34631 | 3:02 PM | 🟣 | Context-Preservation Workflow Design Documents Created | ~729 |
| #34610 | 2:58 PM | 🔵 | Mode Configuration System Architecture for Memory Agent Behavior | ~570 |
### Jan 1, 2026
**ModeManager.ts**
| ID | Time | T | Title | Read |
|----|------|---|-------|------|
| #35433 | 8:43 PM | 🔵 | Try-Catch Block Distribution Across Services | ~372 |
### Jan 2, 2026
**ModeManager.ts**
| ID | Time | T | Title | Read |
|----|------|---|-------|------|
| #35951 | 4:42 PM | 🔵 | Multi-Layer Service Architecture Discovery | ~395 |
### Jan 3, 2026
**ModeManager.ts**
| ID | Time | T | Title | Read |
|----|------|---|-------|------|
| #36539 | 9:39 PM | 🔵 | ModeManager Singleton Pattern with Inheritance | ~343 |
### Jan 5, 2026
**ModeManager.ts**
| ID | Time | T | Title | Read |
|----|------|---|-------|------|
| #37665 | 5:52 PM | 🔵 | Codebase uses dependency injection and lazy initialization patterns to avoid circular dependencies | ~548 |
*No recent activity*
</claude-mem-context>