# v8.6 Observation Ledger Maintenance Suite Implementation Plan

> **For Claude:** REQUIRED SUB-SKILL: Use superpowers:executing-plans to implement this plan task-by-task.

**Goal:** Add explicit maintenance commands for observation-ledger lifecycle: archive, rebuild, and migration utilities.

**Architecture:** Build deterministic maintenance utilities around transcript/observation artifacts, with dry-run defaults, idempotent transformations, and backup-first mutation behavior.

**Tech Stack:** TypeScript, `src/cli.ts`, `src/transcript.ts`, `src/storage.ts`, node:test.

---

## Requirements

1. `archive` old observation artifacts by policy.
2. `rebuild` observation artifacts from transcript history.
3. migration commands for legacy observation formats.
4. All mutation commands support dry-run and backup snapshots.

## Task 1: Archive service

**Files:**
- Create: `src/maintenance/archive-observations.ts`
- Test: `tests/archive-observations.test.ts`

## Task 2: Rebuild service

**Files:**
- Create: `src/maintenance/rebuild-observations.ts`
- Test: `tests/rebuild-observations.test.ts`

## Task 3: Migration service

**Files:**
- Create: `src/maintenance/migrate-observations.ts`
- Test: `tests/migrate-observations.test.ts`

## Task 4: CLI command surfaces

**Files:**
- Modify: `src/cli.ts`
- Test: `tests/cli-maintenance-suite.test.ts`

Commands:
- `openclaw engram archive-observations`
- `openclaw engram rebuild-observations`
- `openclaw engram migrate-observations`

## Task 5: docs and operator runbook

**Files:**
- Modify: `docs/operations.md`
- Modify: `CHANGELOG.md`

