Skip to content

feat(cli): split --max-tokens and --budgets by meaning (F1b tokens) - #954

Merged
xaleryb merged 15 commits into
intel:mainfrom
napetrov:feat/cli-f1b-tokens
Nov 22, 2026
Merged

xaleryb merged 15 commits into
intel:mainfrom
napetrov:feat/cli-f1b-tokens

Conversation

@napetrov

@napetrov napetrov commented Nov 19, 2026 •

Copy link
Copy Markdown
Contributor

Part of #94 (F1b, tokens concept).

Summary

--max-tokens meant two things. It now splits by what the code caps, and --budgets becomes --token-budgets. Old spellings tombstone: they print the new command and exit 2. Existing destination names are preserved. --token-budgets accepts finite fractions from 0 through 1, and counts passed to --max-output-tokens must be positive. Truncated replies on skill coverage and eval graph report the output ceiling without suggesting a flag those commands cannot accept.

Leaf Old flag New flag What it caps
answers generate --max-tokens --retrieval-tokens tokens retrieved per question
benchmark run --max-tokens --retrieval-tokens tokens retrieved per question
benchmark preflight --max-tokens --retrieval-tokens tokens retrieved per question
benchmark batch --max-tokens --retrieval-tokens tokens retrieved per question
arms run --max-tokens --max-output-tokens output of each model call
arms matrix-run --max-tokens --max-output-tokens output of each model call
subjects run --max-tokens --max-output-tokens output of each model call
tools preference --max-tokens --max-output-tokens output of each model call (default 2048)
skill novelty analyze --max-tokens --max-output-tokens output of each model call
skill novelty atoms --max-tokens --max-output-tokens output of each model call
skill novelty probe --max-tokens --max-output-tokens output of each model call
skill shorten --max-tokens --max-output-tokens output of each model call
skill routing --max-tokens --max-output-tokens output of each model call
catalog routing --max-tokens --max-output-tokens output of each model call
skill novelty analyze, atoms, probe; skill shorten --budgets --token-budgets target token fractions

Count: 4 retrieval leaves and 10 output leaves. The count in the F1b brief (six and seven) does not match the snapshot. The note in cli_flags.py was corrected to 4 and 10, so this PR is the source of truth.

Retired novelty routing --max-tokens prints the skill routing --max-output-tokens command.

Evidence

  • Review round on 6b33b73: all 145 graph, output-ceiling and CLI flag migration tests passed.

  • Full suite: 23776 passed, 20 skipped (pytest -n auto). Two subprocess-timeout tests failed once under load and pass alone.

  • make ci-local CI_LOCAL_ARGS="--offline --jobs static,typecheck": 0 failed, 16 passed, 3 skipped (network-only).

  • tests/test_cli_flag_moves.py: tombstone cases for each old spelling, and parse-equivalence cases.

  • docs/reference/cli-interface.json regenerated; the diff is limited to the 14 leaves.

  • test_answering_stack_parity.py: the D7 probe found the option by spelling, which the rename broke. It now finds the option by dest.

Merge Danger

Left out

  • _RETIRED_VALUE_FLAGS and _RETIRED_ROUTING_FLAGS in cli_routes.py still recognise the old spelling for the retired novelty routing. That is intentional.
  • The budgets settings key in fixtures and the CHANGELOG history are unchanged.

🤖 Generated with Claude Code

--max-tokens meant two things. On answers generate and benchmark run,
preflight and batch it caps the tokens retrieved per question, so it is
now --retrieval-tokens. On arms, subjects, tools preference, skill novelty
and skill and catalog routing it caps the output of each model call, so
it is now --max-output-tokens. --budgets on skill novelty analyze, atoms and probe, and on skill shorten, becomes
--token-budgets. The old spellings tombstone (print the new command, exit
2). Dest names are unchanged, so no behaviour changes.

The tokens concept is registered in cli_flags with four retrieval leaves
and ten output leaves; the allowlist rows for --max-tokens and --budgets
are removed. The parity probe now finds an option by its dest, since the
spelling differs per leaf.

Part of intel#94 (F1b, tokens concept).

Signed-off-by: Nikolay Petrov <nikolay.a.petrov@intel.com>
@napetrov
napetrov requested a review from a team as a code owner November 19, 2026 05:08
@napetrov napetrov added the cli-interface-change Changes dokimi's user-facing CLI surface label Nov 19, 2026
@exai-bot

exai-bot commented Nov 19, 2026 •

Copy link
Copy Markdown

OpenCodeReview: Commit 6b33b73 was not reviewed. This PR has reached its review limit (6 reviews).

