# Email to wiki: cited pages from Gmail and Outlook threads

> Connect Gmail or Outlook mail to Cozy, keep threads in sources/ as evidence, and let your own agent write wiki pages that cite them and flag when a thread changes.

Updated 2026-11-09. Canonical: https://cozy.cloud/email-to-wiki

> To turn Gmail or Outlook threads into a wiki, connect the mailbox so threads land in a sources/ folder as evidence, then have your own agent write wiki pages that link back to those threads. In Cozy, links into sources/ become citations, and Health flags a page when a cited thread changes after the page was last edited.

## The problem with email as memory

Important facts live in email threads: a decision about scope, a price someone quoted, a date a vendor promised. Search finds the thread if you remember the right word. It does not give you a page that says what is currently true, who said it, and which message proves it.

A wiki page can do that, but only if someone writes and maintains it. The approach here is to keep the raw mail as evidence and let an agent do the writing and upkeep, with every claim pointing back to a message.

## How the pipeline works in Cozy

Cozy has connectors for Gmail and Outlook mail, among others. Connected mail is imported into the `sources/` folder. Each source has a stable ID, URLs and timestamps, so re-importing a thread updates the same source instead of creating a duplicate.

Sources are treated as untrusted data. An email can contain instructions written by a stranger, so your agent should read it as evidence, not as something to obey. Agents also cannot see connector credentials.

The curated pages live in `wiki/`. Your agent reads from `sources/`, writes pages in `wiki/`, and links each claim to the source it came from. Cozy runs no model itself, so the agent is whichever one you already use, connected over Cozy's account MCP URL, `https://cozy.cloud/mcp`.

## Step by step

1. Create or open a workspace, then connect Gmail or Outlook mail from the connectors list. Threads arrive in `sources/`.
2. Connect your agent to `https://cozy.cloud/mcp` and approve it on Cozy's consent page. Tools use My wiki unless the agent passes a `workspace` argument. See [connect Claude Code](/connect/claude-code) or [the MCP server page](/mcp-server) for configuration.
3. Give the agent a narrow task, such as "write a page for the vendor onboarding thread".
4. The agent searches with `cozy_search`, reads threads with `cozy_read` or `cozy_read_many`, and checks for an existing page with `cozy_resolve` so it does not create a duplicate.
5. It writes the page with `cozy_write`, citing the source threads with ordinary Markdown links.
6. Later, `cozy_changes` shows what arrived since the last run, so the agent only revisits what moved.

## What a cited page looks like

A page is Markdown with frontmatter for type, description, aliases, tags, status and as_of. The body cites mail with links into `sources/`. Here is a sketch, with a placeholder source path:

```markdown
---
type: decision
description: Vendor chose annual billing
status: current
as_of: 2026-11-01
---

# Vendor billing decision

Annual billing was agreed after the pricing thread
([source](sources/gmail/EXAMPLE-THREAD-ID.md)).

CONFLICT: the second thread mentions quarterly billing.
```

Every link into `sources/` is stored in the graph as a `cites` relation. A `CONFLICT:` line is counted by Health, so disagreements between threads stay visible instead of being quietly overwritten. For more on this, see [source citations](/source-citations).

## Keeping pages current when threads change

Email keeps moving. A thread you cited in March may have three more replies by June. Cozy's Health check reports a page as stale when a source it cites changed after the page's last edit. That gives your agent a work list instead of a guess.

Health also reports unsourced pages and uncited sources. An uncited source is a thread that was imported but that no page references yet, which is a useful list of mail nobody has turned into knowledge. Each page starts at 1.0 and loses weight per issue, the workspace score is the average times 100, and a "next" list orders the fixes by priority. More in [wiki health](/wiki-health).

Dreaming is the offline pass your own agent runs. It orients with `cozy_health`, scopes to `cozy_changes` since the last run, verifies claims against sources, keeps superseded values with dates, records `CONFLICT:` lines, merges duplicates, and notes the run in `agents/dream/state.md`. See [memory consolidation](/memory-consolidation).

## Safety and control

- **Scopes.** Credentials carry the scopes read, wiki-write and source-write, and never exceed your own access. A read-only agent can answer questions about mail without being able to edit pages.
- **Folder grants.** You can limit a credential to a folder prefix, for example only `wiki/vendors/`.
- **Limits on agents.** Agents cannot see connector credentials or permanently purge.
- **Safe edits.** Writes need `expectedRevision` (0 for a new page), so two agents cannot silently overwrite each other. Deletion is a tombstone, and the last 50 revisions can be read and restored.

An agent connected with OAuth is capped by the scopes it was granted and your own access. Read [MCP security](/mcp-security) for the token and OAuth details.

## Honest limits

- Search is lexical. There are no embeddings and no vector database, so the agent searches with words that appear in the thread. Good aliases and descriptions on pages help.
- Cozy does not summarize or write anything by itself. The page quality depends on your agent and the instructions you give it.
- Imported sources can be up to 1,500,000 bytes, but curated pages are capped at 90,000 bytes, so very long threads should become several focused pages.
- If you only want mail in the wiki once, without a connector, the ingest API accepts documents with a stable ID. `POST https://cozy.cloud/api/wiki/workspaces/$COZY_WORKSPACE/ingest` takes up to 25 documents per request.

Other tools can search your mail well. If you want an assistant that answers from your inbox on demand and you do not need a durable page, a mail client's built-in assistant may be enough. Cozy fits when you want the result to be a reviewable, versioned page with citations.

## Who this suits

People who carry a lot of context in email, such as [consultants](/use-cases/consultants) and [founders](/use-cases/founders), tend to have the most threads worth distilling. The wiki then serves every agent you connect, not only the one that wrote the page.

## Frequently asked questions

### Does Cozy read my whole mailbox?

Cozy has Gmail and Outlook mail connectors that import threads into sources/ as evidence. Agents cannot see connector credentials, and you can limit what an agent reads with scopes and folder-prefix grants.

### Who writes the wiki pages from my email?

Your own agent does. Cozy runs no model itself, so you connect Claude, Codex or another MCP client, and it reads sources and writes pages through the workspace tools.

### How do I know a page is still accurate after new replies arrive?

Health marks a page stale when a source it cites changed after the page's last edit. Your agent can then re-read the thread and update the page, as described in [wiki health](/wiki-health).

### Can I push email without a connector?

Yes. The ingest API accepts JSON documents with stable IDs, up to 25 per request and 1.5 MB each, and re-pushing the same ID updates the same source.
