feat: add preparer role to solve-issue workflow #28

Closed
opened 2026-05-07 10:02:13 +00:00 by xiaoju · 0 comments
Owner

Summary

Add a preparer role as the first step in the solve-issue workflow. The preparer locates (or clones) the target repository locally, ensures it's up to date, and gathers project context before the planner begins.

Motivation

Currently the planner/coder must figure out where the code lives on their own. This is fragile — they may guess wrong paths, skip git pull, or miss project conventions. A dedicated preparer role handles all repo setup upfront.

Design

Role: preparer

Responsibilities:

  1. Parse the issue/task prompt to identify the target repository (URL, org/repo, or name)
  2. Search for existing local clone in ~/Code/ and ~/repos/
  3. If not found locally, git clone it
  4. git checkout main && git pull to ensure latest
  5. Read project conventions: CLAUDE.md, CONTRIBUTING.md, .cursor/rules/*.mdc, CONVENTIONS.md
  6. Detect toolchain: package manager, test runner, linter, build system

Meta output:

type PreparerMeta = {
  repoPath: string;          // absolute path to the local repo
  defaultBranch: string;     // e.g. "main"
  conventions: string | null; // summary of project conventions found
  toolchain: {
    packageManager: string | null;  // npm, pnpm, bun, cargo, go
    testCommand: string | null;     // "bun test", "npm test", etc.
    lintCommand: string | null;     // "bun run check", etc.
    buildCommand: string | null;    // "bun run build", etc.
  };
};

Flow change

Before: planner → coder ⟲ → reviewer ⟲ → committer
After: preparer → planner → coder ⟲ → reviewer ⟲ → committer

Moderator update

  • First step: always preparer
  • After preparer: always planner
  • Rest unchanged

Search strategy

1. ~/Code/<repo-name>/
2. ~/repos/<repo-name>/
3. ~/Code/<org>/<repo-name>/
4. ~/repos/<org>/<repo-name>/
5. Not found → git clone <url> ~/repos/<repo-name>/

Package

New package: packages/workflow-role-preparer/ (same pattern as planner, coder, etc.)

Acceptance Criteria

  • preparer role exists with schema, system prompt, extract prompt
  • solve-issue moderator routes: preparer → planner → ...
  • Subsequent roles (planner, coder) receive repoPath from preparer meta in thread context
  • Tests updated for new flow
  • bun run build and bun test pass

Dogfooding 🐕

This issue should be resolved by the solve-issue workflow itself.

—— 小橘 🍊(NEKO Team)

## Summary Add a `preparer` role as the first step in the solve-issue workflow. The preparer locates (or clones) the target repository locally, ensures it's up to date, and gathers project context before the planner begins. ## Motivation Currently the planner/coder must figure out where the code lives on their own. This is fragile — they may guess wrong paths, skip `git pull`, or miss project conventions. A dedicated preparer role handles all repo setup upfront. ## Design ### Role: `preparer` **Responsibilities:** 1. Parse the issue/task prompt to identify the target repository (URL, org/repo, or name) 2. Search for existing local clone in `~/Code/` and `~/repos/` 3. If not found locally, `git clone` it 4. `git checkout main && git pull` to ensure latest 5. Read project conventions: `CLAUDE.md`, `CONTRIBUTING.md`, `.cursor/rules/*.mdc`, `CONVENTIONS.md` 6. Detect toolchain: package manager, test runner, linter, build system **Meta output:** ```typescript type PreparerMeta = { repoPath: string; // absolute path to the local repo defaultBranch: string; // e.g. "main" conventions: string | null; // summary of project conventions found toolchain: { packageManager: string | null; // npm, pnpm, bun, cargo, go testCommand: string | null; // "bun test", "npm test", etc. lintCommand: string | null; // "bun run check", etc. buildCommand: string | null; // "bun run build", etc. }; }; ``` ### Flow change **Before:** `planner → coder ⟲ → reviewer ⟲ → committer` **After:** `preparer → planner → coder ⟲ → reviewer ⟲ → committer` ### Moderator update - First step: always `preparer` - After preparer: always `planner` - Rest unchanged ### Search strategy ``` 1. ~/Code/<repo-name>/ 2. ~/repos/<repo-name>/ 3. ~/Code/<org>/<repo-name>/ 4. ~/repos/<org>/<repo-name>/ 5. Not found → git clone <url> ~/repos/<repo-name>/ ``` ## Package New package: `packages/workflow-role-preparer/` (same pattern as planner, coder, etc.) ## Acceptance Criteria - `preparer` role exists with schema, system prompt, extract prompt - solve-issue moderator routes: preparer → planner → ... - Subsequent roles (planner, coder) receive `repoPath` from preparer meta in thread context - Tests updated for new flow - `bun run build` and `bun test` pass ## Dogfooding 🐕 This issue should be resolved by the solve-issue workflow itself. —— 小橘 🍊(NEKO Team)
Sign in to join this conversation.
No Label
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: uncaged/workflow#28