How to delete Command Code session history, and what you lose

Each session is one JSONL file; remove the file, or the project folder for all of its sessions

Command Code keeps one transcript per session, grouped in a folder per project. deja delete does not cover Command Code yet, so you remove the files yourself.

Where the sessions are

~/.commandcode/projects/<encoded-cwd>/<session>.jsonl

Each .jsonl file is one session: a header line, then one line per message. <encoded-cwd> is a slug of the directory the session ran in.

How to delete one session

Close Command Code first so a running session cannot rewrite its file, then remove the transcript:

rm ~/.commandcode/projects/<encoded-cwd>/<session>.jsonl

To clear every session of one project, remove its folder:

rm -r ~/.commandcode/projects/<encoded-cwd>

What you lose

The conversation, the tool calls and results. Command Code cannot bring a deleted session back, and cmd --resume <id> no longer finds it unless you have a separate backup.

Keeping it searchable instead

deja reads Command Code sessions, alongside the other agents' histories, into one local index. Run deja index before deleting the files, and the history stays searchable in deja:

curl -fsSL https://raw.githubusercontent.com/vshulcz/deja-vu/main/install.sh | sh
deja index
deja "Command Code session about the refactor"

Indexing and search stay local, credentials are stripped, and deja forget removes a session from the index when you do want it gone. DEJA_COMMANDCODE_ROOT overrides the project root for deja's reads only, so set it to point deja at a copy or a backup of the tree.

Where every agent keeps its history · Memory for Command Code · The Command Code format

Found this useful? Star deja-vu on GitHub.