devflow-toolkit 0.3.22__tar.gz → 0.3.24__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (84) hide show
  1. {devflow_toolkit-0.3.22 → devflow_toolkit-0.3.24}/CHANGELOG.md +67 -0
  2. {devflow_toolkit-0.3.22 → devflow_toolkit-0.3.24}/PKG-INFO +79 -7
  3. {devflow_toolkit-0.3.22 → devflow_toolkit-0.3.24}/README.md +15 -4
  4. {devflow_toolkit-0.3.22 → devflow_toolkit-0.3.24}/docs/REFERENCE.md +78 -6
  5. {devflow_toolkit-0.3.22 → devflow_toolkit-0.3.24}/pyproject.toml +1 -1
  6. {devflow_toolkit-0.3.22 → devflow_toolkit-0.3.24}/src/devflow/commands/status.py +27 -8
  7. {devflow_toolkit-0.3.22 → devflow_toolkit-0.3.24}/src/devflow/core/discovery.py +153 -25
  8. {devflow_toolkit-0.3.22 → devflow_toolkit-0.3.24}/src/devflow/core/spec_workflow.py +123 -8
  9. {devflow_toolkit-0.3.22 → devflow_toolkit-0.3.24}/src/devflow/core/specification.py +80 -6
  10. {devflow_toolkit-0.3.22 → devflow_toolkit-0.3.24}/src/devflow/prompts/__init__.py +40 -6
  11. {devflow_toolkit-0.3.22 → devflow_toolkit-0.3.24}/src/devflow/prompts/discovery.md +61 -3
  12. {devflow_toolkit-0.3.22 → devflow_toolkit-0.3.24}/src/devflow/prompts/spec.md +9 -4
  13. {devflow_toolkit-0.3.22 → devflow_toolkit-0.3.24}/tests/test_discovery.py +5 -3
  14. {devflow_toolkit-0.3.22 → devflow_toolkit-0.3.24}/tests/test_discovery_decisions.py +177 -0
  15. {devflow_toolkit-0.3.22 → devflow_toolkit-0.3.24}/tests/test_spec_workflow.py +214 -0
  16. {devflow_toolkit-0.3.22 → devflow_toolkit-0.3.24}/tests/test_state.py +51 -0
  17. {devflow_toolkit-0.3.22 → devflow_toolkit-0.3.24}/.gitignore +0 -0
  18. {devflow_toolkit-0.3.22 → devflow_toolkit-0.3.24}/LICENSE +0 -0
  19. {devflow_toolkit-0.3.22 → devflow_toolkit-0.3.24}/PUBLISHING.md +0 -0
  20. {devflow_toolkit-0.3.22 → devflow_toolkit-0.3.24}/src/devflow/__init__.py +0 -0
  21. {devflow_toolkit-0.3.22 → devflow_toolkit-0.3.24}/src/devflow/adapters/__init__.py +0 -0
  22. {devflow_toolkit-0.3.22 → devflow_toolkit-0.3.24}/src/devflow/adapters/agents.py +0 -0
  23. {devflow_toolkit-0.3.22 → devflow_toolkit-0.3.24}/src/devflow/adapters/antigravity.py +0 -0
  24. {devflow_toolkit-0.3.22 → devflow_toolkit-0.3.24}/src/devflow/adapters/base.py +0 -0
  25. {devflow_toolkit-0.3.22 → devflow_toolkit-0.3.24}/src/devflow/adapters/claude_code.py +0 -0
  26. {devflow_toolkit-0.3.22 → devflow_toolkit-0.3.24}/src/devflow/adapters/codex.py +0 -0
  27. {devflow_toolkit-0.3.22 → devflow_toolkit-0.3.24}/src/devflow/adapters/detector.py +0 -0
  28. {devflow_toolkit-0.3.22 → devflow_toolkit-0.3.24}/src/devflow/adapters/instructions.py +0 -0
  29. {devflow_toolkit-0.3.22 → devflow_toolkit-0.3.24}/src/devflow/adapters/kiro.py +0 -0
  30. {devflow_toolkit-0.3.22 → devflow_toolkit-0.3.24}/src/devflow/adapters/opencode.py +0 -0
  31. {devflow_toolkit-0.3.22 → devflow_toolkit-0.3.24}/src/devflow/adapters/registry.py +0 -0
  32. {devflow_toolkit-0.3.22 → devflow_toolkit-0.3.24}/src/devflow/cli.py +0 -0
  33. {devflow_toolkit-0.3.22 → devflow_toolkit-0.3.24}/src/devflow/commands/__init__.py +0 -0
  34. {devflow_toolkit-0.3.22 → devflow_toolkit-0.3.24}/src/devflow/commands/approve.py +0 -0
  35. {devflow_toolkit-0.3.22 → devflow_toolkit-0.3.24}/src/devflow/commands/config.py +0 -0
  36. {devflow_toolkit-0.3.22 → devflow_toolkit-0.3.24}/src/devflow/commands/doctor.py +0 -0
  37. {devflow_toolkit-0.3.22 → devflow_toolkit-0.3.24}/src/devflow/commands/harness.py +0 -0
  38. {devflow_toolkit-0.3.22 → devflow_toolkit-0.3.24}/src/devflow/commands/init.py +0 -0
  39. {devflow_toolkit-0.3.22 → devflow_toolkit-0.3.24}/src/devflow/commands/recover.py +0 -0
  40. {devflow_toolkit-0.3.22 → devflow_toolkit-0.3.24}/src/devflow/commands/reopen.py +0 -0
  41. {devflow_toolkit-0.3.22 → devflow_toolkit-0.3.24}/src/devflow/commands/spec.py +0 -0
  42. {devflow_toolkit-0.3.22 → devflow_toolkit-0.3.24}/src/devflow/core/__init__.py +0 -0
  43. {devflow_toolkit-0.3.22 → devflow_toolkit-0.3.24}/src/devflow/core/architecture.py +0 -0
  44. {devflow_toolkit-0.3.22 → devflow_toolkit-0.3.24}/src/devflow/core/artifacts/__init__.py +0 -0
  45. {devflow_toolkit-0.3.22 → devflow_toolkit-0.3.24}/src/devflow/core/artifacts/errors.py +0 -0
  46. {devflow_toolkit-0.3.22 → devflow_toolkit-0.3.24}/src/devflow/core/artifacts/models.py +0 -0
  47. {devflow_toolkit-0.3.22 → devflow_toolkit-0.3.24}/src/devflow/core/artifacts/store.py +0 -0
  48. {devflow_toolkit-0.3.22 → devflow_toolkit-0.3.24}/src/devflow/core/clock.py +0 -0
  49. {devflow_toolkit-0.3.22 → devflow_toolkit-0.3.24}/src/devflow/core/config.py +0 -0
  50. {devflow_toolkit-0.3.22 → devflow_toolkit-0.3.24}/src/devflow/core/constitution.py +0 -0
  51. {devflow_toolkit-0.3.22 → devflow_toolkit-0.3.24}/src/devflow/core/file_types.py +0 -0
  52. {devflow_toolkit-0.3.22 → devflow_toolkit-0.3.24}/src/devflow/core/ports.py +0 -0
  53. {devflow_toolkit-0.3.22 → devflow_toolkit-0.3.24}/src/devflow/core/profile_manager.py +0 -0
  54. {devflow_toolkit-0.3.22 → devflow_toolkit-0.3.24}/src/devflow/core/project.py +0 -0
  55. {devflow_toolkit-0.3.22 → devflow_toolkit-0.3.24}/src/devflow/core/recovery.py +0 -0
  56. {devflow_toolkit-0.3.22 → devflow_toolkit-0.3.24}/src/devflow/core/state/__init__.py +0 -0
  57. {devflow_toolkit-0.3.22 → devflow_toolkit-0.3.24}/src/devflow/core/state/errors.py +0 -0
  58. {devflow_toolkit-0.3.22 → devflow_toolkit-0.3.24}/src/devflow/core/state/events.py +0 -0
  59. {devflow_toolkit-0.3.22 → devflow_toolkit-0.3.24}/src/devflow/core/state/locator.py +0 -0
  60. {devflow_toolkit-0.3.22 → devflow_toolkit-0.3.24}/src/devflow/core/state/lock.py +0 -0
  61. {devflow_toolkit-0.3.22 → devflow_toolkit-0.3.24}/src/devflow/core/state/manager.py +0 -0
  62. {devflow_toolkit-0.3.22 → devflow_toolkit-0.3.24}/src/devflow/core/state/models.py +0 -0
  63. {devflow_toolkit-0.3.22 → devflow_toolkit-0.3.24}/src/devflow/core/state/transitions.py +0 -0
  64. {devflow_toolkit-0.3.22 → devflow_toolkit-0.3.24}/src/devflow/models/__init__.py +0 -0
  65. {devflow_toolkit-0.3.22 → devflow_toolkit-0.3.24}/src/devflow/models/profile.py +0 -0
  66. {devflow_toolkit-0.3.22 → devflow_toolkit-0.3.24}/src/devflow/models/project.py +0 -0
  67. {devflow_toolkit-0.3.22 → devflow_toolkit-0.3.24}/src/devflow/profiles/ai-rag/constitution/ai-rag-standards.md +0 -0
  68. {devflow_toolkit-0.3.22 → devflow_toolkit-0.3.24}/src/devflow/profiles/ai-rag/profile.yaml +0 -0
  69. {devflow_toolkit-0.3.22 → devflow_toolkit-0.3.24}/src/devflow/profiles/base/constitution/architecture.md +0 -0
  70. {devflow_toolkit-0.3.22 → devflow_toolkit-0.3.24}/src/devflow/profiles/base/constitution/code-standards.md +0 -0
  71. {devflow_toolkit-0.3.22 → devflow_toolkit-0.3.24}/src/devflow/profiles/base/constitution/constitution.md +0 -0
  72. {devflow_toolkit-0.3.22 → devflow_toolkit-0.3.24}/src/devflow/profiles/base/profile.yaml +0 -0
  73. {devflow_toolkit-0.3.22 → devflow_toolkit-0.3.24}/src/devflow/profiles/django-backend/constitution/django-standards.md +0 -0
  74. {devflow_toolkit-0.3.22 → devflow_toolkit-0.3.24}/src/devflow/profiles/django-backend/profile.yaml +0 -0
  75. {devflow_toolkit-0.3.22 → devflow_toolkit-0.3.24}/src/devflow/profiles/fastapi-backend/constitution/fastapi-standards.md +0 -0
  76. {devflow_toolkit-0.3.22 → devflow_toolkit-0.3.24}/src/devflow/profiles/fastapi-backend/profile.yaml +0 -0
  77. {devflow_toolkit-0.3.22 → devflow_toolkit-0.3.24}/src/devflow/prompts/discovery-repair.md +0 -0
  78. {devflow_toolkit-0.3.22 → devflow_toolkit-0.3.24}/tests/test_cli.py +0 -0
  79. {devflow_toolkit-0.3.22 → devflow_toolkit-0.3.24}/tests/test_event_log.py +0 -0
  80. {devflow_toolkit-0.3.22 → devflow_toolkit-0.3.24}/tests/test_greenfield.py +0 -0
  81. {devflow_toolkit-0.3.22 → devflow_toolkit-0.3.24}/tests/test_hardening.py +0 -0
  82. {devflow_toolkit-0.3.22 → devflow_toolkit-0.3.24}/tests/test_harness_adapters.py +0 -0
  83. {devflow_toolkit-0.3.22 → devflow_toolkit-0.3.24}/tests/test_recovery.py +0 -0
  84. {devflow_toolkit-0.3.22 → devflow_toolkit-0.3.24}/tests/test_state_replay.py +0 -0
@@ -2,6 +2,73 @@
2
2
 
3
3
  All notable changes to DevFlow Toolkit are documented in this file.
4
4
 
5
+ ## 0.3.24 - 2026-11-09
6
+
7
+ ### Added
8
+
9
+ - The specification agent can resolve up to 3 missing decisions in its
10
+ own interactive session, with the Discovery rules. The answers are
11
+ recorded in `discovery.yaml` as decisions resolved by the user, and
12
+ DevFlow writes the new Discovery digest into the spec header.
13
+
14
+ ### Changed
15
+
16
+ - The specification agent speaks to the user, and writes the questions
17
+ it adds, in the configured language.
18
+ - Completeness is always derived from the decisions: a record marked
19
+ `complete` with pending questions is read as `awaiting_clarification`,
20
+ and a question with `status: awaiting_clarification` or `open` is read
21
+ as `pending`.
22
+ - A `next_level` option marked as recommended is ignored, because the
23
+ recommended option is level 1.
24
+
25
+ ### Fixed
26
+
27
+ - The specification prompt no longer tells the agent to set a question
28
+ status to `awaiting_clarification`.
29
+ - When the specification agent leaves `discovery.yaml` invalid, DevFlow
30
+ no longer writes its deterministic draft. It stops and asks for
31
+ `devflow spec --continue`, which repairs the file.
32
+
33
+ ### Package
34
+
35
+ - Package version is `0.3.24`.
36
+
37
+ ## 0.3.23 - 2026-11-09
38
+
39
+ ### Added
40
+
41
+ - Level-based Discovery. The spec covers level 1 (essential behavior
42
+ with existing tools plus basic security). Every question can offer a
43
+ `next_level` option with a short explanation, and advanced decisions
44
+ are recorded in a new `deferred` list instead of being asked now.
45
+ - Suggested next specifications: deferred items and every unchosen
46
+ `next_level` option. They appear in the Decision Context, in
47
+ `devflow status`, in the `Next:` line after approval and in `spec.md`
48
+ section `10.1`, which DevFlow writes itself with a ready-to-run
49
+ `devflow spec "..."` command.
50
+ - A readiness check before Discovery closes, so the specification agent
51
+ does not find new decisions.
52
+
53
+ ### Changed
54
+
55
+ - In an interactive run, the specification agent checks for missing
56
+ decisions before writing. If one is missing, it appends the question
57
+ to `discovery.yaml` and stops without writing `spec.md`, instead of
58
+ writing a full spec that DevFlow discards.
59
+ - Security decisions are still always asked and never assumed; the
60
+ prompt now asks for a recommended basic option and a one-sentence
61
+ explanation.
62
+
63
+ ### Fixed
64
+
65
+ - Nested bullets under an open question in section 7 stay part of that
66
+ question instead of becoming separate questions without context.
67
+
68
+ ### Package
69
+
70
+ - Package version is `0.3.23`.
71
+
5
72
  ## 0.3.22 - 2026-11-09
6
73
 
7
74
  ### Added
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.5
2
2
  Name: devflow-toolkit
3
- Version: 0.3.22
3
+ Version: 0.3.24
4
4
  Summary: Specification workflow toolkit for AI-assisted software changes
5
5
  Author: DevFlow contributors
6
6
  License-Expression: MIT
@@ -32,7 +32,7 @@ Description-Content-Type: text/markdown
32
32
 
33
33
  # DevFlow Toolkit
34
34
 
35
- **Current version: `0.3.22`.**
35
+ **Current version: `0.3.24`.**
36
36
 
37
37
  DevFlow is a command-line toolkit for leading AI models and coding
38
38
  agents through specification-driven changes in real software projects.
@@ -152,7 +152,7 @@ pip install devflow-toolkit
152
152
  To install a specific built artifact instead:
153
153
 
154
154
  ```bash
155
- pip install devflow_toolkit-0.3.22-py3-none-any.whl
155
+ pip install devflow_toolkit-0.3.24-py3-none-any.whl
156
156
  ```
157
157
 
158
158
  Verify the installation:
@@ -428,7 +428,7 @@ as an architectural constraint when it is present.
428
428
 
429
429
  ### Harnesses
430
430
 
431
- | Harness | Status in 0.3.22 |
431
+ | Harness | Status in 0.3.24 |
432
432
  | --- | --- |
433
433
  | OpenCode | Verified end-to-end; interactive Discovery uses the `question` tool |
434
434
  | Antigravity | Custom agents and scoped permissions generated; `agy` loading and print mode verified |
@@ -683,6 +683,78 @@ appends the question to `discovery.yaml`, and returns the change to
683
683
  specification is generated. `devflow approve` rejects a
684
684
  specification that still lists open questions.
685
685
 
686
+ In an interactive run the specification agent checks for missing
687
+ decisions **before** writing:
688
+
689
+ - **Up to 3 missing decisions:** it asks you in the same session, with
690
+ the same rules as Discovery (recommended level-1 option first, a
691
+ next-level option with its reason, security never assumed). Your
692
+ answers are recorded in `discovery.yaml` as decisions resolved by you,
693
+ and then it writes the spec. DevFlow writes the new Discovery digest
694
+ into the spec header, because the agent cannot compute it.
695
+ - **More than 3, or no answer:** it records them as `pending`, sets the
696
+ record to `awaiting_clarification` and stops without writing
697
+ `spec.md`, so no tokens are spent on a document that would be
698
+ discarded.
699
+
700
+ If the agent leaves `discovery.yaml` invalid, DevFlow writes no
701
+ specification and asks you to run `devflow spec --continue`, which
702
+ repairs the file first. When an agent lists questions in section 7,
703
+ nested bullets stay part of the same question.
704
+
705
+ DevFlow derives completeness from the decisions themselves: a record
706
+ marked `complete` with pending questions is treated as
707
+ `awaiting_clarification`, and a question written with
708
+ `status: awaiting_clarification` is read as `pending`.
709
+
710
+ ### Level-based Discovery
711
+
712
+ Discovery builds the solution level by level instead of solving
713
+ everything at once:
714
+
715
+ 1. **Level 1 first.** The spec covers the essential behavior, built with
716
+ the tools the project already has, plus basic and obvious security.
717
+ 2. **Security is always asked, never assumed.** Basic security decisions
718
+ are explicit questions with a recommended option and a short
719
+ explanation, so the user learns them by answering.
720
+ 3. **Every question offers a next level.** One option takes the decision
721
+ one level further. It is recorded in `next_level`:
722
+
723
+ ```yaml
724
+ options:
725
+ - "Token valid until logout (basic)"
726
+ - "Token that expires after 24 hours"
727
+ next_level:
728
+ option: "Token that expires after 24 hours"
729
+ why: "Limits the damage if a token leaks."
730
+ ```
731
+
732
+ If the user chooses it, the answer uses that exact text. If not,
733
+ DevFlow treats it as a suggestion for a later specification. The
734
+ recommended option is level 1, so a `next_level` marked as
735
+ recommended is ignored.
736
+ 4. **No deeper than this level.** More advanced decisions found along
737
+ the way, and parts of a large request left for later, are recorded in
738
+ `deferred`:
739
+
740
+ ```yaml
741
+ deferred:
742
+ - title: "Limit failed login attempts"
743
+ why: "Protects accounts from password guessing."
744
+ question_id: Q2
745
+ ```
746
+
747
+ 5. **Readiness check.** Before closing, the agent confirms a decision
748
+ exists for every flow, interface, stored data, error case and level-1
749
+ security measure, and asks what is missing in the same round.
750
+
751
+ DevFlow collects `deferred` items and every unchosen `next_level` into
752
+ **suggested next specifications**. They appear in the Decision Context,
753
+ in `devflow status`, after approval in the `Next:` line, and in
754
+ `spec.md` section `10.1 Suggested next specifications`. DevFlow writes
755
+ that subsection itself, with a ready-to-run `devflow spec "..."` command
756
+ for each item; the agent does not write it.
757
+
686
758
  ## Workflow
