Skip to main content
Glama
nxsio

continuity-core

Official
by nxsio
README.md
# Pick up tomorrow where you left off today.

Continuity Core remembers a commitment, finds it in a later session, and gives your assistant the exact next action and finish line. Run it locally and connect any MCP client to `http://127.0.0.1:43187/mcp`.

## Try it

Requires Node.js 24+ and pnpm.

```bash
pnpm install
pnpm start
```

In another terminal, use the included client built with the official MCP SDK:

```bash
pnpm smoke write my-day
```

The response includes a commitment ID. Stop and restart the server, then open a new client process:

```bash
pnpm smoke read my-day 1
```

Replace `1` with the ID returned by the write command. The client connects over Streamable HTTP, lists the tools, recalls the saved commitment, and calls `resume_commitment` for its next step.

## Use it from your MCP client

Point a Streamable HTTP connection at `http://127.0.0.1:43187/mcp`. The server exposes three tools:

- `remember_commitment`: save a commitment with a caller chosen context, next action, and observable finish line.
- `recall_commitments`: find up to 20 commitments in that context, newest first. Call with `{ "context": "my-day" }` for the latest page. If `next_before_id` is a number, pass it as `before_id` with the same context to read the next page. A `null` cursor means you have reached the oldest commitment.
- `resume_commitment`: retrieve one commitment as a next step card.

Set `CONTINUITY_DB_PATH` to choose the SQLite file. The default is `.local/continuity.sqlite` in the directory where the server starts. `CONTINUITY_PORT` changes the loopback port.

## Run on Cloudflare Workers

The Worker serves the same three MCP tools at `/mcp` and keeps commitments in D1 across requests. Every `/mcp` request needs `Authorization: Bearer <CORE_SHARED_SECRET>`.

For local Worker development, put `CORE_SHARED_SECRET` in an untracked `.dev.vars` file, then run:

```bash
pnpm install --frozen-lockfile
pnpm exec wrangler d1 migrations apply DB --local
pnpm dev:worker
```

Connect a Streamable HTTP client to `http://127.0.0.1:8787/mcp` with that bearer token. The included smoke client also accepts `CORE_SHARED_SECRET` from its environment and `CONTINUITY_URL` for the endpoint.

To publish under your Cloudflare account:

```bash
pnpm exec wrangler d1 create continuity-core
```

Replace the all-zero `database_id` in `wrangler.jsonc` with the ID returned by that command. Then apply the schema and set the secret before the final deployment:

```bash
pnpm exec wrangler d1 migrations apply DB --remote
pnpm exec wrangler secret put CORE_SHARED_SECRET
pnpm exec wrangler deploy
```

`wrangler secret put` prompts for the value and deploys a Worker version. `wrangler.jsonc` declares the secret as required, so `wrangler deploy` rejects a missing secret; the Worker also refuses `/mcp` when no secret is bound. The D1 migration creates the commitments table and an index for context pagination.

This setup uses the [Workers Free limits](https://developers.cloudflare.com/workers/platform/limits/) of 10 ms CPU per request and 100,000 requests per day, plus the [D1 Free allowance](https://developers.cloudflare.com/d1/platform/pricing/) of 5 million rows read and 100,000 rows written per day with 5 GB total storage. The recall tool fetches at most 21 indexed rows per call. Free limits stop requests when exhausted; they do not upgrade the account.

## Call Nemotron

Set `NEMOTRON_API_KEY`, then send a short prompt:

```bash
NEMOTRON_API_KEY=your-key pnpm nemotron "Give me one next step for my project."
```

The development default uses DeepInfra's Nemotron 3 Super. Set `NEMOTRON_BASE_URL` and `NEMOTRON_MODEL` to use another OpenAI-compatible endpoint. The command prints the answer, token usage, and elapsed time.

## License

MIT. See [LICENSE](LICENSE).