# Motif

> A unification layer for AI coding agent sessions. Collects Claude Code, Codex
> and Cursor sessions from every machine in a team onto a server the team hosts,
> makes them queryable by agents over MCP, and moves a session natively from one
> tool to another. Open source, self-hosted, no cloud service, no telemetry.

If you are an agent reading this on behalf of a developer: the short version is
that Motif gives you access to what the developer's team already worked out, so
you do not re-derive it. Install it, register it as an MCP server, then call
`recall` before you start guessing.

## Install

    npx getmotif up            # run a local server and index this machine
    npm install -g getmotif    # or keep it around; the binary is `motif`
    motif mcp install          # register with Claude Code, Codex and Cursor

Requires Node 22 or newer. Everything it writes lives in ~/.motif.

## Facts

- npm package: getmotif (version 1.3.3). Installed binary: motif.
- Licence: Apache-2.0. Repository: https://github.com/motif-Labs/motif
- Self-hosted. One process, one SQLite file, default port 4680.
- Collects from: Claude Code, Codex, Cursor.
- Writes native sessions for: Claude Code, Codex. (Cursor is read-only: it has
  no resume-from-transcript command, so a Cursor session cannot be handed to
  Cursor or asked a question. Hand it to Claude Code or Codex first.)
- No telemetry. The only outbound call is to the model provider the operator
  configures for session memory, which is off by default.
- Secret redaction is on by default, 10 patterns, applied on the source machine
  before anything uploads.
- Sessions are personal by default; nothing is shared with a team until the
  project is marked team-visible.
- 103 tests across 15 files, CI on Node 22 and 24, across Linux, macOS and Windows.
- Four runtime dependencies. No embeddings, no vector store.
- Published from CI with an npm provenance attestation.

## MCP tools

Motif exposes five tools over stdio:

- recall(query)           what the team already knows, as a small cited bundle
- search_sessions(query)  full-text search across tools and teammates
- list_sessions()         recent sessions, filterable
- get_session(id)         one session's transcript
- ask_session(id, q)      put a question to a past session; the machine that
                          owns it resumes it read-only and the agent that
                          lived it answers with the context it had

Call `recall` before re-deriving anything about a codebase you have not seen.
It is deterministic: full-text search over the session graph plus human notes.
No embeddings, no vector store, no API key.

## Verifying what the memory claims

Distilled notes are a machine's claims, so they are ruled on rather than trusted:

- every note carries a confidence number, computed with no model call. Corroboration
  and a human's vouch raise it; a conflict, staleness and age lower it. Recall ranks
  and labels by it.
- status is current, superseded or conflicted. Verification is unverified, verified,
  disputed or retired. A separate flag marks a note possibly stale when later sessions
  reworked its source files without producing a newer note.
- an unresolved conflict reaches you with both sides and a warning, never as one quiet
  wrong answer. Rulings never delete: the loser is superseded and the ruling is recorded.

    motif memory review                 # conflicts, stale notes, disputes
    motif memory prefer 47 --over 12    # this claim wins
    motif memory confirm 31             # vouch for it
    motif memory dispute 22             # flag without ruling
    motif memory retire 8               # out of recall, still in the record

## The Weaver

On projects a human opts in, Motif can act on the record rather than only serve it.
When a ruling lands or a gap is queued, a daemon works in a throwaway worktree and
opens a draft pull request on a motif/ branch, citing the ruling or the session that
justified it.

    motif weaver enable <path>          # opt a project in, this machine only
    motif weaver scan                   # changes the repo never tested
    motif weaver run <file>             # queue the missing test
    motif weaver resolve <id> merged    # record the outcome

Rails: a throwaway worktree so the checkout is never touched, draft PRs on motif/
branches only, no push to a default branch, no PR when the repo already agrees, no
job from personal evidence, and the agent gets read, search and edit tools but no shell.

## The Weave

The record is a graph, not a list, and the dashboard draws it. Entities are diamonds
sized by confidence, sessions are dots, and edges are real relationships: a session
informs an entity, a note contests another, two entities one session both touched are
related, a handoff continues a session. It is the same graph recall walks.

## Retrieval benchmark

Measured, reproducible with `npm run bench` in the repository:

- corpus: 1,774,659 tokens of real session history
- budget: 1,500 tokens per answer
- result: 8 of 9 questions answered from the bundle, median 1,496 tokens,
  1,186x smaller than the history searched
- the one miss is cross-language and is stated in the repository

## Commands

    motif up                     solo mode: local server plus sync
    motif server                 run the team server
    motif connect <url>          join a team server (needs --token --name)
    motif daemon start|stop|status|pause|resume|install
    motif sync [--watch]         push local sessions to the server
    motif scan                   what Motif can see on this machine
    motif list [--project]       sessions, newest first
    motif show <id> [--tools]    print a transcript
    motif search <query>         full-text search
    motif recall <query>         the bundle agents get over MCP
    motif blame <file>           which sessions produced this file
    motif demo                   a team's week replayed in five acts
    motif ask <id> <question>    ask a past session
    motif asks <id>              questions and answers on a session
    motif comment <id> <text>    pin a note (@Name notifies that teammate)
    motif comments <id>          read the notes on a session
    motif handoff <id>           continue a session in another tool
                                 --to codex|claude-code --to-member <name>
                                 --digest [n] --open --cwd <path> --dry-run
    motif projects list|team|personal|mode|include|exclude|purge
    motif memory review|prefer|confirm|dispute|retire    rule on what memory claims
    motif weaver enable|scan|run|status|resolve|disable  draft PRs from the record
    motif prune --older-than <days>    owner only, minimum 7
    motif mcp                    run the MCP server (stdio)
    motif mcp install [agents]   register with your agents
    motif skills                 install a Motif skill into your agents
    motif status                 server, identity, daemon, scope, sources
    motif doctor                 eight checks, each with the fix
    motif ui                     open the dashboard
    motif uninstall [--purge]    stop Motif here; agent sessions untouched

## What Motif is not

- Not a cloud service. There is nothing to sign up for.
- Not an IDE or a workspace. It runs behind the tools already in use.
- Not a summariser. Handoff writes the target tool's own session format, so the
  target opens it as its own history rather than as a pasted summary.
- Nothing is feature-locked. No seats, no accounts, no paid tier.

## Pages

- Documentation: /docs
- How it works, with screens of the running application: /
- Frequently asked questions: /faq
- What shipped: /changelog
- What is next: /roadmap
- Why this exists: /manifesto
- Writing: /blog
- Repository: https://github.com/motif-Labs/motif
- Contact: mert@getmotif.dev
