ドキュメントに戻る
Planning

Merge Instructions

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

8 min で読めます

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.

マージルール

LLMは計画をマージする際にこれらのルールに従います:

  • ソース計画で指定されたファイルパスを正確に保持
  • すべてのソースからの競合しない変更を結合
  • 競合については明示的なユーザー指示に従う
  • マージされたコンテンツ全体で一貫したコードスタイルを維持
  • ソース計画を示す来歴コメントを含める

マージされた出力

マージされた計画は個別の計画と同じ柔軟なフォーマットに従って、LLMから生テキストとして返されます。

各セクションには、どのソース計画がコンテンツを提供したかを示すコメントが含まれます。

Metadata: source_job_ids、merge_instructions、source_count、merged_atタイムスタンプ、planTitle、summary、isStructured(false)、sessionNameがジョブメタデータに保存されます。

UI統合

実装計画パネルはマージワークフローをサポートします:

マージされた計画は完全な監査証跡のためにソース計画にリンクバックします。

計画生成について学ぶ

マージ前に個別の計画がどのように作成されるかを理解しましょう。