snag: Instructions file for Codex

AGENTS.md

snag AGENTS.md is an instructions file for Codex, OpenCode from p3bot/snag. It costs 5,114 tokens per session, scanned A, original, MPL-2.0.

A project guide for AI coding agents working on snag, a command-line tool that fetches web pages through Chrome or Chromium. It describes setup, the project structure, supported browser modes, output formats, URL handling, tab selection, and installation of the agent skill.

In plain words
What is it for?
Use it when setting up or changing snag, fetching pages from URLs or existing browser tabs, handling authenticated sessions, or choosing Markdown, HTML, text, PDF, or PNG output.
Why use it?
It gives agents the project context and expected commands so they can work with browser sessions and web-page output correctly.

Instructions file for CodexOpenCode

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

This is p3bot/snag's own configuration. It tells Codex and OpenCode how to work on snag 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 snag configures →

View source ↗ p3bot/snag
Reuse

Borrowing it

Nothing to install: this file belongs to p3bot/snag. 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/p3bot/snag/main/AGENTS.md
Clone the repo
git clone --depth 1 https://github.com/p3bot/snag

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 snag AGENTS.md

README.md
[![agentmods](https://agentmods.dev/badge/instructions/p3bot/snag/agents-md/github.svg)](https://agentmods.dev/instructions/p3bot/snag/agents-md)
Your own site
<a href="https://agentmods.dev/instructions/p3bot/snag/agents-md"><img src="https://agentmods.dev/badge/instructions/p3bot/snag/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 snag AGENTS.md

Your own site · 80×15
<a href="https://agentmods.dev/instructions/p3bot/snag/agents-md"><img src="https://agentmods.dev/badge/instructions/p3bot/snag/agents-md.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 5,114 This file is loaded in full into every session.
When invoked 5,114 The same file — it is already loaded in full.
Security scan A 0 findings. 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.05114 $0.05114
Opus 5.5 $0.02046 $0.02046
Sonnet 5.5 $0.01023 $0.01023
Haiku 4.5 $0.00511 $0.00511

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

Security

Grade A, and why

snag 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 1mo 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 · 524 lines

How it starts

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

AGENTS.md

A README for AI coding agents - This document provides context and instructions for AI coding agents working on snag. For human contributors, see README.md.

Project Overview

snag is a CLI tool that intelligently fetches web page content using Chrome/Chromium via the Chrome DevTools Protocol (CDP). Built for AI agents to consume web content efficiently.

Key Features:

  • Auto-detect and connect to existing Chrome instances
  • Launch headless or visible browser modes
  • Handle authenticated sessions gracefully
  • Multiple output formats: Markdown (default), HTML, Text, PDF, PNG
  • Multiple URL support: Process multiple URLs in a single command
  • Tab management: List, select, and fetch from existing browser tabs
  • Pattern matching: Select tabs by index, exact URL, substring, or regex
  • Output directory support: Auto-generate filenames with timestamps
  • Single binary distribution, no extra runtime binaries or config files
  • Embedded agent skill (snag --skill) with user-initiated install via agentdex (catalog may use the network on first resolve; fail-closed; snag --skill never does)

Technology Stack:

  • Language: Go 1.25.3
  • CLI Framework: github.com/spf13/cobra v1.10.2
  • Browser Control: github.com/go-rod/rod v0.116.2 (Chrome DevTools Protocol)
  • HTML to Markdown: github.com/JohannesKaufmann/html-to-markdown/v2 v2.5.2
  • HTML to Text: github.com/k3a/html2text v1.4.0
  • Agent skills: github.com/p3bot/agentdex v1.1.0 (path authority for --skill-install / --skill-list / --skill-uninstall)
  • YAML: go.yaml.in/yaml/v3 v3.0.4 (skill frontmatter name)

Setup Commands

# Clone repository
git clone https://github.com/p3bot/snag.git
cd snag

# Install dependencies
go mod download

# Install
go install github.com/p3bot/snag/cmd/snag@latest

# Build binary
go build -o snag ./cmd/snag

# Run snag
./snag --version
./snag --help
./snag --skill

Build and Test Commands

# Build for current platform
go build -o snag ./cmd/snag

# Build with version info
go build -ldflags "-X github.com/p3bot/snag/internal/cli.Version=1.0.0" -o snag ./cmd/snag

# Run all tests (integration tests with real browser)
go test -v ./...

# Run specific test
go test -v ./... -run TestFetchPage

# Run with coverage
go test -v -cover ./...

# Test basic content fetching
snag https://example.com                # Fetch page as Markdown
snag --format html https://example.com  # Fetch as HTML
snag --format text https://example.com  # Fetch as plain text
snag --format pdf https://example.com   # Save as PDF (auto-generates filename)
snag --format png https://example.com   # Save as PNG screenshot (auto-generates filename)
snag -o output.md https://example.com   # Save to file

# Test multiple URL fetching
snag https://example.com https://google.com               # Fetch multiple URLs
snag -d output/ https://example.com https://google.com    # Save multiple with auto-generated names
snag -o combined.md https://example.com https://google.com # Combine into single file

# Test tab management features (Phase 2)
snag --open-browser                     # Open persistent browser (with DevTools enabled)
snag --list-tabs                        # List all open tabs
snag https://example.com                # Fetch URL (creates new tab)
snag --list-tabs                        # List tabs again (should show example.com)

# Tab selection by index (1-based)
snag --tab 1                            # Fetch from first tab
snag -t 2                               # Fetch from second tab (short form)

# Tab selection by pattern
snag -t "example.com"                   # Exact URL match (case-insensitive)
snag -t "example"                       # Substring/contains match
snag -t "https://.*\.com"               # Regex pattern match

# Tab features with output options
snag -t 1 --format html                 # Fetch tab 1 as HTML
snag -t "github" -o repo.md             # Fetch tab matching "github", save to file
snag -t 1 --wait-for ".content"         # Wait for selector in existing tab

# Cross-platform builds
GOOS=darwin GOARCH=arm64 go build -o snag-darwin-arm64 ./cmd/snag
GOOS=darwin GOARCH=amd64 go build -o snag-darwin-amd64 ./cmd/snag
GOOS=linux GOARCH=amd64 go build -o snag-linux-amd64 ./cmd/snag
GOOS=linux GOARCH=arm64 go build -o snag-linux-arm64 ./cmd/snag

# Code quality checks
go vet ./...
gofmt -l .

# Clean build artifacts
rm -f snag snag-*

Read the full file on GitHub · 524 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. 1mo ago Changed · +1 lines · +51 tokens per session 0ce1effb3fc7
  2. 1mo ago Changed · +4 lines · +221 tokens per session 529e8cd88e45
  3. 2mo ago Changed · +17 tokens per session 55579c22a46f
  4. 2mo ago Changed · +5 lines · +102 tokens per session e29b9a248ee4
  5. 2mo ago First seen · 514 lines · 4,723 tokens per session scan A 8291a34b392d

Subscribe to this mod's changes

snag AGENTS.md is an instructions file published in the GitHub repository p3bot/snag (75 stars, last pushed 1mo ago), licensed MPL-2.0. It adds 5,114 tokens to every session, about $0.0205 per session on Opus 5.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.

Related

snag AGENTS.md compared with instructions from other repositories

snag AGENTS.md next to 6 instructions from other repositories
ModTypeStarsLast pushLicenceScanTokensWorks with
snag AGENTS.mdp3bot/snagInstructions file751mo agoMPL-2.0A5,114Codex, 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