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

@mr-jones123/toji

v0.7.0

Published

Toji Pi extensions for code memory and AI-to-AI comms.

Readme

Toji

TypeScript Bun SQLite Pi Extension

Toji is a Pi extension workspace with two packages:

  • toji-mem: local code memory, search, graph traversal, and benchmarks
  • toji-comms: AI-to-AI communication bridge for Pi agents

What toji-mem does

toji-mem indexes a repository into SQLite and answers common agent questions:

  • where is this symbol?
  • what file should I read?
  • what related files/symbols are nearby?
  • what might be affected if I change this symbol?

It uses:

  • SQLite FTS5 for fuzzy search over files, symbols, docstrings, and paths
  • B-tree indexes for exact file and symbol lookups
  • Tree-sitter parsers for symbols, imports, and calls
  • graph edges for blast-radius and related-file traversal

What toji-comms does

toji-comms lets the active Pi model send a structured message to a peer model through MCP/mmx, then stores the discussion in SQLite.

It provides:

  • toji_comms_send for AI-authored peer messages
  • toji_plan_run as a compatibility alias for plan workflows
  • thread history in ~/.pi/agent/toji-comms/toji-comms.sqlite
  • commands for model, mode, thread, and plan control

Install from Pi

After publishing to npm, install Toji like this:

pi install npm:@mr-jones123/toji

Try it for one Pi run without installing:

pi -e npm:@mr-jones123/toji

Local setup

bun install

Use with Pi

If installed with pi install, start Pi normally and both extensions are discovered.

For local development, start Pi with one extension loaded:

pi -e ./packages/toji-mem/src/index.ts
pi -e ./packages/toji-comms/src/index.ts

toji-mem commands

/toji-index .
/toji-query indexProject
/toji-overview .
/toji-graph index project
/toji-blast indexProject
/toji-bench .

| command | purpose | |---|---| | /toji-index [path] | index a project into Toji memory | | /toji-query <query> | search indexed files, symbols, and standards | | /toji-overview [path] | show compact project overview, expandable in Pi | | /toji-graph <intent> | find related files/symbols from a natural-language intent | | /toji-blast <symbol> | traverse likely impact radius for a symbol | | /toji-bench [path] | run the operational benchmark from inside Pi |

toji-comms commands

/toji-comms <message>
/toji-comms-model <model>
/toji-comms-mode discuss|ask|critique|decide|verify|plan
/toji-comms-new [title]
/toji-plan <message>

| command | purpose | |---|---| | /toji-comms <message> | send a raw message to the peer model | | /toji-comms-model <model> | choose the target peer model | | /toji-comms-mode <mode> | set discussion mode | | /toji-comms-new [title] | start a new comms thread | | /toji-plan <message> | compatibility plan command |

Reproduce the operational benchmark

The benchmark measures Toji core directly, without LLM/session overhead:

  • cold index
  • hot re-index
  • query p50
  • project overview p50
  • blast-radius p50
  • indexed files/symbols/edges

1. Benchmark Toji itself

cd packages/toji-mem
bun run bench --repo . --json

2. Benchmark Flask

From the repository root:

mkdir -p benchmarks/repos
git clone --depth 1 https://github.com/pallets/flask.git benchmarks/repos/flask
cd packages/toji-mem
bun run bench --repo ../../benchmarks/repos/flask --json

If Flask is already cloned:

git -C benchmarks/repos/flask pull --ff-only
cd packages/toji-mem
bun run bench --repo ../../benchmarks/repos/flask --json

Current smoke scores

| repo | cold index | hot index | query p50 | overview p50 | blast p50 | files | symbols | edges | |---|---:|---:|---:|---:|---:|---:|---:|---:| | packages/toji-mem | 679.02 ms | 5.18 ms | 0.68 ms | 0.75 ms | 1.71 ms | 20 | 98 | 647 | | flask | 1888.94 ms | 12.85 ms | 0.71 ms | 9.67 ms | 0.29 ms | 83 | 1620 | 7658 |

RepoBench retrieval scores

Toji also has a local RepoBench Python v1.1 adapter for cross-file retrieval quality. It materializes synthetic repos grouped by repo_name, indexes them, then queries with the gold identifier plus repo/current-file context.

| split | rows | files | Path Hit@1 | Path Hit@5 | Path MRR | Symbol Hit@1 | Symbol Hit@5 | Symbol MRR | p95 latency | |---|---:|---:|---:|---:|---:|---:|---:|---:|---:| | cross_file_first | 8,026 | 17,081 | 0.576 | 0.600 | 0.587 | 0.540 | 0.551 | 0.545 | 0.784 ms | | cross_file_random | 7,610 | 16,750 | 0.513 | 0.544 | 0.526 | 0.467 | 0.478 | 0.471 | 1.014 ms |

Compared to the original name-only baseline, repo/import-aware reranking improves Path Hit@1 by about 13 points on both splits.

Benchmark notes

  • CLI benchmark is the source of truth for stable operational numbers.
  • /toji-bench uses the same benchmark engine from inside Pi.
  • Cloned benchmark repos are scratch data and are not committed.
  • Full RepoBench tables live in packages/toji-mem/README.md.