Extend
One core. The rest plugs in.
The core knows mail, not servers or models. Everything outside it is an adapter you can replace or add.
How it is built
packages/core holds the domain and the use cases. It asks for what it needs through small interfaces, the ports. Each packages/adapter-* answers one of them. A check on every change stops the core from importing an adapter.
| Adapter | What it plugs in |
|---|---|
adapter-imap adapter-smtp | Reading and sending mail |
adapter-sqlite | The local database and search |
adapter-claude-code adapter-codex adapter-ollama | Where the agent runs |
adapter-secrets | Passwords, in the system keychain |
adapter-mime adapter-compose | Parsing and writing messages |
adapter-files adapter-filetext | Attachments and the text inside them |
adapter-autoconfig | Finding a provider's servers |
Add an agent runtime
A runtime is anything that takes instructions and text and gives back a value: a program on the computer, a local model, an API. This is the whole interface.
export interface AgentRuntimePort {
readonly id: AgentRuntimeId;
readonly name: string;
/** What the runtime is on this machine. Sends no mail, spends nothing. */
inspect(): Promise<AgentRuntimeInfo>;
run(
request: AgentRunRequest,
options?: { readonly signal?: AbortSignal },
): Promise<AgentRunResult>;
/** Optional: one turn that may call the tools Matters offers, and no others. */
runWithTools?(request: AgentRunRequest, options: AgentToolRunOptions): Promise<AgentRunResult>;
}
- Make a package. Start from
packages/adapter-ollama. - Implement the port. Mail reaches a model as data, never as instructions. Keep it that way.
- Test it.
packages/testkithas the fakes the other adapters use. - Run the checks and open a pull request.
$ bun run typecheck
$ bun run test
$ bun run check:boundaries # the core imports no adapter
$ bun run check:licenses
Wanted next
| Adapter | Why |
|---|---|
| Browser sign-in (OAuth) | Microsoft 365 and Outlook.com do not work without it. |
| Gmail API, JMAP, Microsoft Graph | Faster sync than IMAP where a provider offers it. |
| API keys | A runtime for any provider's API. |
| Linux and Windows | Builds, a keychain for each, and people to test them. |
Read more
The architecture, and every decision behind it, are in the repository. Matters is licensed under AGPL-3.0.