Skip to content

fix: use the saved name, tone and memories in chat - #68

Open
Shubhdeep12 wants to merge 1 commit into
CopilotKit:mainfrom
Shubhdeep12:fix/chat-personal-context
Open

Shubhdeep12 wants to merge 1 commit into
CopilotKit:mainfrom
Shubhdeep12:fix/chat-personal-context

Conversation

@Shubhdeep12

Copy link
Copy Markdown

What changed

Name, tone and memories can be set in Apps, and background tasks already use them (model.ts), but the main chat didn't.
Its prompt was hardcoded to "You are OpenMuse", and memories only reached it if the model happened to call agent_status. So memories saved by remember_fact in chat were never read back by chat.

Chat now loads the identity and memories before each reply, the same way tasks do:

  • The prompt opens with the saved name and tone.
  • All memories are included as { text, source }, marked as data, not instructions (same framing as tasks).
  • Edits and deletions in Apps apply to the next message.
  • Stopping before the context loads never calls the model.

Verification

  • Added tests/conversation-personal-context.test.ts.
  • pnpm lint, pnpm typecheck, pnpm test (175 passing) and pnpm build:server pass.

Integration limits

  • Server-only change; web/iOS/Android exports were not run.
  • Checked against Gemini only, not OpenAI or Anthropic.

Added a preference - "I prefer vegetarian" and tried it before and after the fix.
Screenshot 2026-09-25 at 7 11 50 PM

Updated the ConversationAgent to dynamically read the agent's name, tone, and memories on each run, allowing for personalized responses. The agent's prompt now incorporates these details, ensuring that memories are treated as data rather than instructions. Additionally, documentation has been updated to reflect these changes in the agent's functionality.
@davidmckayv

Copy link
Copy Markdown
Contributor

Needs a change before merge. remember_fact lets the model save a memory in the same turn it reads page or mail text, without confirmation, and stamps it "User confirmed in chat". With this PR those memories go into the chat system prompt on every later turn, so a prompt-injected page can plant a persistent instruction (OWASP ASI06). CONTRIBUTING says page and mail text is data and cannot grant permissions. Either put only owner-written memories in the system prompt, or require an in-app confirmation before remember_fact saves and label the source accurately. Cap the size of the memory block either way.

@jerelvelarde jerelvelarde left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Value: useful saved identity, tone and memories in chat. Four focused personal-context tests passed; owner-scoped reads, untrusted-data framing and forgotten-memory behavior are appropriate. Template includes example UI evidence, checks and provider limits. No additional actionable security issue found. Current production conflict in apps/server/src/engine/conversation.ts blocks integration; please retain both this context behavior and main's newer calendar/tools/Jev lifecycle, then rerun checks on the integrated head.

This branch has not been deployed

No deployments
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.

3 participants