> ## Documentation Index
> Fetch the complete documentation index at: https://docs.checkfu.com/llms.txt
> Use this file to discover all available pages before exploring further.

> ## Agent Instructions
> Checkfu is open source (https://github.com/checkfu/checkfu) and runs in the reader's own Cloudflare account. There is no shared hosted base URL: `checkfu deploy` prints the deployment's API URL (`https://<api-worker>.workers.dev` or the CHECKFU_API_DOMAIN hostname, exported as `CHECKFU_BASE_URL` for the CLI, SDK, and curl) and MCP URL (`.../mcp`). Local development serves the API on http://localhost:1337 and MCP on http://localhost:1338/mcp.
> Authenticated HTTP requests send the deployment's CHECKFU_API_KEY as `Authorization: Bearer $CHECKFU_API_KEY` (or `x-api-key`) and `Content-Type: application/json` for JSON bodies. Pass `Idempotency-Key` on retriable writes.
> Core workflow: create an Agent (`POST /v1/agents`) and an Environment (`POST /v1/environments`), create a Session that references both (`POST /v1/sessions`), send a `user.message` event (`POST /v1/sessions/{session_id}/events`), and follow `GET /v1/sessions/{session_id}/events/stream` until `session.status_idle`.
> Other resources: Memory stores (`/v1/memory_stores`), Files (`/v1/files`), Artifacts (`/v1/artifacts`), Vaults and credentials (`/v1/vaults`), Provider credentials (`/v1/provider_credentials`), Automations (`/v1/automations`), Inbound bindings (`/v1/inbound_bindings`), and Webhooks (`/v1/webhooks`). The deployment serves its OpenAPI 3.1 specification at `GET /openapi.json`.

# Memory stores

> Keep text files that outlive a Session and share them between Sessions and your app.

A Memory store holds small text files, called memories, that outlive any Session. The agent reads and writes them as files under `/mnt/memory/<store>`, while your app can edit the same memories over the API.

```ts TypeScript theme={"theme":{"light":"github-light","dark":"github-dark"}}
import Checkfu from "@checkfu/sdk"

const client = new Checkfu()

const store = await client.waitForPending(
	await client.memoryStores.create({ name: "User Preferences", description: "One file per user." }),
)
const memory = await client.waitForPending(
	await client.memoryStores.memories.create(store.id, {
		path: "/users/ada.md",
		content: "Prefers short answers.\n",
	}),
)
```

```sh CLI theme={"theme":{"light":"github-light","dark":"github-dark"}}
checkfu memory-stores create --name "User Preferences" --description "One file per user."
checkfu memory-stores:memories create --memory-store-id "$MEMORY_STORE_ID" --path /users/ada.md --content @ada.md
```

The agent sees the store's `name` and `description` in its prompt, so make the description clear about what belongs there.

## Update without losing changes

Your app and any number of Sessions can write to the same store. Pass the SHA-256 hash you last read so the update applies only if nobody changed the memory in the meantime:

```ts theme={"theme":{"light":"github-light","dark":"github-dark"}}
const current = await client.memoryStores.memories.retrieve(store.id, memory.id)
try {
	await client.memoryStores.memories.update(store.id, memory.id, {
		content: current.content + "Timezone: Europe/London\n",
		precondition: { type: "content_sha256", content_sha256: current.content_sha256 },
	})
} catch (error) {
	if (!(error instanceof Checkfu.ConflictError)) throw error
	// Someone else changed it. Read it again and reapply your edit.
}
```

## Mount a store in a Session

```json theme={"theme":{"light":"github-light","dark":"github-dark"}}
{
	"agent": "agent_...",
	"environment_id": "env_...",
	"resources": [
		{
			"type": "memory_store",
			"memory_store_id": "memstore_...",
			"access": "read_write",
			"instructions": "Check the user's file before answering. Record new preferences there."
		}
	]
}
```

A store named `"User Preferences"` mounts at `/mnt/memory/user-preferences`. In a `read_write` mount, each file write is persisted to the store immediately, so multiple Sessions can share live state. Size and count caps are in [Limits](https://docs.checkfu.com/reference/limits.md#memory-stores-and-files).


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.