ferkakta.dev

Every AI session starts from zero. Mine doesn’t.

The first thing I do in every Claude Code session is the same thing I’d do if I woke up with amnesia in my own office. Where am I? What branch? What did I ship yesterday? What tickets moved overnight? Did someone create a new workflow I haven’t seen? Is there a live patch on the cluster that never made it into terraform?

The model doesn’t know any of this. Every session starts from zero. The context window is empty. The handoff docs exist but nobody reads them unless you make it a rule. The Jira board changed while you were asleep. The teammate who was blocked yesterday merged a PR at 3am and now the branch you were working on has conflicts.

I wrote a skill called session-start that runs before any work begins. Eight steps:

  1. Git state — fetch, prune stale remote-tracking branches, check for uncommitted work, report local branches that track deleted remotes from merged PRs
  2. Read all recent handoffs — not just the last one. I do up to eight sessions a day. Each handoff has completed items, open TODOs, harvest sections with blog material and bonbons. Read them all and respect the @done tags.
  3. Check work items across all projects — I work across multiple Jira projects. Query all of them, not just the main one. Check what moved in the last 24 hours.
  4. Check PRs across platforms — open PRs on GitHub and Bitbucket. Recent workflow failures.
  5. Workflow hygiene — detect new workflow files I haven’t reviewed. Flag the same workflow failing five times in a row. Flag runs without meaningful titles. Flag infra drift from live kubectl patches that never got baked into terraform.
  6. Pipeline state — for each in-progress ticket, trace it through: ticket created → branch exists → PR open → merged → deployed.
  7. Summarize — dense orientation: branch, stale branches, handoff highlights, active tickets, open PRs, failures, unharvested items.
  8. Load briefing skills — hand off to the morning paper for Slack, meeting transcripts, and the narrative layer.

Session-start provides the facts. The morning paper provides the narrative. Together they answer “what happened while I was away” and “what should I do first” before I’ve typed a single command.

The skill is tool-agnostic — it describes what to check and why, not which binary to use. My setup calls git, jira, gh, and kubectl. Yours might use MCP servers for Jira and Slack. The methodology is the same.

I also wired a SessionStart hook — a lightweight shell script that fires automatically when Claude Code starts. It prints the current time, the branch, and the latest handoff filename. That’s enough for the model to self-orient even if the full skill isn’t invoked. In testing, the hook fired and the model went straight to the handoff without being told. The skill is the full methodology. The hook is the nudge that makes it happen.

Claude Code has nine hook events including SessionStart, UserPromptSubmit, Stop, and PreCompact. Most people I’ve talked to have heard of hooks but never investigated them. The docs are here. Here’s how I wired mine.

The hook script:

#!/usr/bin/env bash
NOW=$(date '+%Y-%m-%d %H:%M %Z')
REPO=$(basename "$CLAUDE_PROJECT_DIR" 2>/dev/null || echo "unknown")
BRANCH=$(git -C "${CLAUDE_PROJECT_DIR:-.}" branch --show-current 2>/dev/null || echo "detached")
HANDOFF=$(ls -t "${CLAUDE_PROJECT_DIR:-.}"/docs/HANDOFF-*.md 2>/dev/null | head -1 | xargs basename 2>/dev/null || echo "none")

echo "Session started at $NOW"
echo "Repo: $REPO | Branch: $BRANCH"
echo "Latest handoff: $HANDOFF"

The config in ~/.claude/settings.json:

{
  "hooks": {
    "SessionStart": [
      {
        "hooks": [
          {
            "type": "command",
            "command": "/path/to/session_start_hook.sh"
          }
        ]
      }
    ]
  }
}

Put the script anywhere. I keep mine in ~/Sites/claude-code-tools/hooks/ but it could be ~/.claude/hooks/ or /usr/local/bin/ or your desk drawer. The command field in settings.json is an absolute path to any executable. Make it chmod +x, point the config at it, done.

The script runs on every session start. Its output lands in the model’s context before your first message. The model sees the time, the branch, and the handoff path, and self-orients from there.

I also added a UserPromptSubmit hook that prints the current time on every message — so the model never loses track of what time it is during long sessions. If you’ve been away more than 30 minutes, it includes the gap so the model knows you just came back.

The second skill in my claude-skills repo. The first was morning-paper.

#platformengineering #ai #productivity #design