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

@ufoq/pi-mini-magic-context

v0.1.0

Published

Pi coding agent extension for Mini Magic Context — historian-backed context management and journal search

Readme

Mini Magic Context — Pi extension

Historian-backed context management and journal search for Pi coding agent. It stores compartmented session history and optional embeddings in a local SQLite database.

Requires @earendil-works/pi-coding-agent and @earendil-works/pi-tui >= 0.80.2.


What it does

| Feature | What it does | |---|---| | Historian | Background subagent compresses old conversation into cache-stable chronological compartments | | <session-history> injection | Prepends compressed history into the system prompt every turn so the agent never loses context | | Journal search (ctx_search) | Queries compressed session history with optional semantic ranking | | History expansion (ctx_expand) | Recovers the original transcript from any compressed compartment range | | Optional embeddings | Semantic search over compartments using local all-MiniLM-L6-v2 or any OpenAI-compatible endpoint |


Installation

npx @ufoq/mini-magic-context@latest setup --harness pi

This registers the extension with Pi's package list and writes a default mini-magic-context.jsonc. Run doctor afterward to verify the installation:

npx @ufoq/mini-magic-context@latest doctor --harness pi

Configuration

Two config files (merged, project overrides user):

| Location | Scope | |---|---| | <project>/.cortexkit/mini-magic-context.jsonc | Project | | ~/.config/cortexkit/mini-magic-context.jsonc | User-wide |

Both are validated against a Zod schema. Invalid fields fall back to defaults; bad config never disables the plugin.

Minimal config

{
  "$schema": "https://raw.githubusercontent.com/ufoq/mini-magic-context/master/assets/magic-context.schema.json",
  "enabled": true,
  "historian": {
    "model": "anthropic/claude-haiku-4-5"
  },
  "embedding": {
    "provider": "local"
  }
}

Commands

| Command | Description | |---|---| | /ctx-status | Live token breakdown, pending queue, cache state | | /ctx-flush | Force-process pending operations | | /ctx-recomp | Rebuild compartments from raw history | | /ctx-wrapup [N] | Compact older live history, keeping newest N messages raw | | /ctx-embed | Embedding status; start or pause compartment embedding |


Tools available to the agent

| Tool | Purpose | |---|---| | ctx_search | Search compartments and raw session history; returns ranked results with previews | | ctx_expand | Recover the original transcript from a compressed compartment range |


Storage

Everything lives in a single SQLite database:

~/.local/share/cortexkit/mini-magic-context/context.db

Session-scoped data is keyed by the Pi harness so separate sessions remain isolated while compartments and embeddings remain available to their owning session.

Storage failures are fatal. The plugin refuses to register hooks rather than run with ephemeral state, since that would let context grow unbounded across restarts.


Architecture

This package is part of the mini-magic-context monorepo. The Pi extension uses the shared core for storage and context operations, with a Pi-specific adapter layer for session management, subprocess subagents, and config loading.


License

MIT — see LICENSE.