> How to save agent memory with commit and get it back with recall in Bilinc: arguments, versions, CLI, HTTP and MCP examples, retries and how to check a write.

Canonical page: https://bilinc.space/docs/commit-recall

- [Docs](https://bilinc.space/docs)
- Concepts
- Commit and recall

# Write important state once, then recall it before risky work.

Commit saves one piece of agent state under a key in Bilinc Cloud. Recall finds the stored memories that match a question, so the agent can read them before it acts.

Search the docs

### All docs pages

Start

- [Overview](https://bilinc.space/docs)
- [Quickstart](https://bilinc.space/docs/quickstart)
- [Cloud quickstart](https://bilinc.space/docs/cloud-quickstart)
- [Quicktest help](https://bilinc.space/docs/quicktest-troubleshooting)
- [v2 migration](https://bilinc.space/docs/migration-v2)

Use Bilinc

- [Python SDK](https://bilinc.space/docs/python-sdk)
- [CLI](https://bilinc.space/docs/cli)
- [Cloud API](https://bilinc.space/docs/api-reference)
- [MCP integration](https://bilinc.space/docs/mcp)
- [Remote MCP for Claude](https://bilinc.space/docs/remote-mcp)
- [MCP tools](https://bilinc.space/docs/mcp-tools)
- [Wiki export](https://bilinc.space/docs/wiki)
- [Dream pass](https://bilinc.space/docs/dream)
- [Agent recipes](https://bilinc.space/docs/agent-recipes)

Agent integrations

- [Codex](https://bilinc.space/docs/codex)
- [Claude Code](https://bilinc.space/docs/claude-code)
- [Cursor](https://bilinc.space/docs/cursor)
- [MCP clients](https://bilinc.space/docs/mcp-clients)

Concepts

- [Memory model](https://bilinc.space/docs/memory-model)
- [Commit and recall](https://bilinc.space/docs/commit-recall)
- [Entitlements](https://bilinc.space/docs/entitlements)
- [Recall profiles](https://bilinc.space/docs/recall-profiles)
- [Evidence-aware recall](https://bilinc.space/docs/evidence-aware-recall)
- [Snapshots and rollback](https://bilinc.space/docs/snapshots-rollback)
- [Audit trail](https://bilinc.space/docs/audit-trail)

Operate

- [Security](https://bilinc.space/docs/security)
- [Production checklist](https://bilinc.space/docs/production-checklist)
- [Operations](https://bilinc.space/docs/operations)
- [Errors](https://bilinc.space/docs/errors)
- [Rate limits](https://bilinc.space/docs/rate-limits)
- [Troubleshooting](https://bilinc.space/docs/troubleshooting)

Reference

- [Environment variables](https://bilinc.space/docs/environment-variables)
- [CLI reference](https://bilinc.space/docs/cli-reference)

Also

- [Pricing](https://bilinc.space/pricing)
- [Changelog](https://bilinc.space/changelog)
- [Connect over MCP](https://bilinc.space/mcp)

Commit and recall are the core hosted memory loop for long-running agents. This page shows both calls from Python, the CLI, HTTP and MCP, the arguments that matter, the mistakes to avoid, and how to check that a write landed. Every change keeps a source and a history, and snapshots, diff and rollback let you undo a bad run.

## When to commit, and when to recall.

Commit when a fact should outlive the current run: a decision, a finished result, a user preference, the outcome of a task. Recall at the start of a task and before any step that is hard to undo, such as a deploy, a migration, or a message to a user.

Use the other calls for the other jobs. To correct a memory that must already exist, use `revise`; it never creates. To say a memory is still right without resending it, use `confirm`. To drop obsolete state, use `forget` with a reason. All of them are in the [API reference](https://bilinc.space/docs/api-reference).

## Commit only what should become durable memory.

Python

```
from bilinc import CloudClient

client = CloudClient()
client.commit(
    "project.status",
    {"phase": "docs refresh", "verified": True},
    memory_type="episodic",
    importance=0.8,
)
```

`CloudClient()` with no arguments reads `BILINC_API_KEY`, then the key saved by `bilinc login`.

### Commit arguments

| Argument | What it does |
| `key` | Required. Up to 512 characters. Use stable, namespaced keys such as `project.status` or `user.preference`. |
| `value` | Required. Any JSON value. |
| `memory_type` | Default `semantic`. See the [memory model](https://bilinc.space/docs/memory-model) for the types. |
| `importance` | A number from 0.0 to 1.0. Default 1.0. |
| `metadata` | A JSON object stored with the memory. |
| `source` | Optional "saved by" label, up to 256 characters. |
| `ttl` | Optional lifetime in seconds. Must be positive. |
| `idempotency_key` | Lets you retry the write without applying it twice. |
| `if_absent` | `True` writes only if the key does not exist yet; otherwise you get `409 memory_exists`. |

Commit returns an `entryVersion`. Keep it: pass it as `expected_version` to `revise` or `confirm`, and the call fails with `version_conflict` if someone changed the memory in between. Over HTTP, a successful commit answers `201`.

Committing to a key that already exists replaces its value. The earlier value stays in that memory's history, so you can see what changed and when. If you need "create only", pass `if_absent=True`.

## Recall before continuing a workflow.

Python

```
results = client.recall(
    "what did we verify in the docs refresh?",
    profile="balanced",
    limit=5,
)
```

### Recall arguments

| Argument | What it does |
| `query` | Required. Plain-language text, up to 4096 characters. |
| `profile` | `fast`, `balanced`, `verified` or `deep`. Default `balanced`. |
| `limit` | 1 to 100 results. Default 10. |
| `memory_types` | Optional list that limits recall to those memory types. |

Profiles depend on your plan. A profile your plan does not include returns `403 capability_not_entitled`, and `GET /api/cloud/status` lists the profiles your key may use. Start with `balanced` and read [recall profiles](https://bilinc.space/docs/recall-profiles) before you change it.

Recall is a search, not a lookup by key. To read one exact key, use `client.get_memory("project.status")`, or `bilinc list --prefix project.status` from the terminal.

## The same loop from the terminal.

Terminal

```
bilinc commit --key project.status --value '{"phase":"launch"}' --type episodic --importance 0.8
bilinc recall --query "project launch status" --profile balanced --limit 5
```

`--value` takes JSON or a plain string. The CLI covers key, value, type, importance and metadata; use the SDK or HTTP for the other commit arguments. See the [CLI reference](https://bilinc.space/docs/cli-reference).

## The same loop over HTTP.

Terminal

```
curl https://bilinc.space/api/cloud/memory/commit \
  -H "Authorization: Bearer $BILINC_API_KEY" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: $(uuidgen)" \
  -d '{
    "key": "project.status",
    "value": { "phase": "launch" },
    "memoryType": "episodic",
    "importance": 0.8
  }'

curl https://bilinc.space/api/cloud/memory/recall \
  -H "Authorization: Bearer $BILINC_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{ "query": "project launch status", "profile": "balanced", "limit": 5 }'
```

HTTP fields use camelCase: `memoryType`, `ifAbsent`, `memoryTypes`. In MCP clients the same calls are the `commit_mem` and `recall` tools; see [MCP tools](https://bilinc.space/docs/mcp-tools).

## Treat failures as non-durable.

If the Cloud API does not return success, the agent should behave as if the write did not happen. This keeps durable memory honest.

That includes a commit the hosted runtime rejects, which comes back as `409 version_conflict`: treat it as not saved, re-read the memory, then retry.

There is one exception. `503 mutation_outcome_unknown` means the write may have been applied. Do not resend it under a new idempotency key; send the request ID to support. Every other code is listed in the [error guide](https://bilinc.space/docs/errors).

The SDK retries recall by itself on transient failures. It never retries a commit, because a retried write could apply twice. If you retry a commit, send the same `idempotency_key` and the same payload: the server replays the first result and bills it once.

## Common mistakes.

- **Storing secrets.** A value that looks like an API key, token or private key is refused with `422 secret_detected`, and nothing is saved. Store where the secret lives instead.
- **Unstable keys.** A key with a timestamp or random ID in it creates a new memory every run. Keep keys stable and let the history record the changes.
- **Committing every turn.** Commit only what should outlive the run. Each commit is a billed write, and every extra memory is one more thing recall has to sort through.
- **Skipping recall before risky steps.** An agent that does not recall cannot use what it saved.
- **Reserved names.** Keys that start with `bilinc:dream:` and sources that start with `mcp:`, `mcp-local:` or `mcp-unverified:` are refused with `400 invalid_request`.

## How to check a write landed.

- The commit response has an `entryVersion` and a request ID in `_meta.requestId`.
- `bilinc history project.status` shows the change, newest first, with its source and time.
- `bilinc list --prefix project.` shows the key with its last-updated time.
- A recall with a matching question returns it.

History and list are free and read-only. For checkpoints before risky work, see [snapshots and rollback](https://bilinc.space/docs/snapshots-rollback).

## Frequently asked questions

### What is the difference between commit and revise?

Commit writes a memory, creating it or replacing the current value. Revise only changes a memory that already exists, and returns `404 memory_not_found` if it does not. Use revise when a missing key means something went wrong.

### Does commit overwrite an existing memory?

Yes, commit replaces the current value of an existing key. The earlier value stays in the memory's history. Pass `if_absent=True` to refuse instead, with `409 memory_exists`.

### Which recall profile should I use?

Start with `balanced`, the default. Higher profiles depend on your plan; `GET /api/cloud/status` shows which ones your key may use. See [recall profiles](https://bilinc.space/docs/recall-profiles).

### Is a failed commit charged?

A commit that fails validation is never charged, because validation runs before any credit is reserved. A commit that fails inside the hosted runtime releases its credit reservation. A retry with the same idempotency key and payload is billed once.

[PreviousMemory model](https://bilinc.space/docs/memory-model)
[NextEntitlements](https://bilinc.space/docs/entitlements)

On this page

- When to commit, and when to recall.
- Commit only what should become durable memory.
- Recall before continuing a workflow.
- The same loop from the terminal.
- The same loop over HTTP.
- Treat failures as non-durable.
- Common mistakes.
- How to check a write landed.
- Frequently asked questions
