feat: Add --thread-id and --resume flags for checkpointing

- Add --thread-id flag to CLI for checkpointing
- Add --resume flag to resume from checkpoint
- Generate UUID if no thread_id provided
- Display thread_id for user to save for resume

Usage:
  opus generate --concept "My book" --thread-id abc123
  # If fails:
  opus generate --concept "My book" --thread-id abc123 --resume
This commit is contained in:
2026-03-13 23:24:41 +00:00
parent 14b22fc8f6
commit ef932973cd
+22
View File
@@ -307,6 +307,17 @@ Examples:
action="store_true",
help="Disable AutoGen critique",
)
gen_parser.add_argument(
"--thread-id",
type=str,
default=None,
help="Thread ID for checkpointing/resume (if resuming, use same ID)",
)
gen_parser.add_argument(
"--resume",
action="store_true",
help="Resume from last checkpoint using --thread-id",
)
gen_parser.add_argument(
"--verbose", "-V",
action="store_true",
@@ -706,11 +717,22 @@ async def run_generate(args: argparse.Namespace) -> int:
)
else:
# Use LangGraph pipeline
# Generate thread_id if not provided
import uuid
thread_id = args.thread_id or str(uuid.uuid4())
print(f"🧵 Thread ID: {thread_id}")
if args.resume:
print(f" ↪️ Resuming from checkpoint\n")
else:
print()
result = await run_opus(
seed_concept=seed_concept,
framework=args.framework,
genre=args.genre,
target_word_count=args.words,
thread_id=thread_id,
)
manuscript = result.get("manuscript", str(result))