lean-ctx AGENTS.md

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

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

Made for: Codex, OpenCode.

Per session 2,223 This file is loaded in full into every session.
When invoked 2,223 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.02223 $0.02223
Opus 5 $0.01111 $0.01111
Sonnet 5 $0.00445 $0.00445
Haiku 4.5 $0.00222 $0.00222

Measured 3d ago against content hash 6e41fa034d2e, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, 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 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 · 201 lines

How it starts

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

Context Engineering Layer

lean-ctx optimizes LLM context by compressing file reads, shell output, and search results.

Mandatory Multi-Agent Delivery

For every substantive task in this repository, load and follow docs/internal/skills/agent-orchestration.md before taking task actions. Use a coordinated Codex CLI swarm of 2 to 15 agents for the work; do not silently fall back to a single-agent workflow. Fifteen agents is a hard concurrent maximum; choose the smallest effective swarm and give every agent a distinct role.

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-5.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. Use a mapper or reviewer alongside the implementer; for non-parallel changes, the reviewer validates the implementer's result after it is ready.
  • 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.

Direct conversational answers, status updates, and clarification questions are not substantive tasks and do not require a swarm. The user may explicitly request a different runtime or a single-agent exception.

Integration Mode: Replace

Native Read/Grep/Glob/Shell are denied by policy. lean-ctx MCP tools are the only path for reading files and running commands:

Read the full file on GitHub · 201 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 · 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,696 stars, last pushed today), licensed Apache-2.0. It adds 2,223 tokens to every session, about $0.0111 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.