Skip to content

abtop did not see my claude code sessions #135

@des256

Description

@des256

abtop didn't see my Claude Code sessions. I had it fixed, here is what was changed. Maybe it's useful:

abtop (v0.4.8) showed no sessions despite Claude Code running.

Root cause

abtop discovers sessions by reading ~/.claude/sessions/<pid>.json — a per-process
JSON file containing pid, sessionId, cwd, and startedAt. Older Claude Code
versions wrote these files automatically. Claude Code 2.x (standalone ELF binary,
~/.local/share/claude/versions/2.1.42) never does — it only writes to
~/.claude/projects/<project>/<uuid>.jsonl.

Two compounding issues:

  1. ~/.claude/sessions/ didn't exist, so is_claude_config_root() returned false
    (abtop requires both sessions/ and projects/ to treat a directory as a
    valid Claude config root — see graykode/abtop#126).
  2. Even after creating the directory, it was empty — so find_session_file_for_pid()
    found nothing and returned no sessions.

Fix

1. Create the missing directory (~/.claude/sessions/)

Required for abtop's config-root detection to pass.

2. Add ~/.config/abtop/config.toml

claude_config_dirs = ["~/.claude"]

Belt-and-suspenders explicit config in case auto-discovery changes again.

3. SessionStart hook: ~/.pilot/hooks/abtop_session_register.py

Writes the expected session file on every Claude Code startup. Walks up the
/proc tree from the hook subprocess to find the claude ancestor PID, then
writes ~/.claude/sessions/<pid>.json with the correct structure. Also cleans
up stale files for processes that no longer exist.

Registered in ~/.claude/settings.json under SessionStart / startup, async.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions