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

@capitalthought/agent-feedback

v0.1.0

Published

Operator feedback + error reporting for agent-first MCP products. Drop-in tool factory + error-wrap middleware.

Readme

@capitalthought/agent-feedback

Operator feedback + error reporting for agent-first MCP products. Drop-in tool factory + error-wrap middleware for capturing feedback from inside Claude/Mikey conversations.

Why

In agent-first products, operators interact through an LLM (Mikey, Claude) — not a UI. When an operator says "this is weird" or hits a tool error, that signal evaporates the moment the conversation ends. This package gives you:

  1. An explicit MCP tool (<product>_feedback) the agent calls when the operator signals friction.
  2. A middleware (wrapWithFeedback) that auto-captures user-facing tool errors with a structured feedback_id returned to the LLM.

Both paths use the operator's existing JWT — no new shared secrets, no impersonation vector.

Install

npm install @capitalthought/agent-feedback

Usage

1. Implement FeedbackStorage against your backend

import type { FeedbackStorage, FeedbackInput, FeedbackRecord } from '@capitalthought/agent-feedback';

export class MyFeedbackStorage implements FeedbackStorage {
  async create(input: FeedbackInput): Promise<FeedbackRecord> { /* INSERT into your DB */ }
  async getById(id: string): Promise<FeedbackRecord | null> { /* SELECT */ }
}

2. Register the explicit tool in your MCP server

import { createFeedbackTool } from '@capitalthought/agent-feedback';

const feedbackTool = createFeedbackTool({
  apiBaseUrl: 'https://yourproduct.com',
  productName: 'yourproduct',
  getAuthToken: async () => operatorJwt,  // your existing operator JWT cache
});

server.registerTool(feedbackTool);

3. Wrap your existing tool handlers with the middleware

import { wrapWithFeedback, defaultClassifier } from '@capitalthought/agent-feedback';

const userFacingErrors = new Set(['mfa_required', 'address_required', /* ... */]);
const infraNoise = new Set(['rate_limited', 'transient_5xx']);

const sessionId = `${operatorEmail}-${Date.now()}`;

const wrapped = wrapWithFeedback('yourproduct_launch', originalHandler, {
  apiBaseUrl: 'https://yourproduct.com',
  productName: 'yourproduct',
  getAuthToken: async () => operatorJwt,
  classifier: (code, tool) => defaultClassifier(code, tool, {
    userFacingErrorCodes: userFacingErrors,
    infraNoiseErrorCodes: infraNoise,
  }),
  sessionId,
  skipToolNames: new Set(['yourproduct_feedback']), // never wrap the feedback tool itself
});

4. Implement POST /api/feedback server-side

The middleware POSTs to ${apiBaseUrl}/api/feedback with the operator JWT in the Authorization header. Your server should:

  • Validate the JWT and derive operator_email from it (NOT from the request body)
  • Validate summary + context for PII (no emails, phones, SSNs, URLs with querystrings, HTML)
  • Insert via your FeedbackStorage
  • Return { short_id: 'fb_XXXXXXXXXX' }

See AGENTS.md for the full agent contract.

Default classifier

defaultClassifier(errorCode, toolName, options) is default-suppress on unknown error codes. Only codes in userFacingErrorCodes are captured. This avoids polluting the triage queue with novel infra noise.

Per-session rate limit

The middleware caps feedback creates at 3 per session (configurable via cap option). Beyond the cap, captures are silently dropped — the original tool response is returned untouched.

Recursion guard

Pass the explicit feedback tool's name in skipToolNames to prevent the middleware from trying to record feedback about a failed feedback create.

License

UNLICENSED — internal Capital Thought tooling. Open-sourced for transparency only.