How to use MemoFS with Google Antigravity
Connect MemoFS to Google AntiGravity agents for persistent project memory across multi-agent workflows.
Google Antigravity is Google's AI-first development platform, available as Antigravity IDE (in-editor AI experience) and Antigravity CLI (agy) (terminal interface).
Antigravity automatically discovers project-scoped rules, skills, and MCP configurations inside the .agents/ folder. This cookbook guides you through setting up MemoFS with Antigravity IDE and Antigravity CLI.
How Antigravity Handles Rules & MCP
- Rules: Antigravity loads project rules from
AGENTS.mdand.agents/rules/(legacyGEMINI.mdfiles are also supported for backwards compatibility). - MCP Servers in Antigravity IDE: Workspace-local MCP servers are configured in
.agents/mcp_settings.json. - MCP Servers in Antigravity CLI: Global or profile-based MCP servers are registered using the
agy mcp addcommand or stored in~/.gemini/antigravity-cli/settings.json.
Setup Instructions
Step 1: Initialize project memory
Run the initializer in your project root:
cd /path/to/your/project
npx @memofs/cli initStep 2: Generate agent rules
Generate the rules file for your workspace:
npx @memofs/cli generate agent-rules gemini --project-name "Your project name"Note: If
AGENTS.mdis present in your project root, Antigravity loads it automatically. You can also link or copy rules intoAGENTS.mdand.agents/rules/.
Step 3: Register the MCP Server
Why `--root` is required for Antigravity:
Unlike Claude Code or Codex (which spawn MCP processes with cwd set to the project workspace), Antigravity spawns background MCP servers from its central daemon directory (~/.gemini/antigravity).
Without --root <path> or the MEMOFS_ROOT environment variable, MemoFS defaults to process.cwd() (~/.gemini/antigravity), which fails with UNEXPECTED_ERROR: Failed to create memory file parent directory. because Antigravity protects its system app directory from process writes. Always pass --root /absolute/path/to/your/project (or --root . when launched from the project root) or set MEMOFS_ROOT.
Depending on whether you are using Antigravity IDE or Antigravity CLI, follow the appropriate method below:
Option A: Antigravity IDE (Project-Local Configuration)
Add the MemoFS MCP server definition to .agents/mcp_settings.json (or .agents/mcp_config.json) in your project root:
{
"mcpServers": {
"memofs": {
"command": "npx",
"args": ["-y", "@memofs/mcp-server", "--root", "/absolute/path/to/your/project"]
}
}
}Or pass the workspace root dynamically via env:
{
"mcpServers": {
"memofs": {
"command": "npx",
"args": ["-y", "@memofs/mcp-server"],
"env": {
"MEMOFS_ROOT": "/absolute/path/to/your/project"
}
}
}
}If .agents/mcp_settings.json does not exist yet, create it with the above content.
Option B: Antigravity CLI (agy)
Register the MCP server directly via the CLI with the --root parameter:
agy mcp add memofs -- npx -y @memofs/mcp-server --root /absolute/path/to/your/projectAlternatively, run agy config --edit to edit your global CLI MCP profile.
Step 4: Record Memory & Verify
First, record a test decision:
npx @memofs/cli remember "Project uses VitePress for documentation" --kind noteIn Antigravity IDE:
- Open the sidebar chat panel in your IDE.
- Ask the agent: "Which docs framework does this project use?"
- Verify that the agent invokes the
memofsMCP tools and returns the recorded fact.
In Antigravity CLI (agy):
- Run
agy inspectto verify active MCP tools and skills. - Confirm
memofsis listed under active MCP servers.