Feature Request: Add PostCommand hook event for CLI commands like /export

Resolved 💬 2 comments Opened Jan 18, 2026 by snapappraise Closed Feb 27, 2026

Summary

Currently, Claude Code hooks (PreToolUse, PostToolUse, etc.) only catch tool calls like Bash, Read, Write, and Edit. Built-in CLI commands like /export, /clear, /help are not catchable by any hook event.

Use Case

I want to automatically move exported session files from the root directory to a specific folder (docs/sessions/) after running /export. This would enable better organization of conversation exports in monorepo projects.

Currently I have to manually run a script after each /export:

.claude/hooks/move-exports.sh

Requested Feature

Add a PostCommand (or similar) hook event that fires after CLI commands like /export complete, allowing users to run custom scripts for post-processing.

Example Configuration

{
  "hooks": {
    "PostCommand": [
      {
        "matcher": "export",
        "hooks": [
          {
            "type": "command",
            "command": ".claude/hooks/move-exports.sh"
          }
        ]
      }
    ]
  }
}

Benefits

  • Seamless session management and file organization
  • Consistent with existing hook patterns
  • Enables automation for other CLI commands too (/init, /doctor, etc.)

View original on GitHub ↗

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