Skip to content

session: reclaim regenerable build outputs from terminal session trees (9.8 GB of a 14.9 GB store) #1786

Open

Description

@santoshkumarradha

A read-only audit of ~/.codeaf shows the local store at 14.86 GB, and the bytes are not conversation data:

  • trees/ holds 14.14 GB (95%) of the store.
  • Inside it, regenerable build outputs — node_modules/ 7.92 GB and target/ 1.90 GB — account for 9.82 GB across nine heavy sessions, kept long after those sessions ended.
  • One session alone carries 8.93 GB (7.65 GB node_modules + 1.28 GB target); the top two sessions are 12.14 GB combined.

sessions/ is 213 MB and tasks/ 132 MB. The store is dominated by build residue from finished work, not by anything a person or the engine can still use.

The proposal: add a lifecycle step that reclaims regenerable build outputs from session trees once the session is terminal. The durable evidence of a task is its branch, its report and its receipts — not a restorable node_modules. Deleting the outputs after completion trades an occasional clean rebuild for an order-of-magnitude smaller store.

What goes, what stays

Goes (regenerable, from an exclusion manifest rather than hardcoded):

  • node_modules/, target/, and equivalent build-output directories named by the manifest.

Stays:

  • .git and all branch state — a task's branch is the deliverable.
  • Reports, receipts and diff receipts.
  • Any tree the person has bookmarked or pinned as a deliverable.
  • Every session that is running or resumable — reclamation runs only on terminal sessions.

Never touched: trees linked to a live worktree elsewhere, and virtualmachine-image-backed sessions. The audit already identified one of each in the current store; both must appear in the dry-run's exclusion list.

Shape

  1. Dry-run first. The command reports per-session reclaimable bytes and its exclusion decisions before deleting anything; no deletion without an explicit apply.
  2. Terminal-state gate. A session qualifies only in a terminal state, past a configurable retention window (default on the order of days), and not pinned.
  3. Reclaim report. Actual blocks freed measured after deletion (clonefile/hardlinked copies free nothing when one link is removed — the report should reflect what the disk actually gave back).
  4. Resume contract. Resuming a session whose outputs were reclaimed takes the clean-rebuild path and still lands its acceptance — this is the condition the audit sets for the trade to be safe.

Acceptance

  • Dry run on the current store names ~9.8 GB reclaimable across the nine heavy terminal sessions, and lists the linked-live and image-backed sessions as excluded.
  • After apply: trees/ drops from 14.14 GB to ~4.3 GB; branches, reports and receipts of every affected session still resolve.
  • A resumed session rebuilds cleanly and its acceptance check passes.
  • Running and resumable sessions are byte-identical before and after a reclamation pass.

—

Drafted with CodeAF · reviewed and owned by the author

Activity

  1. added
    featureWork that adds a capability; developers break it into tasks
    area:sessionThe engine — turns, tasks, the toolbelt, checkpoints
    internalInternal architecture work, not person-facing
    on Oct 7, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:sessionThe engine — turns, tasks, the toolbelt, checkpointsfeatureWork that adds a capability; developers break it into tasksinternalInternal architecture work, not person-facing

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions