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

@reactive-agents/prompts

v0.10.6

Published

Prompt management for Reactive Agents — template engine and built-in prompt library

Readme

@reactive-agents/prompts

Prompt management for the Reactive Agents framework. v0.10.3

A version-controlled template engine with {{variable}} interpolation, type-safe variable bindings, and a built-in library of agent prompts covering reasoning strategies (ReAct, Plan-Execute, Tree-of-Thought, Reflexion), evaluation judges (accuracy, relevance, completeness, safety), and tier-adaptive system prompts (frontier vs. local models).

Installation

bun add @reactive-agents/prompts

Or via the umbrella:

bun add reactive-agents

Features

  • Template engine{{variable}} interpolation with required/optional variables, defaults, and type guards
  • Built-in template library — reasoning, verification, evaluation, and default agent system prompts
  • Tier-adaptive variants — separate react-system-frontier, react-system-local, react-thought-frontier, react-thought-local for cost-aware prompt routing
  • Version-controlled — every template carries a version integer; PromptService looks up the latest unless pinned
  • Token estimatorestimateTokens() for budget planning before render
  • A/B experimentsExperimentService (unstable) for prompt variant evaluation

Quick Example

import { interpolate } from "@reactive-agents/prompts";

const rendered = interpolate(
  "You are a {{role}} expert. Answer in {{language}}.",
  { role: "TypeScript", language: "English" },
);

Built-in Templates

Reasoning

| Template | Strategy / phase | | ----------------------------------------- | ----------------------------------------- | | reactTemplate | High-level ReAct loop prompt | | reactSystemTemplate | ReAct system prompt | | reactThoughtTemplate | ReAct thought-step prompt | | reactSystemFrontierTemplate / reactSystemLocalTemplate | Tier-adaptive system variants | | reactThoughtFrontierTemplate / reactThoughtLocalTemplate | Tier-adaptive thought variants | | planExecuteTemplate | Plan-Execute high-level | | planExecutePlanTemplate | Plan phase | | planExecuteExecuteTemplate | Execute phase | | planExecuteReflectTemplate | Reflect phase | | treeOfThoughtTemplate | ToT high-level | | treeOfThoughtExpandTemplate | Expand candidate thoughts | | treeOfThoughtScoreTemplate | Score candidates | | treeOfThoughtSynthesizeTemplate | Synthesize chosen branch | | reflexionTemplate | Reflexion high-level | | reflexionGenerateTemplate | Generate attempt | | reflexionCritiqueTemplate | Critique prior attempt | | adaptiveClassifyTemplate | Classify task complexity for routing |

Verification

| Template | Use | | ------------------- | -------------------------------- | | factCheckTemplate | Fact-check decomposed claims |

Evaluation (judges)

| Template | Dimension | | ------------------------------ | --------------- | | judgeAccuracyTemplate | Accuracy | | judgeRelevanceTemplate | Relevance | | judgeCompletenessTemplate | Completeness | | judgeSafetyTemplate | Safety | | judgeGenericTemplate | Generic rubric |

Agent

| Template | Use | | ------------------------- | --------------------------------------- | | defaultSystemTemplate | Default agent system prompt |

allBuiltinTemplates is a flat array of every template above — useful for bulk registration.

Builder Integration

import { ReactiveAgents } from "reactive-agents";

// Enable all built-in templates
const agent = await ReactiveAgents.create()
  .withName("researcher")
  .withProvider("anthropic", { model: "claude-sonnet-4-20250514" })
  .withPrompts()
  .build();

// Or register custom templates at build time
const customAgent = await ReactiveAgents.create()
  .withName("custom")
  .withProvider("anthropic")
  .withPrompts({
    templates: [
      {
        id: "custom.system",
        name: "Custom System Prompt",
        version: 1,
        template: "You are a {{role}} expert. Answer in {{language}}.",
        variables: [
          { name: "role", required: true, type: "string" },
          { name: "language", required: false, type: "string", defaultValue: "English" },
        ],
      },
    ],
  })
  .build();

Direct Service Usage

import { Effect } from "effect";
import { PromptService, PromptServiceLive } from "@reactive-agents/prompts";

const program = Effect.gen(function* () {
  const prompts = yield* PromptService;
  const compiled = yield* prompts.compile("react.system", {
    role: "research assistant",
    tools: ["web_search", "calculator"],
  });
  return compiled.text;
});

A/B Experiments (unstable)

import { ExperimentService } from "@reactive-agents/prompts";
// Variant assignment, outcome capture, results aggregation.
// See AUDIT-overhaul-2026.md §11 #41 — surface may change in v0.10.x.

Key Exports

| Export | Purpose | | ------------------------------------------------ | ---------------------------------------------- | | PromptService, PromptServiceLive | Template registration + compilation | | interpolate, estimateTokens | Pure template-engine helpers | | allBuiltinTemplates | Bulk registration array | | createPromptLayer | Factory for the runtime layer | | ExperimentService, ExperimentServiceLive | A/B experimentation (unstable) | | PromptTemplate, CompiledPrompt, PromptVariable | Schemas + types | | PromptError, TemplateNotFoundError, VariableError | Tagged errors |

Documentation

Full documentation at docs.reactiveagents.dev

License

MIT