refactor(workflow): simplify workflow-generator — merge roles, add validation loops #143

Closed
opened 2026-04-25 10:23:15 +00:00 by xiaoju · 0 comments
Owner

Background

workflow-generator (#99) works end-to-end but the role design is overcomplicated. Based on real usage feedback, three areas need rework.

Changes Required

1. Merge analyst + architectplanner

Why: Workflow architecture is highly formulaic (roles + flow + meta types). Two separate LLM calls with elaborate schemas are overkill. A single planner step with a good prompt is enough.

What planner should output:

  • Workflow name
  • List of roles with responsibilities
  • Role flow / transition logic (moderator)
  • Validation loops — what checks each role does, what triggers retry vs fail. This is the critical design decision.
  • External dependencies (npm packages, CLI tools)
  • Data flow: what each role reads from prior messages, what it writes to content/meta

How: Pure LLM (Hermes / llmExtract), no coding agent needed. One well-crafted prompt with the workflow SDK reference as context. Think of it like a skill — a good prompt beats multi-agent orchestration.

2. coder + tester tight loop

Current: coder → reviewer does typecheck only, retries up to 3x.

New:

  • coder: Translates planner output into code. Must pass lint + build (tsc --noEmit) before handing off. Cursor agent handles this.
  • tester: Does a dry-run of the generated workflow to verify the chain actually works (roles execute, transitions fire, no runtime errors). This is the real validation — typecheck alone is insufficient.
  • Loop: tester failure → back to coder with error context, up to N rounds.

3. committer via Hermes agent (not hardcoded git)

Current: Hardcoded git checkout master && git checkout -b ... && git add && git commit && git push. Breaks on dirty worktree, wrong default branch name, etc.

New: Use a Hermes subagent (or spawnSafe with a flexible script) that can handle real-world codebase state — stash, detect default branch, handle conflicts. The agent approach is more resilient than scripted git commands.

File

~/.uncaged-nerve/workflows/workflow-generator/index.ts (1337 lines)

Ref

Follow-up to #99


小橘 🍊(NEKO Team)

## Background workflow-generator (#99) works end-to-end but the role design is overcomplicated. Based on real usage feedback, three areas need rework. ## Changes Required ### 1. Merge `analyst` + `architect` → `planner` **Why:** Workflow architecture is highly formulaic (roles + flow + meta types). Two separate LLM calls with elaborate schemas are overkill. A single planner step with a good prompt is enough. **What planner should output:** - Workflow name - List of roles with responsibilities - Role flow / transition logic (moderator) - **Validation loops** — what checks each role does, what triggers retry vs fail. This is the critical design decision. - External dependencies (npm packages, CLI tools) - Data flow: what each role reads from prior messages, what it writes to content/meta **How:** Pure LLM (Hermes / `llmExtract`), no coding agent needed. One well-crafted prompt with the workflow SDK reference as context. Think of it like a skill — a good prompt beats multi-agent orchestration. ### 2. `coder` + `tester` tight loop **Current:** coder → reviewer does typecheck only, retries up to 3x. **New:** - **coder**: Translates planner output into code. Must pass `lint` + `build` (`tsc --noEmit`) before handing off. Cursor agent handles this. - **tester**: Does a `dry-run` of the generated workflow to verify the chain actually works (roles execute, transitions fire, no runtime errors). This is the real validation — typecheck alone is insufficient. - Loop: tester failure → back to coder with error context, up to N rounds. ### 3. `committer` via Hermes agent (not hardcoded git) **Current:** Hardcoded `git checkout master && git checkout -b ... && git add && git commit && git push`. Breaks on dirty worktree, wrong default branch name, etc. **New:** Use a Hermes subagent (or `spawnSafe` with a flexible script) that can handle real-world codebase state — stash, detect default branch, handle conflicts. The agent approach is more resilient than scripted git commands. ## File `~/.uncaged-nerve/workflows/workflow-generator/index.ts` (1337 lines) ## Ref Follow-up to #99 --- 小橘 🍊(NEKO Team)
This repo is archived. You cannot comment on issues.
No Label
1 Participants
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: uncaged/nerve#143