Skip to content

Conversation

@prosdev
Copy link
Collaborator

@prosdev prosdev commented Nov 27, 2025

Summary

Transforms dev_plan from generating heuristic task breakdowns to assembling rich context packages for LLM consumption.

Philosophy: Provide raw, structured context - let the LLM do the reasoning.

Changes

New Context Package Output

dev_plan now returns:

  • Issue details with comments
  • Relevant code snippets from semantic search
  • Codebase patterns (test naming, location)
  • Metadata (tokens, timing)

Before (old heuristic output)

## Plan for #29: Add feature
**Estimate:** 2 days | **Priority:** medium | **Tasks:** 4

1. Research and design approach (2h)
2. Implement core logic (4h)
3. Write tests (3h)
4. Update documentation (1h)

After (new context output)

# Issue #29: Add feature

**Author:** user | **State:** open | **Labels:** enhancement

## Description
[Full issue body with markdown preserved]

## Comments
[All comments with authors and timestamps]

## Relevant Code

### SearchAdapter (class)
**File:** `src/adapters/search-adapter.ts` | **Relevance:** 85%
**Reason:** Similar pattern

\`\`\`typescript
class SearchAdapter { ... }
\`\`\`

## Codebase Patterns
- **Test naming:** *.test.ts
- **Test location:** __tests__/

Breaking Changes

  • Default output is now context package, not task breakdown
  • Removed useExplorer, detailLevel parameters
  • Added includeCode, includePatterns, tokenBudget parameters
  • Error code PLANNER_TIMEOUTCONTEXT_TIMEOUT

New Files

  • packages/subagents/src/planner/context-types.ts - ContextPackage types
  • packages/subagents/src/planner/utils/context-assembler.ts - Assembly logic

Deprecated (still available but marked)

  • breakdownIssue() - Use assembleContext() instead
  • addEstimatesToTasks() - Let LLMs estimate effort
  • estimateTaskHours() - Let LLMs estimate effort

Code Reduction

  • PlanAdapter: 600 → 250 lines (-58%)
  • Tests: 530 → 300 lines (-43%)

Closes #82

Define new types for context-first planning approach:
- IssueContext: Full issue with comments
- RelevantCodeContext: Code snippets with relevance info
- CodebasePatterns: Detected patterns in codebase
- RelatedHistory: Related issues/PRs
- ContextPackage: Complete assembled context
- ContextAssemblyOptions: Configuration options

Philosophy: Provide raw context, let LLM do reasoning.

Part of #82
Create assembleContext() function that:
- Fetches issue with comments via gh CLI
- Searches for relevant code snippets
- Detects codebase patterns (test naming, location)
- Formats context package for LLM consumption

Also:
- Add GitHubComment type
- Add includeComments option to fetchGitHubIssue
- Add author field to GitHubIssue

Part of #82
Transform dev_plan from heuristic task breakdown to context assembly:

New 'context' mode (default):
- Returns rich ContextPackage for LLM consumption
- Includes issue with comments
- Includes relevant code snippets
- Includes detected codebase patterns
- Token-aware output

Legacy mode preserved for backward compatibility:
- mode='legacy' returns old heuristic task breakdown
- Marked as deprecated

Breaking change: Default output is now context package, not tasks.
Use mode='legacy' for old behavior.

Part of #82
Remove legacy mode entirely - the whole point is to move away from
heuristic task breakdown.

Changes:
- Remove legacy mode and all heuristic task generation
- Remove deprecated imports (breakdownIssue, addEstimatesToTasks, etc.)
- Simplify adapter to ~250 lines (from ~600)
- Simplify tests to ~300 lines (from ~530)
- Update error codes (PLANNER_TIMEOUT -> CONTEXT_TIMEOUT)

The adapter now only does one thing well: assemble context for LLMs.

Part of #82
@prosdev prosdev merged commit 91bc519 into main Nov 27, 2025
1 check passed
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.

Refactor Planner → Context Assembler

1 participant