Feat: transcript retention (#123)

* feat(retention): prune old agent transcripts + panel-tunable setting

Agents write a {session-id}.jsonl per spawn under ~/.claude/projects; nothing
ever deleted them, so the operator's bind-mounted ~/.claude grew without bound.

Add a throttled orchestrator sweep that prunes agent-owned transcripts (the
shared -app dir + per-workspace dirs) older than a retention window — and ONLY
agent-owned dirs, never the operator's own Claude sessions (proven by the
temp-dir selection tests). The window is panel-tunable: a new system_settings
key-value table (migration 027) holds transcript_retention_days, read via
SettingsService with the roboco.config default (14d) as the fallback, exposed
through GET/PUT /api/settings. Panel wiring follows.

* feat(panel): add a panel-tunable transcript retention control

Wire the settings page to the /api/settings backend: a settings API client and
a self-contained Transcript Retention card (React Query) that loads
transcript_retention_days and saves it back, with client-side validation. The
existing settings controls are unchanged.

---------

Co-authored-by: Renn F <rennf93@users.noreply.github.com>
This commit is contained in:
Renzo F
2026-06-12 23:11:01 +02:00
committed by GitHub
co-authored by Renn F
parent 718d7dd83e
commit fbbb7b3251
15 changed files with 619 additions and 0 deletions
+31
View File
@@ -244,6 +244,37 @@ class Settings(BaseSettings):
),
)
# ==========================================================================
# Transcript retention (agent Claude Code transcripts under ~/.claude)
# ==========================================================================
transcript_retention_days: int = Field(
default=14,
ge=1,
description=(
"Default retention window, in days, for agent Claude Code "
"transcripts (the *.jsonl files agents write under "
"~/.claude/projects). A background sweep prunes agent-owned "
"transcripts older than this. Panel-editable: a stored "
"`transcript_retention_days` system setting overrides this default "
"when present; this is the fallback used before one is set."
),
)
transcript_prune_enabled: bool = Field(
default=True,
description=(
"Whether the orchestrator background sweep prunes old agent "
"transcripts. Disable to keep every transcript indefinitely."
),
)
transcript_prune_interval_seconds: int = Field(
default=3600,
ge=300,
description=(
"Minimum seconds between transcript-retention prune passes. The "
"prune is age-based (days), so it need not run more than hourly."
),
)
# ==========================================================================
# Git command execution
# ==========================================================================