[Feature]: Per-step reasoning effort and context size for command steps, passed through like `model`
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(#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 (#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: #4275 (per-step integration config; Docker Agent is the only integration with
validate_runtime_config). - Related discussions: #3008 (Codex in workflows does not inherit the user's sandbox settings), #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.
Feature assessment — per-step-reasoning-context · Stage 1/5: Intake
Idea Intake: Per-step reasoning effort and context size
- Slug: per-step-reasoning-context
- Created: 2026-10-12T12:31:37Z
- Source: GitHub issue #4916 (https://github.com/github/spec-kit/issues/4916)
- Type: improvement
Idea (as captured)
A workflow author cannot set reasoning effort or context size per
commandstep. Different steps need different settings:speckit.planmay warrant high effort whilespeckit.tasksdoes not, and a step analyzing a large spec may need an extended context window.Proposed solution: add optional command-step fields
reasoning_effortandcontext_size, with analogous workflow defaults, step-to-workflow resolution, expression support, string validation, explicit unsupported-integration failures, step-output recording, resume re-resolution, and integration mappings. At least Codex, Copilot, and Claude (effort only) should implement mappings, with positive and negative deterministic tests. Update workflow documentation and document that command-stepoptions:is not forwarded to the CLI.Use cases include high effort for
specifyandplanand low effort fortasks, selecting effort through a workflow input, requesting a long context window for a large spec, and keeping per-step settings reproducible and reviewable in YAML rather than process-wide environment variables.
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
- Raised by: markuswondrak (issue author; contributor)
- Trigger: The issue reports that current command-step
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
- [NEEDS CLARIFICATION: Should the public field be named
context_size,context_window, or another term, given that integrations use different units and tiers?] - [NEEDS CLARIFICATION: Which exact integration versions and value vocabularies must be supported at launch, and how should version drift be handled?]
- [NEEDS CLARIFICATION: What is the expected behavior when a workflow default is set but a particular step or integration cannot support it?]
- [NEEDS CLARIFICATION: Are there existing workflow compatibility or migration constraints for adding new top-level fields and defaults?]
- [NEEDS CLARIFICATION: What measurable cost, latency, quality, or reproducibility improvement is expected from per-step settings?]
Generated by 💡 Assess a Feature Request by Installing and Running Spec Kit for #4916 · copilot · gpt52codex · 4.07 AIC · ⌖ 0.793 AIC · ⊞ 24.3K · ◷
Feature assessment — per-step-reasoning-context · Stage 2/5: Research
Idea Research: Per-step reasoning effort and context size
- Slug: per-step-reasoning-context
- Created: 2026-10-12T12:31:37Z
- Evidence confidence (overall): medium
Users & Demand
- The direct user signal is a contributor-submitted feature request describing workflow authors who need different effort and context settings for different commands, including
planversustasks, large-spec analysis, and workflow-input-driven configuration — source: GitHub issue #4916 (confidence: medium, cited). - The repository does not provide usage telemetry, support-ticket counts, or interview evidence quantifying how many workflow authors encounter this limitation — [source: repository inspection] (confidence: high, cited gap).
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).- Command dispatch currently passes
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 #4916] (confidence: high, cited).- Runtime
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). - Existing integration tests cover
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
- The current workaround described by the issue is
SPECKIT_INTEGRATION__EXTRA_ARGS, which is process-wide, CLI-specific, and not visible in workflow YAML — source: GitHub issue #4916 (confidence: medium, cited). - The proposal cites different mappings across Claude, Codex, Copilot, opencode, Antigravity, Kiro, Cursor, and Gemini, with context-size support narrower than effort support. Those CLI-version observations were supplied by the issue author and were not independently verified in this run — source: GitHub issue #4916 (confidence: low, cited but unverified).
- If nothing changes, workflow authors must continue using process-wide arguments, integration-specific configuration, or separate workflows/steps without per-step control — source: GitHub issue #4916 (confidence: medium, cited).
Data & Constraints
- The current integration host signature accepts
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). - The base class intentionally fails on unsupported runtime options rather than silently ignoring them, which supplies an existing error-handling pattern for opt-in support — [source:
src/specify_cli/integrations/base.py,validate_runtime_config] (confidence: high, cited). - Workflow state already records resolved command-step values such as
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). - No repository metric establishes acceptable added latency, token cost, context-window size, or quality change; target thresholds remain [NEEDS CLARIFICATION: measurable success thresholds].
Evidence Against the Idea
- Cross-integration semantics are not uniform: the issue reports that context size maps to a token count for one CLI and a tier for another, while several integrations have no direct flag. Opaque pass-through preserves flexibility but can make workflows less portable and harder to validate — source: GitHub issue #4916 (confidence: medium, cited).
- Supporting new keywords touches command validation, workflow defaults, dispatch contracts, multiple integrations, resume state, and documentation; the implementation and maintenance cost may exceed the value for users of integrations without mappings — source: repository inspection; GitHub issue #4916 (confidence: medium, cited).
- Demand is currently represented by one feature request and lacks quantified adoption or impact evidence — source: GitHub issue #4916 (confidence: high, cited).
Gaps & Open Questions
- [NEEDS CLARIFICATION: Which integrations are release-critical, and what exact values should each accept?]
- [NEEDS CLARIFICATION: Should context be supported only where a direct mapping exists, or should an integration-specific model alias remain the recommended path elsewhere?]
- [NEEDS CLARIFICATION: What compatibility promise is required when CLI flags or accepted values change between versions?]
- [NEEDS CLARIFICATION: What measurable reductions in cost/latency or improvements in quality/reproducibility justify the cross-integration work?]
- [NEEDS CLARIFICATION: What exact workflow schema and resume-state compatibility guarantees must be preserved?]
Sources
- https://github.com/github/spec-kit/issues/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)
Generated by 💡 Assess a Feature Request by Installing and Running Spec Kit for #4916 · copilot · gpt52codex · 4.07 AIC · ⌖ 0.793 AIC · ⊞ 24.3K · ◷
Feature assessment — per-step-reasoning-context · Stage 3/5: Problem
Problem Definition: Per-step reasoning effort and context size
- Slug: per-step-reasoning-context
- Created: 2026-10-12T12:31:37Z
- Inputs used: intake.md, research.md
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
- Users: Workflow authors — cannot declare or review per-step execution preferences in the workflow language.
- Users: Teams operating multi-step workflows — may pay unnecessary cost or latency for simple steps, or lack sufficient context for large-spec steps; the magnitude is [NEEDS CLARIFICATION].
- Stakeholders: Integration maintainers — would need to define support and failure behavior for settings whose meanings differ across CLIs.
- Stakeholders: Spec Kit maintainers — own workflow compatibility, dispatch contracts, resume behavior, tests, and documentation.
Goals
- Make step-specific execution preferences expressible and reviewable in workflow definitions.
- Preserve predictable fallback and expression behavior consistent with existing workflow settings.
- Ensure unsupported settings are surfaced explicitly rather than silently ignored.
- Enable teams to choose an appropriate cost/latency/context trade-off per step when their integration supports it.
Non-Goals
- Standardizing the meaning or allowed values of effort and context across all external CLIs.
- Designing detailed integration adapters, command-line mappings, schemas, or implementation tasks at this stage.
- Making every integration support every setting.
- Replacing model selection or solving unrelated workflow configuration gaps.
Success Metrics
- A workflow author can represent distinct settings for at least two command steps and inspect the resolved values in step state (target behavior; baseline: unavailable).
- Invalid non-string values and unsupported integration settings produce actionable step failures rather than silent success (target: 100% of covered negative cases; baseline: fields are not available).
- Supported integrations pass the resolved values to their CLI without changing existing behavior when fields are unset (target: positive and regression test coverage; baseline: no such fields).
- [NEEDS CLARIFICATION: target reduction in unnecessary cost/latency or target quality improvement for large-context steps.]
- [NEEDS CLARIFICATION: adoption or workflow-count threshold that would demonstrate meaningful user value.]
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
- [NEEDS CLARIFICATION: Which integrations and CLI versions are required for the first supported release?]
- [NEEDS CLARIFICATION: What field name and value contract best represent context settings across token-count and tier-based CLIs?]
- [NEEDS CLARIFICATION: What compatibility behavior is required when a workflow default targets an integration that cannot support it?]
- [NEEDS CLARIFICATION: What measurable cost, latency, quality, and adoption thresholds define success?]
Generated by 💡 Assess a Feature Request by Installing and Running Spec Kit for #4916 · copilot · gpt52codex · 4.07 AIC · ⌖ 0.793 AIC · ⊞ 24.3K · ◷
Feature assessment — per-step-reasoning-context · Stage 4/5: Concept
Concept: Per-step reasoning effort and context size
- Slug: per-step-reasoning-context
- Created: 2026-10-12T12:31:37Z
- Recommended option: Option A — Effort-first foundation
Options
Option A — Effort-first foundation
- Sketch: Make reasoning effort a first-class workflow setting for command steps, with inherited defaults and explicit unsupported-integration behavior. Defer context-size control until its cross-CLI semantics and user thresholds are clearer.
- Appetite: medium
- Trade-offs: Addresses the broader directly mappable use case while limiting the first release's semantic variance. It does not help workflows whose primary need is a larger context window, and it still requires integration-specific support and compatibility decisions.
- Rabbit holes: CLI version drift, value vocabulary differences, resume behavior, and deciding whether unsupported defaults fail at validation time or execution time.
Option B — Full opaque pass-through
- Sketch: Expose both reasoning effort and context size as opaque per-step settings and let each integration decide whether and how to interpret them, while surfacing unsupported settings.
- Appetite: large
- Trade-offs: Delivers the complete requested workflow author experience and preserves integration flexibility. It has the highest contract, documentation, testing, and maintenance burden, and workflows may be less portable because identical values can have different meanings.
- Rabbit holes: Supporting many integrations, documenting version-specific mappings, preserving resume semantics, and reconciling token-count versus tier-based context values.
Option C — Keep the current workaround
- Sketch: Do not add new workflow fields; document the process-wide extra-arguments workaround and recommend integration-specific configuration or model aliases where applicable.
- Appetite: small
- Trade-offs: Lowest maintenance cost and no schema or dispatch compatibility risk. It leaves per-step reproducibility and mixed-step cost/context control unresolved.
- Rabbit holes: Documentation can become a catalog of unstable CLI flags and may imply support the workflow system does not actually provide.
Recommendation
Recommend Option A. The problem and internal precedent for per-step model settings 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)
- Context-size controls in the first slice.
- A universal effort vocabulary or normalization layer across integrations.
- Detailed adapter architecture, CLI argument design, data models, or task breakdown.
- Making unsupported integrations silently accept or ignore the setting.
- Solving process-wide extra-argument behavior for unrelated settings.
Assumptions to Validate
- [NEEDS CLARIFICATION: At least one supported integration has enough demand and a stable effort mapping to justify the work.]
- [NEEDS CLARIFICATION: Workflow authors value reviewable per-step effort settings more than the simplicity of current workarounds.]
- [NEEDS CLARIFICATION: The project can define compatibility behavior for CLI version drift without promising universal portability.]
- [NEEDS CLARIFICATION: Positive and negative deterministic tests can establish no behavior change when the setting is unset.]
Generated by 💡 Assess a Feature Request by Installing and Running Spec Kit for #4916 · copilot · gpt52codex · 4.07 AIC · ⌖ 0.793 AIC · ⊞ 24.3K · ◷
Feature assessment — per-step-reasoning-context · Stage 5/5: Decision — verdict needs-clarification
Decision: Per-step reasoning effort and context size
- Slug: per-step-reasoning-context
- Decided: 2026-10-12T12:31:37Z
- Verdict: needs-clarification
- Artifacts reviewed: intake.md, research.md, problem.md, concept.md
Scorecard
| Criterion | Rating | Justification |
|---|---|---|
| Problem validity | adequate | The issue identifies a concrete mismatch between workflow authors' per-step needs and the currently process-wide or non-dispatched configuration paths; quantified impact is missing. |
| Evidence strength | adequate | The repository provides strong evidence of the existing model precedent and dispatch boundaries, but demand is represented by one request and external CLI claims were not independently verified. |
| Value vs. inaction | adequate | Reviewable per-step control could improve cost, latency, and reproducibility, while current workarounds remain process-wide; no measured baseline establishes the size of the benefit. |
| Feasibility / appetite | adequate | An effort-first concept fits a medium appetite and narrows semantic variance, but integration mappings, version drift, and resume behavior remain to be bounded. |
| Strategic fit | adequate | The proposal aligns with existing workflow configuration patterns and the project's integration architecture; explicit constitutional guidance for this feature was not identified. |
| Risk posture | weak | Cross-CLI semantics, support/version policy, compatibility behavior, and success thresholds are not yet resolved. |
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
- Blocking questions:
- [NEEDS CLARIFICATION: Which integrations and CLI versions are release-critical, and what exact effort values must be supported?]
- [NEEDS CLARIFICATION: What measured cost, latency, quality, or reproducibility improvement would justify the work?]
- [NEEDS CLARIFICATION: Is context size part of the first release, and what field/value semantics are acceptable across token-count and tier-based CLIs?]
- [NEEDS CLARIFICATION: What compatibility and failure behavior is required for unsupported integrations, defaults, and CLI version drift?]
- [NEEDS CLARIFICATION: Can a maintainer or user provide additional demand evidence beyond this single issue?] +- Revisit stage: research, shape
Generated by 💡 Assess a Feature Request by Installing and Running Spec Kit for #4916 · copilot · gpt52codex · 4.07 AIC · ⌖ 0.793 AIC · ⊞ 24.3K · ◷
I have marked it as a "Go", but please do address some of the clarification questions. Thanks!