Disk Space, Storage & Garbage Collection (/gc)
Long-running coding sessions accumulate transcripts, tool-call journals, background process logs, session scratch directories, and runtime caches. Kompile provides a single garbage-collection and storage-inspection engine (GcService + ManagedCacheCatalog) shared across three surfaces so disk accounting never drifts:
- Inside chat:
/gc(terminal and browser chat) - From your shell:
kompile gc - In the browser: the
/storagescreen in the Web Harness (kompile chat --web), which displays a non-overlapping disk breakdown of~/.kompileand the active project, an interactive file browser, one-click cleanup actions, conversation pin/unpin/restore, and livegc-config.jsonediting.
NOTE
Safe by default: Bare /gc and kompile gc always run a dry-run report — nothing is modified or deleted unless you pass --yes (or apply=true on the gc tool). Nothing runs automatically at startup unless you opt in (autoArchiveAtStartup: true).
What the harness stores on disk
Kompile separates user-wide state under ~/.kompile/ from repository-specific state under <project>/.kompile/ (and <project>/data/ for local RAG/crawls). Every major category has a dedicated storage layout and cleanup lifecycle:
Conversations & transcripts (~/.kompile/conversations/)
Each session (native Kompile or imported source__id) owns a bundle of sibling files and a session directory:
| Path | What it stores | Managed by |
|---|---|---|
<id>.txt | Human-readable chat transcript | chats (reversible files.tar.gz archive) / trash |
<id>.ledger.jsonl | Structured append-only conversation ledger (preserved across /compact) | Follows owning session (chats / trash) |
<id>.metrics.json, <id>.token-usage.jsonl, <id>.title, <id>.todos.json, <id>.activity, <id>.progress.jsonl, <id>.subagent.json, <id>.subagent-total.json | Per-session token/cost ledger, title, task list, activity feed, /progress-reports, and subagent rollups | Follows owning session (chats / trash) |
<id>/claude-code/<native-id>.jsonl | Zero-copy symlink (or .path pointer) to Claude Code's native JSONL | Moved as link on archive; never traverses or deletes provider targets |
.search-index.db | SQLite FTS search projection across transcripts | search-index (drops retired rows and rebuilds from surviving sources) |
.trash/<id>/…, .retired/<id>, <id>.pinned | Packed SHA-256-verified archives, retirement tombstones, and pin markers | trash (explicit opt-in only) / /gc pin & /gc restore |
Tool calls, payloads & large-result caches
Large tool outputs and structured invocation logs live outside LLM context so compaction never discards evidence:
| Path | What it stores | Managed by |
|---|---|---|
~/.kompile/conversations/tool-calls/<id>.jsonl | Per-session tool-call journal (powers /diffs, /stats, tool_call_catalog) | Follows owning session |
~/.kompile/conversations/tool-calls/details/<id>/<invocation>.json.gz | Full per-invocation tool request/response payloads | compress (gzips legacy uncompressed dirs) / follows session |
~/.kompile/conversations/tool-calls/all-tool-calls.jsonl, tool-usage.jsonl | Shared cross-session tool-call and usage journals | journals (ToolJournalCompactor, compacts out purged sessions) |
~/.kompile/conversations/<id>/result-cache/, <id>/tool-results/ | Cached large-output handles (fetch_result / ref:ID payloads) | Follows owning session |
~/.kompile/truncated-outputs/ | OutputTruncator spillover files for >12 KiB tool outputs | temp (7-day TTL) |
Process output & runtime logs
| Path | What it stores | Managed by |
|---|---|---|
<project>/.kompile/process-output/<session>/, ~/.kompile/process-output/<session>/ | proc-NNN.log stdout/stderr logs for background commands and builds | process-output (exited sessions idle >processOutputMaxIdleDays, default 7d; 12h startup sweep; active/pinned protected) |
~/.kompile/logs/, <project>/.kompile/logs/ | Agent, subprocess (logs/subprocesses/<id>.log + .log.1), crawl, LSP (logs/lsp/), and CLI logs | logs (rotated and gzip-archived per log-retention.json) |
~/.kompile/logs/transcripts/<segment>/ | Per-session transcript log directories | aux-state (orphaned dirs >7d after session removal) |
Temp & scratch directories (no OS /tmp sprawl)
Kompile bans agent writes to OS /tmp and redirects temporary files into Kompile-managed directories:
| Path | What it stores | Managed by |
|---|---|---|
~/.kompile/conversations/<id>/tmp/ | Per-session scratch directory (redirect target for /tmp writes) | session-tmp (idle >sessionTmpMaxIdleDays, default 7d; active/current/pinned protected) |
~/.kompile/tmp/ | Kompile's own shared temp files and embedded Tomcat work dirs (tmp/tomcat/<pid>) | session-tmp & temp (>24h; live Tomcat PIDs and lock/credential files protected) |
~/.kompile/run/web-chat-attachment-* | Staged web-chat attachment dirs left behind on abnormal exit | temp (>24h) |
conversations/.metrics-*.tmp, .search-index.db.gc-*, sessions/registry-*.tmp | Abandoned atomic-write temporaries from crashed writers | temp (>24h) |
Auxiliary session & enforcement state (aux-state)
Operational files outside conversations/ cleaned past auxMaxAgeDays (default 30 days, or 1–7 days for short-TTL files):
~/.kompile/queues/queue-*.json— queued chat messages (empty queues >1d, non-empty >7d)~/.kompile/sessions/<id>/— per-session registry/state dirs (active/current protected)~/.kompile/subagents/breakdowns/*.json—/subagent-breakdowntoken reports~/.kompile/web-session-state/*— Web Harness session UI state (*.lockexcluded)~/.kompile/chat_input_history_*— per-session input history (>7d; main history capped at 1 MiB)~/.kompile/memory-backups/&<project>/.kompile/memory-backups/— snapshots kept by/gc memory(retains newestmemoryBackupsKeep, default5)<project>/.kompile/enforcer-archive/<session>/— archived turn diffs for/archive&/rollback(>7d)<project>/.kompile/coordination/*— multi-agent edit-lock & mailbox state (>7d;*.lockexcluded)
Quick commands
Inspect disk usage (dry run — always safe)
/gc # Inside chat: sizes every store and shows what cleanup would reclaimkompile gc # Same dry-run report from your shell
kompile gc report # Explicit report actionEveryday reversible cleanup & compression
/gc run --yes # Clean default reversible targets (chats, logs, temp, session-tmp, process-output, aux-state, compress)
/gc compress --yes # Losslessly compress pre-existing archives & legacy stores in place
/gc chats --older-than 14 --yes # Archive and gzip-pack sessions idle >14 days (reversible)
/gc memory # Dry-run memory deduplication plan (project + global)
/gc memory apply # Apply memory deduplication planThe standalone CLI mirrors the same actions (kompile gc run --yes, kompile gc compress --yes, kompile gc chats --older-than 14 --yes, kompile gc memory --yes, kompile gc drafts --yes).
Protect or restore sessions
/gc pin <session-id> # Protect a session from age/size/count archival
/gc unpin <session-id> # Allow a pinned session to age normally again
/gc restore <session-id> # Unpack a packed files.tar.gz archive and auto-pin itCompact journals & search index (or permanently purge trash)
/gc purge --yes # Compacts journals & search-index (NEVER deletes conversations)
/gc purge trash --grace 7 --delete-conversations --yes # IRREVERSIBLE: delete retired archives older than 7 daysWARNING
Conversations are never permanently deleted by default. /gc chats and /gc run only archive and compress sessions reversibly (files.tar.gz + SHA-256 manifest). /gc purge compacts journals and the search index — it refuses to delete archived conversations unless you pass both trash and --delete-conversations (allow_conversation_deletion=true on the gc tool).
What lives on disk (cleanable vs. protected stores)
1. Cleanable targets (GcService + GcTool)
| Target ID | Included in default /gc run? | What it manages | Reversible? |
|---|---|---|---|
chats | Yes | Archives and gzip-packs unpinned idle sessions into files.tar.gz + SHA-256 manifest | Yes (/gc restore <id>) |
compress | Yes | Losslessly compresses pre-existing archives and legacy stores in place | Yes |
logs | Yes | Rotated agent, subprocess, crawl, LSP, and CLI logs under ~/.kompile/logs/ and <project>/.kompile/logs/ (per log-retention.json) | Gzip-archived per policy |
temp | Yes | Abandoned temp files (~/.kompile/tmp, dead Tomcat PID dirs, .metrics-*.tmp, registry-*.tmp, run/web-chat-attachment-* >24h, truncated-outputs/ >7d) | Removes expired temp |
session-tmp | Yes | Per-session scratch dirs (~/.kompile/conversations/<id>/tmp) created by the /tmp write-ban redirect and aged ~/.kompile/tmp entries (protects active/current sessions; pass --session <id> to empty one session) | Removes expired scratch |
process-output | Yes | Exited sessions' background process logs under <project>/.kompile/process-output/ and ~/.kompile/process-output/ idle past processOutputMaxIdleDays | Removes expired logs |
aux-state | Yes | Stale auxiliary state (queues, stale session dirs, breakdowns, web state, enforcer diff archive, coordination, orphaned transcript logs) past auxMaxAgeDays, plus trimming old memory & deploy-jar backups | Removes expired state |
journals | /gc purge default | Compacts shared tool-call journals (ToolJournalCompactor) | Irreversible compaction |
search-index | /gc purge default | Drops retired rows and rebuilds .search-index.db from surviving sources | Rebuilt from sources |
memory | Optional | Deduplicates project and global memory files (MemoryCompactor) | Keeps backup snapshots (memoryBackupsKeep) |
drafts | Optional | Runs git GC on .kompile/drafts.git | Compacts git objects |
cache | Explicit opt-in only | Clears Kompile-managed caches under ~/.kompile/cache/ (Vulkan, Triton, DSP plans, CDS, LSP, MCP adapters) | Rebuilt on demand |
external-caches | Explicit opt-in only | Clears external sibling caches (~/.nd4j, ~/.cache/nd4j, ~/.javacpp/cache, ~/.cache/huggingface, .kompile/javacpp) | Rebuilt on demand |
trash | Explicit opt-in only | Permanently deletes retired archives older than --grace days (minimum 1, default 7) — requires --delete-conversations | Irreversible |
2. Report-only protected stores (never deleted by /gc)
/gc measures and reports these directories so you can see where gigabytes are going, but never deletes files from them:
| Store | Path | What it holds |
|---|---|---|
models | ~/.kompile/models | Downloaded and staged local models (manage with kompile local-models remove) |
components | ~/.kompile/components | Installed distribution components |
native-libs | ~/.kompile/native-libs | Native accelerator libraries |
code-index | ~/.kompile/code-index | Local code search indices |
lib | ~/.kompile/lib | Distribution JARs |
backups | ~/.kompile/backups | User and deployment backups |
agent-state | ~/.kompile/agent-state | Agent state and diff index |
3. Managed & external runtime caches (ManagedCacheCatalog)
Both /gc and the Web Harness /storage view also catalog Kompile-managed caches under ~/.kompile/cache/ (including the ND4J DSP plan cache) and sibling runtime caches outside ~/.kompile:
~/.nd4jand~/.cache/nd4j~/.javacpp/cacheand project-local.kompile/javacpp~/.cache/huggingface
Per-project storage (<project>/.kompile/ & data/)
Kompile keeps user-wide state under ~/.kompile/ and repository-specific state inside <project>/.kompile/ (and <project>/data/ when using local RAG/crawls). Running /gc inside chat, kompile gc from your repository root, or opening /storage in the Web Harness inspects both ~/.kompile/ and the active project side by side without double-counting:
| Project path | What lives here | Managed by /gc? |
|---|---|---|
<project>/.kompile/process-output/ | Background command and subagent logs for sessions run in this repo | Yes — process-output target sweeps exited sessions idle past processOutputMaxIdleDays (7 days) |
<project>/.kompile/drafts.git | Per-repo bare git store holding staged draft overlays and apply records | Optional — /gc run drafts --yes or kompile gc drafts --yes runs git GC |
<project>/.kompile/agent-state/diff-index/ | Project-scoped diff_index edit history mined from transcripts and kompile-draft commits | Protected — report-only |
<project>/.kompile/test-milestones/ | Immutable harness-captured and manual test milestone JSON records | Protected — never deleted by /gc |
<project>/.kompile/enforcer-archive/ & coordination/ | Archived turn diffs (/archive, /rollback) and multi-agent edit-lock/mailbox state | Yes — aux-state sweeps entries older than 7 days (excluding *.lock) |
<project>/.kompile/memory/ | Project-scoped MEMORY.md and typed memory files | Optional — /gc memory [apply] deduplicates and trims old snapshots (memoryBackupsKeep) |
<project>/.kompile/javacpp/ | Project-local JavaCPP native extraction cache | Cataloged in ManagedCacheCatalog and visible in Web /storage |
<project>/.kompile/task-registry/ | Parent/child subagent task trees and transcripts for task_transcript | Retained for session/task inspection |
<project>/.kompile/*.json | Project overrides (chat-config.json, enforcer-config.json, resource-policy.json, hooks.json, lsp-check.json) | Protected — never deleted by /gc |
<project>/data/crawls/ | Local local-runtime knowledge bases, semantic-index.jsonl, and .kgraph archives | Protected — never deleted by /gc |
See Projects for how project boundaries, .kompile/ overrides, and multi-project workspaces work.
Safety invariants & crash protection
- File locks, writer leases & live-session PID checks: Archival and
purgeacquire file locks and verify live PIDs so an active chat or subprocess never loses files out from under it. - Verified archives: Packed chat archives bundle into
files.tar.gzwith a SHA-256 digest in their manifest;/gc restore <id>verifies, unpacks, and auto-pins the session. - Interactive ownership only: The MCP
gctool (action=report|run|purge|restore|pin|unpin) is denied to subagents — cleanup decisions belong strictly to the interactive session.
Configuration (~/.kompile/config/gc-config.json)
All retention defaults work out of the box. To adjust any threshold, ask the agent in chat (for example, "Archive idle chats after 14 days and cap total unpinned chat storage at 500 MB in gc-config.json"). Every field in ~/.kompile/config/gc-config.json is optional and defaults to the values below:
| Field | Default | Meaning |
|---|---|---|
chatMaxAgeDays | 30 | Archive unpinned conversations idle longer than this many days (0 disables) |
chatMaxTotalMb | 0 (off) | Optional total size cap in MB for unpinned chats before oldest sessions archive |
chatMaxPerSource | 0 (off) | Optional max unpinned chats retained per source |
trashGraceDays | 7 | Minimum days a retired archive stays in trash before purge trash can delete it (minimum 1) |
sessionTmpMaxIdleDays | 7 | Idle days before per-session scratch (conversations/<id>/tmp) is swept (0 disables) |
processOutputMaxIdleDays | 7 | Idle days before exited sessions' .kompile/process-output/ logs are swept (0 disables) |
auxMaxAgeDays | 30 | Max age in days for auxiliary state (queues, breakdowns, web state, enforcer diff archive; 0 disables) |
memoryBackupsKeep | 5 | Number of newest memory-compaction backup snapshots kept per scope (0 disables pruning) |
libBackupsKeep | 2 | Number of newest deploy JAR backups kept per artifact in backups/lib/ (0 disables pruning) |
autoArchiveAtStartup | false | Opt-in: when true, CLI startup runs a 24-hour rate-limited reversible archive+pack pass for idle unpinned chats |
Related pages
- Context Compaction (
/compact&/auto-compact) — freeing LLM context tokens inside a running session - The Web Harness — visual
/storagedisk breakdown, file browser, and one-click GC - Persistent Memory — managing
MEMORY.md, typed memories, and/gc memorydeduplication - Configuration Reference — full map of
~/.kompile/config/files