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

agent-harness-sdk

v0.3.3

Published

Primitives for building agent harnesses: tools, guards, checks, hooks, observability.

Readme

Wrap Claude Code in a deterministic shell.

Pre-action guards, post-action checks, and agent tools — declared in TypeScript, enforced by hooks, observable by default.

📚 Read the documentation →


What this library gives you

The three core harness primitives — guards (what it can't do), checks (what it must verify), tools (what the agent can call) — written in TypeScript and wired into Claude Code's hooks.

New to harness engineering? See Anthropic or Fowler.


Quick start

npm install -D agent-harness-sdk
npx harness init

Restart Claude Code from the project directory. You now have:

my-project/
├── harness/
│   ├── harness.config.ts        ← declarative config: which guards/checks/tools are active
│   ├── harness.lock             ← synced-content manifest (git-tracked; updated by /harness update)
│   ├── guards/                  ← PreToolUse filters
│   ├── checks/                  ← PostToolUse validators
│   └── tools/                   ← MCP tools the agent can call
├── .claude/
│   ├── settings.json            ← PreToolUse + PostToolUse + SessionStart hooks
│   ├── rules/harness.md         ← universal conventions + authoring contracts (synced)
│   └── commands/harness.md      ← /harness slash command (synced)
├── .mcp.json                    ← MCP server registration
└── .harness/                    ← gitignored audit log + evolve state

The harness starts locked — it guards its own files from the agent. To let the agent scaffold or edit harness primitives, unlock it first:

npx harness security 0

Scaffold a harness primitive — from inside Claude Code, describe what you want in plain language:

/harness add guard to block imports from internal/ outside its module
/harness add check that changed components have a test
/harness add tool to run typecheck and return the errors

The agent names it, scaffolds the typed stub via the CLI, registers it in harness.config.ts, and writes a first implementation with you — asking for specifics if your description needs them.

Audit the harness:

/harness evolve

Audits your codebase and harness side by side. Surfaces tiered suggestions: patterns worth enforcing, dead components to remove, drift to fix, and architectural smells worth a human look. Read-only — nothing scaffolds without your approval.


Three harness primitives

The harness manages three primitives directly — declared in harness.config.ts, enforced at runtime by hooks and the MCP server:

| Primitive | What it is | Where it lives | Enforced by | | --------- | ------------------------------------------------------------- | -------------------------- | ------------------------------ | | Guard | Pre-action filter — vetoes a tool call before it runs | harness/guards/<name>.ts | PreToolUse hook | | Check | Post-action validator — fails with feedback after a tool runs | harness/checks/<name>.ts | PostToolUse hook | | Tool | Deterministic MCP operation the agent calls | harness/tools/<name>.ts | MCP server (auto-instrumented) |

All registered in one place — harness/harness.config.ts:

import { defineHarness, protectEnvFiles } from "agent-harness-sdk";
import { myGuard } from "./guards/my-guard";
import { myCheck } from "./checks/my-check";
import myTool from "./tools/my-tool";

export default defineHarness({
  guards: [protectEnvFiles, myGuard],
  checks: [myCheck],
  tools: [myTool],
});

Security

The harness protects its own enforcement surface — harness/, the hook wiring, and its .env.agents unlock file — from the agent. A guard the agent can quietly delete isn't much of a guard, so new harnesses are locked by default.

When you need to work on the harness, unlock it (human-only — the agent can't change its own level):

npx harness security 0      # unlock (off)
npx harness security 1      # re-lock — the in-process guard (default)

Four levels trade convenience for strength: 0 off · 1 in-process guard (default) · 2 OS sandbox · 3 external file hardening. Levels 2–3 make the surface unwritable at the kernel level for long-running / autonomous agents (macOS or Linux).

See the Security guide for the full model — including harness security audit, a red-team check that probes whether your level is actually enforcing.


Observability

Every guard fire, check run, and tool call auto-emits a JSONL line to .harness/log.jsonl (gitignored):

{
  "ts": "2026-05-10T12:34:57Z",
  "event": "pre-tool-use.denied",
  "tool_name": "Edit",
  "file_path": ".env",
  "denied": [
    {
      "name": "protect-env-files",
      "reason": "..."
    }
  ]
}

Ask Claude "what has the harness been doing this week?" — it'll call the bundled harness_status tool to aggregate the log.

Env vars (shell or .env):

  • HARNESS_LOG_DISABLED=1 — turn off logging
  • HARNESS_LOG_PATH=/custom/path — redirect output