replay

command
v0.8.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 20, 2026 License: MIT Imports: 11 Imported by: 0

README

Replay System Example

Demonstrates selective task re-execution, checkpoint forking, and CLI commands.

Features

  1. Replay — re-execute tasks from a specific task ID forward. Pre-task tasks retain their original checkpoint output.
  2. ReplayFromCheckpoint — replay using a specific checkpoint (not just the latest).
  3. Fork — deep-copy a checkpoint to create an independent execution branch.
  4. Error handling — unknown task IDs, missing CheckpointStore.

Run

go run main.go

No external LLM required — uses an inline mock (echoLLM).

Expected output

=== 1. Initial Kickoff ===
  task_1: "output-1" (processed=true)
  task_2: "output-2" (processed=true)
  task_3: "output-3" (processed=true)

=== 2. Replay from Task 2 ===
  task_4: "output-1" (processed=true)        ← restored from checkpoint
  task_5: "output-2-fresh" (processed=true)  ← re-executed
  task_6: "output-3-fresh" (processed=true)  ← re-executed

=== 3. ReplayFromCheckpoint ===
  task_4: "early-output-1" (processed=true)  ← restored from specific checkpoint
  task_5: "output-2-fresh" (processed=true)  ← re-executed
  task_6: "output-3-fresh" (processed=true)  ← re-executed

=== 4. Fork ===
  Forked "fork-base-..." → "fork-base-...-fork-..."
  task_7: "original-output-1" (processed=true)  ← from fork
  task_8: "fork-output-2" (processed=true)      ← re-executed

=== 5. Error: Unknown Task ID ===
  [TASK_NOT_FOUND] task not found in checkpoint

=== 6. Error: No CheckpointStore ===
  crew: replay requires CheckpointStore to be configured

CLI commands

# Replay from a specific task (latest checkpoint)
draftcrew replay -t task_2 --config crew.jsonc

# Replay from a specific checkpoint
draftcrew replay -t task_2 -c ckpt-1234 --config crew.jsonc

# Fork a checkpoint
draftcrew fork ckpt-1234

Documentation

Overview

@sk-task replay-system#T6.2: runnable example demonstrating replay, replay from checkpoint, and fork

This example demonstrates all replay system features. It works without any external LLM — uses an inline mock LLM.

Usage:

go run main.go

The example creates a temporary SQLite database for checkpoints, runs a 3-task crew, then demonstrates:

  1. Replay from the second task (re-executes tasks 2 and 3)
  2. ReplayFromCheckpoint with an explicit earlier checkpoint
  3. Fork a checkpoint + replay from the fork
  4. Error handling for unknown task IDs

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL