Skip to content

armgit / peel

Public Imported from GitHub
0

Uninstall Mac apps with every file they leave behind, and see why each belongs. Free up space, fine-tune macOS, and set up Terminal.

Developer lists the caches and logs of Claude Code and Codex CLI

Țugui Dragoșc22b05a764ed
diff --git a/Packages/PeelCore/Sources/PeelCore/Developer/DeveloperCaches.swift b/Packages/PeelCore/Sources/PeelCore/Developer/DeveloperCaches.swift
index b9fe4192..31c48c39 100644
--- a/Packages/PeelCore/Sources/PeelCore/Developer/DeveloperCaches.swift
+++ b/Packages/PeelCore/Sources/PeelCore/Developer/DeveloperCaches.swift
@@ -769,11 +769,19 @@ public enum DeveloperCaches {
Folder(".local/state/nvim/lazy", .cache, source: "https://github.com/folke/lazy.nvim/blob/main/lua/lazy/core/config.lua#L220-L225"),
Folder(".local/state/nvim/logs", .logs, source: "https://github.com/neovim/neovim/blob/master/runtime/doc/starting.txt#L1409-L1410"),
]),
+ // A running Claude Code session reads its shell snapshot for every command, and the history names what is in
+ // `paste-cache`, so neither is listed.
Definition(id: "claudecode", name: "Claude Code", systemImage: "terminal", appBundleIdentifiers: [], folders: [
Folder(
".local/share/claude/versions", .environments,
source: "https://code.claude.com/docs/en/setup#auto-updates", launchers: [".local/bin/claude"]
),
+ Folder(".claude/cache", .cache, source: "https://code.claude.com/docs/en/claude-directory"),
+ Folder(".claude/debug", .logs, source: "https://code.claude.com/docs/en/claude-directory"),
+ Folder(".claude/statsig", .cache, source: "https://code.claude.com/docs/en/claude-directory"),
+ ]),
+ Definition(id: "codex", name: "Codex CLI", systemImage: "terminal", appBundleIdentifiers: [], folders: [
+ Folder(".codex/log", .logs, source: "https://github.com/openai/codex/blob/main/codex-rs/core/src/config/mod.rs#L4063"),
]),
Definition(id: "cursoragent", name: "Cursor CLI", systemImage: "terminal", appBundleIdentifiers: [], folders: [
Folder(
diff --git a/Packages/PeelCore/Tests/PeelCoreTests/DeveloperCachesTests.swift b/Packages/PeelCore/Tests/PeelCoreTests/DeveloperCachesTests.swift
index a11613cd..b889bd98 100644
--- a/Packages/PeelCore/Tests/PeelCoreTests/DeveloperCachesTests.swift
+++ b/Packages/PeelCore/Tests/PeelCoreTests/DeveloperCachesTests.swift
@@ -286,6 +286,8 @@ struct DeveloperCachesTests {
".minikube", ".minikube/cache/images", ".vagrant.d", "Library/Application Support/Jan/data", "Library/Caches/ollama",
// Unity keeps its licenses beside its caches; SonarScanner the client certificates it signs in with.
"Library/Unity", ".sonar",
+ // Claude Code and Codex keep every conversation and prompt beside their caches and logs.
+ ".claude", ".codex",
]
// CocoaPods' spec repositories hold the ones a person added, which can carry unpushed work: only the CDN copy
// of the public index, `trunk`, is a cache. nvm's, pyenv's, rbenv's and rustup's folders hold every version
@@ -309,6 +311,25 @@ struct DeveloperCachesTests {
}
}
+ /// Claude Code and Codex keep a person's conversations and prompts beside their caches and logs, so only those
+ /// are listed. A running session reads its shell snapshot for every command, so that folder stays too.
+ @Test func listsWhatCodingAgentsCacheAndLogButNeverTheirConversations() async throws {
+ let directory = try TemporaryDirectory()
+ for path in [
+ ".claude/cache/changelog.md", ".claude/debug/session.txt", ".claude/statsig/flags",
+ ".claude/shell-snapshots/snapshot-zsh.sh", ".claude/paste-cache/abc", ".claude/history.jsonl",
+ ".claude/projects/app/session.jsonl", ".codex/log/codex-tui.log", ".codex/sessions/rollout.jsonl",
+ ] {
+ try directory.file(path, bytes: 4_096)
+ }
+
+ let environments = await scanned(directory.url)
+
+ let listed = environments.filter { ["claudecode", "codex"].contains($0.id) }
+ .flatMap(\.locations).map { $0.url.pathComponents.suffix(2).joined(separator: "/") }
+ #expect(Set(listed) == [".claude/cache", ".claude/debug", ".claude/statsig", ".codex/log"])
+ }
+
/// Every folder the table offers names where its tool documents it: a page, or the file inside Xcode that names
/// it, for the folders Apple documents nowhere else.
@Test func everyFolderNamesItsSource() {