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

@happyvertical/smrt-facts

v0.43.5

Published

Distributed memory and knowledge management with provenance tracking for SMRT framework

Readme

@happyvertical/smrt-facts

Knowledge base with semantic deduplication, provenance tracking, and confidence scoring for the s-m-r-t framework. Facts evolve through parent-child chains, are linked to sources and subjects, and undergo 3-zone reconciliation to prevent duplicates.

Installation

pnpm add @happyvertical/smrt-facts

Usage

import {
  Fact, FactCollection,
  FactSource, FactSourceCollection,
  FactSubject, FactSubjectCollection,
  FactContent, FactContentCollection,
  FactTag, FactTagCollection,
  calculateConfidence, normalizeText,
} from '@happyvertical/smrt-facts';

// Create a fact with provenance
const facts = await FactCollection.create({ db });
const fact = await facts.create({
  textRefined: 'The Eiffel Tower is 330 meters tall',
  type: 'measurement',
  domain: 'landmarks',
  status: 'active',
});

// Attach a source with credibility score
const sources = await FactSourceCollection.create({ db });
await sources.create({
  factId: fact.id,
  sourceUrl: 'https://example.com/eiffel-tower',
  sourceTitle: 'Tourism Board',
  credibility: 0.9,
});

// Recalculate confidence from all sources
await facts.recalculateConfidence(fact.id);

// 3-zone semantic reconciliation
// >= 0.85 similarity: auto-merge (same fact, update metadata)
// 0.60-0.85: AI disambiguation (asks model to decide merge vs branch)
// < 0.60: create new fact
const result = await facts.reconcile({
  rawInput: 'The Eiffel Tower stands 330m tall',
  type: 'measurement',
  domain: 'landmarks',
  source: { sourceUrl: 'https://another-source.com', credibility: 0.8 },
});
// result.action: 'created' | 'merged' | 'branched'

// Evolution chains: branch creates a successor fact linked via previousFactId
const successor = await facts.branch(fact.id, {
  textRefined: 'The Eiffel Tower is 330 meters tall including the antenna',
}, 'correction');
// 'correction' and 'contradiction' mark the predecessor as superseded

// Walk evolution: root -> current (via previousFactId)
const chain = await facts.getEvolutionChain(successor.id);
// Find highest-confidence leaf (via getSuccessors)
const latest = await facts.getLatestInChain(fact.id);
// Full tree (BFS with cycle detection)
const tree = await facts.getEvolutionTree(fact.id);

// Per-fact navigation: getPredecessor / getSuccessors / hasPredecessor
const previous = await successor.getPredecessor();
const successors = await fact.getSuccessors();
if (successor.hasPredecessor()) {
  // ...
}

// Entity briefing: all facts for a given entity
const briefing = await facts.getEntityBriefing('Place', placeId);
// { facts, totalCount, byType, byStatus }

API

Models

| Export | Description | |--------|------------| | Fact | Knowledge unit with textRefined, type, status, confidence, previousFactId for evolution chains (predecessor pointer; not a structural hierarchy edge), and auto-generated embeddings | | FactSource | Provenance record with sourceUrl, sourceType, credibility (0-1), extractedAt | | FactSubject | Polymorphic entity link (entityType + entityId), conflictColumns: ['fact_id', 'entity_type', 'entity_id'] | | FactContent | Join table linking facts to Content, conflictColumns: ['fact_id', 'content_id', 'relationship'] | | FactTag | Tag association for a fact |

Collections

| Export | Description | |--------|------------| | FactCollection | Query by status/type/domain, reconcile(), branch(), evolution traversal, recalculateConfidence(), getEntityBriefing(), findWithGlobals(tenantId) | | FactSourceCollection | Source management with getForFact() | | FactSubjectCollection | Subject links with getForFact(), getForEntity() | | FactContentCollection | Fact-to-content relationships | | FactTagCollection | Fact tag management |

Functions

| Export | Description | |--------|------------| | calculateConfidence | Weighted formula: base 0.5 + source volume (max 0.3) + credibility (0.2) + recency (0.1, decays over 10 days) + corroboration (0.1), clamped to [0, 1] | | normalizeText | Trim, collapse whitespace, lowercase -- used for dedup comparison |

Key Types

FactType (assertion/observation/measurement/definition/relationship/event/opinion/prediction), FactStatus (pending/active/disputed/superseded/archived/retracted), EvolutionType (original/correction/refinement/contradiction/extension/merge), SubjectRole, ReconcileAction, ReconcileOptions, ReconcileResult, FactContentRelationship, EntityBriefing

Dependencies

  • @happyvertical/smrt-core -- ORM, code generation, and semantic search
  • @happyvertical/smrt-tenancy -- optional multi-tenant scoping with findWithGlobals()
  • @happyvertical/ai -- AI disambiguation in reconciliation

Contributor guide

See AGENTS.md for package architecture, invariants, validation, and contributor guidance.