Bug Description
Spec Kit’s generated clarification and planning workflows can operate on the wrong feature when an explicit issue target conflicts with the feature persisted in .specify/feature.json.
For example, the user invokes clarification with GitHub issue 285, while .specify/feature.json points to specs/286-tenant-pd-ordering. The prerequisite script resolves feature 286, but the generated workflow does not require comparing that result with the explicit 285 argument before writing files.
This creates a safety risk: specifications or planning artifacts for one feature can be modified while the user believes they are working on another feature.
Steps to Reproduce
-
Create two feature contexts, such as specs/285-semantic-milestones and specs/286-tenant-pd-ordering.
-
Persist feature 286 in .specify/feature.json:
{"feature_directory":"specs/286-tenant-pd-ordering"}
-
Invoke the clarification workflow with an explicit issue 285 target:
$speckit-clarify https://github.com/example/project/issues/285
-
Observe that check-prerequisites.sh --json --paths-only resolves specs/286-tenant-pd-ordering.
-
Observe that the generated workflow has no mandatory check comparing issue 285 from the command input with the resolved directory, specification traceability, or persisted feature state.
-
If processing continues, feature 286 may be analyzed or modified even though the user explicitly requested 285.
-
Invoke a chained command such as “run the plan”; the incorrect persisted target continues into the next stage.
Expected Behavior
Before reading or writing feature artifacts, the workflow should extract any explicit issue or feature identity from the command input and compare it with:
.specify/feature.json
- the resolved
FEATURE_DIR
- the feature-directory numeric prefix
- the specification’s issue traceability metadata
If these values disagree, the command should abort without modifying files and display a clear error such as:
ERROR: Feature context mismatch.
Requested target: GitHub issue 285
Active feature: specs/286-tenant-pd-ordering
Persisted by: .specify/feature.json
Run the specify workflow for 285 or explicitly switch the active feature.
Argument-less chained commands should retain the previously established feature target instead of silently switching to another persisted feature.
Actual Behavior
The prerequisite resolver uses .specify/feature.json and returns feature 286. The generated workflow does not mandate validation against the explicit 285 issue argument.
As a result, the agent can continue with feature 286 and modify its clarification or planning artifacts. No target-mismatch error is produced.
Specify CLI Version
1.0.1
AI Agent
Codex CLI
Operating System
macOS 26.6 (Darwin 25.6.0, arm64)
Python Version
Python 3.13.5
Error Logs
$ cat .specify/feature.json
{
"feature_directory": "specs/286-tenant-pd-ordering"
}
$ .specify/scripts/bash/check-prerequisites.sh --json --paths-only
{
"BRANCH": "286-tenant-pd-ordering",
"FEATURE_DIR": ".../specs/286-tenant-pd-ordering",
"FEATURE_SPEC": ".../specs/286-tenant-pd-ordering/spec.md",
"IMPL_PLAN": ".../specs/286-tenant-pd-ordering/plan.md",
"TASKS": ".../specs/286-tenant-pd-ordering/tasks.md"
}
Explicit workflow input:
https://github.com/example/project/issues/285
No error is emitted for the 285 versus 286 mismatch.
Additional Context
The Specify CLI reports Python 3.11.15 as its bundled runtime, while the system python3 --version reports Python 3.13.5.
The resolver’s current priority is:
SPECIFY_FEATURE_DIRECTORY
.specify/feature.json
- Error when no feature context exists
An issue URL supplied to a generated Spec Kit command is not part of this resolution or validation process.
This report concerns the safety behavior of generated Spec Kit workflows, not merely the persisted-feature resolver. Resolving from .specify/feature.json is valid when no explicit target is supplied. The defect is allowing an explicit target and persisted target to disagree without a mandatory abort.
A backward-compatible fix could activate target validation only when command input contains a recognizable issue URL, number, numeric feature identifier, or specs/<number>-<slug> path.
Bug Description
Spec Kit’s generated clarification and planning workflows can operate on the wrong feature when an explicit issue target conflicts with the feature persisted in
.specify/feature.json.For example, the user invokes clarification with GitHub issue 285, while
.specify/feature.jsonpoints tospecs/286-tenant-pd-ordering. The prerequisite script resolves feature 286, but the generated workflow does not require comparing that result with the explicit 285 argument before writing files.This creates a safety risk: specifications or planning artifacts for one feature can be modified while the user believes they are working on another feature.
Steps to Reproduce
Create two feature contexts, such as
specs/285-semantic-milestonesandspecs/286-tenant-pd-ordering.Persist feature 286 in
.specify/feature.json:{"feature_directory":"specs/286-tenant-pd-ordering"}
Invoke the clarification workflow with an explicit issue 285 target:
$speckit-clarify https://github.com/example/project/issues/285
Observe that
check-prerequisites.sh --json --paths-onlyresolvesspecs/286-tenant-pd-ordering.Observe that the generated workflow has no mandatory check comparing issue 285 from the command input with the resolved directory, specification traceability, or persisted feature state.
If processing continues, feature 286 may be analyzed or modified even though the user explicitly requested 285.
Invoke a chained command such as “run the plan”; the incorrect persisted target continues into the next stage.
Expected Behavior
Before reading or writing feature artifacts, the workflow should extract any explicit issue or feature identity from the command input and compare it with:
.specify/feature.jsonFEATURE_DIRIf these values disagree, the command should abort without modifying files and display a clear error such as:
ERROR: Feature context mismatch.
Requested target: GitHub issue 285
Active feature: specs/286-tenant-pd-ordering
Persisted by: .specify/feature.json
Run the specify workflow for 285 or explicitly switch the active feature.
Argument-less chained commands should retain the previously established feature target instead of silently switching to another persisted feature.
Actual Behavior
The prerequisite resolver uses
.specify/feature.jsonand returns feature 286. The generated workflow does not mandate validation against the explicit 285 issue argument.As a result, the agent can continue with feature 286 and modify its clarification or planning artifacts. No target-mismatch error is produced.
Specify CLI Version
1.0.1
AI Agent
Codex CLI
Operating System
macOS 26.6 (Darwin 25.6.0, arm64)
Python Version
Python 3.13.5
Error Logs
$ cat .specify/feature.json { "feature_directory": "specs/286-tenant-pd-ordering" } $ .specify/scripts/bash/check-prerequisites.sh --json --paths-only { "BRANCH": "286-tenant-pd-ordering", "FEATURE_DIR": ".../specs/286-tenant-pd-ordering", "FEATURE_SPEC": ".../specs/286-tenant-pd-ordering/spec.md", "IMPL_PLAN": ".../specs/286-tenant-pd-ordering/plan.md", "TASKS": ".../specs/286-tenant-pd-ordering/tasks.md" } Explicit workflow input: https://github.com/example/project/issues/285 No error is emitted for the 285 versus 286 mismatch.Additional Context
The Specify CLI reports Python 3.11.15 as its bundled runtime, while the system
python3 --versionreports Python 3.13.5.The resolver’s current priority is:
SPECIFY_FEATURE_DIRECTORY.specify/feature.jsonAn issue URL supplied to a generated Spec Kit command is not part of this resolution or validation process.
This report concerns the safety behavior of generated Spec Kit workflows, not merely the persisted-feature resolver. Resolving from
.specify/feature.jsonis valid when no explicit target is supplied. The defect is allowing an explicit target and persisted target to disagree without a mandatory abort.A backward-compatible fix could activate target validation only when command input contains a recognizable issue URL,
number, numeric feature identifier, orspecs/<number>-<slug>path.