pi-anthropic-auth AGENTS.md

pi-anthropic-auth AGENTS.md is an instructions file for Codex, OpenCode from gotgenes/pi-anthropic-auth. It costs 7,847 tokens per session, scanned A, original, MIT.

A project guide for pi-anthropic-auth, a small pnpm package that changes how Pi, a command-line AI client, connects to Anthropic. Its goal is to improve Claude Pro and Max sign-in compatibility while preserving normal API-key use.

In plain words
What is it for?
Use it to understand the package layout, its OAuth and API-key compatibility goal, and where reusable workflows, prompts, and subagents belong.
Why use it?
It explains the package's narrow purpose and constraints, helping contributors avoid replacing more of Pi's built-in Anthropic behavior than necessary.

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/gotgenes/pi-anthropic-auth/agents-md
Clone the repo
git clone --depth 1 https://github.com/gotgenes/pi-anthropic-auth

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 pi-anthropic-auth AGENTS.md

README.md
[![agentmods](https://agentmods.dev/badge/instructions/gotgenes/pi-anthropic-auth/agents-md.svg)](https://agentmods.dev/instructions/gotgenes/pi-anthropic-auth/agents-md)
Your own site
<a href="https://agentmods.dev/instructions/gotgenes/pi-anthropic-auth/agents-md"><img src="https://agentmods.dev/badge/instructions/gotgenes/pi-anthropic-auth/agents-md.svg" alt="Measured on agentmods" height="20"></a>
Per session 7,847 This file is loaded in full into every session.
When invoked 7,847 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.07847 $0.07847
Opus 5 $0.03923 $0.03923
Sonnet 5 $0.01569 $0.01569
Haiku 4.5 $0.00785 $0.00785

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

Security

Grade A, and why

pi-anthropic-auth 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 today.

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

How it starts

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

AGENTS Guide: pi-anthropic-auth

This file contains shared context for agents working in this repository. Keep it focused on information that multiple agents need: repository purpose, current architecture, constraints, commands, and known gotchas. Do not turn this into a task log.

Project-level reusable workflows belong in .pi/skills/, reusable slash-command flows in .pi/prompts/, and custom subagents in .pi/agents/. This repo includes repo-specific skills (Anthropic OAuth debugging, Pi CLI repro, frontmatter) plus a shared workflow toolkit (code design, testing, fallow, improvement discovery, pre-completion, and others) kept in parity with ~/development/pi/pi-packages/.

Project

Overview

pi-anthropic-auth is a small pnpm-based Pi package. Its purpose is to minimally override Pi's built-in anthropic provider to improve Claude Pro/Max OAuth compatibility without breaking Pi's normal Anthropic API-key behavior.

The design intent is explicitly minimal. Prefer wrapping or extending Pi's existing Anthropic behavior over replacing it wholesale.

Primary Goal

Preserve all of Pi's normal Anthropic UX while adding only the compatibility layers Pi still appears to be missing for Claude Pro/Max OAuth.

That means preserving:

  1. Built-in provider name: anthropic
  2. Built-in model list
  3. Normal Anthropic API-key behavior
  4. Native /login anthropic UX

Current Status

The current implementation does the following:

  1. Re-registers the built-in anthropic provider with a thin streamSimple transport wrapper (login and refresh are delegated to Pi's built-in anthropicOAuth)
  2. Wraps Pi's built-in Anthropic transport to shape OAuth requests on every call path that reaches provider-composer (main loop and compaction; not agentLoop background agents — see Issue #46)
  3. Prepends an Anthropic billing/content-consistency header block to system[]
  4. Sanitizes Pi's default preamble by anchor during the same shaping pass — removing the Pi identity, custom-tool filler, and Pi documentation paragraphs and replacing only the identity with a minimal neutral prompt — while preserving tool snippets, guidelines, and appended extension content
  5. Gates all shaping on the sk-ant-oat OAuth access-token prefix, so API-key and non-Anthropic requests pass through untouched

Read the full file on GitHub · 554 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. today Changed · +62 lines · +1,313 tokens per session 3c0ac52e4f94
  2. 5d ago First seen · 492 lines · 6,534 tokens per session scan A 9214bd533bcb

Subscribe to this mod's changes

pi-anthropic-auth AGENTS.md is an instructions file published in the GitHub repository gotgenes/pi-anthropic-auth (232 stars, last pushed today), licensed MIT. It adds 7,847 tokens to every session, about $0.0392 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.