Auto-Context — auto-context.py¶
Runs on every UserPromptSubmit. Reads the prompt from stdin JSON, matches against a regex/project table, emits a small markdown pointer-list for the matched projects. Silent when nothing matches.
How it decides¶
Keyword → project mapping is defined in the script itself (PROJECTS list). Each entry:
- regex pattern (case-insensitive, word-boundary anchored)
- project label
- list of file/dir pointers
Top 3 matches surface. Skipped on prompts shorter than 4 chars.
Current project coverage¶
Nova Design, JustinWieb-VR, Home Assistant, Frigate/Cameras, Business Second Brain, justinandkrystal.com, Plex/Media, n8n, Greg/OpenClaw, Google Drive, Wiebelhaus Enterprises, Web Builder mode, Context API, Wellness pollers, Telegram bot, Forge fleet platform.
Edit when¶
- A new project is added — append a regex+label+pointers entry to
PROJECTSinscripts/hooks/auto-context.py - A project is renamed or moved
- You notice the hook firing on false-positive keywords (tighten the regex)
Design rules¶
- Never crashes (wrapped in try/except, swallows all exceptions)
- Silent on non-project prompts (most prompts)
- Emits pointers not contents — Claude decides which to Read
- Caps at 3 matches per prompt to avoid context bloat
Files¶
scripts/hooks/auto-context.py— the hook.claude/settings.local.json→hooks.UserPromptSubmitwires it up (chained after prompt-counter.sh)