gogh AGENTS.md

Instructions for using gogh, a Go library that generates Go source files from programmatically written lines.

In plain words
What is it for?
Use it when building Go code generators, such as go generate tools, protocol-buffer plugins, or schema-to-Go generators.
Why use it?
It handles repetitive generator tasks such as imports, package names, formatting, and placing generated files in a Go module.

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

Made for: Codex, OpenCode.

Per session 6,606 This file is loaded in full into every session.
When invoked 6,606 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.06606 $0.06606
Opus 5 $0.03303 $0.03303
Sonnet 5 $0.01321 $0.01321
Haiku 4.5 $0.00661 $0.00661

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

Security

Grade A, and why

gogh 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 2d 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 · 455 lines

How it starts

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

gogh — LLM usage context

Reference for an LLM that needs to write or modify Go code that uses the gogh library to generate Go source. Module: github.com/sirkon/gogh · Go 1.26+ · Root package is gogh (all public API lives there).

What gogh is

gogh is a Go source rendering library. You build Go files programmatically by writing formatted lines through a renderer; gogh takes care of the parts that are tedious and error-prone in hand-written generators:

  • collecting and emitting the import block,
  • resolving package qualifier names and alias collisions automatically,
  • running gofmt (or fancyfmt) on the result,
  • writing the files into the correct location inside the current Go module.

Use it when writing go generate tools, protoc plugins, schema-to-Go generators, etc. The model is "write lines that look like Go, with $placeholders for imported-package qualifiers and positional args".


Mental model (read this first)

  1. Module[T] — one generation session, tied to the Go module on disk (discovered via go env / go mod edit). You create it once with gogh.New(...). Render() at the end flushes all files to disk. Must run inside a module directory; shells out to the go toolchain and uses a boltDB cache for package-name lookups. That cache is self-invalidating: versioned deps are keyed by (package path, declared version) from go.mod so a bump invalidates exactly the affected entry; replaced/workspaced/local packages are read straight from disk (cheap, always fresh, never bolt-cached); stdlib/undeclared-transitive are cached by package path. A per-module in-memory cache ensures each name is resolved at most once per Module.
  2. Package[T] — a Go package within the module. Get one from the module (Root, Current, Package, PackageName). Each package produces one or more file renderers.
  3. GoRenderer[T] — the writing surface for one Go file. You write lines into it; it owns that file's imports and rendering context.
  4. RawRenderer — like GoRenderer but for plain-text files (no package header, no imports). Same line API.
  5. Importer / Imports — import management. Add(pkgpath).Ref("name") registers an import and binds its qualifier into the rendering context so $name expands to the (possibly aliased) package name.
  6. Rendering context / scope — a hierarchical map of named values per renderer. Populated by Ref, Let, Uniq, UniqBind, and the function helpers (Returns sets ReturnZeroValues). Exposed in format strings as $name; positional args are $0, $1, …

Read the full file on GitHub · 455 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. 2d ago First seen · 455 lines · 6,606 tokens per session scan A 4869e4fa53d8

Subscribe to this mod's changes

gogh AGENTS.md is an instructions file published in the GitHub repository sirkon/gogh (2 stars, last pushed 6d ago), licensed MIT. It adds 6,606 tokens to every session, about $0.0330 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-31.