Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions .claude-plugin/marketplace.json
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
{
"name": "past",
"name": "pastdotdev",
"description": "Connectors that give Claude Code a memory, built on the past.dev Memory API.",
"owner": {
"name": "past.dev",
"url": "https://past.dev"
},
"plugins": [
{
"name": "past",
"name": "pastdotdev",
"source": "./plugins/past",
"description": "Your Claude Code sessions become memory, and every session starts briefed.",
"version": "0.2.1",
"version": "0.3.0",
"author": {
"name": "past.dev",
"url": "https://past.dev"
Expand Down
31 changes: 17 additions & 14 deletions CLAUDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ plugins/past/
hooks/hooks.json SessionStart, UserPromptSubmit, Stop, PreCompact, SessionEnd
.mcp.json past_recall: the script's mcp mode, started by Claude Code
bin/past-hook.mjs the whole connector, one file, no dependencies
commands/ /past:connect, :status, :cut, :ingest, :backfill
commands/ /pastdotdev:connect, :status, :cut, :ingest, :backfill
skills/past/SKILL.md teaches Claude when to search history
LICENSE the same license: an install copies this folder and nothing else
.github/workflows/check.yml every pull request: the script parses and runs, the manifests validate
Expand All @@ -52,7 +52,7 @@ Use `updateState` for every change. Keep transcript hashes and pending sessions
## The rules this code keeps

1. **A hook never breaks the session.** Every mode exits 0, prints valid JSON or nothing, and
swallows its own failures. `/past:status` is where a person learns something is wrong, so a
swallows its own failures. `/pastdotdev:status` is where a person learns something is wrong, so a
failed send is kept in `state.lastError` for it.
2. **Only prose travels.** A session is ~10 MB on disk and ~30 KB of prose. Tool results, file
contents, diffs, subagent threads and harness-injected turns are cut. Sending the transcript
Expand All @@ -74,7 +74,7 @@ Use `updateState` for every change. Keep transcript hashes and pending sessions
Closing a window or quitting the app kills it without a `SessionEnd`; the waiter sees it gone
within the minute and sends the session as ended. There is no `ps` on Windows, so no owner
there, and the idle timer alone applies.
- `ensureWaiters` (`Stop`, `SessionStart`, `/past:status`) replaces a waiter that died or that
- `ensureWaiters` (`Stop`, `SessionStart`, `/pastdotdev:status`) replaces a waiter that died or that
an older `WAITER_VERSION` started — bump it whenever the waiter changes — and a replacement
past its deadline sends at once. A waiter that a newer copy started is left alone.
- In Claude Code, `SessionEnd` clears the stamp and detaches the send (`flush` mode), because
Expand All @@ -96,8 +96,8 @@ Use `updateState` for every change. Keep transcript hashes and pending sessions
One session is `ingest`, which sends at once — running it is the consent — and may send the
current one, which then stays pending. `cut` defaults to the current session, then to the most
recently written transcript, never the largest.
7. **Two ways in, one store.** `/past:connect` works wherever Claude Code runs and is the one the
docs lead with. The settings form (`userConfig`, opened by `/plugin configure past@past` in the
7. **Two ways in, one store.** `/pastdotdev:connect` works wherever Claude Code runs and is the one the
docs lead with. The settings form (`userConfig`, opened by `/plugin configure pastdotdev@pastdotdev` in the
terminal CLI only; the key masked and kept in the system credential store) is the alternative.
Both end in `~/.past/config.json`, which every mode reads. Form values reach
hooks only, as `CLAUDE_PLUGIN_OPTION_*`, so they land at the next hook, not when the form
Expand Down Expand Up @@ -159,11 +159,14 @@ Use `updateState` for every change. Keep transcript hashes and pending sessions

13. **The product is written past.dev.** Every sentence a person reads says past.dev: the READMEs,
the manifests' display names, the commands' and the skill's text, what a mode prints.
Identifiers keep `past`: the plugin and marketplace names (`past@past`), the commands
(`/past:connect`), `~/.past`, the key prefix `past_sk_` and the data point ids. So does the
recall block's header, `=== past · recalled from memory ===`: the script drops a block by that
exact text from the sessions it sends, so a changed header would change how old sessions render
and send them all again (rule 10).
An identifier that cannot hold the dot says `pastdotdev`: the plugin and marketplace names
(`pastdotdev@pastdotdev`, since 0.3.0) and so the commands (`/pastdotdev:connect`). A few
identifiers keep `past` because changing them would break what is already in place: `~/.past`
(shared with the other past.dev plugins), the key prefix `past_sk_`, the data point ids, the MCP
server `past` in `.mcp.json` and its tool `past_recall`, and the recall block's header,
`=== past · recalled from memory ===`. The script drops a block by that exact text from the
sessions it sends, so a changed header would change how old sessions render and send them all
again (rule 10).
14. **A hook answers Claude Code's own events alone.** Another agent can load this plugin's hooks
and run them on events of its own, about a conversation that is not Claude Code's. Claude Code
names the event in every hook's input (`hook_event_name`), so each hook mode checks that it is
Expand Down Expand Up @@ -205,20 +208,20 @@ cannot read the conversation and can only be recalled from.
every memory drawn from the item, `label` names the session, `metadata` carries
`conversationId`, `sessionId`, `project`, `gitBranch`, `sitting`. A batch takes up to 1,000
items and 16 MB of content.
- `POST /api/v1/recall` — **`identity` is required**. Recall stays off until `/past:connect`
- `POST /api/v1/recall` — **`identity` is required**. Recall stays off until `/pastdotdev:connect`
sets one. The response is one result per document in rank order; the hooks read each result's
`content` and `occurredAt`, and the tool also its sources' `excerpts` and `metadata.localTime`
and its artifact's `supersededAt`. The prompt hook sends `limit` 10; the tool sends `limit` 100
and `maxTokens` 2,000.
- `audience` on ingest — a slug; absent means the whole project. `connect --audience` checks it
with `GET /api/v1/audiences/{slug}` (404 when unknown); a later `audience-unknown` refusal is
kept in `state.lastError` for `/past:status`, like every failed send.
kept in `state.lastError` for `/pastdotdev:status`, like every failed send.
- `UserPromptSubmit` gives the prompt as `prompt` on stdin.
- Claude Code gives a hook `session_id`, `transcript_path`, `cwd` and `hook_event_name`, and
takes `hookSpecificOutput.additionalContext` at session start and on a prompt.
- A project API key (`past_sk_…`) names its own project. The plugin never sends a project id.
- Claude Code starts a plugin's MCP server from the `mcpServers` file its manifest names, expands
`${CLAUDE_PLUGIN_ROOT}` in its arguments, and names its tool `mcp__plugin_past_past__past_recall`.
`${CLAUDE_PLUGIN_ROOT}` in its arguments, and names its tool `mcp__plugin_pastdotdev_past__past_recall`.

If any of these contracts changes, this file changes with it.

Expand Down Expand Up @@ -248,7 +251,7 @@ small `idleMinutes` in that config makes the idle timer testable in seconds.
For the tool, pipe JSON-RPC lines (`initialize`, `tools/list`, `tools/call`) into `node
plugins/past/bin/past-hook.mjs mcp` in the same throwaway home, with a stand-in answering `POST
/api/v1/recall`, and check what the request carried; then install the plugin from the folder into a
throwaway `CLAUDE_CONFIG_DIR` and see `claude mcp list` report `plugin:past:past` connected.
throwaway `CLAUDE_CONFIG_DIR` and see `claude mcp list` report `plugin:pastdotdev:past` connected.

**A change to the script is checked against what it sent before.** Run the old script and the new
one over the same transcripts, each in a throwaway home with its own stand-in, and compare what each
Expand Down
49 changes: 31 additions & 18 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ You need Claude Code and Node 16 or later.

```
/plugin marketplace add pastdotdev/claude-code-plugin
/plugin install past@past
/plugin install pastdotdev@pastdotdev
```

The first line adds this repository as a marketplace. The second line installs the plugin
Expand All @@ -46,17 +46,17 @@ You need Claude Code and Node 16 or later.
3. **Connect it.**

```
/past:connect <project-api-key> <identity>
/pastdotdev:connect <project-api-key> <identity>
```

The identity is the email or id every memory is attributed to. Recall stays off without one.

4. **Check it.** `/past:status` shows the project it talks to and what it has sent.
4. **Check it.** `/pastdotdev:status` shows the project it talks to and what it has sent.

New sessions are read from then on. `/past:backfill` lists the sessions already on this machine,
New sessions are read from then on. `/pastdotdev:backfill` lists the sessions already on this machine,
estimates what sending them costs, and sends them when you confirm.

To keep the key out of the conversation, use `/plugin configure past@past` in the terminal CLI
To keep the key out of the conversation, use `/plugin configure pastdotdev@pastdotdev` in the terminal CLI
instead of step 3: a form that masks the key and keeps it in your system's credential store.

## How it works
Expand Down Expand Up @@ -94,7 +94,7 @@ and anything injected into the conversation rather than typed by a person. Strin
keys, tokens or private keys become `[redacted]` before anything leaves, and recall queries are
redacted the same way.

`/past:cut` prints exactly what would be sent from this session, sitting by sitting, before
`/pastdotdev:cut` prints exactly what would be sent from this session, sitting by sitting, before
anything is.

A session is about 10 MB on disk and about 30 KB of prose, and only the prose travels. At 350
Expand All @@ -105,16 +105,16 @@ see [past.dev/pricing](https://past.dev/pricing).

| Command | What it does |
|---|---|
| `/past:connect <key> <identity> [api-url]` | connect this machine; `--audience <slug>` sets who sees what you send |
| `/past:status` | what it is connected to, what it has sent, and the last send that failed |
| `/past:cut [session]` | print exactly what would be sent from this session, or from one you name |
| `/past:ingest [session]` | send one session now, without waiting for it to go quiet |
| `/past:backfill` | list and estimate the sessions already on this machine, then send them |
| `/pastdotdev:connect <key> <identity> [api-url]` | connect this machine; `--audience <slug>` sets who sees what you send |
| `/pastdotdev:status` | what it is connected to, what it has sent, and the last send that failed |
| `/pastdotdev:cut [session]` | print exactly what would be sent from this session, or from one you name |
| `/pastdotdev:ingest [session]` | send one session now, without waiting for it to go quiet |
| `/pastdotdev:backfill` | list and estimate the sessions already on this machine, then send them |

## Who sees what you send

Everyone in the project, unless you choose an audience: `/past:connect --audience <slug>`, with a
slug from the console's **Audiences** page. `/past:connect --audience project` widens it back.
Everyone in the project, unless you choose an audience: `/pastdotdev:connect --audience <slug>`, with a
slug from the console's **Audiences** page. `/pastdotdev:connect --audience project` widens it back.

## Settings

Expand All @@ -124,25 +124,38 @@ half off, `idleMinutes` (720) is how long a session stays quiet before it is sen
sessions are never read. `PAST_API_KEY`, `PAST_IDENTITY` and `PAST_API_URL` override the file.
Each setting is described in the [plugin's README](plugins/past/README.md#configuration).

For a self-hosted past.dev, pass your deployment's URL as the third argument of `/past:connect`. Use
For a self-hosted past.dev, pass your deployment's URL as the third argument of `/pastdotdev:connect`. Use
`https`: over plain `http` to another machine the key travels unencrypted, and the plugin says so.

## When something looks wrong

Start with `/past:status`. A hook never interrupts a session, so a problem shows up there rather
Start with `/pastdotdev:status`. A hook never interrupts a session, so a problem shows up there rather
than in the conversation.

- **Nothing is recalled.** Status has to show a key and an identity: recall needs both. A new
project has nothing to recall until its first sessions are in; `/past:ingest` sends the current
project has nothing to recall until its first sessions are in; `/pastdotdev:ingest` sends the current
one now.
- **A send failed.** Status shows the last failed send and what the API answered.
- **The hooks stay silent.** They call `node`. Claude Code started from the Dock or a launcher
finds the `node` of a login shell, which may be older than your terminal's: Node 16 or later has
to come first on that path.

## Moving from past@past

Before 0.3.0 the plugin was installed as `past@past`. To move to the new name, run these in Claude Code:

```
/plugin uninstall past@past
/plugin marketplace remove past
/plugin marketplace add pastdotdev/claude-code-plugin
/plugin install pastdotdev@pastdotdev
```

Your connection stays in `~/.past`, so you don't need to connect again, and sessions already sent aren't sent twice.

## Remove it

`/plugin uninstall past@past`, then delete `~/.past`. Revoking the key in **Build › API keys**
`/plugin uninstall pastdotdev@pastdotdev`, then delete `~/.past`. Revoking the key in **Build › API keys**
stops it at once from the server side. What was already sent stays in the project until you
delete it in the console.

Expand All @@ -157,7 +170,7 @@ plugins/past/
.claude-plugin/plugin.json the manifest, with the settings form
hooks/hooks.json the five hooks
bin/past-hook.mjs the whole plugin: one file, Node 16, no dependencies
commands/ /past:connect, :status, :cut, :ingest, :backfill
commands/ /pastdotdev:connect, :status, :cut, :ingest, :backfill
skills/past/SKILL.md teaches Claude when to search past.dev
```

Expand Down
4 changes: 2 additions & 2 deletions plugins/past/.claude-plugin/plugin.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "past",
"name": "pastdotdev",
"displayName": "past.dev",
"version": "0.2.1",
"version": "0.3.0",
"description": "Your Claude Code sessions become memory, and every session starts briefed.",
"author": { "name": "past.dev", "url": "https://past.dev" },
"homepage": "https://github.com/pastdotdev/claude-code-plugin",
Expand Down
Loading
Loading