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. -->
### Jan 2, 2026
**SessionStore.ts**
| ID | Time | T | Title | Read |
|----|------|---|-------|------|
| #36101 | 10:25 PM | ✅ | Database migration made observations.text field nullable | ~353 |
| #36100 | " | 🔵 | storeObservation method implementation in SessionStore | ~368 |
| #36085 | 10:15 PM | 🔵 | Memory Session ID Two-Phase Capture Pattern | ~350 |
| #36084 | " | 🔵 | SDK Session Creation Idempotent Design Pattern | ~410 |
| #36029 | 9:21 PM | 🔄 | Removed try-catch block from ensureDiscoveryTokensColumn migration | ~322 |
| #35998 | 5:32 PM | 🔴 | Critical Session ID Placeholder Bug Fixed to Prevent Transcript Pollution | ~488 |
| #35995 | 5:31 PM | 🔵 | Worker Version Mismatch Detection Issue | ~419 |
| #35990 | 5:17 PM | 🔴 | Fixed memory_session_id initialization to prevent session ID collision | ~385 |
| #35989 | " | 🔵 | SDK Session Creation Uses Content Session ID as Memory Session Placeholder | ~399 |
| #35988 | " | 🔵 | Session ID Threading Architecture with FK Placeholder Pattern | ~380 |
| #35970 | 4:47 PM | 🔵 | Session ID Logging Distribution Across Codebase | ~485 |
| #35959 | 4:44 PM | 🔵 | SessionStore Database Schema and Session ID Architecture | ~684 |
**migrations.ts**
| ID | Time | T | Title | Read |
|----|------|---|-------|------|
| #35951 | 4:42 PM | 🔵 | Multi-Layer Service Architecture Discovery | ~395 |
**PendingMessageStore.ts**
| ID | Time | T | Title | Read |
|----|------|---|-------|------|
| #35901 | 2:49 PM | 🔵 | PR #525 File Changes Summary | ~376 |
| #35885 | 2:46 PM | 🔵 | PendingMessageStore Implements Four-State Lifecycle | ~411 |
| #35858 | 2:33 PM | 🔵 | PendingMessageStore Provides Stuck Message Recovery Methods | ~496 |
| #35855 | " | 🔵 | PendingMessageStore Implements Database-Backed Message Queue with Status Tracking | ~518 |
**types.ts**
| ID | Time | T | Title | Read |
|----|------|---|-------|------|
| #35840 | 2:30 PM | 🔵 | Database Schema Includes Observation Status Tracking | ~488 |
### Jan 3, 2026
**transactions.ts**
| ID | Time | T | Title | Read |
|----|------|---|-------|------|
| #36689 | 11:56 PM | 🔵 | PR #538 Review Findings - Modular Architecture Refactor | ~590 |
| #36486 | 9:12 PM | 🟣 | Transactions Module Test Suite Implemented | ~833 |
| #36350 | 8:30 PM | 🔄 | Renamed StoreAndMarkCompleteResult to StoreObservationsResult | ~278 |
| #36348 | " | 🔵 | Transaction Module Structure for Observation Storage | ~370 |
| #36323 | 8:25 PM | 🔵 | Message Queue Architecture Scope Expanded | ~302 |
**Import.ts**
| ID | Time | T | Title | Read |
|----|------|---|-------|------|
| #36670 | 11:37 PM | ✅ | Resolved merge conflicts by accepting branch changes for 39 files | ~435 |
**SessionStore.ts**
| ID | Time | T | Title | Read |
|----|------|---|-------|------|
| #36636 | 10:46 PM | 🟣 | Session ID Refactor Analysis Agent Completed Comprehensive Report | ~637 |
| #36635 | " | 🟣 | SessionStore Analysis Agent Completed Report Generation | ~545 |
| #36621 | 10:43 PM | 🔵 | SessionStore Implementation Already Supports Timestamp Override | ~491 |
| #36390 | 8:50 PM | 🔄 | Comprehensive Monolith Refactor with Modular Architecture | ~724 |
| #36355 | 8:42 PM | 🔵 | SessionStore observations table uses 5-type enum constraint | ~273 |
| #36353 | " | 🔵 | Multiple observation table definitions found across codebase | ~280 |
| #36339 | 8:28 PM | 🔵 | Message Completion SQL Update in Transaction | ~343 |
| #36332 | 8:27 PM | 🔵 | Transaction Structure in storeObservationsAndMarkComplete | ~353 |
| #36117 | 6:19 PM | 🔵 | SessionStore Architecture: 2,012 Lines Managing 20 Migrations and 49 Methods | ~578 |
| #36113 | 3:58 PM | 🔴 | Fixed FOREIGN KEY Constraint Failure in Observation Storage | ~448 |
**Sessions.ts**
| ID | Time | T | Title | Read |
|----|------|---|-------|------|
| #36470 | 9:06 PM | 🔵 | SQLite Module API Documentation Verified for Test Implementation | ~765 |
**Database.ts**
| ID | Time | T | Title | Read |
|----|------|---|-------|------|
| #36435 | 9:00 PM | 🔵 | SQLite Database Configuration and Migration Management | ~476 |
**index.ts**
| ID | Time | T | Title | Read |
|----|------|---|-------|------|
| #36416 | 8:57 PM | 🔄 | SQLite Module Public API with SessionStore Deprecation | ~402 |
| #36351 | 8:31 PM | 🔵 | SQLite Module Index Exports storeObservationsAndMarkComplete | ~268 |
| #36314 | 8:25 PM | 🔵 | Message Queue Processing Duplicate Bug Investigation | ~316 |
**PendingMessageStore.ts**
| ID | Time | T | Title | Read |
|----|------|---|-------|------|
| #36342 | 8:29 PM | 🔄 | Implemented claimAndDelete Method in PendingMessageStore | ~353 |
| #36340 | 8:28 PM | 🔵 | Complete Duplicate Bug Analysis via Explore Agent | ~435 |
| #36329 | 8:25 PM | 🔵 | PendingMessageStore State Machine Architecture | ~393 |
| #36127 | 6:20 PM | 🔵 | PendingMessageStore Implements Persistent Work Queue for Crash Recovery | ~539 |
**sqlite**
| ID | Time | T | Title | Read |
|----|------|---|-------|------|
| #36296 | 8:04 PM | 🔵 | TypeScript Compilation Check: Pre-Existing Errors Unrelated to Refactoring | ~621 |
**migrations.ts**
| ID | Time | T | Title | Read |
|----|------|---|-------|------|
| #36124 | 6:19 PM | 🔵 | Migrations File Contains 7 Separate Migration Definitions | ~509 |
### Jan 4, 2026
**SessionStore.ts**
| ID | Time | T | Title | Read |
|----|------|---|-------|------|
| #36780 | 12:44 AM | 🔵 | Observation Schema Evolution with Hierarchical Fields | ~452 |
| #36770 | 12:42 AM | 🔵 | Export Script Type Duplication Analysis Complete | ~555 |
**PendingMessageStore.ts**
| ID | Time | T | Title | Read |
|----|------|---|-------|------|
| #36713 | 12:11 AM | 🔵 | Issue #520 Stuck Messages Already Resolved | ~569 |
| #36711 | " | 🔵 | Issue #520 Stuck Messages Analysis - Already Resolved | ~526 |
### Jan 5, 2026
**SessionSearch.ts**
| ID | Time | T | Title | Read |
|----|------|---|-------|------|
| #38036 | 9:43 PM | 🟣 | Configurable Observation Limits and Enhanced Folder Search | ~418 |
*No recent activity*
</claude-mem-context>