Read Your Own AGENTS.md Whole; Bound Foreign Context
Read Your Own AGENTS.md Whole; Bound Foreign Context An agent runtime has two conflicting duties when it loads project instructions: preserve the rules that govern its own work, and keep an arbitrary external file from consuming the entire prompt. Treating both files the same creates a bad trade-off. A small universal limit can silently remove a project’s own critical rules; no limit lets any…
An agent runtime has two competing responsibilities when it loads project instructions: respecting the rules governing its own work and preventing an external file from dominating the entire prompt. Treating both files equally creates an unfavorable trade-off. A modest universal limit can unintentionally truncate a project's critical rules, while an absence of limit allows any referenced repository to dominate the context window.
APX resolves this issue by distinguishing between the portable context layer (AGENTS.md and .apc/ files) that carries project-owned guidance and the runtime layer that assembles this guidance into a live prompt, along with runtime state that remains local. The fundamental rule is straightforward: APX reads the AGENTS.md file in its entirety for the project it is currently running inside.
However, the file from a foreign project receives a configurable budget. The root cause of why a single cap fails is illustrated by a project's AGENTS.md file starting with code conventions and ending with a release safety rule: "Never publish before the integration suite passes." A fixed cap could preserve the first section but cut the last one.
Consequently, the agent would receive a partial contract while believing it had received the complete project guidance, which is worse than a visible absence. It would follow some rules while violating others it never encountered. In practice, APX does not cap the project residing in the runtime's working directory. The project's own contract reaches the prompt intact.
This decision is not an endorsement of unlimited instructions everywhere; rather, it is an ownership choice. The repository running the agent owns its contract and should be capable of reviewing its full impact. Foreign context demands a different policy. APX can receive a project path that is not its own working project. This file might serve as valuable context, but it is not safe to assume its size is suitable for the current turn.
Therefore, APX applies a default foreign-contract budget of 24,000 characters. When it must shorten a file, it ensures the cut occurs at a line boundary instead of breaking a rule mid-sentence and explicitly states the result is truncated, including how much was omitted. The prompt then instructs the agent to read the file directly before relying on rules not displayed.
This maintains the important principle that partial context is inherently incomplete. The foreign cap is also configurable via super_agent.project_agents_max_chars. A positive value adjusts the budget; 0 disables it. This makes prompt size a deliberate local runtime choice, not an unnoticed alteration to APC's portable contract.
Maintaining clear boundaries addresses a common design question: should a project compress its own instructions to fit a runtime? In certain cases, yes, but this should be a project authoring decision made within the repository and reviewed like any other modification. It should not be an invisible runtime truncation. Similarly, a runtime may need to restrict foreign context for cost and reliability.
This safeguard should reside within APX, where prompt assembly occurs, rather than redefining what APC files represent or what a project is permitted to document. A practical test: when an agent operates within your repository, can you demonstrate exactly which project rules reached it? If the answer is "only the first part, silently," the boundary is incorrect.
To summarize, read the owning contract in its entirety; bound foreign context visibly. APX maintains the contract's portability. APX implements it in a live runtime without asserting that every source of context shares the same ownership or budget.
Written by urgent.news from Dev.to's reporting — not their text. Machine-written — may contain errors; check the original before relying on it.