fix: Add scope awareness to chat prompt so agents focus on target entities

Pass targetId to buildChatPrompt and add <scope> block that clearly
distinguishes primary target files from context files. Context entities
may be modified when necessary (e.g. dependency links) but the agent
is instructed to focus changes on the primary target.
This commit is contained in:
Lukas May
2026-03-04 11:31:49 +01:00
parent 354950bb8a
commit 9c09683029
2 changed files with 39 additions and 1 deletions

View File

@@ -96,7 +96,7 @@ export function chatSessionProcedures(publicProcedure: ProcedureBuilder) {
input.initiativeId,
);
const prompt = buildChatPrompt(input.targetType, chatHistory, input.message);
const prompt = buildChatPrompt(input.targetType, input.targetId, chatHistory, input.message);
// Create a task for the chat agent
const targetName = input.targetType === 'phase'