{
  "markdown": "# Nowledge Mem -- Gemini CLI Extension\n\n> Bring your Nowledge Mem knowledge base into Gemini CLI with persistent context, reusable slash commands, and agent skills.\n\nThis package is the **Gemini-native product surface** for Nowledge Mem.\n\nIt is deliberately **hybrid**:\n\n- Gemini CLI loads `GEMINI.md` plus extension hooks for Context Bundle / Working Memory startup context and session capture\n- the extension exposes local Nowledge Mem MCP tools for lower-friction retrieval and memory writes\n- bundled commands wrap common `nmem` workflows\n- bundled skills teach Gemini when to recall, distill, save real threads, and create handoff summaries\n- Gemini can still call `nmem` directly whenever it needs a more flexible path\n\nThe recommended Gemini setup is deliberately simple and stable: Gemini CLI on top, MCP for direct retrieval tools, and `nmem` for hooks, thread save, remote auth, and command fallback.\n\n## Requirements\n\n- [Gemini CLI](https://github.com/google-gemini/gemini-cli)\n- [Nowledge Mem](https://mem.nowledge.co) running locally, or a reachable remote Nowledge Mem server\n- `nmem` CLI in your `PATH`\n\nIf Nowledge Mem is already running on the same machine through the desktop app, the cleanest setup is to install the bundled CLI from **Settings -> Preferences -> Developer Tools -> Install CLI**. That gives Gemini direct access to the local Mem instance without any remote configuration.\n\nYou can also install `nmem` standalone:\n\n```bash\n# Option 1: pip\npip install nmem-cli\n\n# Option 2: uvx\ncurl -LsSf https://astral.sh/uv/install.sh | sh\nuvx --from nmem-cli nmem --version\n\n# Option 3: Arch Linux AUR\nyay -S nmem-cli\n# or: paru -S nmem-cli\n```\n\nVerify the connection:\n\n```bash\nnmem status\n```\n\nFor the default same-machine setup, `nmem status` should show `http://127.0.0.1:14242 (default)`. No `~/.nowledge-mem/config.json` is required unless you are connecting to a remote Mem server.\n\n## Install\n\nFor local development or a repository checkout install, use:\n\n```bash\ngit clone https://github.com/nowledge-co/nowledge-mem-gemini-cli.git\ncd nowledge-mem-gemini-cli\ngemini extensions link .\n```\n\nRestart Gemini CLI after linking.\n\nThis repository root is the Gemini extension root for both local development and gallery discovery.\n\nRelease packaging and marketplace notes live in [`RELEASING.md`](./RELEASING.md).\n\n## What You Get\n\n**Automatic lifecycle hooks**\n\n- Session start loads Context Bundle when available, with Working Memory as the lightweight fallback\n- Before context compression, Gemini imports the current thread so the pre-compression transcript remains searchable\n- Session end performs a best-effort real Gemini thread import through `nmem t save --from gemini-cli`\n\n**Bundled MCP**\n\n- Local same-machine installs expose `nowledge-mem` MCP tools at `http://127.0.0.1:14242/mcp/`\n- Gemini `settings.json` can override the same `nowledge-mem` server name for remote Mem or a custom local endpoint\n\n**Persistent context**\n\n- `GEMINI.md` tells Gemini how to route recall across Context Bundle, Working Memory, distilled memories, conversation threads, thread save, distillation, and handoff summaries\n\n**Custom commands**\n\n- `/nowledge:read-working-memory` -- Load today's Working Memory briefing\n- `/nowledge:search-memory <query>` -- Search your knowledge base before answering\n- `/nowledge:distill-memory` -- Save the high-value insights from the current conversation\n- `/nowledge:save-thread` -- Save the real Gemini CLI session through `nmem`'s native Gemini importer\n- `/nowledge:save-handoff` -- Save a concise resumable handoff summary for the current Gemini session\n- `/nowledge:status` -- Check `nmem` and server connectivity\n\n**Agent skills**\n\n- `read-working-memory`\n- `search-memory`\n- `distill-memory`\n- `save-thread`\n- `save-handoff`\n\n## Local vs Remote\n\nBy default, both `nmem` and the bundled MCP server point to the local Mem server at `http://127.0.0.1:14242`.\n\nFor remote Mem, the preferred long-term setup is:\n\n```bash\nnmem config client set url https://mem.example.com\nnmem config client set api-key nmem_your_key\n```\n\n`nmem` loads connection settings with this priority:\n\n- `--api-url` flag\n- `NMEM_API_URL` / `NMEM_API_KEY`\n- `~/.nowledge-mem/config.json`\n- defaults\n\nIf you need a temporary override for one Gemini session, launch Gemini from a shell where `NMEM_API_URL` and `NMEM_API_KEY` are already exported. For durable setup, keep using `~/.nowledge-mem/config.json`.\n\nFor Gemini MCP tools in remote mode, define a `nowledge-mem` server in Gemini `settings.json`. Gemini gives user settings precedence over the extension's bundled local MCP server:\n\n```bash\nnmem config mcp show --host gemini-cli\n```\n\nPaste the generated JSON into Gemini's `settings.json`. Direct MCP clients do not read `~/.nowledge-mem/config.json` automatically; the generated block gives Gemini the same URL and key that `nmem` already uses.\n\nFor thread save in remote mode, the important detail is that `nmem t save --from gemini-cli` reads Gemini's local session files on the machine running Gemini, then uploads the normalized thread messages to Mem. The remote Mem server does not need direct access to your `~/.gemini` directory.\n\n## Direct `nmem` Use Is Always Allowed\n\nThe bundled commands are convenience paths, not a cage. Gemini should freely compose direct `nmem` commands when that is clearer or more flexible. Use the MCP tools for the day-to-day per-turn loop first; **for anything beyond that** -- including graph and relationship queries (`nmem graph expand <memory-or-crystal-id> --depth 2`, `nmem graph evolves <memory-id>`) -- reach for `nmem` directly. Run `nmem --help` to see its full capabilities.\n\nExamples:\n\n```bash\nnmem --json wm read\nnmem --json m search \"auth token rotation\" --mode deep --importance 0.7\nnmem --json m search \"auth token rotation\" --mode deep --importance 0.7 --space \"Research Agent\"\nnmem --json m add \"JWT refresh failures came from clock skew between the gateway and API nodes.\" -t \"JWT refresh failures traced to clock skew\" -i 0.9 --unit-type learning -l auth -l backend -s gemini-cli\nnmem --json t save --from gemini-cli -p . -s \"Finished the auth refactor and verified the new refresh-token flow.\"\nnmem --json t create -t \"Gemini CLI Session - auth refactor\" -c \"Goal: finish the auth refactor. Decisions: keep refresh verification in the API layer and treat gateway skew as the root cause. Files: api/auth.ts, auth.test.ts. Next: validate expiry behavior against remote sessions.\" -s gemini-cli\nnmem status\n```\n\nFor historical backfill, preview first:\n\n```bash\nnmem t sync --from gemini-cli --all-projects --limit 20\n```\n\nThen import:\n\n```bash\nnmem t sync --from gemini-cli --all-projects --apply\n```\n\nUse `-p /path/to/project` instead of `--all-projects` when you only want one project. The command reads local Gemini CLI session files and writes to the Mem server configured in `nmem`.\n\n## Thread Save vs Handoff\n\nGemini now supports two separate save paths, and they should stay distinct:\n\n- `/nowledge:save-thread` imports the **real Gemini session messages** into Nowledge Mem with `nmem t save --from gemini-cli`. The summary is only metadata; the stored thread is based on Gemini's recorded transcript. The extension also performs this import automatically before context compression and at session end as best-effort, idempotent lifecycle hooks.\n- `/nowledge:save-handoff` creates a **compact resumable handoff summary** with Goal, Decisions, Files, Risks, and Next. Use this when the user wants a lightweight restart point rather than the full transcript.\n\nUse `/nowledge:distill-memory` for durable atomic knowledge, `/nowledge:save-thread` for the full session, and `/nowledge:save-handoff` for a resumable handoff.\n\n## Architecture Choice\n\nThis integration keeps the control plane simple:\n\n- Gemini provides the extension surface: `GEMINI.md`, commands, and skills\n- MCP provides the direct tool path for retrieval and memory writes when Gemini chooses tools\n- `nmem` provides the lifecycle path: Working Memory hooks, capture, thread import, remote auth, and command fallback\n- direct `nmem` composition stays available whenever Gemini needs a more flexible command path\n\nThe result is a setup that is easier to reason about, easier to support, and easier for advanced users to extend.\n\n## Customize without editing the extension\n\nGemini CLI already gives you a durable instruction layer through `GEMINI.md`.\n\n- Shared repo behavior: project `GEMINI.md`\n- Personal behavior across repos: `~/.gemini/GEMINI.md`\n- Large customizations: split them into files and import with `@file.md`\n- Do not edit the installed Nowledge Mem extension files directly\n\nThat keeps your custom behavior stable while letting the extension keep updating normally.\n\n## Links\n\n- [Documentation](https://mem.nowledge.co/docs/integrations/gemini-cli)\n- [Nowledge Mem](https://mem.nowledge.co)\n- [Discord](https://nowled.ge/discord)\n- [GitHub](https://github.com/nowledge-co/nowledge-mem-gemini-cli)\n",
  "bytes": 8977,
  "sha": "e6c2a6a44d6b9ddabad66f8cf1efbca520b686a3d9629f7f80801ef8ed3a5f54",
  "repo_slug": "nowledge-co/nowledge-mem-gemini-cli",
  "fonte": "repo",
  "truncated": false,
  "api": "https://agentalog.com/api/listings/plg_nowledge_co_nowledge_mem_gemini_cli_02fae615/readme"
}