krystal-quorum 0.6.1__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 (51) hide show
  1. krystal_quorum-0.6.1/LICENSE +201 -0
  2. krystal_quorum-0.6.1/PKG-INFO +382 -0
  3. krystal_quorum-0.6.1/README.md +356 -0
  4. krystal_quorum-0.6.1/pyproject.toml +61 -0
  5. krystal_quorum-0.6.1/setup.cfg +4 -0
  6. krystal_quorum-0.6.1/src/krystal_quorum/__init__.py +21 -0
  7. krystal_quorum-0.6.1/src/krystal_quorum/__main__.py +5 -0
  8. krystal_quorum-0.6.1/src/krystal_quorum/cli.py +196 -0
  9. krystal_quorum-0.6.1/src/krystal_quorum/config.py +187 -0
  10. krystal_quorum-0.6.1/src/krystal_quorum/diversity.py +91 -0
  11. krystal_quorum-0.6.1/src/krystal_quorum/formatting.py +105 -0
  12. krystal_quorum-0.6.1/src/krystal_quorum/init_command.py +156 -0
  13. krystal_quorum-0.6.1/src/krystal_quorum/issue_matching.py +494 -0
  14. krystal_quorum-0.6.1/src/krystal_quorum/models.py +123 -0
  15. krystal_quorum-0.6.1/src/krystal_quorum/persist.py +139 -0
  16. krystal_quorum-0.6.1/src/krystal_quorum/prompts.py +83 -0
  17. krystal_quorum-0.6.1/src/krystal_quorum/reconcile.py +255 -0
  18. krystal_quorum-0.6.1/src/krystal_quorum/reviewers/__init__.py +11 -0
  19. krystal_quorum-0.6.1/src/krystal_quorum/reviewers/base.py +245 -0
  20. krystal_quorum-0.6.1/src/krystal_quorum/reviewers/command.py +178 -0
  21. krystal_quorum-0.6.1/src/krystal_quorum/reviewers/mock.py +46 -0
  22. krystal_quorum-0.6.1/src/krystal_quorum/reviewers/ollama.py +131 -0
  23. krystal_quorum-0.6.1/src/krystal_quorum/reviewers/openai_compatible.py +132 -0
  24. krystal_quorum-0.6.1/src/krystal_quorum/templates/agent_integrations/claude-code/.claude/commands/quorum-review.md +26 -0
  25. krystal_quorum-0.6.1/src/krystal_quorum/templates/agent_integrations/claude-code/.claude/skills/krystal-quorum-review/SKILL.md +54 -0
  26. krystal_quorum-0.6.1/src/krystal_quorum/templates/agent_integrations/codex/.codex/skills/krystal-quorum-review/SKILL.md +23 -0
  27. krystal_quorum-0.6.1/src/krystal_quorum/templates/agent_integrations/common/quorum-review.md +40 -0
  28. krystal_quorum-0.6.1/src/krystal_quorum/templates/agent_integrations/hermes/.hermes/skills/krystal-quorum-plan-review/SKILL.md +62 -0
  29. krystal_quorum-0.6.1/src/krystal_quorum/templates/agent_integrations/openclaw/.openclaw/skills/krystal-quorum-openclaw-review/SKILL.md +49 -0
  30. krystal_quorum-0.6.1/src/krystal_quorum/templates/agent_integrations/opencode/.opencode/skills/krystal-quorum-review.md +24 -0
  31. krystal_quorum-0.6.1/src/krystal_quorum.egg-info/PKG-INFO +382 -0
  32. krystal_quorum-0.6.1/src/krystal_quorum.egg-info/SOURCES.txt +49 -0
  33. krystal_quorum-0.6.1/src/krystal_quorum.egg-info/dependency_links.txt +1 -0
  34. krystal_quorum-0.6.1/src/krystal_quorum.egg-info/entry_points.txt +2 -0
  35. krystal_quorum-0.6.1/src/krystal_quorum.egg-info/requires.txt +10 -0
  36. krystal_quorum-0.6.1/src/krystal_quorum.egg-info/top_level.txt +1 -0
  37. krystal_quorum-0.6.1/tests/test_adapters.py +315 -0
  38. krystal_quorum-0.6.1/tests/test_cli.py +318 -0
  39. krystal_quorum-0.6.1/tests/test_command_reviewer.py +359 -0
  40. krystal_quorum-0.6.1/tests/test_diversity.py +45 -0
  41. krystal_quorum-0.6.1/tests/test_init_command.py +95 -0
  42. krystal_quorum-0.6.1/tests/test_issue_matching.py +155 -0
  43. krystal_quorum-0.6.1/tests/test_mock_review.py +103 -0
  44. krystal_quorum-0.6.1/tests/test_models.py +114 -0
  45. krystal_quorum-0.6.1/tests/test_persist.py +119 -0
  46. krystal_quorum-0.6.1/tests/test_prompts.py +51 -0
  47. krystal_quorum-0.6.1/tests/test_public_readiness.py +143 -0
  48. krystal_quorum-0.6.1/tests/test_reconcile.py +317 -0
  49. krystal_quorum-0.6.1/tests/test_reviewer_exports.py +13 -0
  50. krystal_quorum-0.6.1/tests/test_v04_experiments.py +203 -0
  51. krystal_quorum-0.6.1/tests/test_version.py +12 -0