687
759
 
688
760
  1. Initialize the project with `devflow init`.
@@ -696,7 +768,7 @@ specification that still lists open questions.
696
768
  8. If artifacts exist without workflow state, diagnose with
697
769
  `devflow doctor <id>` and repair with `devflow recover <id>`.
698
770
 
699
- Available commands in `0.3.22`:
771
+ Available commands in `0.3.24`:
700
772
 
701
773
  | Command | Status |
702
774
  | --- | --- |
@@ -929,7 +1001,7 @@ devflow approve 001
929
1001
  ```
930
1002
 
931
1003
  Approval is explicit and binds the decision to the current artifact
932
- digests. For a `0.3.22` change it binds `spec.md`, `discovery.yaml` and,
1004
+ digests. For a `0.3.24` change it binds `spec.md`, `discovery.yaml` and,
933
1005
  when a manifest applies, the architecture manifest digest. Repeating the
934
1006
  same approval is a no-op. If an artifact changes after validation,
935
1007
  DevFlow marks it stale and refuses approval until it is regenerated and
@@ -940,7 +1012,7 @@ and names the pending questions and assumptions. Approval also rejects a
940
1012
  specification whose section 7 still lists open questions. Legacy `0.2.0`
941
1013
  changes without `discovery.yaml` remain approvable with a warning.
942
1014
 
943
- Only the `spec` stage is available in `0.3.22`, so `--stage` is optional
1015
+ Only the `spec` stage is available in `0.3.24`, so `--stage` is optional
944
1016
  and defaults to `spec`. `--stage plan` and `--stage review` are
945
1017
  rejected. There are no `plan`, `implement` or
946
1018
  `review` commands in this release.
@@ -10,7 +10,7 @@ approved specification instead of a vague chat request.
10
10
  approval live in `.devflow/`, so any agent or teammate can pick up
11
11
  the work.
12
12
 
13
- Current version: `0.3.22` · Python 3.11+ · Linux and macOS
13
+ Current version: `0.3.24` · Python 3.11+ · Linux and macOS
14
14
 
15
15
  ## Install
16
16
 
@@ -63,6 +63,12 @@ agent says Discovery is done, **exit the chat** (for example `/exit`).
63
63
  DevFlow then checks the answers on your machine, without spending
64
64
  tokens.
65
65
 
66
+ Discovery works **level by level**. This spec covers the essentials
67
+ with the tools your project already has, plus basic security, which is
68
+ always asked, never assumed. Each question also offers a "next level"
69
+ option with a short explanation. Whatever you don't choose now becomes a
70
+ suggested next spec.
71
+
66
72
  ### 3. Continue until the spec is written
67
73
 
68
74
  ```bash
@@ -70,15 +76,18 @@ devflow spec --continue 001
70
76
  ```
71
77
 
72
78
  Each command opens at most one chat. Run it again if there are pending
73
- questions, and once more to write `spec.md`. Exit the chat only after
74
- the agent says `spec.md` is written.
79
+ questions, and once more to write `spec.md`. If the agent writing the
80
+ spec finds up to 3 missing decisions, it asks you right there and then
81
+ writes the spec. Exit the chat only after the agent says `spec.md` is
82
+ written.
75
83
 
76
84
  Prefer one command for both phases? Add `--auto` to the first command:
77
85
  `devflow spec "Add a contact form" --auto`.
78
86
 
79
87
  ### 4. Review and approve
80
88
 
81
- Read `.devflow/specs/001-…/spec.md`, then:
89
+ Read `.devflow/specs/001-…/spec.md`. Section 10.1 lists the suggested
90
+ next specs, each with its `devflow spec "..."` command. Then:
82
91
 
83
92
  ```bash
84
93
  devflow approve 001
@@ -131,6 +140,8 @@ written outside the normal flow.
131
140
  - **Fewer wasted tokens.** Questions are cheap; rewriting code after a
132
141
  misunderstanding is expensive. An approved spec avoids most of those
133
142
  rewrites.
143
+ - **Grow step by step.** After approval, `devflow status 001` suggests
144
+ the next level as a new spec.
134
145
  - **Small changes don't need DevFlow.** Use it when a change involves
135
146
  decisions: new features, integrations, refactors.
136
147
  - **Without a chat.** `--mode non-interactive` runs the agent in the
@@ -1,6 +1,6 @@
1
1
  # DevFlow Toolkit
2
2
 
3
- **Current version: `0.3.22`.**
3
+ **Current version: `0.3.24`.**
4
4
 
5
5
  DevFlow is a command-line toolkit for leading AI models and coding
6
6
  agents through specification-driven changes in real software projects.
@@ -120,7 +120,7 @@ pip install devflow-toolkit
120
120
  To install a specific built artifact instead:
121
121
 
122
122
  ```bash
123
- pip install devflow_toolkit-0.3.22-py3-none-any.whl
123
+ pip install devflow_toolkit-0.3.24-py3-none-any.whl
124
124
  ```
125
125
 
126
126
  Verify the installation:
@@ -396,7 +396,7 @@ as an architectural constraint when it is present.
396
396
 
397
397
  ### Harnesses
398
398
 
399
- | Harness | Status in 0.3.22 |
399
+ | Harness | Status in 0.3.24 |
400
400
  | --- | --- |
401
401
  | OpenCode | Verified end-to-end; interactive Discovery uses the `question` tool |
402
402
  | Antigravity | Custom agents and scoped permissions generated; `agy` loading and print mode verified |
@@ -651,6 +651,78 @@ appends the question to `discovery.yaml`, and returns the change to
651
651
  specification is generated. `devflow approve` rejects a
652
652
  specification that still lists open questions.
653
653
 
