Skip to content

Commit d205556

Browse files
🔧 update (core): inject sender userId into LLM messages for owner identity
Agent-Logs-Url: https://github.com/warengonzaga/tinyclaw/sessions/86909675-1107-446e-8ee8-abb371b60b2c Co-authored-by: warengonzaga <15052701+warengonzaga@users.noreply.github.com>
1 parent 6a1de7a commit d205556

1 file changed

Lines changed: 4 additions & 0 deletions

File tree

packages/core/src/loop.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -873,9 +873,13 @@ export async function agentLoop(
873873
const sanitizedMessage = sanitizeMessage(message, userId, context.ownerId);
874874

875875
// Build messages
876+
// Inject sender identity before the user message so the LLM can correctly
877+
// apply owner-vs-friend rules. Without this, the LLM has no way to know
878+
// who is sending the current message and may misidentify the owner.
876879
const messages: Message[] = [
877880
{ role: 'system', content: systemPrompt },
878881
...history,
882+
{ role: 'system', content: `[Current message sender: userId = \`${userId}\`]` },
879883
{ role: 'user', content: sanitizedMessage },
880884
];
881885

0 commit comments

Comments
 (0)