Zurück zur Dokumentation
Planning

Merge Instructions

How multiple plan drafts are merged using XML-tagged source plans and user guidance.

8 min Lesezeit

When you have multiple implementation plans that need to be combined, the merge workflow lets you select plans, provide guidance, and generate a unified plan that incorporates the best elements from each source.

ImplementationPlanMergeProcessor

The ImplementationPlanMergeProcessor fetches source plan responses, wraps them in XML-tagged sections, and streams the merged result through the LlmTaskRunner.

Payload: Accepts source_job_ids array, optional merge_instructions string, and inherits model configuration from the session.

Storage: Merged plan stored as JobResultData::Text with metadata including source_job_ids, merge_instructions, source_count, merged_at timestamp, and session context.

Merge Inputs

  • Source plans: 2-5 implementation plans selected from the plan list
  • Merge instructions: User guidance on how to combine (prioritize, resolve conflicts)
  • Model selection: LLM model for merge generation
  • Task context: Original task description for reference

XML-Tagged Source Plans

Source plans are wrapped in XML tags with sequential identifiers:

<task_description>
  [original task from session]
</task_description>

<source_plans>
  <implementation_plan_1>
    [full plan content from first source]
  </implementation_plan_1>
  <implementation_plan_2>
    [full plan content from second source]
  </implementation_plan_2>
</source_plans>

<user_instructions>
  Prioritize API structure from plan 1.
  Use database schema from plan 2.
  Resolve conflicts by preferring newer patterns.
</user_instructions>

Merge Prompt Structure

The merge prompt includes all context needed for intelligent combination:

  • System prompt with merge guidelines
  • Source plans in XML tags
  • User's merge instructions
  • Task description for context
  • Output format requirements

Merge workflow walkthrough

Video showing the complete merge process from selection to output.

Placeholder for merge walkthrough video.

Merge Rules

The LLM follows these rules when merging plans:

  • Preserve file paths exactly as specified in source plans
  • Combine non-conflicting changes from all sources
  • For conflicts, follow explicit user instructions
  • Maintain consistent code style across merged content
  • Include provenance comments indicating source plan

Merged Output

The merged plan is returned as raw text from the LLM, following the same flexible format as individual plans.

Each section includes comments indicating which source plan contributed the content.

Metadata: source_job_ids, merge_instructions, source_count, merged_at timestamp, planTitle, summary, isStructured (false), and sessionName stored in job metadata.

UI Integration

The Implementation Plans panel supports merge workflow:

Merged plans link back to source plans for complete audit trail.

Learn about plan generation

Understand how individual plans are created before merging.