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

kg-coder

v1.0.1

Published

Knowledge Graph system for agentic AI context engineering

Readme

kg-coder

Elite coding patterns from the world's best developers, delivered to your AI assistant.

Overview

kg-coder is a local-first knowledge graph system designed for agentic AI context engineering. It provides Claude Desktop and other MCP-compatible AI assistants with access to 115 elite coding patterns extracted from 13 legendary developers.

Each pattern includes:

  • Problem - The specific issue the pattern solves
  • Solution - The implementation approach
  • Benefits - What the pattern enables
  • Tradeoffs - What you sacrifice when using it
  • Causality chains - Full reasoning path from problem to solution

Features

  • 115 Elite Patterns from 13 legendary developers (bellard, antirez, ryansolid, mitchellh, and more)
  • MCP Server for seamless Claude Desktop integration
  • Context-Aware Discovery - Patterns matched by file type, keywords, and problem description
  • Full Causality Chains - Understand the "why" behind each pattern
  • Local-First - Your data stays on your machine
  • SQLite Backend - Fast, reliable, WAL-mode enabled

Installation

Claude Desktop

Add to your Claude Desktop configuration (~/Library/Application Support/Claude/claude_desktop_config.json):

{
  "mcpServers": {
    "kg-coder": {
      "command": "node",
      "args": ["/path/to/kg-coder/dist/mcp-server/index.js"],
      "env": {
        "KG_DATABASE_PATH": "/path/to/kg-coder/elite-patterns/patterns.db"
      }
    }
  }
}

From Source

# Clone the repository
git clone https://github.com/bradheitmann/kg-coder.git
cd kg-coder

# Install dependencies
pnpm install

# Build
pnpm build

# Test
pnpm test

Quick Start

Once installed in Claude Desktop, you can query patterns directly:

"What patterns solve rate limiting problems?"
"Show me patterns from antirez"
"How does bellard approach memory management?"

Or use the MCP resources directly:

kg://patterns/context?ext=.tsx&keywords=state,reactive
kg://patterns/developer?dev=ryansolid&limit=5
kg://patterns/top?minWow=0.95

Pattern Library

Tier 1: Legendary

| Developer | Known For | Patterns | |-----------|-----------|----------| | Fabrice Bellard | FFmpeg, QEMU, QuickJS | Systems programming, compression | | Salvatore Sanfilippo (antirez) | Redis | Data structures, idempotency | | Andrew Kelley | Zig | Comptime, error handling |

Tier 2: Elite

| Developer | Known For | Patterns | |-----------|-----------|----------| | Ryan Carniato | SolidJS | Fine-grained reactivity | | Rich Harris | Svelte | Compiler-driven UI | | Evan You | Vue | Reactive systems | | Mitchell Hashimoto | HashiCorp | Infrastructure patterns |

Tier 3: Master

| Developer | Known For | Patterns | |-----------|-----------|----------| | Matt Pocock (matklad) | rust-analyzer | IDE architecture | | Tanner Linsley | TanStack | State management | | Jarred Sumner | Bun | Runtime optimization | | Simon Willison | Datasette | Data tooling | | TJ Holowaychuk | Express, Koa | Node.js patterns |

MCP Tools

Memory Tools (6)

| Tool | Description | |------|-------------| | memory.upsert_entities | Create or update graph nodes | | memory.upsert_edges | Create relationships between nodes | | memory.invalidate_edges | Soft-delete edges (temporal versioning) | | memory.query_subgraph | Query graph with traversal | | context.assemble_pgn | Pack context for LLM consumption | | memory.compact_session | Optimize session memory |

Pattern Tools (5)

| Tool | Description | |------|-------------| | patterns.find_for_problem | Find patterns by problem description | | patterns.get_by_developer | Get patterns from specific developer | | patterns.get_causality_chain | Get full causality chain for pattern | | patterns.find_by_context | Find patterns by file/language context | | patterns.search | Full-text pattern search |

MCP Resources

Graph Resources (8)

| Resource | Description | |----------|-------------| | kg://graph/stats | Graph statistics (nodes, edges, tokens) | | kg://graph/entities | Entity listing with filtering | | kg://graph/neighborhood | K-hop expansion from seeds | | kg://graph/temporal | Time-slice graph state | | kg://graph/clusters | Spectral clustering view | | kg://graph/ranking | Marginal utility ranking | | kg://graph/paths | Shortest path finder | | kg://server/info | Server version and capabilities |

Pattern Resources (6)

| Resource | Description | |----------|-------------| | kg://patterns/context | Context-aware pattern discovery | | kg://patterns/developer | Patterns by developer | | kg://patterns/top | Highest-rated patterns | | kg://patterns/problems | Problem-organized index | | kg://patterns/chain | Full causality chains | | kg://patterns/developers | Available developer listing |

Configuration

Environment Variables

| Variable | Description | Default | |----------|-------------|---------| | KG_DATABASE_PATH | Path to SQLite database | ~/.kg-coder/memory.db | | KG_VERBOSE | Enable verbose logging | false |

CLI Arguments

kg-coder-mcp --db /path/to/database.db --verbose

| Argument | Description | |----------|-------------| | --db, --database | Database file path | | --verbose, -v | Enable verbose logging | | --help, -h | Show help |

Database Schema

kg-coder uses SQLite with:

  • WAL mode for concurrent access
  • Foreign key constraints for referential integrity
  • 13 indexes for query performance
  • Temporal versioning for edge history

Statistics

| Metric | Value | |--------|-------| | Nodes | 381 | | Edges | 335 | | Entity Types | 20 | | Predicates | 31 |

Serialization Formats

kg-coder supports multiple formats for context packing:

  • PGN (Prompt Graph Notation) - Markdown for LLMs
  • TOON (Tokens Optimized Notation) - CSV tables for efficiency
  • GGN (Graph Grammar Notation) - Schema-first format
  • JSON - Native format

Development

# Development mode (watch)
pnpm dev

# Run tests
pnpm test

# Run tests with coverage
pnpm test:coverage

# Type check
pnpm typecheck

# Lint
pnpm lint

Project Structure

kg-coder/
├── src/
│   ├── core/           # Core types and models
│   ├── storage/        # SQLite database layer
│   ├── serialization/  # PGN, TOON, GGN formats
│   ├── mcp-server/     # MCP server implementation
│   ├── tools/          # MCP tool handlers
│   └── import/         # Data import pipeline
├── elite-patterns/     # Pattern database
├── tests/              # Test suite
└── docs/               # Documentation

Contributing

See CONTRIBUTING.md for development setup and guidelines.

Security

See SECURITY.md for security model and vulnerability reporting.

License

MIT - see LICENSE

Acknowledgments

This project extracts and organizes coding patterns from publicly available talks, blog posts, and open-source code by the developers listed above. All attribution is preserved in the pattern metadata.


Built with care by OKOA Labs