lean-ctx: Instructions file for Codex

AGENTS.md

lean-ctx AGENTS.md is an instructions file for Codex, OpenCode from yvgude/lean-ctx. It costs 5,516 tokens per session, scanned A, original, Apache-2.0.

Repository instructions for lean-ctx, a tool that reduces the amount of project information an AI agent needs to process. They also define how multiple agents should coordinate while working on a task.

In plain words
What is it for?
Coordinating multi-agent coding tasks, assigning separate roles, using lean-ctx to manage context, and following the repository's required command and integration workflow.
Why use it?
They give agents shared rules for reading context, dividing work, and combining results. This helps prevent duplicated work and inconsistent changes in larger repositories.

Instructions file for CodexOpenCode

Written for Codex and OpenCode: the file is AGENTS.md. Also seen: reads .claude/ paths; mentions subagents; mentions Claude Code.

This is yvgude/lean-ctx's own configuration. It tells Codex and OpenCode how to work on lean-ctx itself, so it is not a mod to install elsewhere. Copy it as a starting point and replace the rules that are about this project. Everything lean-ctx configures →

About the project

LeanCTX is a local Rust program that controls the repository context an AI coding agent receives, including selecting, compressing, remembering, and tracking information. Developers use it alongside coding agents to reduce repeated context and manage what those agents read and execute, while the catalogue entries provide related rules, skills, and instructions.

yvgude/lean-ctx · 3,931 stars · on GitHub · leanctx.com

Reuse

Borrowing it

Nothing to install: this file belongs to yvgude/lean-ctx. Take a copy, put it at the same path in your own repository, and replace the rules that are about this project with yours.

Copy the file
curl -O https://raw.githubusercontent.com/yvgude/lean-ctx/main/AGENTS.md
Clone the repo
git clone --depth 1 https://github.com/yvgude/lean-ctx

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 lean-ctx AGENTS.md

README.md
[![agentmods](https://agentmods.dev/badge/instructions/yvgude/lean-ctx/agents-md/github.svg)](https://agentmods.dev/instructions/yvgude/lean-ctx/agents-md)
Your own site
<a href="https://agentmods.dev/instructions/yvgude/lean-ctx/agents-md"><img src="https://agentmods.dev/badge/instructions/yvgude/lean-ctx/agents-md/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for lean-ctx AGENTS.md

Your own site · 80×15
<a href="https://agentmods.dev/instructions/yvgude/lean-ctx/agents-md"><img src="https://agentmods.dev/badge/instructions/yvgude/lean-ctx/agents-md.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 5,516 This file is loaded in full into every session.
When invoked 5,516 The same file — it is already loaded in full.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
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.05516 $0.05516
Opus 5.5 $0.02206 $0.02206
Sonnet 5.5 $0.01103 $0.01103
Haiku 4.5 $0.00552 $0.00552

Measured 2d ago against content hash dbd3682d90d0, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade A, and why

lean-ctx 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 · 394 lines

How it starts

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

LeanCTX — Context Gateway for AI Systems

LeanCTX | OSS selects context, applies supported access and content controls, and records observable context operations; compression is one capability within that path.

Shared Context Gateway delivery skill

For LeanCTX implementation, integration, release, or repository migration, load skills/leanctx-gateway-delivery/SKILL.md. Codex and Claude discover the same canonical content through the .agents/skills/leanctx-gateway-delivery and .claude/skills/leanctx-gateway-delivery links.

Mandatory Routing Decision (Direct or Swarm)

For every substantive task in this repository, load and follow docs/internal/skills/agent-orchestration.md before taking task actions. The routing decision is mandatory; a swarm is not. The lead uses 0 to 15 workers (0 = direct execution) and picks the path with the shortest accepted-result time that keeps the full quality bar — the routing gate in the skill defines how. Fifteen agents is a hard concurrent maximum; every worker gets a distinct role. Security, redaction, public contracts/schemas, migrations, releases, and data-loss risk normally get an independent reviewer.

This rule is owned by the orchestration lead. Agents with a concrete delegated subtask are swarm workers: they coordinate through lean-ctx and complete their assigned role, but do not recursively launch another swarm unless the lead explicitly asks them to do so.

  • Runtime: every Codex CLI agent MUST use --model gpt-6-luna and -c 'model_reasoning_effort="max"'.
  • LeanCTX coordination: every agent registers on the lean-ctx agent bus, checks directives, and uses lean-ctx context tools; the lead records the integrated decision and progress through lean-ctx.
  • Topology: assign independent, non-duplicative roles. When a reviewer is used on a non-parallel change, it validates the implementer's result after it is ready — including whether each new test earns its place (see Test Policy).
  • Safe ownership: only one agent may edit a given file or shared worktree at a time. Parallel agents investigate, test, or review in isolation unless explicit file ownership or separate worktrees are assigned.
  • Completion: the lead integrates the findings, runs the relevant quality gates, and reports the agents' evidence. A task is not complete merely because an agent returned successfully.

Read the full file on GitHub · 394 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 Changed · +32 lines · +577 tokens per session dbd3682d90d0
  2. 4d ago Changed · +51 lines · +788 tokens per session bad557b1c0b3
  3. 5d ago Changed · +48 lines · +726 tokens per session 873fb5463d8a
  4. 6d ago Changed · -12 lines · -67 tokens per session 8a5f124f8f8f
  5. 7d ago Changed · +25 lines · +558 tokens per session 0d17eaa5b1e6
  6. 20d ago Changed · +9 lines · +119 tokens per session a16f72eb5e61
  7. 1mo ago Changed · +11 tokens per session 764d93d73e99
  8. 1mo ago Changed · +40 lines · +581 tokens per session 7a310224d507
  9. 2mo ago First seen · 201 lines · 2,223 tokens per session scan A 6e41fa034d2e

Subscribe to this mod's changes

lean-ctx AGENTS.md is an instructions file published in the GitHub repository yvgude/lean-ctx (3,931 stars, last pushed yesterday), licensed Apache-2.0. It adds 5,516 tokens to every session, about $0.0221 per session on Opus 5.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.

Related

lean-ctx AGENTS.md compared with instructions from other repositories

lean-ctx AGENTS.md next to 6 instructions from other repositories
ModTypeStarsLast pushLicenceScanTokensWorks with
lean-ctx AGENTS.mdyvgude/lean-ctxInstructions file3.9kyesterdayApache-2.0A5,516Codex, OpenCode
vscode buildNext.instructions.mdmicrosoft/vscodeInstructions file195ktodayMITA9,719GitHub Copilot
next.js AGENTS.mdvercel/next.jsInstructions file143ktodayMITA7,461Codex, OpenCode
vscode oss-third-party-notices.instructions.mdmicrosoft/vscodeInstructions file195ktodayMITA5,516GitHub Copilot
langchain AGENTS.mdlangchain-ai/langchainInstructions file149ktodayMITA4,680Codex, OpenCode
vscode copilot-instructions.mdmicrosoft/vscodeInstructions file195ktodayMITA3,093GitHub Copilot
deepseek-harness AGENTS.mddeepseek-ai/deepseek-harnessInstructions file274k2d agoMITA4,313Codex, OpenCode