Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
90 changes: 88 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@ python main.py
```

Start a new run with an inline goal:

```bash
python main.py --goal "Your research goal here"
```
Expand Down Expand Up @@ -298,6 +297,83 @@ Artifact requirements by stage:

A run with only markdown notes does not pass validation.

## CLI

Start a new run:

```bash
python main.py
```

Start a new run with an inline goal:

```bash
python main.py --goal "Your research goal here"
```

Run fake mode:

```bash
python main.py --fake-operator --goal "Smoke test"
```

Resume the latest run:

```bash
python main.py --resume-run latest
```

Resume a specific run:

```bash
python main.py --resume-run 20260329_210252
```

Redo from a specific stage inside the same run:

```bash
python main.py --resume-run 20260329_210252 --redo-stage 03
```

Roll back to a specific stage and mark downstream stages stale:

```bash
python main.py --resume-run 20260329_210252 --rollback-stage 03
```

`--resume-run ... --redo-stage ...` continues inside the existing run directory. It does not create a new run.

Valid stage identifiers include `03`, `3`, and `03_study_design`.

Inspect structured run state:

```bash
python main.py --resume-run latest --show-status
```

Search the per-run knowledge base:

```bash
python main.py --resume-run latest --kb-search "hypothesis evidence" --kb-limit 8
```

Platform-alignment layer under `src/platform/` now includes:

- orchestration patterns: sequential, parallel, hierarchical, swarm
- research pipeline router and stage-specific workflow engines
- literature-source adapters plus citation validation
- multi-agent hypothesis debate workflow
- overnight playbook execution with self-monitoring primitives
- A2A/MCP-style protocol bridge primitives
- agent runtime manager and command-style research agents
- semantic retrieval for Knowledge Base ranking
- Foundry document generation for paper/poster/slides/social bundles
- observability collectors for spans and metrics
- RBAC scope checks for API access
- sandbox execution policy and runner abstractions
- messaging outbox integration
- retry/fallback/classification/checkpoint primitives

## 📌 Scope

Included:
Expand All @@ -313,10 +389,20 @@ Included:
- draft-to-final stage promotion
- resume and redo-stage support
- artifact-level validation
- manifest-first lifecycle tracking via `run_manifest.json`
- per-run Knowledge Base with prompt injection and CLI search
- stage-pattern metadata aligned with the ClawDock research design
- platform-alignment modules for orchestration, protocols, runtimes, Foundry, observability, security, sandboxing, messaging, and deployment
- machine-readable `run_manifest.json` stage state tracking
- stage handoff summaries under `handoff/`
- cross-stage rollback with downstream stale invalidation
- operator attempt/session recovery state under `operator_state/`
- Stage 07 paper package generation with LaTeX/bib/table/checklist/PDF artifacts
- Stage 08 review and dissemination package generation with readiness/release materials

Out of scope:

- multi-agent orchestration
- true multi-agent orchestration execution
- database-backed state
- web UI
- concurrent stage execution
Expand Down
35 changes: 33 additions & 2 deletions main.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,25 @@ def parse_args() -> argparse.Namespace:
"--redo-stage",
help="When resuming a run, restart from this stage slug or stage number (for example '06_analysis' or '6').",
)
parser.add_argument(
"--rollback-stage",
help="When resuming a run, roll back to this stage and mark downstream stages stale before continuing.",
)
parser.add_argument(
"--show-status",
action="store_true",
help="Print the structured run status for --resume-run and exit.",
)
parser.add_argument(
"--kb-search",
help="Search the run knowledge base for --resume-run and exit.",
)
parser.add_argument(
"--kb-limit",
type=int,
default=5,
help="Maximum number of knowledge-base results to return with --kb-search. Defaults to 5.",
)
return parser.parse_args()


Expand Down Expand Up @@ -106,9 +125,21 @@ def main() -> int:
)

if args.resume_run:
start_stage = resolve_stage(args.redo_stage)
run_root = resolve_resume_run(runs_dir, args.resume_run)
manager.resume_run(run_root, start_stage=start_stage)
if args.show_status or args.kb_search:
if args.redo_stage or args.rollback_stage:
raise ValueError("--redo-stage/--rollback-stage cannot be combined with --show-status or --kb-search.")
if args.show_status:
print(manager.describe_run_status(run_root))
if args.kb_search:
print(manager.search_run_knowledge_base(run_root, args.kb_search, limit=max(args.kb_limit, 1)))
return 0

start_stage = resolve_stage(args.redo_stage)
rollback_stage = resolve_stage(args.rollback_stage)
if start_stage is not None and rollback_stage is not None:
raise ValueError("--redo-stage and --rollback-stage are mutually exclusive.")
manager.resume_run(run_root, start_stage=start_stage, rollback_stage=rollback_stage)
return 0

goal = args.goal.strip() if args.goal else read_user_goal()
Expand Down
Loading