Skip to content

feat: optionally enforce playbook token budget - #44

Open
Frankie-Xu wants to merge 1 commit into
ace-agent:mainfrom
Frankie-Xu:feat/optional-playbook-budget
Open

Frankie-Xu wants to merge 1 commit into
ace-agent:mainfrom
Frankie-Xu:feat/optional-playbook-budget

Conversation

@Frankie-Xu

Copy link
Copy Markdown

Addresses the playbook-bloat concern in #26 with an opt-in budget guardrail. It does not implement DELETE/MERGE/UPDATE, replace the prompt loader in #38, change PR #43, or claim that a budget alone fixes validation oscillation.

This adds enforce_playbook_token_budget (default false) to ACE, ACEBatch and the three task entry points. When enabled, the existing count_tokens / cl100k_base counter measures the resulting playbook only. The curation boundary rejects an over-budget candidate before publication, returns the original playbook unchanged, does not consume next_global_id, and records structured diagnostics: status, base/candidate/budget token counts and reason. Bullet content is never silently truncated. Empty operations and exact-boundary candidates are covered.

Ordinary Curator curation attaches the decision to call_info; the ACEBatch reducer uses the same pure helper before assigning its playbook and ID and exposes the decision in per-sample tracking. The default path retains existing tuple/config behavior.

Tests cover exact-boundary acceptance, over-budget rejection, empty operations, default compatibility and opt-in config extraction, Curator structured rejection, reducer output/state preservation, and no ID consumption. Validation: 7 unittest tests passed, compileall and diff-check passed, and the same suite passed from a clean git archive. No LLM, API key, network request, benchmark, or upstream main push was used.

@Frankie-Xu
Frankie-Xu marked this pull request as ready for review September 18, 2026 16:59
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.

1 participant