Metadata-Version: 2.5
Name: pluto-center
Version: 0.4.0
Summary: Shared memory for AI agents: CLI, Python client and server
License-Expression: MIT
Requires-Python: >=3.11
Requires-Dist: click>=8.0
Requires-Dist: httpx>=0.27
Requires-Dist: rich>=13.0
Provides-Extra: dev
Requires-Dist: aiosqlite>=0.20; extra == 'dev'
Requires-Dist: asyncpg>=0.30; extra == 'dev'
Requires-Dist: fastapi>=0.115; extra == 'dev'
Requires-Dist: fastembed>=0.5; extra == 'dev'
Requires-Dist: mcp<2,>=1.27; extra == 'dev'
Requires-Dist: numpy>=1.26; extra == 'dev'
Requires-Dist: pydantic-settings>=2.2; extra == 'dev'
Requires-Dist: pydantic>=2.7; extra == 'dev'
Requires-Dist: pyjwt>=2.8; extra == 'dev'
Requires-Dist: pytest-asyncio>=1.0; extra == 'dev'
Requires-Dist: pytest>=8.0; extra == 'dev'
Requires-Dist: ruff>=0.5; extra == 'dev'
Requires-Dist: sqlalchemy[asyncio]>=2.0.30; extra == 'dev'
Requires-Dist: uvicorn[standard]>=0.30; extra == 'dev'
Provides-Extra: e2e
Requires-Dist: playwright>=1.40; extra == 'e2e'
Provides-Extra: embeddings
Requires-Dist: fastembed>=0.5; extra == 'embeddings'
Provides-Extra: mcp
Requires-Dist: mcp<2,>=1.27; extra == 'mcp'
Provides-Extra: postgres
Requires-Dist: asyncpg>=0.30; extra == 'postgres'
Provides-Extra: server
Requires-Dist: aiosqlite>=0.20; extra == 'server'
Requires-Dist: fastapi>=0.115; extra == 'server'
Requires-Dist: mcp<2,>=1.27; extra == 'server'
Requires-Dist: numpy>=1.26; extra == 'server'
Requires-Dist: pydantic-settings>=2.2; extra == 'server'
Requires-Dist: pydantic>=2.7; extra == 'server'
Requires-Dist: pyjwt>=2.8; extra == 'server'
Requires-Dist: sqlalchemy[asyncio]>=2.0.30; extra == 'server'
Requires-Dist: uvicorn[standard]>=0.30; extra == 'server'
Description-Content-Type: text/markdown

# Pluto

Shared memory for AI agents. What one agent learns about your codebase (a gotcha, a
convention, why a decision was made), every agent on your team can find, without a person
relaying it.

- **Memory.** Agents save warnings, decisions, conventions, discoveries and open questions.
  Search is semantic, so "renew the login session" finds a note about "token refresh".
  Repeats are not stored twice, credentials are redacted, and agents confirm or dispute
  each other's notes (one vote per person, never on your own).
- **Briefings.** When an agent starts a task it gets the handful of notes relevant to that
  task, the conventions closest to it, and how the last session ended. A few hundred
  tokens, not a dump.
- **Session summaries.** What an agent reports when it finishes stays searchable for 90
  days, so findings are not lost when nobody saved them as a note.
- **Presence.** Agents see who else is working on the project, including your own other
  terminals, and are told before editing a file another session is on.

Any agent can use it: MCP clients (Claude Code, Cursor, …) over the hosted MCP server,
everything else over the REST API, the Python client or the CLI.

## Quick start (hosted)

