Skip to content

Conversation

@yemyat
Copy link
Owner

@yemyat yemyat commented Jan 21, 2026

Summary

This PR introduces dependency-aware task scheduling and smarter planning guidance to reduce micro-tasks and improve build-loop efficiency.

Problem

The planning agent was creating too many tiny tasks (e.g., "add 3 constants", "rename an export") that wasted build-loop iterations. Additionally, there was no way to express dependencies between specs or tasks, leading to execution order issues when specs depended on each other.

Solution

1. Dependency Graph Support

Added dependsOn fields for both specs and tasks, allowing the builder to respect execution order:

{
  "id": "feature-b",
  "dependsOn": ["feature-a"],
  "tasks": [
    { "id": "feature-b-1", "dependsOn": ["feature-a-3"] }
  ]
}

2. Story Points Estimation

Tasks now support story point estimation (1, 2, 3, 5, 8) to guide task sizing:

  • Target: 2-5 points per task
  • 1-point tasks should be merged
  • 8-point tasks must be split

3. Improved Planning Prompts

Updated PROMPT_plan.md with explicit guidance:

  • Target 3-10 tasks per spec (not micro-tasks)
  • Reduced subagent budget from "500" to 13 (1 map + 8 area + 4 verification)
  • Do NOT create standalone "run tests" tasks - baseline verification happens every loop

Changes by File

Domain Layer

File Changes
src/domain/implementation.ts Added normalization functions to handle legacy/malformed JSON safely. Added priority-based spec sorting and dependency-aware task selection via nextPendingTask and hasPendingTasks.
src/domain/spec.ts Added dependsOn, pointsBudget, pointsTotal properties. Added dependenciesSatisfied() and nextRunnablePendingTask() methods. Fixed isCompleted to handle specs with no tasks.
src/domain/task.ts Added dependsOn and points properties. Added dependenciesSatisfied() method.
src/types.ts Added StoryPoints type (1|2|3|5|8). Extended TaskEntry and SpecEntry with dependency and estimation fields.

Services Layer

File Changes
src/services/builder.ts Refactored runLoop() into smaller methods. Added handleNoRunnableTasks() to report which specs/tasks are blocked and why. Improved logging for dependency-blocked items.

Templates & Configuration

File Changes
src/templates/prompts.ts Added "Task Granularity" and "Estimation" sections. Reduced subagent budget. Updated spec template with verification guidelines.
.ralph-wiggum/PROMPT_plan.md Same changes as prompts.ts (user-facing planning prompt).
.ralph-wiggum/specs/example.md Updated example spec to follow new task granularity guidelines.

How It Works

flowchart TD
    A[Load implementation.json] --> B{Has pending tasks?}
    B -->|No| C[Report completion]
    B -->|Yes| D[Sort specs by priority]
    D --> E{Spec dependencies satisfied?}
    E -->|No| F[Skip spec, report blocked]
    E -->|Yes| G{Task dependencies satisfied?}
    G -->|No| H[Skip task, try next]
    G -->|Yes| I[Execute task]
    I --> A
Loading

Testing

  • Manual testing with various implementation.json configurations
  • Verified dependency blocking reports correctly
  • Verified priority ordering works as expected

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants