Skip to main content

CLI and TUI for Nowledge Mem - AI memory management

Project description

nmem-cli

A lightweight CLI and TUI for Nowledge Mem - AI memory management that works with any AI agent.

Installation Options

Option 1: Standalone PyPI Package (Recommended for CLI-only users)

pip install nmem-cli

Or with uv:

uv pip install nmem-cli

Option 2: Nowledge Mem Desktop App

If you're using the Nowledge Mem desktop app, the nmem CLI is bundled and can be installed via:

  • macOS: Settings → Preferences → Developer Tools → Install CLI
  • Linux: Automatically installed via package postinstall
  • Windows: Automatically added to PATH during installation

The desktop app includes a bundled Python environment, so no separate Python installation is required.

Requirements

  • Python 3.11+ (for PyPI package)
  • A running Nowledge Mem server (default: http://127.0.0.1:14242)

Quick Start

# Check server status
nmem status

# Launch interactive TUI
nmem tui

# List memories
nmem m

# Search memories
nmem m search "python programming"

# List threads
nmem t

Commands

Core Commands

Command Description
nmem status Check server connection status
nmem stats Show database statistics
nmem tui Launch interactive terminal UI

Memory Commands

Command Description
nmem m / nmem memories List recent memories
nmem m search "query" Search memories (includes source thread info)
nmem m show <id> Show memory details
nmem m add "content" Add a new memory
nmem m update <id> Update a memory
nmem m delete <id> [id ...] Delete one or more memories (bulk uses MCP)

Thread Commands

Command Description
nmem t / nmem threads List threads
nmem t search "query" Search threads
nmem t show <id> Show thread with messages
nmem t create -t "Title" -c "content" Create a thread
nmem t append <id> -m '[{"role":"user","content":"..."}]' Append messages to a thread
nmem t save --from claude-code Save Claude Code session as thread
nmem t save --from codex Save Codex session as thread
nmem t save --from gemini-cli Save Gemini CLI session as thread
nmem t delete <id> Delete a thread

Options

Global Options

nmem --json <command>     # Output in JSON format (for scripting)
nmem --api-url <url>      # Override API URL
nmem --version            # Show version

Search Filters (memories)

nmem m search "query" -l label1 -l label2   # Filter by labels
nmem m search "query" -t week               # Time range: today/week/month/year
nmem m search "query" --importance 0.7      # Minimum importance

Persistent Remote Configuration

For long-term remote use, prefer nmem's config file instead of exporting auth on every shell session.

Create:

~/.nowledge-mem/config.json

With content:

{
  "apiUrl": "https://mem.example.com",
  "apiKey": "nmem_your_key"
}

Resolution priority:

  1. --api-url
  2. NMEM_API_URL / NMEM_API_KEY
  3. ~/.nowledge-mem/config.json
  4. defaults

Use environment variables when you want a temporary override for the current shell, CI job, or integration runtime.

Environment Variables

Variable Description Default
NMEM_API_URL API server URL http://127.0.0.1:14242
NMEM_API_KEY Optional API key (Bearer auth + proxy-safe fallback) (unset)

Remote tunnel examples:

# Quick Tunnel (random URL)
export NMEM_API_URL="https://<random>.trycloudflare.com"
export NMEM_API_KEY="nmem_..."

# Cloudflare account tunnel (stable URL)
export NMEM_API_URL="https://mem.example.com"
export NMEM_API_KEY="nmem_..."

For account mode, the URL is the Cloudflare Route tunnel → Public Hostname value (use domain root only, without /remote-api).

TUI Features

The interactive TUI provides:

  • Dashboard: Overview with statistics and recent activity
  • Memories: Browse, search, and manage memories
  • Threads: View conversation threads
  • Graph: Explore the knowledge graph
  • Settings: Configure the application

TUI Keybindings

Key Action
1-5 Switch tabs
/ Focus search
? Show help
q Quit

Examples

Script Integration (JSON mode)

# Get memories as JSON
nmem --json m search "meeting notes" | jq '.memories[].title'

# Get source thread for a memory (to fetch full conversation context)
nmem --json m search "auth" | jq '.memories[] | {title, thread: .source_thread.id}'

# Check if server is running
if nmem --json status | jq -e '.status == "ok"' > /dev/null; then
    echo "Server is running"
fi

Adding Memories

# Simple memory
nmem m add "Remember to review the PR tomorrow"

# With title and importance
nmem m add "The deployment process requires SSH access" \
    -t "Deployment Notes" \
    -i 0.8

# With labels (repeatable -l flag)
nmem m add "API uses JWT tokens for auth" \
    -t "Auth Notes" \
    -l work -l backend

# With custom source (for skills/integrations)
nmem m add "User preference: dark mode" \
    -s "skill-settings"

Options for nmem m add:

  • -t, --title: Memory title
  • -i, --importance: Importance score 0.0-1.0 (default: 0.5)
  • -l, --label: Add label (repeatable for multiple labels)
  • -s, --source: Source identifier (default: "cli")

Creating Threads

# From content
nmem t create -t "Debug Session" -c "Started investigating the memory leak"

# Explicit thread id (for deterministic integrations)
nmem t create --id openclaw-session-abc123 -t "OpenClaw Session" -c "Session started"

# From file
nmem t create -t "Code Review" -f review-notes.md

# Append one message
nmem t append openclaw-session-abc123 -c "Follow-up finding" -r assistant

# Append with retry-safe idempotency key
nmem t append openclaw-session-abc123 \
  -m '[{"role":"assistant","content":"Follow-up finding","metadata":{"external_id":"oc-msg-42"}}]' \
  --idempotency-key openclaw-run-123

Saving AI Coding Sessions

Import conversations from Claude Code, Codex, or Gemini CLI as threads:

# Save current Claude Code session (uses current directory)
nmem t save --from claude-code

# Save from a specific project path
nmem t save --from claude-code -p /path/to/project

# Save all sessions for a project
nmem t save --from claude-code -m all

# Save Codex session with a summary
nmem t save --from codex -s "Implemented auth feature"

# Save Gemini CLI session from the current project
nmem t save --from gemini-cli

How it works:

  • nmem discovers and reads the local agent session files on the machine where you run the command
  • it parses those transcripts into normalized thread messages
  • it then uploads the resulting thread data to your configured Mem server

That means nmem t save --from ... works correctly with remote Mem too: the server does not need direct access to ~/.claude, ~/.codex, or ~/.gemini on your laptop.

Options:

  • --from: Source app (claude-code, codex, or gemini-cli) - required
  • -p, --project: Project directory (default: current dir)
  • -m, --mode: current (latest session) or all (all sessions)
  • -s, --summary: Brief session summary
  • --session-id: Specific session ID
  • --truncate: Truncate large tool results (>10KB)

Re-running the command appends new messages with deduplication.

This import path is distinct from desktop auto-sync and watcher-based ingestion. File watching remains a local server-side capability; explicit CLI save is a client-side capture path.

Related

  • Nowledge Mem - The full Nowledge Mem application
  • This CLI is also bundled with the main Nowledge Mem desktop app

Author

Nowledge Labs

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

nmem_cli-0.6.12.tar.gz (90.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

nmem_cli-0.6.12-py3-none-any.whl (100.4 kB view details)

Uploaded Python 3

File details

Details for the file nmem_cli-0.6.12.tar.gz.

File metadata

  • Download URL: nmem_cli-0.6.12.tar.gz
  • Upload date:
  • Size: 90.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.12

File hashes

Hashes for nmem_cli-0.6.12.tar.gz
Algorithm Hash digest
SHA256 6aca557ee77d0c0256d7dbd904e0fa8249bae569af75268f1a6e0e7a76b7437c
MD5 dae7f75d22712240efccd31f5d66116d
BLAKE2b-256 f41b7e942d376e21f14357801bc1ba9cddd7d4a8dafb7b2b05cafe8a30a3faf2

See more details on using hashes here.

File details

Details for the file nmem_cli-0.6.12-py3-none-any.whl.

File metadata

  • Download URL: nmem_cli-0.6.12-py3-none-any.whl
  • Upload date:
  • Size: 100.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.12

File hashes

Hashes for nmem_cli-0.6.12-py3-none-any.whl
Algorithm Hash digest
SHA256 c2830969f58cbf434a692122d7a42dfbe93100ee83732ae0bb6c1a82f418bfac
MD5 2cd11d5ffc40a603a2dd6f4c0d839672
BLAKE2b-256 712110b442cdf413cf7d45f28186fa1a8262aa12d2a4ee4ee6e098ee423f75de

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page