devflow-toolkit 0.3.15__tar.gz → 0.3.17__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 (81) hide show
  1. {devflow_toolkit-0.3.15 → devflow_toolkit-0.3.17}/CHANGELOG.md +55 -0
  2. {devflow_toolkit-0.3.15 → devflow_toolkit-0.3.17}/PKG-INFO +99 -25
  3. {devflow_toolkit-0.3.15 → devflow_toolkit-0.3.17}/README.md +98 -24
  4. {devflow_toolkit-0.3.15 → devflow_toolkit-0.3.17}/pyproject.toml +1 -1
  5. {devflow_toolkit-0.3.15 → devflow_toolkit-0.3.17}/src/devflow/adapters/antigravity.py +7 -5
  6. {devflow_toolkit-0.3.15 → devflow_toolkit-0.3.17}/src/devflow/adapters/codex.py +2 -0
  7. {devflow_toolkit-0.3.15 → devflow_toolkit-0.3.17}/src/devflow/adapters/opencode.py +5 -3
  8. {devflow_toolkit-0.3.15 → devflow_toolkit-0.3.17}/src/devflow/cli.py +1 -1
  9. {devflow_toolkit-0.3.15 → devflow_toolkit-0.3.17}/src/devflow/commands/approve.py +1 -1
  10. {devflow_toolkit-0.3.15 → devflow_toolkit-0.3.17}/src/devflow/commands/spec.py +1 -0
  11. {devflow_toolkit-0.3.15 → devflow_toolkit-0.3.17}/src/devflow/commands/status.py +3 -1
  12. {devflow_toolkit-0.3.15 → devflow_toolkit-0.3.17}/src/devflow/core/config.py +126 -0
  13. {devflow_toolkit-0.3.15 → devflow_toolkit-0.3.17}/src/devflow/core/discovery.py +343 -40
  14. {devflow_toolkit-0.3.15 → devflow_toolkit-0.3.17}/src/devflow/core/ports.py +3 -0
  15. {devflow_toolkit-0.3.15 → devflow_toolkit-0.3.17}/src/devflow/core/spec_workflow.py +33 -5
  16. {devflow_toolkit-0.3.15 → devflow_toolkit-0.3.17}/src/devflow/core/specification.py +80 -109
  17. {devflow_toolkit-0.3.15 → devflow_toolkit-0.3.17}/src/devflow/profiles/base/constitution/code-standards.md +5 -4
  18. {devflow_toolkit-0.3.15 → devflow_toolkit-0.3.17}/src/devflow/profiles/base/constitution/constitution.md +25 -8
  19. devflow_toolkit-0.3.17/src/devflow/prompts/__init__.py +461 -0
  20. devflow_toolkit-0.3.17/src/devflow/prompts/discovery.md +280 -0
  21. devflow_toolkit-0.3.15/src/devflow/prompts/spec.greenfield.md → devflow_toolkit-0.3.17/src/devflow/prompts/spec.md +88 -24
  22. {devflow_toolkit-0.3.15 → devflow_toolkit-0.3.17}/tests/test_discovery.py +23 -0
  23. devflow_toolkit-0.3.17/tests/test_discovery_decisions.py +403 -0
  24. {devflow_toolkit-0.3.15 → devflow_toolkit-0.3.17}/tests/test_greenfield.py +19 -0
  25. {devflow_toolkit-0.3.15 → devflow_toolkit-0.3.17}/tests/test_hardening.py +1 -1
  26. {devflow_toolkit-0.3.15 → devflow_toolkit-0.3.17}/tests/test_harness_adapters.py +37 -1
  27. {devflow_toolkit-0.3.15 → devflow_toolkit-0.3.17}/tests/test_spec_workflow.py +1 -1
  28. devflow_toolkit-0.3.15/src/devflow/prompts/__init__.py +0 -290
  29. devflow_toolkit-0.3.15/src/devflow/prompts/discovery.md +0 -181
  30. devflow_toolkit-0.3.15/src/devflow/prompts/spec.md +0 -126
  31. {devflow_toolkit-0.3.15 → devflow_toolkit-0.3.17}/.gitignore +0 -0
  32. {devflow_toolkit-0.3.15 → devflow_toolkit-0.3.17}/LICENSE +0 -0
  33. {devflow_toolkit-0.3.15 → devflow_toolkit-0.3.17}/src/devflow/__init__.py +0 -0
  34. {devflow_toolkit-0.3.15 → devflow_toolkit-0.3.17}/src/devflow/adapters/__init__.py +0 -0
  35. {devflow_toolkit-0.3.15 → devflow_toolkit-0.3.17}/src/devflow/adapters/agents.py +0 -0
  36. {devflow_toolkit-0.3.15 → devflow_toolkit-0.3.17}/src/devflow/adapters/base.py +0 -0
  37. {devflow_toolkit-0.3.15 → devflow_toolkit-0.3.17}/src/devflow/adapters/claude_code.py +0 -0
  38. {devflow_toolkit-0.3.15 → devflow_toolkit-0.3.17}/src/devflow/adapters/detector.py +0 -0
  39. {devflow_toolkit-0.3.15 → devflow_toolkit-0.3.17}/src/devflow/adapters/instructions.py +0 -0
  40. {devflow_toolkit-0.3.15 → devflow_toolkit-0.3.17}/src/devflow/adapters/kiro.py +0 -0
  41. {devflow_toolkit-0.3.15 → devflow_toolkit-0.3.17}/src/devflow/adapters/registry.py +0 -0
  42. {devflow_toolkit-0.3.15 → devflow_toolkit-0.3.17}/src/devflow/commands/__init__.py +0 -0
  43. {devflow_toolkit-0.3.15 → devflow_toolkit-0.3.17}/src/devflow/commands/doctor.py +0 -0
  44. {devflow_toolkit-0.3.15 → devflow_toolkit-0.3.17}/src/devflow/commands/harness.py +0 -0
  45. {devflow_toolkit-0.3.15 → devflow_toolkit-0.3.17}/src/devflow/commands/init.py +0 -0
  46. {devflow_toolkit-0.3.15 → devflow_toolkit-0.3.17}/src/devflow/commands/recover.py +0 -0
  47. {devflow_toolkit-0.3.15 → devflow_toolkit-0.3.17}/src/devflow/core/__init__.py +0 -0
  48. {devflow_toolkit-0.3.15 → devflow_toolkit-0.3.17}/src/devflow/core/architecture.py +0 -0
  49. {devflow_toolkit-0.3.15 → devflow_toolkit-0.3.17}/src/devflow/core/artifacts/__init__.py +0 -0
  50. {devflow_toolkit-0.3.15 → devflow_toolkit-0.3.17}/src/devflow/core/artifacts/errors.py +0 -0
  51. {devflow_toolkit-0.3.15 → devflow_toolkit-0.3.17}/src/devflow/core/artifacts/models.py +0 -0
  52. {devflow_toolkit-0.3.15 → devflow_toolkit-0.3.17}/src/devflow/core/artifacts/store.py +0 -0
  53. {devflow_toolkit-0.3.15 → devflow_toolkit-0.3.17}/src/devflow/core/clock.py +0 -0
  54. {devflow_toolkit-0.3.15 → devflow_toolkit-0.3.17}/src/devflow/core/constitution.py +0 -0
  55. {devflow_toolkit-0.3.15 → devflow_toolkit-0.3.17}/src/devflow/core/profile_manager.py +0 -0
  56. {devflow_toolkit-0.3.15 → devflow_toolkit-0.3.17}/src/devflow/core/project.py +0 -0
  57. {devflow_toolkit-0.3.15 → devflow_toolkit-0.3.17}/src/devflow/core/recovery.py +0 -0
  58. {devflow_toolkit-0.3.15 → devflow_toolkit-0.3.17}/src/devflow/core/state/__init__.py +0 -0
  59. {devflow_toolkit-0.3.15 → devflow_toolkit-0.3.17}/src/devflow/core/state/errors.py +0 -0
  60. {devflow_toolkit-0.3.15 → devflow_toolkit-0.3.17}/src/devflow/core/state/events.py +0 -0
  61. {devflow_toolkit-0.3.15 → devflow_toolkit-0.3.17}/src/devflow/core/state/locator.py +0 -0
  62. {devflow_toolkit-0.3.15 → devflow_toolkit-0.3.17}/src/devflow/core/state/lock.py +0 -0
  63. {devflow_toolkit-0.3.15 → devflow_toolkit-0.3.17}/src/devflow/core/state/manager.py +0 -0
  64. {devflow_toolkit-0.3.15 → devflow_toolkit-0.3.17}/src/devflow/core/state/models.py +0 -0
  65. {devflow_toolkit-0.3.15 → devflow_toolkit-0.3.17}/src/devflow/core/state/transitions.py +0 -0
  66. {devflow_toolkit-0.3.15 → devflow_toolkit-0.3.17}/src/devflow/models/__init__.py +0 -0
  67. {devflow_toolkit-0.3.15 → devflow_toolkit-0.3.17}/src/devflow/models/profile.py +0 -0
  68. {devflow_toolkit-0.3.15 → devflow_toolkit-0.3.17}/src/devflow/models/project.py +0 -0
  69. {devflow_toolkit-0.3.15 → devflow_toolkit-0.3.17}/src/devflow/profiles/ai-rag/constitution/ai-rag-standards.md +0 -0
  70. {devflow_toolkit-0.3.15 → devflow_toolkit-0.3.17}/src/devflow/profiles/ai-rag/profile.yaml +0 -0
  71. {devflow_toolkit-0.3.15 → devflow_toolkit-0.3.17}/src/devflow/profiles/base/constitution/architecture.md +0 -0
  72. {devflow_toolkit-0.3.15 → devflow_toolkit-0.3.17}/src/devflow/profiles/base/profile.yaml +0 -0
  73. {devflow_toolkit-0.3.15 → devflow_toolkit-0.3.17}/src/devflow/profiles/django-backend/constitution/django-standards.md +0 -0
  74. {devflow_toolkit-0.3.15 → devflow_toolkit-0.3.17}/src/devflow/profiles/django-backend/profile.yaml +0 -0
  75. {devflow_toolkit-0.3.15 → devflow_toolkit-0.3.17}/src/devflow/profiles/fastapi-backend/constitution/fastapi-standards.md +0 -0
  76. {devflow_toolkit-0.3.15 → devflow_toolkit-0.3.17}/src/devflow/profiles/fastapi-backend/profile.yaml +0 -0
  77. {devflow_toolkit-0.3.15 → devflow_toolkit-0.3.17}/tests/test_cli.py +0 -0
  78. {devflow_toolkit-0.3.15 → devflow_toolkit-0.3.17}/tests/test_event_log.py +0 -0
  79. {devflow_toolkit-0.3.15 → devflow_toolkit-0.3.17}/tests/test_recovery.py +0 -0
  80. {devflow_toolkit-0.3.15 → devflow_toolkit-0.3.17}/tests/test_state.py +0 -0
  81. {devflow_toolkit-0.3.15 → devflow_toolkit-0.3.17}/tests/test_state_replay.py +0 -0
