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.

Release files for claude-code-slug 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for claude-code-slug 0.1.0
File Size Uploaded
claude_code_slug-0.1.0.tar.gz 8.2 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for claude-code-slug 0.1.0
File Interpreter ABI Platform
claude_code_slug-0.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 17.4 kB

Release files / claude_code_slug-0.1.0.tar.gz

Download URL claude_code_slug-0.1.0.tar.gz
Size 8.2 kB
Tags Source
SHA-256 checksum
How to use checksums
acfa9b7dc9e9d2534bdef60c2e9ecd65588c14f48977a3c52961a21e0524c24d
BLAKE2b-256 checksum
How to use checksums
d7bc796cdcc2c8559d268d1baa7956f7d27058cbb1b90a7cfaf39761f3d891cd
Upload date
Uploaded using Trusted Publishing?
What is 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}

Release files / claude_code_slug-0.1.0-py3-none-any.whl

Download URL claude_code_slug-0.1.0-py3-none-any.whl
Size 9.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
1511dee26a2a4a0088fc90260b945cb164232d7c8e542579b2b5bb3c56fd860e
BLAKE2b-256 checksum
How to use checksums
7716bc2344be2220df956b2c818ac73646952f3a4a1af579598fc07c9ce702ef
Upload date
Uploaded using Trusted Publishing?
What is 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}

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page