Agents need a stable project instruction block so they scan and write memory the same way every session. For MCP-only setups that block talks about MCP tools, not machine-memory CLI flags.
The managed section lives between HTML markers and can be replaced safely:
<!-- machine-memory:start -->
…
<!-- machine-memory:end -->Everything outside the markers is preserved.
Public script (no CLI)
From the repository root:
macOS and Linux
curl -fsSL https://machine-memory.jfa.dev/init-mcp | bashWindows
irm https://machine-memory.jfa.dev/init-mcp.ps1 | iexThis is the MCP counterpart to the CLI install script. It:
- Creates
AGENTS.mdif missing, or updates the managed block in place - Writes the MCP backend workflow (tool names, repository slug rules, size preflight, checklist)
- Prints the backend and a pointer at this docs section
Options
| Variable | Effect |
|---|---|
MACHINE_MEMORY_AGENTS_MD |
Path to write (default AGENTS.md). Absolute or relative to the current directory. |
Examples:
# default ./AGENTS.md
curl -fsSL https://machine-memory.jfa.dev/init-mcp | bash
# custom path
MACHINE_MEMORY_AGENTS_MD=.agents/memory.md \
curl -fsSL https://machine-memory.jfa.dev/init-mcp | bash# default ./AGENTS.md
irm https://machine-memory.jfa.dev/init-mcp.ps1 | iex
# custom path
$env:MACHINE_MEMORY_AGENTS_MD = ".agents/memory.md"
irm https://machine-memory.jfa.dev/init-mcp.ps1 | iexRequirements: on macOS/Linux the init-mcp script needs bash, base64, and python3. The Windows init-mcp.ps1 script needs PowerShell 5.1+ only (no extra dependencies).
CLI equivalent
If the CLI is installed:
machine-memory init --mcpSame managed block as the public script. Use --local or --remote when agents should follow CLI commands instead — see init.
Exactly one of --local, --remote, or --mcp is required.
When to run it
- First time enabling MCP-only memory for a repo
- After changing the MCP workflow or tool surface you want agents to follow
- Safe to re-run: the block is replaced, not duplicated
What agents get
The MCP block tells agents to:
- Use MCP tools only, including maintenance (
memory_doctor,memory_stats,memory_gc,memory_deprecate) and explicit bulk deletion (memory_delete_many) - Pass an exact
owner/namerepository slug (no default); reads are loose (wrong slug returns empty, nothing lost) but writes are strict, so calllist_repositoriesbefore every write when unsure - Follow
offsetwhilehas_moreis true onmemory_listandlist_repositories; repository entries include status counts - Scan with
memory_suggestfor known files; verify withmemory_verify/memory_diff; maintain withmemory_updateviamatchormemory_addviaupsert_match(weak matches needforce: true) - Set
memory_type/certaintyexplicitly (memory_adddefaults toconvention/inferred);expires_after_daysworks only forstatusmemories - Preflight long content with
memory_size; respect on-flight size rejection on writes - Scan before edits and persist durable decisions at task end
Full tool reference: Tools.