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

who-behind-me

v0.0.1

Published

Detect whether your code is being run by an AI agent or a human.

Readme

who-behind-me

Detect whether your code is being run by an AI agent or a human.

This library analyzes the runtime environment to determine if the current process was launched by an AI coding agent (like Claude Code, GitHub Copilot, or Codex) rather than a human sitting at a terminal.

How it works

The library runs a set of rules against the current platform (Node.js or Deno), each returning a [isAgentSignal, confidence, description?] tuple. Each result is assigned a numeric weight, and the weighted scores are summed. If the total exceeds a threshold, the process is classified as agent-driven.

Detection Rules

| Rule | What it checks | | ------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | Environment variables | Scans for agent-specific env vars (e.g., CLAUDECODE, CODEX_THREAD_ID, COPILOT_AGENT, AI_AGENT, OMPCODE, __PI_NATIVE_VARIANT_CACHE) and analyzes TERM settings | | Stdio pipes | Checks whether stdin/stdout/stderr are connected to a TTY (interactive terminal) or piped, and whether stdin has buffered data |

Confidence levels

  • confident — Strong signal (e.g., a known AI agent env var is set)
  • maybe — Suggestive but not definitive (e.g., non-TTY stdout)
  • unknown — Inconclusive (e.g., TTY stdout — can be spoofed)

Installation

npm install who-behind-me
# or
pnpm add who-behind-me
# or
bun add who-behind-me

Usage

import { check } from "who-behind-me";

const result = check();
console.log(result.isAgent); // true | false
console.log(result.score); // weighted sum
console.log(result.detail); // individual rule results

Custom weights

You can override the default scoring weights to tune sensitivity:

import { check } from "who-behind-me";

const result = check({
    truthy: { confident: 20, maybe: 0.5, unknown: 0 },
    falsy: { confident: -20, maybe: -0.5, unknown: 0 },
});

Default scoring

| Result | confident | maybe | unknown | | ---------------------- | --------- | ----- | ------- | | true (agent signal) | +10 | +0.1 | 0 | | false (human signal) | -10 | -0.1 | 0 |

Threshold: 0.5 — scores above this classify as agent.

API

check(weight?, opts?)

  • weight — Optional custom WeightConfig to override detection sensitivity
  • opts — Optional platform-specific options (e.g., { checkType: "active" } for Deno permission mode)
  • Returns { isAgent: boolean, detail: RuleEntity[], score: number }

Supported Platforms

  • Node.js >= 24
  • Deno (with environment permission handling)

License

MIT