afm AGENTS.md

afm AGENTS.md is an instructions file for Codex, OpenCode from akopichin/afm. It costs 22,790 tokens per session, scanned B, original, MIT.

Development instructions for AFM, a tool that runs staged workflows for AI agents. They explain how AFM stores run state, chooses the project directory, and keeps different workflow stages pointed at the same files.

In plain words
What is it for?
Use them when developing AFM commands, configuring its working directory, or debugging run state, file paths, stages, and paused-work metrics.
Why use it?
They prevent agents from reading and writing state or project files in different locations, especially when the workflow runs from Docker or another directory.

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

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

README.md
[![agentmods](https://agentmods.dev/badge/instructions/akopichin/afm/agents-md.svg)](https://agentmods.dev/instructions/akopichin/afm/agents-md)
Your own site
<a href="https://agentmods.dev/instructions/akopichin/afm/agents-md"><img src="https://agentmods.dev/badge/instructions/akopichin/afm/agents-md.svg" alt="Measured on agentmods" height="20"></a>
Per session 22,790 This file is loaded in full into every session.
When invoked 22,790 The same file — it is already loaded in full.
Security scan B 2 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.22790 $0.22790
Opus 5 $0.11395 $0.11395
Sonnet 5 $0.04558 $0.04558
Haiku 4.5 $0.02279 $0.02279

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

Security

Grade B, and why

afm AGENTS.md scanned grade B with 2 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.

Reads agent configuration directoriesmediumAgent snooping

.claude/, .codex/, .gemini/ hold keys, settings and other credentials a mod has no legitimate need for.

# codex / ~/.codex/config.toml decides

Makes network callslowCapability

Not a fault in itself. Listed so you know the mod talks to something, and to what.

Image requirements: `jq`, `curl` (both present in `Dockerfile.runtime`).
AGENTS.md · 644 lines

How it starts

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

AFM Development Guide

Working directory: .afm and --dir

By default afm stores runs, flows, and config under .afm/ in the working directory. The parent directory is resolved in PersistentPreRunE (cmd/afm/main.go) with priority flag > env > .: the --dir persistent flag, else the AFM_DIR env variable, else the current directory. All subcommands read the effective .afm path via fmDir() (filepath.Join(rootDir, ".afm")); state.FindLatestRunDir(base, flowName) takes the runs base as an explicit argument instead of hardcoding the path.

Project root for agents: flow.root_dir. afm assumes the afm-root (the parent of .afm/) == the project root. When that isn't true (e.g. Docker: sources in /workspace, .afm/ in another directory), agents — inheriting the CWD of the afm process — resolve relative project paths (docs/arch/…) against the wrong root, and stages diverge: one writes a file, another can't find it. The root_dir field in flow.yaml (flow.Flow.RootDir) sets the agents' CWD: a relative path is resolved from the afm-root in cmd/afm/run.go, then threaded through orchestrator.Options.RootDirexecutor.Config.Dircmd.Dir in executor.run. Empty → previous behavior (inherit CWD). AFM_STAGE_DIR (dialog files) stays anchored to the afm-root regardless of root_dir.

Attributing agent_action to a stage. Agent tool-action events get their stageID from the OnAction closure of the per-stage runner (runnerFor, runner_factory.go). The injected o.runner (tests, empty stageID) is used ONLY when opts.Runner != nil and the stage has no command of its own; in production every stage always gets a per-stage runner with the correct s.ID — otherwise the stage badge in the dashboard's event feed disappeared (EventFeedPanel.tsx renders the badge only when stageId is non-empty).

State persistence & run lifecycle (reliability core)

The event log .afm/runs/<run_id>/events.jsonl is the single trusted source of truth. state.json is a derived cache (it carries last_seq); read paths (afm check, run lookup) read state from the log via state.LoadRunState (no flock), not trusting the snapshot.

Read the full file on GitHub · 644 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 · 644 lines · 22,790 tokens per session scan B 13049241e054

Subscribe to this mod's changes

afm AGENTS.md is an instructions file published in the GitHub repository akopichin/afm (11 stars, last pushed 6d ago), licensed MIT. It adds 22,790 tokens to every session, about $0.1140 per session on Opus 5. A static security scan graded it B with 2 findings (reads agent configuration directories, makes network calls). No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.

Related

Other instructions, from other repositories

vscode buildNext.instructions.md

Working notes and architecture documentation for the new esbuild-based build system in build/next. Use when making changes to the new build pipeline (transpile/bundle commands, NLS plugin, source-map handling, resource copying, or self-hosting watch tasks).

microsoft/vscode · 6,785 tokens

spec-kit AGENTS.md

AGENTS.md instructions for github/spec-kit, covering agents.md, about spec kit and specify, quickstart — add a new integration in 5 steps, integration architecture and integrationmanifest — file tracking.

github/spec-kit · 7,104 tokens

codex AGENTS.md

AGENTS.md instructions for openai/codex, covering rust/codex-rs, the codex-core crate, code review rules, crate api surface and model visible context.

openai/codex · 5,182 tokens

langchain AGENTS.md

AGENTS.md instructions for langchain-ai/langchain, covering global development guidelines for the langchain monorepo, corridor security analysis, project architecture and context, monorepo structure and development tools & commands.

langchain-ai/langchain · 4,345 tokens

vscode oss-third-party-notices.instructions.md

Instructions for microsoft/vscode, covering vs code oss third-party-notices pipeline, architecture, pipeline flow in ci, applying the notice (cutover) and fallback chain (never fail the build).

microsoft/vscode · 5,001 tokens

next.js AGENTS.md

Instructions for vercel/next.js, covering next.js development guide, codebase structure, monorepo overview, core package: packages/next and other important packages.

vercel/next.js · 7,296 tokens