Gemini CLI extension that saves and retrieves project memory from local SQLite, with MCP tools that share the same memory DB.
Official Gemini docs this README follows:
- Writing extensions: https://geminicli.com/docs/extensions/writing-extensions/
- Releasing extensions: https://geminicli.com/docs/extensions/releasing/
- Hook-based memory capture (
AfterAgent) and retrieval (BeforeAgent,SessionStart) - Slash commands for memory inspection and cleanup
- Optional MCP server tools for external agents/clients
- Local per-project storage by default:
${HOME}/.gemini/gemini-mem/<repo-folder>/memory.db
npm install
npm run build
gemini extensions link .
gemini extensions listThen restart Gemini CLI.
- Edit code.
- Rebuild:
npm run build - Test:
npm test - Restart Gemini CLI to pick up changes.
src/
hooks/ # SessionStart, BeforeAgent, AfterAgent
memory/ # sqlite store, schema, retrieval, dedupe, redaction
gemini/ # summarizer/reranker prompts + validators
commands/ # mem-status, mem-search, mem-last, mem-prune
mcp/ # stdio and HTTP MCP servers + tool handlers
runtime/ # process and Gemini CLI adapters
cli/ # db init/migration scripts
/mem:status/mem:search <query>/mem:last [limit]/mem:prune [maxAgeDays] [importanceFloor]
Local equivalents:
npm run mem:status
npm run mem:status -- --json
npm run mem:search -- "query text"
npm run mem:last -- 5
npm run mem:last -- 5 --json
npm run mem:prune -- 30 2MCP is decoupled from hook runtime in this extension build. Hook execution does not require MCP server discovery.
memory_statusmemory_get_contextmemory_searchmemory_save_observationmemory_citememory_end_session
Run transports:
npm run mcp:server
npm run mcp:httpIf you want Gemini CLI to auto-discover this MCP server, register it explicitly in your user/project Gemini MCP settings.
Default HTTP endpoint:
https://127.0.0.1:3303/mcp
Recommended MCP usage order:
memory_get_contextmemory_save_observationmemory_end_session
Settings are defined in gemini-extension.json (DB path, model, limits, timeouts, project mode, command override).
Opt-in hook telemetry:
- Set
MEM_HOOK_TELEMETRY=true - Writes JSONL events and failures to
<project-db-folder>/hook.log(for example${HOME}/.gemini/gemini-mem/<repo>/hook.log)
This repo already has workflows in .github/workflows/ and release notes in PUBLISHING.md.
- Update version in both files:
package.jsongemini-extension.json
- Validate locally:
npm run buildnpm test
- Commit and tag:
git tag vX.Y.Zgit push origin main --tags
- Let GitHub Actions create/publish the release artifacts.
- Install test from users' perspective:
gemini extensions install <repo-url>- or
gemini extensions install <repo-url> --ref=vX.Y.Z
For gallery discoverability (from official docs):
- Keep repository public.
- Add GitHub topic
gemini-cli-extension. - Keep
gemini-extension.jsonat repository root.
npm run build
npm test
npm run test:hooks
npm run test:mcp
npm run test:mcp-httpSee CONTRIBUTING.md.