Skip to content

Add reasoning effort to AI Sessions starts - #459

Merged
maximelb merged 1 commit into
masterfrom
starwatch/ai-sessions/reasoning-effort-python-limacharlie
Nov 13, 2026
Merged

maximelb merged 1 commit into
masterfrom
starwatch/ai-sessions/reasoning-effort-python-limacharlie

Conversation

@maximelb

Copy link
Copy Markdown
Contributor

What

AI Sessions can now set a reasoning effort per session: how long the model thinks before answering. This adds it to the CLI and SDK.

  • ai start-session and ai chat take --effort with the choices low, medium, high, xhigh and max. Leaving it out sends nothing, so the model's own default applies, exactly as today.
  • The SDK takes an effort keyword on AI.start_session (sent inside the session profile, and copied from the template like model) and on AI.create_user_session. An empty value sends nothing. The SDK passes the string through; the service validates it.
  • The --help and explain texts describe it: higher levels do better on hard investigations, but they are slower and use more tokens on your AI provider's bill.
  • ai chat and ai session attach hide the runner's effort_set notice by default, like model_set, and keep showing effort_adjusted and effort_skipped, which tell the user when the runner changed or dropped the requested level for the model in use.

The service accepts the field only while reasoning effort is enabled on it; otherwise it ignores it, so this is safe to release before then.

Tests

  • New tests cover the start-session override, copying from the template, an override replacing the template value, empty values sending nothing (both calls), the CLI passing the flag through (and None when omitted), the CLI refusing an unknown level, and the attach filter. The help-flag and "all overrides" tests now include --effort / effort.
  • Each new or changed test fails with the change reverted (13 fail on a full revert). Partial reverts were checked one at a time: dropping effort from the profile field list, the empty-value handling in each call, the attach filter entry and the choice list each fail their own test.
  • pytest tests/unit/ tests/microbenchmarks/: 5330 passed. The 5 skips are existing platform-only and docstring skips, unchanged by this PR.

StarWatch ai-sessions XO via StarForge

🤖 Generated with Claude Code

ai start-session and ai chat take --effort (low, medium, high, xhigh,
max). The SDK takes an effort keyword on start_session (sent in the
session profile) and create_user_session. Unset or empty sends nothing,
so the model's own default applies as before. ai chat and ai session
attach hide the effort_set notice like model_set and show
effort_adjusted and effort_skipped.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@maximelb

Copy link
Copy Markdown
Contributor Author

Independent review of e04c661: approve

Reviewed from a clean export of e04c661 against master 8891083.

Checked

  • The effort field matches the AI Sessions API spec on both the inline profile (POST /v1/api/sessions) and POST /v1/sessions: same five levels, omitted when unset, ignored by the service while the setting is off.
  • Unset sends nothing. start_session drops an empty or null effort after applying the template and overrides. create_user_session sends it only when it is non-empty. The CLI defaults to None and rejects unknown levels before any request.
  • The runner sends the readable text of effort_adjusted / effort_skipped in payload.message, which the attach renderer prints. effort_set is hidden like model_set.
  • Both changed test files pass (164). With these tests run against master's source, the 13 new or changed tests fail.

High: none. Medium: none.

Low

  1. limacharlie/commands/ai.py:375: ai start-session --effort has no way to clear a template's effort, though the SDK accepts effort="". This has no effect until agent records carry effort. Revisit then.
  2. limacharlie/commands/ai.py:377, limacharlie/sdk/ai.py:89: "Omit to keep the template's value" and the template copy refer to a record field that doesn't exist yet. Harmless and forward-compatible.
  3. tests/unit/test_ai_session_attach.py:625: the fixtures put fields flat in the payload instead of under payload.data. The filter reads only subtype, so the test holds. No test covers how the visible events are rendered. Optional.

Merge once the remaining pending check is green.

@maximelb
maximelb merged commit 259bb48 into master Nov 13, 2026
7 checks passed
@maximelb
maximelb deleted the starwatch/ai-sessions/reasoning-effort-python-limacharlie branch November 13, 2026 17:48
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