Windows-first Python Typer CLI for building a local communication style guide from your own Microsoft 365 messages through delegated Microsoft Graph access.
Project repo: https://github.com/Midtown-Technology-Group/communication-style
The tool follows the same shape as Midtown's other Graph toys: Typer CLI,
shared mtg-microsoft-auth WAM authentication, local token cache reuse, and
explicit per-tool environment variables.
- A local-only collector for your authored sent email and Teams chat messages.
- A markdown generator for
COMMUNICATION_STYLE.md. - Era and participant-focused report generation.
- A read-only Graph tool by default.
- A local analysis workflow that keeps generated corpus/docs under
%USERPROFILE%\.codex\communication-styleby default.
- It is not a tenant-wide Teams export tool.
- It does not use application permissions.
- It does not pull channel messages yet.
- It does not send raw message content to an LLM provider.
- It does not guarantee Teams participant metadata. Current delegated Graph access can read chat messages, but historical chat member lookups may fail; participant-focused reports therefore use Sent Items recipients plus Teams chat or meeting titles unless explicitly told to try member lookups.
Default delegated scopes:
User.Read,Mail.Read,Chat.ReadOptional later scopes:
offline_access: only for unattended repeat refresh.ChannelMessage.Read.All: only if channel posts are explicitly in scope.Mail.Read.Shared: only if shared mailbox sent items are explicitly in scope.
The tool intentionally avoids /users/{id}/chats/getAllMessages because
Microsoft exposes that bulk Teams export shape as application-permission only.
Instead it walks /me/chats and /me/chats/{chat-id}/messages, then keeps only
messages authored by the signed-in user.
py -3 -m venv .venv
.\.venv\Scripts\python.exe -m pip install --upgrade pip
.\.venv\Scripts\python.exe -m pip install -e .[dev]Set these environment variables if you need to override defaults:
COMM_STYLE_CLIENT_IDdefaults to the shared Midtown public client.COMM_STYLE_TENANT_IDdefaults tocommon.COMM_STYLE_SCOPESdefaults toUser.Read,Mail.Read,Chat.Read.COMM_STYLE_AUTH_MODEdefaults towam.COMM_STYLE_ALLOW_BROKERdefaults totrue.MTG_AUTH_ACCOUNT_HINTcan pin the preferred signed-in UPN.COMM_STYLE_OUTPUT_DIRdefaults to%USERPROFILE%\.codex\communication-style.
Collect a local corpus:
.\invoke.ps1 collect --mail-limit 250 --chat-limit 50 --chat-message-limit 500Generate the style guide:
.\invoke.ps1 generateGenerate era-specific reports:
.\invoke.ps1 erasGenerate participant-focused reports:
.\invoke.ps1 focusfocus currently includes built-in cuts for Jack Musick, Steven Keath, and
company ownership. Add --fetch-chat-members if you want to probe the Teams
members endpoint anyway; the default avoids slow failures on historical chat
IDs.
Outputs:
%USERPROFILE%\.codex\communication-style\communication-samples.jsonl%USERPROFILE%\.codex\communication-style\summary.json%USERPROFILE%\.codex\communication-style\COMMUNICATION_STYLE.md%USERPROFILE%\.codex\communication-style\COMMUNICATION_STYLE_PROFILE.md%USERPROFILE%\.codex\communication-style\eras\%USERPROFILE%\.codex\communication-style\focused\
.\.venv\Scripts\python.exe -m pytestInitial toy release is v0.1.0.
GPL-3.0-or-later.