zigpty: Instructions file for Codex

AGENTS.md

zigpty AGENTS.md is an instructions file for Codex, OpenCode from pithings/zigpty. It costs 7,359 tokens per session, scanned A, original, MIT.

A guide to zigpty, a Zig library for creating and controlling pseudo-terminals, plus a Node.js add-on that exposes the library to JavaScript.

In plain words
What is it for?
Use it when building zigpty, changing Unix or Windows terminal handling, updating its Node.js interface, or packaging the Zig module and native libraries.
Why use it?
It explains how the pure Zig core and the Node.js bridge are separated across platforms. This helps developers change terminal-process behavior without mixing platform code or adding unnecessary dependencies.

Instructions file for CodexOpenCode

Written for Codex and OpenCode: the file is AGENTS.md.

This is pithings/zigpty's own configuration. It tells Codex and OpenCode how to work on zigpty itself, so it is not a mod to install elsewhere. Copy it as a starting point and replace the rules that are about this project. Everything zigpty configures →

Reuse

Borrowing it

Nothing to install: this file belongs to pithings/zigpty. Take a copy, put it at the same path in your own repository, and replace the rules that are about this project with yours.

Copy the file
curl -O https://raw.githubusercontent.com/pithings/zigpty/main/AGENTS.md
Clone the repo
git clone --depth 1 https://github.com/pithings/zigpty

Made for: Codex, OpenCode.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for zigpty AGENTS.md

README.md
[![agentmods](https://agentmods.dev/badge/instructions/pithings/zigpty/agents-md/github.svg)](https://agentmods.dev/instructions/pithings/zigpty/agents-md)
Your own site
<a href="https://agentmods.dev/instructions/pithings/zigpty/agents-md"><img src="https://agentmods.dev/badge/instructions/pithings/zigpty/agents-md/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for zigpty AGENTS.md

Your own site · 80×15
<a href="https://agentmods.dev/instructions/pithings/zigpty/agents-md"><img src="https://agentmods.dev/badge/instructions/pithings/zigpty/agents-md.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 7,359 This file is loaded in full into every session.
When invoked 7,359 The same file — it is already loaded in full.
Security scan A 1 finding. A grade says what 26 rules found in the file — not that it is safe.
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.1 $0.07359 $0.07359
Opus 5.5 $0.02944 $0.02944
Sonnet 5.5 $0.01472 $0.01472
Haiku 4.5 $0.00736 $0.00736

Measured 2mo ago against content hash 35b37a90cd88, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade A, and why

zigpty AGENTS.md scanned grade A with 1 finding 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 2mo ago.

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.

Runs shell commandslowCapability

Expected in a hook, worth knowing in a rule or an instructions file.

└── PipePty (src/pty/pipe.ts) — pure-TS fallback (child_process pipes)
AGENTS.md · 345 lines

How it starts

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

zigpty

Zig-based PTY library. Dual-use: standalone Zig package and Node.js NAPI addon.

Goals

  • Smallest build (19KB ReleaseSmall vs node-pty's ~500KB+ with C++ runtime)
  • Pure Zig PTY library with no NAPI dependency (lib.zig)
  • Thin NAPI wrapper layer for Node.js (pty.zig + pty_unix.zig + win/napi.zig + root.zig)
  • Raw NAPI — no third-party Zig NAPI bindings, no node-gyp
  • Cross-platform (Linux + macOS + Windows)
  • Statically linked via Zig

Architecture

zigpty/
├── build.zig               # Zig build: exposes "zigpty" module + NAPI shared libs
├── build.zig.zon           # Zig package metadata (min Zig 0.16.0)
├── build.config.ts         # obuild config (bundle src/ → dist/)
├── zig/                    # Zig sources (two layers)
│   ├── lib.zig             # Pure Zig PTY library — platform dispatcher + shared code
│   ├── root.zig            # NAPI module entry: exports platform-specific functions
│   ├── napi.zig            # Raw NAPI bindings (~240 lines, extern declarations)
│   ├── pty.zig             # NAPI shared helpers + platform dispatch (re-exports)
│   ├── pty_unix.zig        # NAPI↔lib.zig bridge for Unix (fork, open, resize, process)
│   ├── termios.zig         # Default terminal config (Linux + macOS)
│   ├── pty_linux.zig       # Linux-specific: execvpe, ptsname_r, /proc, close_range
│   ├── pty_darwin.zig      # macOS-specific: execvp+environ, sysctl, FD close loop
│   ├── pty_windows.zig     # Windows-specific: ConPTY (CreatePseudoConsole + pipes)
│   ├── errno_shim.c        # Android errno compat (__errno_location → __errno)
│   └── win/
│       ├── napi.zig        # NAPI↔lib.zig bridge for Windows (spawn, write, resize, kill, close)
│       └── node_api.def    # NAPI import definitions (→ .lib via zig dlltool)
├── src/                    # TypeScript wrapper + tests
│   ├── index.ts            # Public API: spawn(), open() — platform dispatch
│   ├── napi.ts             # Native module loader (platform-aware, INativeUnix/INativeWindows)
│   ├── terminal.ts         # Terminal class (Bun-compatible) + TerminalOptions type
│   ├── pty/                # PTY class hierarchy
│   │   ├── _base.ts        # BasePty abstract class — shared state, events, waitFor, buildEnvPairs
│   │   ├── types.ts        # IPty, IPtyOptions, IDisposable, IEvent interfaces
│   │   ├── unix.ts         # UnixPty: tty.ReadStream + async fs.write
│   │   ├── windows.ts      # WindowsPty: native callbacks + deferred init
│   │   └── pipe.ts         # PipePty: pure-TS fallback when native bindings unavailable
│   ├── spawn.test.ts       # E2E tests (platform-conditional)
│   ├── pipe.test.ts        # PipePty fallback tests
│   └── terminal.test.ts    # Terminal class tests
├── dist/                   # Built output (obuild → .mjs + .d.mts)
├── prebuilds/              # Zig build output (8 binaries, see below)
├── scripts/
│   └── cross-platform.sh   # Docker-based cross-platform smoke tests
└── .github/workflows/
    └── ci.yml              # PR/push: build + test (Linux, macOS, Windows)

Read the full file on GitHub · 345 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. 2mo ago First seen · 345 lines · 7,359 tokens per session scan A 35b37a90cd88

Subscribe to this mod's changes

zigpty AGENTS.md is an instructions file published in the GitHub repository pithings/zigpty (127 stars, last pushed 4mo ago), licensed MIT. It adds 7,359 tokens to every session, about $0.0294 per session on Opus 5.5. A static security scan graded it A with 1 finding (runs shell commands). No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.

Related

zigpty AGENTS.md compared with instructions from other repositories

zigpty AGENTS.md next to 6 instructions from other repositories
ModTypeStarsLast pushLicenceScanTokensWorks with
zigpty AGENTS.mdpithings/zigptyInstructions file1274mo agoMITA7,359Codex, OpenCode
vscode buildNext.instructions.mdmicrosoft/vscodeInstructions file195ktodayMITA9,719GitHub Copilot
vscode oss-third-party-notices.instructions.mdmicrosoft/vscodeInstructions file195ktodayMITA5,516GitHub Copilot
next.js AGENTS.mdvercel/next.jsInstructions file143kyesterdayMITA7,461Codex, OpenCode
langchain AGENTS.mdlangchain-ai/langchainInstructions file149ktodayMITA4,680Codex, OpenCode
vscode copilot-instructions.mdmicrosoft/vscodeInstructions file195ktodayMITA3,093GitHub Copilot
vscode model-prompts.instructions.mdmicrosoft/vscodeInstructions file195ktodayMITA2,022GitHub Copilot