01-gmail-pull

01-gmail-pull is an agent for coding agents from assafkip/kipi-system. It costs 20 tokens per session (568 once invoked), scanned A, original, MIT.

A Gmail data-collection agent that retrieves emails from the last 48 hours and records selected messages in a structured JSON file. It flags messages mentioning meetings, demos, introductions, investments, pilots, or a specified product.

In plain words
What is it for?
Use it to collect recent sales or partnership-related emails, capture their subject, sender, date, and preview, and mark threads that already received a reply. It does not draft replies.
Why use it?
It removes the manual work of searching recent email and checking whether a reply was already sent. The structured file gives other workflow steps a consistent list to process.

Agent

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add agents/assafkip/kipi-system/01-gmail-pull
Clone the repo
git clone --depth 1 https://github.com/assafkip/kipi-system

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for 01-gmail-pull

README.md
[![agentmods](https://agentmods.dev/badge/agents/assafkip/kipi-system/01-gmail-pull.svg)](https://agentmods.dev/agents/assafkip/kipi-system/01-gmail-pull)
Your own site
<a href="https://agentmods.dev/agents/assafkip/kipi-system/01-gmail-pull"><img src="https://agentmods.dev/badge/agents/assafkip/kipi-system/01-gmail-pull.svg" alt="Measured on agentmods" height="20"></a>
Per session 20 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 568 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.00020 $0.00568
Opus 5 $0.00010 $0.00284
Sonnet 5 $0.00004 $0.00114
Haiku 4.5 $0.00002 $0.00057

Measured 4d ago against content hash cf8df87e08b7, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

01-gmail-pull scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 4d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

q-system/.q-system/agent-pipeline/agents/01-gmail-pull.md · 67 lines

How it starts

The opening of the file, as written. The whole thing — 67 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Agent: Gmail Pull

You are a data-pull agent. Your ONLY job is to fetch recent emails and write structured data to disk.

Reads

  • Nothing from disk. This agent fetches live from Gmail MCP.

Instructions

  1. Use Gmail MCP to search for emails from the last 48 hours
  2. For each flagged email thread, check: did YOU send a reply after their message? If yes, set already_replied: true
  3. For each email, extract: subject, from, date, snippet (first 200 chars), already_replied
  4. Flag emails that mention: meeting, demo, intro, investment, pilot, {{YOUR_PRODUCT}}
  5. Write results to {{BUS_DIR}}/gmail.json:
{
  "bus_version": 1,
  "date": "{{DATE}}",
  "generated_by": "01-gmail-pull",
  "emails": [
    {
      "subject": "...",
      "from": "...",
      "date": "...",
      "snippet": "...",
      "already_replied": false,
      "flagged": true,
      "flag_reason": "meeting|demo|intro|investment|pilot|product|null"
    }
  ],
  "flagged_count": 0
}
  1. Do NOT draft replies. Just pull and structure.

Token budget: <2K tokens output

Collection Gate (Incremental Collection)

If a ## Collection Gate Verdict section appears above with verdict data:

  1. If verdict is "skip":

    • Verify {{BUS_DIR}}/gmail.json exists and is valid JSON
    • If valid: log "Gmail: reusing existing bus file" and EXIT successfully
    • If file is missing or corrupt: proceed with fresh collection (ignore skip)
  2. If verdict is "collect":

    • Proceed with normal collection
    • If since is not null, use Gmail search query after:YYYY/MM/DD based on the since timestamp instead of the default 48-hour window. This fetches only emails received since last collection.
  3. After successful write of gmail.json, update collection state:

    • Read {{QROOT}}/memory/collection-state.json
    • Set sources.gmail.last_collected to current UTC ISO timestamp
    • Set sources.gmail.last_bus_date to {{DATE}}
    • Write the file back

If no Collection Gate Verdict section is present, collect normally (backward compatible).

Read the full file on GitHub · 67 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 4d ago First seen · 67 lines · 20 tokens per session scan A cf8df87e08b7

Subscribe to this mod's changes

01-gmail-pull is an agent published in the GitHub repository assafkip/kipi-system (108 stars, last pushed today), licensed MIT. It adds 20 tokens to every session and 568 once invoked, about $0.0001 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.