@@ -0,0 +1,201 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for reasonable and customary use in describing the
141
+ origin of the Work and reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
177
+
178
+ APPENDIX: How to apply the Apache License to your work.
179
+
180
+ To apply the Apache License to your work, attach the following
181
+ boilerplate notice, with the fields enclosed by brackets "[]"
182
+ replaced with your own identifying information. (Don't include
183
+ the brackets!) The text should be enclosed in the appropriate
184
+ comment syntax for the file format. We also recommend that a
185
+ file or class name and description of purpose be included on the
186
+ same "printed page" as the copyright notice for easier
187
+ identification within third-party archives.
188
+
189
+ Copyright [yyyy] [name of copyright owner]
190
+
191
+ Licensed under the Apache License, Version 2.0 (the "License");
192
+ you may not use this file except in compliance with the License.
193
+ You may obtain a copy of the License at
194
+
195
+ http://www.apache.org/licenses/LICENSE-2.0
196
+
197
+ Unless required by applicable law or agreed to in writing, software
198
+ distributed under the License is distributed on an "AS IS" BASIS,
199
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200
+ See the License for the specific language governing permissions and
201
+ limitations under the License.
@@ -0,0 +1,382 @@
1
+ Metadata-Version: 2.4
2
+ Name: krystal-quorum
3
+ Version: 0.6.1
4
+ Summary: Preflight review for AI coding plans.
5
+ License-Expression: Apache-2.0
6
+ Project-URL: Homepage, https://github.com/KrystalUnity/krystal-quorum
7
+ Project-URL: Repository, https://github.com/KrystalUnity/krystal-quorum
8
+ Project-URL: Issues, https://github.com/KrystalUnity/krystal-quorum/issues
9
+ Classifier: Programming Language :: Python :: 3
10
+ Classifier: Programming Language :: Python :: 3.11
11
+ Classifier: Programming Language :: Python :: 3.12
12
+ Classifier: Topic :: Software Development :: Quality Assurance
13
+ Requires-Python: >=3.11
14
+ Description-Content-Type: text/markdown
15
+ License-File: LICENSE
16
+ Requires-Dist: httpx>=0.27
17
+ Requires-Dist: pydantic>=2.7
18
+ Requires-Dist: typer>=0.12
19
+ Provides-Extra: dev
20
+ Requires-Dist: build>=1.2; extra == "dev"
21
+ Requires-Dist: pytest>=8.2; extra == "dev"
22
+ Requires-Dist: pytest-asyncio>=0.23; extra == "dev"
23
+ Requires-Dist: ruff>=0.5; extra == "dev"
24
+ Requires-Dist: twine>=5; extra == "dev"
25
+ Dynamic: license-file
26
+
27
+ # Krystal Quorum
28
+
29
+ [![CI](https://github.com/KrystalUnity/krystal-quorum/actions/workflows/ci.yml/badge.svg)](https://github.com/KrystalUnity/krystal-quorum/actions/workflows/ci.yml)
30
+ [![License](https://img.shields.io/badge/license-Apache--2.0-blue.svg)](LICENSE)
31
+
32
+ ```text
33
+ +-- Krystal Quorum ------------------------+
34
+ | Review the plan before agents edit code. |
35
+ +------------------------------------------+
36
+ ```
37
+
38
+ Review the plan before your AI coding agent creates the mess.
39
+
40
+ Krystal Quorum is a local CLI that reviews markdown implementation plans with one or more independent reviewers, then writes a reconciled human-triage summary. It is designed for developers using AI coding agents who want to catch vague requirements, missing acceptance criteria, contradictions, unsafe assumptions, rollback gaps, and test gaps before code is written.
41
+
42
+ Krystal Quorum is not an agent runtime and not a code generator. It is a review step before implementation.
43
+
44
+ ## Quickstart
45
+
46
+ Until Krystal Quorum is published to PyPI, install it from a source checkout:
47
+
48
+ ```bash
49
+ git clone https://github.com/KrystalUnity/krystal-quorum.git
50
+ cd krystal-quorum
51
+ python -m pip install .
52
+ python -m krystal_quorum review examples/bad-plan.md --reviewers mock --format pretty
53
+ ```
54
+
55
+ The no-key mock reviewer returns `REVISE` for the deliberately weak plan and
56
+ writes an append-only review run under `.krystal-quorum/reviews/`.
57
+
58
+ By default Quorum rejects plans over 120,000 characters before reviewers are
59
+ constructed, with a rough token estimate in the error. Use `--max-plan-chars`
60
+ to raise the limit or `--max-plan-chars 0` to disable the guard for a
61
+ controlled run.
62
+
63
+ For development from the checkout:
64
+
65
+ ```bash
66
+ python -m pip install -e ".[dev]"
67
+ ```
68
+
69
+ ## See It Work
70
+
71
+ ```bash
72
+ python -m krystal_quorum review examples/bad-plan.md --reviewers mock --format pretty
73
+ ```
74
+
75
+ ```text
76
+ + Krystal Quorum ------------------------------------------------------------+
77
+ VERDICT: REVISE | Confidence: 0.77
78
+ Reviewers: mock
79
+ Diversity: ok
80
+
81
+ Singleton Blockers (1)
82
+ - [Acceptance] The plan does not include explicit acceptance criteria.
83
+
84
+ Artifacts: .krystal-quorum/reviews/...
85
+ +----------------------------------------------------------------------------+
86
+ ```
87
+
88
+ `REVISE` exits with code `1`, so CI scripts can fail fast when a plan needs
89
+ work. Review artifacts are written locally and ignored by git.
90
+
91
+ Now run the fixed plan:
92
+
93
+ ```bash
94
+ python -m krystal_quorum review examples/good-plan.md --reviewers mock --format pretty
95
+ ```
96
+
97
+ The mock reviewer sees explicit acceptance criteria and returns `APPROVE`
98
+ with exit code `0`. See [docs/demo.md](docs/demo.md) for a short transcript and
99
+ terminal card.
100
+
101
+ JSON remains available for scripts with `--format json`, which is also the
102
+ default.
103
+
104
+ ## Agent Import Packs
105
+
106
+ Install project-local skills or prompt files for the agents you already use:
107
+
108
+ | Target | Command |
109
+ | --- | --- |
110
+ | Claude Code | `krystal-quorum init --target claude-code` |
111
+ | Codex | `krystal-quorum init --target codex` |
112
+ | Hermes-style runners | `krystal-quorum init --target hermes` |
113
+ | Claw / OpenClaw | `krystal-quorum init --target claw` |
114
+ | OpenCode | `krystal-quorum init --target opencode` |
115
+ | Everything | `krystal-quorum init --target all` |
116
+
117
+ The packs share one workflow file at
118
+ `.krystal-quorum/agents/quorum-review.md`, so every agent gets the same review
119
+ gate. Details live in [docs/agent-integrations.md](docs/agent-integrations.md)
120
+ and [docs/agent-import-packs.md](docs/agent-import-packs.md).
121
+
122
+ List supported targets with:
123
+
124
+ ```bash
125
+ krystal-quorum init --list-targets
126
+ ```
127
+
128
+ Example JSON output:
129
+
130
+ ```json
131
+ {
132
+ "schema_version": "1.2",
133
+ "verdict": "REVISE",
134
+ "confidence": 0.9,
135
+ "reviewers_used": ["mock"],
136
+ "diversity": "ok",
137
+ "diversity_reason": null,
138
+ "diversity_reviewers": [{"reviewer": "mock", "backend": "mock", "family": "mock"}],
139
+ "output_dir": ".krystal-quorum/reviews/bad-plan_20260619-102618"
140
+ }
141
+ ```
142
+
143
+ ## Reviewers
144
+
145
+ Krystal Quorum is bring-your-own-LLM. The CLI sends the plan text to each
146
+ configured reviewer, asks for strict JSON, then reconciles the responses into
147
+ one human-triage summary.
148
+
149
+ If a reviewer returns malformed text instead of the strict JSON contract,
150
+ Krystal Quorum retries that reviewer once with a JSON-only reminder. The final
151
+ artifact records the retry count and preserves raw text from both attempts.
152
+ Transient HTTP failures from Ollama or OpenAI-compatible reviewers are retried
153
+ before the reviewer is marked `ABSTAIN`.
154
+ When a reviewer omits `<json>` tags, Quorum searches for complete reviewer JSON
155
+ objects and prefers the last one, which reduces false parses when a model echoes
156
+ the schema before its final answer. Reasoning-only responses are parsed only
157
+ when they contain explicit `<json>...</json>` tags.
158
+
159
+ Use the mock reviewer first to prove the workflow works. It uses no network and
160
+ requires no keys:
161
+
162
+ ```bash
163
+ krystal-quorum review examples/bad-plan.md --reviewers mock --format pretty
164
+ ```
165
+
166
+ ### Local Ollama
167
+
168
+ Start Ollama with any model you already have available, then pass the model name
169
+ after `ollama:`:
170
+
171
+ ```bash
172
+ krystal-quorum review plan.md --reviewers ollama:qwen2.5:14b
173
+ ```
174
+
175
+ Prefer instruct-tuned models for reviewer adapters. Reasoning-heavy models can
176
+ spend most of the default timeout on internal thinking and may abstain if they
177
+ do not return the strict JSON contract in time.
178
+
179
+ For Ollama-compatible servers that support reasoning controls, project config
180
+ can disable thinking and cap generation:
181
+
182
+ ```toml
183
+ [ollama]
184
+ think = false
185
+ num_predict = 1024
186
+ ```
187
+
188
+ If Ollama is running somewhere other than `http://localhost:11434`, set
189
+ `OLLAMA_BASE_URL`:
190
+
191
+ ```bash
192
+ OLLAMA_BASE_URL=http://192.168.1.20:11434 krystal-quorum review plan.md --reviewers ollama:your-model
193
+ ```
194
+
195
+ ### OpenAI API
196
+
197
+ ```bash
198
+ export OPENAI_API_KEY=...
199
+ krystal-quorum review plan.md --reviewers openai:gpt-4.1
200
+ ```
201
+
202
+ PowerShell:
203
+
204
+ ```powershell
205
+ $env:OPENAI_API_KEY = "..."
206
+ krystal-quorum review plan.md --reviewers openai:gpt-4.1
207
+ ```
208
+
209
+ ### OpenAI-Compatible Servers
210
+
211
+ Any server that exposes an OpenAI-compatible `/chat/completions` endpoint can be
212
+ used by setting `OPENAI_BASE_URL`. This is how you connect hosted providers,
213
+ gateway services, or local inference servers that mimic the OpenAI API.
214
+
215
+ ```bash
216
+ export OPENAI_API_KEY=your-provider-key-or-local-placeholder
217
+ export OPENAI_BASE_URL=http://localhost:1234/v1
218
+ krystal-quorum review plan.md --reviewers openai:your-model
219
+ ```
220
+
221
+ PowerShell:
222
+
223
+ ```powershell
224
+ $env:OPENAI_API_KEY = "your-provider-key-or-local-placeholder"
225
+ $env:OPENAI_BASE_URL = "http://localhost:1234/v1"
226
+ krystal-quorum review plan.md --reviewers openai:your-model
227
+ ```
228
+
229
+ ### Local Command Reviewers
230
+
231
+ Use `command:<name>` reviewers when you already have local coding agents or
232
+ review scripts installed. Command reviewers receive the full review prompt on
233
+ stdin and can return the strict reviewer JSON on stdout.
234
+
235
+ ```toml
236
+ # krystal-quorum.toml
237
+ [reviewers.local-codex]
238
+ type = "command"
239
+ command = ["codex", "exec", "--sandbox", "read-only", "--ephemeral", "-"]
240
+ timeout_s = 180
241
+ ```
242
+
243
+ Then run:
244
+
245
+ ```bash
246
+ krystal-quorum review plan.md --config krystal-quorum.toml --reviewers command:local-codex
247
+ ```
248
+
249
+ If a tool writes its final answer to a file, configure `output_file`. This is
250
+ useful for wrappers that start a detached local agent process and collect the
251
+ final review later.
252
+
253
+ ```toml
254
+ [reviewers.local-agent]
255
+ type = "command"
256
+ command = ["bash", "reviewers/local-agent-review.sh"]
257
+ timeout_s = 30
258
+ output_file = ".krystal-quorum/tmp/local-agent-review.json"
259
+ wait_for_output_s = 300
260
+ ```
261
+
262
+ Command reviewers are intentionally generic. They can wrap installed CLIs,
263
+ local scripts, or remote shells. If a command times out, exits without output,
264
+ or still returns unparseable text after the one-shot parse retry, Krystal
265
+ Quorum records that reviewer as `ABSTAIN` instead of blocking the whole run.
266
+ Multi-reviewer runs surface partial abstentions in `unresolved_for_human`; if a
267
+ multi-reviewer quorum collapses to only one usable reviewer, the merged verdict
268
+ is forced to `REVISE` for human triage.
269
+
270
+ Try the bundled command-reviewer example:
271
+
272
+ ```bash
273
+ krystal-quorum review examples/bad-plan.md --config examples/command-reviewer.toml --reviewers command:example-local
274
+ ```
275
+
276
+ ### Multiple Reviewers
277
+
278
+ Pass a comma-separated reviewer list to compare independent model reviews:
279
+
280
+ ```bash
281
+ krystal-quorum review plan.md --reviewers ollama:model-a,openai:model-b
282
+ ```
283
+
284
+ Add `--round2` when you want reviewers to cross-audit each other's findings
285
+ before the final reconciliation:
286
+
287
+ ```bash
288
+ krystal-quorum review plan.md --reviewers ollama:model-a,openai:model-b --round2
289
+ ```
290
+
291
+ Round 2 artifacts include `round2_delta` and per-reviewer before/after verdicts
292
+ so you can see whether cross-audit changed any reviewer positions.
293
+ When `--round2` is used, the short CLI JSON also includes `round2_comparisons`
294
+ for scripts that do not read the full artifact directory.
295
+
296
+ ### Reviewer Diversity
297
+
298
+ Krystal Quorum reports reviewer diversity in both CLI output and persisted
299
+ artifacts. Diversity is `low` when any two reviewers resolve to the same model
300
+ family, such as `openai:gpt-4.1` and `openai:gpt-4.1-mini`, or
301
+ `ollama:qwen2.5:14b` and `ollama:qwen2.5:32b`.
302
+
303
+ Use `--require-diversity` to fail closed before review when reviewers are too
304
+ correlated:
305
+
306
+ ```bash
307
+ krystal-quorum review plan.md \
308
+ --reviewers ollama:qwen2.5:14b,ollama:qwen2.5:32b \
309
+ --require-diversity
310
+ ```
311
+
312
+ Command reviewers use the command name as their family by default. You can
313
+ override that in config:
314
+
315
+ ```toml
316
+ [reviewers.local-agent-a]
317
+ type = "command"
318
+ command = ["bash", "reviewers/a.sh"]
319
+ family = "local-agent"
320
+ ```
321
+
322
+ Low diversity does not change the verdict by itself, but it reduces the
323
+ reported system confidence.
324
+
325
+ ## Reconciliation Model
326
+
327
+ Krystal Quorum is safety-biased rather than majority-rule voting. A single
328
+ `BLOCK` verdict blocks the merged result, and a single unresolved blocking issue
329
+ forces at least `REVISE`. When two or more reviewers report substantially
330
+ similar blocking issues, Quorum promotes that finding to a shared blocker. This
331
+ single-`BLOCK` veto is intentional fail-safe behavior; run Round 2 or inspect
332
+ the artifacts when a lone reviewer disagrees with the rest of the quorum.
333
+
334
+ Consensus matching is deterministic and explainable. Quorum groups reviewer
335
+ findings with a small public concept matcher for common review areas such as
336
+ acceptance criteria, rollback, tests, security, dependencies, and observability.
337
+ It does not use embeddings or hidden model calls to decide whether two issues
338
+ match. Persisted review artifacts include `issue_clusters` with members, direct
339
+ match edges, and match reasons.
340
+
341
+ Support-overlap consensus requires at least two shared support terms and an
342
+ overlap coefficient of at least `0.50`. Absence-style findings require a shared
343
+ topic-specific gap term, so broad words like "missing" or generic section names
344
+ like "Plan" are not enough to create consensus.
345
+
346
+ Set `KRYSTAL_QUORUM_CONSENSUS_MATCHER=legacy` to temporarily restore the older
347
+ token-overlap grouping behavior. This is a behavior rollback, not a schema
348
+ downgrade: schema-1.1-only consumers should pin a v0.3.x release or revert the
349
+ v0.4 change.
350
+
351
+ Reviewers are asked to emit `per_clause` statuses for common plan clauses such
352
+ as acceptance criteria, rollback, tests, safety assumptions, security risk,
353
+ dependency scope, and observability plan. Contradictory clause statuses are
354
+ surfaced for human triage instead of being averaged away. Common key variants
355
+ such as `acceptance_criteria` and `security_risk` are normalized before
356
+ comparison; unknown keys are flagged in `unresolved_for_human`.
357
+
358
+ The `confidence` field is a system-adjusted signal. It starts from reviewer
359
+ self-reported confidence, then discounts weak quorum health, low diversity,
360
+ singleton blockers, and contradictions.
361
+
362
+ Architecture notes:
363
+
364
+ - [Consensus matching](docs/architecture/consensus-matching.md)
365
+ - [Local command reviewers](docs/architecture/local-command-reviewers.md)
366
+
367
+ Benchmark fixtures live in [benchmarks/](benchmarks/). They provide a small,
368
+ public way to compare single-reviewer and multi-reviewer behavior without
369
+ claiming more evidence than the project has collected.
370
+
371
+ ## Exit Codes
372
+
373
+ - `0`: approve
374
+ - `1`: revise
375
+ - `2`: block
376
+ - `3`: runtime or configuration error
377
+
378
+ Reviewer outputs are advisory. A human should triage the findings before implementation.
379
+
380
+ ## License
381
+
382
+ Apache-2.0.