claude-code - 💡(How to fix) Fix [FEATURE] add startup/session-init hook event to settings.json hooks

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…

Error Message

  • Environment validation (check API keys, warn about config issues) before the session begins

Code Example

{
  "hooks": {
    "Startup": [
      {
        "type": "command",
        "command": "bash ~/.claude/plugins/my-plugin/on-start.sh"
      }
    ]
  }
}
RAW_BUFFERClick to expand / collapse

Preflight Checklist

  • I have searched existing requests and this feature hasn't been requested yet
  • This is a single feature request (not multiple features)

Problem Statement

Claude Code's hooks system currently fires on tool-use events (PreToolUse, PostToolUse, Stop, etc.) and the statusLine command renders per-conversation context. Neither fires at CLI startup — before a conversation exists.

This means plugins like a custom statusLine command don't initialize until the user sends a first message or runs /new. In interactive terminal environments (IntelliJ terminal, VS Code terminal, etc.) this creates a visible gap where the status line is absent at the initial prompt.

Proposed Solution

Add a startup (or SessionInit) hook event that fires once when the Claude Code CLI process starts, before displaying the initial prompt:

{
  "hooks": {
    "Startup": [
      {
        "type": "command",
        "command": "bash ~/.claude/plugins/my-plugin/on-start.sh"
      }
    ]
  }
}

This mirrors how the existing hooks work but runs exactly once at process init.

Alternative Solutions

Users must either send a first message or run /new to trigger the statusLine command. There is no way to pre-initialize plugin state from within Claude Code's own extension points.

Priority

Critical - Blocking my work

Feature Category

CLI commands and flags

Use Case Example

Driven by token exhaustion on Claude Pro in CLI show me the money $$ ref: https://github.com/msusol/claude-code-plugins

  • Status line plugins that should be active from the first prompt, not after the first message
  • Environment validation (check API keys, warn about config issues) before the session begins
  • Session logging / telemetry initialization
  • Loading dynamic config that should be available session-wide

Additional Context

  • The hook could receive a JSON payload with session metadata (model, session ID, etc.) via stdin, consistent with how other hooks work
  • A Shutdown counterpart would be a natural complement for cleanup

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING

claude-code - 💡(How to fix) Fix [FEATURE] add startup/session-init hook event to settings.json hooks