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

@tylerge99/mini-claw

v0.9.0

Published

A mini AI assistant system inspired by OpenClaw architecture

Readme

Mini-Claw

A modular, extensible personal AI assistant system built in TypeScript. Inspired by the OpenClaw architecture, designed for learning and rapid development.

Features

  • Multi-model support -- Claude (Anthropic) and OpenAI out of the box, extensible via plugins
  • Agent runtime -- Tool-calling loop with streaming, context pruning, and automatic compaction
  • Plugin system -- Load tools, channels, model providers, and search providers from extensions/
  • Skill system -- Slash-command prompt templates with argument substitution, sub-agents, and reference docs
  • Session persistence -- File-based JSONL storage with concurrent-write safety
  • WebSocket gateway -- Multi-client server with typed protocol (req/res/event frames)
  • Multiple interfaces -- Rich TUI, Web UI (React), and CLI
  • Workspace context -- System prompt assembled from markdown files (SOUL, AGENTS, USER, MEMORY)

Quick Start

Prerequisites

  • Node.js >= 22
  • pnpm

Install

git clone <repo-url> && cd mini-claw
pnpm install

Configure

Run the interactive onboarding wizard:

pnpm dev:onboard

Or set environment variables directly:

export ANTHROPIC_API_KEY=sk-ant-...   # For Claude
export OPENAI_API_KEY=sk-...          # For OpenAI

Run

pnpm dev          # Start TUI chat session
pnpm gateway      # Start WebSocket gateway + CLI channel
pnpm ui           # Start Web UI (React, opens in browser)

Architecture

┌─────────────────────────────────────────────────────────────────────────────┐
│                              Clients                                        │
│                                                                             │
│   ┌──────────┐    ┌──────────────────┐    ┌──────────────────┐              │
│   │   TUI    │    │   Web UI (React) │    │  External WS     │              │
│   │  (CLI)   │    │     (Vite)       │    │  Clients         │              │
│   └────┬─────┘    └────────┬─────────┘    └────────┬─────────┘              │
│        │                   │                       │                        │
└────────┼───────────────────┼───────────────────────┼────────────────────────┘
         │                   │                       │
         │  readline         │  HTTP/WS              │  WebSocket
         │                   │                       │
┌────────┼───────────────────┼───────────────────────┼────────────────────────┐
│        │            Gateway Layer                   │                        │
│        ▼                   ▼                       ▼                        │
│   ┌─────────────────────────────────────────────────────────────┐           │
│   │                   GatewayServer (:18789)                     │           │
│   │  ┌──────────┐  ┌──────────────┐  ┌───────────────────────┐  │           │
│   │  │  Router   │  │  Broadcaster │  │  Protocol (TypeBox)   │  │           │
│   │  │  method   │  │  broadcast() │  │  req / res / event    │  │           │
│   │  │  registry │  │  send()      │  │  frame schemas        │  │           │
│   │  └──────────┘  └──────────────┘  └───────────────────────┘  │           │
│   └────────────────────────┬────────────────────────────────────┘           │
│                            │                                                │
└────────────────────────────┼────────────────────────────────────────────────┘
                             │
         ┌───────────────────┼───────────────────────────────┐
         │                   │                               │
         ▼                   ▼                               ▼
┌─────────────────┐ ┌─────────────────┐           ┌─────────────────┐
│  Channel Layer  │ │  Skills System  │           │   Workspace     │
│                 │ │                 │           │                 │
│  CliChannel     │ │  SkillRegistry  │           │  ContextBuilder │
│  TelegramChannel│ │  SkillExecutor  │           │                 │
│  QQBotChannel*  │ │  invoke_skill   │           │  SOUL.md        │
│                 │ │  tool           │           │  AGENTS.md      │
└────────┬────────┘ └────────┬────────┘           │  USER.md        │
         │                   │                    │  MEMORY.md      │
         │                   │                    │  memory/*.md    │
         │                   │                    └────────┬────────┘
         │                   │                             │
         ▼                   ▼                             │ system prompt
┌──────────────────────────────────────────────────────────┼──────────────────┐
│                        Agent Runtime                      │                  │
│                                                          │                  │
│  ┌───────────────────────────────────────────────────────┼──────────────┐   │
│  │                  AgentRuntime                          │              │   │
│  │                                                       ▼              │   │
│  │   ┌───────────┐   ┌──────────────┐   ┌──────────────────────┐       │   │
│  │   │   Model    │   │  Tool        │   │  Context Manager     │       │   │
│  │   │   Router   │   │  Registry    │   │                      │       │   │
│  │   │            │   │              │   │  ContextPruner       │       │   │
│  │   │  claude ──►│   │  echo        │   │  (TTL-based trim)    │       │   │
│  │   │  openai ──►│   │  calculator  │   │                      │       │   │
│  │   │  mimo*  ──►│   │  date_time   │   │  CompactionModule    │       │   │
│  │   │            │   │  bash        │   │  (auto-summary)      │       │   │
│  │   └─────┬──────┘   │  web_fetch   │   └──────────────────────┘       │   │
│  │         │          │  web_search  │                                  │   │
│  │         │          └──────┬───────┘                                  │   │
│  │         │                 │                                          │   │
│  │         ▼                 ▼                                          │   │
│  │   ┌─────────────────────────────┐                                    │   │
│  │   │   Execution Loop (max 20)   │                                    │   │
│  │   │                             │                                    │   │
│  │   │   model.chat()              │                                    │   │
│  │   │       │                     │                                    │   │
│  │   │       ▼                     │                                    │   │
│  │   │   tool_use? ──yes──► execute + append result                    │   │
│  │   │       │                     │                                    │   │
│  │   │      no                     │                                    │   │
│  │   │       │                     │                                    │   │
│  │   │       ▼                     │                                    │   │
│  │   │   return final text         │                                    │   │
│  │   └─────────────────────────────┘                                    │   │
│  └──────────────────────────────────────────────────────────────────────┘   │
│                                                                            │
└────────────────────────────┬───────────────────────────────────────────────┘
                             │
         ┌───────────────────┼───────────────────┐
         ▼                   ▼                   ▼
┌─────────────────┐ ┌─────────────────┐ ┌─────────────────┐
│ Session Manager │ │ Plugin System   │ │  Model Providers │
│                 │ │                 │ │                  │
│ SessionManager  │ │ PluginRegistry  │ │  ClaudeProvider  │
│  (in-memory)    │ │ PluginLoader    │ │  OpenAIProvider  │
│                 │ │ PluginAPI       │ │  XiaomiProvider* │
│ SessionStore    │ │                 │ │                  │
│  (JSONL files)  │ │  Built-in:      │ │  SearchProviders │
│                 │ │  claude-provider│ │  DuckDuckGo*     │
│  sessions.json  │ │  openai-provider│ │                  │
│  <key>.jsonl    │ │                 │ │                  │
│                 │ │  Extensions/:   │ │                  │
│                 │ │  hello-plugin   │ │                  │
│                 │ │  duckduckgo*    │ │                  │
│                 │ │  xiaomi*        │ │                  │
│                 │ │  qqbot*         │ │                  │
└─────────────────┘ └─────────────────┘ └─────────────────┘

  * = extension plugin (loaded from extensions/)

Gateway

WebSocket server (default 127.0.0.1:18789) with a typed frame protocol:

| Frame | Direction | Purpose | | :--- | :--- | :--- | | req | Client -> Server | Request with method + params | | res | Server -> Client | Response with ok/error | | event | Server -> Client | Push events (streaming, notifications) |

Agent Runtime

The core execution loop:

  1. Resolve system prompt (static or dynamic per session)
  2. Load session history, apply context pruning
  3. Stream model response -- emit text/tool_use/tool_result events
  4. If tool calls present, execute them and loop (max 20 rounds)
  5. Auto-compact when message count or token thresholds are exceeded

Plugin System

Plugins are loaded from extensions/ directories. Each plugin has a mini-claw.plugin.json manifest and an index.ts entry point that receives a PluginAPI:

export function register(api: PluginAPI) {
  api.registerTool(myTool);
  api.registerChannel(myChannel);
  api.registerProvider(myProvider);
  api.registerSearchProvider(mySearchProvider);
}

Four example plugins are included:

| Plugin | Type | Description | | :--- | :--- | :--- | | hello-plugin | Tool | Demo tool that greets by name | | duckduckgo-search | Search Provider | Web search without API keys | | xiaomi-provider | Model Provider | Xiaomi MiMo models (OpenAI/Anthropic compatible) | | qqbot-channel | Channel | QQ Bot integration (C2C + group) |

Skills System

Skills are prompt templates invoked via /skill-name in chat. Two formats:

Single file (skills/weather.md):

---
name: weather
description: Get weather for a location
argument-hint: <city>
---

Check the weather for $ARGUMENTS using wttr.in

Directory (skills/skill-creator/SKILL.md + agents/, references/): Contains sub-agent definitions, reference docs, scripts, and assets.

7 built-in skills: commit, explain, refactor, review, test, weather, skill-creator.

Session Management

Sessions are stored as JSONL files under ~/.mini-claw/sessions/:

  • sessions.json -- metadata index
  • <session-key>.jsonl -- one JSON line per message

A per-session promise-chain mutex prevents concurrent write corruption.

Workspace Context

The system prompt is assembled from markdown files in ~/.mini-claw/workspace/:

| File | Purpose | Budget | | :--- | :--- | :--- | | SOUL.md | Personality and tone | 5K chars | | AGENTS.md | Tool usage rules | 10K chars | | USER.md | User preferences | 3K chars | | MEMORY.md | Long-term memory | 20K chars | | memory/*.md | Daily memory notes | Today + yesterday |

Total budget: 150K characters.

CLI Commands

mini-claw onboard              # Interactive setup wizard
mini-claw chat                 # Start TUI chat session
mini-claw gateway              # Start WebSocket gateway + CLI channel
mini-claw providers list       # List discovered provider plugins
mini-claw models list          # Show configured providers
mini-claw models auth add      # Add/update a provider interactively
mini-claw plugins list         # List loaded plugins
mini-claw skills list          # List available skills
mini-claw skills show <name>   # Show skill details
mini-claw skills create <name> # Create a new skill template

TUI Slash Commands

| Command | Action | | :--- | :--- | | /new | Start a new session | | /clear | Clear current session | | /model | Switch model | | /skills | List available skills | | /compact | Manually compact conversation | | /quit | Exit | | /help | Show help |

Built-in Tools

| Tool | Description | | :--- | :--- | | echo | Returns input text (testing) | | calculator | Basic arithmetic | | date_time | Time, timezone, formatting | | bash | Shell execution with security sandbox | | web_fetch | Fetch URL, convert HTML to Markdown | | web_search | Delegate to registered search providers |

Configuration

Config file: ~/.mini-claw/mini-claw.json

{
  "gateway": { "port": 18789, "host": "127.0.0.1" },
  "agent": {
    "defaultProvider": "claude",
    "defaultModel": "claude-sonnet-4-5-20250929",
    "compaction": { "enabled": true, "maxMessages": 50, "maxInputTokens": 100000 },
    "maxToolRounds": 20
  },
  "plugins": { "enabled": true, "loadPaths": ["./extensions"] }
}

Use MINI_CLAW_ENV=dev to switch to ~/.mini-claw-dev/ for development.

Extending

Add a New Tool

Create src/agent/tools/my-tool.ts, implement the AgentTool interface, register in src/agent/tools/index.ts.

Add a New Channel

Implement ChannelPlugin from src/channels/types.ts, register via ChannelManager.register().

Add a New Plugin

Create a directory under extensions/ with:

  • mini-claw.plugin.json -- manifest
  • index.ts -- exports register(api: PluginAPI)

Add a New Skill

Create a .md file in skills/ with YAML frontmatter, or a directory with SKILL.md plus optional agents/, references/, scripts/, assets/ subdirectories.

Testing

pnpm test           # Run all tests
pnpm test:watch     # Watch mode
pnpm lint           # Type check

8 test suites covering: agent runtime, bash tool, channels, compaction, context builder, context pruner, gateway, and session store.

Tech Stack

  • Runtime: Node.js >= 22, TypeScript (ESM)
  • AI: @anthropic-ai/sdk, openai
  • WebSocket: ws
  • Schemas: @sinclair/typebox
  • CLI: commander, @clack/prompts, chalk
  • TUI: @earendil-works/pi-tui
  • Web: React 19, Vite
  • Testing: vitest
  • Package Manager: pnpm

License

MIT