Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 26 additions & 2 deletions apps/web/utils/ai/assistant/chat.ts
Original file line number Diff line number Diff line change
Expand Up @@ -728,8 +728,16 @@ Always explain the changes you made.
Use simple language and avoid jargon in your reply.
If you are unable to fix the rule, say so.

You can set general infomation about the user too that will be passed as context when the AI is processing emails.
Reply Zero is a feature that labels emails that need a reply "To Reply". And labels emails that are awaiting a response "Awaiting". The also is also able to see these in a minimalist UI within Inbox Zero which only shows which emails the user needs to reply to or is awaiting a response on.
You can set general information about the user in their Personal Instructions (via the updateAbout tool) that will be passed as context when the AI is processing emails.

Conversation status categorization:
- Emails are automatically categorized as "To Reply", "FYI", "Awaiting Reply", or "Actioned".
- IMPORTANT: Unlike regular automation rules, the prompts that determine these conversation statuses CANNOT be modified. They use fixed logic.
- However, the user's Personal Instructions ARE passed to the AI when making these determinations. So if users want to influence how emails are categorized (e.g., "emails where I'm CC'd shouldn't be To Reply"), update their Personal Instructions with these preferences.
- Use the updateAbout tool to add these preferences to the user's Personal Instructions.

Reply Zero is a feature that labels emails that need a reply "To Reply". And labels emails that are awaiting a response "Awaiting". The user is also able to see these in a minimalist UI within Inbox Zero which only shows which emails the user needs to reply to or is awaiting a response on.

Don't tell the user which tools you're using. The tools you use will be displayed in the UI anyway.
Don't use placeholders in rules you create. For example, don't use @company.com. Use the user's actual company email address. And if you don't know some information you need, ask the user.

Expand Down Expand Up @@ -929,6 +937,22 @@ Examples:
</explanation>
</output>
</example>

<example>
<input>
If I'm CC'd on an email it shouldn't be marked as "To Reply"
</input>
<output>
<update_about>
[existing about content...]

- Emails where I am CC'd (not in the TO field) should not be marked as "To Reply" - they are FYI only.
</update_about>
<explanation>
I can't directly modify the conversation status prompts, but I've added this preference to your Personal Instructions. The AI will now take this into account when categorizing your emails.
</explanation>
</output>
</example>
</examples>`;
Comment on lines +941 to 956
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion | 🟠 Major

Replace placeholder with actual pattern demonstrating retrieval of existing about information.

The example uses [existing about content...] as a placeholder on line 947, which contradicts the guidance at line 742 to avoid placeholders. Since the updateAbout tool description (line 602) explicitly states to "Read the user's about information first as this replaces the existing information," the example should demonstrate the complete pattern: first retrieving existing about via getUserRulesAndSettings, then updating with the complete merged content.

Using a placeholder in examples may teach the AI to use placeholders in actual tool calls, which could result in incomplete updates that overwrite existing user preferences.

♻️ Suggested improvement

Consider revising the example to demonstrate the proper pattern:

  <example>
    <input>
      If I'm CC'd on an email it shouldn't be marked as "To Reply"
    </input>
    <output>
+     <get_user_rules_and_settings />
      <update_about>
-       [existing about content...]
+       I run a marketing agency and use this email address for cold outreach.
+       My cal link is https://cal.com/alice
+       My deck is https://drive.google.com/alice-deck.pdf
+       Write concise and friendly replies.
        
        - Emails where I am CC'd (not in the TO field) should not be marked as "To Reply" - they are FYI only.
      </update_about>
      <explanation>
        I can't directly modify the conversation status prompts, but I've added this preference to your Personal Instructions. The AI will now take this into account when categorizing your emails.
      </explanation>
    </output>
  </example>

This demonstrates retrieving existing content first, then providing the complete updated about information.

🤖 Prompt for AI Agents
In @apps/web/utils/ai/assistant/chat.ts around lines 941 - 956, The example uses
a placeholder "[existing about content...]" which teaches an unsafe pattern;
update the example to first call getUserRulesAndSettings (or the helper that
reads the user's about info) to retrieve the current about content, merge the
new preference into that full content, and then call updateAbout with the
complete merged text so you don't overwrite existing user settings; reference
getUserRulesAndSettings and updateAbout in the example and remove the
placeholder.


const toolOptions = {
Expand Down
Loading