Goal
Replace filesystem cleanup plan workflows with DB-backed cleanup runs/items.
Scope
Add tables/repositories for:
datamachine_code_cleanup_runs
datamachine_code_cleanup_items
Required workflow
workspace cleanup plan --mode=<mode> creates a cleanup run and item rows.
workspace cleanup apply <run-id> schedules or applies rows by querying item state.
workspace cleanup status <run-id> aggregates item/job state.
workspace cleanup evidence <run-id> reads run/item/job evidence.
workspace cleanup resume <run-id> resumes pending/failed chunks.
workspace cleanup cancel <run-id> cancels pending items/jobs.
Data model expectations
Each cleanup item stores:
- handle/worktree reference
- planned action
- current status
- reason_code/reason
- chunk/job ids
- bytes reclaimed
- bounded evidence JSON
Migration from current behavior
- File-based
--apply-plan=/path.json becomes an escape hatch only.
- CLI help should stop documenting redirect-to-file as the normal path.
- Data Machine job
engine_data can store chunk-local payloads, but run/item state belongs in DMC tables.
Tests
- Plan creates run/items.
- Apply claims pending items and updates status.
- Status/evidence aggregate item and child job state.
- Retrying a run is idempotent.
- No filesystem plan files are created.
Goal
Replace filesystem cleanup plan workflows with DB-backed cleanup runs/items.
Scope
Add tables/repositories for:
datamachine_code_cleanup_runsdatamachine_code_cleanup_itemsRequired workflow
workspace cleanup plan --mode=<mode>creates a cleanup run and item rows.workspace cleanup apply <run-id>schedules or applies rows by querying item state.workspace cleanup status <run-id>aggregates item/job state.workspace cleanup evidence <run-id>reads run/item/job evidence.workspace cleanup resume <run-id>resumes pending/failed chunks.workspace cleanup cancel <run-id>cancels pending items/jobs.Data model expectations
Each cleanup item stores:
Migration from current behavior
--apply-plan=/path.jsonbecomes an escape hatch only.engine_datacan store chunk-local payloads, but run/item state belongs in DMC tables.Tests