@@ -2,6 +2,61 @@
2
2
 
3
3
  All notable changes to DevFlow Toolkit are documented in this file.
4
4
 
5
+ ## 0.3.17 - 2026-11-06
6
+
7
+ ### Changed
8
+
9
+ - `context.md` is now the single generated context file. Its
10
+ `## 1. Decision Context` section merges the former
11
+ `decision-context.md` with project facts, conventions, approved
12
+ decisions, evidence and pending decisions. Its
13
+ `## 2. Project Evidence` section contains the request, static
14
+ analysis, relevant code, constitution scope and declared architecture.
15
+ - Removed the separate `decision-context.md` artifact, its digest and
16
+ the inline discovery decision list from the specification prompt.
17
+ - The base constitution now defines a single `Instruction Precedence`
18
+ hierarchy. The Discovery and specification prompts reference it
19
+ instead of repeating conflict rules.
20
+ - `spec.md` is now a single template with `existing` and `greenfield`
21
+ conditional blocks. `spec.greenfield.md` was removed.
22
+ - Discovery resolves decisions in one order: explicit user answers,
23
+ constitution and profiles, declared architecture, existing code,
24
+ previous specifications and reversible defaults.
25
+ - The code standards no longer require one line per parameter when a
26
+ function has more than two parameters.
27
+ - Package version is `0.3.17`.
28
+
29
+ ## 0.3.16 - 2026-11-05
30
+
31
+ ### Added
32
+
33
+ - Discovery now uses a decision contract with three outcomes:
34
+ `resolved`, `assumed` and `pending`. Questions gain `materiality`,
35
+ `resolution_source` and `evidence`, while `pending`, `resolved` and
36
+ `assumed` replace the old answered/pending-only model.
37
+ - `decision-context.md` is generated deterministically for every
38
+ change. It contains project facts, conventions, approved decisions,
39
+ evidence, pending decisions and constraints, is token-capped, and
40
+ carries its own digest for new sessions.
41
+ - Discovery configuration adds question budgets, maximum rounds,
42
+ batching and assumption policy under `discovery` in
43
+ `.devflow/config.yaml`.
44
+ - Basic batching groups independent decisions into one interaction.
45
+ Harness limits are enforced; Codex is capped at three questions per
46
+ call.
47
+
48
+ ### Changed
49
+
50
+ - Discovery prefers evidence before questions and only asks for
51
+ decisions that materially change the result. Critical and security
52
+ decisions can never be assumed.
53
+ - OpenCode and Antigravity agent instructions now ask for one batched
54
+ question call per round instead of one call per question.
55
+ - Legacy discovery records remain loadable. `answered` is read as
56
+ `resolved`, and questions without an explicit materiality keep their
57
+ previous behavior.
58
+ - Package version is `0.3.16`.
59
+
5
60
  ## 0.3.15 - 2026-11-05