654
+ In an interactive run the specification agent checks for missing
655
+ decisions **before** writing:
656
+
657
+ - **Up to 3 missing decisions:** it asks you in the same session, with
658
+ the same rules as Discovery (recommended level-1 option first, a
659
+ next-level option with its reason, security never assumed). Your
660
+ answers are recorded in `discovery.yaml` as decisions resolved by you,
661
+ and then it writes the spec. DevFlow writes the new Discovery digest
662
+ into the spec header, because the agent cannot compute it.
663
+ - **More than 3, or no answer:** it records them as `pending`, sets the
664
+ record to `awaiting_clarification` and stops without writing
665
+ `spec.md`, so no tokens are spent on a document that would be
666
+ discarded.
667
+
668
+ If the agent leaves `discovery.yaml` invalid, DevFlow writes no
669
+ specification and asks you to run `devflow spec --continue`, which
670
+ repairs the file first. When an agent lists questions in section 7,
671
+ nested bullets stay part of the same question.
672
+
673
+ DevFlow derives completeness from the decisions themselves: a record
674
+ marked `complete` with pending questions is treated as
675
+ `awaiting_clarification`, and a question written with
676
+ `status: awaiting_clarification` is read as `pending`.
677
+
678
+ ### Level-based Discovery
679
+
680
+ Discovery builds the solution level by level instead of solving
681
+ everything at once:
682
+
683
+ 1. **Level 1 first.** The spec covers the essential behavior, built with
684
+ the tools the project already has, plus basic and obvious security.
685
+ 2. **Security is always asked, never assumed.** Basic security decisions
686
+ are explicit questions with a recommended option and a short
687
+ explanation, so the user learns them by answering.
688
+ 3. **Every question offers a next level.** One option takes the decision
689
+ one level further. It is recorded in `next_level`:
690
+
691
+ ```yaml
692
+ options:
693
+ - "Token valid until logout (basic)"
694
+ - "Token that expires after 24 hours"
695
+ next_level:
696
+ option: "Token that expires after 24 hours"
697
+ why: "Limits the damage if a token leaks."
698
+ ```
699
+
700
+ If the user chooses it, the answer uses that exact text. If not,
701
+ DevFlow treats it as a suggestion for a later specification. The
702
+ recommended option is level 1, so a `next_level` marked as
703
+ recommended is ignored.
704
+ 4. **No deeper than this level.** More advanced decisions found along
705
+ the way, and parts of a large request left for later, are recorded in
706
+ `deferred`:
707
+
708
+ ```yaml
709
+ deferred:
710
+ - title: "Limit failed login attempts"
711
+ why: "Protects accounts from password guessing."
712
+ question_id: Q2
713
+ ```
714
+
715
+ 5. **Readiness check.** Before closing, the agent confirms a decision
716
+ exists for every flow, interface, stored data, error case and level-1
717
+ security measure, and asks what is missing in the same round.
718
+
719
+ DevFlow collects `deferred` items and every unchosen `next_level` into
720
+ **suggested next specifications**. They appear in the Decision Context,
721
+ in `devflow status`, after approval in the `Next:` line, and in
722
+ `spec.md` section `10.1 Suggested next specifications`. DevFlow writes
723
+ that subsection itself, with a ready-to-run `devflow spec "..."` command
724
+ for each item; the agent does not write it.
725
+
654
726
  ## Workflow
655
727
 
656
728
  1. Initialize the project with `devflow init`.
@@ -664,7 +736,7 @@ specification that still lists open questions.
664
736
  8. If artifacts exist without workflow state, diagnose with
665
737
  `devflow doctor <id>` and repair with `devflow recover <id>`.
666
738
 
667
- Available commands in `0.3.22`:
739
+ Available commands in `0.3.24`:
668
740
 
669
741
  | Command | Status |
670
742
  | --- | --- |
