[FEATURE] Claude Code Web - restart Claude on SessionStart end.

Resolved 💬 4 comments Opened Mar 2, 2026 by mattgi Closed Mar 30, 2026

Preflight Checklist

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

Problem Statement

In Claude Code Web, there is a SessionStart hook that allows us to run a script.

We wish to use this feature to copy .claude configuration files from a separate repository into the current environment's project or root .claude folder.

The copy workflow performs as expected; however, the rules/hooks are not loaded in context because the Claude session's context is already prepared before SessionStart ends.

Please offer a way to have Claude restart (or refresh context) after SessionStart to pick up any newly provided files.

Alternatively, please document other ways to achieve this same outcome.

Proposed Solution

Run SessionStart to completion before starting the session.

Add a new hook, PreSessionStart hook (or EnvironmentLoaded) to accommodate this workflow

Alternative Solutions

Tried copying to project and root .claude folders.
Prefixing the first prompt in Claude Code web with "reload your rules and then ...". This works for basic rules, but not things like hooks.

Priority

Critical - Blocking my work

Feature Category

Configuration and settings

Use Case Example

This allows enterprises with multiple repos to manage their core rules and contribution guidelines in a separate repository. This enables them to be maintained without the ceremony typical of product-focused repositories but also in a central location for all rules that apply to every repo.

product repo:
.claude/settings.json

{
  "hooks": {
    "SessionStart": [
      {
        "matcher": "startup",
        "hooks": [
          {
            "type": "command",
            "command": "\"$CLAUDE_PROJECT_DIR\"/.claude/sync-claude.sh"
          }
        ]
      }
    ]
  }
}

sync-claude.sh:

#!/bin/bash
# .claude/sync-claude.sh

AGENT_REPO="https://github.com/{org}/{repo}.git"
TMPDIR=$(mktemp -d)

# Shallow clone just the .claude folder
git clone --depth 1 --filter=blob:none --sparse "$AGENT_REPO" "$TMPDIR/agent"
cd "$TMPDIR/agent"
git sparse-checkout set .claude

# Copy rules to user-level ~/.claude, creating subdirs as needed
cd "$TMPDIR/agent/.claude"
find . -type f | while read -r file; do
  dest="$HOME/.claude/$file"
  if [ ! -f "$dest" ]; then
    mkdir -p "$(dirname "$dest")"
    cp "$file" "$dest"
  fi
done

# Cleanup
rm -rf "$TMPDIR"

exit 0

claude repo ({org}/{repo}.git)

  • a .claude folder with all of your required claude skills, hooks, rules, etc.

View original on GitHub ↗

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