context-budget-balance

context-budget-balance is an agent for coding agents from EndogenAI/dogma. It costs 0 tokens per session (4,408 once invoked), scanned A, original, Apache-2.0.

An analysis of how much written guidance an AI coding agent can receive before its context window becomes crowded and leaves less room for doing the task.

In plain words
What is it for?
Use it to measure instruction size, set context budgets, and decide which guidance should be loaded only when needed.
Why use it?
It helps prevent long instruction files from overwhelming the agent and reducing its ability to follow the very rules they contain.

Agent

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 agents/endogenai/dogma/context-budget-balance
Clone the repo
git clone --depth 1 https://github.com/EndogenAI/dogma

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 context-budget-balance

README.md
[![agentmods](https://agentmods.dev/badge/agents/endogenai/dogma/context-budget-balance.svg)](https://agentmods.dev/agents/endogenai/dogma/context-budget-balance)
Your own site
<a href="https://agentmods.dev/agents/endogenai/dogma/context-budget-balance"><img src="https://agentmods.dev/badge/agents/endogenai/dogma/context-budget-balance.svg" alt="Measured on agentmods" height="20"></a>
Per session 0 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 4,408 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 $0.00000 $0.04408
Opus 5 $0.00000 $0.02204
Sonnet 5 $0.00000 $0.00882
Haiku 4.5 $0.00000 $0.00441

Measured yesterday against content hash 4515fff07319, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

context-budget-balance 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 yesterday.

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.

docs/research/agents/context-budget-balance.md · 186 lines

How it starts

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

Context Window Budget — Research Synthesis

Research Question: As the endogenic documentation substrate grows, how do we prevent instruction volume from saturating the session context window — degrading principle adherence in the process — while preserving full fidelity of encoded values? Date: 2026-03-08 Related: #85 (source issue), #80 (queryable docs), #79 (skills extraction), #82 (dogma neuroplasticity), #14 (AIGNE AFS governance), #13 (episodic memory), #75 (value drift at handoffs)


1. Executive Summary

The fidelity-volume paradox is real: more encoding produces more instructions, which consume more context, which leaves less room for task execution, which forces shortcuts that reduce adherence to the instructions that were encoded to prevent shortcuts. This synthesis quantifies that paradox, identifies the degradation threshold, and ranks four intervention categories by cost/impact ratio.

Key findings:

  • The primary Executive Orchestrator instruction substrate (AGENTS.md + agent file + mode instructions + memory) totals approximately 14,375 tokens (≈57,500 characters). At a 32K effective context window this is 45% of total capacity before any task work begins — confirming the risk zone for smaller context budgets. At 200K it is 7.2%.
  • Adherence degradation follows the "lost in the middle" effect documented in the context engineering literature: as task history fills the context window, instruction content positioned at the start of prior turns receives proportionally less attention. The empirically-supported degradation threshold is when instruction content represents ≤15–20% of total in-context tokens — a condition that can arise mid-session at any context size.
  • The highest-cost/impact intervention is skill extraction (Pattern 7-adjacent): encoding decision logic in reusable SKILL.md files reduces agent body size without sacrificing governance coverage, exploits existing infrastructure, and is immediately actionable.
  • Retrieval-augmented governance (Pattern 7 from docs/research/values-encoding.md) offers the highest long-term ceiling but requires new infrastructure (BM25/vector index over docs/).

Read the full file on GitHub · 186 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. yesterday First seen · 186 lines · 0 tokens per session scan A 4515fff07319

Subscribe to this mod's changes

context-budget-balance is an agent published in the GitHub repository EndogenAI/dogma (2 stars, last pushed 11d ago), licensed Apache-2.0. It costs nothing until one of its globs matches a file; then it loads 4,408 tokens. 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-09-03.

Related

Other agents, from other repositories

dx-engineer

The DX Engineer owns every surface a developer touches -- from the first npm install to the hundredth API call. Its north star: a developer should feel competent, not confused. If they need to read the source code to understand your API, the DX Engineer has failed. If they hit an error and do not know what to do next…

nxtg-ai/forge-plugin · 0 tokens

GeminiResearcher

Multi-perspective researcher using Google Gemini with Search grounding, via LIFEOS/TOOLS/GeminiSearch.ts (NOT the gemini CLI, which cannot authenticate non-interactively here). Called BY Research skill workflows only. Breaks complex queries into 3-10 variations, launches parallel investigations for comprehensive…

danielmiessler/LifeOS · 66 tokens

agent-system

An AgentSystem composes multiple Agents into a directed graph that Orloj executes as a coordinated workflow. The graph defines how messages flow between agents during task execution.

OrlojHQ/orloj · 0 tokens

golang-code-writer

Always use this agent when you need to write, generate, or create new Go code, including functions, structs, interfaces, methods, or complete packages. Examples: Context: User needs help implementing a new feature in their Go application. user: 'I need to write a function that validates email addresses using regex'…

stacklok/toolhive-registry-server · 0 tokens

guardian

The Guardian is the last line of defense between your code and production. It runs a multi-dimensional quality gate that checks tests, type safety, security, code quality, and documentation coverage in a single pass. Unlike a CI pipeline that tells you something broke 10 minutes after you pushed, the Guardian catches…

nxtg-ai/forge-plugin · 0 tokens

compliance

The Compliance agent protects your project from legal and regulatory risk. It audits dependency licenses for compatibility (is that GPL-3.0 package going to force your MIT project open-source?), checks data handling against GDPR requirements (do you have a data inventory? can users request deletion?), verifies WCAG…

nxtg-ai/forge-plugin · 0 tokens