Repository navigation
[Feature]: Per-step reasoning effort and context size for command steps, passed through like model #4916
Description
Problem Statement
A workflow author cannot set reasoning effort or context size per command step. Different steps need different settings: speckit.plan may warrant high effort while speckit.tasks does not, and a step analyzing a large spec may need an extended context window. Today this cannot be expressed in the workflow definition:
options:on a command step is merged with workflow defaults (step/command/__init__.py:116-130) and recorded in the step output, but never passed to_try_dispatch/dispatch_command. It has no effect on the CLI.integration_options/integration_args([Feature]: Per step integration configuration in workflows #4275) are rejected byIntegrationBase.validate_runtime_config(base.py:273) for every integration except Docker Agent.integration_options: {reasoning_effort: high}fails the step on Claude, Codex, Copilot, and others.SPECKIT_INTEGRATION_<KEY>_EXTRA_ARGScan inject flags, but applies to the whole run, differs per CLI, and is invisible in the workflow YAML.
model is already a first-class per-step field. Reasoning effort and context size are the same kind of setting but have no equivalent.
Proposed Solution
Add two optional command-step fields, reasoning_effort and context_size, implemented analogously to model:
| Aspect | model (existing) |
reasoning_effort / context_size |
|---|---|---|
| Step field | model: |
reasoning_effort:, context_size: (names open for discussion) |
| Workflow default | context.default_model |
analogous defaults |
| Resolution | step → workflow default → unset; expressions allowed | same |
| Type validation | string, else step FAILED | same |
| Passed to integration | build_exec_args(..., model=...) |
new keywords |
| Value semantics | opaque string, interpreted by the CLI | same: opaque string, passed through |
| Unsupported | n/a | step fails with an actionable error, never silently ignored |
| Run state | stored in step output, re-resolved on resume | same |
The values are deliberately not normalized. CLIs differ in scales and meaning, just as they differ in model naming, and Spec Kit does not try to hide that. The goal is only that a workflow can pass the setting to the CLI per step. An integration may validate against its own known values, but is not required to. The base class keeps rejecting the fields (the same opt-in pattern as validate_runtime_config), so an unsupported integration fails loudly instead of ignoring the setting.
Feasibility check against current CLIs
Checked with --help of the installed versions, plus online docs for Codex and Kiro.
| CLI | reasoning_effort maps to |
context_size maps to |
|---|---|---|
| Claude Code 2.1.116 | --effort low|medium|high|xhigh|max |
no flag. Part of the model alias (sonnet[1m], opus[1m]) or env CLAUDE_CODE_MAX_CONTEXT_TOKENS. Initially unsupported; use model: sonnet[1m] |
| Codex 0.117.0 | -c model_reasoning_effort=<v> (model-dependent values) |
-c model_context_window=<tokens> |
| GitHub Copilot 1.0.89 | --reasoning-effort none|minimal|low|medium|high|xhigh|max |
--context default|long_context |
| opencode 1.18.35 | --variant <string> (provider-specific) |
no flag |
Antigravity (agy) 1.1.22 |
--effort low|medium|high |
no flag |
| Kiro CLI (docs only) | kiro-cli chat --effort low|medium|high|xhigh|max |
none found |
| Cursor Agent 2026.05.09 | no flag; encoded in the model name (for example sonnet-4-thinking) |
no flag |
| Gemini CLI 0.57.0 | no flag (settings-based) | no flag |
Takeaways:
reasoning_efforthas a direct mapping in six of the eight CLIs checked (Claude, Codex, Copilot, opencode, agy, Kiro).context_sizeis directly mappable in only two (Codex, Copilot), and means a token count in one and a tier in the other. With opaque pass-through, that difference does not matter to Spec Kit.- The fields are therefore opt-in per integration. Cursor and Gemini would continue to fail with a clear message, as would
context_sizeon integrations without a mapping. - Kiro's dispatch currently has a separate problem ([Bug]: kiro-cli workflow dispatch exits 2, and Kiro doesn't expand dotted /speckit.* prompt names #4797), so the feature would only become usable there once that is fixed.
Alternatives Considered
- Per-integration keys in
integration_options(for example{reasoning_effort: high}). This is cheaper because the plumbing exists, but every integration invents its own keys, and the workflow is bound to one integration. This is the same trade-off that was resolved in favour of a top-level field formodel(Docker Agent even rejectsintegration_options.model). SPECKIT_INTEGRATION_<KEY>_EXTRA_ARGS. A workaround only: process-wide, invisible in YAML, requires CLI-specific flag knowledge.- Only
reasoning_effortfirst. A reasonable first step, sincecontext_sizehas fewer supported CLIs. - Passing
options:through. A broader, separate question. At minimum the docs should state that it currently has no effect on dispatch.
Component
Agent integrations (command files, workflows)
AI Agent (if applicable)
All agents
Use Cases
- High effort for
specifyandplan, low effort fortasksto reduce cost and latency. - A workflow input (
inputs.effort) lets the caller choose effort for a run, resolved via expression likemodeltoday. - A step analyzing a large spec requests a long context window while other steps use the default.
- Per-step settings are reproducible and reviewable in the workflow definition instead of living in env vars.
Acceptance Criteria
- Command step accepts optional
reasoning_effortandcontext_size, plus workflow-level defaults, with the same resolution order and expression support asmodel. - Non-string values fail the step with an actionable error.
- An integration that does not support a field fails the step explicitly instead of silently ignoring it.
- At least Codex, Copilot, and Claude (effort only) implement their mapping, with positive and negative tests per
CONTRIBUTING.md#testing-deterministic-behavior. - Resolved values are recorded in step output and re-resolved on
workflow resume. -
docs/reference/workflows.mdandworkflows/README.mddocument both fields and a per-integration support table. Also document that command-stepoptions:is not forwarded to the CLI.
Additional Context
- Prior art: [Feature]: Per step integration configuration in workflows #4275 (per-step integration config; Docker Agent is the only integration with
validate_runtime_config). - Related discussions: How to use workflow in danger-full-access in sandbox-mode? #3008 (Codex in workflows does not inherit the user's sandbox settings), [Workflow] Can I use cavemen, ponytail kind of ai agent token usage helpers with workflow command? #3191 (each step spawns a one-shot CLI process).
- Code references:
src/specify_cli/workflows/step/command/__init__.py(model resolution lines 84-114, dispatch lines 245-268),src/specify_cli/integrations/base.py(build_exec_args,validate_runtime_config,_apply_extra_args_env_var). - CLI flags in the table were verified against locally installed versions on the date of writing and may change.
AI Disclosure
Drafted with OpenCode (model: claude-sonnet-5.5, reasoning effort not set/unknown), human-supervised, based on a read-through of the codebase, existing issues, and the --help output of the locally installed CLIs. Reviewed by the filer before posting.
Activity
github-actions commentedon Oct 12, 2026
Feature assessment — per-step-reasoning-context · Stage 1/5: Intake
Idea Intake: Per-step reasoning effort and context size
model#4916 ([Feature]: Per-step reasoning effort and context size for command steps, passed through likemodel#4916)Idea (as captured)
Restated
The workflow system would expose reasoning-effort and context-size settings at command-step and workflow-default scope, passing resolved values through to integrations that support them and failing explicitly for integrations that do not. The proposal aims to make per-step behavior reproducible, configurable, and visible in workflow definitions.
Origin & Context
options:values are recorded but not dispatched, runtime integration configuration is rejected by most integrations, and the extra-arguments environment variable is process-wide rather than per-step.First-Glance Unknowns
context_size,context_window, or another term, given that integrations use different units and tiers?]github-actions commentedon Oct 12, 2026
Feature assessment — per-step-reasoning-context · Stage 2/5: Research
Idea Research: Per-step reasoning effort and context size
Users & Demand
planversustasks, large-spec analysis, and workflow-input-driven configuration — source: GitHub issue #4916 (confidence: medium, cited).Prior Art
modelis already resolved per command step with a workflow default and expression evaluation insrc/specify_cli/workflows/step/command/__init__.py; this is the closest internal precedent for first-class per-step execution settings — [source:src/specify_cli/workflows/step/command/__init__.py, lines 84-114] (confidence: high, cited).modeltodispatch_command, but no reasoning or context keywords are present in the dispatch path — [source:src/specify_cli/workflows/step/command/__init__.py, lines 245-268] (confidence: high, cited).optionsis merged for the step and recorded, but the inspected command dispatch path does not pass it to the integration; the issue explicitly identifies this as a current limitation — [source:src/specify_cli/workflows/step/command/__init__.py, lines 116-130; GitHub issue [Feature]: Per-step reasoning effort and context size for command steps, passed through likemodel#4916] (confidence: high, cited).integration_argsandintegration_optionsare deliberately opt-in: the base integration rejects non-empty values unless an integration overrides validation — [source:src/specify_cli/integrations/base.py,validate_runtime_config] (confidence: high, cited).build_exec_argsand model handling, but repository search found noreasoning_effortorcontext_sizeimplementation or test symbols — [source:tests/integrations/andtests/test_workflows.py] (confidence: high, cited).Market & Context
SPECKIT_INTEGRATION__EXTRA_ARGS, which is process-wide, CLI-specific, and not visible in workflow YAML — source: GitHub issue #4916 (confidence: medium, cited).Data & Constraints
model,output_json,integration_args,integration_options, andproject_root; adding new settings would affect integration contracts and installer signature validation — [source:src/specify_cli/integrations/base.py;src/specify_cli/integrations/installer.py] (confidence: high, cited).src/specify_cli/integrations/base.py,validate_runtime_config] (confidence: high, cited).model, and resume behavior re-resolves runtime fields according to the issue's cited existing behavior; exact resume coverage for the proposed fields is not yet established — source:src/specify_cli/workflows/step/command/__init__.py; GitHub issue #4916 (confidence: medium, cited).Evidence Against the Idea
Gaps & Open Questions
Sources
model#4916 (host: github.com, policy: allowlisted)src/specify_cli/workflows/step/command/__init__.py(repository source)src/specify_cli/integrations/base.py(repository source)src/specify_cli/integrations/installer.py(repository source)tests/integrations/andtests/test_workflows.py(repository source)github-actions commentedon Oct 12, 2026
Feature assessment — per-step-reasoning-context · Stage 3/5: Problem
Problem Definition: Per-step reasoning effort and context size
Problem Statement
Workflow authors cannot reliably express different reasoning-effort or context-capacity needs for individual command steps. As a result, settings are either unavailable, process-wide, integration-specific, or hidden outside the workflow definition, reducing control and reproducibility when steps have different cost, latency, or context requirements.
Affected Users & Stakeholders
Goals
Non-Goals
Success Metrics
Cost of Inaction
Authors continue to rely on process-wide extra arguments, integration-specific workarounds, or settings that are recorded but not dispatched. Workflows remain less portable and less self-documenting, while the project has no measured evidence of the resulting cost, latency, or quality impact.
Open Questions
github-actions commentedon Oct 12, 2026
Feature assessment — per-step-reasoning-context · Stage 4/5: Concept
Concept: Per-step reasoning effort and context size
Options
Option A — Effort-first foundation
Option B — Full opaque pass-through
Option C — Keep the current workaround
Recommendation
Recommend Option A. The problem and internal precedent for per-step
modelsettings are credible, and effort has more direct mappings in the evidence than context size. A narrower first slice can test whether workflow authors use and benefit from explicit per-step controls while avoiding an early commitment to a cross-CLI context abstraction. Proceed only with explicit support boundaries and measurable cost, latency, or quality targets resolved during specification.Out of Scope (for the recommended option)
Assumptions to Validate
github-actions commentedon Oct 12, 2026
Feature assessment — per-step-reasoning-context · Stage 5/5: Decision — verdict needs-clarification
Decision: Per-step reasoning effort and context size
Scorecard
modelprecedent and dispatch boundaries, but demand is represented by one request and external CLI claims were not independently verified.Verdict & Rationale
Needs clarification. The problem is plausible and an effort-first option is shaped, but the evidence is not sufficient for a confident handoff: the request lacks quantified user impact, independently verified integration/version requirements, and measurable success thresholds. The unresolved context-size naming and support contract also materially affect scope. Clarify these points and revisit research and shape before deciding whether to specify.
If needs-clarification
+- Revisit stage: research, shape
mnriem commentedon Oct 12, 2026
I have marked it as a "Go", but please do address some of the clarification questions. Thanks!