Works with the AI tools you already use

    CClaude CodeCCursorCCodex CLIGGitHub CopilotGGemini CLIVVS CodeWWindsurf+15 more

    Email Threading Gate

    by Tradeplier

    1

    Prevent Gmail thread splitting and encoding corruption with a strict pre-send validation gate.

    Secure checkout via Stripe

    0 installsSecurity scanned

    See it in action

    You say

    Before this reply goes out, run the email threading gate on it. Thread FIXTURE_THREAD_ID, In-Reply-To , outgoing subject 'Important Thread -- Details'.

    Your agent does

    [threading_gate] E4: immediate parent is own send (sender@example.com). Resolving subject from References chain. [threading_gate] E4: resolved original_subject='Important Thread — Details' from References anchor anchor_id

    AssertionError: Threading gate: Reply subject mismatch after stripping Re:/Fwd:. Outgoing (stripped): 'Important Thread -- Details' Original (stripped): 'Important Thread — Details' Do not normalize a reply subject -- normalization changes the conversation key and splits the thread.

    Telegram alert fired: ⛔ Threading gate STOP: Threading gate: Reply subject mismatch after stripping Re:/Fwd:. Outgoing (stripped): 'Important Thread -- Details' Original (stripped): 'Important Thread — Details' Do not normalize a reply subject -- normalization changes the conversation key and splits the thread.

    (Same reply with the original em-dash subject intact: gate returns None, no alert, send proceeds.)

    What you get

    Prevent em-dash normalization from splitting email threads.Verify inbound message provenance before calling Gmail's send API.Alert on mojibake bigrams in automated outbound subjects.Standardize threading identity across Google Workspace service accounts.Stop agent email replies from splitting into new threads.Keep automated support and sales sequences in one conversation per client.

    About this skill

    The problem

    Automated Gmail workflows often fail silently when message threads split due to subject encoding mojibake or using the wrong In-Reply-To source. These threading errors are difficult to debug after the fact and unprofessional for recipients.

    What it does

    • Enforces a single choke point before outbound API calls to prevent invalid sends.
    • Detects and blocks subject encoding corruption like em-dash normalization and latin-1 mojibake bigrams.
    • Verifies In-Reply-To provenance against the sending account's own mailbox; when the immediate parent is your agent's own send, resolves the true subject through the References chain instead of trusting the caller.
    • Fires immediate Telegram alerts for precondition failures or degraded service states.
    • Gracefully handles "Fresh Send" modes while maintaining type and mojibake safety checks.

    Frameworks & tools

    Python 3.11+, google-api-python-client, and google-auth. Designed specifically for Google Workspace with Domain-Wide Delegation (DWD).

    Why this beats prompting it yourself

    The checks in this gate grew out of documented production failures: a latin-1 subject mangle that forked a client thread despite correct In-Reply-To headers; a cross-account thread ID that 404'd; an em-dash retyped as a double hyphen that split a 27-message thread three times in one evening; and a degraded mode that silently skipped its own subject check for two days because one caller omitted one parameter. Each incident is documented in the included PROVENANCE.md, dated, and mapped to the test that now catches it.

    The suite collects 38 cases across ten test files; a standard run reports 36 passed and 2 skipped (the two live cross-namespace Gmail tests, which run only when credentials are configured). It includes replays of the actual failing inputs through the production call path. This is not threading logic an LLM guessed at; it is the scar tissue of a production fleet that runs a real company, packaged.

    Use cases

    • Preventing automated support responses from splitting into multiple threads.
    • Auditing outbound sales sequences for subject line encoding integrity.
    • Ensuring internal bot notifications correctly thread under the specific trigger email.
    • Standardizing email send safety across multiple service accounts or apps.

    Known limitations

    Gmail-specific by design, targeting the Gmail API thread model and RFC 2822 headers. The Telegram alert hook is a documented swap-point: it defaults to the OpenClaw CLI and swaps cleanly for your own alert channel.

    About the builder

    Built by Tradeplier: a licensed Massachusetts builder running a $1M/yr construction company on an agent back office, in production since April 2026. We file the bugs we find upstream: six issues on openclaw/openclaw to date, four rated diamond lobster by the project. If this skill breaks in your fleet, the incident becomes a test and you get the fix.

    How to install

    Drop the file into your AI Agent. Works with Claude, Cursor, ChatGPT, and 20+ more.

    Reviews

    No reviews yet

    Be one of the first to try it. Every listed skill passes our trust checks below.

    Security scanned

    Passed our 8-point scan before listing

    Fresh listing

    Recently published to Agensi

    30-day refund

    Not a fit? Get your money back

    Trust & safety

    Security scanned

    Verified clean today

    Listedtoday

    Creator

    Ten-plus years in construction, laborer to apprentice carpenter to founder; business-school trained; operating president of a $1M/year design-build firm. I run that company on an agent back office: lead intake, CRM, contracts, proposals, and cost tracking, in production since April 2026, built on five years of the company's real job data. These skills exist because a three-day chartered audit of that system found the failure modes the hard way, and every fix became a test. Built on OpenClaw, standard SKILL.md, nothing platform-locked. I file the bugs I find upstream: six issues on openclaw/openclaw to date, four rated diamond lobster by the project — full list: https://github.com/openclaw/openclaw/issues?q=is%3Aissue+author%3Adexiosmb The two behind these skills: https://github.com/openclaw/openclaw/issues/106996 https://github.com/openclaw/openclaw/issues/107010 If a skill breaks in your fleet, the incident becomes a test and you get the fix.

    Frequently Asked Questions

    Popular in AI Agents & LLM Ops