From ef932973cd6fe7ffc9f36257f45ef42117122d24 Mon Sep 17 00:00:00 2001 From: Mark Randall Havens Date: Fri, 13 Mar 2026 23:24:41 +0000 Subject: [PATCH] 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 --- opus_orchestrator/cli.py | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/opus_orchestrator/cli.py b/opus_orchestrator/cli.py index 4e9debf..4d38624 100644 --- a/opus_orchestrator/cli.py +++ b/opus_orchestrator/cli.py @@ -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))