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

personal-ai-architecture

v0.1.0

Published

Level 1 Foundation — Personal AI Architecture. Generic, user-owned AI runtime with zero lock-in.

Downloads

93

Readme

Personal AI Architecture

A generic, user-owned AI runtime. Zero lock-in by design.

Four components (Your Memory, Engine, Auth, Gateway), two connectors (Gateway API, Provider API), three externals (Clients, Models, Tools). Every piece is swappable. Your data stays on your machine.

Install

npm install personal-ai-architecture

Quick Start

As a dependency

import {
  boot,
  createServer,
  createMemoryTools,
  createMemoryToolExecutor,
  createOpenAICompatibleAdapter,
  createEngine,
  createConversationStore,
  createGateway,
} from "personal-ai-architecture";

// Boot loads config, adapter, tools, and validates memory
const { config, adapterConfig } = await boot();

// Or compose manually
const memoryTools = createMemoryTools("/path/to/your/memory");
const toolExecutor = createMemoryToolExecutor(memoryTools);
const provider = createOpenAICompatibleAdapter({
  name: "openrouter",
  base_url: "https://openrouter.ai/api/v1",
  api_key: process.env.OPENROUTER_API_KEY!,
  default_model: "anthropic/claude-sonnet-4",
});
const engine = createEngine(provider, toolExecutor);

Standalone

Create a config.json:

{
  "memory_root": "/path/to/your/memory",
  "provider_adapter": "openrouter",
  "auth_mode": "local",
  "tool_sources": []
}

Set your API key and start:

export OPENROUTER_API_KEY=sk-or-v1-...
npx personal-ai
# optional sanity check:
npx personal-ai boot-check

Configuration

The runtime config has four fields:

| Field | Description | |-------|-------------| | memory_root | Path to your memory folder (files + SQLite conversations) | | provider_adapter | Adapter name — matches adapters/{name}.json | | auth_mode | "local" for V1 owner-only auth | | tool_sources | Directories to scan for tool.json manifests |

Adapter configs live in adapters/. Two are included:

  • openrouter — Works with any model via OpenRouter
  • ollama — Local models via Ollama

Both use the OpenAI-compatible format, so any compatible endpoint works.

Documentation

Full architecture documentation lives in docs/:

Architecture

Clients ──→ Gateway API ──→ Gateway ──→ Engine ──→ Provider API ──→ Models
                              │            │
                              │            └── Tools (discovered from tool_sources)
                              │
                              └── Your Memory (files + git + SQLite)
                                     │
                                     └── Auth (cross-cutting)

Your Memory is the platform. Files are plain text, conversations are SQLite, history is git. When the system isn't running, you can read and modify everything with standard tools.

Engine is a generic agent loop: message → model → tools → response → repeat. No opinions about what you build with it.

Gateway manages conversations, routes messages, serves HTTP. Any client that speaks the Gateway API works.

Auth is V1 owner-only. Token from PAI_AUTH_TOKEN env var or auto-generated at first boot ({memory_root}/.data/auth-token, mode 0600).

Adding Tools

Drop a tool.json manifest into any directory listed in tool_sources:

my-memory/tools/weather/tool.json
{
  "name": "get_weather",
  "description": "Get current weather for a city",
  "parameters": {
    "type": "object",
    "properties": {
      "city": { "type": "string" }
    },
    "required": ["city"]
  }
}

Restart and the tool is discovered alongside the built-in memory tools.

Swapping Providers

Change provider_adapter in your config and set the corresponding API key. No code changes.

# OpenRouter (cloud models)
export OPENROUTER_API_KEY=sk-or-v1-...

# Ollama (local models)
# No API key needed — just run ollama serve

Moving Your Memory

Copy the folder. Point config to the new location. Everything works — files, conversations, history.

cp -r ~/old-memory ~/new-memory
# Update config.json: "memory_root": "~/new-memory"

Scripts

npx tsx scripts/server-check.ts      # Full server test with real model
npx tsx scripts/acceptance-check.ts  # 3 acceptance tests (no API key needed)
npx tsx scripts/memory-check.ts      # Memory tools verification
npx tsx scripts/auth-check.ts        # Auth verification
npx tsx scripts/provider-check.ts    # Provider connectivity test

Testing

npm test                    # All 211 tests
npm run test:conformance    # 50 conformance tests + 13 lock-in checks
npm run check:imports       # Import boundary verification
npm run check:lockin        # Zero lock-in grep check
npm run baseline            # Build + test + lint + all checks

License

MIT