std-env AGENTS.md

Repository instructions for std-env, a JavaScript library that detects operating environments, runtimes, continuous-integration systems, and AI coding agents.

In plain words
What is it for?
Building, linting, type-checking, testing, and updating the library’s source code and user documentation.
Why use it?
They explain the project’s structure, maintenance rules, and checks so changes do not leave documentation, formatting, types, or tests out of date.

Instructions file for CodexOpenCode

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add instructions/unjs/std-env/agents-md
Clone the repo
git clone --depth 1 https://github.com/unjs/std-env

Made for: Codex, OpenCode.

Per session 2,188 This file is loaded in full into every session.
When invoked 2,188 The same file — it is already loaded in full.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.02188 $0.02188
Opus 5 $0.01094 $0.01094
Sonnet 5 $0.00438 $0.00438
Haiku 4.5 $0.00219 $0.00219

Measured yesterday against content hash 91048081a5a7, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

std-env AGENTS.md scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured yesterday.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

AGENTS.md · 147 lines

How it starts

The opening of the file, as written. The whole thing — 147 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Agents

Project Overview

std-env — runtime-agnostic JS utility library for detecting environments, runtimes, CI providers, and AI coding agents. Published as std-env on npm under unjs/std-env.

Maintenance

  • AGENTS.md — Keep updated with technical details, architecture, and conventions for AI agents working on this project
  • README.md — Keep updated with user-facing documentation (usage, installation, exported APIs, examples)

When adding new features or changing behavior, update both files accordingly.

After finishing any code updates, always run pnpm lint:fix then pnpm test to auto-fix lint/formatting issues and verify everything passes.

  • ESM-only ("type": "module", single .mjs output)
  • Linted with oxlint + oxfmt, typechecked with tsgo
  • Tested with vitest
  • Built with obuild

Scripts

Script Description
pnpm run build Build with obuild (dist/index.mjs, dist/index.d.mts)
pnpm run dev Start vitest in watch mode
pnpm run test Lint + typecheck + vitest with coverage
pnpm run lint Run oxlint and oxfmt
pnpm run lint:fix Auto-fix lint/format issues
pnpm run typecheck Run tsgo --noEmit

Source Structure

All source lives in src/, single entry point at src/index.ts which re-exports everything.

File Purpose
src/index.ts Barrel re-export of all modules
src/agents.ts AI coding agent detection (detectAgent, agentInfo, agent, isAgent)
src/providers.ts CI/CD provider detection (detectProvider, providerInfo, provider)
src/runtimes.ts JS runtime detection (runtime, runtimeInfo, isNode, isBun, isDeno, etc.)
src/flags.ts Environment flags (isCI, isDebug, isTest, isProduction, isDevelopment, isMinimal, platform, etc.)
src/env.ts Universal env proxy + nodeENV constant

Read the full file on GitHub · 147 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. yesterday First seen · 147 lines · 2,188 tokens per session scan A 91048081a5a7

Subscribe to this mod's changes

std-env AGENTS.md is an instructions file published in the GitHub repository unjs/std-env (641 stars, last pushed 2d ago), licensed MIT. It adds 2,188 tokens to every session, about $0.0109 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.