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

@agentproto/mastra

v0.2.2

Published

@agentproto/mastra — turn an AIP-42 AGENT.md handle into a runnable Mastra Agent. The package is a thin adapter: you supply resolvers (model, tool, workflow, memory) and it composes the manifest's identity, persona, body, boundaries, and tool refs into a

Readme

@agentproto/mastra

AIP-42 AGENT.md → Mastra runtime adapter. Reference implementation for the agent/v1 → live agent path against the Mastra framework.

pnpm add @agentproto/mastra @agentproto/agent @mastra/core

Why

@agentproto/agent parses an AGENT.md and gives you a typed AgentHandle. That's the spec layer. To actually run the agent, something has to translate ref strings (anthropic/claude-opus-4-7, @agentik/tools-standard/web-fetch, per-conversation memory scope) into runtime objects.

This package is that something for Mastra.

Usage

import { readFile } from "node:fs/promises"
import { parseAgentManifest, agentFromManifest } from "@agentproto/agent"
import { buildMastraAgent } from "@agentproto/mastra"
import { openai } from "@ai-sdk/openai"
import { anthropic } from "@ai-sdk/anthropic"
import { Memory } from "@mastra/memory"
import { weatherTool } from "./tools/weather"

const source = await readFile("./.agents/writer/AGENT.md", "utf8")
const parsed = parseAgentManifest(source)
const handle = agentFromManifest(parsed)

const { agent, resolvedTools, droppedTools, instructions } =
  await buildMastraAgent(handle, {
    body: parsed.body,
    resolveModel: (ref) => {
      const id = typeof ref === "string" ? ref : (ref.ref ?? "")
      const [provider, model] = id.split("/", 2)
      if (provider === "anthropic") return anthropic(model!)
      if (provider === "openai") return openai(model!)
      throw new Error(`unknown model provider: ${provider}`)
    },
    resolveTool: (ref) => {
      const id = typeof ref === "string" ? ref : (ref.ref ?? "")
      if (id === "weather") return { name: "weather", tool: weatherTool }
      return undefined // dropped with a warning
    },
    buildMemory: (cfg) => new Memory({ /* translate cfg fields */ }),
  })

console.log(`built agent '${agent.name}' with ${resolvedTools.length} tools`)
const reply = await agent.generate("draft a 200-word brief on…")

Resolvers

The package never bundles a model provider, tool catalog, or memory backend. You provide:

| Option | Required | Purpose | |---|---|---| | resolveModel(ref) | yes | Translate model: → AI-SDK LanguageModel | | resolveTool(ref) | no | Translate tools[] → Mastra tools | | resolveWorkflow(ref) | no | Validate workflows[] exist (not attached to agent) | | buildMemory(cfg) | no | Build a Mastra Memory from memory: | | buildVoice(handle) | no | Build a voice provider (ElevenLabs, etc.) | | formatInstructions | no | Override how body + boundaries become a system prompt | | body | no | The markdown body (everything after frontmatter) | | strict | no | Throw on unresolved tools instead of warn-and-drop |

Default instructions composer

composeInstructions(handle, body) produces:

{body or description}

{persona inline block if present}

Hard rules — these MUST be followed:
- {boundary 1}
- {boundary 2}

Trait scores (0-10): rigor=9, warmth=4.

Override with formatInstructions: (handle, body) => string if your host has its own prompt assembly (e.g. multi-agent council headers, per-tenant pre-amble, i18n).

Diagnostics

buildMastraAgent returns the live Agent plus:

  • resolvedTools: string[] — names that wired in
  • droppedTools: string[] — refs the resolver returned undefined for
  • resolvedWorkflows: string[] / droppedWorkflows: string[]
  • instructions: string — the final composed prompt

Useful for diagnostics UIs (which tools were declared on the manifest but missing from the host's catalog?) and tests.

License

MIT.