How to delete CodeBuddy and WorkBuddy session history, and what you lose

CodeBuddy keeps one <session-id>.jsonl conversation and its .meta.json per session under ~/.codebuddy/projects, and cleans expired sessions itself via SessionHistoryClean (cleanupPeriodDays defaults to 30)

CodeBuddy Code is Tencent's terminal agent, and it keeps one .jsonl conversation per session, with a .meta.json beside it, in the directory shape Claude Code uses: a directory per working directory under ${CODEBUDDY_CONFIG_DIR:-~/.codebuddy}/projects, named by the cwd with /, \ and : turned into - and the leading dash dropped, one file per session. CodeBuddy also cleans expired sessions itself: SessionHistoryClean runs on cleanupPeriodDays (defaults to 30 days) and removes sessions past their TTL, so the agent lists what is on disk, and deleting is removing files. WorkBuddy is the same agent under another name: workbuddy.cn and WorkBuddy AI write the same tree in their own homes, ~/.workbuddy and ~/.workbuddy-ai.

How to delete CodeBuddy sessions

The files and the sub-agent directory sit beside each other: <session-id>.jsonl is the conversation, <session-id>.meta.json its metadata, and <session-id>/subagents/agent-*.jsonl holds the turns its sub-agents ran. The session also leaves a <session-id>.file-rollback.ndjson sidecar beside them and the snapshots its edits made in ~/.codebuddy/file-history/<session-id>/ — the same set CodeBuddy's own delete removes. Removing the file alone leaves everything else on disk, so the one-session command names all of it.

# the project directories, one per working directory
ls ~/.codebuddy/projects

# one session — the conversation, its metadata file, the sub-agent
# transcripts, the rollback sidecar and the edits' file-history
# snapshots go together
rm -r ~/.codebuddy/projects/<folder>/<session-id>.jsonl \
      ~/.codebuddy/projects/<folder>/<session-id>.meta.json \
      ~/.codebuddy/projects/<folder>/<session-id> \
      ~/.codebuddy/projects/<folder>/<session-id>.file-rollback.ndjson \
      ~/.codebuddy/file-history/<session-id>

# every session of one project; the folder also holds any memory/ dir,
# which CodeBuddy's own cleanup conservatively skips and rm does not
rm -rf ~/.codebuddy/projects/<folder>

# the whole store
rm -rf ~/.codebuddy/projects

# WorkBuddy keeps its own sessions, in its own homes; other runtime data
# (sessions/, file-history/, history.jsonl) may sit beside projects/, so check
# the homes before assuming rm clears everything WorkBuddy has
rm -rf ~/.workbuddy/projects ~/.workbuddy-ai/projects

If CODEBUDDY_CONFIG_DIR is set the store moves with it, and WORKBUDDY_CONFIG_DIR does the same for WorkBuddy.

What is in the store

JSON Lines, one file per session. Each line is one item — a message with a role and text blocks, function_call and function_call_result for the tools, plus reasoning, titles and bookkeeping. CodeBuddy also cleans expired sessions itself: SessionHistoryClean runs on cleanupPeriodDays (defaults to 30 days) and removes sessions past their TTL. Timestamps are epoch milliseconds and every record carries the working directory. Sub-agent transcripts are the same shape, in the directory of the same name; deja reads each one as a session of its own under the parent, as its task, answer and edits; DEJA_INCLUDE_SUBAGENTS=1 takes the whole run and =0 leaves them out.

It is plain text and it is verbatim: whatever a command printed into the conversation is in the file. Treat the projects directory the way you treat your shell history. The format registry documents every field.

What you lose

The session leaves the agent's own history list, and what goes with it is the record: the commands, their output, and the edits, none of which are recoverable from a summary. deja reads these files — and WorkBuddy's — along with every other agent's on the machine, so a decision made here answers a question asked in Claude Code or Cursor. A session it has already indexed stays searchable after the file goes; only deja forget drops one on purpose.

In the screen bare deja opens, a deleted session sits under the Deleted tab, and R writes one back so codebuddy -r <id> finds it again, with the conversation but not the tool calls. WorkBuddy comes back refused: deja knows no command that reopens one. That is a reason to index before deleting, not a reason to keep gigabytes.

The same question for Claude Code · Where every agent stores history · The CodeBuddy format registry

Found this useful? Star deja-vu on GitHub.