feat(altimate-code): SessionStart hook injecting skill-consultation directive#15
feat(altimate-code): SessionStart hook injecting skill-consultation directive#15sahrizvi wants to merge 1 commit into
Conversation
…irective
Adds a SessionStart hook to the altimate-code plugin. On session boot,
the handler outputs a hookSpecificOutput JSON with additionalContext
text that directs the agent to consult Skills before reading files on
data-engineering tasks, with explicit mention of altimate-code for
warehouse / lineage / cross-DB work.
Files added:
skills/altimate-code/hooks/hooks.json — hook declaration
skills/altimate-code/hooks-handlers/session-start.sh — handler shell script
Validated locally:
- hooks.json parses as valid JSON
- handler executes cleanly and outputs 952 chars of valid JSON
- claude --print --include-hook-events smoke produces 4 hook events,
SessionStart fires correctly, additionalContext flows into session.
| #!/usr/bin/env bash | ||
| # SessionStart hook for the altimate-code skill. Injects a one-shot directive | ||
| # into the session's system prompt telling the agent to consult Skills before | ||
| # reading files when the task is data-engineering shaped. | ||
| cat <<'EOF' | ||
| { | ||
| "hookSpecificOutput": { | ||
| "hookEventName": "SessionStart", | ||
| "additionalContext": "You have access to data-engineering skills via plugins: dbt-skills (refactoring, creating, testing, debugging, documenting, migrating dbt models, incremental models), snowflake-skills (finding expensive queries, optimizing query by id, optimizing query text), and altimate-code (warehouse access, column-level lineage, dbt builds against real warehouses, cross-database operations, multi-warehouse data parity). When the user's task involves dbt models, SQL refactoring, data warehouse work, query optimization, or cross-database operations, INVOKE THE Skill TOOL FIRST — before reading files, writing code, or starting work directly. Prefer altimate-code:altimate-code when the task needs live warehouse access, column-level lineage, dbt builds against a real warehouse, profiling, cost attribution, or cross-database migration. Use Skill consultation as your first action on every data-engineering task; the skill's body will tell you how to proceed." |
There was a problem hiding this comment.
When and how does it get called?
There was a problem hiding this comment.
there needs to be some installation which adds to the skills right
There was a problem hiding this comment.
When/how it's called: It's a Claude Code SessionStart hook. skills/altimate-code/hooks/hooks.json registers it, so Claude Code's harness runs bash ${CLAUDE_PLUGIN_ROOT}/hooks-handlers/session-start.sh automatically on every session start (new chat, /clear, /resume). The script prints a JSON envelope on stdout; Claude Code parses hookSpecificOutput.additionalContext and injects that string into the session's system prompt for that one session. Nothing in this repo invokes it directly — the harness does, on the user's machine, once the plugin is installed.
Installation: Yes — .claude-plugin/marketplace.json declares three plugins (dbt-skills, snowflake-skills, altimate-code). A user installs the altimate-code plugin via:
/plugin marketplace add AltimateAI/data-engineering-skills
/plugin install altimate-code@data-engineering-skills
That registers the SessionStart hook and makes the altimate-code skill discoverable via the Skill tool — no manual wiring needed.
One caveat: this is a two-layered install. The plugin install adds the skill + hook. The actual altimate-code CLI binary that the skill delegates to is a separate npm package (npm install -g altimate-code) — the skill body gates on command -v altimate-code and surfaces the install command if missing (see SKILL.md lines 10-30). We intentionally don't auto-install the CLI because users may want a specific version, a different package manager, or to opt out.
Did you mean the CLI should be installed as part of the plugin install? Happy to wire that up if so — though it'd mean shipping a PostInstall-style hook that runs npm on the user's machine, which is a bigger behavior change worth discussing first.
Summary
Adds a
SessionStarthook to thealtimate-codeplugin. On every new Claude Code session, the handler emits ahookSpecificOutputJSON whoseadditionalContexttext directs the agent to consult Skills before reading files when the task is data-engineering-shaped, with explicit mention ofaltimate-code:altimate-codefor warehouse / lineage / cross-DB work.Files added:
skills/altimate-code/hooks/hooks.json— hook declarationskills/altimate-code/hooks-handlers/session-start.sh— handler shell scriptWhat this fixes
Without the hook, plugin skills auto-fire reliably on greenfield prompts (
Create a model called X…,Migrate the X stored procedures…) but not on existing-file-refactor prompts likeThe X model is incomplete. Right now it joins… It's missing…. On those, the model goes straight toReadand never enumerates Skills.The hook fixes that by injecting a session-prompt directive that pushes the model to invoke the Skill tool first on any DE-shaped task.
Measured impact (controlled experiment, claude-sonnet-4-6, plugin_passive config, 5-prompt × 5-trial sweep)
mart_patient_360(HIPAA refactor of incomplete model)eastman(MSSQL→Snowflake migration)intercom003(model creation)ae006(model creation)asana003(refactor existing models)Zero regression on the prompts that already fired skills. The hook's
additionalContextis bit-for-bit identical to what was measured.Companion PR
#14— pushieraltimate-codeskill description (targeted to that one skill, not full-spectrum). Designed to compound with this hook for both higher fire rate AND higher altimate-code routing rate. They can ship independently.How the hook works mechanically
hooks/hooks.jsondeclares aSessionStarthook pointing at${CLAUDE_PLUGIN_ROOT}/hooks-handlers/session-start.sh.hookSpecificOutput.additionalContextcontaining the directive text.The directive content (~950 chars):
Test plan
hooks.jsonparses as valid JSON.additionalContext).claude --print --include-hook-events <any prompt>smoke shows thehook_startedandhook_responseevents forSessionStart. The cached plugin returns to a clean state after the smoke completes.claude --print --output-format stream-json --include-hook-events --no-session-persistence "say hi" < /dev/null | grep hook.Acknowledged limitations
additionalContextinjected at every session start. Small but nonzero per-session overhead. Justified by the fire/delegation lift..dbt_project.ymlorprofiles.ymlis in cwd) — out of scope for this PR.