Managed workflows orchestration (feature proposal) - #31
Conversation
Support named TOML workflows and reusable AGENTS through /nebula-workflow. Show live progress in the TUI with readable WORKTREE and SESSION labels, a dedicated workflow panel, and a clickable running count in the FOOTER. Validated with 922 tests, formatting, Clippy, and the memory and glossary gates.
|
Let me spend some time reviewing / thinking about this. I will say with each new modal release, the claude and codex harnesses are able to follow specific .md workflows very well, so I'm debating if adding this into nebula directly introduces more bloat than I'd want, especially since claude code and codex can easily run for hours and follow the provided worked flow. |
|
@webdevcody I appreciate you taking into consideration. For context, the inspiration for this came from this video. I have not yet run these workflows just using Claude or Codex, so my view may change with more experience. However, I see value in having Nebula orchestrate the workflow instead of relying on one agent to manage the entire process within a single conversation. The main advantages are:
The approach also has trade-offs:
I agree that a single coordinating agent could manage the full workflow. My concern is that an agent may eventually skip a step, deviate from the process, or stop early. Encoding the workflow in Nebula provides stronger guarantees while preserving the option to choose a different harness for each stage. |
Hi @webdevcody,
My idea is to introduce workflow orchestration to Nebula for worktrees.
A workflow could define a sequence of steps inside the
.nebula/workflowsfolder. Nebula would then run a chain of specialized agents, with each agent completing its part before handing the work to the next. A workflow might refine a specification, create an implementation plan, write the code, run tests, review the changes, and open a pull request.This would also make Nebula useful as an autonomous runtime on a VPS. For example, I could ask Claude to select one of my triaged GitHub issues and run a predefined workflow that strengthens the specification, implements the change, verifies it, reviews the result, and prepares a pull request with minimal supervision.
Nebula already provides much of the runtime needed to support this model, so workflow orchestration feels like a natural extension. I am proposing it as an idea to experiment with, learn from, and evolve based on real-world use.
Please give it a try, skip to the How to test section and use the skill to invoke it. Look at the
.nebulafolder I created a couple of sample workflows to start with.To test, from Claude invoke:
As "reviewed" being the workflow being triggered for this example, defined in the
.nebula/workflowsfolder.Draft for discussion: this is an unfinished prototype, not a request to merge yet. It explores whether NEBULA should coordinate an ordered sequence of AGENTS using its existing WORKTREES, SESSIONS, DAEMON, and SQLITE STORE.
Contents: Why · What to try · Progress preview · How it works · How to test · Risk · Technical overview · Discussion and unfinished work
💡 Why
NEBULA already provides the pieces for working with several AGENTS, but coordinating a planner, implementer, and reviewer still requires manually starting SESSIONS and passing work between them. The idea here is to describe that order once, kick off a task, and let NEBULA manage the handoffs while keeping progress visible.
The proposed MANAGED WORKFLOW creates one WORKTREE for a task and a fresh SESSION for each stage. Run state belongs in the SQLITE STORE; repository files describe the configuration. This keeps execution state with the DAEMON that already owns the SESSIONS and makes a run inspectable after a restart.
This PR is intended to make the idea concrete enough to discuss the ownership, configuration, and user experience before treating any interface as stable.
✨ What to try
default(planner → implementer),reviewed(planner → implementer → reviewer), andreview(reviewer only)./nebula-workflowwraps discovery and kickoff. The CLI also exposescatalog,inspect,start,list,status,report,pause, andresume.Shift+Oopens the WORKFLOWS PANEL with the current step, next step, and completed/remaining counts. The FOOTER shows the running count and opens the panel when clicked.👀 Progress preview
Excerpt from the recorded isolated TUI test, using a STUB AGENT and the two-stage definition. The PNG remains local and is not hosted in this draft.
The panel includes unfinished runs across the open WORKSPACE, including paused and blocked runs, followed by the ten newest completed runs. Steps left includes the current unfinished step. Background updates do not move FOCUS or switch the selected SESSION.
🔄 How it works
flowchart TD A["Kickoff from an AGENT SESSION on main"] --> B["Resolve and validate workflow + AGENTS"] B --> C["DAEMON freezes definition in SQLITE STORE"] C --> D["Create one WORKTREE from pinned main commit"] D --> E["Launch current stage SESSION"] E --> F["Store explicit result and artifact"] F --> G{"Result completed AND SESSION FINISHED?"} G -- "No" --> H["Wait, or block for intervention"] G -- "Yes" --> I{"More stages?"} I -- "Yes" --> E I -- "No" --> J["Completed; inspect the WORKTREE"] C -. "Persisted transitions" .-> K["WORKFLOWS PANEL + FOOTER"] F -. "Progress updates" .-> KThe DAEMON watcher checks runs every two seconds. A SESSION finishing is insufficient by itself: the assigned AGENT must also report an explicit completed result. Each subsequent stage gets the previous results and uses the same WORKTREE. The resolved definition is frozen at kickoff, so editing configuration affects new runs only.
Pause stops scheduling and leaves the current SESSION running. Missing SESSIONS, timeouts, reported blockers, or ambiguous launch recovery block progress for intervention. A DAEMON restart restores scheduling state; it does not automatically resume a provider conversation. There is no automatic commit, merge, or deployment.
🧪 How to test
Use the DAEMON/TUI built from this PR, with its
.nebula/workflows,.nebula/agents, and/nebula-workflowskill available in your test PROJECT. The configured AGENTS need working provider authentication and supported MODEL / EFFORT values.Open an AGENT SESSION inside NEBULA, in the PROJECT's ROOT WORKTREE on
main.Invoke the skill in that SESSION:
This selects planner → implementer → reviewer. Use
defaultinstead ofreviewedfor planner → implementer only.Press
Shift+Oto open the WORKFLOWS PANEL (Ctrl+Qfirst if the TERMINAL is locked). Follow the current step, next step, and remaining count; respond to provider prompts if requested.Expected: one new managed WORKTREE, a fresh SESSION for each stage, and progress from
0/3 done · 3 leftto completion. Inspect the resulting files in that WORKTREE. The DAEMON handles handoffs after each stage reports its result and finishes.Already validated at
5f62819: 922 tests passed, plus formatting, clippy, and repository memory/glossary checks. Integration coverage uses STUB AGENTS; real-provider approval and recovery behavior still needs testing.Verdict: 🔴 Do not merge as-is. This draft introduces autonomous stage scheduling and persistent/protocol changes that need upstream design review and integration work.
Rollback: reverting the code removes the feature but does not undo created WORKTREES, branches, provider actions, or persisted workflow records. Restart with matching binaries; this draft does not define a database downgrade procedure.
🔧 Technical overview
.nebula/workflows/<selector>.tomlsupplies the stable selector;nameis an optional display label. Reusable roles live under.nebula/agents/. Explicit legacy JSON definitions remain readable..nebula.💬 Discussion and unfinished work
mainstarting points should work, and refine the WORKFLOWS PANEL, history retention, labels, and shortcut.main. This branch has not incorporated its latest changes, including ROOT WORKTREE visibility changes. Resolve those conflicts and reconcile protocol/migration numbering before merge, validate real-provider recovery, and clean up prototype documentation/defaults. The older “Try it” paragraph still says PROTOCOL VERSION 40; the implemented version is 41.