How to delete Qwen Code chat history, and what you lose
One JSONL file per session; remove it together with its sub-agent logs
Qwen Code writes every session as a JSONL file under its projects directory. Settings live in the same ~/.qwen folder but are not history, so delete files inside projects only.
Where the sessions are
~/.qwen/projects/<encoded-project>/chats/<sessionId>.jsonl ~/.qwen/projects/<encoded-project>/subagents/<sessionId>/agent-<id>.jsonl
The project directory is the working directory's path with slashes and hyphens encoded the way Claude Code does it, so /home/me/my-app becomes a name like -home-me-my-app. The file name in chats/ is the session id that qwen -r <id> takes. A sub-agent's log sits beside the chats, in a folder named for its parent session.
How to delete one session
Quit Qwen Code first, then remove the session file and its sub-agent folder:
cd ~/.qwen/projects/<encoded-project> rm chats/<sessionId>.jsonl rm -r subagents/<sessionId>
The second command fails harmlessly when the session never started a sub-agent. To clear a whole project, remove its chats and subagents directories; to clear everything, remove those two in every project directory. Do not remove ~/.qwen itself: settings.json and your MCP and hook wiring are there.
Delete one session with deja
If deja is installed, run deja last and copy the session id. Preview the deletion, then run it from a terminal and confirm:
deja delete <id> --dry-run deja delete <id>
The dry run lists the paths without removing them. After confirmation, deja removes those paths and forgets its own copy of the session. This cannot be undone. It also removes the session's subagents/<id> directory, if present. deja refuses deletion if a file or directory to be removed was written in the last 5 minutes; end the session and wait before deleting it.
What you lose
The session file is the only record of what Qwen Code was asked, which commands and edits it ran and why. Deleting it means qwen -r can no longer reopen the session, and nothing in Qwen Code can bring it back without a separate backup.
Keeping it searchable instead
deja reads Qwen Code sessions, alongside the other agents' histories, into one local index:
curl -fsSL https://raw.githubusercontent.com/vshulcz/deja-vu/main/install.sh | sh deja "Qwen session about the parser"
Indexing and search stay local, credentials are stripped, and deja forget removes a session from the index when you do want it gone.
Where every agent keeps its history · Memory for Qwen Code · The Qwen Code format
Found this useful? Star deja-vu on GitHub.