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

@astrivya/akg-core

v0.5.0

Published

Astrivya Knowledge Graph engine — SQLite-embedded, FTS5, vector embeddings, graph traversal, impact analysis, 3-way merge sync

Readme

@astrivya/akg-core

Embeddable knowledge graph engine — SQLite-embedded, keyword full-text search, optional 384-dim vector embeddings, graph traversal, impact analysis, and last-write-wins sync/merge. Zero external services, one file per workspace.

npm install @astrivya/akg-core

Quick Start

import { createAkg } from "@astrivya/akg-core";

// Initialize in any directory
const ctx = await createAkg("./my-project");

// Insert nodes (files, decisions, concepts)
await ctx.storage.upsertNode({
  id: "adr:001",
  label: "Use React for frontend",
  type: "adr",
  content: "Decision to adopt React 18 with TypeScript for the SPA.",
  createdAt: Date.now(),
  updatedAt: Date.now(),
});

// Insert edges (relationships)
await ctx.storage.addEdge({
  source: "adr:001",
  target: "file:package.json",
  relation: "references",
  weight: 1,
});

// Search
const results = await ctx.query.retrieve("React frontend", 5);

// Traverse graph
const path = ctx.traversal.shortestPath("adr:001", "file:package.json");

// Analyze impact
const report = ctx.impact.analyzeRemoval("adr:001");

API Reference

createAkg(workspacePath): Promise<AkgContext>

One-shot initialization. Creates/opens the .astrivya/akg.db SQLite database and returns all services.

AkgStorage

| Method | Description | |--------|-------------| | init(workspacePath) | Open or create the database | | upsertNode(node) | Insert or update a node | | getNode(id) | Look up a node by ID | | deleteFileNodes(filePath) | Remove all nodes associated with a file | | getNeighbors(id) | Get immediate neighbor nodes | | addEdge(edge) | Insert a directed edge | | upsertChunk(chunk) | Index a content chunk (keyword + optional embedding) | | getStats() | Aggregate graph statistics | | exportGraph() | Serialize the full graph for sync | | importGraph(data) | Import a serialized graph (last-write-wins merge) | | close() | Flush and close the database | | runQuery(sql, params) | Execute raw SQL (advanced use) |

AkgQuery

| Method | Description | |--------|-------------| | retrieve(query, limit) | Multi-strategy search (keyword + semantic + graph) | | classifyQuery(query) | Determine search intent weights | | buildContext(query, results) | Format results as LLM context block |

GraphTraversal

| Method | Description | |--------|-------------| | shortestPath(from, to) | Shortest path between two nodes | | topologicalSort(...) | Topological sort with cycle detection | | dependencies(id, transitive?) | Nodes a node depends on | | dependents(id, transitive?) | Nodes that depend on a node |

ImpactAnalyzer

| Method | Description | |--------|-------------| | analyzeRemoval(nodeId) | Impact report with risk score for removing a node | | criticalityRanking(limit?) | Rank nodes by how many depend on them | | findCycles(maxLength?) | Detect circular dependency loops |

Sync (Last-Write-Wins Merge)

| Function | Description | |----------|-------------| | mergeNode(local, remote) | Merge two versions of a node | | mergeChunks(local, remote) | Merge chunk sets | | mergeEdges(local, remote) | Merge edge sets | | mergeGraphs(local, remote) | Merge full graphs |

Error Classes

| Class | Code | When | |-------|------|------| | AkgError | AKG_ERR | Base error | | StorageError | STORAGE_ERR | Database I/O or schema failure | | QueryError | QUERY_ERR | Invalid query | | TraversalError | TRAVERSAL_ERR | Graph traversal failure | | MergeError | MERGE_ERR | Sync conflict | | NotFoundError | NOT_FOUND | Entity not found | | ValidationError | VALIDATION_ERR | Invalid input |

Types

type NodeType = "file" | "function" | "class" | "interface" | "adr" | "task"
  | "agent" | "agent_action" | "dependency" | "person" | "community" | "workspace";

type RelationType = "depends_on" | "imports" | "calls" | "implements" | "extends"
  | "contains" | "references" | "documents" | "generated";

interface AkgNode { id, label, type, content?, sourceFile?, metadata?,
  createdAt, updatedAt, ... }

interface AkgEdge { source, target, relation, weight?,
  confidence?, extractionMethod? }

interface AkgChunk { id?, nodeId, filePath, content, startLine?, endLine?,
  embedding? }

interface AkgContext { storage, query, traversal, impact }

How It Works

┌─────────────┐  SQLite Database (.astrivya/akg.db)
│   Nodes     │  ├── nodes (graph vertices)
│   Edges     │  ├── edges (directed relations)
│   Chunks    │  ├── chunks (keyword-indexed content)
│   Vectors   │  ├── embeddings (384-dim float32)
└─────────────┘  └── communities, persons, metadata

The database is a single file — copy it, sync it, commit it. No server, no API keys, no cloud dependency.

License

Apache 2.0