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 - Treat search results as ranked candidates, not an exhaustive list; rely on
match_strengthandno_strong_matchrather than scores, and prefer known IDs,memory_suggest, andtagsfilters - Set certainty from evidence: name the
evidencekinds (user_requirement,observed_implementation,verified_mechanism,tested_behavior) and listvalidation_gaps;verifiedwithout evidence is rejected - Keep durable knowledge separate from delivery status; say whether work is local, committed, pushed, or deployed in an expiring
statusrecord - Carry over unrelated details when replacing a record (
memory_diffandmemory_updatereportdroppeddetails), and resolve thereview_candidatesthat updates and deprecations return - Let the parent agent own memory writes; child agents return persistence candidates with evidence
- Scan before edits, then run the end-of-task checkpoint: classify each finding as covered, new durable knowledge, superseded, transient status, or intentionally omitted
Full tool reference: Tools.