Skip to content

feat(assistant): send mail, add events and write files after a yes - #552

Merged
adeelahmad merged 2 commits into
mainfrom
claude/project-thread-sg6j7c
Oct 18, 2026
Merged

adeelahmad merged 2 commits into
mainfrom
claude/project-thread-sg6j7c

Conversation

@adeelahmad

Copy link
Copy Markdown
Owner

Requested by Adeel · project thread

Description

Before: an admin's assistant could search and read connected mail, calendars and files (#533), but couldn't send a reply, put a meeting on the calendar or save a file.

After: three new tools in "Mail, calendars and files":

  • send_mail sends from Gmail, or saves a draft; reply_to (a message id from search_mail) keeps the thread and answers its sender with "Re:".
  • add_event adds an event to Google Calendar (a date alone is all day; a time without an offset is in the calendar's zone), inviting attendees unless invite is false.
  • write_file writes a text file to a storage connection, replacing one only when overwrite is set; a file that appeared after it asked is never replaced.

Each always waits for the person's approval, even in a setup conversation, and the approval card (in chat and the Approvals inbox) now shows all of it first: the whole message with recipients, the event, the file's text, plus a note when the answer read outside text. Gmail and Google Calendar connections only read until an admin picks "Also sends mail and saves drafts" / "Also adds events" under The assistant in the connection's settings (write "yes") and connects again, since Google is then asked for gmail.compose / calendar.events. Google Drive connected read only is never offered write_file. Each change is audited (mail.send, mail.draft, calendar.add, connections.write).

gmail.send(cfg, src, msg, thread_id=None, draft=False) is a module-level function so other features (the email responder) send through the same path.

Motivation and Context

Second part of "Chat tools for Gmail, Calendar, Drive, S3 and Bash". Next: the sandbox node seam, so run_python/run_bash can run on compute nodes over the mesh.

Refine later (in docs/assistant.md): sending from IMAP over SMTP, attachments on sent mail, changing or removing events and files.

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change; ! in the title)

Checklist:

  • The title is a Conventional Commit.
  • My code follows the code style of this project (make hooks checks it on commit).
  • I added or updated tests.
  • My change requires documentation updates, and I have updated docs/ accordingly.
  • Users need more than the title to understand it, so I wrote it under ## Unreleased in CHANGELOG.md.

Done questions (AGENTS.md)

  • Goal: sending, adding and writing from chat, merged on green.
  • Agents: assistant tools, so the chat API, OpenAI-compatible endpoint and MCP chat reach them; agents can decline but only a person approves.
  • Zero setup: no install or .env; Google writes need one pick and a reconnect, by design (new scope).
  • Fewest clicks: one select per connection; one Approve per change.
  • Configurable: write is in the connection form with "Only reads" as default.
  • Light: no new dependency or process.
  • Private and secure: changes always wait for a yes with full preview; admins only; scopes opt-in; re-checked at approval; threat model md/yaml/json updated.
  • Cost: no model calls of its own; ledger rows gmail.send, gmail.draft, google.calendar (events.insert), connections.write.
  • User decides: every change waits for the person; existing connections keep reading only.
  • Upgrades: new optional param write, absent means "only reads"; no stored data change.
  • Honest: docs and CHANGELOG say what is built; refine-later listed.
  • Tests: 3 backend tests (send/draft/reply, events, files incl. read-only Drive), fakes for Gmail send, Calendar insert and rclone rcat; frontend tests for the form, scopes and the approval preview; make openapi regenerated; requirements row added.
  • Open: Gmail and Calendar REST APIs, RFC 5322 messages, rclone; no new dependency.
  • Reported in the project thread.
  • Reuse: approvals flow, google_auth, gmail._Gmail, gcal, sources.run/browse/check_path, untrusted.

Generated by Claude Code

Three new connection tools: send_mail (Gmail: send, or save a draft;
reply_to keeps the thread), add_event (Google Calendar, inviting people
if asked) and write_file (a text file on a storage connection, replacing
one only when asked). Each always waits for the person's approval, which
now carries a preview of all of it.

Gmail and Google Calendar connections only read until an admin sets
write "yes", which asks Google for gmail.compose or calendar.events, so
nothing changes for existing connections. Google Drive connected read
only is never written. Every change is audited.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01GbBS222wEEQgkuui6CHo6c
@adeelahmad adeelahmad self-assigned this Oct 18, 2026
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01GbBS222wEEQgkuui6CHo6c
@adeelahmad
adeelahmad merged commit 99c0c3e into main Oct 18, 2026
12 checks passed
@adeelahmad
adeelahmad deleted the claude/project-thread-sg6j7c branch October 18, 2026 06:53
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.

2 participants