Kilo Code
Setup Guides/Kilo Code

Memstate + Kilo Code

Give Kilo Code long-term memory that persists across VS Code sessions.

Kilo Code is a VS Code AI coding agent that starts fresh every session. Memstate gives Kilo Code a structured, versioned memory layer via MCP — so it remembers your architecture, past decisions, and project context without you having to re-explain everything.

1

Get Your API Key

Sign up for free at Memstate AI and create an API key from your dashboard. No credit card required.

Sign Up Free

Already have an account? Go to API Keys →

2

Add MCP Configuration

Add the following to your Kilo Code MCP configuration file. Replace YOUR_API_KEY_HERE with your key.

MCP Configuration (JSON)
{
  "mcpServers": {
    "memstate": {
      "command": "npx",
      "args": ["-y", "@memstate/mcp"],
      "env": {
        "MEMSTATE_API_KEY": "YOUR_API_KEY_HERE"
      }
    }
  }
}

📁 Where to put this config:

macOS~/Library/Application Support/Code/User/globalStorage/kilocode.kilo-code/settings/mcp_settings.json
Windows%APPDATA%\Code\User\globalStorage\kilocode.kilo-code\settings\mcp_settings.json
Linux~/.config/Code/User/globalStorage/kilocode.kilo-code/settings/mcp_settings.json
3

Open Kilo Code MCP Settings

In VS Code with Kilo Code installed, open the Kilo Code sidebar, click the MCP Servers icon, then click Edit MCP Settings. This opens the settings JSON file directly.

Direct file path

You can also edit the settings file directly at:

  • macOS/Linux: ~/Library/Application Support/Code/User/globalStorage/kilocode.kilo-code/settings/mcp_settings.json
  • Windows: %APPDATA%\Code\User\globalStorage\kilocode.kilo-code\settings\mcp_settings.json
3

Alternative: Add a Kilo Code Rule

Instead of editing AGENTS.md, you can create a custom rule specifically for Kilo Code. This is the recommended approach for Kilo Code users.

Create the file at one of these locations depending on your preference:

  • Project-local (applies to this project only): .kilocode/rules/use-memstate-memory.md
  • Global (applies to all projects): ~/.kilocode/rules/use-memstate-memory.md
.kilocode/rules/use-memstate-memory.md
# Memstate MCP - Memory Storage

This project uses Memstate MCP for versioned memory. Keypaths are hierarchical (e.g. project.myapp.database).

## Which tool when
- **memstate_remember** — PREFERRED for markdown, task summaries, meeting notes. Server extracts keypaths automatically.
- **memstate_set** — Only for single keypath = single short value (e.g. config.port).
- **memstate_get** — Browse project, fetch existing knowledge before tasks.
- **memstate_search** — Find by meaning when you don't know the keypath.
- **memstate_history** — View version history of a keypath.

## Before each task
Check what already exists: memstate_get(project_id="myproject")

## After each task
Save a summary: memstate_remember(project_id="myproject", content="## Summary\n- What was done\n- Key decisions", source="agent")

Need help creating rules? Learn more in the Kilo Code custom rules documentation.

4

Add Agent Instructions

Paste this into your project's AGENTS.md, CLAUDE.md, or GEMINI.md. This tells your agent how to use Memstate automatically.

AGENTS.md (paste into your project)
# Memstate MCP - Memory Storage
This project uses Memstate MCP for versioned memory. Keypaths are hierarchical (e.g. `project.myapp.database`).

## Which tool when
- **memstate_remember** — PREFERRED for markdown, task summaries, meeting notes. Server extracts keypaths automatically.
- **memstate_set** — Only for single keypath = single short value (e.g. config.port).
- **memstate_get** — Browse project, fetch existing knowledge before tasks.
- **memstate_search** — Find by meaning when you don't know the keypath.
- **memstate_history** — View version history of a keypath.

## Before each task
Check what already exists: `memstate_get(project_id="myproject")`

## After each task
Save a summary: `memstate_remember(project_id="myproject", content="## Summary\n- What was done\n- Key decisions", source="agent")`

Why this matters

Without instructions, your agent won't know to use Memstate proactively. This snippet tells it to check existing memories before tasks and save summaries after — keeping your project context current across every session.

Verify the Connection

Restart Kilo Code, then ask your agent:

Test prompt
Use memstate_get() to list all my projects and confirm Memstate is connected.

You're all set!

Kilo Code now has access to structured, versioned memory. It will automatically look up existing knowledge before tasks and save summaries after completion — keeping your project context current and organized across every session.

Alternative: Install as an Agent Skill

Prefer a portable, project-committed approach? Install the Memstate skill directly into your repo. Skills are loaded automatically by compatible agents (Claude Code, Cline, Cursor) without needing manual AGENTS.md edits.

Terminal
npx @memstate/skills setup

See the Skills documentation for full details on supported agents and manual installation options.