@@ -897,7 +969,7 @@ devflow approve 001
897
969
  ```
898
970
 
899
971
  Approval is explicit and binds the decision to the current artifact
900
- digests. For a `0.3.22` change it binds `spec.md`, `discovery.yaml` and,
972
+ digests. For a `0.3.24` change it binds `spec.md`, `discovery.yaml` and,
901
973
  when a manifest applies, the architecture manifest digest. Repeating the
902
974
  same approval is a no-op. If an artifact changes after validation,
903
975
  DevFlow marks it stale and refuses approval until it is regenerated and
@@ -908,7 +980,7 @@ and names the pending questions and assumptions. Approval also rejects a
908
980
  specification whose section 7 still lists open questions. Legacy `0.2.0`
909
981
  changes without `discovery.yaml` remain approvable with a warning.
910
982
 
911
- Only the `spec` stage is available in `0.3.22`, so `--stage` is optional
983
+ Only the `spec` stage is available in `0.3.24`, so `--stage` is optional
912
984
  and defaults to `spec`. `--stage plan` and `--stage review` are
913
985
  rejected. There are no `plan`, `implement` or
914
986
  `review` commands in this release.
@@ -4,7 +4,7 @@ build-backend = "hatchling.build"
4
4
 
5
5
  [project]
6
6
  name = "devflow-toolkit"
7
- version = "0.3.22"
7
+ version = "0.3.24"
8
8
  description = "Specification workflow toolkit for AI-assisted software changes"
9
9
  readme = "docs/REFERENCE.md"
10
10
  license = "MIT"
@@ -14,7 +14,11 @@ from devflow.core.config import (
14
14
  ConfigManager,
15
15
  DevFlowConfig,
16
16
  )
17
- from devflow.core.discovery import DiscoveryError, DiscoveryManager
17
+ from devflow.core.discovery import (
18
+ DiscoveryDocument,
19
+ DiscoveryError,
20
+ DiscoveryManager,
21
+ )
18
22
  from devflow.core.project import ProjectDetector
19
23
  from devflow.core.state import (
20
24
  ChangeLocation,
@@ -99,7 +103,7 @@ def _status(spec_id: str, path: Path) -> None:
99
103
  else:
100
104
  console.print("\n[yellow]No artifacts are registered.[/yellow]")
101
105
 
102
- _print_discovery(config=config, location=location)
106
+ discovery = _print_discovery(config=config, location=location)
103
107
 
104
108
  if state.approvals:
105
109
  console.print("\n[bold]Approvals[/bold]")
@@ -123,7 +127,7 @@ def _status(spec_id: str, path: Path) -> None:
123
127
  "They are not approved and do not advance the change.[/dim]"
124
128
  )
125
129
 
126
- next_step = _next_step(current, location)
130
+ next_step = _next_step(current, location, discovery)
127
131
  if next_step:
128
132
  console.print(f"\n[bold]Next:[/bold] {next_step}")
129
133
 
@@ -131,6 +135,7 @@ def _status(spec_id: str, path: Path) -> None:
131
135
  def _next_step(
132
136
  current: ChangeStatus,
133
137
  location: ChangeLocation,
138
+ discovery: DiscoveryDocument | None = None,
134
139
  ) -> str:
135
140
  """Suggest the next action for the current workflow state."""
136
141
  state = current.state
@@ -152,7 +157,14 @@ def _next_step(
152
157
  if spec is not None
153
158
  else f"{location.change}/spec.md"
154
159
  )
155
- return f"ask your coding agent to implement `{spec_path}`"
160
+ step = f"ask your coding agent to implement `{spec_path}`"
161
+ suggestions = (
162
+ discovery.suggested_next_specs() if discovery is not None else ()
163
+ )
164
+ if suggestions:
165
+ title = suggestions[0].title.replace('"', "'")
166
+ step += f'. Next level: devflow spec "{title}"'
167
+ return step
156
168
  if (
157
169
  state.status == WorkflowStatus.DRAFT.value
158
170
  and spec is not None
@@ -171,18 +183,18 @@ def _print_discovery(
171
183
  *,
172
184
  config: DevFlowConfig,
173
185
  location: ChangeLocation,
174
- ) -> None:
186
+ ) -> DiscoveryDocument | None:
175
187
  manager = DiscoveryManager(config.root)
176
188
  if not manager.exists(location.directory):
177
- return
189
+ return None
178
190
  console.print("\n[bold]Discovery[/bold]")
179
191
  try:
180
192
  discovery = manager.load(location.directory, required=True)
181
193
  except DiscoveryError as error:
182
194
  console.print(f"[yellow]- invalid discovery: {error}[/yellow]")
183
- return
195
+ return None
184
196
  if discovery is None:
185
- return
197
+ return None
186
198
  console.print(
187
199
  f" status: {discovery.status} · "
188
200
  f"{len(discovery.pending_questions)} pending · "
@@ -214,3 +226,10 @@ def _print_discovery(
214
226
  f"{assumption.value}",
215
227
  soft_wrap=True,
216
228
  )
229
+
230
+ suggestions = discovery.suggested_next_specs()
231
+ if suggestions:
232
+ console.print("\n[bold]Suggested next specifications[/bold]")
233
+ for index, item in enumerate(suggestions, start=1):
234
+ console.print(f" {index}. {item.title}: {item.why}", soft_wrap=True)
235
+ return discovery