[BUG] PostToolUse hook not sending cwd field despite documentation

Resolved 💬 3 comments Opened Jan 7, 2026 by lmcdo Closed Feb 20, 2026

[BUG] PostToolUse hook not sending cwd field despite documentation

Problem

The PostToolUse hook is not sending the cwd (current working directory) field in the hook data, despite being documented in the official hooks documentation. This causes plugins that depend on working directory context (like claude-mem) to fail silently.

Documentation vs. Reality

According to the documentation (Hooks Input Reference):

All hook events should receive common fields including:

{
  "session_id": "abc123",
  "transcript_path": "/Users/.../.claude/projects/.../00893aaf.jsonl",
  "cwd": "/Users/.../project-name",
  "permission_mode": "default",
  "hook_event_name": "PostToolUse",
  "tool_name": "Read",
  "tool_input": {...},
  "tool_response": {...}
}

In reality:
The cwd field is null, undefined, or missing from the PostToolUse hook data.

Impact

Without cwd, plugins cannot:

  1. Determine project context - Plugins like claude-mem use cwd to tag observations with project names for cross-session memory
  2. Isolate multi-project data - When working across multiple repos, observations get mixed together without project identification
  3. Function at all - claude-mem has been silently failing since Jan 1, 2026, with no observations captured

Evidence

From claude-mem worker logs (~/.claude-mem/silent.log):

[2025-12-30T21:26:04.946Z] [HAPPY-PATH-ERROR] [unknown] Missing cwd when queueing observation in SessionRoutes {"sessionDbId":2646,"tool_name":"Glob"}
[2025-12-30T21:26:21.698Z] [HAPPY-PATH-ERROR] [unknown] Missing cwd when queueing observation in SessionRoutes {"sessionDbId":2646,"tool_name":"Read"}
[2025-12-30T21:27:51.533Z] [HAPPY-PATH-ERROR] [unknown] Missing cwd when queueing observation in SessionRoutes {"sessionDbId":2646,"tool_name":"Edit"}

The plugin receives the hook event but cwd is missing, preventing project identification.

Current Workaround

None. Plugins must either:

  • Use a hardcoded default project (unreliable for multi-project workflows)
  • Parse the transcript path to extract project directory (fragile and slow)
  • Fail silently (current state)

Expected Behavior

Claude Code should send cwd in all hook events (SessionStart, UserPromptSubmit, PostToolUse, Stop, SessionEnd) as documented, so plugins can correctly identify the working directory context.

Environment

  • Claude Code version: Latest (as of Jan 7, 2026)
  • Hook: PostToolUse (likely affects all hooks)
  • Platform: Windows (but likely affects all platforms)
  • Plugin affected: claude-mem (and any plugin that needs project context)
  • Working directory: C:\Users\lawre\Downloads\solvyra\projects\ikb-research

Related Issues

  • #13241 - tool_use_id field also missing from PostToolUse (similar class of bug)
  • #11891 - Hook documentation incomplete
  • #16142 - PostToolUse fails when cwd is home directory (different issue, but cwd-related)

Request

Please add the cwd field to all hook events as documented, so plugins can identify project context without parsing filesystem paths or maintaining fragile heuristics.

Thank you!

View original on GitHub ↗

This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