Email Project Context
Overview
Read user-authored context and translate only the portions supported by the
current IntentMail rule schema. Preview the exact local rule before creation;
never turn descriptive business context into automation silently.
Prerequisites
- Run IntentMail on Node.js 20 or newer with a connected account.
- Provide
context/projects.md in the working directory, or start from the
bundled context/projects.example.md template.
Authentication and execution boundary
- Require an account previously connected through
mail_auth_start; never
request OAuth tokens in chat.
mail_create_rule, mail_apply_rule, and mail_delete_rule change the local
IntentMail database. The current rule engine does not propagate those rule
actions to Gmail or Microsoft Graph.
- Treat priority guidance as AI context, not a rule action:
set_priority is
not in the current rule schema.
- See the supported rule contract.
Workflow
- Resolve the account with
mcp__intentmail__mail_list_accounts. Ask when
more than one active account could match.
Read context/projects.md. If absent, point to
context/projects.example.md; do not create or infer user context.
- Separate descriptive context from executable intent. Preserve client,
project, and priority prose for triage. Translate only supported conditions
and actions listed in the rule contract.
- Call
mcp__intentmail__mail_list_rules and identify duplicates or conflicts.
- Present each proposed rule in plain language and exact fields: account ID,
name, trigger, AND-combined conditions, ordered actions, and active state.
Explain that this is a textual proposal, not a tool-level dry-run.
- After explicit confirmation, call
mcp__intentmail__mail_create_rule for
the approved rules. Prefer a manual trigger unless the user explicitly
approved on_new_email or scheduled behavior.
- List the created rules, then test with
mcp__intentmail__mail_apply_rule
and dryRun: true. Report match and action counts without applying changes.
- Use
dryRun: false only after a separate confirmation that names the rule,
message scope, limit, and local-cache effects.
- Before
mcp__intentmail__mail_delete_rule, show the rule ID and complete
rule definition and obtain explicit confirmation; deletion is permanent.
Validation
- Use only schema-supported condition fields, operators, triggers, and actions.
- Confirm every created rule belongs to the intended account and matches the
approved proposal.
- Keep regexes narrow and test them in dry-run mode against a bounded scope.
- Never report provider-side filing, forwarding, trashing, or priority changes;
the current rule engine operates on local cached state.
Output
Return the source context lines, unsupported intent, conflicts, exact proposed
rules, confirmation received, created/deleted rule IDs, dry-run scope, match
counts, local actions that would occur, errors, and the next user decision.
Error Handling
- Missing context: stop and point to the example file.
- Unsupported priority or forwarding request: retain it as context or mark
it unsupported; do not synthesize an invalid rule.
- Ambiguous sender, folder, or account: ask for the exact value.
- Duplicate/conflicting rule: show both definitions and require a choice.
- Dry-run failure: do not retry with
dryRun: false.
- Provider-side automation requested: explain the local-only limitation and
do not claim the provider mailbox changed.
Examples
For account 2, read context/projects.md and propose a manual rule that labels
mail from @acme.com as Clients/Acme. Create it only after I confirm, then run a
dry-run over at most 25 cached messages.
Review existing rules for account 1. Show duplicates and unsupported actions;
do not apply or delete anything.
Resources
- Supported rule contract
- Context template:
context/projects.example.md
- Rule schema:
src/types/rule.ts
1---2name: email-project-context3description: Translate plain-language project and client context into supported, reviewable IntentMail rules without inventing conditions or actions. Use when designing, previewing, creating, or removing local inbox rules; trigger with "set up my email rules", "file mail by project", or "review my rules".4license: Apache-2.05---67# Email Project Context89## Overview1011Read user-authored context and translate only the portions supported by the12current IntentMail rule schema. Preview the exact local rule before creation;13never turn descriptive business context into automation silently.1415## Prerequisites1617- Run IntentMail on Node.js 20 or newer with a connected account.18- Provide `context/projects.md` in the working directory, or start from the19 bundled `context/projects.example.md` template.2021## Authentication and execution boundary2223- Require an account previously connected through `mail_auth_start`; never24 request OAuth tokens in chat.25- `mail_create_rule`, `mail_apply_rule`, and `mail_delete_rule` change the local26 IntentMail database. The current rule engine does not propagate those rule27 actions to Gmail or Microsoft Graph.28- Treat priority guidance as AI context, not a rule action: `set_priority` is29 not in the current rule schema.30- See the [supported rule contract](references/rule-contract.md).3132## Workflow33341. Resolve the account with `mcp__intentmail__mail_list_accounts`. Ask when35 more than one active account could match.362. `Read` `context/projects.md`. If absent, point to37 `context/projects.example.md`; do not create or infer user context.383. Separate descriptive context from executable intent. Preserve client,39 project, and priority prose for triage. Translate only supported conditions40 and actions listed in the rule contract.414. Call `mcp__intentmail__mail_list_rules` and identify duplicates or conflicts.425. Present each proposed rule in plain language and exact fields: account ID,43 name, trigger, AND-combined conditions, ordered actions, and active state.44 Explain that this is a textual proposal, not a tool-level dry-run.456. After explicit confirmation, call `mcp__intentmail__mail_create_rule` for46 the approved rules. Prefer a `manual` trigger unless the user explicitly47 approved `on_new_email` or `scheduled` behavior.487. List the created rules, then test with `mcp__intentmail__mail_apply_rule`49 and `dryRun: true`. Report match and action counts without applying changes.508. Use `dryRun: false` only after a separate confirmation that names the rule,51 message scope, limit, and local-cache effects.529. Before `mcp__intentmail__mail_delete_rule`, show the rule ID and complete53 rule definition and obtain explicit confirmation; deletion is permanent.5455## Validation5657- Use only schema-supported condition fields, operators, triggers, and actions.58- Confirm every created rule belongs to the intended account and matches the59 approved proposal.60- Keep regexes narrow and test them in dry-run mode against a bounded scope.61- Never report provider-side filing, forwarding, trashing, or priority changes;62 the current rule engine operates on local cached state.6364## Output6566Return the source context lines, unsupported intent, conflicts, exact proposed67rules, confirmation received, created/deleted rule IDs, dry-run scope, match68counts, local actions that would occur, errors, and the next user decision.6970## Error Handling7172- **Missing context:** stop and point to the example file.73- **Unsupported priority or forwarding request:** retain it as context or mark74 it unsupported; do not synthesize an invalid rule.75- **Ambiguous sender, folder, or account:** ask for the exact value.76- **Duplicate/conflicting rule:** show both definitions and require a choice.77- **Dry-run failure:** do not retry with `dryRun: false`.78- **Provider-side automation requested:** explain the local-only limitation and79 do not claim the provider mailbox changed.8081## Examples8283```text84For account 2, read context/projects.md and propose a manual rule that labels85mail from @acme.com as Clients/Acme. Create it only after I confirm, then run a86dry-run over at most 25 cached messages.87```8889```text90Review existing rules for account 1. Show duplicates and unsupported actions;91do not apply or delete anything.92```9394## Resources9596- [Supported rule contract](references/rule-contract.md)97- Context template: `context/projects.example.md`98- Rule schema: `src/types/rule.ts`