6
61
 
7
62
  ### 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.17
4
4
  Summary: Specification workflow toolkit for AI-assisted software changes
5
5
  Author: DevFlow contributors
6
6
  License-Expression: MIT
@@ -42,16 +42,16 @@ 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.17` 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
49
49
  review workflows.
50
50
 
51
51
  Discovery decides whether a request is ready to become a
52
- specification. A specification is only generated when every question
53
- has an explicit answer and every proposed assumption has been
54
- explicitly accepted. Discovery is persisted, so an incomplete request
52
+ specification. A specification is only generated when every decision is
53
+ `resolved` or `assumed`, and every assumption has been explicitly
54
+ accepted. Discovery is persisted, so an incomplete request
55
55
  can be resumed across sessions and agent harnesses. Discovery is also
56
56
  the requirement-gathering stage: ambiguity, authentication,
57
57
  permissions, moderation, data lifecycle, validation, ordering,
@@ -95,6 +95,26 @@ identity for the project:
95
95
  - DevFlow never switches modes silently. Use `--project-mode` explicitly
96
96
  when a run differs from the configured default.
97
97
 
98
+ ## Instruction precedence
99
+
100
+ Every generated `context.md` has two numbered sections: the
101
+ `Decision Context` and the `Project Evidence`. The Decision Context is
102
+ authoritative for decisions; the Project Evidence supports it. When
103
+ instructions conflict, DevFlow applies this order, highest priority
104
+ first:
105
+
106
+ 1. Explicit decisions approved by the user.
107
+ 2. The approved specification.
108
+ 3. The constitution and the enabled technology profiles.
109
+ 4. The declared architecture and verified project conventions.
110
+ 5. General good practices.
111
+ 6. Agent preferences.
112
+
113
+ A lower-priority instruction never overrides a higher-priority one. When
114
+ two instructions at the same level conflict, the agent asks instead of
115
+ resolving the conflict silently. The prompts state the output contract;
116
+ DevFlow's Python code applies the enforcement.
117
+
98
118
  ## Requirements
99
119
 
100
120
  - Python 3.11 or newer.
@@ -119,7 +139,7 @@ pip install devflow-toolkit
119
139
  To install a specific built artifact instead:
120
140
 
121
141
  ```bash
122
- pip install devflow_toolkit-0.3.15-py3-none-any.whl
142
+ pip install devflow_toolkit-0.3.17-py3-none-any.whl
123
143
  ```
124
144
 
125
145
  Verify the installation:
@@ -299,7 +319,7 @@ as an architectural constraint when it is present.
299
319
 
300
320
  ### Harnesses
301
321
 
302
- | Harness | Status in 0.3.15 |
322
+ | Harness | Status in 0.3.17 |
303
323
  | --- | --- |
304
324
  | OpenCode | Verified end-to-end; interactive Discovery uses the `question` tool |
305
325
  | Antigravity | Custom agents and scoped permissions generated; `agy` loading and print mode verified |
@@ -405,6 +425,7 @@ updated_at: "2026-11-02T10:00:00Z"
405
425
  questions:
406
426
  - id: Q1
407
427
  category: functional_scope
428
+ materiality: functional
408
429
  question: What should happen when the contact form is submitted?
409
430
  reason: Persistence, confirmation and email delivery change scope.
410
431
  blocking: true
@@ -413,9 +434,22 @@ questions:
413
434
  answer: null
414
435
  answered_by: null
415
436
  answered_at: null
437
+ - id: Q2
438
+ category: architecture_boundary
439
+ materiality: technical
440
+ question: Which form mechanism should the page use?
441
+ reason: The project already uses Django Forms.
442
+ blocking: false
443
+ status: resolved
444
+ resolution_source: evidence
445
+ evidence:
446
+ - "profiles/django-backend"
447
+ - "src/contact/forms.py:12"
448
+ answer: Reuse Django Forms.
449
+ options: []
416
450
  assumptions:
417
451
  - id: A1
418
- question_id: Q1
452
+ question_id: Q3
419
453
  value: Use `/contacto/` as the URL path.
420
454
  reason: Internal routing must be visible before approval.
421
455
  source: agent_default
@@ -424,14 +458,45 @@ assumptions:
424
458
  accepted_at: null
425
459
  ```
426
460
 
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.
461
+ Every decision has one outcome: `resolved`, `assumed` or `pending`.
462
+ A question presents a pending decision; an assumption is the acceptance
463
+ ledger for an assumed decision. Each decision has a `category`, a
464
+ `materiality` (`critical`, `functional`, `technical` or `cosmetic`) and
465
+ an explicit `blocking` flag.
466
+
467
+ - `pending` is valid only for blocking or material decisions.
468
+ - `resolved` by the user records `answer`, `answered_by` and
469
+ `answered_at`.
470
+ - `resolved` by evidence records `resolution_source: evidence` and at
471
+ least one `evidence` entry.
472
+ - `assumed` requires a linked assumption with explicit human acceptance.
473
+ Critical and security decisions can never be assumed.
474
+ - `answered` is a legacy alias that DevFlow reads as `resolved`.
475
+
476
+ A specification may only be generated when no decision is `pending` and
477
+ every assumption has been explicitly accepted. DevFlow validates the
478
+ record and confirms completeness; the agent never declares Discovery
479
+ complete on its own.
480
+
481
+ Discovery uses a per-round question budget and batches independent
482
+ decisions into one interaction. The defaults live in `.devflow/config.yaml`:
483
+
484
+ ```yaml
485
+ discovery:
486
+ question_budget:
487
+ initial: 6
488
+ follow_up: 3
489
+ maximum: 12
490
+ interaction:
491
+ batch_size: 6
492
+ max_rounds: 3
493
+ assumptions:
494
+ enabled: true
495
+ ```
496
+
497
+ The budget limits questions but never permits ignoring a critical
498
+ decision. If material decisions remain after the budget is exhausted,
499
+ Discovery stays incomplete and asks for intervention.
435
500
 
436
501
  The deterministic planner recognizes contact pages, forms, comments,
437
502
  authentication, persistence, deployments and architecture boundaries in
@@ -454,13 +519,22 @@ starts as `pending_acceptance`. It never becomes accepted automatically.
454
519
  A human must set `status: accepted` with `accepted_by` and `accepted_at`,
455
520
  or reject it and record a different decision.
456
521
 
457
- While any question or assumption remains unresolved:
522
+ While any decision is pending or any assumption remains unaccepted:
458
523
 
459
524
  - `discovery.yaml` and `context.md` are written;
460
525
  - no `spec.md` is generated;
461
526
  - `devflow approve --stage spec` refuses the change;
462
527
  - the workflow status is `awaiting_clarification`.
463
528
 
529
+ `context.md` is the single generated context file. Its
530
+ `## 1. Decision Context` section is generated deterministically by
531
+ DevFlow from the project facts, conventions, approved decisions,
532
+ evidence, pending decisions and constraints. Its
533
+ `## 2. Project Evidence` section contains the request, static analysis,
534
+ relevant code, constitution scope and declared architecture. The file is
535
+ capped and carries the Discovery and architecture digests, so a new
536
+ session does not need to rediscover the whole project.
537
+
464
538
  Answer the questions in the file, or run an interactive harness, then
465
539
  resume:
466
540
 
@@ -503,7 +577,7 @@ specification that still lists open questions.
503
577
  8. If artifacts exist without workflow state, diagnose with
504
578
  `devflow doctor <id>` and repair with `devflow recover <id>`.
505
579
 
506
- Available commands in `0.3.15`:
580
+ Available commands in `0.3.17`:
507
581
 
508
582
  | Command | Status |
509
583
  | --- | --- |
@@ -541,8 +615,8 @@ The command:
541
615
  default, or `greenfield`);
542
616
  4. creates a persistent `discovery.yaml` with classified questions and
543
617
  proposed assumptions;
544
- 5. writes the deterministic evidence or declared architecture to
545
- `context.md`;
618
+ 5. writes the Decision Context and the project evidence or declared
619
+ architecture to `context.md`;
546
620
  6. stops without `spec.md` when any question or assumption remains
547
621
  unresolved;
548
622
  7. in an interactive run, stops after Discovery is complete and prints
@@ -584,8 +658,8 @@ devflow spec --continue 006
584
658
  ```
585
659
 
586
660
  `--continue` is not a new specification. It reuses the stored request
587
- and project mode, loads Discovery, and stops until every question is
588
- answered and every assumption is accepted. It reuses a current
661
+ and project mode, loads Discovery, and stops until no decision is
662
+ pending and every assumption is accepted. It reuses a current
589
663
  validated specification when the Discovery digest still matches;
590
664
  otherwise it archives the old specification and generates a new one. If
591
665
  an interrupted run left a complete `discovery.yaml` without
@@ -695,7 +769,7 @@ devflow approve 001 --stage spec
695
769
  ```
696
770
 
697
771
  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,
772
+ digests. For a `0.3.17` change it binds `spec.md`, `discovery.yaml` and,
699
773
  when a manifest applies, the architecture manifest digest. Repeating the
700
774
  same approval is a no-op. If an artifact changes after validation,
701
775
  DevFlow marks it stale and refuses approval until it is regenerated and
@@ -706,7 +780,7 @@ and names the pending questions and assumptions. Approval also rejects a
706
780
  specification whose section 7 still lists open questions. Legacy `0.2.0`
707
781
  changes without `discovery.yaml` remain approvable with a warning.
708
782
 
709
- Only the `spec` stage is available in `0.3.15`. `--stage plan` and
783
+ Only the `spec` stage is available in `0.3.17`. `--stage plan` and
710
784
  `--stage review` are rejected. There are no `plan`, `implement` or
711
785
  `review` commands in this release.
712
786
 
@@ -726,7 +800,7 @@ my-project/
726
800
  │ └── specs/
727
801
  │ └── 001-add-patients-endpoint/
728
802
  │ ├── discovery.yaml # persistent questions and answers
729
- │ ├── context.md
803
+ │ ├── context.md # Decision Context + Project Evidence
730
804
  │ ├── spec.md # only when Discovery is complete
731
805
  │ ├── workflow.yaml # projection of events.jsonl
732
806
  │ ├── events.jsonl # append-only source of truth
@@ -10,16 +10,16 @@ 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.17` 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
17
17
  review workflows.
18
18
 
19
19
  Discovery decides whether a request is ready to become a
20
- specification. A specification is only generated when every question
21
- has an explicit answer and every proposed assumption has been
22
- explicitly accepted. Discovery is persisted, so an incomplete request
20
+ specification. A specification is only generated when every decision is
21
+ `resolved` or `assumed`, and every assumption has been explicitly
22
+ accepted. Discovery is persisted, so an incomplete request
23
23
  can be resumed across sessions and agent harnesses. Discovery is also
24
24
  the requirement-gathering stage: ambiguity, authentication,
25
25
  permissions, moderation, data lifecycle, validation, ordering,
@@ -63,6 +63,26 @@ identity for the project:
63
63
  - DevFlow never switches modes silently. Use `--project-mode` explicitly
64
64
  when a run differs from the configured default.
65
65
 
66
+ ## Instruction precedence
67
+
68
+ Every generated `context.md` has two numbered sections: the
69
+ `Decision Context` and the `Project Evidence`. The Decision Context is
70
+ authoritative for decisions; the Project Evidence supports it. When
71
+ instructions conflict, DevFlow applies this order, highest priority
72
+ first:
73
+
74
+ 1. Explicit decisions approved by the user.
75
+ 2. The approved specification.
76
+ 3. The constitution and the enabled technology profiles.
77
+ 4. The declared architecture and verified project conventions.
78
+ 5. General good practices.
79
+ 6. Agent preferences.
80
+
81
+ A lower-priority instruction never overrides a higher-priority one. When
82
+ two instructions at the same level conflict, the agent asks instead of
83
+ resolving the conflict silently. The prompts state the output contract;
84
+ DevFlow's Python code applies the enforcement.
85
+
66
86
  ## Requirements
67
87
 
68
88
  - Python 3.11 or newer.
@@ -87,7 +107,7 @@ pip install devflow-toolkit
87
107
  To install a specific built artifact instead:
88
108
 
89
109
  ```bash
90
- pip install devflow_toolkit-0.3.15-py3-none-any.whl
110
+ pip install devflow_toolkit-0.3.17-py3-none-any.whl
91
111
  ```
92
112
 
93
113
  Verify the installation:
@@ -267,7 +287,7 @@ as an architectural constraint when it is present.
267
287
 
268
288
  ### Harnesses
269
289
 
270
- | Harness | Status in 0.3.15 |
290
+ | Harness | Status in 0.3.17 |
271
291
  | --- | --- |
272
292
  | OpenCode | Verified end-to-end; interactive Discovery uses the `question` tool |
273
293
  | Antigravity | Custom agents and scoped permissions generated; `agy` loading and print mode verified |
@@ -373,6 +393,7 @@ updated_at: "2026-11-02T10:00:00Z"
373
393
  questions:
374
394
  - id: Q1
375
395
  category: functional_scope
396
+ materiality: functional
376
397
  question: What should happen when the contact form is submitted?
377
398
  reason: Persistence, confirmation and email delivery change scope.
378
399
  blocking: true
@@ -381,9 +402,22 @@ questions:
381
402
  answer: null
382
403
  answered_by: null
383
404
  answered_at: null
405
+ - id: Q2
406
+ category: architecture_boundary
407
+ materiality: technical
408
+ question: Which form mechanism should the page use?
409
+ reason: The project already uses Django Forms.
410
+ blocking: false
411
+ status: resolved
412
+ resolution_source: evidence
413
+ evidence:
414
+ - "profiles/django-backend"
415
+ - "src/contact/forms.py:12"
416
+ answer: Reuse Django Forms.
417
+ options: []
384
418
  assumptions:
385
419
  - id: A1
386
- question_id: Q1
420
+ question_id: Q3
387
421
  value: Use `/contacto/` as the URL path.
388
422
  reason: Internal routing must be visible before approval.
389
423
  source: agent_default
@@ -392,14 +426,45 @@ assumptions:
392
426
  accepted_at: null
393
427
  ```
394
428
 
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.
429
+ Every decision has one outcome: `resolved`, `assumed` or `pending`.
430
+ A question presents a pending decision; an assumption is the acceptance
431
+ ledger for an assumed decision. Each decision has a `category`, a
432
+ `materiality` (`critical`, `functional`, `technical` or `cosmetic`) and
433
+ an explicit `blocking` flag.
434
+
435
+ - `pending` is valid only for blocking or material decisions.
436
+ - `resolved` by the user records `answer`, `answered_by` and
437
+ `answered_at`.
438
+ - `resolved` by evidence records `resolution_source: evidence` and at
439
+ least one `evidence` entry.
440
+ - `assumed` requires a linked assumption with explicit human acceptance.
441
+ Critical and security decisions can never be assumed.
442
+ - `answered` is a legacy alias that DevFlow reads as `resolved`.
443
+
444
+ A specification may only be generated when no decision is `pending` and
445
+ every assumption has been explicitly accepted. DevFlow validates the
446
+ record and confirms completeness; the agent never declares Discovery
447
+ complete on its own.
448
+
449
+ Discovery uses a per-round question budget and batches independent
450
+ decisions into one interaction. The defaults live in `.devflow/config.yaml`:
451
+
452
+ ```yaml
453
+ discovery:
454
+ question_budget:
455
+ initial: 6
456
+ follow_up: 3
457
+ maximum: 12
458
+ interaction:
459
+ batch_size: 6
460
+ max_rounds: 3
461
+ assumptions:
462
+ enabled: true
463
+ ```
464
+
465
+ The budget limits questions but never permits ignoring a critical
466
+ decision. If material decisions remain after the budget is exhausted,
467
+ Discovery stays incomplete and asks for intervention.
403
468
 
404
469
  The deterministic planner recognizes contact pages, forms, comments,
