get-session-id

Inject the active Claude Code session ID into runtime context at session start via hook.

4|Updated Sep 25, 2025
One-click install
npx skills add https://github.com/cowwoc/styler --skill get-session-id
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: get-session-id
Source: https://github.com/cowwoc/styler/tree/main/.claude/skills/get-session-id
Command: npx skills add https://github.com/cowwoc/styler --skill get-session-id

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires jq.

What problem does it solve?

Many AI agent tasks, hooks, and logging mechanisms require the current session's unique ID for file naming, context management, or task tracking. Manually finding or passing this ID across different parts of a workflow can be cumbersome, error-prone, and interrupt the flow of automation. This Skill ensures the ID is always available.

Core Features & Use Cases

  • Automatic Injection: The session ID is automatically injected into the conversation context at SessionStart via a hook, requiring no manual invocation or user input.
  • Seamless Integration: Provides the session ID in a standardized format (✅ Session ID: {uuid}), ready for immediate use by other skills, scripts, and hooks.
  • Context Management: Enables session-specific file operations, logging, and task tracking, ensuring data isolation and relevance across complex AI workflows.
  • Use Case: A logging hook needs to create a session-specific log file. Instead of requiring the user or agent to provide the session ID, this Skill ensures the ID is already available in the context, allowing the hook to automatically name its log file correctly (e.g., log-{session-id}.txt), saving manual effort and ensuring consistency.

Quick Start

Look for the system reminder "✅ Session ID: {uuid}" in the SessionStart context; no direct invocation is needed.

Frequently Asked Questions about get-session-id

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I automatically inject a session ID into my workflow context?

The session ID is automatically injected at SessionStart via a hook without manual invocation. A system reminder displays the formatted session ID (✅ Session ID: {uuid}) in your context, ready for immediate use by scripts, hooks, and logging mechanisms.

What is a session ID and why do I need it for automation tasks?

A session ID is a unique identifier assigned to each Claude Code session. It enables file naming, history tracking, and task coordination across hooks and workflows, ensuring data isolation and consistency when automating complex agent operations.

How can I use the session ID for logging and file operations?

Once the session ID appears in context, hooks and scripts can extract it with jq to dynamically name log files and track outputs (e.g., log-{session-id}.txt). This eliminates manual ID passing and ensures session-specific file organization automatically.

Does this Skill work with existing hooks and automation frameworks?

Yes. The Skill registers the echo-session-id.sh hook for SessionStart, reads stdin JSON, and outputs a formatted reminder injected into context. It integrates seamlessly with any hook or script that needs the session ID for context management.

Do I need to invoke this Skill manually or configure anything?

No manual invocation is required. The Skill automatically activates at SessionStart. Simply look for the session ID reminder in your context; the hook handles all setup and injection internally.