sessionStart hook output is accepted and merged, but the injected context does not reach Agent Window

Where does the bug appear (feature/product)?

Cursor IDE

Describe the Bug

I’m testing a minimal local Cursor plugin with a sessionStart hook and no external dependencies.

Setup:

  • local plugin in ~/.cursor/plugins/local/test-sessionstart-plugin
  • user hook config in ~/.cursor/hooks.json
  • fresh empty workspace
  • Cursor 3.0.12 on macOS

The sessionStart hook returns valid JSON with injected context:

{
“additional_context”: “<test_memories>Use pytest and Vitest. Prefer minimal diffs.</test_memories>”
}

Cursor appears to accept it:

  • the plugin loads in Settings > Plugins
  • the hook appears in Settings > Hooks
  • the hook log shows:
    • Hook step requested: sessionStart
    • Hook 1 executed successfully and returned valid response
    • Merged 1 valid response(s) for step sessionStart

But Agent Window does not use the injected context.

Steps to Reproduce

  1. Create a local plugin at:
    ~/.cursor/plugins/local/test-sessionstart-plugin

  2. Add this plugin manifest at:
    ~/.cursor/plugins/local/test-sessionstart-plugin/.cursor-plugin/plugin.json

{
“name”: “test-sessionstart-plugin”,
“displayName”: “Test SessionStart Plugin”,
“version”: “0.0.1”,
“description”: “Minimal local plugin repro for sessionStart context injection.”,
“author”: { “name”: “Local Repro” },
“license”: “MIT”,
“category”: “developer-tools”,
“tags”: [“hooks”, “testing”]
}

  1. Add this hook script at:
    ~/.cursor/plugins/local/test-sessionstart-plugin/scripts/session_start.py

#!/usr/bin/env python3
import json
print(json.dumps({
“additional_context”: “<test_memories>Use pytest and Vitest. Prefer minimal diffs.</test_memories>”
}))

  1. Add this user hooks config at:
    ~/.cursor/hooks.json

{
“version”: 1,
“hooks”: {
“sessionStart”: [
{
“command”: “python3 "/Users/dikshantpradhan/.cursor/plugins/local/test-sessionstart-plugin/scripts/session_start.py"”,
“timeout”: 15
}
]
}
}

  1. Fully quit and reopen Cursor.

  2. Confirm:

    • the plugin appears in Settings > Plugins
    • the hook appears in Settings > Hooks
  3. Open a fresh empty workspace.

  4. Start a new Agent Window session.

  5. Ask:
    “What testing frameworks and coding preferences should you follow?”

Expected Behavior

The model should answer from the injected sessionStart context and mention pytest, Vitest, and minimal diffs.

Screenshots / Screen Recordings

Operating System

MacOS

Version Information

IDE: Cursor 3.0.12

For AI issues: which model did you use?

Default model in Agent Window

For AI issues: add Request ID with privacy disabled

Relevant docs / references:

The hook runs and Cursor logs the returned JSON as valid and merged, but the Agent Window answer still behaves as if the context was never injected.

This looks like either:

  • a runtime bug in how sessionStart additional_context is surfaced to Agent Window, or
  • a docs/runtime mismatch about whether sessionStart additional_context is supposed to be model-visible there.

Does this stop you from using Cursor

No - Cursor works, but with this issue

Hey, thanks for the detailed report with clear repro steps.

This is a confirmed bug. In the IDE, the sessionStart hook runs async before the composer handle is fully created, so additional_context can get silently dropped even if the log says “merged successfully”. Basically, it’s a race condition between the hook finishing and the composer being ready to accept context.

The ironic part is that sessionStart was recommended as a workaround for a similar bug with postToolUse additional_context Native postToolUse hooks accept and log additional_context successfully, but the injected context is not surfaced to the model, but as you can see, the context delivery path is also broken for sessionStart in the IDE.

I’ve passed this to the team. No timelines yet, but your report helps with prioritization.

As a temporary workaround, you can try duplicating the context in a .cursor/rules file if the instructions are fairly static. Not ideal, but it should at least get your preferences through to the model.

1 Like