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:
+64
-113
@@ -3,147 +3,98 @@
|
||||
|
||||
<!-- This section is auto-generated by claude-mem. Edit content outside the tags. -->
|
||||
|
||||
### Dec 30, 2025
|
||||
### Dec 9, 2025
|
||||
|
||||
**new-hook.ts**
|
||||
| ID | Time | T | Title | Read |
|
||||
|----|------|---|-------|------|
|
||||
| #34440 | 2:16 PM | 🔵 | TypeScript type errors identified across multiple components | ~328 |
|
||||
| #23126 | 6:40 PM | ✅ | Removed SKIP_TOOLS Check from saveHook Function | ~288 |
|
||||
| #23125 | " | 🔵 | SKIP_TOOLS Reference Still Present in saveHook Function | ~224 |
|
||||
| #23124 | " | ✅ | Removed SKIP_TOOLS Constant from save-hook.ts | ~297 |
|
||||
| #23123 | 6:39 PM | 🔵 | Current SKIP_TOOLS Implementation in save-hook.ts | ~397 |
|
||||
| #23122 | " | 🔴 | Hardened Spinner Stop Mechanism with Timeout and Logging | ~361 |
|
||||
| #23121 | " | 🔵 | Current Spinner Stop Implementation in summary-hook.ts | ~348 |
|
||||
| #23118 | 6:38 PM | ✅ | Phase 6: StopInput Interface Type Safety Restored | ~248 |
|
||||
| #23117 | 6:37 PM | ✅ | Phase 6: PostToolUseInput Interface Type Safety Restored | ~222 |
|
||||
| #23116 | " | ✅ | Phase 6: UserPromptSubmitInput Interface Type Safety Restored | ~216 |
|
||||
| #23115 | " | ✅ | Phase 6: SessionStartInput Interface Type Safety Restored | ~341 |
|
||||
| #23114 | " | 🔵 | Current State of context-hook.ts Interface | ~409 |
|
||||
| #23113 | " | 🔵 | Current State of summary-hook.ts Interface and Spinner Stop | ~397 |
|
||||
| #23112 | " | 🔵 | Current State of save-hook.ts Interface and SKIP_TOOLS | ~395 |
|
||||
| #23111 | " | 🔵 | Current State of new-hook.ts Interface | ~381 |
|
||||
| #23076 | 6:27 PM | ✅ | Added Comment Explaining Exit Code 3 in user-message-hook.ts | ~245 |
|
||||
| #23075 | 6:26 PM | ✅ | Deleted Expired Announcement Code from user-message-hook.ts | ~354 |
|
||||
| #23074 | " | ✅ | Replaced Verbose Manual Mode Help with Error in cleanup-hook.ts | ~222 |
|
||||
| #23073 | " | ✅ | Removed cwd from cleanup-hook Debug Logging | ~177 |
|
||||
| #23072 | " | ✅ | Simplified SessionEndInput Interface in cleanup-hook.ts | ~236 |
|
||||
|
||||
### Dec 10, 2025
|
||||
|
||||
**summary-hook.ts**
|
||||
| ID | Time | T | Title | Read |
|
||||
|----|------|---|-------|------|
|
||||
| #34393 | 1:41 PM | 🔵 | Stop Hook (summary-hook.ts) Only Requests Summary, No Process Cleanup | ~375 |
|
||||
| #23407 | 2:14 PM | 🔵 | New Hook Implementation Structure | ~264 |
|
||||
|
||||
### Dec 31, 2025
|
||||
### Dec 13, 2025
|
||||
|
||||
**new-hook.ts**
|
||||
| ID | Time | T | Title | Read |
|
||||
|----|------|---|-------|------|
|
||||
| #34675 | 3:37 PM | 🔵 | API Endpoint /api/sessions/init Expects contentSessionId Parameter | ~401 |
|
||||
| #34674 | " | 🔵 | Source Hook Files Use contentSessionId Parameter | ~327 |
|
||||
| #34602 | 2:56 PM | 🔵 | New Hook Architecture: Session Initialization and Privacy Filtering | ~385 |
|
||||
| #25389 | 9:30 PM | 🔴 | Save Hook Error Logging Enhanced With Tool Context | ~361 |
|
||||
| #25388 | " | 🔴 | New Hook Now Logs SDK Agent Start Errors | ~344 |
|
||||
| #25387 | 9:29 PM | 🔴 | New Hook Now Logs Session Initialization Errors | ~350 |
|
||||
| #25386 | " | 🔴 | Context Hook Now Logs Error Text Before Throwing | ~338 |
|
||||
| #25385 | " | ✅ | Added Logger Import to New Hook | ~249 |
|
||||
| #25384 | " | ✅ | Added Logger Import to Context Hook | ~223 |
|
||||
| #25383 | " | 🔵 | New Hook Has Two Silent Failure Points | ~392 |
|
||||
| #25382 | 9:28 PM | 🔵 | Save Hook Has Partial Error Logging | ~351 |
|
||||
| #25381 | " | 🔵 | Summary Hook Has Partial Error Logging | ~345 |
|
||||
| #25380 | " | 🔵 | Context Hook Silent Failure Pattern Confirmed | ~354 |
|
||||
|
||||
### Dec 14, 2025
|
||||
|
||||
**context-hook.ts**
|
||||
| ID | Time | T | Title | Read |
|
||||
|----|------|---|-------|------|
|
||||
| #34631 | 3:02 PM | 🟣 | Context-Preservation Workflow Design Documents Created | ~729 |
|
||||
| #26730 | 11:24 PM | 🔵 | Context Hook TypeScript Source Shows EnsureWorkerRunning as First Action | ~441 |
|
||||
| #26729 | " | 🔵 | Context Hook TypeScript Source Calls ensureWorkerRunning Before API Requests | ~411 |
|
||||
| #26260 | 8:32 PM | 🔵 | User Message Hook Calls Context Inject with colors=true Parameter | ~300 |
|
||||
| #26244 | 8:29 PM | 🔵 | Context Hook Delegates to Worker API Context Endpoint | ~260 |
|
||||
| #25692 | 4:24 PM | 🔵 | Summary hook extracts last user and assistant messages from transcript file before sending to worker | ~465 |
|
||||
|
||||
### Jan 1, 2026
|
||||
### Dec 17, 2025
|
||||
|
||||
**new-hook.ts**
|
||||
| ID | Time | T | Title | Read |
|
||||
|----|------|---|-------|------|
|
||||
| #35287 | 1:22 PM | 🔵 | SDKAgent Resume Logic Analysis - Two-Stage Session ID System | ~517 |
|
||||
| #35284 | " | 🔵 | New Hook Session Initialization Flow | ~631 |
|
||||
| #35221 | 1:11 PM | 🔵 | New-hook workflow: Two-phase session initialization | ~477 |
|
||||
| #35201 | 1:07 PM | 🔵 | New Hook receives and processes cwd parameter | ~303 |
|
||||
| #28449 | 4:23 PM | 🔵 | New Hook Session Initialization Flow | ~385 |
|
||||
|
||||
### Dec 19, 2025
|
||||
|
||||
**context-hook.ts**
|
||||
| ID | Time | T | Title | Read |
|
||||
|----|------|---|-------|------|
|
||||
| #35206 | 1:08 PM | 🔵 | context-hook.ts falls back to process.cwd() when cwd missing | ~311 |
|
||||
| #30105 | 8:11 PM | 🔵 | Hook Response Utility Standardizes Hook Output Format | ~387 |
|
||||
| #30103 | 8:10 PM | 🔵 | Context Hook Injects Mode-Based Memory Context During SessionStart | ~460 |
|
||||
|
||||
### Dec 20, 2025
|
||||
|
||||
**save-hook.ts**
|
||||
| ID | Time | T | Title | Read |
|
||||
|----|------|---|-------|------|
|
||||
| #35204 | 1:07 PM | 🔵 | PostToolUse hook validates cwd as required field | ~301 |
|
||||
| #31085 | 7:59 PM | 🔵 | Summary Hook Uses session_id from Hook Input | ~315 |
|
||||
|
||||
### Jan 2, 2026
|
||||
### Dec 27, 2025
|
||||
|
||||
**new-hook.ts**
|
||||
| ID | Time | T | Title | Read |
|
||||
|----|------|---|-------|------|
|
||||
| #35997 | 5:32 PM | 🟣 | Session Alignment Logging Implemented Across Hook, HTTP, and SDK Layers | ~342 |
|
||||
| #35977 | 4:48 PM | 🔵 | Existing alignment logging infrastructure found | ~353 |
|
||||
| #35970 | 4:47 PM | 🔵 | Session ID Logging Distribution Across Codebase | ~485 |
|
||||
| #35964 | 4:45 PM | 🔵 | Session Initialization Two-Stage API Pattern | ~468 |
|
||||
| #35954 | 4:43 PM | 🔵 | New Hook Session Initialization Flow | ~393 |
|
||||
| #35893 | 2:48 PM | 🔵 | New Hook Initializes Session And Starts SDK Agent Without Exit Code | ~382 |
|
||||
| #35833 | 2:29 PM | 🔵 | New Hook Starts Memory Agent Asynchronously | ~404 |
|
||||
| #33216 | 9:07 PM | 🔵 | UserPromptSubmit Hook (new-hook.ts) Initializes Session and Starts SDK Agent via Two HTTP Endpoints | ~735 |
|
||||
| #33211 | 9:04 PM | 🔵 | User Message Hook Displays Context Info via stderr in Parallel with Context Injection | ~476 |
|
||||
| #33210 | 9:03 PM | 🔵 | Summary Hook (summary-hook.ts) Extracts Messages and Triggers Summarization | ~479 |
|
||||
| #33209 | " | 🔵 | SessionStart Hook (context-hook.ts) Fetches Context Injection via HTTP | ~520 |
|
||||
|
||||
### Jan 7, 2026
|
||||
|
||||
**context-hook.ts**
|
||||
| ID | Time | T | Title | Read |
|
||||
|----|------|---|-------|------|
|
||||
| #35958 | 4:44 PM | 🔵 | Context Hook Session Context Injection | ~379 |
|
||||
| #35894 | 2:48 PM | 🔵 | Context Hook Explicitly Exits With Code 0 On Success | ~355 |
|
||||
| #35837 | 2:30 PM | 🔵 | Context Hook Returns Synchronously with Explicit Exit | ~413 |
|
||||
|
||||
**save-hook.ts**
|
||||
| ID | Time | T | Title | Read |
|
||||
|----|------|---|-------|------|
|
||||
| #35956 | 4:43 PM | 🔵 | Save Hook Tool Observation Storage | ~380 |
|
||||
| #35899 | 2:48 PM | 🔵 | Save Hook Sends Observations Without Explicit Exit Code | ~387 |
|
||||
| #35869 | 2:36 PM | 🔴 | Save Hook Entry Point Lacks Error Handling Around Async Call | ~448 |
|
||||
| #35835 | 2:30 PM | 🔵 | Save Hook Uses Fire-and-Forget for Observations | ~394 |
|
||||
|
||||
**user-message-hook.ts**
|
||||
| ID | Time | T | Title | Read |
|
||||
|----|------|---|-------|------|
|
||||
| #35955 | 4:43 PM | 🔵 | User Message Hook Context Display Mechanism | ~369 |
|
||||
| #35888 | 2:47 PM | 🔵 | User Message Hook Exits With USER_MESSAGE_ONLY Code | ~313 |
|
||||
| #35831 | 2:29 PM | 🔵 | User Message Hook Exits with Special Exit Code | ~348 |
|
||||
|
||||
**hook-response.ts**
|
||||
| ID | Time | T | Title | Read |
|
||||
|----|------|---|-------|------|
|
||||
| #35953 | 4:43 PM | 🔵 | Standard Hook Response Protocol | ~253 |
|
||||
| #35950 | 4:42 PM | 🔵 | Hook System Architecture Discovery | ~254 |
|
||||
| #35891 | 2:47 PM | 🔵 | STANDARD_HOOK_RESPONSE Signals Continue And Suppress Output | ~333 |
|
||||
|
||||
**summary-hook.ts**
|
||||
| ID | Time | T | Title | Read |
|
||||
|----|------|---|-------|------|
|
||||
| #35901 | 2:49 PM | 🔵 | PR #525 File Changes Summary | ~376 |
|
||||
| #35889 | 2:47 PM | 🔵 | Summary Hook Outputs STANDARD_HOOK_RESPONSE On Success And Error | ~358 |
|
||||
| #35829 | 2:29 PM | 🔵 | Summary Hook Uses Fire-and-Forget HTTP Pattern | ~385 |
|
||||
| #35770 | 1:23 PM | ✅ | Last User Message Field Removed Across 11 Files in Codebase | ~374 |
|
||||
| #35747 | 1:18 PM | 🔴 | Removed Incorrect last_user_message Extraction from Summary Hook | ~382 |
|
||||
| #35734 | 1:11 PM | 🔵 | Summary Hook Extracts Last User and Assistant Messages from Transcript | ~383 |
|
||||
| #35733 | " | 🔵 | Located last_user_message usage across codebase | ~333 |
|
||||
|
||||
### Jan 3, 2026
|
||||
|
||||
**new-hook.ts**
|
||||
| ID | Time | T | Title | Read |
|
||||
|----|------|---|-------|------|
|
||||
| #36296 | 8:04 PM | 🔵 | TypeScript Compilation Check: Pre-Existing Errors Unrelated to Refactoring | ~621 |
|
||||
| #36112 | 3:44 PM | 🔵 | New Hook Architecture and Session Initialization Flow | ~412 |
|
||||
|
||||
### Jan 5, 2026
|
||||
|
||||
**save-hook.ts**
|
||||
| ID | Time | T | Title | Read |
|
||||
|----|------|---|-------|------|
|
||||
| #38081 | 9:55 PM | 🔵 | Save Hook - Pure HTTP Client with No Database Dependencies | ~206 |
|
||||
| #37626 | 5:35 PM | 🔵 | FormatTool Function Usage Across Codebase | ~493 |
|
||||
| #37540 | 4:46 PM | 🔵 | save-hook.ts First formatTool Call Point in Observation Pipeline | ~416 |
|
||||
|
||||
**CLAUDE.md**
|
||||
| ID | Time | T | Title | Read |
|
||||
|----|------|---|-------|------|
|
||||
| #38078 | 9:54 PM | ✅ | CLAUDE.md Documentation Cleanup - 1,233 Lines Removed Across 18 Files | ~590 |
|
||||
|
||||
**context-hook.ts**
|
||||
| ID | Time | T | Title | Read |
|
||||
|----|------|---|-------|------|
|
||||
| #38076 | 9:53 PM | 🟣 | Worktree-Aware Project Filtering for Unified Timeline Context | ~578 |
|
||||
|
||||
**new-hook.ts**
|
||||
| ID | Time | T | Title | Read |
|
||||
|----|------|---|-------|------|
|
||||
| #38000 | 9:02 PM | 🔵 | Mixed usage of hard-coded 127.0.0.1 vs getWorkerHost() | ~347 |
|
||||
| #37999 | " | 🔵 | getWorkerHost and getWorkerPort used in 18 files across codebase | ~282 |
|
||||
|
||||
**hook-response.ts**
|
||||
| ID | Time | T | Title | Read |
|
||||
|----|------|---|-------|------|
|
||||
| #37554 | 4:48 PM | 🔵 | Standard Hook Response Protocol for Claude Code | ~387 |
|
||||
|
||||
### Jan 6, 2026
|
||||
|
||||
**context-hook.ts**
|
||||
| ID | Time | T | Title | Read |
|
||||
|----|------|---|-------|------|
|
||||
| #38108 | 12:15 AM | 🔵 | Complete Windows Zombie Port Bug Technical Deep Dive | ~935 |
|
||||
| #38235 | 7:42 PM | ✅ | Deprecated User Message Hook Source File | ~399 |
|
||||
| #38176 | 7:26 PM | ⚖️ | Plan Created to Merge User Message into Context Hook JSON Output | ~536 |
|
||||
| #38175 | " | 🔵 | Complete Claude-Mem Hook Output Architecture Documented | ~530 |
|
||||
| #38174 | " | 🔵 | UserPromptSubmit Hook Initializes Sessions and Strips Slash Commands | ~480 |
|
||||
| #38173 | 7:25 PM | 🔵 | Standard Hook Response Pattern for Non-SessionStart Hooks | ~343 |
|
||||
| #38172 | 7:22 PM | 🔵 | Claude Code Hook Output Architecture Clarified - Exit Code Pattern is Correct for User-Only Display | ~523 |
|
||||
| #38170 | 7:21 PM | 🔵 | User-Message-Hook TypeScript Source Shows Exit Code 1 Strategy for User-Only Display | ~203 |
|
||||
</claude-mem-context>
|
||||
@@ -1,15 +1,20 @@
|
||||
/**
|
||||
* User Message Hook - SessionStart
|
||||
* Displays context information to the user via stderr
|
||||
*
|
||||
* This hook runs in parallel with context-hook to show users what context
|
||||
* has been loaded into their session. Uses stderr as the communication channel
|
||||
* since it's currently the only way to display messages in Claude Code UI.
|
||||
* @deprecated This hook is no longer used as of Claude Code 2.1.0 (ultrathink update).
|
||||
* SessionStart hooks no longer display any user-visible messages in the Claude Code UI.
|
||||
* Context is still injected via hookSpecificOutput.additionalContext in context-hook.ts,
|
||||
* but users don't see any startup output.
|
||||
*
|
||||
* This file is kept for reference but is not registered in hooks.json.
|
||||
*
|
||||
* Historical behavior:
|
||||
* - Displayed context information to the user via stderr
|
||||
* - Ran in parallel with context-hook to show users what context was loaded
|
||||
* - Used stderr + exit code 1 to display to user only without adding to Claude's context
|
||||
*/
|
||||
import { basename } from "path";
|
||||
import { ensureWorkerRunning, getWorkerPort } from "../shared/worker-utils.js";
|
||||
import { HOOK_EXIT_CODES } from "../shared/hook-constants.js";
|
||||
import { logger } from "../utils/logger.js";
|
||||
|
||||
// Ensure worker is running
|
||||
await ensureWorkerRunning();
|
||||
@@ -39,4 +44,4 @@ console.error(
|
||||
`\n📺 Watch live in browser http://localhost:${port}/\n`
|
||||
);
|
||||
|
||||
process.exit(HOOK_EXIT_CODES.USER_MESSAGE_ONLY);
|
||||
process.exit(1); // Exit code 1 for SessionStart = show stderr to user only
|
||||
Reference in New Issue
Block a user