Back to skills
SkillHub ClubShip Full StackFull Stack

get-session-id

Imported from https://github.com/cowwoc/styler.

Packaged view

This page reorganizes the original catalog entry around fit, installability, and workflow context first. The original raw source lives below.

Stars
4
Hot score
81
Updated
March 19, 2026
Overall rating
C3.4
Composite score
3.4
Best-practice grade
A85.2

Install command

npx @skill-hub/cli install cowwoc-styler-get-session-id

Repository

cowwoc/styler

Skill path: .claude/skills/get-session-id

Imported from https://github.com/cowwoc/styler.

Open repository

Best for

Primary workflow: Ship Full Stack.

Technical facets: Full Stack.

Target audience: everyone.

License: Unknown.

Original source

Catalog source: SkillHub Club.

Repository owner: cowwoc.

This is still a mirrored public skill entry. Review the repository before installing into production workflows.

What it helps with

  • Install get-session-id into Claude Code, Codex CLI, Gemini CLI, or OpenCode workflows
  • Review https://github.com/cowwoc/styler before adding get-session-id to shared team environments
  • Use get-session-id for development workflows

Works across

Claude CodeCodex CLIGemini CLIOpenCode

Favorites: 0.

Sub-skills: 0.

Aggregator: No.

Original source / Raw SKILL.md

---
name: get-session-id
description: Session ID is automatically injected at SessionStart via echo-session-id.sh hook
allowed-tools: None (automatic hook)
---

# Get Session ID Skill

**Purpose**: The session ID is automatically available at session start via the `echo-session-id.sh` hook.

**How It Works**:
- The `echo-session-id.sh` hook is registered for `SessionStart` events
- When the session starts, the hook automatically injects the session ID into context
- The session ID appears in system reminders as: `✅ Session ID: {uuid}`
- No manual invocation required

**When to Use This Skill**:
- The session ID is already available - just look for it in the SessionStart system reminders
- Use this skill documentation to understand how the session ID is provided
- Reference when coordinating with hooks that use session IDs

## How Session IDs Work

Claude Code assigns a unique session ID (UUID v4) to each conversation session. This ID is used for:
- Naming conversation history files: `/home/node/.config/projects/-workspace/{session-id}.jsonl`
- Session-specific TODO list tracking
- Hook coordination across tools
- Task ownership in multi-instance scenarios

## Automatic Injection via SessionStart Hook

The `echo-session-id.sh` hook is registered in `.claude/settings.json` for `SessionStart` events.

**How it works**:
1. Claude Code invokes SessionStart hooks when the session starts OR resumes after compaction
2. `echo-session-id.sh` reads stdin JSON from Claude Code
3. Extracts `session_id` field using `jq`
4. Outputs `hookSpecificOutput` with formatted session ID
5. Claude Code injects this into context as a system reminder

**Output injected into context**:
```
✅ Session ID: b6933609-ab67-467e-af26-e48c3c8c129e
```

## Usage Examples

### Example 1: Get Current Session ID

The session ID is automatically available in SessionStart system reminders. Look for:

```
✅ Session ID: b6933609-ab67-467e-af26-e48c3c8c129e
```

No manual execution needed - it's already in your context!

### Example 2: Use Session ID for File Operations

After getting the session ID, you can use it to:

```bash
# Access conversation history
cat /home/node/.config/projects/-workspace/{session-id}.jsonl | jq -r 'select(.type == "message")'

# Find session-specific TODO list
find /home/node/.config/todos/ -name "*${SESSION_ID}*"

# Check task ownership
jq -r --arg sid "$SESSION_ID" 'select(.session_id == $sid)' /workspace/tasks/*/task.json
```

## Integration with Hooks

The session ID from this skill matches the session ID that hooks receive via stdin:

```bash
# Hooks can use echo-session-id.sh to get formatted output
SESSION_OUTPUT=$(cat | /workspace/.claude/hooks/echo-session-id.sh)
echo "$SESSION_OUTPUT" | jq -r '.hookSpecificOutput'

# Or extract directly from stdin JSON
SESSION_ID=$(cat | jq -r '.session_id')
```

Both methods read from the same stdin JSON provided by Claude Code.

## Related

- **echo-session-id.sh**: Script that outputs session ID from Claude Code stdin JSON
- **get-history**: Skill that uses session ID to access conversation
- **hook-logger.sh**: Library that uses session ID for session-specific logging

## Implementation Details

The `echo-session-id.sh` script:
- Reads JSON from stdin (provided by Claude Code)
- Extracts `session_id` field using `jq`
- Outputs JSON with `hookSpecificOutput` field
- Requires `jq` to be installed (standard in Claude Code environment)

**Script Location**: `/workspace/.claude/hooks/echo-session-id.sh`
get-session-id | SkillHub