devils-advocate 0.9.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 (169) hide show
  1. devils_advocate-0.9.5/.github/workflows/publish.yml +50 -0
  2. devils_advocate-0.9.5/.gitignore +11 -0
  3. devils_advocate-0.9.5/LICENSE +21 -0
  4. devils_advocate-0.9.5/PKG-INFO +162 -0
  5. devils_advocate-0.9.5/README.md +112 -0
  6. devils_advocate-0.9.5/RELEASING.md +23 -0
  7. devils_advocate-0.9.5/docs/config-page-iconography.md +20 -0
  8. devils_advocate-0.9.5/docs/e2e-test-plan.md +492 -0
  9. devils_advocate-0.9.5/docs/enterprise-deployment.md +97 -0
  10. devils_advocate-0.9.5/docs/plan-p1-critical.md +61 -0
  11. devils_advocate-0.9.5/docs/plan-p2-minor.md +131 -0
  12. devils_advocate-0.9.5/docs/specs/devils-advocate-spec.md +265 -0
  13. devils_advocate-0.9.5/docs/testpypi-install.md +37 -0
  14. devils_advocate-0.9.5/examples/.env.example +27 -0
  15. devils_advocate-0.9.5/examples/models.yaml.example +310 -0
  16. devils_advocate-0.9.5/install.sh +86 -0
  17. devils_advocate-0.9.5/pyproject.toml +59 -0
  18. devils_advocate-0.9.5/scripts/probe_openai_models.py +183 -0
  19. devils_advocate-0.9.5/src/devils_advocate/__init__.py +3 -0
  20. devils_advocate-0.9.5/src/devils_advocate/__main__.py +5 -0
  21. devils_advocate-0.9.5/src/devils_advocate/cli.py +752 -0
  22. devils_advocate-0.9.5/src/devils_advocate/config.py +290 -0
  23. devils_advocate-0.9.5/src/devils_advocate/cost.py +51 -0
  24. devils_advocate-0.9.5/src/devils_advocate/dedup.py +126 -0
  25. devils_advocate-0.9.5/src/devils_advocate/examples/.env.example +27 -0
  26. devils_advocate-0.9.5/src/devils_advocate/examples/__init__.py +0 -0
  27. devils_advocate-0.9.5/src/devils_advocate/examples/models.yaml.example +365 -0
  28. devils_advocate-0.9.5/src/devils_advocate/governance.py +319 -0
  29. devils_advocate-0.9.5/src/devils_advocate/gui/__init__.py +20 -0
  30. devils_advocate-0.9.5/src/devils_advocate/gui/_helpers.py +12 -0
  31. devils_advocate-0.9.5/src/devils_advocate/gui/api.py +1179 -0
  32. devils_advocate-0.9.5/src/devils_advocate/gui/app.py +75 -0
  33. devils_advocate-0.9.5/src/devils_advocate/gui/pages.py +482 -0
  34. devils_advocate-0.9.5/src/devils_advocate/gui/progress.py +117 -0
  35. devils_advocate-0.9.5/src/devils_advocate/gui/runner.py +356 -0
  36. devils_advocate-0.9.5/src/devils_advocate/gui/static/app.js +1575 -0
  37. devils_advocate-0.9.5/src/devils_advocate/gui/static/brand/dvad-black-trans.png +0 -0
  38. devils_advocate-0.9.5/src/devils_advocate/gui/static/brand/dvad-black-white.png +0 -0
  39. devils_advocate-0.9.5/src/devils_advocate/gui/static/brand/dvad-color-trans.png +0 -0
  40. devils_advocate-0.9.5/src/devils_advocate/gui/static/brand/dvad-color-white.png +0 -0
  41. devils_advocate-0.9.5/src/devils_advocate/gui/static/brand/vectorized-dvad-color-white.svg +10 -0
  42. devils_advocate-0.9.5/src/devils_advocate/gui/static/style.css +1342 -0
  43. devils_advocate-0.9.5/src/devils_advocate/gui/templates/base.html +32 -0
  44. devils_advocate-0.9.5/src/devils_advocate/gui/templates/config.html +231 -0
  45. devils_advocate-0.9.5/src/devils_advocate/gui/templates/dashboard.html +301 -0
  46. devils_advocate-0.9.5/src/devils_advocate/gui/templates/review_detail.html +394 -0
  47. devils_advocate-0.9.5/src/devils_advocate/http.py +14 -0
  48. devils_advocate-0.9.5/src/devils_advocate/ids.py +126 -0
  49. devils_advocate-0.9.5/src/devils_advocate/normalization.py +52 -0
  50. devils_advocate-0.9.5/src/devils_advocate/orchestrator/__init__.py +13 -0
  51. devils_advocate-0.9.5/src/devils_advocate/orchestrator/_common.py +774 -0
  52. devils_advocate-0.9.5/src/devils_advocate/orchestrator/_display.py +216 -0
  53. devils_advocate-0.9.5/src/devils_advocate/orchestrator/_formatting.py +155 -0
  54. devils_advocate-0.9.5/src/devils_advocate/orchestrator/code.py +251 -0
  55. devils_advocate-0.9.5/src/devils_advocate/orchestrator/integration.py +274 -0
  56. devils_advocate-0.9.5/src/devils_advocate/orchestrator/plan.py +306 -0
  57. devils_advocate-0.9.5/src/devils_advocate/orchestrator/spec.py +488 -0
  58. devils_advocate-0.9.5/src/devils_advocate/output.py +369 -0
  59. devils_advocate-0.9.5/src/devils_advocate/parser.py +653 -0
  60. devils_advocate-0.9.5/src/devils_advocate/prompts.py +197 -0
  61. devils_advocate-0.9.5/src/devils_advocate/providers.py +337 -0
  62. devils_advocate-0.9.5/src/devils_advocate/revision.py +344 -0
  63. devils_advocate-0.9.5/src/devils_advocate/service.py +180 -0
  64. devils_advocate-0.9.5/src/devils_advocate/storage.py +353 -0
  65. devils_advocate-0.9.5/src/devils_advocate/templates/__init__.py +0 -0
  66. devils_advocate-0.9.5/src/devils_advocate/templates/dedup-instruct.txt +23 -0
  67. devils_advocate-0.9.5/src/devils_advocate/templates/governance-rules-final.txt +20 -0
  68. devils_advocate-0.9.5/src/devils_advocate/templates/governance-rules.txt +31 -0
  69. devils_advocate-0.9.5/src/devils_advocate/templates/integration-reviewer-instruct.txt +27 -0
  70. devils_advocate-0.9.5/src/devils_advocate/templates/normalization-instruct.txt +15 -0
  71. devils_advocate-0.9.5/src/devils_advocate/templates/reviewer-system.txt +4 -0
  72. devils_advocate-0.9.5/src/devils_advocate/templates/revision-code-instruct.txt +22 -0
  73. devils_advocate-0.9.5/src/devils_advocate/templates/revision-integration-instruct.txt +22 -0
  74. devils_advocate-0.9.5/src/devils_advocate/templates/revision-plan-instruct.txt +21 -0
  75. devils_advocate-0.9.5/src/devils_advocate/templates/round1-author-code-instruct.txt +17 -0
  76. devils_advocate-0.9.5/src/devils_advocate/templates/round1-author-plan-instruct.txt +17 -0
  77. devils_advocate-0.9.5/src/devils_advocate/templates/round1-reviewer-instruct.txt +16 -0
  78. devils_advocate-0.9.5/src/devils_advocate/templates/round2-author-final-code-instruct.txt +18 -0
  79. devils_advocate-0.9.5/src/devils_advocate/templates/round2-author-final-plan-instruct.txt +18 -0
  80. devils_advocate-0.9.5/src/devils_advocate/templates/round2-reviewer-rebuttal-instruct.txt +39 -0
  81. devils_advocate-0.9.5/src/devils_advocate/templates/spec-dedup-instruct.txt +28 -0
  82. devils_advocate-0.9.5/src/devils_advocate/templates/spec-reviewer-instruct.txt +21 -0
  83. devils_advocate-0.9.5/src/devils_advocate/templates/spec-reviewer-system.txt +20 -0
  84. devils_advocate-0.9.5/src/devils_advocate/templates/spec-revision-instruct.txt +42 -0
  85. devils_advocate-0.9.5/src/devils_advocate/types.py +259 -0
  86. devils_advocate-0.9.5/src/devils_advocate/ui.py +5 -0
  87. devils_advocate-0.9.5/test-coverage-gap-analysis.md +620 -0
  88. devils_advocate-0.9.5/tests/conftest.py +228 -0
  89. devils_advocate-0.9.5/tests/e2e/.gitignore +4 -0
  90. devils_advocate-0.9.5/tests/e2e/baselines/config_raw_yaml.png +0 -0
  91. devils_advocate-0.9.5/tests/e2e/baselines/config_structured.png +0 -0
  92. devils_advocate-0.9.5/tests/e2e/baselines/dashboard_with_reviews.png +0 -0
  93. devils_advocate-0.9.5/tests/e2e/baselines/review_complete.png +0 -0
  94. devils_advocate-0.9.5/tests/e2e/conftest.py +392 -0
  95. devils_advocate-0.9.5/tests/e2e/diffs/.gitkeep +0 -0
  96. devils_advocate-0.9.5/tests/e2e/fixtures/captured_review/dvad-report.md +384 -0
  97. devils_advocate-0.9.5/tests/e2e/fixtures/captured_review/input_files_manifest.json +13 -0
  98. devils_advocate-0.9.5/tests/e2e/fixtures/captured_review/original_content.txt +214 -0
  99. devils_advocate-0.9.5/tests/e2e/fixtures/captured_review/review-ledger.json +890 -0
  100. devils_advocate-0.9.5/tests/e2e/fixtures/captured_review/revised-spec-suggestions.md +156 -0
  101. devils_advocate-0.9.5/tests/e2e/fixtures/captured_review/revision/revision_raw.txt +160 -0
  102. devils_advocate-0.9.5/tests/e2e/fixtures/captured_review/round1/deduplication.json +678 -0
  103. devils_advocate-0.9.5/tests/e2e/fixtures/captured_review/round1/gpt-5.2_parsed.json +164 -0
  104. devils_advocate-0.9.5/tests/e2e/fixtures/captured_review/round1/gpt-5.2_raw.txt +107 -0
  105. devils_advocate-0.9.5/tests/e2e/fixtures/captured_review/round1/grok-4-0709_parsed.json +182 -0
  106. devils_advocate-0.9.5/tests/e2e/fixtures/captured_review/round1/grok-4-0709_raw.txt +119 -0
  107. devils_advocate-0.9.5/tests/e2e/fixtures/captured_review/round1/round1-data.json +1024 -0
  108. devils_advocate-0.9.5/tests/e2e/fixtures/captured_review/round2/round2-data.json +1 -0
  109. devils_advocate-0.9.5/tests/e2e/fixtures/test-code.py +44 -0
  110. devils_advocate-0.9.5/tests/e2e/fixtures/test-plan-2.md +17 -0
  111. devils_advocate-0.9.5/tests/e2e/fixtures/test-plan.md +19 -0
  112. devils_advocate-0.9.5/tests/e2e/fixtures/test-project/src/auth.py +9 -0
  113. devils_advocate-0.9.5/tests/e2e/fixtures/test-project/src/middleware.py +9 -0
  114. devils_advocate-0.9.5/tests/e2e/fixtures/test-project/strategic-summary.md +12 -0
  115. devils_advocate-0.9.5/tests/e2e/fixtures/test-reference.md +17 -0
  116. devils_advocate-0.9.5/tests/e2e/fixtures/test-spec.md +23 -0
  117. devils_advocate-0.9.5/tests/e2e/test_config_page.py +697 -0
  118. devils_advocate-0.9.5/tests/e2e/test_dashboard.py +82 -0
  119. devils_advocate-0.9.5/tests/e2e/test_matrix.py +861 -0
  120. devils_advocate-0.9.5/tests/e2e/test_max_out_enforcement.py +197 -0
  121. devils_advocate-0.9.5/tests/e2e/test_review_detail.py +86 -0
  122. devils_advocate-0.9.5/tests/e2e/test_review_flow.py +136 -0
  123. devils_advocate-0.9.5/tests/e2e/test_visual_regression.py +97 -0
  124. devils_advocate-0.9.5/tests/fixtures/boardfoot-codebase/.gitignore +9 -0
  125. devils_advocate-0.9.5/tests/fixtures/boardfoot-codebase/app/build.gradle.kts +43 -0
  126. devils_advocate-0.9.5/tests/fixtures/boardfoot-codebase/app/src/main/AndroidManifest.xml +21 -0
  127. devils_advocate-0.9.5/tests/fixtures/boardfoot-codebase/app/src/main/java/com/kelleyb/boardfootcalculator/MainActivity.kt +95 -0
  128. devils_advocate-0.9.5/tests/fixtures/boardfoot-codebase/app/src/main/res/layout/activity_main.xml +124 -0
  129. devils_advocate-0.9.5/tests/fixtures/boardfoot-codebase/app/src/main/res/values/colors.xml +5 -0
  130. devils_advocate-0.9.5/tests/fixtures/boardfoot-codebase/app/src/main/res/values/strings.xml +15 -0
  131. devils_advocate-0.9.5/tests/fixtures/boardfoot-codebase/app/src/main/res/values/themes.xml +4 -0
  132. devils_advocate-0.9.5/tests/fixtures/boardfoot-codebase/build.gradle.kts +4 -0
  133. devils_advocate-0.9.5/tests/fixtures/boardfoot-codebase/gradle/wrapper/gradle-wrapper.jar +0 -0
  134. devils_advocate-0.9.5/tests/fixtures/boardfoot-codebase/gradle/wrapper/gradle-wrapper.properties +7 -0
  135. devils_advocate-0.9.5/tests/fixtures/boardfoot-codebase/gradle.properties +4 -0
  136. devils_advocate-0.9.5/tests/fixtures/boardfoot-codebase/gradlew +252 -0
  137. devils_advocate-0.9.5/tests/fixtures/boardfoot-codebase/gradlew.bat +94 -0
  138. devils_advocate-0.9.5/tests/fixtures/boardfoot-codebase/settings.gradle.kts +18 -0
  139. devils_advocate-0.9.5/tests/fixtures/boardfoot.sample.plan.md +214 -0
  140. devils_advocate-0.9.5/tests/fixtures/boardfoot.sample.spec.txt +38 -0
  141. devils_advocate-0.9.5/tests/test_audit_gaps.py +694 -0
  142. devils_advocate-0.9.5/tests/test_cli.py +1597 -0
  143. devils_advocate-0.9.5/tests/test_code_review.py +557 -0
  144. devils_advocate-0.9.5/tests/test_common.py +1168 -0
  145. devils_advocate-0.9.5/tests/test_config.py +711 -0
  146. devils_advocate-0.9.5/tests/test_cost.py +273 -0
  147. devils_advocate-0.9.5/tests/test_dedup.py +515 -0
  148. devils_advocate-0.9.5/tests/test_e2e_live.py +645 -0
  149. devils_advocate-0.9.5/tests/test_formatting.py +568 -0
  150. devils_advocate-0.9.5/tests/test_governance.py +407 -0
  151. devils_advocate-0.9.5/tests/test_gui_api.py +603 -0
  152. devils_advocate-0.9.5/tests/test_gui_env.py +229 -0
  153. devils_advocate-0.9.5/tests/test_gui_pages.py +232 -0
  154. devils_advocate-0.9.5/tests/test_gui_progress.py +158 -0
  155. devils_advocate-0.9.5/tests/test_gui_routes.py +202 -0
  156. devils_advocate-0.9.5/tests/test_gui_runner.py +114 -0
  157. devils_advocate-0.9.5/tests/test_ids.py +150 -0
  158. devils_advocate-0.9.5/tests/test_init_config.py +124 -0
  159. devils_advocate-0.9.5/tests/test_integration_review.py +563 -0
  160. devils_advocate-0.9.5/tests/test_normalization.py +170 -0
  161. devils_advocate-0.9.5/tests/test_orchestrator.py +350 -0
  162. devils_advocate-0.9.5/tests/test_output.py +1046 -0
  163. devils_advocate-0.9.5/tests/test_parser.py +926 -0
  164. devils_advocate-0.9.5/tests/test_prompts_templates.py +326 -0
  165. devils_advocate-0.9.5/tests/test_providers.py +1598 -0
  166. devils_advocate-0.9.5/tests/test_revision.py +530 -0
  167. devils_advocate-0.9.5/tests/test_service.py +282 -0
  168. devils_advocate-0.9.5/tests/test_spec_review.py +721 -0
  169. devils_advocate-0.9.5/tests/test_storage.py +223 -0
@@ -0,0 +1,50 @@
1
+ name: Publish to PyPI
2
+
3
+ on:
4
+ push:
5
+ branches: [main]
6
+
7
+ jobs:
8
+ publish:
9
+ runs-on: ubuntu-latest
10
+ permissions:
11
+ contents: write
12
+ steps:
13
+ - uses: actions/checkout@v4
14
+ with:
15
+ token: ${{ secrets.GITHUB_TOKEN }}
16
+
17
+ - uses: actions/setup-python@v5
18
+ with:
19
+ python-version: "3.12"
20
+
21
+ - name: Install build tools
22
+ run: pip install build twine
23
+
24
+ - name: Bump build version
25
+ run: |
26
+ current=$(grep '^version' pyproject.toml | sed 's/version = "\(.*\)"/\1/')
27
+ major=$(echo "$current" | cut -d. -f1)
28
+ minor=$(echo "$current" | cut -d. -f2)
29
+ build=$(echo "$current" | cut -d. -f3)
30
+ new="${major}.${minor}.$((build + 1))"
31
+ sed -i "s/^version = \"${current}\"/version = \"${new}\"/" pyproject.toml
32
+ echo "VERSION=${new}" >> "$GITHUB_ENV"
33
+ echo "Bumped ${current} -> ${new}"
34
+
35
+ - name: Build package
36
+ run: python -m build
37
+
38
+ - name: Upload to PyPI
39
+ env:
40
+ TWINE_USERNAME: __token__
41
+ TWINE_PASSWORD: ${{ secrets.PYPI_TOKEN }}
42
+ run: python -m twine upload dist/*
43
+
44
+ - name: Commit version bump
45
+ run: |
46
+ git config user.name "github-actions"
47
+ git config user.email "github-actions@github.com"
48
+ git add pyproject.toml
49
+ git commit -m "build: bump version to ${VERSION} [skip ci]"
50
+ git push
@@ -0,0 +1,11 @@
1
+ models.yaml
2
+ .dvad/
3
+ __pycache__/
4
+ .pytest_cache/
5
+ .venv/
6
+ *.egg-info/
7
+ dist/
8
+ *.pyc
9
+ .mypy_cache/
10
+ tests/e2e/failures/
11
+ tests/e2e/videos/
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Brian Kelley
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,162 @@
1
+ Metadata-Version: 2.4
2
+ Name: devils-advocate
3
+ Version: 0.9.5
4
+ Summary: Cost-aware multi-LLM adversarial review engine with deterministic governance
5
+ Author: Brian Kelley
6
+ License: MIT License
7
+
8
+ Copyright (c) 2026 Brian Kelley
9
+
10
+ Permission is hereby granted, free of charge, to any person obtaining a copy
11
+ of this software and associated documentation files (the "Software"), to deal
12
+ in the Software without restriction, including without limitation the rights
13
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
14
+ copies of the Software, and to permit persons to whom the Software is
15
+ furnished to do so, subject to the following conditions:
16
+
17
+ The above copyright notice and this permission notice shall be included in all
18
+ copies or substantial portions of the Software.
19
+
20
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
21
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
22
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
23
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
24
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
25
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
26
+ SOFTWARE.
27
+ License-File: LICENSE
28
+ Keywords: adversarial,code-review,consensus,governance,llm
29
+ Requires-Python: >=3.12
30
+ Requires-Dist: click>=8.1
31
+ Requires-Dist: fastapi>=0.115
32
+ Requires-Dist: httpx>=0.27
33
+ Requires-Dist: jinja2>=3.1
34
+ Requires-Dist: python-multipart>=0.0.9
35
+ Requires-Dist: pyyaml>=6.0
36
+ Requires-Dist: rich[markdown]>=13.0
37
+ Requires-Dist: ruamel-yaml>=0.18
38
+ Requires-Dist: uvicorn[standard]>=0.32
39
+ Provides-Extra: dev
40
+ Requires-Dist: httpx>=0.27; extra == 'dev'
41
+ Requires-Dist: pytest-asyncio>=0.23; extra == 'dev'
42
+ Requires-Dist: pytest>=8.0; extra == 'dev'
43
+ Requires-Dist: respx>=0.21; extra == 'dev'
44
+ Provides-Extra: e2e
45
+ Requires-Dist: pillow>=10.0; extra == 'e2e'
46
+ Requires-Dist: pixelmatch>=0.3; extra == 'e2e'
47
+ Requires-Dist: playwright>=1.48; extra == 'e2e'
48
+ Requires-Dist: pytest-playwright>=0.5; extra == 'e2e'
49
+ Description-Content-Type: text/markdown
50
+
51
+
52
+ <div align="center"><img width="200" alt="dvad-color-white" src="https://github.com/user-attachments/assets/35b89380-cddd-4b70-88ac-e71cb1d867a6" /></div>
53
+
54
+ # Devil's Advocate
55
+
56
+ Cost-aware multi-LLM adversarial review engine with deterministic governance.
57
+
58
+ **Do you have an implementation plan, codebase, or spec created by Claude, GPT, Gemini, Grok, etc and you want the flagship model from competing frontier providers to rip it apart, exposing the holes in logic and potential coding landmines, before a single line of code gets written?**
59
+
60
+ Devil's Advocate pits multiple LLM reviewers against an LLM author in a structured 2-round adversarial protocol. A deterministic governance engine (straight python, no LLM calls, no probability) resolves every finding into a machine-readable outcome. The result is a vetted artifact where every finding has been accepted, defended, challenged, or escalated (to you for final decision) with full traceability from the first objection through final resolution.
61
+
62
+ DVAD is borne from my frustrations with code generated inside an AI echo chamber (single source provider). Often I'll post a script to an LLM that didn't write it to see if the other providers could spot issues or problems. They usually do. I decided to turn it into an easy to use UI.
63
+
64
+ <img width="1358" height="989" alt="dvad main" src="https://github.com/user-attachments/assets/686fa07d-df88-436e-81a9-b4782d722107" />
65
+
66
+ <img width="1319" height="1000" alt="dvad config" src="https://github.com/user-attachments/assets/e6c0fad0-4181-4885-b064-dadb35a81a81" />
67
+
68
+ ## Requirements
69
+
70
+ - Python 3.12+
71
+ - Bare Minimum: 1 API key from 1 provider, 3 models - an author and two reviewers. (*The other roles: dedup, integration, normalization, revision, can use the same models the author or reviewers use*).
72
+ - Comfortably Confrontational: 3 API keys from 3 different providers - one for the author, one per reviewer. (*Different providers mean different blind spots and that's where the friction comes from. Friction is good.*)
73
+ - Supported providers: Every frontier provider that uses OpenAI-compatible, Anthropic, or Minimax prompt formatting. (Google Gemini, ChatGPT, Claude, DeepSeek, xAI/Grok, Minimax, Kimi, etc.)
74
+
75
+ ## Quick Install & Update
76
+
77
+ ```bash
78
+ curl -fsSL https://raw.githubusercontent.com/briankelley/devils-advocate/main/install.sh | bash
79
+ ```
80
+
81
+ Installs dvad, initializes config, sets up the systemd service, and launches the web GUI on port 8411.
82
+
83
+ ## Manual Install
84
+
85
+ ```bash
86
+ python3 -m venv ~/.local/share/devils-advocate/venv
87
+ ~/.local/share/devils-advocate/venv/bin/pip install devils-advocate
88
+ ln -sf ~/.local/share/devils-advocate/venv/bin/dvad ~/.local/bin/dvad
89
+ dvad install
90
+ ```
91
+
92
+ ## Getting Started
93
+
94
+ ### 1. Configure your models
95
+
96
+ Run `dvad config --init` to generate `~/.config/devils-advocate/models.yaml`, then edit it. Each model needs a provider, model ID, and an environment variable name for its API key. See `examples/models.yaml.example` for a fully annotated template.
97
+
98
+ ### 2. Set your API keys
99
+
100
+ API keys are resolved from environment variables — never stored in the config file. Set them in your shell or in `~/.config/devils-advocate/.env` (auto-loaded, won't override existing env vars).
101
+
102
+ ### 3. Validate
103
+
104
+ ```bash
105
+ dvad config --show
106
+ ```
107
+
108
+ ## Web GUI
109
+
110
+ The primary way to use Devil's Advocate. Covers the full workflow - submitting reviews, monitoring progress in real time, resolving escalated findings, and generating revised artifacts.
111
+
112
+ ```bash
113
+ dvad gui
114
+ ```
115
+
116
+ Opens at `http://127.0.0.1:8411`. The GUI includes a dashboard for submitting and browsing reviews, real-time review progress via SSE with per-model cost tracking, governance override controls, revision generation, and visual model/role configuration with a raw YAML editor.
117
+
118
+ By default the GUI refuses to bind to non-localhost interfaces. `--allow-nonlocal` overrides this and requires a CSRF token header on all mutating requests.
119
+
120
+ ## How It Works
121
+
122
+ 1. **Independent review** - Multiple reviewer models analyze the input in parallel, producing findings with severity, category, location, and recommendation.
123
+ 2. **Deduplication** - A dedup model groups overlapping findings into consolidated review groups, preserving source attribution.
124
+ 3. **Author response** - The author model responds to each group: **ACCEPTED**, **REJECTED**, or **PARTIAL** with a rationale.
125
+ 4. **Rebuttal** - Reviewers issue rebuttals on contested groups only. Each votes **CONCUR** or **CHALLENGE**.
126
+ 5. **Final position** - For challenged groups, the author provides a final position.
127
+ 6. **Governance** - A deterministic engine (no LLM calls, pure rule-based logic) maps every group to an outcome: **AUTO_ACCEPTED**, **AUTO_DISMISSED**, or **ESCALATED**. No finding passes through without the author demonstrating engagement - implicit and rote acceptance both escalate to human review.
128
+
129
+ Escalated findings are resolved through the GUI's override controls or `dvad override`. After governance, `dvad revise` generates the final revised artifact.
130
+
131
+ ## Review Modes
132
+
133
+ | Mode | Protocol | Input | Output |
134
+ | ------------- | ------------- | --------------------------------------------------- | ----------------------------- |
135
+ | `plan` | Adversarial | Plan file + optional reference files | `revised-plan.md` |
136
+ | `code` | Adversarial | Exactly one code file, optional spec | `revised-diff.patch` |
137
+ | `spec` | Collaborative | Spec file(s) | `revised-spec-suggestions.md` |
138
+ | `integration` | Adversarial | Input files or `.dvad/manifest.json`, optional spec | `remediation-plan.md` |
139
+
140
+ **spec** is non-adversarial - no author, no rebuttals, no governance. Findings are grouped by theme and compiled into a suggestion report. All other modes use the full 2-round adversarial protocol.
141
+
142
+ ## CLI Quick Start
143
+
144
+ ```bash
145
+ dvad review --mode plan --input plan.md --input ref.py --project myproject
146
+ dvad review --mode code --input src/app.py --spec spec.md --project myproject
147
+ dvad review --mode plan --input plan.md --project myproject --max-cost 0.50
148
+ dvad review --mode plan --input plan.md --project myproject --dry-run
149
+ ```
150
+
151
+ ## Design Notes
152
+
153
+ - **No vendor SDKs.** All provider calls use `httpx` directly - full control over request shape and retry behavior.
154
+ - **Deterministic governance.** Zero LLM calls. Every outcome is reproducible from the same inputs.
155
+ - **Atomic operations.** File writes use `mkstemp` + `os.replace`. Locking uses `O_CREAT | O_EXCL`.
156
+ - **XDG-compliant.** Config and data paths follow the XDG Base Directory specification.
157
+
158
+ Full CLI reference, configuration schema, governance rules, and cost tracking details are available in the [documentation](docs/).
159
+
160
+ ## License
161
+
162
+ MIT
@@ -0,0 +1,112 @@
1
+
2
+ <div align="center"><img width="200" alt="dvad-color-white" src="https://github.com/user-attachments/assets/35b89380-cddd-4b70-88ac-e71cb1d867a6" /></div>
3
+
4
+ # Devil's Advocate
5
+
6
+ Cost-aware multi-LLM adversarial review engine with deterministic governance.
7
+
8
+ **Do you have an implementation plan, codebase, or spec created by Claude, GPT, Gemini, Grok, etc and you want the flagship model from competing frontier providers to rip it apart, exposing the holes in logic and potential coding landmines, before a single line of code gets written?**
9
+
10
+ Devil's Advocate pits multiple LLM reviewers against an LLM author in a structured 2-round adversarial protocol. A deterministic governance engine (straight python, no LLM calls, no probability) resolves every finding into a machine-readable outcome. The result is a vetted artifact where every finding has been accepted, defended, challenged, or escalated (to you for final decision) with full traceability from the first objection through final resolution.
11
+
12
+ DVAD is borne from my frustrations with code generated inside an AI echo chamber (single source provider). Often I'll post a script to an LLM that didn't write it to see if the other providers could spot issues or problems. They usually do. I decided to turn it into an easy to use UI.
13
+
14
+ <img width="1358" height="989" alt="dvad main" src="https://github.com/user-attachments/assets/686fa07d-df88-436e-81a9-b4782d722107" />
15
+
16
+ <img width="1319" height="1000" alt="dvad config" src="https://github.com/user-attachments/assets/e6c0fad0-4181-4885-b064-dadb35a81a81" />
17
+
18
+ ## Requirements
19
+
20
+ - Python 3.12+
21
+ - Bare Minimum: 1 API key from 1 provider, 3 models - an author and two reviewers. (*The other roles: dedup, integration, normalization, revision, can use the same models the author or reviewers use*).
22
+ - Comfortably Confrontational: 3 API keys from 3 different providers - one for the author, one per reviewer. (*Different providers mean different blind spots and that's where the friction comes from. Friction is good.*)
23
+ - Supported providers: Every frontier provider that uses OpenAI-compatible, Anthropic, or Minimax prompt formatting. (Google Gemini, ChatGPT, Claude, DeepSeek, xAI/Grok, Minimax, Kimi, etc.)
24
+
25
+ ## Quick Install & Update
26
+
27
+ ```bash
28
+ curl -fsSL https://raw.githubusercontent.com/briankelley/devils-advocate/main/install.sh | bash
29
+ ```
30
+
31
+ Installs dvad, initializes config, sets up the systemd service, and launches the web GUI on port 8411.
32
+
33
+ ## Manual Install
34
+
35
+ ```bash
36
+ python3 -m venv ~/.local/share/devils-advocate/venv
37
+ ~/.local/share/devils-advocate/venv/bin/pip install devils-advocate
38
+ ln -sf ~/.local/share/devils-advocate/venv/bin/dvad ~/.local/bin/dvad
39
+ dvad install
40
+ ```
41
+
42
+ ## Getting Started
43
+
44
+ ### 1. Configure your models
45
+
46
+ Run `dvad config --init` to generate `~/.config/devils-advocate/models.yaml`, then edit it. Each model needs a provider, model ID, and an environment variable name for its API key. See `examples/models.yaml.example` for a fully annotated template.
47
+
48
+ ### 2. Set your API keys
49
+
50
+ API keys are resolved from environment variables — never stored in the config file. Set them in your shell or in `~/.config/devils-advocate/.env` (auto-loaded, won't override existing env vars).
51
+
52
+ ### 3. Validate
53
+
54
+ ```bash
55
+ dvad config --show
56
+ ```
57
+
58
+ ## Web GUI
59
+
60
+ The primary way to use Devil's Advocate. Covers the full workflow - submitting reviews, monitoring progress in real time, resolving escalated findings, and generating revised artifacts.
61
+
62
+ ```bash
63
+ dvad gui
64
+ ```
65
+
66
+ Opens at `http://127.0.0.1:8411`. The GUI includes a dashboard for submitting and browsing reviews, real-time review progress via SSE with per-model cost tracking, governance override controls, revision generation, and visual model/role configuration with a raw YAML editor.
67
+
68
+ By default the GUI refuses to bind to non-localhost interfaces. `--allow-nonlocal` overrides this and requires a CSRF token header on all mutating requests.
69
+
70
+ ## How It Works
71
+
72
+ 1. **Independent review** - Multiple reviewer models analyze the input in parallel, producing findings with severity, category, location, and recommendation.
73
+ 2. **Deduplication** - A dedup model groups overlapping findings into consolidated review groups, preserving source attribution.
74
+ 3. **Author response** - The author model responds to each group: **ACCEPTED**, **REJECTED**, or **PARTIAL** with a rationale.
75
+ 4. **Rebuttal** - Reviewers issue rebuttals on contested groups only. Each votes **CONCUR** or **CHALLENGE**.
76
+ 5. **Final position** - For challenged groups, the author provides a final position.
77
+ 6. **Governance** - A deterministic engine (no LLM calls, pure rule-based logic) maps every group to an outcome: **AUTO_ACCEPTED**, **AUTO_DISMISSED**, or **ESCALATED**. No finding passes through without the author demonstrating engagement - implicit and rote acceptance both escalate to human review.
78
+
79
+ Escalated findings are resolved through the GUI's override controls or `dvad override`. After governance, `dvad revise` generates the final revised artifact.
80
+
81
+ ## Review Modes
82
+
83
+ | Mode | Protocol | Input | Output |
84
+ | ------------- | ------------- | --------------------------------------------------- | ----------------------------- |
85
+ | `plan` | Adversarial | Plan file + optional reference files | `revised-plan.md` |
86
+ | `code` | Adversarial | Exactly one code file, optional spec | `revised-diff.patch` |
87
+ | `spec` | Collaborative | Spec file(s) | `revised-spec-suggestions.md` |
88
+ | `integration` | Adversarial | Input files or `.dvad/manifest.json`, optional spec | `remediation-plan.md` |
89
+
90
+ **spec** is non-adversarial - no author, no rebuttals, no governance. Findings are grouped by theme and compiled into a suggestion report. All other modes use the full 2-round adversarial protocol.
91
+
92
+ ## CLI Quick Start
93
+
94
+ ```bash
95
+ dvad review --mode plan --input plan.md --input ref.py --project myproject
96
+ dvad review --mode code --input src/app.py --spec spec.md --project myproject
97
+ dvad review --mode plan --input plan.md --project myproject --max-cost 0.50
98
+ dvad review --mode plan --input plan.md --project myproject --dry-run
99
+ ```
100
+
101
+ ## Design Notes
102
+
103
+ - **No vendor SDKs.** All provider calls use `httpx` directly - full control over request shape and retry behavior.
104
+ - **Deterministic governance.** Zero LLM calls. Every outcome is reproducible from the same inputs.
105
+ - **Atomic operations.** File writes use `mkstemp` + `os.replace`. Locking uses `O_CREAT | O_EXCL`.
106
+ - **XDG-compliant.** Config and data paths follow the XDG Base Directory specification.
107
+
108
+ Full CLI reference, configuration schema, governance rules, and cost tracking details are available in the [documentation](docs/).
109
+
110
+ ## License
111
+
112
+ MIT
@@ -0,0 +1,23 @@
1
+ # Releasing
2
+
3
+ ## Version Bumps
4
+
5
+ 1. Update `__version__` in `src/devils_advocate/__init__.py`
6
+ 2. Update `version` in `pyproject.toml`
7
+ 3. Commit: `git commit -am "release: vX.Y.Z"`
8
+ 4. Tag: `git tag vX.Y.Z`
9
+
10
+ ## Build and Publish
11
+
12
+ ```bash
13
+ pip install build twine
14
+ python -m build
15
+ twine upload dist/*
16
+ ```
17
+
18
+ ## Pre-release Checklist
19
+
20
+ - [ ] All tests pass: `pytest`
21
+ - [ ] Version strings match in `__init__.py` and `pyproject.toml`
22
+ - [ ] CHANGELOG updated (if maintained)
23
+ - [ ] No debug prints or development-only code
@@ -0,0 +1,20 @@
1
+ # Functional Specification: Role Assignment & Chain-of-Thought Iconography
2
+
3
+ ## Role Assignment Icons (pen-tool, scan-eye, combine, scale, file-pen, puzzle)
4
+
5
+ - **Behavior:** Bidirectional state machine between Models table and Role Assignments table. Click toggles membership in `{roles}` namespace. DOM syncs horizontally — assignment in either card immediately reflects in the other.
6
+ - **Cardinality:** Radio-select for singular roles (author, dedup, normalization, revision, integration); checkbox with ceiling=2 for reviewer.
7
+ - **Visual State:** Binary. `role-active` class (illuminated) = assigned; absence = unassigned.
8
+ - **Mutation:** Updates `config.roles` in memory; persists via `/api/config` POST on explicit save.
9
+
10
+ ## Chain-of-Thought Icons (brain)
11
+
12
+ - **Models Table:** Toggle with eligibility gating — click handler active only when model has role assignment (`thinking-eligible`). Mutates `model.thinking` boolean via `/api/config/model-thinking`. Visual state reflects `thinking` property from YAML.
13
+ - **Role Assignments Table:** Read-only. Pure function of `modelThinking[assignedModelName]` — no event listeners.
14
+ - **State Dependency:** Row existence derives from role assignment; visual state derives independently from `thinking` boolean on the assigned model.
15
+
16
+ ## Critical Constraints
17
+
18
+ 1. **Idempotent init:** `initRolePills()` and `initThinkingToggle()` guard double-attachment via `_rolePillsInitialized` / `_thinkingToggleInitialized` flags.
19
+ 2. **Hydration order:** Client-side CoT reconciliation deferred until `modelThinking` context is defined (populated by inline script injection post-`DOMContentLoaded`).
20
+ 3. **Soft navigation:** Logo click → config page must re-evaluate icon states against current `roles` and `modelThinking` without assuming empty initial state.