SessionStart

SessionStart is a hook for coding agents from jameslowman/planning-with-james. Its token cost is not measured, scanned A, original, MIT.

A session and compaction hook for a project knowledge base. The knowledge base is a collection of notes about a codebase that can be checked when a session starts or is shortened.

In plain words
What is it for?
Use it to check project knowledge at session start, report how many commits behind it is, and run related update or creation commands when needed.
Why use it?
It warns when the knowledge notes are missing or out of date compared with the project's latest commits.

Hook

Part of the planning-with-james plugin — 7 skills, 2 hooks shipped together

One of 2 entries in hooks.json — they are configured in one file and arrive together.

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add hooks/jameslowman/planning-with-james/session-start
Clone the repo
git clone --depth 1 https://github.com/jameslowman/planning-with-james

Or install planning-with-james, the plugin that ships this one along with the rest of its 7 skills, 2 hooks.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for SessionStart

README.md
[![agentmods](https://agentmods.dev/badge/hooks/jameslowman/planning-with-james/session-start.svg)](https://agentmods.dev/hooks/jameslowman/planning-with-james/session-start)
Your own site
<a href="https://agentmods.dev/hooks/jameslowman/planning-with-james/session-start"><img src="https://agentmods.dev/badge/hooks/jameslowman/planning-with-james/session-start.svg" alt="Measured on agentmods" height="20"></a>
Per session not measured What this adds to a session before it is invoked.
When invoked not measured Not applicable: nothing here is loaded into a session.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Security

Grade A, and why

SessionStart scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 3d ago.

A static scan of the commands this hook runs, not an audit. A hook is shell that executes on your machine at the event it names, which is why every command in it is printed with what was found.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

hooks/hooks.json · 24 lines

How it starts

The opening of the file, as written. The whole thing — 24 lines — stays where its author put it; the contents beside it link to each section on GitHub.

{
  "SessionStart": [
    {
      "matcher": "",
      "hooks": [
        {
          "type": "command",
          "command": "bash -c 'KNOWLEDGE_DIR=\".claude/planning-with-james/knowledge\"; if [ ! -d \"$KNOWLEDGE_DIR\" ]; then echo \"{\\\"message\\\": \\\"Knowledge base not found. Run /planning-with-james:create-knowledge to index this codebase.\\\"}\"; else OVERVIEW=\"$KNOWLEDGE_DIR/_overview.md\"; if [ -f \"$OVERVIEW\" ]; then LAST_COMMIT=$(grep -oP \"(?<=last_commit: )[a-f0-9]+\" \"$OVERVIEW\" 2>/dev/null || echo \"\"); CURRENT_COMMIT=$(git rev-parse HEAD 2>/dev/null || echo \"\"); if [ -n \"$LAST_COMMIT\" ] && [ -n \"$CURRENT_COMMIT\" ] && [ \"$LAST_COMMIT\" != \"$CURRENT_COMMIT\" ]; then COMMIT_COUNT=$(git rev-list --count \"$LAST_COMMIT\"..\"$CURRENT_COMMIT\" 2>/dev/null || echo \"unknown\"); echo \"{\\\"message\\\": \\\"Knowledge base is $COMMIT_COUNT commits behind. Consider running /planning-with-james:update-knowledge.\\\"}\"; fi; fi; fi'",
          "timeout": 10
        }
      ]
    },
    {
      "matcher": "compact",
      "hooks": [
        {
          "type": "command",
          "command": "bash -c 'SESSION_ID=$(jq -r \".session_id // empty\" 2>/dev/null); REG=\".claude/planning-with-james/plans/_registry.json\"; KNOWLEDGE=\".claude/planning-with-james/knowledge/_overview.md\"; MSG=\"\"; if [ -f \"$REG\" ] && [ -n \"$SESSION_ID\" ]; then ACTIVE=$(jq -r \".sessions[\\\"$SESSION_ID\\\"].active_plan // empty\" \"$REG\" 2>/dev/null); if [ -n \"$ACTIVE\" ]; then PDIR=$(jq -r \".plans[\\\"$ACTIVE\\\"].path // empty\" \"$REG\" 2>/dev/null); if [ -n \"$PDIR\" ] && [ -f \"$PDIR/context_scratch_pad.md\" ]; then MSG=\"[POST-COMPACT RECOVERY] You are using the planning-with-james plugin. Active plan: $ACTIVE. Read $PDIR/context_scratch_pad.md to restore context. All paths are relative to repo root, not ~/.claude/.\"; fi; fi; fi; if [ -z \"$MSG\" ] && [ -f \"$KNOWLEDGE\" ]; then MSG=\"[POST-COMPACT REMINDER] You are using the planning-with-james plugin. Know

Read the full file on GitHub · 24 lines

Same file

What else hooks.json configures

This page is one entry in a file that holds 2. Installing the file brings all of them; each is measured and scanned on its own page.

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 3d ago First seen · 24 lines scan A 0804fc95ac04

Subscribe to this mod's changes

SessionStart is a hook published in the GitHub repository jameslowman/planning-with-james (2 stars, last pushed 4mo ago), licensed MIT. Its token cost is not measured: a hook is shell that never enters the context. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.