---
title: "init"
description: "Create or replace the managed machine-memory instructions in AGENTS.md."
---

> Documentation Index
> Fetch the complete documentation index at: https://machine-memory.jfa.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# init

## Prerequisites

This tool uses [Bun Secrets](https://bun.com/docs/runtime/secrets) to safely store items in your keychain and requires the userspace to have access to it.

While this is guaranteed on Windows and macOS machines, Linux users must have a compatible `libsecret` keychain available on the shell session.

## Usage

```sh
machine-memory init (--local|--remote|--mcp)
```

This command creates `AGENTS.md` when it does not exist, or replaces the content between the `machine-memory:start` and `machine-memory:end` markers when it already exists. Everything outside those markers is preserved.

The generated block tells future agents how to scan memory, which backend to use, and how to maintain durable project context. The selected backend is written into the block so its examples stay consistent with the command you ran.

## Backend selection

Exactly one flag is required:

```sh
machine-memory init --local
```

```sh
machine-memory init --remote
```

```sh
machine-memory init --mcp
```

| Flag       | Agents should use   | Notes                                               |
| ---------- | ------------------- | --------------------------------------------------- |
| `--local`  | CLI with `--local`  | SQLite at `machine-memory.db`                       |
| `--remote` | CLI with `--remote` | Shared Worker; see [remote](/human/remote/overview) |
| `--mcp`    | MCP tools only      | No CLI required; see [MCP init](/docs/mcp/init)     |

For MCP-only repos without the CLI installed, use the public script instead:

```sh
curl -fsSL https://machine-memory.jfa.dev/init-mcp | bash
```

On Windows:

```powershell
irm https://machine-memory.jfa.dev/init-mcp.ps1 | iex
```

Details: [MCP → Init](/docs/mcp/init).

## When to run it

Run this after changing the project’s memory workflow or backend policy. It is safe to run again: the managed block is updated in place rather than appended repeatedly.

Source: https://machine-memory.jfa.dev/human/init/index.mdx
