@mr-jones123/toji

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

Packages

Package details

extension

Install @mr-jones123/toji from npm and Pi will load the resources declared by the package manifest.

$ pi install npm:@mr-jones123/toji
Package
@mr-jones123/toji
Version
0.1.0
Published
Jun 21, 2026
Downloads
not available
Author
mr-jones123
License
MIT
Types
extension
Size
11.5 MB
Dependencies
4 dependencies · 3 peers
Pi manifest JSON
{
  "extensions": [
    "./packages/toji-mem/src/index.ts",
    "./packages/toji-comms/src/index.ts"
  ]
}

Security note

Pi packages can execute code and influence agent behavior. Review the source before installing third-party packages.

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

Benchmark notes

  • CLI benchmark is the source of truth for stable numbers.
  • /toji-bench uses the same benchmark engine from inside Pi.
  • Cloned benchmark repos are scratch data and are not committed.
  • RepoBench validation is planned separately for external retrieval quality.