Skip to content

Make _INIT_AGENTS_MD_BUDGET configurable via cli argument and config - #32

Open
fboudra wants to merge 1 commit into
Swival:masterfrom
fboudra:agents-md-budget
Open

Make _INIT_AGENTS_MD_BUDGET configurable via cli argument and config#32
fboudra wants to merge 1 commit into
Swival:masterfrom
fboudra:agents-md-budget

Conversation

@fboudra

@fboudra fboudra commented Jul 26, 2026

Copy link
Copy Markdown

Convert the hardcoded 3000 characters AGENTS.md budget into a runtime value. The --agents-md-budget cli argument and agents_md_budget (config.toml) both override the default. INIT_WRITE_PROMPT became init_write_prompt(budget) so /init and /remember respect the setting. For backward compatibility, INIT_WRITE_PROMPT constant still exists and InputContext defaults to 3000.

Convert the hardcoded 3000 characters AGENTS.md budget into a runtime value.
The --agents-md-budget cli argument and agents_md_budget (config.toml) both
override the default. INIT_WRITE_PROMPT became init_write_prompt(budget) so
/init and /remember respect the setting. For backward compatibility,
INIT_WRITE_PROMPT constant still exists and InputContext defaults to 3000.

Signed-off-by: Fathi Boudra <fathi.boudra@linaro.org>
@jedisct1

Copy link
Copy Markdown
Contributor

Thanks for the contribution, Fathi.

But before adding the option, could you share the concrete use case that prompted it?

I’m hesitant to add another permanent configuration knob for what may be a niche case.

The existing 3,000-character value is deliberately a soft target rather than a hard limit: /init and /remember continue to work, and just warn when AGENTS.md grows large.

Since AGENTS.md is injected into future agent contexts, raising the budget permanently increases prompt size, cost, and the chance that important instructions are diluted by a long file.

There are also a few things that doesn't make this PR mergeable:

  • Although the PR description says agents_md_budget can be configured in swival.toml, it was not added to CONFIG_KEYS. At present, a setting such as agents_md_budget = 6000 is reported as unknown and ignored; only the CLI option works.
  • The option needs documentation. It is currently difficult for a user to tell what it controls, why the default exists, when changing it is appropriate, and what trade-off they are making. If we keep it, please document it in the CLI/config reference and generated config template.

@fboudra

fboudra commented Jul 28, 2026

Copy link
Copy Markdown
Author

Thanks for the feedback. In my use case, the 3k felt too small and had the need for a larger limit more often than not. While the AGENTS.md is consumed by coding agent, it requires some updates or edits done by human. I ended hacking in the source code to increase the limit to 5k (more reasonable in my use cases). In addition, most of my existing AGENTS.md are above the 3k limit. Avoid also hitting the warning message all the time. Overall, making it configurable looked to me a good compromise.
I understand the budget constraint and cost of this change, but it leaves the default to 3k.
Let me know if this feature has a chance to make it, and I'll address the other couple of issues that you raised.

@jedisct1

Copy link
Copy Markdown
Contributor

Not forgetting you :) But I'd like to find a cleaner/simpler to use way to address this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants