Skip to content
Productivity
Hook

Hooks

What mentor runs automatically, and when. A hook is a command Claude Code fires at a fixed moment, without you asking for it.

From plugin
mentor
133 skills2 commands1 hook
Install
> /plugin marketplace add hcsum/dont-let-me
> /plugin install mentor@dont-let-me

Ships with mentor. Installing the plugin gets these hooks.

What fires, and when

SessionStart

Fires once when a session begins, and again after a context compaction. It is where a plugin sets up its environment, or restores state the compaction dropped.

  • bash "${CLAUDE_PLUGIN_ROOT}/hooks/session-start.sh"
Read hooks/hooks.json

In the plugin's words

How mentor describes its own hook set.

Injects the mentor stance and the user's profile at the start of every session.

Where it lives

  • hooks/session-start.shRunsGitHub
    Read the script
    #!/usr/bin/env bash
    # Injects the mentor stance (+ the user's profile, if set up) into every session
    # as SessionStart additionalContext. Runs under Claude Code and Codex — both fire
    # SessionStart hooks with the same schema, and Codex sets CLAUDE_PLUGIN_ROOT for
    # compatibility. Never fails the session: any error exits 0 with no output, which
    # the harness treats as "no extra context".
    
    set -uo pipefail
    
    # Where the profile and todos live. An explicit $MENTOR_HOME wins; otherwise
    # reuse whichever directory already holds a profile, so an existing setup keeps
    # working when the plugin is installed in the other agent too.
    MENTOR_DIR="${MENTOR_HOME:-}"
    if [ -z "$MENTOR_DIR" ]; then
      for candidate in "$HOME/.mentor" "$HOME/.claude/mentor" "${CODEX_HOME:-$HOME/.codex}/mentor"; do
        if [ -r "$candidate/profile.md" ]; then
          MENTOR_DIR="$candidate"
          break
        fi
      done
    fi
    [ -n "$MENTOR_DIR" ] || MENTOR_DIR="$HOME/.mentor"
    
    PROFILE="$MENTOR_DIR/profile.md"
    STANCE="${CLAUDE_PLUGIN_ROOT:-$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)}/stance.md"
    
    [ -r "$STANCE" ] || exit 0
    
    body="$(cat "$STANCE")"
    body+=$'\n\n---\n\n# Mentor directory\n\nThis user\'s mentor directory is `'"$MENTOR_DIR"$'`. Its two files are the profile\nat `'"$PROFILE"$'` and the todo file at `'"$MENTOR_DIR"$'/todos.md`. Either may be a\nsymlink pointing elsewhere; follow it without comment. Use these paths, not any\ndefault mentioned elsewhere.'
    
    if [ -r "$PROFILE" ]; then
      body+=$'\n\n---\n\n# This user\'s profile\n\nThe user wrote this themselves during mentor setup. It is the yardstick for the\nstance above — if they ask to change a goal, edit a shortcoming, or add to the\ndon\'t-let-me list, edit the profile file directly.\n\n'
      body+="$(cat "$PROFILE")"
    else
      body+=$'\n\n---\n\n# No profile yet\n\nThis user has not set up a mentor profile, so the stance above has no yardstick\nand cannot function. At the next natural pause — not mid-task — mention once\nthat setting one up takes a few minutes: `/mentor:init` in Claude Code, or in\nCodex just ask to set up the mentor profile. Say it once per session at most.\nDo not nag, and do not invent goals for them in the meantime.'
    fi
    
    # JSON-encode safely: the profile contains quotes, newlines and likely non-ASCII.
    if command -v python3 >/dev/null 2>&1; then
      printf '%s' "$body" | python3 -c 'import json,sys; print(json.dumps({"hookSpecificOutput":{"hookEventName":"SessionStart","additionalContext":sys.stdin.read()}}))'
    else
      # Fallback: minimal escaper, good enough for the stance text alone.
      esc=$(printf '%s' "$body" | sed -e 's/\\/\\\\/g' -e 's/"/\\"/g' | awk '{printf "%s\\n", $0}')
      printf '{"hookSpecificOutput":{"hookEventName":"SessionStart","additionalContext":"%s"}}\n' "$esc"
    fi
    
    exit 0
    

Read the script before you install anything that runs on your machine. This is the one part of a plugin that acts without being asked.

Ships withmentor

Turn your agent into a mentor. It knows what you're working toward, and how you get in your own way.

Get the whole plugin
Stats
13
Stars
4
Forks
Maintained
Maintenance
Shell
Language
MIT
License
1mo ago
Last commit
1mo ago
Created

Repo: hcsum/dont-let-me