Skip to content

feat(workflow): YAML workflow manifest + bernstein workflow CLI#1117

Merged
chernistry merged 2 commits intomainfrom
feat/yaml-workflow-cli
May 8, 2026
Merged

feat(workflow): YAML workflow manifest + bernstein workflow CLI#1117
chernistry merged 2 commits intomainfrom
feat/yaml-workflow-cli

Conversation

@chernistry
Copy link
Copy Markdown
Collaborator

Summary

  • New Archon-inspired bernstein workflow run|init|validate|list surface that runs in parallel to the open-ended bernstein run -g entrypoint, validated up-front with Pydantic v2 and dispatched through the existing AgentSpawner.spawn_for_tasks path (no parallel spawn pipeline).
  • Six stock manifests (idea-to-pr, refactor-with-tests, security-review, doc-update, dependency-bump, hot-fix) shipped in the wheel via hatch force-include.
  • 28 unit + 14 integration tests covering parse round-trip, cycle / missing-dep / kind-exclusivity rejection, fan-out parallel, loop-until-pass, max_iterations exhaustion, fresh-context iteration, real-AgentSpawner dispatch, command timeout, malformed YAML, missing-template resolution, and the interactive: true stub that points at feat(orchestration): explicit human-approval gates as first-class task config #1110.

Shape

  • src/bernstein/core/workflows/{__init__,workflow_spec,workflow_runner}.py — schema + DAG runner.
  • src/bernstein/cli/commands/workflow_cmd.py — extended group with run/init and dual-mode validate/list (auto-detect manifest flavour so the legacy DSL keeps working).
  • templates/workflows/*.yaml — 6 stock manifests, registered in pyproject.toml [tool.hatch.build.targets.wheel.force-include].
  • tests/unit/test_workflow_spec.py + tests/integration/test_workflow_runner.py.
  • README install-block-adjacent section + stock-workflow table; workflow already in DOCUMENTED_COMMANDS.

Test plan

  • uv run pytest tests/unit/test_workflow_spec.py tests/integration/test_workflow_runner.py tests/unit/test_workflow_dsl.py tests/unit/test_readme_api_coverage.py (111 passed)
  • uv run ruff check src/bernstein/core/workflows src/bernstein/cli/commands/workflow_cmd.py tests/unit/test_workflow_spec.py tests/integration/test_workflow_runner.py (clean)
  • uv run ruff format --check (clean for new files)
  • CLI smoke: bernstein workflow list --bundled-only, bernstein workflow validate templates/workflows/idea-to-pr.yaml, bernstein workflow run idea-to-pr --dry-run, bernstein workflow init scratch-test --target /tmp/...

Closes #1108.

🤖 Generated with Claude Code

@chernistry chernistry enabled auto-merge (squash) May 8, 2026 17:28
@github-actions github-actions Bot added size/xl dependencies Pull requests that update a dependency file core cli templates docs tests and removed size/xl labels May 8, 2026
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 8, 2026

AI Review (Gemini)

PR Review: Bernstein Workflow Manifests

Summary

This PR introduces a significant new feature to Bernstein: Archon-inspired YAML workflow manifests. This allows users to define declarative Directed Acyclic Graphs (DAGs) of agent, command, and loop nodes, offering a more structured approach than the existing goal-based execution. The implementation includes a new Pydantic v2 schema for workflow definitions

@chernistry chernistry force-pushed the feat/yaml-workflow-cli branch from cb73848 to 5f6fada Compare May 8, 2026 19:26
chernistry and others added 2 commits May 8, 2026 23:19
Adds an Archon-inspired YAML workflow surface that runs in parallel to the
open-ended `bernstein run -g <goal>` entry. Manifests are validated with
Pydantic v2, executed by a dedicated DAG runner, and dispatch agent-typed
nodes through the existing AgentSpawner.spawn_for_tasks path so there is no
parallel spawn pipeline to maintain.

* core/workflows/workflow_spec.py: WorkflowSpec, WorkflowNode, LoopSpec
  with cycle / missing-dep / duplicate-id / kind-exclusivity validation,
  topological layering, and bundled+user discovery.
* core/workflows/workflow_runner.py: parallel layer execution, command
  shellout with timeout, agent dispatch via AgentSpawner, loop predicate
  re-fire (max_iterations cap), fresh-context iteration via fresh task
  ids, and a stub for `interactive: true` that raises NotImplementedError
  pointing at #1110.
* cli/commands/workflow_cmd.py: extended `bernstein workflow` group with
  `run`, `init`, and dual-mode `validate`/`list` that auto-detect manifest
  flavour so the legacy DSL keeps working.
* templates/workflows/: 6 stock manifests (idea-to-pr, refactor-with-tests,
  security-review, doc-update, dependency-bump, hot-fix) shipped via the
  hatch wheel force-include.
* tests/unit/test_workflow_spec.py: 28 cases covering parse round-trip,
  cycle / missing-dep / duplicate / self-dep rejection, kind-exclusivity,
  versioning, loop semantics, discovery, shadowing, and stock-workflow
  loading.
* tests/integration/test_workflow_runner.py: 14 cases covering linear DAG,
  fan-out parallel, loop-until-pass, max_iterations exhaustion, fresh-
  context iteration, real-AgentSpawner dispatch, command timeout, audit
  emission, malformed YAML, and missing-template resolution.
* README.md: new "YAML workflow manifests" section with stock-workflow
  table, slotted right after the install block.

Closes #1108.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@chernistry chernistry force-pushed the feat/yaml-workflow-cli branch from 5f6fada to 60aef0e Compare May 8, 2026 20:19
@chernistry chernistry merged commit 1cd8e14 into main May 8, 2026
26 checks passed
@chernistry chernistry deleted the feat/yaml-workflow-cli branch May 8, 2026 21:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat(workflow): YAML workflow manifest + bernstein workflow CLI

1 participant