1. Sign up at [app.pluto.center](https://app.pluto.center). You get a workspace and a
   personal API key.
2. Connect Claude Code with the command the dashboard shows:

   ```bash
   claude mcp add --transport http --scope user pluto https://api.pluto.center/mcp \
     --header "X-API-Key: plt_..."
   ```

3. Invite teammates from **Team & keys**. They open the link, sign up and connect the same way.

Nothing to install. Each API key is its own agent identity. One key can run any number of
sessions at once; create a second key when you want a second identity (another machine, a
CI job). The free plan has three keys per workspace.

## What the agent gets (MCP)

Seven tools, about 1,000 tokens of context in total including the server's instructions:

| Tool | Purpose |
|------|---------|
| `pluto_start` | Start a task: returns a session id, relevant notes, conflicts, who else is active |
| `pluto_search` | Search the team's notes |
| `pluto_get` | Read one note in full |
| `pluto_save` | Save one fact: a warning, decision, pattern, discovery or question (`replaces` corrects a note) |
| `pluto_files` | Before editing: marks the files as yours, returns who else is on them and notes attached to them |
| `pluto_feedback` | Confirm or dispute a note |
| `pluto_end` | End the session with a summary for the next agent |

Results are one line per note with a short id, within a fixed size budget; the full text is
fetched only when the agent asks for it. Notes are scoped to a project, which is the name
of the repository's git remote. Everything written by other agents is marked as reference
data, flattened to single lines and, for full notes, fenced with a random marker, so a note
cannot pose as instructions.

Correcting a note: `replaces` supersedes a note your own agents wrote. A teammate's note
stays visible and gets your dispute instead; one agent cannot make another's knowledge
disappear. A logged-in person can edit or delete anything in the dashboard.

Clients that can only launch a local command use the stdio bridge:
`pip install "pluto-center[mcp]"`, then run `pluto-mcp` with `PLUTO_API_KEY` set.

## REST API and Python client

Everything the MCP tools do is available as JSON. Reference and try-it-out UI:
[api.pluto.center/docs](https://api.pluto.center/docs).

```bash
curl -X POST https://api.pluto.center/api/v1/briefing \
  -H "X-API-Key: $PLUTO_API_KEY" -H "Content-Type: application/json" \
  -d '{"task": "Fix double charge on retry", "project": "payments"}'
```

```python
# pip install pluto-center
from pluto import Pluto          # AsyncPluto has the same methods as coroutines

pluto = Pluto()                  # reads PLUTO_API_KEY
briefing = pluto.start("Fix double charge on retry", project="payments", files=["src/retry.py"])
hits = pluto.search("how do refunds reach the ledger", project="payments")
pluto.remember("warning", "Retries must hold the ledger lock",
               "Two retries can double-post without it.", project="payments")
pluto.end("Added the lock; refund path still untested.", project="payments")
```

Agents authenticate with `X-API-Key` (or `Authorization: Bearer plt_...`). Managing the
workspace (keys, invites, members) needs a person's login token from `POST /auth/login`;
an agent key cannot do it. Errors are always `{"detail": "...", "code": "..."}`, and
unknown request fields are rejected. Search works best on short notes that state one fact:
only about the first 250 words of a note are matched semantically, the rest by keywords.

## CLI

```bash
pip install pluto-center
pluto signup                      # or: pluto login, or pluto use-key (paste a dashboard key)
pluto connect claude-code         # also: cursor, print (config for any MCP client)
pluto logout                      # sign out here and revoke this machine's key
pluto status                      # who is working on what
pluto search "auth token refresh"
pluto save warning "Title" "What another agent needs to know" --file src/auth.py
pluto invite                      # invite link for a teammate
pluto generate-context            # write the project's notes to PLUTO.md, for tools without MCP
```

Failures exit non-zero. For CI, set `PLUTO_API_KEY` (and `PLUTO_URL` for your own server)
instead of logging in.

## Running your own server

```bash
cp .env.example .env              # set PLUTO_SECRET_KEY and POSTGRES_PASSWORD
docker compose up --build         # API on http://localhost:8000, dashboard at /app/, docs at /docs
```

Or without Docker, on SQLite, for development:

```bash
pip install -e ".[dev]"
pluto server
```

| Variable | Default | |
|----------|---------|---|
| `PLUTO_DATABASE_URL` | `sqlite+aiosqlite:///./pluto.db` | Use PostgreSQL with pgvector in production |
| `PLUTO_SECRET_KEY` | none | JWT signing key. Required with PostgreSQL |
| `PLUTO_APP_URL`, `PLUTO_API_URL` | hosted addresses | Used in invite links and setup commands |
| `PLUTO_EMBEDDING_PROVIDER` | `auto` | `auto`: local model if installed, else keyword overlap. `fastembed`, `hash` |
| `PLUTO_EMBEDDING_MODEL` | `sentence-transformers/all-MiniLM-L6-v2` | English. See "Changing the embedding model" |
| `PLUTO_RATE_LIMIT_PER_MINUTE` | `240` | Per API key |
| `PLUTO_PUBLIC_DOCS` | `true` | Serve `/docs` and `/openapi.json` |

Things to know when operating it:

- **One API process.** Rate limiting and login throttling keep their state in memory.
- **Behind a reverse proxy.** The API trusts `X-Real-IP`; `deploy/nginx/pluto.conf` sets it.
  Never expose port 8000 directly.
- **Schema changes are applied at startup** and are additive only: new tables, nullable
  columns, enum values and indexes. Anything else needs a manual migration; a missing
  NOT NULL column stops startup rather than failing later.
- **Changing the embedding model** re-indexes existing memories in the background at the
  next start. The relevance and duplicate thresholds in `services/embeddings.py` were
  calibrated for the default model and must be re-checked with
  `tests/test_retrieval_quality.py` for another one. A model with a different vector size
  also needs `ALTER TABLE memories ALTER COLUMN embedding TYPE vector(<n>)` and
  `PLUTO_EMBEDDING_DIM`. Notes in other languages are found by their keywords with the
  default model; semantic matching of them needs a multilingual model.
- **Retention.** Session summaries are kept as searchable memory for 90 days and ended
  sessions for 180; notes are kept until someone deletes them.
- **Backups.** `deploy/backup.sh` dumps the database nightly and keeps 14 days, on the same
  machine. Copy them somewhere else too.

Deployment to the hosted server is `PLUTO_DEPLOY_HOST=root@<server> deploy/deploy.sh`.

## Development

```bash
pip install -e ".[dev]"
pytest                                            # SQLite, about 40 seconds
PLUTO_TEST_DATABASE_URL=postgresql+asyncpg://user:pass@localhost/pluto_test pytest   # PostgreSQL + pgvector
PLUTO_TEST_REAL_EMBEDDINGS=1 pytest tests/test_retrieval_quality.py -s               # search quality, real model
ruff check src tests && ruff format --check src tests
```

`tests/e2e` starts a real server and drives it with the CLI, the Python client, the stdio
bridge and (if Playwright is installed) a browser. `tests/test_mcp_budget.py` fails when a
change makes the MCP tools or their results cost more context than budgeted.
