npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@menteai/infinite-memory

v0.1.4

Published

Vector memory MCP server for Codex session history

Readme

🔥 INFINITE MEMORY FOR CODEX 🔥

Give Codex a permanent, unlimited memory.
No compaction loss. Preserve memories from 525 turns ago. 🧠⚡

Infinite Memory is a vector-memory MCP + hook system for Codex. It captures completed Codex turns, embeds them locally or through a custom embeddings endpoint, stores them in SQLite, and exposes semantic recall back to Codex through MCP.

No more “what did we decide again?”
No more losing the plot after compaction.
No more manually pasting old context like it is 1999. 🚀

Two killer promises:

  • 💸 Completely free by default — uses a local embedding model, so there is no required paid API.
  • 💯 100% preserved memory — stores the original text intact, then retrieves it efficiently only when it matters.

✨ What It Does

  • 🧠 Permanent Codex memory using vector embeddings
  • 💸 Free local embeddings by default — no required paid API
  • 💯 Original text preserved intact — efficient recall without lossy memory rewriting
  • 🔎 Semantic search over remembered turns
  • 🌿 Fork inheritance so child sessions can recall parent-session memories
  • 🪝 Lifecycle hooks that save completed turns automatically
  • 🧩 MCP tool integration for model-controlled recall
  • 💥 Post-compaction recall so Codex can recover context after compression
  • 🗃️ SQLite storage — simple, local, portable
  • ⚙️ Qwen3-Embedding-0.6B by default
  • 🖥️ Linux / macOS / Windows support
  • 🧑‍💻 Codex CLI, IDE, and Codex app compatible

Infinite Memory stores Codex turns captured by lifecycle hooks. It combines each user request with the final assistant answer into one turn, embeds that turn, and stores it for later recall. Commentary, tool calls, tool output, incomplete turns, and duplicated event records are excluded.


🚀 Quickstart

Install from npm

npm install -g @menteai/infinite-memory
infinite

Or install from source

git clone [email protected]:menteai/codex-infinite-memory.git
cd codex-infinite-memory
npm install -g .
infinite

Python direct mode

python3 -m venv .venv
source .venv/bin/activate
pip install -e .
infinite

infinite asks for the embedding backend and batch size:

Select embedding model:
1) Qwen/Qwen3-Embedding-0.6B (GPU) (DEFAULT)
2) Qwen/Qwen3-Embedding-0.6B (CPU)
3) Custom OpenAI-compatible embeddings endpoint
Embedding batch size [4]:

Then it automatically:

  • 📝 writes ~/.codex/infinite-memory/config.toml
  • 🗄️ creates ~/.codex/infinite-memory/memory.sqlite3
  • 🧩 registers the MCP server in ~/.codex/config.toml
  • 🪝 registers lifecycle hooks in ~/.codex/hooks.json
  • 🧠 adds a model-level usage hint to ~/.codex/AGENTS.md
  • 📦 installs selected local dependencies

Restart Codex after setup. If Codex asks you to review hooks, open /hooks and trust the Infinite Memory hooks.


🧨 How The Magic Works

Codex turn finishes
  ↓
Stop hook captures the completed turn
  ↓
Turn gets chunked + embedded
  ↓
Vector goes into SQLite
  ↓
Codex later calls infinite_memory_search
  ↓
Current session + fork ancestors are searched
  ↓
Relevant memories come back as clean context

After context compaction:

PostCompact hook marks the session
  ↓
Next UserPromptSubmit hook fires
  ↓
Infinite Memory searches the current session and fork ancestors once
  ↓
Retrieved snippets are injected as temporary context
  ↓
Flag is cleared

Existing historical Codex sessions are not automatically imported. Infinite Memory remembers turns captured after setup through hooks.


🖥️ Platform Support

Infinite Memory is packaged for:

  • 🐧 Linux
  • 🍎 macOS
  • 🪟 Windows

The npm installer creates a local Python virtual environment using Python 3.11, 3.12, 3.13, or 3.14.

Device behavior:

  • ⚡ GPU option installs PyTorch and uses the best accelerator PyTorch exposes
  • 🍎 macOS Apple Silicon/Metal uses PyTorch MPS when available
  • 🟩 CUDA is used when available
  • 🧊 If no supported accelerator is available, runtime falls back to CPU

Codex CLI, IDE, and Codex app share the same setup:

~/.codex/config.toml
~/.codex/hooks.json

Run infinite once from a terminal, restart Codex, then use:

/mcp    # check the MCP server
/hooks  # review/trust hooks

🧠 Embeddings

Default backend is selected during infinite setup.

Config file:

~/.codex/infinite-memory/config.toml

Default config:

home = "~/.codex/infinite-memory"
db_path = "~/.codex/infinite-memory/memory.sqlite3"
codex_sessions_dir = "~/.codex/sessions"
chunk_chars = 800
chunk_overlap_chars = 100

[embedding]
backend = "local"
model = "Qwen/Qwen3-Embedding-0.6B"
api_key_env = "CUSTOM_EMBEDDINGS_API_KEY"
max_length = 1024
batch_size = 4

Local Qwen mode

  • 🔥 Model: Qwen/Qwen3-Embedding-0.6B
  • 📏 max_length: tokenizer limit per chunk, in tokens. Default: 1024
  • 📦 batch_size: chunks embedded per model call. Default: 4
  • 🧊 Increase batch size on larger GPUs; decrease it if VRAM runs out
  • 📁 Model cache: ~/.codex/infinite-memory/models/huggingface

Custom OpenAI-compatible endpoint

[embedding]
backend = "custom"
base_url = "http://localhost:8000/v1"
model = "text-embedding-3-small"
api_key_env = "CUSTOM_EMBEDDINGS_API_KEY"

⚔️ CLI Commands

infinite             # setup config, database, hooks, and Codex MCP
infinite setup        # same as above
infinite ingest       # manually index Codex sessions
infinite ingest --force
infinite search "query text" --session-id SESSION_ID
infinite stats

Manual infinite ingest exists for explicit imports. The normal memory path is hook-based capture after setup.


🧩 MCP Tools

  • memory_ingest(force=false)
  • infinite_memory_search(query, session_id, limit=8)
  • memory_stats()
  • memory_get(chunk_id, session_id)
  • memory_forget_session(session_id)

The main tool is the one that matters:

infinite_memory_search

When prior decisions, setup details, new task context, topic changes, or post-compaction continuity matter, Codex can call it and pull the right memory back into the conversation.


🕹️ Usage

You can nudge Codex directly:

infinite memory search what did we decide about batch size?

Or let Codex decide through the installed AGENTS.md hint:

When prior conversation context may matter, use infinite_memory_search.

Search results are formatted without metadata, so the model gets the memory without noisy IDs, timestamps, or scores.


📦 Package

npm:

npm install -g @menteai/infinite-memory

GitHub:

[email protected]:menteai/codex-infinite-memory.git

📜 License

Apache-2.0. See LICENSE.