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-personas

v0.51.10

Published

Tenant-owned, context-scoped agent personas and resolution for the SMRT framework

Downloads

10,372

Readme

@happyvertical/smrt-personas

Tenant-owned, context-scoped agent personas for s-m-r-t. A TenantAgent decides whether an agent may run and caps its capabilities; a persona decides how that agent behaves for a tenant and context—its instructions, tools, acting identity, principal, memory scope, and priority.

The package also provides a gated learning loop: feedback reinforces memory, reflection creates pending directive proposals, and a human-authorized approval service activates instruction changes.

Installation

pnpm add @happyvertical/smrt-personas

Add svelte when consuming the optional directive-review UI.

Quick start

import {
  AgentPersonaCollection,
  PersonaResolver,
} from '@happyvertical/smrt-personas';
import { withTenant } from '@happyvertical/smrt-tenancy';

const personas = await AgentPersonaCollection.create({ db: 'app.db' });

await withTenant({ tenantId: 'tenant-1' }, async () => {
  const editor = await personas.create({
    tenantId: 'tenant-1',
    agentClass: '@acme/agents:EditorAgent',
    name: 'newsroom-editor',
    contextType: 'site',
    contextId: 'site-42',
    instructions: 'Prefer local sources and concise summaries.',
    priority: 100,
  });
  editor.setAllowedTools(['facts.search', 'content.update']);
  await editor.save();
});

const resolved = await new PersonaResolver(personas).resolve(
  'tenant-1',
  '@acme/agents:EditorAgent',
  { contextType: 'site', contextId: 'site-42' },
);

Resolution prefers exact context over context type over tenant default, then higher priority. The nearest tenant level with an applicable persona shadows farther ancestors.

Layering model

manifest defaults
    → TenantAgent availability and tool ceiling
        → nearest applicable AgentPersona
            → resolved instructions, tools, identity, and memory scope

Hierarchy resolution intentionally reads ancestor-tenant personas. Run it from a reviewed system/admin path rather than inside a strict tenant interceptor that forbids cross-tenant reads.

Learning and directive approval

  1. Feedback records a human or autonomous outcome with a correlation ID.
  2. reinforceFromFeedback() updates persona-scoped learning memory.
  3. ReflectionRunner turns evidence into a pending DirectiveProposal.
  4. DirectiveApprovalService requires personas.activate-directive before an approved rewrite becomes a tenant/persona-scoped prompt override.

Autonomous reflection can propose but cannot activate instructions. Confidence reinforcement is automatic; instruction changes are permission-gated.

Durable agent instances

Personas can also identify independently scheduled instances of a multi-instance agent. schedulePersonaInstance(), buildPersonaInstanceAdmin(), and upgradeSingletonToDefaultPersona() preserve singleton identity while enabling per-persona schedules, memory, and administration.

Public entry points

| Entry point | Purpose | | --- | --- | | @happyvertical/smrt-personas | Models, resolver, learning loop, approval services | | @happyvertical/smrt-personas/svelte | Presentational DirectiveReviewQueue |

Related packages

  • smrt-agents owns availability, scheduling, and agent lifecycle.
  • smrt-prompts stores activated instruction overrides.
  • smrt-users supplies permission resolution and run-as principals.
  • smrt-messages supplies the fixed persona messaging tool boundary.

Development

pnpm --filter @happyvertical/smrt-personas test
pnpm --filter @happyvertical/smrt-personas typecheck
pnpm --filter @happyvertical/smrt-personas build

See AGENTS.md for resolver, memory, tenancy, and permission invariants.