Skip to content

Autonomous quest chains with dependency ordering #63

@justinjdev

Description

@justinjdev

Problem

Complex features often require sequential quests — "first add the database migration, then the API endpoint, then the frontend." Currently, the user must manually spawn each quest after the previous one completes and set up the correct base branch.

Proposal

Allow quest declarations with dependencies in /fellowship:

/fellowship
Quest A: Add user_preferences table (migration)
Quest B: Add /preferences API endpoint (depends: A)
Quest C: Add preferences UI (depends: B)
Quest D: Write API documentation (independent)

Behavior

  1. Parse dependencies: Gandalf builds a DAG from depends: annotations
  2. Spawn ready quests: Quests with no unmet dependencies spawn immediately (A and D in parallel)
  3. Chain on completion: When Quest A completes (PR created), Gandalf auto-spawns Quest B using A's branch as base
  4. Propagate context: Dependent quests receive a PREDECESSOR CONTEXT: block with the completed quest's summary, PR URL, and key files modified
  5. Independent quests: Quests without depends: run in parallel as today (D runs alongside A)

Dependency Resolution

  • Simple linear chains: A → B → C
  • Fan-out: A → B, A → C (B and C spawn in parallel after A)
  • Fan-in: A → C, B → C (C spawns after both A and B complete)
  • Cycle detection: reject at parse time

Base Branch for Dependent Quests

When Quest B depends on Quest A:

  • Quest A creates branch fellowship/add-preferences-table and opens a PR
  • Quest B creates its worktree from A's branch (not main), so it builds on A's changes
  • Quest B's PR targets A's branch (stacked PRs) or main (if A is already merged)

Failure Handling

  • If Quest A fails: dependent quests (B, C) are held with reason "dependency A failed"
  • Lead decides: retry A, skip A and unblock dependents, or abort chain
  • If Quest A succeeds but dependents are paused (e.g., held by palantir): resume after hold clears

Status Display

Gandalf's status table shows dependency state:

| Quest | Phase    | Status     | Depends On | Blocked By |
|-------|----------|------------|------------|------------|
| A     | Complete | PR #42     | —          | —          |
| B     | Research | In Progress| A ✓        | —          |
| C     | Pending  | Waiting    | B          | B          |
| D     | Review   | In Progress| —          | —          |

Scope

  • Add depends: parsing to fellowship spawn logic
  • DAG construction and cycle detection
  • Auto-spawn on dependency completion
  • Base branch selection for dependent quests
  • Status table with dependency columns
  • Failure propagation (hold dependents on failure)
  • Update fellowship SKILL.md and site docs

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions