devflow-toolkit 0.3.15__tar.gz → 0.3.16__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 (80) hide show
  1. {devflow_toolkit-0.3.15 → devflow_toolkit-0.3.16}/CHANGELOG.md +31 -0
  2. {devflow_toolkit-0.3.15 → devflow_toolkit-0.3.16}/PKG-INFO +68 -18
  3. {devflow_toolkit-0.3.15 → devflow_toolkit-0.3.16}/README.md +67 -17
  4. {devflow_toolkit-0.3.15 → devflow_toolkit-0.3.16}/pyproject.toml +1 -1
  5. {devflow_toolkit-0.3.15 → devflow_toolkit-0.3.16}/src/devflow/adapters/antigravity.py +7 -5
  6. {devflow_toolkit-0.3.15 → devflow_toolkit-0.3.16}/src/devflow/adapters/codex.py +2 -0
  7. {devflow_toolkit-0.3.15 → devflow_toolkit-0.3.16}/src/devflow/adapters/opencode.py +5 -3
  8. {devflow_toolkit-0.3.15 → devflow_toolkit-0.3.16}/src/devflow/cli.py +1 -1
  9. {devflow_toolkit-0.3.15 → devflow_toolkit-0.3.16}/src/devflow/commands/approve.py +1 -1
  10. {devflow_toolkit-0.3.15 → devflow_toolkit-0.3.16}/src/devflow/commands/spec.py +1 -0
  11. {devflow_toolkit-0.3.15 → devflow_toolkit-0.3.16}/src/devflow/commands/status.py +3 -1
  12. {devflow_toolkit-0.3.15 → devflow_toolkit-0.3.16}/src/devflow/core/config.py +126 -0
  13. {devflow_toolkit-0.3.15 → devflow_toolkit-0.3.16}/src/devflow/core/discovery.py +343 -40
  14. {devflow_toolkit-0.3.15 → devflow_toolkit-0.3.16}/src/devflow/core/ports.py +3 -0
  15. {devflow_toolkit-0.3.15 → devflow_toolkit-0.3.16}/src/devflow/core/spec_workflow.py +129 -0
  16. {devflow_toolkit-0.3.15 → devflow_toolkit-0.3.16}/src/devflow/prompts/__init__.py +214 -33
  17. devflow_toolkit-0.3.16/src/devflow/prompts/discovery.md +281 -0
  18. {devflow_toolkit-0.3.15 → devflow_toolkit-0.3.16}/tests/test_discovery.py +20 -0
  19. devflow_toolkit-0.3.16/tests/test_discovery_decisions.py +403 -0
  20. devflow_toolkit-0.3.15/src/devflow/prompts/discovery.md +0 -181
  21. {devflow_toolkit-0.3.15 → devflow_toolkit-0.3.16}/.gitignore +0 -0
  22. {devflow_toolkit-0.3.15 → devflow_toolkit-0.3.16}/LICENSE +0 -0
  23. {devflow_toolkit-0.3.15 → devflow_toolkit-0.3.16}/src/devflow/__init__.py +0 -0
  24. {devflow_toolkit-0.3.15 → devflow_toolkit-0.3.16}/src/devflow/adapters/__init__.py +0 -0
  25. {devflow_toolkit-0.3.15 → devflow_toolkit-0.3.16}/src/devflow/adapters/agents.py +0 -0
  26. {devflow_toolkit-0.3.15 → devflow_toolkit-0.3.16}/src/devflow/adapters/base.py +0 -0
  27. {devflow_toolkit-0.3.15 → devflow_toolkit-0.3.16}/src/devflow/adapters/claude_code.py +0 -0
  28. {devflow_toolkit-0.3.15 → devflow_toolkit-0.3.16}/src/devflow/adapters/detector.py +0 -0
  29. {devflow_toolkit-0.3.15 → devflow_toolkit-0.3.16}/src/devflow/adapters/instructions.py +0 -0
  30. {devflow_toolkit-0.3.15 → devflow_toolkit-0.3.16}/src/devflow/adapters/kiro.py +0 -0
  31. {devflow_toolkit-0.3.15 → devflow_toolkit-0.3.16}/src/devflow/adapters/registry.py +0 -0
  32. {devflow_toolkit-0.3.15 → devflow_toolkit-0.3.16}/src/devflow/commands/__init__.py +0 -0
  33. {devflow_toolkit-0.3.15 → devflow_toolkit-0.3.16}/src/devflow/commands/doctor.py +0 -0
  34. {devflow_toolkit-0.3.15 → devflow_toolkit-0.3.16}/src/devflow/commands/harness.py +0 -0
  35. {devflow_toolkit-0.3.15 → devflow_toolkit-0.3.16}/src/devflow/commands/init.py +0 -0
  36. {devflow_toolkit-0.3.15 → devflow_toolkit-0.3.16}/src/devflow/commands/recover.py +0 -0
  37. {devflow_toolkit-0.3.15 → devflow_toolkit-0.3.16}/src/devflow/core/__init__.py +0 -0
  38. {devflow_toolkit-0.3.15 → devflow_toolkit-0.3.16}/src/devflow/core/architecture.py +0 -0
  39. {devflow_toolkit-0.3.15 → devflow_toolkit-0.3.16}/src/devflow/core/artifacts/__init__.py +0 -0
  40. {devflow_toolkit-0.3.15 → devflow_toolkit-0.3.16}/src/devflow/core/artifacts/errors.py +0 -0
  41. {devflow_toolkit-0.3.15 → devflow_toolkit-0.3.16}/src/devflow/core/artifacts/models.py +0 -0
  42. {devflow_toolkit-0.3.15 → devflow_toolkit-0.3.16}/src/devflow/core/artifacts/store.py +0 -0
  43. {devflow_toolkit-0.3.15 → devflow_toolkit-0.3.16}/src/devflow/core/clock.py +0 -0
  44. {devflow_toolkit-0.3.15 → devflow_toolkit-0.3.16}/src/devflow/core/constitution.py +0 -0
  45. {devflow_toolkit-0.3.15 → devflow_toolkit-0.3.16}/src/devflow/core/profile_manager.py +0 -0
  46. {devflow_toolkit-0.3.15 → devflow_toolkit-0.3.16}/src/devflow/core/project.py +0 -0
  47. {devflow_toolkit-0.3.15 → devflow_toolkit-0.3.16}/src/devflow/core/recovery.py +0 -0
  48. {devflow_toolkit-0.3.15 → devflow_toolkit-0.3.16}/src/devflow/core/specification.py +0 -0
  49. {devflow_toolkit-0.3.15 → devflow_toolkit-0.3.16}/src/devflow/core/state/__init__.py +0 -0
  50. {devflow_toolkit-0.3.15 → devflow_toolkit-0.3.16}/src/devflow/core/state/errors.py +0 -0
  51. {devflow_toolkit-0.3.15 → devflow_toolkit-0.3.16}/src/devflow/core/state/events.py +0 -0
  52. {devflow_toolkit-0.3.15 → devflow_toolkit-0.3.16}/src/devflow/core/state/locator.py +0 -0
  53. {devflow_toolkit-0.3.15 → devflow_toolkit-0.3.16}/src/devflow/core/state/lock.py +0 -0
  54. {devflow_toolkit-0.3.15 → devflow_toolkit-0.3.16}/src/devflow/core/state/manager.py +0 -0
  55. {devflow_toolkit-0.3.15 → devflow_toolkit-0.3.16}/src/devflow/core/state/models.py +0 -0
  56. {devflow_toolkit-0.3.15 → devflow_toolkit-0.3.16}/src/devflow/core/state/transitions.py +0 -0
  57. {devflow_toolkit-0.3.15 → devflow_toolkit-0.3.16}/src/devflow/models/__init__.py +0 -0
  58. {devflow_toolkit-0.3.15 → devflow_toolkit-0.3.16}/src/devflow/models/profile.py +0 -0
  59. {devflow_toolkit-0.3.15 → devflow_toolkit-0.3.16}/src/devflow/models/project.py +0 -0
  60. {devflow_toolkit-0.3.15 → devflow_toolkit-0.3.16}/src/devflow/profiles/ai-rag/constitution/ai-rag-standards.md +0 -0
  61. {devflow_toolkit-0.3.15 → devflow_toolkit-0.3.16}/src/devflow/profiles/ai-rag/profile.yaml +0 -0
  62. {devflow_toolkit-0.3.15 → devflow_toolkit-0.3.16}/src/devflow/profiles/base/constitution/architecture.md +0 -0
  63. {devflow_toolkit-0.3.15 → devflow_toolkit-0.3.16}/src/devflow/profiles/base/constitution/code-standards.md +0 -0
  64. {devflow_toolkit-0.3.15 → devflow_toolkit-0.3.16}/src/devflow/profiles/base/constitution/constitution.md +0 -0
  65. {devflow_toolkit-0.3.15 → devflow_toolkit-0.3.16}/src/devflow/profiles/base/profile.yaml +0 -0
  66. {devflow_toolkit-0.3.15 → devflow_toolkit-0.3.16}/src/devflow/profiles/django-backend/constitution/django-standards.md +0 -0
  67. {devflow_toolkit-0.3.15 → devflow_toolkit-0.3.16}/src/devflow/profiles/django-backend/profile.yaml +0 -0
  68. {devflow_toolkit-0.3.15 → devflow_toolkit-0.3.16}/src/devflow/profiles/fastapi-backend/constitution/fastapi-standards.md +0 -0
  69. {devflow_toolkit-0.3.15 → devflow_toolkit-0.3.16}/src/devflow/profiles/fastapi-backend/profile.yaml +0 -0
  70. {devflow_toolkit-0.3.15 → devflow_toolkit-0.3.16}/src/devflow/prompts/spec.greenfield.md +0 -0
  71. {devflow_toolkit-0.3.15 → devflow_toolkit-0.3.16}/src/devflow/prompts/spec.md +0 -0
  72. {devflow_toolkit-0.3.15 → devflow_toolkit-0.3.16}/tests/test_cli.py +0 -0
  73. {devflow_toolkit-0.3.15 → devflow_toolkit-0.3.16}/tests/test_event_log.py +0 -0
  74. {devflow_toolkit-0.3.15 → devflow_toolkit-0.3.16}/tests/test_greenfield.py +0 -0
  75. {devflow_toolkit-0.3.15 → devflow_toolkit-0.3.16}/tests/test_hardening.py +0 -0
  76. {devflow_toolkit-0.3.15 → devflow_toolkit-0.3.16}/tests/test_harness_adapters.py +0 -0
  77. {devflow_toolkit-0.3.15 → devflow_toolkit-0.3.16}/tests/test_recovery.py +0 -0
  78. {devflow_toolkit-0.3.15 → devflow_toolkit-0.3.16}/tests/test_spec_workflow.py +0 -0
  79. {devflow_toolkit-0.3.15 → devflow_toolkit-0.3.16}/tests/test_state.py +0 -0
  80. {devflow_toolkit-0.3.15 → devflow_toolkit-0.3.16}/tests/test_state_replay.py +0 -0
@@ -2,6 +2,37 @@
2
2
 
3
3
  All notable changes to DevFlow Toolkit are documented in this file.
4
4
 
5
+ ## 0.3.16 - 2026-11-05
6
+
7
+ ### Added
8
+
9
+ - Discovery now uses a decision contract with three outcomes:
10
+ `resolved`, `assumed` and `pending`. Questions gain `materiality`,
11
+ `resolution_source` and `evidence`, while `pending`, `resolved` and
12
+ `assumed` replace the old answered/pending-only model.
13
+ - `decision-context.md` is generated deterministically for every
14
+ change. It contains project facts, conventions, approved decisions,
15
+ evidence, pending decisions and constraints, is token-capped, and
16
+ carries its own digest for new sessions.
17
+ - Discovery configuration adds question budgets, maximum rounds,
18
+ batching and assumption policy under `discovery` in
19
+ `.devflow/config.yaml`.
20
+ - Basic batching groups independent decisions into one interaction.
21
+ Harness limits are enforced; Codex is capped at three questions per
22
+ call.
23
+
24
+ ### Changed
25
+
26
+ - Discovery prefers evidence before questions and only asks for
27
+ decisions that materially change the result. Critical and security
28
+ decisions can never be assumed.
29
+ - OpenCode and Antigravity agent instructions now ask for one batched
30
+ question call per round instead of one call per question.
31
+ - Legacy discovery records remain loadable. `answered` is read as
32
+ `resolved`, and questions without an explicit materiality keep their
33
+ previous behavior.
34
+ - Package version is `0.3.16`.
35
+
5
36
  ## 0.3.15 - 2026-11-05
6
37
 
7
38
  ### Added
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.5
2
2
  Name: devflow-toolkit
3
- Version: 0.3.15
3
+ Version: 0.3.16
4
4
  Summary: Specification workflow toolkit for AI-assisted software changes
5
5
  Author: DevFlow contributors
6
6
  License-Expression: MIT
@@ -42,7 +42,7 @@ anyone starts implementing it. DevFlow owns the workflow state; the
42
42
  selected agent harness is only the execution backend that drafts the
43
43
  specification.
44
44
 
45
- This is the `0.3.15` MVP. It implements the **discovery and
45
+ This is the `0.3.16` MVP. It implements the **discovery and
46
46
  specification stages only**. It supports two specification contexts:
47
47
  **Existing Project** (the default) and **Greenfield**. It is not a
48
48
  complete SDD platform and does not include planning, implementation or
@@ -119,7 +119,7 @@ pip install devflow-toolkit
119
119
  To install a specific built artifact instead:
120
120
 
121
121
  ```bash
122
- pip install devflow_toolkit-0.3.15-py3-none-any.whl
122
+ pip install devflow_toolkit-0.3.16-py3-none-any.whl
123
123
  ```
124
124
 
125
125
  Verify the installation:
@@ -299,7 +299,7 @@ as an architectural constraint when it is present.
299
299
 
300
300
  ### Harnesses
301
301
 
302
- | Harness | Status in 0.3.15 |
302
+ | Harness | Status in 0.3.16 |
303
303
  | --- | --- |
304
304
  | OpenCode | Verified end-to-end; interactive Discovery uses the `question` tool |
305
305
  | Antigravity | Custom agents and scoped permissions generated; `agy` loading and print mode verified |
@@ -405,6 +405,7 @@ updated_at: "2026-11-02T10:00:00Z"
405
405
  questions:
406
406
  - id: Q1
407
407
  category: functional_scope
408
+ materiality: functional
408
409
  question: What should happen when the contact form is submitted?
409
410
  reason: Persistence, confirmation and email delivery change scope.
410
411
  blocking: true
@@ -413,9 +414,22 @@ questions:
413
414
  answer: null
414
415
  answered_by: null
415
416
  answered_at: null
417
+ - id: Q2
418
+ category: architecture_boundary
419
+ materiality: technical
420
+ question: Which form mechanism should the page use?
421
+ reason: The project already uses Django Forms.
422
+ blocking: false
423
+ status: resolved
424
+ resolution_source: evidence
425
+ evidence:
426
+ - "profiles/django-backend"
427
+ - "src/contact/forms.py:12"
428
+ answer: Reuse Django Forms.
429
+ options: []
416
430
  assumptions:
417
431
  - id: A1
418
- question_id: Q1
432
+ question_id: Q3
419
433
  value: Use `/contacto/` as the URL path.
420
434
  reason: Internal routing must be visible before approval.
421
435
  source: agent_default
@@ -424,14 +438,45 @@ assumptions:
424
438
  accepted_at: null
425
439
  ```
426
440
 
427
- Each question has a `category` and an explicit `blocking` flag. The
428
- categories are scope, user-visible behaviour, data and persistence,
429
- security and authentication, external integrations, architecture
430
- boundaries, new dependencies and deployment. The `blocking` flag
431
- prioritizes the conversation; it does not make a question optional.
432
- Every question, blocking or not, must be answered before
433
- `discovery.yaml` can be `complete` and before a specification can be
434
- generated.
441
+ Every decision has one outcome: `resolved`, `assumed` or `pending`.
442
+ A question presents a pending decision; an assumption is the acceptance
443
+ ledger for an assumed decision. Each decision has a `category`, a
444
+ `materiality` (`critical`, `functional`, `technical` or `cosmetic`) and
445
+ an explicit `blocking` flag.
446
+
447
+ - `pending` is valid only for blocking or material decisions.
448
+ - `resolved` by the user records `answer`, `answered_by` and
449
+ `answered_at`.
450
+ - `resolved` by evidence records `resolution_source: evidence` and at
451
+ least one `evidence` entry.
452
+ - `assumed` requires a linked assumption with explicit human acceptance.
453
+ Critical and security decisions can never be assumed.
454
+ - `answered` is a legacy alias that DevFlow reads as `resolved`.
455
+
456
+ A specification may only be generated when no decision is `pending` and
457
+ every assumption has been explicitly accepted. DevFlow validates the
458
+ record and confirms completeness; the agent never declares Discovery
459
+ complete on its own.
460
+
461
+ Discovery uses a per-round question budget and batches independent
462
+ decisions into one interaction. The defaults live in `.devflow/config.yaml`:
463
+
464
+ ```yaml
465
+ discovery:
466
+ question_budget:
467
+ initial: 6
468
+ follow_up: 3
469
+ maximum: 12
470
+ interaction:
471
+ batch_size: 6
472
+ max_rounds: 3
473
+ assumptions:
474
+ enabled: true
475
+ ```
476
+
477
+ The budget limits questions but never permits ignoring a critical
478
+ decision. If material decisions remain after the budget is exhausted,
479
+ Discovery stays incomplete and asks for intervention.
435
480
 
436
481
  The deterministic planner recognizes contact pages, forms, comments,
437
482
  authentication, persistence, deployments and architecture boundaries in
@@ -454,13 +499,18 @@ starts as `pending_acceptance`. It never becomes accepted automatically.
454
499
  A human must set `status: accepted` with `accepted_by` and `accepted_at`,
455
500
  or reject it and record a different decision.
456
501
 
457
- While any question or assumption remains unresolved:
502
+ While any decision is pending or any assumption remains unaccepted:
458
503
 
459
- - `discovery.yaml` and `context.md` are written;
504
+ - `discovery.yaml`, `context.md` and `decision-context.md` are written;
460
505
  - no `spec.md` is generated;
461
506
  - `devflow approve --stage spec` refuses the change;
462
507
  - the workflow status is `awaiting_clarification`.
463
508
 
509
+ `decision-context.md` is generated deterministically by DevFlow from
510
+ the project facts, conventions, approved decisions, evidence, pending
511
+ decisions and constraints. It is capped and carries its own digest, so
512
+ a new session does not need to rediscover the whole project.
513
+
464
514
  Answer the questions in the file, or run an interactive harness, then
465
515
  resume:
466
516
 
@@ -503,7 +553,7 @@ specification that still lists open questions.
503
553
  8. If artifacts exist without workflow state, diagnose with
504
554
  `devflow doctor <id>` and repair with `devflow recover <id>`.
505
555
 
506
- Available commands in `0.3.15`:
556
+ Available commands in `0.3.16`:
507
557
 
508
558
  | Command | Status |
509
559
  | --- | --- |
@@ -695,7 +745,7 @@ devflow approve 001 --stage spec
695
745
  ```
696
746
 
697
747
  Approval is explicit and binds the decision to the current artifact
698
- digests. For a `0.3.15` change it binds `spec.md`, `discovery.yaml` and,
748
+ digests. For a `0.3.16` change it binds `spec.md`, `discovery.yaml` and,
699
749
  when a manifest applies, the architecture manifest digest. Repeating the
700
750
  same approval is a no-op. If an artifact changes after validation,
701
751
  DevFlow marks it stale and refuses approval until it is regenerated and
@@ -706,7 +756,7 @@ and names the pending questions and assumptions. Approval also rejects a
706
756
  specification whose section 7 still lists open questions. Legacy `0.2.0`
707
757
  changes without `discovery.yaml` remain approvable with a warning.
708
758
 
709
- Only the `spec` stage is available in `0.3.15`. `--stage plan` and
759
+ Only the `spec` stage is available in `0.3.16`. `--stage plan` and
710
760
  `--stage review` are rejected. There are no `plan`, `implement` or
711
761
  `review` commands in this release.
712
762
 
@@ -10,7 +10,7 @@ anyone starts implementing it. DevFlow owns the workflow state; the
10
10
  selected agent harness is only the execution backend that drafts the
11
11
  specification.
12
12
 
13
- This is the `0.3.15` MVP. It implements the **discovery and
13
+ This is the `0.3.16` MVP. It implements the **discovery and
14
14
  specification stages only**. It supports two specification contexts:
15
15
  **Existing Project** (the default) and **Greenfield**. It is not a
16
16
  complete SDD platform and does not include planning, implementation or
@@ -87,7 +87,7 @@ pip install devflow-toolkit
87
87
  To install a specific built artifact instead:
88
88
 
89
89
  ```bash
90
- pip install devflow_toolkit-0.3.15-py3-none-any.whl
90
+ pip install devflow_toolkit-0.3.16-py3-none-any.whl
91
91
  ```
92
92
 
93
93
  Verify the installation:
@@ -267,7 +267,7 @@ as an architectural constraint when it is present.
267
267
 
268
268
  ### Harnesses
269
269
 
270
- | Harness | Status in 0.3.15 |
270
+ | Harness | Status in 0.3.16 |
271
271
  | --- | --- |
272
272
  | OpenCode | Verified end-to-end; interactive Discovery uses the `question` tool |
273
273
  | Antigravity | Custom agents and scoped permissions generated; `agy` loading and print mode verified |
@@ -373,6 +373,7 @@ updated_at: "2026-11-02T10:00:00Z"
373
373
  questions:
374
374
  - id: Q1
375
375
  category: functional_scope
376
+ materiality: functional
376
377
  question: What should happen when the contact form is submitted?
377
378
  reason: Persistence, confirmation and email delivery change scope.
378
379
  blocking: true
@@ -381,9 +382,22 @@ questions:
381
382
  answer: null
382
383
  answered_by: null
383
384
  answered_at: null
385
+ - id: Q2
386
+ category: architecture_boundary
387
+ materiality: technical
388
+ question: Which form mechanism should the page use?
389
+ reason: The project already uses Django Forms.
390
+ blocking: false
391
+ status: resolved
392
+ resolution_source: evidence
393
+ evidence:
394
+ - "profiles/django-backend"
395
+ - "src/contact/forms.py:12"
396
+ answer: Reuse Django Forms.
397
+ options: []
384
398
  assumptions:
385
399
  - id: A1
386
- question_id: Q1
400
+ question_id: Q3
387
401
  value: Use `/contacto/` as the URL path.
388
402
  reason: Internal routing must be visible before approval.
389
403
  source: agent_default
@@ -392,14 +406,45 @@ assumptions:
392
406
  accepted_at: null
