grain AGENTS.md

Project instructions for an AT Protocol application built with hatk, covering its folders, generated types, server code, frontend, tests, and project-specific commands.

In plain words
What is it for?
Use them when changing feeds, server handlers, frontend routes, lexicon schemas, generated types, tests, seeds, or project configuration.
Why use it?
They give a coding agent the context needed to navigate the repository and avoid editing generated files or using the wrong imports.

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

Made for: Codex, OpenCode.

Per session 2,545 This file is loaded in full into every session.
When invoked 2,545 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.02545 $0.02545
Opus 5 $0.01273 $0.01273
Sonnet 5 $0.00509 $0.00509
Haiku 4.5 $0.00254 $0.00254

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

Security

Grade A, and why

grain 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 3d 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 · 250 lines

How it starts

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

hatk project

This is an AT Protocol application built with hatk. Read the project's lexicons in lexicons/ to understand the data model. Types are generated from lexicons into hatk.generated.ts — never edit this file directly.

Project structure

Directory Purpose
lexicons/ AT Protocol lexicon schemas (JSON). Defines collections and XRPC methods
server/ All server-side code: feeds, XRPC handlers, hooks, labels, OG routes, setup scripts
app/ SvelteKit frontend (routes, components, styles)
seeds/ Test data seeding scripts for local development
test/ Test files (vitest). Run with vp test
public/ Static files served at the root

Key files

  • hatk.config.ts — project configuration (see defineConfig for type info)
  • hatk.generated.ts — auto-generated server types and helpers. Regenerate with hatk generate types
  • hatk.generated.client.ts — auto-generated client-safe types and callXrpc. Never import hatk.generated.ts from frontend code

The $hatk alias

Server files in server/ import from $hatk:

import { defineFeed, views, type Status } from "$hatk";

SvelteKit routes and components import from $hatk/client:

import { callXrpc, getViewer } from "$hatk/client";

$hatk resolves to hatk.generated.ts and $hatk/client to hatk.generated.client.ts. The Vite plugin handles this in dev/build. In tests and production, a Node.js module resolve hook handles it.

Commands

Run npx hatk --help for the full list of commands.

Use npx hatk generate to scaffold new feeds, xrpc handlers, labels, and lexicons rather than creating files manually. These generate files with the correct imports.

Read the full file on GitHub · 250 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. 3d ago First seen · 250 lines · 2,545 tokens per session scan A 352b4caa1c09

Subscribe to this mod's changes

grain AGENTS.md is an instructions file published in the GitHub repository grainsocial/grain (51 stars, last pushed 3d ago), licensed MIT. It adds 2,545 tokens to every session, about $0.0127 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.