ai-context

ai-context is a command for Claude Code from beerandcodeteam/beer-and-code-harness. It costs 56 tokens per session (1,903 once invoked), scanned A, original, MIT.

A command that creates or updates a set of project notes—such as AGENTS.md and CLAUDE.md—from the code and configuration that are actually implemented.

In plain words
What is it for?
Use it to create the project’s agent documentation, refresh notes after code changes, and detect which documentation has drifted.
Why use it?
It keeps guidance for coding agents aligned with the repository as it changes, without relying on outdated plans or specifications.

Command for Claude Code

Written for Claude Code: allowed-tools in frontmatter. Also seen: mentions CLAUDE.md; names the AskUserQuestion tool; positional $N argument.

Part of the bc-harness plugin — 3 commands, 6 agents, 1 hook shipped together

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 commands/beerandcodeteam/beer-and-code-harness/ai-context
Clone the repo
git clone --depth 1 https://github.com/beerandcodeteam/beer-and-code-harness

Made for: Claude Code.

Or install bc-harness, the plugin that ships this one along with the rest of its 3 commands, 6 agents, 1 hook.

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 ai-context

README.md
[![agentmods](https://agentmods.dev/badge/commands/beerandcodeteam/beer-and-code-harness/ai-context.svg)](https://agentmods.dev/commands/beerandcodeteam/beer-and-code-harness/ai-context)
Your own site
<a href="https://agentmods.dev/commands/beerandcodeteam/beer-and-code-harness/ai-context"><img src="https://agentmods.dev/badge/commands/beerandcodeteam/beer-and-code-harness/ai-context.svg" alt="Measured on agentmods" height="20"></a>
Per session 56 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 1,903 The whole file, excluding the scripts and references it only reads on demand.
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.1 $0.00056 $0.01903
Opus 5 $0.00028 $0.00951
Sonnet 5 $0.00011 $0.00381
Haiku 4.5 $0.00006 $0.00190

Measured 6d ago against content hash 540f8bb7027b, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-06, from the pricing page.

Security

Grade A, and why

ai-context 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 6d 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.

commands/ai-context.md · 138 lines

How it starts

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

ai-context

You are the router and orchestrator for the AGENTS context tree. You parse input, verify preconditions, delegate inspection and writing to agents, verify artifacts on disk, and report. You never author artifact content yourself — all template knowledge lives in the agents.

Objective

Keep the canonical AGENTS context tree in sync with the target repository's implemented code. First run creates the tree; later runs detect drift and update only the artifacts whose canonical content changed. Safe to re-run at any time.

The tree documents reality, not intent: source code, manifests, CI config, and configs are the only sources of truth. Planning artifacts (.spec/, .specs/, spec/) are invisible to this command — never read, never cited, in any step.

Canonical tree (10 artifacts)

id Path Content
AGENTS AGENTS.md 6 numbered sections: commands, conventions, behavioral rules, setup, references, docs index
CLAUDE CLAUDE.md ≤400-byte redirect to AGENTS.md
project_overview docs/agents/project_overview.md Purpose, consumers, macro flow
architecture docs/agents/architecture.md Style, layout, layer responsibilities
tech_stack docs/agents/tech_stack.md Language, framework, runtime, test tooling
coding_guidelines docs/agents/coding_guidelines.md ≥3 observed patterns + enforcement
domain_rules docs/agents/domain_rules.md Business rules as implemented
api_contracts docs/agents/api_contracts.md Endpoints, payloads, message formats
data_model docs/agents/data_model.md Entities, storage, migrations
dependencies docs/agents/dependencies.md External services, internal libs, shared infra

Input — $ARGUMENTS

$ARGUMENTS
Token Meaning
absolute path target repo root
relative path / bare name resolve against current working directory
(no path) target = current working directory
+<id> include-only mode: generate ONLY the listed ids
-<id> exclude mode: generate all except the listed ids
--adopt take ownership of pre-existing hand-written artifacts (see Ownership)

Read the full file on GitHub · 138 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. 6d ago First seen · 138 lines · 56 tokens per session scan A 540f8bb7027b

Subscribe to this mod's changes

ai-context is a command published in the GitHub repository beerandcodeteam/beer-and-code-harness (46 stars, last pushed 17d ago), licensed MIT. It adds 56 tokens to every session and 1,903 once invoked, about $0.0003 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.