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

@trybacked/semantic-chat

v0.1.3

Published

NL → semantic query planner and deterministic executor with row provenance for chat/workshop

Readme

@trybacked/semantic-chat

Natural-language ask over a published ontology and warehouse: an LLM agent calls the same governed tools as MCP/API (query_objects, schema search, optional docs readers), then finishes with submit_answer or ask_clarification. Numbers in the answer must appear in tool results (grounding + optional repair turn).

A separate plan engine (createSemanticChatEngine) still exists for deterministic translate → validate → execute workflows and tests; production POST /v1/chat/ask uses runSemanticAgent.

Agent flow (production)

Question
  → applySemanticCatalogs(ontology, shared packs)
  → system prompt (schema slice + glossary + examples)
  → tool loop (AI SDK, toolChoice required)
       search_schema | get_entity | get_property_values | query_objects
       [search_documents | get_entity_profile | traverse_graph if enabled]
       submit_answer | ask_clarification
  → grounding (rebind claims to toolCallId evidence)
  → optional repair generation if a cited number is missing
  → SemanticAgentResult

Budget defaults live in src/agent/limits.ts (DEFAULT_AGENT_BUDGET in types.ts).

Attach to a tenant service

import { attachSemanticAsk } from "@trybacked/semantic-chat";
import { createSemanticAgentModelFromEnv } from "@trybacked/semantic-chat";

const model = createSemanticAgentModelFromEnv(process.env);
if (model !== undefined) {
  attachSemanticAsk(anchorService, { ontology, ...model });
}

Run the agent directly (tests, scripts)

import { runSemanticAgent, DEFAULT_AGENT_BUDGET } from "@trybacked/semantic-chat";

const result = await runSemanticAgent({
  ontology,
  service: anchorService,
  question: "How many rows for load month 2025-06?",
  apiKey: process.env.AI_GATEWAY_API_KEY!,
  modelId: "openai/gpt-4o-mini",
  budget: DEFAULT_AGENT_BUDGET,
});

// result.answer, result.claims, result.steps, result.clarification?, result.usage

Plan engine (legacy / eval helpers)

import { createSemanticChatEngine } from "@trybacked/semantic-chat";

const engine = createSemanticChatEngine({ ontology, queryRuntime, translate });
const answer = await engine.executePlan({ objectQuery: { objectId: "customer", mode: "count" } });

Key modules

| Path | Role | | ------------------------- | ----------------------------------------------------------------- | | agent/run-agent.ts | Main loop, fallback model, grounding repair | | agent/build-tools.ts | Tool definitions; ObjectQuerySchema derived for query_objects | | agent/grounding.ts | Claim ↔ tool result validation and citation rebind | | agent/prompt-builder.ts | System policy + ontology context | | create-semantic-ask.ts | Maps agent result → HTTP SemanticAskResponse |

HTTP contract and workshop notes: apps/api-server/docs/AI-ASK.md, WORKSHOP-AI-ASK.md.