devflow-toolkit 0.4.3__tar.gz → 0.4.5__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 (97) hide show
  1. {devflow_toolkit-0.4.3 → devflow_toolkit-0.4.5}/CHANGELOG.md +109 -0
  2. {devflow_toolkit-0.4.3 → devflow_toolkit-0.4.5}/PKG-INFO +88 -23
  3. {devflow_toolkit-0.4.3 → devflow_toolkit-0.4.5}/README.md +6 -5
  4. {devflow_toolkit-0.4.3 → devflow_toolkit-0.4.5}/docs/REFERENCE.md +87 -22
  5. {devflow_toolkit-0.4.3 → devflow_toolkit-0.4.5}/pyproject.toml +1 -1
  6. {devflow_toolkit-0.4.3 → devflow_toolkit-0.4.5}/src/devflow/adapters/antigravity.py +21 -7
  7. {devflow_toolkit-0.4.3 → devflow_toolkit-0.4.5}/src/devflow/adapters/claude_code.py +27 -6
  8. {devflow_toolkit-0.4.3 → devflow_toolkit-0.4.5}/src/devflow/adapters/instructions.py +3 -1
  9. {devflow_toolkit-0.4.3 → devflow_toolkit-0.4.5}/src/devflow/adapters/kiro.py +21 -7
  10. {devflow_toolkit-0.4.3 → devflow_toolkit-0.4.5}/src/devflow/adapters/opencode.py +55 -34
  11. {devflow_toolkit-0.4.3 → devflow_toolkit-0.4.5}/src/devflow/commands/approve.py +3 -2
  12. {devflow_toolkit-0.4.3 → devflow_toolkit-0.4.5}/src/devflow/commands/config.py +2 -1
  13. {devflow_toolkit-0.4.3 → devflow_toolkit-0.4.5}/src/devflow/commands/doctor.py +2 -1
  14. {devflow_toolkit-0.4.3 → devflow_toolkit-0.4.5}/src/devflow/commands/harness.py +3 -2
  15. {devflow_toolkit-0.4.3 → devflow_toolkit-0.4.5}/src/devflow/commands/init.py +4 -3
  16. {devflow_toolkit-0.4.3 → devflow_toolkit-0.4.5}/src/devflow/commands/recover.py +2 -1
  17. devflow_toolkit-0.4.5/src/devflow/commands/reopen.py +143 -0
  18. {devflow_toolkit-0.4.3 → devflow_toolkit-0.4.5}/src/devflow/commands/security.py +2 -1
  19. {devflow_toolkit-0.4.3 → devflow_toolkit-0.4.5}/src/devflow/commands/spec.py +77 -4
  20. {devflow_toolkit-0.4.3 → devflow_toolkit-0.4.5}/src/devflow/commands/status.py +30 -17
  21. {devflow_toolkit-0.4.3 → devflow_toolkit-0.4.5}/src/devflow/core/artifacts/store.py +29 -3
  22. {devflow_toolkit-0.4.3 → devflow_toolkit-0.4.5}/src/devflow/core/config.py +27 -1
  23. {devflow_toolkit-0.4.3 → devflow_toolkit-0.4.5}/src/devflow/core/ports.py +9 -1
  24. devflow_toolkit-0.4.5/src/devflow/core/safe_files.py +36 -0
  25. {devflow_toolkit-0.4.3 → devflow_toolkit-0.4.5}/src/devflow/core/security_tools.py +24 -7
  26. {devflow_toolkit-0.4.3 → devflow_toolkit-0.4.5}/src/devflow/core/spec_workflow.py +211 -5
  27. {devflow_toolkit-0.4.3 → devflow_toolkit-0.4.5}/src/devflow/core/specification.py +20 -3
  28. {devflow_toolkit-0.4.3 → devflow_toolkit-0.4.5}/src/devflow/core/state/events.py +56 -7
  29. {devflow_toolkit-0.4.3 → devflow_toolkit-0.4.5}/src/devflow/core/state/lock.py +5 -1
  30. {devflow_toolkit-0.4.3 → devflow_toolkit-0.4.5}/src/devflow/core/state/manager.py +131 -32
  31. devflow_toolkit-0.4.5/src/devflow/core/state/signing.py +107 -0
  32. {devflow_toolkit-0.4.3 → devflow_toolkit-0.4.5}/src/devflow/hooks/claude_guard.py +10 -1
  33. {devflow_toolkit-0.4.3 → devflow_toolkit-0.4.5}/src/devflow/prompts/__init__.py +6 -2
  34. devflow_toolkit-0.4.5/tests/conftest.py +18 -0
  35. {devflow_toolkit-0.4.3 → devflow_toolkit-0.4.5}/tests/test_harness_adapters.py +39 -18
  36. devflow_toolkit-0.4.5/tests/test_security_fixes.py +751 -0
  37. {devflow_toolkit-0.4.3 → devflow_toolkit-0.4.5}/tests/test_state.py +1 -1
  38. devflow_toolkit-0.4.3/src/devflow/commands/reopen.py +0 -105
  39. {devflow_toolkit-0.4.3 → devflow_toolkit-0.4.5}/.gitignore +0 -0
  40. {devflow_toolkit-0.4.3 → devflow_toolkit-0.4.5}/LICENSE +0 -0
  41. {devflow_toolkit-0.4.3 → devflow_toolkit-0.4.5}/docs/PRESENTATION.md +0 -0
  42. {devflow_toolkit-0.4.3 → devflow_toolkit-0.4.5}/docs/PUBLISHING.md +0 -0
  43. {devflow_toolkit-0.4.3 → devflow_toolkit-0.4.5}/src/devflow/__init__.py +0 -0
  44. {devflow_toolkit-0.4.3 → devflow_toolkit-0.4.5}/src/devflow/adapters/__init__.py +0 -0
  45. {devflow_toolkit-0.4.3 → devflow_toolkit-0.4.5}/src/devflow/adapters/agents.py +0 -0
  46. {devflow_toolkit-0.4.3 → devflow_toolkit-0.4.5}/src/devflow/adapters/base.py +0 -0
  47. {devflow_toolkit-0.4.3 → devflow_toolkit-0.4.5}/src/devflow/adapters/codex.py +0 -0
  48. {devflow_toolkit-0.4.3 → devflow_toolkit-0.4.5}/src/devflow/adapters/detector.py +0 -0
  49. {devflow_toolkit-0.4.3 → devflow_toolkit-0.4.5}/src/devflow/adapters/registry.py +0 -0
  50. {devflow_toolkit-0.4.3 → devflow_toolkit-0.4.5}/src/devflow/cli.py +0 -0
  51. {devflow_toolkit-0.4.3 → devflow_toolkit-0.4.5}/src/devflow/commands/__init__.py +0 -0
  52. {devflow_toolkit-0.4.3 → devflow_toolkit-0.4.5}/src/devflow/core/__init__.py +0 -0
  53. {devflow_toolkit-0.4.3 → devflow_toolkit-0.4.5}/src/devflow/core/architecture.py +0 -0
  54. {devflow_toolkit-0.4.3 → devflow_toolkit-0.4.5}/src/devflow/core/artifacts/__init__.py +0 -0
  55. {devflow_toolkit-0.4.3 → devflow_toolkit-0.4.5}/src/devflow/core/artifacts/errors.py +0 -0
  56. {devflow_toolkit-0.4.3 → devflow_toolkit-0.4.5}/src/devflow/core/artifacts/models.py +0 -0
  57. {devflow_toolkit-0.4.3 → devflow_toolkit-0.4.5}/src/devflow/core/clock.py +0 -0
  58. {devflow_toolkit-0.4.3 → devflow_toolkit-0.4.5}/src/devflow/core/constitution.py +0 -0
  59. {devflow_toolkit-0.4.3 → devflow_toolkit-0.4.5}/src/devflow/core/discovery.py +0 -0
  60. {devflow_toolkit-0.4.3 → devflow_toolkit-0.4.5}/src/devflow/core/file_types.py +0 -0
  61. {devflow_toolkit-0.4.3 → devflow_toolkit-0.4.5}/src/devflow/core/profile_manager.py +0 -0
  62. {devflow_toolkit-0.4.3 → devflow_toolkit-0.4.5}/src/devflow/core/project.py +0 -0
  63. {devflow_toolkit-0.4.3 → devflow_toolkit-0.4.5}/src/devflow/core/recovery.py +0 -0
  64. {devflow_toolkit-0.4.3 → devflow_toolkit-0.4.5}/src/devflow/core/security_baseline.py +0 -0
  65. {devflow_toolkit-0.4.3 → devflow_toolkit-0.4.5}/src/devflow/core/state/__init__.py +0 -0
  66. {devflow_toolkit-0.4.3 → devflow_toolkit-0.4.5}/src/devflow/core/state/errors.py +0 -0
  67. {devflow_toolkit-0.4.3 → devflow_toolkit-0.4.5}/src/devflow/core/state/locator.py +0 -0
  68. {devflow_toolkit-0.4.3 → devflow_toolkit-0.4.5}/src/devflow/core/state/models.py +0 -0
  69. {devflow_toolkit-0.4.3 → devflow_toolkit-0.4.5}/src/devflow/core/state/transitions.py +0 -0
  70. {devflow_toolkit-0.4.3 → devflow_toolkit-0.4.5}/src/devflow/hooks/__init__.py +0 -0
  71. {devflow_toolkit-0.4.3 → devflow_toolkit-0.4.5}/src/devflow/models/__init__.py +0 -0
  72. {devflow_toolkit-0.4.3 → devflow_toolkit-0.4.5}/src/devflow/models/profile.py +0 -0
  73. {devflow_toolkit-0.4.3 → devflow_toolkit-0.4.5}/src/devflow/models/project.py +0 -0
  74. {devflow_toolkit-0.4.3 → devflow_toolkit-0.4.5}/src/devflow/profiles/ai-rag/constitution/ai-rag-standards.md +0 -0
  75. {devflow_toolkit-0.4.3 → devflow_toolkit-0.4.5}/src/devflow/profiles/ai-rag/profile.yaml +0 -0
  76. {devflow_toolkit-0.4.3 → devflow_toolkit-0.4.5}/src/devflow/profiles/base/constitution/architecture.md +0 -0
  77. {devflow_toolkit-0.4.3 → devflow_toolkit-0.4.5}/src/devflow/profiles/base/constitution/code-standards.md +0 -0
  78. {devflow_toolkit-0.4.3 → devflow_toolkit-0.4.5}/src/devflow/profiles/base/constitution/constitution.md +0 -0
  79. {devflow_toolkit-0.4.3 → devflow_toolkit-0.4.5}/src/devflow/profiles/base/profile.yaml +0 -0
  80. {devflow_toolkit-0.4.3 → devflow_toolkit-0.4.5}/src/devflow/profiles/django-backend/constitution/django-standards.md +0 -0
  81. {devflow_toolkit-0.4.3 → devflow_toolkit-0.4.5}/src/devflow/profiles/django-backend/profile.yaml +0 -0
  82. {devflow_toolkit-0.4.3 → devflow_toolkit-0.4.5}/src/devflow/profiles/fastapi-backend/constitution/fastapi-standards.md +0 -0
  83. {devflow_toolkit-0.4.3 → devflow_toolkit-0.4.5}/src/devflow/profiles/fastapi-backend/profile.yaml +0 -0
  84. {devflow_toolkit-0.4.3 → devflow_toolkit-0.4.5}/src/devflow/prompts/discovery-repair.md +0 -0
  85. {devflow_toolkit-0.4.3 → devflow_toolkit-0.4.5}/src/devflow/prompts/discovery.md +0 -0
  86. {devflow_toolkit-0.4.3 → devflow_toolkit-0.4.5}/src/devflow/prompts/spec.md +0 -0
  87. {devflow_toolkit-0.4.3 → devflow_toolkit-0.4.5}/tests/test_cli.py +0 -0
  88. {devflow_toolkit-0.4.3 → devflow_toolkit-0.4.5}/tests/test_discovery.py +0 -0
  89. {devflow_toolkit-0.4.3 → devflow_toolkit-0.4.5}/tests/test_discovery_decisions.py +0 -0
  90. {devflow_toolkit-0.4.3 → devflow_toolkit-0.4.5}/tests/test_event_log.py +0 -0
  91. {devflow_toolkit-0.4.3 → devflow_toolkit-0.4.5}/tests/test_greenfield.py +0 -0
  92. {devflow_toolkit-0.4.3 → devflow_toolkit-0.4.5}/tests/test_hardening.py +0 -0
  93. {devflow_toolkit-0.4.3 → devflow_toolkit-0.4.5}/tests/test_recovery.py +0 -0
  94. {devflow_toolkit-0.4.3 → devflow_toolkit-0.4.5}/tests/test_security_baseline.py +0 -0
  95. {devflow_toolkit-0.4.3 → devflow_toolkit-0.4.5}/tests/test_security_tools.py +0 -0
  96. {devflow_toolkit-0.4.3 → devflow_toolkit-0.4.5}/tests/test_spec_workflow.py +0 -0
  97. {devflow_toolkit-0.4.3 → devflow_toolkit-0.4.5}/tests/test_state_replay.py +0 -0
@@ -2,6 +2,115 @@
2
2
 
3
3
  All notable changes to DevFlow Toolkit are documented in this file.
4
4
 
5
+ ## 0.4.5 - 2026-11-30
6
+
7
+ ### Changed
8
+
9
+ - `devflow reopen` is clearer when you want to extend a specification:
10
+ - New `--add "what to add"`: records the new scope in Discovery and
11
+ reopens it, so the agent asks only about the new decisions and then
12
+ writes the extended spec. It implies `--discovery`.
13
+ - `--discovery` and `--add` work on a change that is not approved yet;
14
+ before, they failed with "nothing to reopen".
15
+ - The confirmation matches the state: it asks to withdraw the approval
16
+ only when there is one, and to reopen Discovery otherwise.
17
+ - A plain `reopen` on a change that is not approved explains that it is
18
+ already open and how to extend it.
19
+ - When `devflow spec --continue` finds the spec unchanged, it explains
20
+ how to extend it with `devflow reopen <id> --add`.
21
+ - The reopened-Discovery prompt starts from the added scope and keeps the
22
+ decisions already answered.
23
+
24
+ ### Package
25
+
26
+ - Package version is `0.4.5`.
27
+
28
+ ## 0.4.4 - 2026-11-30
29
+
30
+ ### Security
31
+
32
+ Fixes from a security audit of `src/`. They protect developers who run
33
+ DevFlow inside a cloned repository they do not control.
34
+
35
+ - Installing the security tools runs `pip` and `pre-commit` with
36
+ `python -P`, so a `pip/` or `pre_commit/` folder in the project can no
37
+ longer run its own code. The Claude Code write guard is launched the
38
+ same way, so a `devflow/` folder in the project cannot replace it.
39
+ - `agent.permissions.allow_source_code_changes` in `.devflow/config.yaml`
40
+ no longer takes effect on its own. `devflow spec` asks for
41
+ confirmation (default no), or needs the new `--allow-source-changes`
42
+ option; otherwise the agent may only write specifications.
43
+ - Permission warnings are printed before the agent starts, not after it
44
+ finishes.
45
+ - DevFlow never writes through a symbolic link in a change directory.
46
+ A `spec.md`, `context.md` or `workflow.yaml` link is replaced by a
47
+ regular file and its target is left untouched.
48
+ - `events.jsonl`, `.lock` and `.devflow/.specs.lock` are opened without
49
+ following symbolic links, so a link cannot make DevFlow create files
50
+ outside the project.
51
+ - Agents cannot change workflow state: Claude Code and OpenCode rules
52
+ deny writes to `events.jsonl`, `workflow.yaml` and `.lock`, the Claude
53
+ guard blocks them, and DevFlow restores any of those files that an
54
+ agent run changed.
55
+ - Suggested `devflow spec "<title>"` commands quote the title so that
56
+ pasting them cannot run `$(...)` or backtick commands.
57
+ - Approvals are signed with a per-user key kept outside the project
58
+ (`~/.config/devflow/approval.key`). An approval that was not made with
59
+ `devflow approve` on this machine, such as one written by an agent or
60
+ committed in a cloned repository, does not count, and `devflow status`
61
+ says so. Changing an approved spec and appending events to re-approve
62
+ it no longer works.
63
+ - `specifications.path` and `constitution.path` must be real
64
+ directories: a path through a symbolic link, the project root or
65
+ anything under `.git` is rejected, and the specifications directory
66
+ may not contain `config.yaml` or the constitution.
67
+ - A leftover `.devflow-agent-output.md` (for example a committed link)
68
+ is removed before Codex writes its answer, and DevFlow never reads
69
+ the output through a link.
70
+ - OpenCode agents start from a deny-all rule. Only reads (except `.env`
71
+ files), edits in the specifications directory and, in interactive
72
+ mode, questions are allowed; MCP tools, skills, shell, web, subagents
73
+ and paths outside the project are denied.
74
+ - Claude Code runs with `--setting-sources user --strict-mcp-config`, so
75
+ hooks, permissions and MCP servers committed in the project are not
76
+ loaded. Reads are limited to the project, `.env` files and MCP tools
77
+ are denied, and reads are no longer pre-approved outside the project.
78
+ - If `.opencode/agents/`, `.kiro/agents/` or `.agents/agents/` contains a
79
+ `devflow-spec` definition that DevFlow did not write, `devflow spec`
80
+ stops instead of starting the harness with it.
81
+ - Model listings run the harness from an empty temporary directory, so
82
+ `devflow init` and `devflow harness models` do not load the project's
83
+ harness configuration.
84
+ - When source changes are not allowed, DevFlow lists any project file
85
+ outside the specifications directory that the agent changed.
86
+ - An unmanaged `.pre-commit-config.yaml` is no longer activated with
87
+ `pre-commit install`; DevFlow only recognises its own file when the
88
+ marker is the first line, and ignores a linked one.
89
+ - Repository and agent text printed by `devflow status` and in warnings
90
+ and errors is escaped, so it cannot hide or restyle output, and labels
91
+ such as `[security, critical, blocking]` are shown again.
92
+ - Managed harness files no longer keep special, executable or
93
+ world-writable permission bits from the file they replace.
94
+
95
+ ### Upgrade notes
96
+
97
+ - Approvals made with `0.4.3` or earlier are unsigned. After upgrading,
98
+ those changes show as not approved; review them and run
99
+ `devflow approve <id>` again.
100
+ - Approvals are personal: an approval made by a teammate on another
101
+ machine does not count on yours.
102
+ - Projects whose `specifications.path` is `.`, under `.git` or a
103
+ symbolic link must move it to a real directory such as
104
+ `.devflow/specs`.
105
+
106
+ ### Package
107
+
108
+ - Package version is `0.4.4`, published on TestPyPI and PyPI.
109
+
110
+ ### Added
111
+
112
+ - `devflow spec --allow-source-changes`.
113
+
5
114
  ## 0.4.3 - 2026-11-10
6
115
 
7
116
  ### Changed
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.5
2
2
  Name: devflow-toolkit
3
- Version: 0.4.3
3
+ Version: 0.4.5
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.4.3`.**
35
+ **Current version: `0.4.5`.**
36
36
 
37
37
  Before any code is written, you and the AI agree on what will be built
38
38
  and approve it as a spec. The agent then implements once, on something
@@ -210,7 +210,7 @@ pip install devflow-toolkit
210
210
  To install a specific built artifact instead:
211
211
 
212
212
  ```bash
213
- pip install devflow_toolkit-0.4.3-py3-none-any.whl
213
+ pip install devflow_toolkit-0.4.5-py3-none-any.whl
214
214
  ```
215
215
 
216
216
  Verify the installation:
@@ -394,7 +394,11 @@ revisions, installs `pre-commit` with pip when it is missing and runs
394
394
  `pre-commit install` when the project is a git repository. Only the
395
395
  hooks that apply are added: Bandit and pip-audit for Python projects,
396
396
  `p/django` rules for Django. An existing, unmanaged
397
- `.pre-commit-config.yaml` is never overwritten. The first commit
397
+ `.pre-commit-config.yaml` is never overwritten, and in that case DevFlow
398
+ does not run `pre-commit install`, so the project's own hooks are not
399
+ activated until you review them. `pip` and `pre-commit` run with
400
+ `python -P`, so Python never loads modules from the project directory.
401
+ The first commit
398
402
  downloads the tools; `pre-commit run --all-files` checks the whole
399
403
  project.
400
404
 
@@ -443,6 +447,18 @@ reinitializing the project.
443
447
  `constitution.files` accepts plain file names inside the constitution
444
448
  directory. Absolute paths, `..` and nested paths are rejected.
445
449
 
450
+ `specifications.path` and `constitution.path` must be real directories
451
+ inside the project: a path that goes through a symbolic link, the
452
+ project root itself or anything under `.git` is rejected. The
453
+ specifications directory must not contain `config.yaml` or the
454
+ constitution, because agents may write there.
455
+
456
+ `agent.permissions.allow_source_code_changes: true` in a committed
457
+ `config.yaml` is not enough on its own. `devflow spec` asks you to
458
+ confirm it before the agent starts (the default answer is no), or you
459
+ pass `--allow-source-changes`. Without confirmation the run is limited
460
+ to specifications.
461
+
446
462
  Existing configurations without `project.mode` load as `existing`.
447
463
 
448
464
  ## Declared architecture
@@ -511,7 +527,7 @@ as an architectural constraint when it is present.
511
527
 
512
528
  ### Harnesses
513
529
 
514
- | Harness | Status in 0.4.3 |
530
+ | Harness | Status in 0.4.5 |
515
531
  | --- | --- |
516
532
  | OpenCode | Verified end-to-end; interactive Discovery uses the `question` tool |
517
533
  | Antigravity | Custom agents and scoped permissions generated; `agy` loading and print mode verified |
@@ -587,21 +603,48 @@ DevFlow did not create are never added. DevFlow does not ignore
587
603
 
588
604
  `allow_workflow_write` controls writes to DevFlow artifacts.
589
605
  `allow_spec_write` is accepted as a compatibility alias.
590
- `allow_source_code_changes` is disabled by default.
606
+ `allow_source_code_changes` is disabled by default and, when a project
607
+ enables it, needs your confirmation or `--allow-source-changes` on each
608
+ `devflow spec` run.
591
609
 
592
610
  DevFlow translates these settings into technical controls where the
593
- harness exposes them. For OpenCode, the generated agents deny `edit`
594
- outside `.devflow/specs/`, deny shell execution unless source changes are
595
- explicitly allowed, and disable web access and subagents. Prompt text is
596
- not treated as the only permission boundary.
611
+ harness exposes them. For OpenCode, the generated agents start with a
612
+ rule that denies every action, then allow reads, `glob` and `grep`
613
+ (except `.env` files), edits under the specifications directory, and
614
+ the `question` tool in interactive mode. Shell, web access, subagents,
615
+ MCP tools, skills and paths outside the project stay denied unless source
616
+ changes are explicitly allowed. Prompt text is not treated as the only
617
+ permission boundary.
618
+
619
+ Workflow state is never writable by agents. Claude Code and OpenCode
620
+ deny writes to `events.jsonl`, `workflow.yaml` and `.lock`, and after
621
+ every agent run DevFlow restores any of those files that changed and
622
+ warns. When source changes are not allowed, DevFlow also lists any
623
+ project file outside the specifications directory that the agent
624
+ changed, so you can review it with `git diff`.
625
+
626
+ If `.opencode/agents/`, `.kiro/agents/` or `.agents/agents/` already
627
+ contains a `devflow-spec` or `devflow-spec-readonly` definition that
628
+ DevFlow did not write, `devflow spec` stops instead of running the
629
+ harness with it. Review the file and delete it so DevFlow can recreate
630
+ it. Model listings (`devflow harness models`, `init`, `harness use`) run
631
+ the harness from an empty temporary directory, so it does not load the
632
+ project's own configuration.
633
+
634
+ Permission warnings are printed before the agent starts.
597
635
 
598
636
  When a harness cannot enforce a restriction technically, DevFlow prints
599
637
  a warning instead of claiming that the restriction is guaranteed.
600
638
 
601
639
  For Claude Code, interactive runs use Manual mode
602
640
  (`--permission-mode manual`) so Discovery can open the
603
- `AskUserQuestion` dialog. Reads and writes under `.devflow/specs/` are
604
- pre-approved, while shell, web and task tools remain denied.
641
+ `AskUserQuestion` dialog. Writes under `.devflow/specs/` are
642
+ pre-approved, while shell, web, task and MCP tools remain denied. Reads
643
+ are limited to the project (`blockReadsOutsideWorkingDirectories`) and
644
+ `.env` files are denied. DevFlow starts Claude Code with
645
+ `--setting-sources user --strict-mcp-config`, so hooks, permissions and
646
+ MCP servers committed in the project's `.claude/` or `.mcp.json` are not
647
+ loaded.
605
648
  Non-interactive runs keep the locked `dontAsk` mode and do not allow the
606
649
  question tool.
607
650
 
@@ -609,8 +652,10 @@ Manual mode would ask you about any other write, such as a helper
609
652
  script in `/tmp`. To avoid that prompt, DevFlow also passes a
610
653
  `PreToolUse` hook (`devflow.hooks.claude_guard`) that blocks every
611
654
  `Write`, `Edit`, `MultiEdit` and `NotebookEdit` outside
612
- `.devflow/specs/` without asking, and tells the agent why. The hook is
613
- not added when `allow_source_code_changes` is enabled.
655
+ `.devflow/specs/`, and any write to `events.jsonl`, `workflow.yaml` or
656
+ `.lock`, without asking, and tells the agent why. The hook runs with
657
+ `python -P`, so a `devflow/` folder in the project cannot replace it.
658
+ The hook is not added when `allow_source_code_changes` is enabled.
614
659
 
615
660
  ## Discovery
616
661
 
@@ -939,14 +984,14 @@ reference.
939
984
  8. If artifacts exist without workflow state, diagnose with
940
985
  `devflow doctor <id>` and repair with `devflow recover <id>`.
941
986
 
942
- Available commands in `0.4.3`:
987
+ Available commands in `0.4.5`:
943
988
 
944
989
  | Command | Status |
945
990
  | --- | --- |
946
991
  | `devflow init` | Implemented |
947
992
  | `devflow spec` | Implemented: Discovery, specification, and `--continue` |
948
993
  | `devflow approve <id>` (stage `spec` by default) | Implemented |
949
- | `devflow reopen <id>` | Implemented: withdraw a spec approval to change it |
994
+ | `devflow reopen <id>` | Implemented: withdraw a spec approval, or reopen Discovery with `--discovery` / `--add` to extend the spec |
950
995
  | `devflow status <id>` | Implemented |
951
996
  | `devflow doctor <id>` | Implemented: read-only diagnostics |
952
997
  | `devflow recover <id>` | Implemented: register existing artifacts |
@@ -1172,18 +1217,27 @@ devflow approve 001
1172
1217
  ```
1173
1218
 
1174
1219
  Approval is explicit and binds the decision to the current artifact
1175
- digests. For a `0.4.3` change it binds `spec.md`, `discovery.yaml` and,
1220
+ digests. For a `0.4.5` change it binds `spec.md`, `discovery.yaml` and,
1176
1221
  when a manifest applies, the architecture manifest digest. Repeating the
1177
1222
  same approval is a no-op. If an artifact changes after validation,
1178
1223
  DevFlow marks it stale and refuses approval until it is regenerated and
1179
1224
  validated again.
1180
1225
 
1226
+ Each approval is signed with a key that DevFlow keeps outside the
1227
+ project, in `~/.config/devflow/approval.key` (or
1228
+ `$XDG_CONFIG_HOME/devflow/approval.key`). An approval only counts when
1229
+ it was made with `devflow approve` on your machine: an approval written
1230
+ by an agent, copied from another change or committed by someone else is
1231
+ ignored, and `devflow status` asks you to review the change and approve
1232
+ it yourself. Approvals made with DevFlow `0.4.3` or earlier are not
1233
+ signed, so approve those changes again after upgrading.
1234
+
1181
1235
  Discovery must be complete before approval. If it is not, approval fails
1182
1236
  and names the pending questions and assumptions. Approval also rejects a
1183
1237
  specification whose section 7 still lists open questions. Legacy `0.2.0`
1184
1238
  changes without `discovery.yaml` remain approvable with a warning.
1185
1239
 
1186
- Only the `spec` stage is available in `0.4.3`, so `--stage` is optional
1240
+ Only the `spec` stage is available in `0.4.5`, so `--stage` is optional
1187
1241
  and defaults to `spec`. `--stage plan` and `--stage review` are
1188
1242
  rejected. There are no `plan`, `implement` or
1189
1243
  `review` commands in this release.
@@ -1211,16 +1265,22 @@ The generated `AGENTS.md` (or `CLAUDE.md`) tells the agent to:
1211
1265
  this step. Discovery and specification prompts skip it to save tokens;
1212
1266
  the specification still lists it in section 9.
1213
1267
 
1214
- ### Reopen an approved specification
1268
+ ### Reopen a specification to change or extend it
1215
1269
 
1216
1270
  An approved specification is a contract. To change it, reopen it first;
1217
1271
  editing `spec.md` directly only marks it `stale`.
1218
1272
 
1219
1273
  ```bash
1220
- devflow reopen 001 # fix or extend the spec text yourself
1221
- devflow reopen 001 --discovery # add or change decisions with the agent
1274
+ devflow reopen 001 # fix the spec text yourself
1275
+ devflow reopen 001 --add "password reset" # the agent extends the spec
1276
+ devflow reopen 001 --discovery # the agent asks what to change
1222
1277
  ```
1223
1278
 
1279
+ `--add` records what you want to add at the end of the Discovery request
1280
+ (`Additional scope (date): ...`) and implies `--discovery`. The agent
1281
+ starts from that text, asks only about the new decisions and keeps the
1282
+ decisions already answered unless the new scope contradicts them.
1283
+
1224
1284
  `reopen` asks for confirmation (skip it with `--yes`), copies the
1225
1285
  current `spec.md` into `history/`, records a `spec_reopened` event and
1226
1286
  withdraws the approval. The previous approval stays in `events.jsonl`;
@@ -1243,8 +1303,13 @@ devflow spec --continue 001 # writes the new spec
1243
1303
  devflow approve 001
1244
1304
  ```
1245
1305
 
1246
- Only an approved spec can be reopened, and only while the change is in
1247
- `spec_approved`.
1306
+ `--discovery` and `--add` also work on a change that is not approved
1307
+ yet: they reopen Discovery without any approval to withdraw. A plain
1308
+ `devflow reopen 001` on a change that is not approved explains that it
1309
+ is already open and how to extend it. When `spec --continue` finds the
1310
+ spec unchanged, it shows the same hint. Extending a spec through
1311
+ Discovery needs an interactive harness, because the agent asks you the
1312
+ new questions.
1248
1313
 
1249
1314
  ## Generated files
1250
1315
 
@@ -32,7 +32,7 @@ tokens, which cost several times more than input tokens.
32
32
  The goal is not to generate code faster, but to decide better before
33
33
  generating it. Thinking is cheap; redoing code is expensive.
34
34
 
35
- Current version: `0.4.3` · Python 3.11+ · Linux and macOS
35
+ Current version: `0.4.5` · Python 3.11+ · Linux and macOS
36
36
 
37
37
  ## Install
38
38
 
@@ -142,11 +142,12 @@ The `AGENTS.md` file created by `devflow init` tells the agent to check
142
142
  the approval, follow your code standards, build only the listed
143
143
  requirements and report every acceptance criterion.
144
144
 
145
- ### 6. Change an approved spec (if needed)
145
+ ### 6. Change or extend a spec (if needed)
146
146
 
147
147
  ```bash
148
- devflow reopen 001 # you edit spec.md yourself
149
- devflow reopen 001 --discovery # the agent asks about the new decisions
148
+ devflow reopen 001 # you edit spec.md yourself
149
+ devflow reopen 001 --add "password reset" # the agent extends the spec
150
+ devflow reopen 001 --discovery # the agent asks what to change
150
151
  ```
151
152
 
152
153
  Then run `devflow spec --continue 001` and approve again. The previous
@@ -160,7 +161,7 @@ version is kept in `history/`.
160
161
  | `devflow spec "…"` | Start a change with Discovery |
161
162
  | `devflow spec --continue 001` | Resume Discovery or write the spec |
162
163
  | `devflow approve 001` | Approve the spec |
163
- | `devflow reopen 001` | Withdraw the approval to change the spec |
164
+ | `devflow reopen 001 --add "…"` | Extend or change the spec with the agent |
164
165
  | `devflow status 001` | Show where the change is and the next command |
165
166
 
166
167
  ## When something looks wrong
@@ -1,6 +1,6 @@
1
1
  # DevFlow Toolkit
2
2
 
3
- **Current version: `0.4.3`.**
3
+ **Current version: `0.4.5`.**
4
4
 
5
5
  Before any code is written, you and the AI agree on what will be built
6
6
  and approve it as a spec. The agent then implements once, on something
@@ -178,7 +178,7 @@ pip install devflow-toolkit
178
178
  To install a specific built artifact instead:
179
179
 
180
180
  ```bash
181
- pip install devflow_toolkit-0.4.3-py3-none-any.whl
181
+ pip install devflow_toolkit-0.4.5-py3-none-any.whl
182
182
  ```
183
183
 
184
184
  Verify the installation:
@@ -362,7 +362,11 @@ revisions, installs `pre-commit` with pip when it is missing and runs
362
362
  `pre-commit install` when the project is a git repository. Only the
363
363
  hooks that apply are added: Bandit and pip-audit for Python projects,
364
364
  `p/django` rules for Django. An existing, unmanaged
365
- `.pre-commit-config.yaml` is never overwritten. The first commit
365
+ `.pre-commit-config.yaml` is never overwritten, and in that case DevFlow
366
+ does not run `pre-commit install`, so the project's own hooks are not
367
+ activated until you review them. `pip` and `pre-commit` run with
368
+ `python -P`, so Python never loads modules from the project directory.
369
+ The first commit
366
370
  downloads the tools; `pre-commit run --all-files` checks the whole
367
371
  project.
368
372
 
@@ -411,6 +415,18 @@ reinitializing the project.
411
415
  `constitution.files` accepts plain file names inside the constitution
412
416
  directory. Absolute paths, `..` and nested paths are rejected.
413
417
 
418
+ `specifications.path` and `constitution.path` must be real directories
419
+ inside the project: a path that goes through a symbolic link, the
420
+ project root itself or anything under `.git` is rejected. The
421
+ specifications directory must not contain `config.yaml` or the
422
+ constitution, because agents may write there.
423
+
424
+ `agent.permissions.allow_source_code_changes: true` in a committed
425
+ `config.yaml` is not enough on its own. `devflow spec` asks you to
426
+ confirm it before the agent starts (the default answer is no), or you
427
+ pass `--allow-source-changes`. Without confirmation the run is limited
428
+ to specifications.
429
+
414
430
  Existing configurations without `project.mode` load as `existing`.
415
431
 
416
432
  ## Declared architecture
@@ -479,7 +495,7 @@ as an architectural constraint when it is present.
479
495
 
480
496
  ### Harnesses
481
497
 
482
- | Harness | Status in 0.4.3 |
498
+ | Harness | Status in 0.4.5 |
483
499
  | --- | --- |
484
500
  | OpenCode | Verified end-to-end; interactive Discovery uses the `question` tool |
485
501
  | Antigravity | Custom agents and scoped permissions generated; `agy` loading and print mode verified |
@@ -555,21 +571,48 @@ DevFlow did not create are never added. DevFlow does not ignore
555
571
 
556
572
  `allow_workflow_write` controls writes to DevFlow artifacts.
557
573
  `allow_spec_write` is accepted as a compatibility alias.
558
- `allow_source_code_changes` is disabled by default.
574
+ `allow_source_code_changes` is disabled by default and, when a project
575
+ enables it, needs your confirmation or `--allow-source-changes` on each
576
+ `devflow spec` run.
559
577
 
560
578
  DevFlow translates these settings into technical controls where the
561
- harness exposes them. For OpenCode, the generated agents deny `edit`
562
- outside `.devflow/specs/`, deny shell execution unless source changes are
563
- explicitly allowed, and disable web access and subagents. Prompt text is
564
- not treated as the only permission boundary.
579
+ harness exposes them. For OpenCode, the generated agents start with a
580
+ rule that denies every action, then allow reads, `glob` and `grep`
581
+ (except `.env` files), edits under the specifications directory, and
582
+ the `question` tool in interactive mode. Shell, web access, subagents,
583
+ MCP tools, skills and paths outside the project stay denied unless source
584
+ changes are explicitly allowed. Prompt text is not treated as the only
585
+ permission boundary.
586
+
587
+ Workflow state is never writable by agents. Claude Code and OpenCode
588
+ deny writes to `events.jsonl`, `workflow.yaml` and `.lock`, and after
589
+ every agent run DevFlow restores any of those files that changed and
590
+ warns. When source changes are not allowed, DevFlow also lists any
591
+ project file outside the specifications directory that the agent
592
+ changed, so you can review it with `git diff`.
593
+
594
+ If `.opencode/agents/`, `.kiro/agents/` or `.agents/agents/` already
595
+ contains a `devflow-spec` or `devflow-spec-readonly` definition that
596
+ DevFlow did not write, `devflow spec` stops instead of running the
597
+ harness with it. Review the file and delete it so DevFlow can recreate
598
+ it. Model listings (`devflow harness models`, `init`, `harness use`) run
599
+ the harness from an empty temporary directory, so it does not load the
600
+ project's own configuration.
601
+
602
+ Permission warnings are printed before the agent starts.
565
603
 
566
604
  When a harness cannot enforce a restriction technically, DevFlow prints
567
605
  a warning instead of claiming that the restriction is guaranteed.
568
606
 
569
607
  For Claude Code, interactive runs use Manual mode
570
608
  (`--permission-mode manual`) so Discovery can open the
571
- `AskUserQuestion` dialog. Reads and writes under `.devflow/specs/` are
572
- pre-approved, while shell, web and task tools remain denied.
609
+ `AskUserQuestion` dialog. Writes under `.devflow/specs/` are
610
+ pre-approved, while shell, web, task and MCP tools remain denied. Reads
611
+ are limited to the project (`blockReadsOutsideWorkingDirectories`) and
612
+ `.env` files are denied. DevFlow starts Claude Code with
613
+ `--setting-sources user --strict-mcp-config`, so hooks, permissions and
614
+ MCP servers committed in the project's `.claude/` or `.mcp.json` are not
615
+ loaded.
573
616
  Non-interactive runs keep the locked `dontAsk` mode and do not allow the
574
617
  question tool.
575
618
 
@@ -577,8 +620,10 @@ Manual mode would ask you about any other write, such as a helper
577
620
  script in `/tmp`. To avoid that prompt, DevFlow also passes a
578
621
  `PreToolUse` hook (`devflow.hooks.claude_guard`) that blocks every
579
622
  `Write`, `Edit`, `MultiEdit` and `NotebookEdit` outside
580
- `.devflow/specs/` without asking, and tells the agent why. The hook is
581
- not added when `allow_source_code_changes` is enabled.
623
+ `.devflow/specs/`, and any write to `events.jsonl`, `workflow.yaml` or
624
+ `.lock`, without asking, and tells the agent why. The hook runs with
625
+ `python -P`, so a `devflow/` folder in the project cannot replace it.
626
+ The hook is not added when `allow_source_code_changes` is enabled.
582
627
 
583
628
  ## Discovery
584
629
 
@@ -907,14 +952,14 @@ reference.
907
952
  8. If artifacts exist without workflow state, diagnose with
908
953
  `devflow doctor <id>` and repair with `devflow recover <id>`.
909
954
 
910
- Available commands in `0.4.3`:
955
+ Available commands in `0.4.5`:
911
956
 
912
957
  | Command | Status |
913
958
  | --- | --- |
914
959
  | `devflow init` | Implemented |
915
960
  | `devflow spec` | Implemented: Discovery, specification, and `--continue` |
916
961
  | `devflow approve <id>` (stage `spec` by default) | Implemented |
917
- | `devflow reopen <id>` | Implemented: withdraw a spec approval to change it |
962
+ | `devflow reopen <id>` | Implemented: withdraw a spec approval, or reopen Discovery with `--discovery` / `--add` to extend the spec |
918
963
  | `devflow status <id>` | Implemented |
919
964
  | `devflow doctor <id>` | Implemented: read-only diagnostics |
920
965
  | `devflow recover <id>` | Implemented: register existing artifacts |
@@ -1140,18 +1185,27 @@ devflow approve 001
1140
1185
  ```
1141
1186
 
1142
1187
  Approval is explicit and binds the decision to the current artifact
1143
- digests. For a `0.4.3` change it binds `spec.md`, `discovery.yaml` and,
1188
+ digests. For a `0.4.5` change it binds `spec.md`, `discovery.yaml` and,
1144
1189
  when a manifest applies, the architecture manifest digest. Repeating the
1145
1190
  same approval is a no-op. If an artifact changes after validation,
1146
1191
  DevFlow marks it stale and refuses approval until it is regenerated and
1147
1192
  validated again.
1148
1193
 
1194
+ Each approval is signed with a key that DevFlow keeps outside the
1195
+ project, in `~/.config/devflow/approval.key` (or
1196
+ `$XDG_CONFIG_HOME/devflow/approval.key`). An approval only counts when
1197
+ it was made with `devflow approve` on your machine: an approval written
1198
+ by an agent, copied from another change or committed by someone else is
1199
+ ignored, and `devflow status` asks you to review the change and approve
1200
+ it yourself. Approvals made with DevFlow `0.4.3` or earlier are not
1201
+ signed, so approve those changes again after upgrading.
1202
+
1149
1203
  Discovery must be complete before approval. If it is not, approval fails
1150
1204
  and names the pending questions and assumptions. Approval also rejects a
1151
1205
  specification whose section 7 still lists open questions. Legacy `0.2.0`
1152
1206
  changes without `discovery.yaml` remain approvable with a warning.
1153
1207
 
1154
- Only the `spec` stage is available in `0.4.3`, so `--stage` is optional
1208
+ Only the `spec` stage is available in `0.4.5`, so `--stage` is optional
1155
1209
  and defaults to `spec`. `--stage plan` and `--stage review` are
1156
1210
  rejected. There are no `plan`, `implement` or
1157
1211
  `review` commands in this release.
@@ -1179,16 +1233,22 @@ The generated `AGENTS.md` (or `CLAUDE.md`) tells the agent to:
1179
1233
  this step. Discovery and specification prompts skip it to save tokens;
1180
1234
  the specification still lists it in section 9.
1181
1235
 
1182
- ### Reopen an approved specification
1236
+ ### Reopen a specification to change or extend it
1183
1237
 
1184
1238
  An approved specification is a contract. To change it, reopen it first;
1185
1239
  editing `spec.md` directly only marks it `stale`.
1186
1240
 
1187
1241
  ```bash
1188
- devflow reopen 001 # fix or extend the spec text yourself
1189
- devflow reopen 001 --discovery # add or change decisions with the agent
1242
+ devflow reopen 001 # fix the spec text yourself
1243
+ devflow reopen 001 --add "password reset" # the agent extends the spec
1244
+ devflow reopen 001 --discovery # the agent asks what to change
1190
1245
  ```
1191
1246
 
1247
+ `--add` records what you want to add at the end of the Discovery request
1248
+ (`Additional scope (date): ...`) and implies `--discovery`. The agent
1249
+ starts from that text, asks only about the new decisions and keeps the
1250
+ decisions already answered unless the new scope contradicts them.
1251
+
1192
1252
  `reopen` asks for confirmation (skip it with `--yes`), copies the
1193
1253
  current `spec.md` into `history/`, records a `spec_reopened` event and
1194
1254
  withdraws the approval. The previous approval stays in `events.jsonl`;
@@ -1211,8 +1271,13 @@ devflow spec --continue 001 # writes the new spec
1211
1271
  devflow approve 001
1212
1272
  ```
1213
1273
 
1214
- Only an approved spec can be reopened, and only while the change is in
1215
- `spec_approved`.
1274
+ `--discovery` and `--add` also work on a change that is not approved
1275
+ yet: they reopen Discovery without any approval to withdraw. A plain
1276
+ `devflow reopen 001` on a change that is not approved explains that it
1277
+ is already open and how to extend it. When `spec --continue` finds the
1278
+ spec unchanged, it shows the same hint. Extending a spec through
1279
+ Discovery needs an interactive harness, because the agent asks you the
1280
+ new questions.
1216
1281
 
1217
1282
  ## Generated files
1218
1283
 
@@ -4,7 +4,7 @@ build-backend = "hatchling.build"
4
4
 
5
5
  [project]
6
6
  name = "devflow-toolkit"
7
- version = "0.4.3"
7
+ version = "0.4.5"
8
8
  description = "Specification workflow toolkit for AI-assisted software changes"
9
9
  readme = "docs/REFERENCE.md"
10
10
  license = "MIT"
@@ -3,7 +3,9 @@
3
3
  from __future__ import annotations
4
4
 
5
5
  import json
6
+ import os
6
7
  import subprocess
8
+ import tempfile
7
9
  from pathlib import Path
8
10
  from typing import Any
9
11
 
@@ -39,6 +41,10 @@ class AntigravityAdapter(HarnessAdapter):
39
41
  name = "antigravity"
40
42
  display_name = "Antigravity"
41
43
  executable = "agy"
44
+ agent_definition_files = (
45
+ f".agents/agents/{INTERACTIVE_AGENT}.md",
46
+ f".agents/agents/{READONLY_AGENT}.md",
47
+ )
42
48
 
43
49
  def setup(self, context: SetupContext) -> SetupResult:
44
50
  changes: list[FileChange] = []
@@ -157,14 +163,22 @@ class AntigravityAdapter(HarnessAdapter):
157
163
 
158
164
  def list_models(self) -> tuple[ModelOption, ...]:
159
165
  """Return models reported by ``agy models``."""
166
+ if not self.is_available():
167
+ return ()
160
168
  try:
161
- result = subprocess.run( # noqa: S603
162
- [self.executable, "models"],
163
- capture_output=True,
164
- text=True,
165
- timeout=30,
166
- check=False,
167
- )
169
+ # Run outside the project so the harness does not load the
170
+ # repository's own configuration, plugins or MCP servers.
171
+ with tempfile.TemporaryDirectory() as neutral:
172
+ result = subprocess.run( # noqa: S603
173
+ [self.executable, "models"],
174
+ capture_output=True,
175
+ text=True,
176
+ timeout=30,
177
+ check=False,
178
+ cwd=neutral,
179
+ # OpenCode resolves the project from PWD, not the cwd.
180
+ env={**os.environ, "PWD": neutral},
181
+ )
168
182
  except (OSError, subprocess.SubprocessError):
169
183
  return ()
170
184
  if result.returncode != 0: