feat: add plan archival with retention policy #62

Merged
Charon merged 1 commit from feat/plan-retention-policy into main 2026-02-24 13:20:39 +00:00
Member

Summary

Implements configurable retention policy for archived plans, preventing indefinite data accumulation.

  • Add agentic.plan_retention_days config key (default 90 days, overridable via AGENTIC_PLAN_RETENTION_DAYS env var)
  • Add SoftDeletes trait and archived_at timestamp to AgentPlan model
  • Add migration (000006) for deleted_at and archived_at columns on agent_plans
  • Create agentic:plan-cleanup artisan command with --dry-run and --days options
  • Schedule cleanup to run daily via service provider booted() hook
  • Register PlanRetentionCommand in ConsoleBooting event handler
  • Add PlanRetentionTest feature test suite (9 tests) covering all retention scenarios
  • Fix archive() to store archived_at as a dedicated typed column instead of metadata string

Closes

Closes #34

Test plan

  • AgentPlan::archive() sets archived_at timestamp
  • agentic:plan-cleanup --dry-run --days=90 reports count without deleting
  • agentic:plan-cleanup --days=90 permanently removes plans archived > 90 days ago
  • Plans archived < retention threshold are untouched
  • Active/draft plans are never affected by cleanup
  • AGENTIC_PLAN_RETENTION_DAYS=0 disables cleanup
  • Feature tests in PlanRetentionTest all pass

🤖 Generated with Claude Code

## Summary Implements configurable retention policy for archived plans, preventing indefinite data accumulation. - Add `agentic.plan_retention_days` config key (default 90 days, overridable via `AGENTIC_PLAN_RETENTION_DAYS` env var) - Add `SoftDeletes` trait and `archived_at` timestamp to `AgentPlan` model - Add migration (`000006`) for `deleted_at` and `archived_at` columns on `agent_plans` - Create `agentic:plan-cleanup` artisan command with `--dry-run` and `--days` options - Schedule cleanup to run daily via service provider `booted()` hook - Register `PlanRetentionCommand` in `ConsoleBooting` event handler - Add `PlanRetentionTest` feature test suite (9 tests) covering all retention scenarios - Fix `archive()` to store `archived_at` as a dedicated typed column instead of metadata string ## Closes Closes #34 ## Test plan - [ ] `AgentPlan::archive()` sets `archived_at` timestamp - [ ] `agentic:plan-cleanup --dry-run --days=90` reports count without deleting - [ ] `agentic:plan-cleanup --days=90` permanently removes plans archived > 90 days ago - [ ] Plans archived < retention threshold are untouched - [ ] Active/draft plans are never affected by cleanup - [ ] `AGENTIC_PLAN_RETENTION_DAYS=0` disables cleanup - [ ] Feature tests in `PlanRetentionTest` all pass 🤖 Generated with [Claude Code](https://claude.com/claude-code)
Clotho added 1 commit 2026-02-23 15:13:36 +00:00
feat: add plan archival with retention policy (#34)
Some checks failed
CI / PHP 8.3 (pull_request) Failing after 21s
CI / PHP 8.4 (pull_request) Failing after 19s
cc1c4c1adc
- Add `agentic.plan_retention_days` config (default 90 days via AGENTIC_PLAN_RETENTION_DAYS env)
- Add SoftDeletes and `archived_at` timestamp to AgentPlan model
- Add migration for `deleted_at` and `archived_at` columns on agent_plans
- Create `agentic:plan-cleanup` command with --dry-run and --days options
- Schedule retention cleanup to run daily via service provider
- Register PlanRetentionCommand in ConsoleBooting handler
- Add PlanRetentionTest feature test suite covering all retention scenarios
- Fix archive() to store archived_at as dedicated column (not metadata string)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Charon merged commit a9a6e258e1 into main 2026-02-24 13:20:39 +00:00
Charon deleted branch feat/plan-retention-policy 2026-02-24 13:20:39 +00:00
Sign in to join this conversation.
No description provided.