prek AGENTS.md

A set of AGENTS.md instructions for contributing to the prek codebase, including code quality, writing style, builds, tests, and GitHub work.

In plain words
What is it for?
Guiding implementation choices, comments, error handling, lint fixes, tests, builds, issues, and pull requests in the prek project.
Why use it?
It gives the coding agent project-specific rules so changes and collaboration follow the repository’s expectations.

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

Made for: Codex, OpenCode.

Per session 700 This file is loaded in full into every session.
When invoked 700 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.00700 $0.00700
Opus 5 $0.00350 $0.00350
Sonnet 5 $0.00140 $0.00140
Haiku 4.5 $0.00070 $0.00070

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

Security

Grade A, and why

prek 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 · 68 lines

How it starts

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

Code Quality

  • Write elegant, efficient, and concise code. Prefer simple, clear designs; concise does not mean clever.
  • Prefer the smallest coherent change. Reuse existing mechanisms and avoid wrappers or abstractions for speculative or unmeasured gains.
  • Prefer direct if or match control flow and explicit state types over clever combinators, wrappers, or invalid boolean/Option combinations. Prefer plain if/else to .then() or .then_some().
  • Try hard to avoid panic!, unreachable!, .unwrap(), and .expect(). Encode those constraints in the type system instead. More explicit code or a larger refactor is acceptable when it avoids these calls.
  • Do not narrate code in comments. Explain invariants and unusual decisions in plain language that makes sense to a first-time reader. Be more verbose when clarity requires it.
  • Fix Clippy findings. If suppression is necessary, prefer a narrow #[expect(...)] with a reason.

Writing Style

  • Write natural, direct English that sounds like a human collaborator, not a template or an AI-generated response.
  • Avoid canned introductions, generic filler, repetition, and unnecessary summaries.
  • Avoid dash-heavy prose, especially em dashes or - used to join thoughts. Prefer a period, comma, colon, or an explicit conjunction. For example, prefer This is safe because the fallback still validates the state. over This is safe - the fallback still validates the state.

Build and Tests

  • Linked worktrees must share the primary Cargo target. Before running cargo or a Cargo-backed mise task, set:

    export CARGO_TARGET_DIR="$(dirname "$(git rev-parse --path-format=absolute --git-common-dir)")/target"
    
  • Check existing coverage and nearby style before adding a test. Prefer focused tests; do not run the full integration suite by default.

  • In integration tests, prefer cmd_snapshot! snapshot coverage over string assertions such as contains.

  • Regenerate insta snapshots with the relevant test and review them with cargo insta review; do not edit them manually.

Read the full file on GitHub · 68 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 First seen · 68 lines · 700 tokens per session scan A 08cbcf38626e

Subscribe to this mod's changes

prek AGENTS.md is an instructions file published in the GitHub repository j178/prek (8,351 stars, last pushed today), licensed MIT. It adds 700 tokens to every session, about $0.0035 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.