CI at `6b33b73`: 10 still running, 3 passing, 1 skipped
Check Status
Build docs (strict) still running
CLI interface diff still running
CodeQL (actions) still running
CodeQL (python) still running
External catalog smoke test (uxlfoundation/skills) still running
Platforms and Python versions still running
Static checks (ruff, schema, zizmor, licenses, pre-commit, bandit, secrets, changelog, schema com... still running
atheris (parsers) still running
benchmark still running
mypy still running

To review this commit: re-request review from exai-bot in the Reviewers list.

<details><summary>Last review (a5fdb07): no findings</summary>

Open threads from the bot: 0

</details>

@github-actions

Copy link
Copy Markdown

CLI interface change detected

This PR changes dokimi's user-facing CLI surface (commands and/or options):

~ `dokimi answers generate` parameters changed:
    - removed option `--max-tokens`
    + added option `--retrieval-tokens`
~ `dokimi arms matrix-run` parameters changed:
    - removed option `--max-tokens`
    + added option `--max-output-tokens`
~ `dokimi arms run` parameters changed:
    - removed option `--max-tokens`
    + added option `--max-output-tokens`
~ `dokimi benchmark batch` parameters changed:
    - removed option `--max-tokens`
    + added option `--retrieval-tokens`
~ `dokimi benchmark preflight` parameters changed:
    - removed option `--max-tokens`
    + added option `--retrieval-tokens`
~ `dokimi benchmark run` parameters changed:
    - removed option `--max-tokens`
    + added option `--retrieval-tokens`
~ `dokimi catalog routing` parameters changed:
    - removed option `--max-tokens`
    + added option `--max-output-tokens`
~ `dokimi skill novelty analyze` parameters changed:
    - removed option `--budgets`
    - removed option `--max-tokens`
    + added option `--max-output-tokens`
    + added option `--token-budgets`
~ `dokimi skill novelty atoms` parameters changed:
    - removed option `--budgets`
    - removed option `--max-tokens`
    + added option `--max-output-tokens`
    + added option `--token-budgets`
~ `dokimi skill novelty probe` parameters changed:
    - removed option `--budgets`
    - removed option `--max-tokens`
    + added option `--max-output-tokens`
    + added option `--token-budgets`
~ `dokimi skill routing` parameters changed:
    - removed option `--max-tokens`
    + added option `--max-output-tokens`
~ `dokimi skill shorten` parameters changed:
    - removed option `--budgets`
    - removed option `--max-tokens`
    + added option `--max-output-tokens`
    + added option `--token-budgets`
~ `dokimi subjects run` parameters changed:
    - removed option `--max-tokens`
    + added option `--max-output-tokens`
~ `dokimi tools preference` parameters changed:
    - removed option `--max-tokens`
    + added option `--max-output-tokens`

Updated on every push; the cli-interface-change label is on while the diff is non-empty.

@codecov-commenter

codecov-commenter commented Nov 19, 2026 •

Copy link
Copy Markdown

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 95.91%. Comparing base (36075a0) to head (6b33b73).
❗ Your organization needs to install the Codecov GitHub app to enable full functionality.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #954      +/-   ##
==========================================
- Coverage   95.92%   95.91%   -0.01%     
==========================================
  Files         450      450              
  Lines       59527    59531       +4     
  Branches    10265    10265              
==========================================
+ Hits        57101    57102       +1     
  Misses       1507     1507              
- Partials      919      922       +3     
Files with missing lines Coverage Δ
dokimi/dokimi/cli_flags.py 100.00% <ø> (ø)
dokimi/dokimi/commands/answers.py 96.29% <100.00%> (+0.03%) ⬆️
dokimi/dokimi/commands/arms.py 97.84% <100.00%> (ø)
dokimi/dokimi/commands/benchmark.py 91.63% <100.00%> (ø)
dokimi/dokimi/commands/eval_graph.py 90.62% <100.00%> (ø)
dokimi/dokimi/commands/novelty.py 99.08% <100.00%> (+<0.01%) ⬆️
dokimi/dokimi/commands/routing_parser.py 100.00% <100.00%> (ø)
dokimi/dokimi/commands/skill.py 100.00% <100.00%> (ø)
dokimi/dokimi/commands/skill_coverage.py 96.73% <100.00%> (ø)
dokimi/dokimi/commands/subjects.py 94.57% <100.00%> (ø)
... and 6 more

... and 5 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Signed-off-by: Vladislav Perevezentsev <vladislav.perevezentsev@intel.com>
Signed-off-by: Vladislav Perevezentsev <vladislav.perevezentsev@intel.com>
Signed-off-by: Vladislav Perevezentsev <vladislav.perevezentsev@intel.com>
Signed-off-by: Vladislav Perevezentsev <vladislav.perevezentsev@intel.com>
…below 1

Signed-off-by: Vladislav Perevezentsev <vladislav.perevezentsev@intel.com>

@vlad-perevezentsev vlad-perevezentsev left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

I checked f1a5d4d. The split is right: each leaf moves by what its code does with the value. The FLAG_MOVES lists now match, by a test, the leaves that carry each new flag (4 retrieval, 10 output, 4 budgets), and novelty routing --max-tokens becomes skill routing --max-output-tokens.

Merge: safe now: it merges cleanly into current main, 2 commits behind, and its CLI tests pass on the merge. Once it is in, #955, #957 and #958 conflict with it (cli_flags.py, cli-interface.json, cli_flags_allowlist.txt) and need a rebase.

What I ran, at f1a5d4d:

  • make ci-local --offline: 0 failed, 25 passed, 20 skipped (network-only jobs); the test suite: 23,756 passed, 72 skipped.
  • The new tests on the code before the fix commits: the metavar and the below-one tests fail. With benchmark batch dropped from FLAG_MOVES, the leaves test fails.
  • On the merge with main: test_cli_flag_moves.py, test_cli_flags.py, test_answering_stack_parity.py, test_novelty_cli.py, test_repo_budget.py (changed on main): 241 passed.

Checked, no issues

  • Destinations: every new flag keeps dest="max_tokens" / budgets, so the code that reads them and the stored run config do not change.
  • Docs, schema and changelog: the docs and the novelty.v1.json descriptions name the new flags; the schema change is text only. The fragment is under Changed and says what a script must change.

Fixed in this branch, up to f1a5d4d:

  • --help showed MAX_TOKENS / BUDGETS as the metavar, the old names: 36a300f passes N / F as in the registry on all 14 leaves.
  • The tombstone test covered 7 of the 18 moved pairs: 634d55b checks each move's leaves against build_parser() and tombstones every (move, leaf) pair.
  • answers generate --retrieval-tokens took 0 and negative counts, unlike the benchmark leaves: e9a37a5 uses positive_int; the changelog says so (f1a5d4d).
  • The test module's docstring named only the output concept: 4ca2ffe.

Each new test fails when the code it covers is broken.

@vchamarthi vchamarthi left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Not approved yet · reviewed f1a5d4d

Next: @napetrov: settle 1 open question (below). 1 nit optional.

Blocking

  • Open question for @napetrov: arms run --max-t 8, a unique prefix of --max-tokens, parsed on main as --max-tokens. Decide whether unique prefixes of --max-tokens and --budgets tombstone: match them in moved_flags_argv (dokimi/dokimi/cli_routes.py), or say in the changelog fragment that prefixes are refused.
Follow-ups, not blocking (2)
  • dokimi/dokimi/commands/novelty.py:668 – Input --token-budgets nan (--budgets nan on main) parses to a fraction of NaN, and shorten uses it as the target budget * tokens_full (dokimi/novelty/shorten.py:233) (main has it too).
  • dokimi/dokimi/commands/skill_coverage.py:41 – A cut-off reply from a non-CLI provider in skill coverage gets the hint raise --max-output-tokens, which skill coverage does not take (main has it too).

Verified on f1a5d4d: ✅ changed tests: 479 passed, fail on main · ✅ full suite on the head: 23781 passed · ⚠️ conflicts with main · ✅ 12 broken variants of the changed code: 12 caught by the tests · 2 mutations tried · 6 edge inputs tried

10 checks behind it, each with its evidence
Area What holds How
Token move table The four retrieval leaves, the ten output leaves and the four --token-budgets leaves take the new spellings, and tests/test_cli_flag_moves.py checks each move's leaves against the parser tree tests on the head
Old spellings answers generate --max-tokens 8, arms run --max-tokens 8 and skill shorten --budgets 0.5 exit 2 and print the new command; on main the same argv parses ran it, edge input (cli)
Retired routing novelty routing --max-tokens prints skill routing --max-output-tokens: tests/test_cli_flag_moves.py pins that line tests on the head
Token counts answers generate --retrieval-tokens 0 and -5, and arms run --max-output-tokens 0, exit 2 with must be >= 1; on main the new spellings are unrecognized ran it, edge input (numbers)
Stored values tests/test_answering_stack_parity.py, tests/test_arms_run_config_parity.py and tests/test_subjects.py pass on the head with the new spellings: the parity tests pin the values under max_tokens and budgets tests on the head
Help metavars test_help_shows_the_registry_metavar_for_each_token_spelling passes: --help shows N and F for the token flags, not the dests tests on the head
Cli snapshot docs/reference/cli-interface.json equals a fresh dump of the parser from scripts/cli_surface.py ran it, edge input (structured)
Moved argv values moved_flags_argv keeps an empty, a blank and a non-ASCII value after a moved token flag ran it, edge input (text)
Cut-off hint A cut-off reply from LLMClient with no max_tokens, system or accept raises OutputTruncated with raise --max-output-tokens ran it, edge input (none)
Move pins Dropping catalog routing from the --max-output-tokens move list fails tests/test_cli_flag_moves.py broke the code, tests caught it

napetrov and others added 5 commits November 20, 2026 00:13
Signed-off-by: Nikolay Petrov <nikolay.a.petrov@intel.com>
Signed-off-by: Nikolay Petrov <nikolay.a.petrov@intel.com>
Signed-off-by: Nikolay Petrov <nikolay.a.petrov@intel.com>
Signed-off-by: Nikolay Petrov <nikolay.a.petrov@intel.com>
A skill routing --max-output-tokens type of int instead of
positive_int left all flag tests green; the refusal is now checked
on each of the 10 output leaves.

Signed-off-by: vchamarthi <venkata.sai.gireesh.chamarthi@intel.com>
@vchamarthi

Copy link
Copy Markdown
Contributor

🟢 Ready for re-review · 1 commit on feat/cli-f1b-tokens (6c9d7d2..a5fdb07)

Next: @vlad-perevezentsev: re-review the new head. Nothing needed from @napetrov.

Changes

  • tests/test_cli_flag_moves.py: refusal of 0 and -5 is checked on every --max-output-tokens leaf.

Threads and comments

  • 1 fixed; each answered in its thread.

Verified on the new head: ✅ tests of the fix: 1 passed · ✅ full suite with main merged in: 24283 passed · ✅ second reader: nothing raised

What each test shows
  • every output-token leaf refuses a count below one: passes.
  • Left to GitHub's own checks: agent-quality.yml:external-catalog-smoke, ci.yml:static / pre-commit, ci.yml:static / Install gitleaks, ci.yml:static / Scan commits, ci.yml:fidelity / Install the pinned Claude Code, ci.yml:test-latest, ci.yml:package-smoke, ci.yml:windows-smoke.

Signed-off-by: Nikolay Petrov <nikolay.a.petrov@intel.com>
Thread: PRR_kwDOVBg7g88AAAABZOla5g.b
Signed-off-by: Nikolay Petrov <nikolay.a.petrov@intel.com>
Thread: PRR_kwDOVBg7g88AAAABZOla5g.c
Signed-off-by: Nikolay Petrov <nikolay.a.petrov@intel.com>
Signed-off-by: Nikolay Petrov <nikolay.a.petrov@intel.com>
@napetrov

Copy link
Copy Markdown
Contributor Author

Re: review by vchamarthi

Decide whether unique prefixes of --max-tokens and --budgets tombstone.
Waiting on a decision before I change this: should prefixes receive migration hints or should the changelog document that hints require full spellings? I recommend documenting full spellings. The token fraction validator now rejects NaN (3877514), and coverage errors omit the unavailable output flag (67ab1ee).

@napetrov

Copy link
Copy Markdown
Contributor Author

Re: comment by vchamarthi

Refusal of 0 and -5 is checked on every --max-output-tokens leaf.
Confirmed the leaf-wide parameterized cases in test_cli_flag_moves.py. The review above tracks the separate question about migration hints.

@napetrov

Copy link
Copy Markdown
Contributor Author

The token-budget parser now rejects non-finite fractions before starting a run. The coverage command reports the model’s output ceiling without suggesting an unavailable option. The abbreviation policy is still awaiting an author decision.

@xaleryb xaleryb left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approved on 6b33b73. vlad's approval stands on f1a5d4d; I re-verified every commit after it on the head merged with current main: all 14 old --max-tokens leaves and both --budgets leaves print the new command and exit 2 (also as --flag=value); --token-budgets rejects nan, inf, negatives and values above 1; --max-output-tokens and --retrieval-tokens reject 0 and negatives; destination names are unchanged; no old flag is left in docs, scripts, workflows or benchmarks; the CLI snapshot regenerated on Python 3.13 is byte-identical; full suite, ruff, mypy, bandit and the growth and comment-block gates are clean. Minor, not blocking: the abbreviations --max-tok and --budget exit 2 with a plain argparse error and no new command. CI is green.

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

Labels

cli-interface-change Changes dokimi's user-facing CLI surface

Projects

None yet

Development

Successfully merging this pull request may close these issues.

CLI API: the evaluation loop at the top level, subject and eval groups below, one enforced flag vocabulary (proposal v2.1)

6 participants