393
407
  ```
394
408
 
395
- Each question has a `category` and an explicit `blocking` flag. The
396
- categories are scope, user-visible behaviour, data and persistence,
397
- security and authentication, external integrations, architecture
398
- boundaries, new dependencies and deployment. The `blocking` flag
399
- prioritizes the conversation; it does not make a question optional.
400
- Every question, blocking or not, must be answered before
401
- `discovery.yaml` can be `complete` and before a specification can be
402
- generated.
409
+ Every decision has one outcome: `resolved`, `assumed` or `pending`.
410
+ A question presents a pending decision; an assumption is the acceptance
411
+ ledger for an assumed decision. Each decision has a `category`, a
412
+ `materiality` (`critical`, `functional`, `technical` or `cosmetic`) and
413
+ an explicit `blocking` flag.
414
+
415
+ - `pending` is valid only for blocking or material decisions.
416
+ - `resolved` by the user records `answer`, `answered_by` and
417
+ `answered_at`.
418
+ - `resolved` by evidence records `resolution_source: evidence` and at
419
+ least one `evidence` entry.
420
+ - `assumed` requires a linked assumption with explicit human acceptance.
421
+ Critical and security decisions can never be assumed.
422
+ - `answered` is a legacy alias that DevFlow reads as `resolved`.
423
+
424
+ A specification may only be generated when no decision is `pending` and
425
+ every assumption has been explicitly accepted. DevFlow validates the
426
+ record and confirms completeness; the agent never declares Discovery
427
+ complete on its own.
428
+
429
+ Discovery uses a per-round question budget and batches independent
430
+ decisions into one interaction. The defaults live in `.devflow/config.yaml`:
431
+
432
+ ```yaml
433
+ discovery:
434
+ question_budget:
435
+ initial: 6
436
+ follow_up: 3
437
+ maximum: 12
438
+ interaction:
439
+ batch_size: 6
440
+ max_rounds: 3
441
+ assumptions:
442
+ enabled: true
443
+ ```
444
+
445
+ The budget limits questions but never permits ignoring a critical
446
+ decision. If material decisions remain after the budget is exhausted,
447
+ Discovery stays incomplete and asks for intervention.
403
448
 
404
449
  The deterministic planner recognizes contact pages, forms, comments,
405
450
  authentication, persistence, deployments and architecture boundaries in
@@ -422,13 +467,18 @@ starts as `pending_acceptance`. It never becomes accepted automatically.
422
467
  A human must set `status: accepted` with `accepted_by` and `accepted_at`,
423
468
  or reject it and record a different decision.
424
469
 
425
- While any question or assumption remains unresolved:
470
+ While any decision is pending or any assumption remains unaccepted:
426
471
 
427
- - `discovery.yaml` and `context.md` are written;
472
+ - `discovery.yaml`, `context.md` and `decision-context.md` are written;
428
473
  - no `spec.md` is generated;
429
474
  - `devflow approve --stage spec` refuses the change;
430
475
  - the workflow status is `awaiting_clarification`.
431
476
 
477
+ `decision-context.md` is generated deterministically by DevFlow from
478
+ the project facts, conventions, approved decisions, evidence, pending
479
+ decisions and constraints. It is capped and carries its own digest, so
480
+ a new session does not need to rediscover the whole project.
481
+
432
482
  Answer the questions in the file, or run an interactive harness, then
433
483
  resume:
434
484
 
@@ -471,7 +521,7 @@ specification that still lists open questions.
471
521
  8. If artifacts exist without workflow state, diagnose with
472
522
  `devflow doctor <id>` and repair with `devflow recover <id>`.
473
523
 
474
- Available commands in `0.3.15`:
524
+ Available commands in `0.3.16`:
475
525
 
476
526
  | Command | Status |
477
527
  | --- | --- |
@@ -663,7 +713,7 @@ devflow approve 001 --stage spec
663
713
  ```
664
714
 
665
715
  Approval is explicit and binds the decision to the current artifact
666
- digests. For a `0.3.15` change it binds `spec.md`, `discovery.yaml` and,
716
+ digests. For a `0.3.16` change it binds `spec.md`, `discovery.yaml` and,
667
717
  when a manifest applies, the architecture manifest digest. Repeating the
668
718
  same approval is a no-op. If an artifact changes after validation,
669
719
  DevFlow marks it stale and refuses approval until it is regenerated and
@@ -674,7 +724,7 @@ and names the pending questions and assumptions. Approval also rejects a
674
724
  specification whose section 7 still lists open questions. Legacy `0.2.0`
675
725
  changes without `discovery.yaml` remain approvable with a warning.
676
726
 
677
- Only the `spec` stage is available in `0.3.15`. `--stage plan` and
727
+ Only the `spec` stage is available in `0.3.16`. `--stage plan` and
678
728
  `--stage review` are rejected. There are no `plan`, `implement` or
679
729
  `review` commands in this release.
680
730
 
@@ -4,7 +4,7 @@ build-backend = "hatchling.build"
4
4
 
5
5
  [project]
6
6
  name = "devflow-toolkit"
7
- version = "0.3.15"
7
+ version = "0.3.16"
8
8
  description = "Specification workflow toolkit for AI-assisted software changes"
9
9
  readme = "README.md"
10
10
  license = "MIT"
@@ -256,11 +256,13 @@ class AntigravityAdapter(HarnessAdapter):
256
256
  if interactive:
257
257
  body.extend(
258
258
  [
259
- "During interactive Discovery, call the `ask_question` tool for "
260
- "every pending question and every assumption acceptance. "
261
- "Present the recorded options in the dialog instead of asking "
262
- "in free-form prose, and wait for the user's selection before "
263
- "recording an answer.",
259
+ "During interactive Discovery, call the `ask_question` tool "
260
+ "once per round with every independent pending decision, and "
261
+ "use it for assumption acceptance. Respect the batch size "
262
+ "from the task prompt instead of asking one question at a "
263
+ "time. Present the recorded options in the dialog instead of "
264
+ "asking in free-form prose, and wait for the user's selection "
265
+ "before recording anything.",
264
266
  "",
265
267
  ]
266
268
  )
@@ -23,6 +23,8 @@ class CodexAdapter(HarnessAdapter):
23
23
  name = "codex"
24
24
  display_name = "Codex"
25
25
  executable = "codex"
26
+ # Codex describes request_user_input as one to three short questions.
27
+ max_questions_per_call = 3
26
28
 
27
29
  def setup(self, context: SetupContext) -> SetupResult:
28
30
  content = render_agent_instructions(
@@ -194,11 +194,13 @@ class OpenCodeAdapter(HarnessAdapter):
194
194
  if interactive:
195
195
  body.extend(
196
196
  [
197
- "During interactive Discovery, call the `question` tool for "
198
- "every pending question and every assumption acceptance. "
197
+ "During interactive Discovery, call the `question` tool once "
198
+ "per round with every independent pending decision, and use "
199
+ "it for assumption acceptance. Respect the batch size from "
200
+ "the task prompt instead of asking one question at a time. "
199
201
  "Present the recorded options in the dialog instead of asking "
200
202
  "in free-form prose, and wait for the user's selection before "
201
- "recording an answer.",
203
+ "recording anything.",
202
204
  "",
203
205
  ]
204
206
  )
@@ -35,7 +35,7 @@ def version() -> None:
35
35
  try:
36
36
  current_version = package_version("devflow-toolkit")
37
37
  except PackageNotFoundError:
38
- current_version = "0.3.15"
38
+ current_version = "0.3.16"
39
39
  console.print(f"DevFlow v{current_version}")
40
40
 
41
41
 
@@ -57,7 +57,7 @@ def _approve(spec_id: str, path: Path, stage: str) -> None:
57
57
  normalized = stage.strip().lower()
58
58
  if normalized != "spec":
59
59
  msg = (
60
- f"Stage '{stage}' is not available in DevFlow 0.3.15. "
60
+ f"Stage '{stage}' is not available in DevFlow 0.3.16. "
61
61
  "Only the 'spec' stage can be approved."
62
62
  )
63
63
  raise UnsupportedStageError(msg)
@@ -248,6 +248,7 @@ def _create_specification(
248
248
  console.print(
249
249
  f"[bold]Discovery:[/bold] {result.discovery.status} "
250
250
  f"({len(result.discovery.pending_questions)} pending, "
251
+ f"{len(result.discovery.pending_material)} material, "
251
252
  f"{len(result.discovery.pending_assumptions)} assumptions)"
252
253
  )
253
254
  if result.discovery_digest:
@@ -130,6 +130,7 @@ def _print_discovery(
130
130
  f" status: {discovery.status} · "
131
131
  f"{len(discovery.pending_questions)} pending · "
132
132
  f"{len(discovery.pending_blocking)} blocking · "
133
+ f"{len(discovery.pending_material)} material · "
133
134
  f"{len(discovery.pending_assumptions)} assumptions"
134
135
  )
135
136
  for question in discovery.questions:
@@ -140,7 +141,8 @@ def _print_discovery(
140
141
  else " (pending)"
141
142
  )
142
143
  console.print(
143
- f" {question.id} [{question.category}, {marker}] "
144
+ f" {question.id} [{question.category}, "
145
+ f"{question.effective_materiality}, {marker}] "
144
146
  f"{question.status}{answer}",
145
147
  soft_wrap=True,
146
148
  )
@@ -23,6 +23,7 @@ DEFAULT_SPECIFICATIONS_PATH = Path(".devflow") / "specs"
23
23
  DEFAULT_PLANS_PATH = Path(".devflow") / "plans"
24
24
  DEFAULT_TEMPLATES_PATH = Path(".devflow") / "templates"
25
25
  DEFAULT_DOCUMENTATION_LANGUAGE = "en"
26
+ MAX_DISCOVERY_BUDGET = 100
26
27
 
27
28
  _LANGUAGE_ALIASES = {
28
29
  "aleman": "de",
@@ -207,6 +208,19 @@ class AgentSettings:
207
208
  permissions: AgentPermissions = AgentPermissions()
208
209
 
209
210
 
211
+ @dataclass(frozen=True)
212
+ class DiscoverySettings:
213
+ """Deterministic limits for the Discovery decision loop."""
214
+
215
+ question_budget_initial: int = 6
216
+ question_budget_follow_up: int = 3
217
+ question_budget_maximum: int = 12
218
+ max_rounds: int = 3
219
+ batch_size: int = 6
220
+ assumptions_enabled: bool = True
221
+ require_explicit_acceptance: bool = True
222
+
223
+
210
224
  @dataclass(frozen=True)
211
225
  class DevFlowConfig:
212
226
  """Validated DevFlow configuration for a project."""
@@ -224,6 +238,7 @@ class DevFlowConfig:
224
238
  templates_path: Path
225
239
  documentation_language: str
226
240
  agent: AgentSettings
241
+ discovery: DiscoverySettings = DiscoverySettings()
227
242
 
228
243
  @property
229
244
  def agent_harness(self) -> str:
@@ -296,6 +311,11 @@ class ConfigManager:
296
311
  )
297
312
  agent = self._mapping(data.get("agent", {}), "agent")
298
313
  agent_settings = self._agent_settings(agent)
314
+ discovery = self._mapping(
315
+ data.get("discovery", {}),
316
+ "discovery",
317
+ )
318
+ discovery_settings = self._discovery_settings(discovery)
299
319
 
300
320
  profiles = self._string_list(
301
321
  data.get("profiles", []),
@@ -383,6 +403,7 @@ class ConfigManager:
383
403
  templates_path=templates_path,
384
404
  documentation_language=documentation_language,
385
405
  agent=agent_settings,
406
+ discovery=discovery_settings,
386
407
  )
387
408
 
388
409
  def create(
@@ -459,6 +480,21 @@ class ConfigManager:
459
480
  "documentation": {
460
481
  "language": language,
461
482
  },
483
+ "discovery": {
484
+ "question_budget": {
485
+ "initial": 6,
486
+ "follow_up": 3,
487
+ "maximum": 12,
488
+ },
489
+ "interaction": {
490
+ "batch_size": 6,
491
+ "max_rounds": 3,
492
+ },
493
+ "assumptions": {
494
+ "enabled": True,
495
+ "require_explicit_acceptance": True,
496
+ },
497
+ },
462
498
  "agent": {
463
499
  "harness": harness,
464
500
  "execution": {
@@ -684,6 +720,78 @@ class ConfigManager:
684
720
  ),
685
721
  )
686
722
 
723
+ def _discovery_settings(
724
+ self,
725
+ discovery: dict[str, Any],
726
+ ) -> DiscoverySettings:
727
+ budget = self._mapping(
728
+ discovery.get("question_budget", {}),
729
+ "discovery.question_budget",
730
+ )
731
+ interaction = self._mapping(
732
+ discovery.get("interaction", {}),
733
+ "discovery.interaction",
734
+ )
735
+ assumptions = self._mapping(
736
+ discovery.get("assumptions", {}),
737
+ "discovery.assumptions",
738
+ )
739
+ initial = self._bounded_integer(
740
+ budget.get("initial", 6),
741
+ "discovery.question_budget.initial",
742
+ minimum=0,
743
+ maximum=100,
744
+ )
745
+ follow_up = self._bounded_integer(
746
+ budget.get("follow_up", 3),
747
+ "discovery.question_budget.follow_up",
748
+ minimum=0,
749
+ maximum=100,
750
+ )
751
+ maximum = self._bounded_integer(
752
+ budget.get("maximum", 12),
753
+ "discovery.question_budget.maximum",
754
+ minimum=0,
755
+ maximum=MAX_DISCOVERY_BUDGET,
756
+ )
757
+ if maximum and initial > maximum:
758
+ msg = (
759
+ "discovery.question_budget.initial cannot exceed "
760
+ "discovery.question_budget.maximum."
761
+ )
762
+ raise ConfigError(msg)
763
+ if maximum and follow_up > maximum:
764
+ msg = (
765
+ "discovery.question_budget.follow_up cannot exceed "
766
+ "discovery.question_budget.maximum."
767
+ )
768
+ raise ConfigError(msg)
769
+ return DiscoverySettings(
770
+ question_budget_initial=initial,
771
+ question_budget_follow_up=follow_up,
772
+ question_budget_maximum=maximum,
773
+ max_rounds=self._bounded_integer(
774
+ interaction.get("max_rounds", 3),
775
+ "discovery.interaction.max_rounds",
776
+ minimum=1,
777
+ maximum=20,
778
+ ),
779
+ batch_size=self._bounded_integer(
780
+ interaction.get("batch_size", 6),
781
+ "discovery.interaction.batch_size",
782
+ minimum=1,
783
+ maximum=20,
784
+ ),
785
+ assumptions_enabled=self._boolean(
786
+ assumptions.get("enabled", True),
787
+ "discovery.assumptions.enabled",
788
+ ),
789
+ require_explicit_acceptance=self._boolean(
790
+ assumptions.get("require_explicit_acceptance", True),
791
+ "discovery.assumptions.require_explicit_acceptance",
792
+ ),
793
+ )
794
+
687
795
  def _write_atomic(self, content: str) -> None:
688
796
  target = self._target_path()
689
797
  target.parent.mkdir(parents=True, exist_ok=True)
@@ -739,6 +847,24 @@ class ConfigManager:
739
847
  raise ConfigError(msg)
740
848
  return value
741
849
 
850
+ def _bounded_integer(
851
+ self,
852
+ value: Any,
853
+ field: str,
854
+ *,
855
+ minimum: int,
856
+ maximum: int,
857
+ ) -> int:
858
+ if isinstance(value, bool) or not isinstance(value, int):
859
+ msg = f"{field} must be an integer."
860
+ raise ConfigError(msg)
861
+ if value < minimum or value > maximum:
862
+ msg = (
863
+ f"{field} must be between {minimum} and {maximum}."
864
+ )
865
+ raise ConfigError(msg)
866
+ return value
867
+
742
868
  def _technologies(self, value: Any) -> dict[str, list[str]]:
743
869
  if value is None:
744
870
  return {}