better-result AGENTS.md

better-result AGENTS.md is an instructions file for Codex, OpenCode from dmmulroy/better-result. It costs 1,362 tokens per session, scanned A, original, MIT.

Project instructions for `better-result`, a TypeScript library that represents either a successful value or an error. The guidance maps the codebase, naming the main source files, tests, and common places to make changes.

In plain words
What is it for?
Use it when adding Result methods or combinators, defining error types, updating tests, or working on the public API and compiled files.
Why use it?
It helps an agent find the right files and follow the project’s conventions when changing the library.

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/dmmulroy/better-result/agents-md
Clone the repo
git clone --depth 1 https://github.com/dmmulroy/better-result

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 better-result AGENTS.md

README.md
[![agentmods](https://agentmods.dev/badge/instructions/dmmulroy/better-result/agents-md.svg)](https://agentmods.dev/instructions/dmmulroy/better-result/agents-md)
Your own site
<a href="https://agentmods.dev/instructions/dmmulroy/better-result/agents-md"><img src="https://agentmods.dev/badge/instructions/dmmulroy/better-result/agents-md.svg" alt="Measured on agentmods" height="20"></a>
Per session 1,362 This file is loaded in full into every session.
When invoked 1,362 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.01362 $0.01362
Opus 5 $0.00681 $0.00681
Sonnet 5 $0.00272 $0.00272
Haiku 4.5 $0.00136 $0.00136

Measured 4d ago against content hash ce280cddcfe5, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

better-result 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 4d 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.

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 · 125 lines

How it starts

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

better-result

Generated: 2026-01-19 | Commit: fb308ef | Branch: main

OVERVIEW

Lightweight TypeScript Result type with generator-based composition. Functional error handling via Ok/Err discriminated union with yield* syntax for railway-oriented programming.

STRUCTURE

better-result/
├── src/
│   ├── index.ts         # Public API barrel export
│   ├── result.ts        # Core Result type, Ok/Err classes, combinators
│   ├── error.ts         # TaggedError base class, UnhandledException, Panic
│   ├── dual.ts          # data-first/data-last function helper
│   ├── result.test.ts   # Result tests (~1600 lines)
│   └── error.test.ts    # TaggedError tests (~250 lines)
├── skills/              # Portable SKILL.md agent skills
│   └── adopt-better-result/
├── dist/                # Compiled output (committed for npm)
└── opensrc/             # Fetched dependency source for AI context

WHERE TO LOOK

Task Location Notes
Add Result method src/result.ts Add to both Ok and Err classes
Add static combinator src/result.ts:782 Result namespace object
New error type src/error.ts Extend TaggedError, add _tag
Change exports src/index.ts Barrel file
Add tests src/*.test.ts Colocated, Vitest runner
Update agent skills skills/*/SKILL.md Keep name: matching the directory name
Add skill references skills/*/references/*.md Prefer linked references over giant skills

CODE MAP

Symbol Type Location Role
Ok<A, E> class result.ts:32 Success variant, E is phantom
Err<T, E> class result.ts:203 Error variant, T is phantom
Result<T, E> type result.ts:361 Union: Ok<T,E> | Err<T,E>
Result namespace obj result.ts:782 Static combinators
Result.gen fn result.ts:594 Generator-based composition
Result.try fn result.ts:400 Wrap sync throwing fn
Result.tryPromise fn result.ts:448 Wrap async throwing fn + retry
TaggedError fn error.ts:35 Factory for discriminated errors
UnhandledException class error.ts:186 Wrapper for uncaught exceptions
Panic class error.ts:215 Unrecoverable error (throws)
dual fn dual.ts:20 Creates pipeable functions

Read the full file on GitHub · 125 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. 4d ago First seen · 125 lines · 1,362 tokens per session scan A ce280cddcfe5

Subscribe to this mod's changes

better-result AGENTS.md is an instructions file published in the GitHub repository dmmulroy/better-result (1,948 stars, last pushed 11d ago), licensed MIT. It adds 1,362 tokens to every session, about $0.0068 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.