ALL MEMOS Download .docx

Pattern: Task-Scoped Context Resets with Handoff Files

Date: 2026-05-13

Source: CLAUDE-CODE-2026-FEATURES-FOR-TITAN.md (Pattern 2)

The Problem

Long multi-stage pipelines (symphony, newsletter send, asset index rebuild) run as single monolithic sessions. If a stage fails or the context compacts, the whole run must restart.

The Pattern

Split every pipeline into plan, execute, verify phases. After each phase:

1. Write state file at F:/TITAN/state/pipelines/{pipeline}-{date}.json

2. Next phase reads state, confirms prior phase completed, then proceeds

3. Each phase is independently re-runnable

State file schema (minimal)


{
  "pipeline": "newsletter-weekly",
  "date": "2026-05-13",
  "phases": {
    "fetch":     { "status": "done", "items": 42, "completed_at": "2026-05-13T08:01:00Z" },
    "summarize": { "status": "done", "completed_at": "2026-05-13T08:04:00Z" },
    "render":    { "status": "in_progress", "started_at": "2026-05-13T08:05:00Z" },
    "send":      { "status": "pending" }
  },
  "artifacts": {
    "summary_path": "F:/TITAN/tmp/newsletter-2026-05-13-summary.json",
    "html_path": null
  }
}

Implementation Checklist

Current candidates for migration

| Pipeline | Script | Priority |

|---|---|---|

| symphony | F:/TITAN/scripts/symphony.py | High -- $3/run, costly to restart |

| newsletter | F:/TITAN/scheduled-tasks/titan-*/run.py | Medium |

| asset index | F:/TITAN/scripts/asset_index_builder.py | Low |