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

pi-dax

v0.1.2

Published

Dual Active eXtension — a symbiont for the Pi coding agent that provides peer code review and loop prevention

Readme

π-DAX — Dual Active eXtension

DAX is a symbiont for the Pi coding agent.

In Star Trek: Deep Space Nine, the Dax symbiont joins with a host, carrying the memories and wisdom of past lifetimes. π-DAX brings that same spirit to LLM-assisted development: a lightweight secondary model joins with the primary worker model, offering real-time peer review, loop detection, and oversight — not as a command-and-control watchdog, but as an active partner that helps the host produce better code.


How It Works

Example: Two local models communicate via llama.cpp (or any OpenAI-compatible server):

| Role | Model | Port | Responsibility | |------|-------|------|---------------| | Host (Worker) | Gemma 4 12B | :8080 | Drives the conversation, writes code, executes tools | | DAX (Symbiont) | Qwen 3.5 4B | :8081 | Reviews every edit, detects loops, prunes repeating context |

DAX hooks into three Pi lifecycle events:

  • tool_call — Tracks tool repetition for loop detection; intercepts write/edit and sends the proposed change to DAX for peer review. If DAX finds bugs, the edit is blocked and feedback is returned to the host.
  • message_end — Heuristic loop detection via Jaccard similarity of consecutive assistant messages.
  • context — Queries the DAX LLM for semantic loop verification; prunes looping turns and injects a steering warning when a loop is confirmed.

Project Structure

pi-dax/
├── src/
│   ├── index.ts          # Extension entry point (default export, event handlers)
│   ├── config.ts         # DAX provider configuration (models.json, API keys)
│   ├── peer-review.ts    # Code review logic (reviewCodeChange)
│   └── loops.ts          # Loop detection & pruning utilities
├── tests/                # Test files
├── package.json          # Package manifest with pi.extensions registration
├── tsconfig.json         # TypeScript configuration
├── README.md             # You are here
└── LICENSE               # MIT

Setup

Prerequisites

  • Pi coding agent installed
  • Two llama.cpp server instances (or any OpenAI-compatible API)

Step 1: Start the llama.cpp Servers

Host (Worker, port 8080):

./llama-server -m models/gemma-4-12b.gguf --port 8080

DAX (Symbiont / Reviewer, port 8081):

./llama-server -m models/qwen-4b.gguf --port 8081

Step 2: Configure Pi Models (models.json)

Edit ~/.pi/agent/models.json to register the models. You can either run both models locally (Option A), or route the DAX symbiont to a remote API provider like OpenRouter or OpenAI (Option B).

[!IMPORTANT] The provider key in the providers object must be exactly named "local-dax", as the extension explicitly looks up this identifier under the hood—even when it resolves to a remote endpoint.

Option A: Fully Local Setup (Gemma + Qwen)

For a fully offline setup using two local llama.cpp servers:

{
  "providers": {
    "local-worker": {
      "baseUrl": "http://localhost:8080/v1",
      "api": "openai-completions",
      "apiKey": "local",
      "compat": {
        "supportsDeveloperRole": false,
        "supportsReasoningEffort": false
      },
      "models": [
        {
          "id": "gemma-4-12b",
          "name": "Gemma 4 12B (Host)",
          "contextWindow": 262144
        }
      ]
    },
    "local-dax": {
      "baseUrl": "http://localhost:8081/v1",
      "api": "openai-completions",
      "apiKey": "local",
      "compat": {
        "supportsDeveloperRole": false,
        "supportsReasoningEffort": false
      },
      "models": [
        {
          "id": "qwen-4b",
          "name": "Qwen 3.5 4B (DAX)",
          "contextWindow": 262144
        }
      ]
    }
  }
}

Note: For local llama-servers, the apiKey can be any placeholder string.

Option B: Remote Setup (e.g., OpenRouter / any OpenAI-compatible API)

If you prefer not to run a local server for the symbiont, configure the "local-dax" provider to point to a remote endpoint by supplying their base URL, model ID, and API key environment variable (which the extension will resolve in real time):

{
  "providers": {
    "local-dax": {
      "baseUrl": "https://openrouter.ai/api/v1",
      "api": "openai-completions",
      "apiKey": "$OPENROUTER_API_KEY",
      "models": [
        {
          "id": "qwen/qwen-2.5-7b-instruct",
          "name": "Qwen 2.5 7B (DAX)",
          "contextWindow": 32768
        }
      ]
    }
  }
}

Step 3: Configure Default Session Model

Create a project-local .pi/settings.json:

{
  "defaultModel": "local-worker/gemma-4-12b",
  "defaultProjectTrust": "trust"
}

Step 4: Load DAX

Option A — Install from npm (once):

pi install npm:pi-dax

Option B — Load from path (for local development):

pi -e /path/to/pi-dax/src/index.ts

Look for the startup notification:

DAX symbiont active — peer review & loop prevention on port 8081

Commands

  • /dax — Show current DAX status
  • /dax review on / /dax review off — Toggle peer code review

Development

npm install
npm run typecheck   # TypeScript type checking
npm test            # Run tests

The Symbiont Philosophy

DAX is not a supervisor. It is a symbiont — a partner that enhances the host without replacing it. The host makes the decisions and drives the work; DAX offers its accumulated wisdom in two critical moments:

  • Before a file is written — reviewing code with fresh eyes
  • When the host stalls — recognizing the loop and clearing the path forward

This symbiotic relationship gives the host the benefit of a second model's perspective without the overhead of explicit hand-offs, context switching, or multi-agent orchestration.


License

MIT