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
+16 -127
View File
@@ -3,147 +3,36 @@
<!-- This section is auto-generated by claude-mem. Edit content outside the tags. -->
### Dec 16, 2025
### Nov 18, 2025
**worker-service.mdx**
| ID | Time | T | Title | Read |
|----|------|---|-------|------|
| #28299 | 9:57 PM | | Documentation Updated for Renamed MCP Tools | ~305 |
| #28293 | 9:56 PM | 🔵 | get_batch_observations Usage Across Codebase | ~226 |
| #28292 | " | 🔵 | get_batch_observations Referenced in 4 Files | ~246 |
| #28242 | 9:38 PM | 🔵 | Progressive Description and Batch Observations Usage Sites | ~241 |
| #11206 | 3:01 PM | 🔵 | mem-search skill architecture and migration details retrieved in full format | ~538 |
### Nov 21, 2025
**search-architecture.mdx**
| ID | Time | T | Title | Read |
|----|------|---|-------|------|
| #28074 | 8:09 PM | 🔵 | Progressive Disclosure Pattern and Search Implementation | ~558 |
| #28067 | " | 🔵 | Progressive Disclosure and Security Architecture | ~528 |
| #28066 | 8:08 PM | 🔵 | Search Architecture Evolution from MCP to Skill-Based | ~530 |
| #28058 | " | 🔵 | Search Architecture Evolution from MCP Tools to Skill-Based HTTP API | ~528 |
| #13218 | 1:58 AM | 🔴 | Escaped HTML special character in MDX documentation | ~261 |
### Dec 3, 2025
**pm2-to-bun-migration.mdx**
| ID | Time | T | Title | Read |
|----|------|---|-------|------|
| #27716 | 5:41 PM | | Better-sqlite3 References Removed from Codebase | ~319 |
| #27715 | " | 🔵 | Git Branch Already Created | ~208 |
| #27712 | 5:40 PM | 🟣 | Merged PR #332: API-Based Import/Export Architecture | ~372 |
| #27699 | 5:37 PM | 🔵 | Comprehensive PM2 to Bun migration documentation exists | ~360 |
| #27696 | 5:36 PM | 🔵 | Documentation already reflects better-sqlite3 to bun:sqlite migration | ~390 |
| #27695 | " | 🔵 | Better-sqlite3 references found in documentation | ~201 |
| #27687 | 5:32 PM | 🔴 | Corrected Migration Date in PM2 to Bun Documentation | ~270 |
| #27656 | 5:24 PM | ⚖️ | PM2 to Bun Documentation Migration Plan Created | ~551 |
| #27655 | " | 🟣 | PM2 to Bun Documentation Migration Plan Created | ~455 |
| #27654 | 5:22 PM | 🔵 | Complete PM2 Documentation Audit | ~458 |
| #19891 | 9:43 PM | 🔵 | Seven hook scripts across five lifecycle events | ~713 |
### Dec 17, 2025
### Dec 15, 2025
**pm2-to-bun-migration.mdx**
| ID | Time | T | Title | Read |
|----|------|---|-------|------|
| #28930 | 7:30 PM | 🔵 | Worker CLI Distribution and Build System | ~275 |
| #27040 | 6:03 PM | 🔵 | Comprehensive search confirms no 95% claims exist in main branch public documentation | ~508 |
| #27037 | 6:02 PM | 🔵 | Branch switching functionality exists in SettingsRoutes with UI switcher removal intent | ~463 |
### Jan 7, 2026
**worker-service.mdx**
| ID | Time | T | Title | Read |
|----|------|---|-------|------|
| #28929 | 7:30 PM | 🔵 | ProcessManager Usage Across Codebase | ~319 |
### Dec 18, 2025
**database.mdx**
| ID | Time | T | Title | Read |
|----|------|---|-------|------|
| #29815 | 7:33 PM | 🔵 | Database contains multiple session table schemas | ~311 |
### Dec 20, 2025
**worker-service.mdx**
| ID | Time | T | Title | Read |
|----|------|---|-------|------|
| #30675 | 5:08 PM | 🔵 | Platform Documentation Across 18 Files | ~335 |
**overview.mdx**
| ID | Time | T | Title | Read |
|----|------|---|-------|------|
| #30253 | 3:17 PM | 🔵 | Agent SDK Integration Throughout Codebase | ~402 |
### Dec 24, 2025
**hooks.mdx**
| ID | Time | T | Title | Read |
|----|------|---|-------|------|
| #32193 | 7:42 PM | 🔵 | Session completion endpoint usage across codebase | ~278 |
### Dec 25, 2025
**worker-service.mdx**
| ID | Time | T | Title | Read |
|----|------|---|-------|------|
| #32654 | 8:51 PM | 🔵 | Identified multiple files related to queue recovery | ~375 |
| #32456 | 5:41 PM | ✅ | Completed merge of main branch into feature/titans-phase1-3 | ~354 |
| #32432 | 3:41 PM | 🟣 | Manual Queue Recovery System with CLI and API | ~531 |
| #32425 | 3:26 PM | ✅ | API Documentation for Manual Recovery Endpoints Added | ~563 |
### Dec 27, 2025
**hooks.mdx**
| ID | Time | T | Title | Read |
|----|------|---|-------|------|
| #33101 | 7:11 PM | 🔵 | Context Injection API Endpoint Usage Across Hooks | ~358 |
### Dec 28, 2025
**search-architecture.mdx**
| ID | Time | T | Title | Read |
|----|------|---|-------|------|
| #33540 | 10:55 PM | 🔵 | Grep search found mem-search references in internationalized documentation | ~577 |
### Dec 29, 2025
**search-architecture.mdx**
| ID | Time | T | Title | Read |
|----|------|---|-------|------|
| #33769 | 12:37 AM | ✅ | Documentation updated for MCP-based search architecture | ~528 |
| #33767 | 12:34 AM | ✅ | Committed MDX Syntax Fix to updates/docs Branch | ~301 |
| #33766 | " | 🔴 | Fixed MDX Syntax Error in Performance Section | ~293 |
| #33765 | 12:33 AM | 🔵 | Search Architecture Documentation Structure Analysis | ~524 |
| #33763 | 12:27 AM | ✅ | Pull request #480 created for MCP architecture documentation updates | ~423 |
| #33762 | " | ✅ | Architecture shift from skill-based to MCP-based search with 3-layer workflow | ~418 |
| #33760 | 12:26 AM | ✅ | Major documentation overhaul across 6 files with 908 additions | ~367 |
| #33756 | 12:25 AM | ✅ | Documentation Version Reference Removed from Search Architecture | ~257 |
| #33754 | " | ✅ | Removed fabricated version range from skill-based approach comparison | ~318 |
| #33753 | " | ✅ | Documentation Version Number Removed from Architecture Evolution Section | ~233 |
| #33751 | " | 🔵 | Architecture Evolution Documentation Records v6.5.0 Migration | ~227 |
| #33702 | 12:09 AM | ⚖️ | Documentation Update Strategy Finalized for MCP Architecture Transition | ~845 |
| #33698 | 12:07 AM | 🔵 | Search Architecture Documentation Comprehensively Describes Deleted Skill System | ~663 |
| #33680 | 12:03 AM | 🔵 | Search Architecture Documentation Describes Deleted Skill System | ~576 |
### Dec 31, 2025
**pm2-to-bun-migration.mdx**
| ID | Time | T | Title | Read |
|----|------|---|-------|------|
| #34688 | 3:40 PM | 🔵 | Worker Logs Command Usage Across Codebase | ~320 |
### Jan 2, 2026
**database.mdx**
| ID | Time | T | Title | Read |
|----|------|---|-------|------|
| #36096 | 10:23 PM | 🔵 | Observation API Function Names Located | ~227 |
### Jan 3, 2026
**database.mdx**
| ID | Time | T | Title | Read |
|----|------|---|-------|------|
| #36353 | 8:42 PM | 🔵 | Multiple observation table definitions found across codebase | ~280 |
### Jan 5, 2026
**overview.mdx**
| ID | Time | T | Title | Read |
|----|------|---|-------|------|
| #38066 | 9:50 PM | ✅ | v9.0 Documentation Audit Completed with 14 Files Updated | ~547 |
| #38064 | " | ⚖️ | 9.0 Release Documentation Audit Complete - Major Gaps Identified | ~997 |
| #38059 | 9:49 PM | 🔵 | Architecture Overview Documentation Review | ~554 |
| #38221 | 7:41 PM | | Removed User Message Hook Documentation Section | ~339 |
| #38218 | 7:40 PM | ✅ | Updated Hook Configuration Documentation to Match Implementation | ~382 |
| #38212 | " | 🔵 | 5-Stage Hook Lifecycle Architecture for Memory Agent | ~668 |
</claude-mem-context>