405
470
  authentication, persistence, deployments and architecture boundaries in
@@ -422,13 +487,22 @@ starts as `pending_acceptance`. It never becomes accepted automatically.
422
487
  A human must set `status: accepted` with `accepted_by` and `accepted_at`,
423
488
  or reject it and record a different decision.
424
489
 
425
- While any question or assumption remains unresolved:
490
+ While any decision is pending or any assumption remains unaccepted:
426
491
 
427
492
  - `discovery.yaml` and `context.md` are written;
428
493
  - no `spec.md` is generated;
429
494
  - `devflow approve --stage spec` refuses the change;
430
495
  - the workflow status is `awaiting_clarification`.
431
496
 
497
+ `context.md` is the single generated context file. Its
498
+ `## 1. Decision Context` section is generated deterministically by
499
+ DevFlow from the project facts, conventions, approved decisions,
500
+ evidence, pending decisions and constraints. Its
501
+ `## 2. Project Evidence` section contains the request, static analysis,
502
+ relevant code, constitution scope and declared architecture. The file is
503
+ capped and carries the Discovery and architecture digests, so a new
504
+ session does not need to rediscover the whole project.
505
+
432
506
  Answer the questions in the file, or run an interactive harness, then
433
507
  resume:
434
508
 
@@ -471,7 +545,7 @@ specification that still lists open questions.
471
545
  8. If artifacts exist without workflow state, diagnose with
472
546
  `devflow doctor <id>` and repair with `devflow recover <id>`.
473
547
 
474
- Available commands in `0.3.15`:
548
+ Available commands in `0.3.17`:
475
549
 
476
550
  | Command | Status |
477
551
  | --- | --- |
@@ -509,8 +583,8 @@ The command:
509
583
  default, or `greenfield`);
510
584
  4. creates a persistent `discovery.yaml` with classified questions and
511
585
  proposed assumptions;
512
- 5. writes the deterministic evidence or declared architecture to
513
- `context.md`;
586
+ 5. writes the Decision Context and the project evidence or declared
587
+ architecture to `context.md`;
514
588
  6. stops without `spec.md` when any question or assumption remains
515
589
  unresolved;
516
590
  7. in an interactive run, stops after Discovery is complete and prints
@@ -552,8 +626,8 @@ devflow spec --continue 006
552
626
  ```
553
627
 
554
628
  `--continue` is not a new specification. It reuses the stored request
555
- and project mode, loads Discovery, and stops until every question is
556
- answered and every assumption is accepted. It reuses a current
629
+ and project mode, loads Discovery, and stops until no decision is
630
+ pending and every assumption is accepted. It reuses a current
557
631
  validated specification when the Discovery digest still matches;
558
632
  otherwise it archives the old specification and generates a new one. If
559
633
  an interrupted run left a complete `discovery.yaml` without
@@ -663,7 +737,7 @@ devflow approve 001 --stage spec
663
737
  ```
664
738
 
665
739
  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,
740
+ digests. For a `0.3.17` change it binds `spec.md`, `discovery.yaml` and,
667
741
  when a manifest applies, the architecture manifest digest. Repeating the
668
742
  same approval is a no-op. If an artifact changes after validation,
669
743
  DevFlow marks it stale and refuses approval until it is regenerated and
@@ -674,7 +748,7 @@ and names the pending questions and assumptions. Approval also rejects a
674
748
  specification whose section 7 still lists open questions. Legacy `0.2.0`
675
749
  changes without `discovery.yaml` remain approvable with a warning.
676
750
 
677
- Only the `spec` stage is available in `0.3.15`. `--stage plan` and
751
+ Only the `spec` stage is available in `0.3.17`. `--stage plan` and
678
752
  `--stage review` are rejected. There are no `plan`, `implement` or
679
753
  `review` commands in this release.
680
754
 
@@ -694,7 +768,7 @@ my-project/
694
768
  │ └── specs/
695
769
  │ └── 001-add-patients-endpoint/
696
770
  │ ├── discovery.yaml # persistent questions and answers
697
- │ ├── context.md
771
+ │ ├── context.md # Decision Context + Project Evidence
698
772
  │ ├── spec.md # only when Discovery is complete
699
773
  │ ├── workflow.yaml # projection of events.jsonl
700
774
  │ ├── events.jsonl # append-only source of truth
@@ -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.17"
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.17"
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.17. "
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
  )