Skip to content

feat: support context length shorthand (64k, 128k)#64

Merged
Andyyyy64 merged 5 commits into
Andyyyy64:mainfrom
devangpratap:feat/context-length-shorthand
May 26, 2026
Merged

feat: support context length shorthand (64k, 128k)#64
Andyyyy64 merged 5 commits into
Andyyyy64:mainfrom
devangpratap:feat/context-length-shorthand

Conversation

@devangpratap
Copy link
Copy Markdown
Contributor

@devangpratap devangpratap commented May 21, 2026

What

Add shorthand notation for the --context-length / -c flag across all
commands (whichllm, plan, upgrade, run). Users can now write
whichllm -c 64k instead of whichllm -c 64000.

Supported formats: plain integers (4096), k/K suffix (64k = 64000),
m/M suffix (1m = 1000000), fractional (1.5k = 1500). Case-insensitive.

Why

Closes #59. Converting context lengths to raw integers is annoying when
the values are commonly expressed as 64k, 128k, etc.

Testing

  • Tests pass (uv run pytest, 202/202)
  • New tests added (12 tests in test_utils.py covering valid inputs,
    edge cases, and rejection of bad values)
  • Tested on real hardware (if hardware-related)

Notes

  • ContextLengthType is a custom click.ParamType in utils.py that
    handles parsing before typer sees it
  • All 4 --context-length options in cli.py wired via
    click_type=CONTEXT_LENGTH
  • Help text updated to show shorthand examples
  • Plain integer input is fully backwards compatible

@Andyyyy64
Copy link
Copy Markdown
Owner

Thanks, this is the implementation I’d like to go with for #59.

Could you make one small adjustment before we merge? 64k currently parses as 64,000, but for context windows users may expect 64k to mean 65,536. I think we should either switch k to 1024-based parsing or explicitly document that this is decimal shorthand.

Could you also carry over the CLI docs coverage from #60? After that this looks good to merge.

Andyyyy64 and others added 2 commits May 22, 2026 17:09
…thand

Switch k/m/b multipliers from decimal (1000) to binary (1024) so that
64k parses as 65536, matching LLM context window conventions. Add
shorthand examples and updated option descriptions to docs/cli.md for
all four commands (main, plan, upgrade, run).
@devangpratap
Copy link
Copy Markdown
Contributor Author

Thanks for the feedback! I've pushed the changes:

  1. Switched k to 1024-based parsing64k now parses as 65536 instead of 64000. Same for m (1024²) and b (1024³). This matches how LLM context windows are conventionally expressed.
  2. Added CLI docs coverage from feat: support context length shorthand #60 — updated docs/cli.md with shorthand mentions in the option descriptions and added shorthand examples for all four commands (main, plan, upgrade, run).

All 202 tests pass, ruff clean.

@Andyyyy64
Copy link
Copy Markdown
Owner

Sorry for the slow follow-up, work has been busy on my end.

This looks good now. The 1024-based shorthand behavior matches how people usually talk about context windows, and the CLI docs coverage is in place.

@Andyyyy64 Andyyyy64 merged commit 8018115 into Andyyyy64:main May 26, 2026
4 checks passed
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.

Support context length shorthand

2 participants