Works with the AI Agents you already use

    Claude CodeClaude CodeCursorCursorCodex CLICodex CLIMuseMuseDotsDots+22 more

    Email Threading Gate

    2

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

    $27.39

    Secure checkout via Stripe

    Money-back guarantee

    Converts to your local currency at checkout

    Security scanned
    email-threading-gate

    email-threading-gate

    Example session with this skill installed

    Before this reply goes out, run the email threading gate on it.
    Thread FIXTURE_THREAD_ID, In-Reply-To anchor-message-id@mail.example.com,
    outgoing subject 'Important Thread -- Details'.

    • Read your context and instructions
    • Compiled the email-threading-gate

    [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.)

    Connects securely to your tools. The creator never sees your data.

    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. The full audit story behind all three, including the part where the audit caught these packages themselves, is at https://www.tradeplier.com/audit-story/

    How to use

    Skills on Agensi run inside your AI agent. Copy the prompt, paste it into your agent, and it connects to Agensi and installs this skill for you. If a payment is needed, your agent shows it to you first.

    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

    Money-back guarantee

    Doesn't do what its page promises? You get your money back.

    Trust & safety

    Security scanned

    Verified clean 2 months ago

    • Passed all security checks, Safe to install

    Requires

    Telegram
    Gmail
    Python

    Listed3 months ago
    Updated2 months ago

    What's inside

    Frequently Asked Questions