Skip to main content

claude-code-slug

Claude Code names each session directory under ~/.claude/projects/ after the working directory the session ran in, slugified: every character that is not ASCII alphanumeric becomes exactly one -. No squeezing of runs, no case folding, no exemption for . or _.

This package is that one fact, reverse-engineered and pinned by tests, so that tools which have to agree about it can share an implementation instead of each carrying a copy of the regex.

Install

uv tool install claude-code-slug   # the commands
uv add claude-code-slug            # the library

Use

$ claude-path /home/you/src/my.project
-home-you-src-my-project
$ claude-slug "Notes: 2026-08-10"
Notes--2026-08-10
>>> from claude_code_slug import path_slug, slug
>>> slug("prototype.chatfs/docs")
'prototype-chatfs-docs'
>>> path_slug("/home/you/src")
'-home-you-src'

claude-slug has no path semantics at all, which makes it safe on titles. claude-path adds them: it makes the path absolute and normalizes it lexically first — realpath -Lm, so symlinks are not resolved and the path need not exist — because the scheme has no relative form. A directory reached through a symlink encodes under the name you reached it by.

The mapping is not invertible

- is the image of /, of ., and of itself, so prototype.chatfs/docs and prototype-chatfs-docs produce the same name. To recover the directory a session ran in, read the cwd field from its JSONL — never decode the directory name that holds it.

The encoding is frozen

Anything that has already named data with this function — session directories, cache keys, relocated git stores — is orphaned by an improvement to it, not fixed by one. If Claude Code's scheme changes, that is a new function, not an edit to this one.

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

claude_code_slug-0.1.0.tar.gz (8.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

claude_code_slug-0.1.0-py3-none-any.whl (9.2 kB view details)

Uploaded Python 3

File details

Details for the file claude_code_slug-0.1.0.tar.gz.

File metadata

  • Download URL: claude_code_slug-0.1.0.tar.gz
  • Upload date:
  • Size: 8.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.12.3 {"installer":{"name":"uv","version":"0.12.3","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for claude_code_slug-0.1.0.tar.gz
Algorithm Hash digest
SHA256 acfa9b7dc9e9d2534bdef60c2e9ecd65588c14f48977a3c52961a21e0524c24d
MD5 5194a1014d2386561491d2eda8ef5bd0
BLAKE2b-256 d7bc796cdcc2c8559d268d1baa7956f7d27058cbb1b90a7cfaf39761f3d891cd

See more details on using hashes here.

File details

Details for the file claude_code_slug-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: claude_code_slug-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 9.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.12.3 {"installer":{"name":"uv","version":"0.12.3","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for claude_code_slug-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 1511dee26a2a4a0088fc90260b945cb164232d7c8e542579b2b5bb3c56fd860e
MD5 a8e99d232dd190b40eff33bfa4fb8ddf
BLAKE2b-256 7716bc2344be2220df956b2c818ac73646952f3a4a1af579598fc07c9ce702ef

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page