Skip to content

Feature Request: Add session_start hook for session lifecycle #12110

Closed

Description

@BruceWae

Summary

Request to add a session_start hook to complement the existing session_completed hook, enabling actions to be triggered when a new session begins.

Use Case

I'm using a Continuous Learning MCP Server that stores user preferences and learned patterns across sessions. Currently:

  • ✅ session_completed hook exists - can save state when session ends
  • ❌ session_start hook missing - cannot auto-load state when session begins

This means the MCP can save memories, but there's no way to automatically read them at the start of a new session. Users must manually trigger the read operation.

Proposed Solution

Add session_start to the experimental hooks:

// Current (from opencode-sdk-go/config.go)
type ConfigExperimentalHook struct {
    FileEdited       map[string][]ConfigExperimentalHookFileEdited `json:"file_edited"`
    SessionCompleted []ConfigExperimentalHookSessionCompleted      `json:"session_completed"`
}

// Proposed
type ConfigExperimentalHook struct {
    FileEdited       map[string][]ConfigExperimentalHookFileEdited `json:"file_edited"`
    SessionCompleted []ConfigExperimentalHookSessionCompleted      `json:"session_completed"`
    SessionStart     []ConfigExperimentalHookSessionStart          `json:"session_start"` // NEW
}

Example Configuration

{
  "experimental": {
    "hooks": {
      "session_start": [
        {
          "command": ["node", "scripts/load-context.js"]
        }
      ]
    }
  }
}

Reference

Claude Code supports SessionStart hooks which enables this workflow. See: everything-claude-code hooks.json

Impact

This would enable:

  1. Auto-loading user preferences/context at session start
  2. Persistent memory across sessions
  3. Better integration with learning/memory MCP servers
  4. Parity with Claude Code's hook capabilities

Thank you for considering this feature!

Activity

  1. github-actions commented on Feb 4, 2026

    @github-actions
    Contributor

    This issue might be a duplicate of existing issues. Please check:

    Feel free to ignore if none of these address your specific case.

  2. github-actions commented on Apr 6, 2026

    @github-actions
    Contributor

    To stay organized issues are automatically closed after 90 days of no activity. If the issue is still relevant please open a new one.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions