autofab-py 0.2.0__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 (53) hide show
  1. autofab_py-0.2.0/.gitignore +34 -0
  2. autofab_py-0.2.0/PKG-INFO +29 -0
  3. autofab_py-0.2.0/README.md +18 -0
  4. autofab_py-0.2.0/autofab_roles.toml +257 -0
  5. autofab_py-0.2.0/guides/coverage.md +45 -0
  6. autofab_py-0.2.0/guides/high_level_spec.md +148 -0
  7. autofab_py-0.2.0/guides/high_to_planning.md +105 -0
  8. autofab_py-0.2.0/guides/high_to_scenario.md +98 -0
  9. autofab_py-0.2.0/guides/low_to_lib.md +89 -0
  10. autofab_py-0.2.0/guides/low_to_test.md +92 -0
  11. autofab_py-0.2.0/guides/planning_to_low.md +123 -0
  12. autofab_py-0.2.0/guides/pretense.md +111 -0
  13. autofab_py-0.2.0/guides/pretense_coverage.md +39 -0
  14. autofab_py-0.2.0/guides/pretense_qa.md +43 -0
  15. autofab_py-0.2.0/guides/qa.md +118 -0
  16. autofab_py-0.2.0/guides/spec_qa.md +101 -0
  17. autofab_py-0.2.0/guides/uncontracted_bash.md +90 -0
  18. autofab_py-0.2.0/pyproject.toml +24 -0
  19. autofab_py-0.2.0/pyright_spec.json +5 -0
  20. autofab_py-0.2.0/support/__init__.py +5 -0
  21. autofab_py-0.2.0/support/lib/__init__.py +5 -0
  22. autofab_py-0.2.0/support/lib/app_info.py +129 -0
  23. autofab_py-0.2.0/support/lib/build_lint_common.py +5247 -0
  24. autofab_py-0.2.0/support/lib/framework.py +135 -0
  25. autofab_py-0.2.0/support/lib/framework.pyi +144 -0
  26. autofab_py-0.2.0/support/lib/high_lint.py +408 -0
  27. autofab_py-0.2.0/support/lib/lib_lint.py +1244 -0
  28. autofab_py-0.2.0/support/lib/lifecycle.py +759 -0
  29. autofab_py-0.2.0/support/lib/lifecycle.pyi +399 -0
  30. autofab_py-0.2.0/support/lib/low_lint.py +775 -0
  31. autofab_py-0.2.0/support/lib/pretense_lint.py +1228 -0
  32. autofab_py-0.2.0/support/lib/spec_lint.py +732 -0
  33. autofab_py-0.2.0/support/lib/test_lint.py +729 -0
  34. autofab_py-0.2.0/support/tests/app_info_test.py +84 -0
  35. autofab_py-0.2.0/support/tests/autofab_role_tool_test.py +1186 -0
  36. autofab_py-0.2.0/support/tests/build_lint_common_test.py +472 -0
  37. autofab_py-0.2.0/support/tests/high_lint_test.sh +169 -0
  38. autofab_py-0.2.0/support/tests/import_boundaries_lint_test.py +149 -0
  39. autofab_py-0.2.0/support/tests/lib_lint_test.sh +1436 -0
  40. autofab_py-0.2.0/support/tests/lifecycle_test.py +707 -0
  41. autofab_py-0.2.0/support/tests/linter_gates_test.py +38 -0
  42. autofab_py-0.2.0/support/tests/low_lint_test.sh +263 -0
  43. autofab_py-0.2.0/support/tests/pretense_lint_test.py +474 -0
  44. autofab_py-0.2.0/support/tests/test_lint_test.sh +1100 -0
  45. autofab_py-0.2.0/templates/empty_template.txt +0 -0
  46. autofab_py-0.2.0/templates/hls_template.md +37 -0
  47. autofab_py-0.2.0/templates/lib_template.py +10 -0
  48. autofab_py-0.2.0/templates/low_template.pyi +6 -0
  49. autofab_py-0.2.0/templates/model_configs.toml +250 -0
  50. autofab_py-0.2.0/templates/planning_template.md +37 -0
  51. autofab_py-0.2.0/templates/pretense_template.py +168 -0
  52. autofab_py-0.2.0/templates/scenario_template.md +22 -0
  53. autofab_py-0.2.0/templates/test_template.py +10 -0
@@ -0,0 +1,34 @@
1
+ /bazel-*
2
+ /agent_loop.log*
3
+ /staging/
4
+ /testing/
5
+ __pycache__/
6
+ *.py[cod]
7
+ *$py.class
8
+ .update_with_ai.textproto
9
+ .update_with_ai.proto
10
+ /.mcp.active*
11
+ /.cleanroom/
12
+ /.autofab/
13
+ .pytest_cache/
14
+ .ruff_cache/
15
+ .hypothesis/
16
+ .mcp.worker_sessions.json
17
+ .DS_Store
18
+ /.cleanroom_workspaces.json
19
+ /.cleanroom_blame_buffer.json
20
+ /.autofab_workspaces.json
21
+ /.autofab_blame_buffer.json
22
+ *.bak
23
+ *.bak/
24
+ /logs/
25
+ *.cleanroom.log*
26
+ *.autofab.log*
27
+ /benchmark_*
28
+ scratch/
29
+ .coverage*
30
+ autofab_role_workspaces/
31
+ role_workspaces/
32
+ dist/
33
+ build/
34
+ *.egg-info/
@@ -0,0 +1,29 @@
1
+ Metadata-Version: 2.5
2
+ Name: autofab-py
3
+ Version: 0.2.0
4
+ Summary: Python methodology and verification tools for the Autofab framework
5
+ Author-email: Sean McDirmid <mcdirmid@outlook.com>
6
+ License: Apache-2.0
7
+ Requires-Python: >=3.11
8
+ Requires-Dist: pyright>=1.1.350
9
+ Requires-Dist: pytest>=8.0.0
10
+ Description-Content-Type: text/markdown
11
+
12
+ # autofab-py
13
+
14
+ Python methodology package, linters, guides, and arbiter verifiers for the [Autofab](https://pypi.org/project/autofab/) autonomous pair-programming framework.
15
+
16
+ ## Overview
17
+
18
+ `autofab-py` provides the specification methodology, structural linting gates, and AST contracts for Python components developed under Autofab.
19
+
20
+ ### Key Capabilities
21
+ - **Specification Linters**: High-level specification (`high_lint`), epistemic planning (`spec_lint`), and low-level AST contract verifiers (`low_lint`).
22
+ - **Methodology Guides**: Comprehensive pair-programming guides for specifications, double-blind verification, QA arbitration, and test coverage.
23
+ - **Roles**: Declares the canonical Python roles in `autofab_roles.toml`.
24
+
25
+ ## Installation
26
+
27
+ ```bash
28
+ uv pip install autofab-py
29
+ ```
@@ -0,0 +1,18 @@
1
+ # autofab-py
2
+
3
+ Python methodology package, linters, guides, and arbiter verifiers for the [Autofab](https://pypi.org/project/autofab/) autonomous pair-programming framework.
4
+
5
+ ## Overview
6
+
7
+ `autofab-py` provides the specification methodology, structural linting gates, and AST contracts for Python components developed under Autofab.
8
+
9
+ ### Key Capabilities
10
+ - **Specification Linters**: High-level specification (`high_lint`), epistemic planning (`spec_lint`), and low-level AST contract verifiers (`low_lint`).
11
+ - **Methodology Guides**: Comprehensive pair-programming guides for specifications, double-blind verification, QA arbitration, and test coverage.
12
+ - **Roles**: Declares the canonical Python roles in `autofab_roles.toml`.
13
+
14
+ ## Installation
15
+
16
+ ```bash
17
+ uv pip install autofab-py
18
+ ```
@@ -0,0 +1,257 @@
1
+ # autofab_roles.toml
2
+ # Autofab Python methodology role definitions
3
+ # Canonical package address: //autofab_python
4
+
5
+ [methodology]
6
+ name = "python"
7
+ description = "Cleanroom literate specification and verification methodology for Python"
8
+
9
+ [roles.high]
10
+ name = "high"
11
+ persona = "High-Level Spec Engineer"
12
+ src_pattern = "{unit_dir}/high/{unit_name}.md"
13
+ guide = "autofab_python/guides/high_level_spec.md"
14
+ template = "autofab_python/templates/hls_template.md"
15
+ prompt_template = "Files are aligned according to the guide."
16
+ allows_step_mode = true
17
+ role_deps = []
18
+ star_role_deps = ["high"]
19
+ common_spec_roles = []
20
+ tools = [
21
+ "autofab_python.support.lib.high_lint",
22
+ "autofab_python.support.lib.build_lint_common",
23
+ ]
24
+ active_component_types = ["implementation", "assembly", "interface", "external"]
25
+ verify_template = "uv run python -m autofab_python.support.lib.high_lint {unit_dir}/high/{unit_name}.md"
26
+
27
+ [roles.scenario]
28
+ name = "scenario"
29
+ persona = "Scenario Author"
30
+ src_pattern = "{unit_dir}/scenarios/{unit_name}.md"
31
+ guide = "autofab_python/guides/high_to_scenario.md"
32
+ template = "autofab_python/templates/scenario_template.md"
33
+ prompt_template = "Files are aligned according to the guide."
34
+ allows_step_mode = true
35
+ role_deps = []
36
+ star_role_deps = ["scenario"]
37
+ common_spec_roles = ["high"]
38
+ tools = [
39
+ "autofab.support.lib.build_lint_common",
40
+ ]
41
+ active_component_types = ["interface", "implementation"]
42
+ verify_template = "# Scenario files verified against high_to_scenario.md"
43
+
44
+ [roles.planning]
45
+ name = "planning"
46
+ persona = "Planning Engineer"
47
+ src_pattern = "{unit_dir}/planning/{unit_name}.md"
48
+ guide = "autofab_python/guides/high_to_planning.md"
49
+ template = "autofab_python/templates/planning_template.md"
50
+ prompt_template = "Files are aligned according to the guide."
51
+ allows_step_mode = true
52
+ role_deps = []
53
+ star_role_deps = ["planning"]
54
+ feedback_role_deps = ["high"]
55
+ common_spec_roles = ["high"]
56
+ tools = [
57
+ "autofab.support.lib.build_lint_common",
58
+ ]
59
+ active_component_types = ["implementation", "interface"]
60
+ verify_template = "# Planning canvas verified against high_to_planning.md"
61
+
62
+ [roles.low]
63
+ name = "low"
64
+ persona = "Low-Level Spec Engineer"
65
+ src_pattern = "{unit_dir}/low/{unit_name}.pyi"
66
+ guide = "autofab_python/guides/planning_to_low.md"
67
+ template = "autofab_python/templates/low_template.pyi"
68
+ prompt_template = "Files are aligned according to the guide."
69
+ allows_step_mode = true
70
+ role_deps = []
71
+ star_role_deps = ["low"]
72
+ feedback_role_deps = ["planning"]
73
+ common_spec_roles = ["planning"]
74
+ tools = [
75
+ "autofab.support.lib.build_lint_common",
76
+ ]
77
+ active_component_types = ["implementation", "assembly", "interface", "external"]
78
+ verify_template = "uv run python -m autofab_python.support.lib.low_lint {unit_dir}/low/{unit_name}.pyi && uv run pyright --project $([ -f pyright_spec.json ] && echo pyright_spec.json || find . -name pyright_spec.json -not -path '*/.*' | head -n 1) {unit_dir}/low/{unit_name}.pyi"
79
+
80
+ [roles.spec_qa]
81
+ name = "spec_qa"
82
+ persona = "Specification QA Arbiter"
83
+ src_pattern = ""
84
+ guide = "autofab_python/guides/spec_qa.md"
85
+ prompt_template = "Files are aligned according to the guide."
86
+ allows_step_mode = false
87
+ role_deps = ["scenario"]
88
+ star_role_deps = ["high", "planning", "low"]
89
+ feedback_role_deps = ["high", "planning", "low"]
90
+ common_spec_roles = ["high", "planning", "scenario"]
91
+ tools = [
92
+ "autofab_python.support.lib.high_lint",
93
+ "autofab_python.support.lib.spec_lint",
94
+ "autofab_python.support.lib.low_lint",
95
+ "autofab_python.support.lib.build_lint_common",
96
+ ]
97
+ active_component_types = ["implementation", "assembly", "interface"]
98
+ verify_template = "uv run python -m autofab_python.support.lib.high_lint {unit_dir}/high/{unit_name}.md && (! test -f {unit_dir}/planning/{unit_name}.md || uv run python -m autofab_python.support.lib.spec_lint {unit_dir}/planning/{unit_name}.md) && uv run python -m autofab_python.support.lib.low_lint {unit_dir}/low/{unit_name}.pyi && uv run pyright --project $([ -f pyright_spec.json ] && echo pyright_spec.json || find . -name pyright_spec.json -not -path '*/.*' | head -n 1) {unit_dir}/low/{unit_name}.pyi"
99
+ verification_success_message = "Specification, planning, and low-level specification verified for {unit_name}."
100
+
101
+ [roles.lib]
102
+ name = "lib"
103
+ persona = "Lib Engineer"
104
+ src_pattern = "{unit_dir}/lib/{unit_name}.py"
105
+ guide = "autofab_python/guides/low_to_lib.md"
106
+ template = "autofab_python/templates/lib_template.py"
107
+ template_command = "uv run python -m autofab_python.support.lib.lib_lint --scaffold {target_file}"
108
+ prompt_template = "Files are aligned according to the guide."
109
+ allows_step_mode = true
110
+ role_deps = []
111
+ star_role_deps = ["low"]
112
+ silent_role_deps = ["spec_qa"]
113
+ silent_cross_role_deps = ["lib"]
114
+ common_spec_roles = ["low"]
115
+ tools = [
116
+ "autofab_python.support.lib.lib_lint",
117
+ "autofab_python.support.lib.build_lint_common",
118
+ ]
119
+ active_component_types = ["implementation", "assembly", "interface"]
120
+ verify_template = "uv run python -m autofab_python.support.lib.lib_lint {unit_dir}/lib/{unit_name}.py --pyi {unit_dir}/low/{unit_name}.pyi && uv run pyright {unit_dir}/lib/{unit_name}.py"
121
+ verification_success_message = "{unit_name}.py passed static checks (syntax & types). IMPORTANT: Static verification does NOT run unit tests or verify runtime logic. If this target has unacted feedback, you must resolve the defect against low/*.pyi contracts and tests before submitting."
122
+
123
+ [roles.test]
124
+ name = "test"
125
+ persona = "Test Engineer"
126
+ pipeline = "standard"
127
+ src_pattern = "{unit_dir}/tests/{unit_name}_test.py"
128
+ guide = "autofab_python/guides/low_to_test.md"
129
+ template = "autofab_python/templates/test_template.py"
130
+ template_command = "uv run python -m autofab_python.support.lib.test_lint --scaffold {target_file} --lib-pkg {unit_dir}/lib"
131
+ prompt_template = "Files are aligned according to the guide."
132
+ allows_step_mode = true
133
+ role_deps = []
134
+ star_role_deps = ["low"]
135
+ silent_role_deps = ["spec_qa"]
136
+ stub_role_deps = ["lib"]
137
+ silent_cross_role_deps = ["lib"]
138
+ common_spec_roles = ["low"]
139
+ tools = [
140
+ "autofab_python.support.lib.test_lint",
141
+ "autofab_python.support.lib.build_lint_common",
142
+ ]
143
+ active_component_types = ["implementation"]
144
+ verify_template = "uv run python -m autofab_python.support.lib.test_lint {unit_dir}/tests/{unit_name}_test.py --pyi {unit_dir}/low/{unit_name}.pyi && uv run pyright {unit_dir}/tests/{unit_name}_test.py"
145
+
146
+ verification_success_message = "{unit_name}_test.py passed static checks (syntax & types). IMPORTANT: Static verification does NOT execute test suites. Call check_file often to verify test structure and imports."
147
+
148
+ [roles.qa]
149
+ name = "qa"
150
+ persona = "QA Arbiter"
151
+ pipeline = "standard"
152
+ src_pattern = ""
153
+ guide = "autofab_python/guides/qa.md"
154
+ prompt_template = "Files are aligned according to the guide."
155
+ allows_step_mode = false
156
+ role_deps = []
157
+ star_role_deps = ["low"]
158
+ feedback_role_deps = ["lib", "test"]
159
+ common_spec_roles = ["low"]
160
+ tools = []
161
+ active_component_types = ["implementation"]
162
+ verify_template = "uv run pytest {unit_dir}/tests/{unit_name}_test.py --timeout=10 --timeout-method=thread"
163
+ verification_success_message = "Test {unit_name}_test.py passed."
164
+
165
+ [roles.coverage]
166
+ name = "coverage"
167
+ persona = "Coverage Arbiter"
168
+ pipeline = "standard"
169
+ src_pattern = ""
170
+ guide = "autofab_python/guides/coverage.md"
171
+ prompt_template = "Files are aligned according to the guide. Coverage audits must be formulated strictly against public specification contracts. Never demand testing private helpers or internal methods; uncovered defensive branches belong to the library to prune as dead code or mark as unreachable according to the methodology."
172
+ allows_step_mode = false
173
+ role_deps = []
174
+ silent_role_deps = ["qa"]
175
+ star_role_deps = ["low"]
176
+ feedback_role_deps = ["lib", "test"]
177
+ common_spec_roles = ["low"]
178
+ tools = [
179
+ "autofab.support.lib.autofab_role_tool",
180
+ ]
181
+ active_component_types = ["implementation"]
182
+ verify_template = "uv run pytest {unit_dir}/tests/{unit_name}_test.py --timeout=10 --timeout-method=thread && uv run python -m autofab.support.lib.autofab_role_tool coverage --impl {unit_dir}/lib/{unit_name}.py --test {unit_dir}/tests/{unit_name}_test.py --threshold 100.0"
183
+ verification_success_message = "All lines of {unit_name}.py are covered by {unit_name}_test.py."
184
+
185
+ [roles.pretense]
186
+ name = "pretense"
187
+ persona = "Pretense Engineer"
188
+ pipeline = "pretense"
189
+ src_pattern = "{unit_dir}/pretense/{unit_name}_pretense.py"
190
+ guide = "autofab_python/guides/pretense.md"
191
+ template = "autofab_python/templates/pretense_template.py"
192
+ template_command = "uv run python -m autofab_python.support.lib.pretense_lint --scaffold {target_file} --pyi {unit_dir}/low/{unit_name}.pyi --impl {unit_dir}/lib/{unit_name}.py"
193
+ prompt_template = "Files are aligned according to the guide. In Pretense test suites, define transition postconditions in ctx.ensures(...). In Test<Target>ImplReal, bind real instances into self.sm = TargetStateMachine(singletons={...}) and drive scenarios via self.sm.dispatch_transition(...) without redundant manual assertions, relying on ctx.ensures(...) to verify contracts automatically."
194
+ allows_step_mode = true
195
+ role_deps = []
196
+ star_role_deps = ["low"]
197
+ silent_role_deps = ["spec_qa"]
198
+ stub_role_deps = ["lib"]
199
+ silent_cross_role_deps = ["lib"]
200
+ common_spec_roles = ["low"]
201
+ tools = [
202
+ "autofab_python.support.lib.pretense_lint",
203
+ "autofab_python.support.lib.build_lint_common",
204
+ ]
205
+ active_component_types = ["implementation"]
206
+ verify_template = "uv run python -m autofab_python.support.lib.pretense_lint {unit_dir}/pretense/{unit_name}_pretense.py --pyi {unit_dir}/low/{unit_name}.pyi && uv run pyright {unit_dir}/pretense/{unit_name}_pretense.py"
207
+ verification_success_message = "{unit_name}_pretense.py passed static checks (syntax & types). IMPORTANT: Static verification does NOT execute test suites. Call check_file often to verify pretense structure."
208
+
209
+ [roles.pretense_qa]
210
+ name = "pretense_qa"
211
+ persona = "Pretense QA Arbiter"
212
+ pipeline = "pretense"
213
+ src_pattern = ""
214
+ guide = "autofab_python/guides/pretense_qa.md"
215
+ prompt_template = "Files are aligned according to the guide."
216
+ allows_step_mode = false
217
+ role_deps = []
218
+ star_role_deps = ["low"]
219
+ feedback_role_deps = ["lib", "pretense"]
220
+ common_spec_roles = ["low"]
221
+ tools = []
222
+ active_component_types = ["implementation"]
223
+ verify_template = "uv run pretense {unit_dir}/pretense/{unit_name}_pretense.py"
224
+ verification_success_message = "Pretense test {unit_name}_pretense.py passed."
225
+
226
+ [roles.pretense_coverage]
227
+ name = "pretense_coverage"
228
+ persona = "Pretense Coverage Arbiter"
229
+ pipeline = "pretense"
230
+ src_pattern = ""
231
+ guide = "autofab_python/guides/pretense_coverage.md"
232
+ prompt_template = "Files are aligned according to the guide. Coverage audits must be formulated strictly against public specification contracts. Never demand testing private helpers or internal methods; uncovered defensive branches belong to the library to prune as dead code or mark as unreachable according to the methodology."
233
+ allows_step_mode = false
234
+ role_deps = []
235
+ silent_role_deps = ["pretense_qa"]
236
+ star_role_deps = ["low"]
237
+ feedback_role_deps = ["lib", "pretense"]
238
+ common_spec_roles = ["low"]
239
+ tools = []
240
+ active_component_types = ["implementation"]
241
+ verify_template = "uv run pretense {unit_dir}/pretense/{unit_name}_pretense.py --no-fuzz --cov --threshold 100.0"
242
+ verification_success_message = "All lines of {unit_name}.py are covered by {unit_name}_pretense.py."
243
+
244
+ [fused_roles.baseline]
245
+ name = "baseline"
246
+ persona = "Baseline Software Developer"
247
+ pipeline = "standard"
248
+ roles = ["lib", "test", "qa", "coverage"]
249
+ guide = "autofab_python/guides/low_to_lib.md"
250
+
251
+ [fused_roles.pretense_baseline]
252
+ name = "pretense_baseline"
253
+ persona = "Pretense Baseline Software Developer"
254
+ pipeline = "pretense"
255
+ roles = ["lib", "pretense", "pretense_qa", "pretense_coverage"]
256
+ guide = "autofab_python/guides/low_to_lib.md"
257
+
@@ -0,0 +1,45 @@
1
+ # Guide: Coverage Arbiter
2
+
3
+ ## Summary
4
+
5
+ The verification targets are the library implementation (`lib/<name>.py`) and the test suite (`tests/<name>_test.py`) for the specified unit. In a multi-node session, multiple targets are evaluated together; each target is evaluated and submitted independently via `submit(target="<target_file>")` once 100% statement coverage is achieved, which stamps `COVERAGE_AUDIT: <timestamp>` into the in-band metadata blocks of `lib/<name>.py` and `tests/<name>_test.py` without modifying their last changed timestamps. All code files (both lib and test files) are strictly read-only for coverage; calling file editing tools on code files is prohibited, coverage never edits `.py` files directly, and coverage delivers defect attribution exclusively via the `blame` tool (specifying the blamed file `lib/<name>.py` or `tests/<name>_test.py`). When coverage deficits involve both roles (such as uncovered requirements in tests and unreachable code in the library), the arbiter attributes blame to each culprit file (`tests/<name>_test.py` and `lib/<name>.py`) within the current round. Deficit diagnosis is concise (under 200 words); the arbiter inspects uncovered lines in the library implementation with line numbers enabled, translates uncovered code into missing specification requirements, and delivers targeted blame. The search tool is never installed.
6
+
7
+ Blame feedback is strictly a single paragraph containing no newline characters; line breaks, multi-line formatting, and bulleted lists in blame explanations are prohibited. Feedback must be provided in terms of how the file being blamed is not compliant with the common source of truth specification. Line numbers can be mentioned only if they reference the file being blamed; exposing line numbers, code details, or internal variables of other files is strictly prohibited. Blame feedback delivered to the test module is strictly non-prescriptive, identifying only what specification requirements and behavioral aspects lack test coverage; it is framed strictly as missing unit test cases asserting specification postconditions, invariants, or error branches from low-level specifications, and never phrases deficits as defects or missing behaviors in library classes (e.g. stating that a class or method 'does not' perform an action), never prescribes test scenario designs, mock setups, graph topologies, or code snippets, and never mentions library file names, file paths, line numbers, or internal variable names. Blame feedback delivered to the library module is strictly restricted to reporting that code is unreachable under the specification, instructing the library to either restructure the code to eliminate the dead code or annotate it with `# pragma: no cover (assumption: <reason>)` for impossible branches or caller assumptions guaranteed by the contract; diagnosing functional bugs or prescribing functional logic changes to library code is prohibited. When a coverage deficit is attributable to missing unit tests, blaming `tests/<name>_test.py` fully resolves the assigned target; delivering blame, courtesy notices, or informational updates to `lib/<name>.py` when the library implementation contains no unreachable code or dead code is strictly prohibited. When 100% statement coverage is achieved and verified, calling `blame` is prohibited, and the target concludes via the `submit` tool, stamping `COVERAGE_AUDIT` across both verified target files. When coverage cannot be achieved without violating the contract and the code cannot be restructured or annotated with a pragma, the run fails via the `fail` tool instead.
8
+
9
+ > META: "The coverage arbiter attributes uncovered lines to missing specification requirements or caller assumptions without modifying code files."
10
+
11
+ ## Deficit diagnosis and blame feedback
12
+
13
+ - [ ] In multi-node sessions, each target is evaluated independently for its corresponding module, and submitted individually via `submit(target="<target_file>")`
14
+ - [ ] All code files are strictly read-only: the agent never modifies `.py` files directly
15
+ - [ ] Uncovered statements are inspected by reading the library implementation file with line numbers enabled
16
+ - [ ] Coverage evaluation presents all uncovered statement spans per cycle without throttling, enabling the arbiter to diagnose all active deficits together
17
+ - [ ] Blame feedback delivered to the test module is strictly non-prescriptive: it identifies only which specification requirements and behavioral aspects lack test coverage, leaving scenario design, fixture structure, graph topology, and assertion choices entirely to the test module
18
+ - [ ] Blame feedback delivered to the test module is framed strictly as missing unit test cases asserting specification postconditions, invariants, or error branches, and never phrases deficits as defects or missing behaviors in library classes (e.g. stating that a class or method 'does not' perform an action)
19
+ - [ ] Blame feedback delivered to the test module never prescribes test implementations, mock configurations, fixture designs, graph shapes, node counts, variable values, or assertion code snippets
20
+ - [ ] Anti-contamination: blame feedback must be provided in terms of how the file being blamed is not compliant with the common source of truth specification (the low-level specification and imported interface/boundary contracts in module_deps); line numbers may be mentioned only if they reference the file being blamed; mentioning line numbers, file names, file paths, internal variables, helper methods, or private execution branches of other files is strictly prohibited
21
+ - [ ] Blame feedback delivered to the test module never instructs tests to assert unmandated behaviors, internal implementation artifacts, or fabricated requirements observed in uncovered library code
22
+ - [ ] Blame feedback delivered to the test module never instructs tests to access private attributes, manipulate internal collaborator state, or invoke uncontracted methods to force execution through defensive branches; unreachable defensive branches are attributed to the library module for pragma annotation or dead code elimination
23
+ - [ ] Uncontracted non-concerns and defensive branches: when library code implements defensive checks or fallback branches for uncontracted non-concerns (conditions not specified in the low-level contract closure), instructing tests to test those branches is strictly prohibited; unreachable defensive branches must be attributed to the library module to prune as dead code or annotate with `# pragma: no cover (assumption: <reason>)`
24
+ - [ ] Repeating identical blame feedback across cycles for an unyielding deficit is prohibited: when previous feedback fails to achieve coverage, the arbiter deepens analysis of the specification contract to formulate distinct requirement aspects or evaluates whether the code is unreachable
25
+ - [ ] In multi-target sessions, the `blame` tool specifies the bound target file receiving blame (`lib/<name>.py` or `tests/<name>_test.py`)
26
+ - [ ] Multi-role defect attribution: when coverage deficits span both the test module and the library module, blame is attributed to each culprit file (`tests/<name>_test.py` and `lib/<name>.py`) within the current round
27
+ - [ ] Test deficit target resolution: when a coverage deficit is attributable to missing unit tests in `tests/<name>_test.py`, delivering blame to `tests/<name>_test.py` fully resolves the assigned target; delivering courtesy blame, informational notes, or status feedback to `lib/<name>.py` when the library implementation contains no unreachable code or dead code is strictly prohibited
28
+ - [ ] Blame feedback paragraph format: the blame explanation string is strictly a single paragraph containing no newline characters; multi-line formatting, line breaks, and bulleted lists in blame explanations are prohibited
29
+ - [ ] Blame feedback delivered to the library module is strictly restricted to reporting that specific code is unreachable under the specification closure: the feedback instructs the library module only to either restructure the code to eliminate the unreachable code or annotate it with `# pragma: no cover (assumption: <reason>)` when the code represents an impossible branch or caller assumption guaranteed by the contract
30
+ - [ ] Defensive deadlock guards, loop stall breakers, and assertions protecting against infinite execution loops are safety guards rather than redundant dead code: blaming library code to delete defensive deadlock or stall guards is prohibited; such guards are covered by testing edge/failure conditions or annotated with `# pragma: no cover (assumption: <reason>)`
31
+ - [ ] Blame feedback delivered to the library module never diagnoses functional bugs, contract deviations, or algorithmic logic errors, and never prescribes functional code fixes; functional defect arbitration belongs exclusively to QA
32
+ - [ ] When coverage cannot be achieved without violating the specification contract and the code cannot be eliminated by restructuring or justified by an assumption pragma, the session concludes via the `fail` tool
33
+ - [ ] When 100% statement coverage is achieved and verified, calling the `blame` tool is prohibited, and the target concludes via the `submit` tool
34
+
35
+ ## Lint checks
36
+
37
+ - [ ] Applies only to implementation modules ending in `_impl`
38
+ - [ ] The verified target files (lib/<name>.py and tests/<name>\_test.py) contain valid COVERAGE_AUDIT metadata tags upon successful completion
39
+
40
+ <!-- CLEANROOM METADATA
41
+ LAST_CLEANED: 2026-10-20T22:50:00Z
42
+ LAST_CHANGED: 2026-10-20T22:50:00Z
43
+ CHANGE: Enforce framing coverage blame feedback as missing unit test cases rather than library defects
44
+ CODE_HASH: 34eb94099181
45
+ -->
@@ -0,0 +1,148 @@
1
+ # Guide: High-Level Specifications
2
+
3
+ ## Summary
4
+
5
+ The artifact is a High-Level Specification (HLS) that defines a software component declaratively through literate prose under `high/<name>.md`. In a multi-node session, multiple high-level specifications are processed together; each target is identified by its file alias relative path, and each target is submitted individually via `submit(target="<target_file>", change_summary="...")` when complete (in single-target sessions, the target parameter may be omitted). Cleanroom metadata blocks at the bottom of the file (enclosed by `<!-- CLEANROOM METADATA` and `-->`) are managed automatically by Cleanroom tooling upon `submit(change_summary=...)`; direct edits to metadata blocks are prohibited and rejected by editing tools. The artifact conforms to this guide and the component architecture described in the design documents. Specifications define interface (`high/<name>.md`), implementation (`high/<name>_impl.md`), external boundary (`high/<name>_ext.md`), or assembly (`high/<name>_asm.md`) components without pseudo-code, bolding, nested bullet trees, or artificial parameter flags.
6
+
7
+ Specifications define domain concepts through a disciplined term ontology where each concept is represented by exactly one canonical term, avoiding synonym drift and avoiding introducing different terms for opposite sides of the same concept. Component visibility and lifetimes are governed by hierarchical lifecycle tiers (the root system tier and subordinate tiers defined by interface components) where services access each other directly without object type containment or factory plumbing. Specifications follow a closed two-section layout: a why-focused `## Purpose` section with an `**Out of scope:**` boundary disclaimer and an optional `**Delegated:**` boundary statement, and either a unified `## Types and Behavior` section expressed in literate prose with semantic italics strictly on term introductions (for interface, implementation, and assembly specifications), or a `## Grounding Gaps Covered` section in plain prose without semantic italics (for external boundary specifications).
8
+
9
+ > META: "High-level specifications establish declarative component architectures and disciplined term ontologies; synonym drift, dual-term divergence, and unmandated behaviors are avoided."
10
+
11
+ ## Lint checks
12
+
13
+ - [ ] Header matches `# <name> <component_type> component` where `<component_type>` is `interface`, `implementation`, `external`, or `assembly`
14
+ - [ ] Front-matter ordering places `assembles:` (for assembly specifications) and `imports:` first, followed by `implements:`
15
+ - [ ] Implementation specifications (`high/<name>_impl.md`) and assembly specifications (`high/<name>_asm.md`) declare `implements: <components>` listing the interface component names closed
16
+ - [ ] Assembly specifications (`high/<name>_asm.md`) declare `assembles: <components>` listing constituent implementation and sub-assembly component names closed
17
+ - [ ] Front-matter `implements:` clause lists interface component names rather than type names or polymorphic types
18
+ - [ ] An interface or external boundary specification never declares `implements:`
19
+ - [ ] Front-matter `implements:` clause never contains entries that are also declared under `imports:` or `assembles:`
20
+ - [ ] An implementation component implements all singleton types defined in each interface component it lists under `implements:`
21
+ - [ ] An assembly component's `implements:` clause equals the union of all `implements:` clauses of its constituent components
22
+ - [ ] An assembly component's `imports:` clause contains all components imported by its constituents except those implemented by the assembly
23
+ - [ ] A root assembly component ready for execution implements all interface components in the binary and has no imports outside data types and external boundary components
24
+ - [ ] Front-matter never contains `instantiates:` or `types from <dep>:` statements
25
+ - [ ] Imported component names in `imports:` never appear in `## Types and Behavior` or `**Out of scope:**`, appearing only in `**Delegated:**` when declared
26
+ - [ ] Implementation import accountability: every component declared in `imports:` of `high/<name>_impl.md` must be utilized in AST signatures or cited in at least one `GROUNDING:` section of `low/<name>_impl.pyi`
27
+ - [ ] Host file literal grounding: host file names, serialization schemas, and repository marker conventions belong strictly in external boundary specifications (`high/<name>_ext.md`)
28
+ - [ ] Section inventory is closed strictly to `## Purpose` and `## Types and Behavior` (or `## Grounding Gaps Covered` for external boundary specifications)
29
+ - [ ] Sub-headers (`###`) are strictly prohibited
30
+
31
+ ## Document structure and front-matter
32
+
33
+ - [ ] The document consists exclusively of optional front-matter, `## Purpose`, and `## Types and Behavior` (or `## Grounding Gaps Covered` for external boundary specifications)
34
+ - [ ] An interface component (`high/<name>.md`) defines public object types, data types, and capabilities as the bill of sale for consumers and mock generation
35
+ - [ ] An implementation component (`high/<name>_impl.md`) refines capabilities into concrete naming, algorithms, preconditions, and failure feedback for realized types without repeating property catalogs or data fields already defined in implemented interface components
36
+ - [ ] An external boundary component (`high/<name>_ext.md`) describes domain knowledge and grounding gaps covered without specifying an API or types, containing strictly `## Purpose` and `## Grounding Gaps Covered` sections, using zero semantic italics, and grounding to an external boundary stub without Python code
37
+ - [ ] An assembly component (`high/<name>_asm.md`) aggregates constituent implementation and sub-assembly components, closing their combined interface components and propagating unresolved dependencies
38
+ - [ ] Assembly components are purely structural aggregations of constituent components; no behavioral logic, tool installation, algorithmic branching, operational code, or runtime logic can occur at the assembly level
39
+ - [ ] Specifications without external dependencies omit `imports:` entirely
40
+ - [ ] `imports:` lists only component-level module names separated by commas
41
+ - [ ] Implementation specifications declare strictly necessary imports in front-matter; every declared import must be accounted for in downstream low-level AST signatures or explicit `GROUNDING:` arguments
42
+ - [ ] Host file names, configuration schemas, and persistence formats belong strictly in external boundary specifications (`high/<name>_ext.md`); interface and implementation specifications import `_ext` components rather than inventing host file literals
43
+ - [ ] Assembly specifications declare `assembles: <components>` listing constituent implementation and sub-assembly components separated by commas
44
+ - [ ] Implementation and assembly specifications declare `implements: <components>` listing closed interface component names separated by commas
45
+ - [ ] No component appears in both `imports:` and `implements:` within the same specification
46
+
47
+ ## Purpose and boundaries
48
+
49
+ - [ ] The `## Purpose` section begins with a single standalone summary sentence naming the component (`The <name> <component_type> component ...`) and articulating why the component exists rather than how it maintains state
50
+ - [ ] A single blank line follows the summary sentence, followed by one or two paragraphs of architectural rationale motivating the component from a system perspective
51
+ - [ ] The architectural rationale explains systemic friction, cascading risks, and workflow failure modes prevented, without overlapping or repeating behavioral details from `## Types and Behavior`
52
+ - [ ] The section ends with an out of scope paragraph qualified by the exact prefix `**Out of scope:** `, optionally followed by a delegated paragraph qualified by the exact prefix `**Delegated:** `
53
+ - [ ] The out of scope text identifies workflow purpose, background intent, or caller motivations outside the component and its imported dependencies, ending with `; these are handled by other components.`
54
+ - [ ] Out of scope never lists technical operations that the component coordinates or delegates to its imported dependencies
55
+ - [ ] The delegated text identifies responsibilities within the workflow coordinated by this component that are explicitly delegated to imported collaborator components, mentioning imported component names only at a high level
56
+ - [ ] Collaborator component names in `imports:` appear only in `**Delegated:**` and never appear in `**Out of scope:**` or `## Types and Behavior`
57
+
58
+ ## Term ontology and semantic italics
59
+
60
+ - [ ] Italics (`*term*`) are used strictly as semantic markers upon the first introduction of a newly defined entity, object type, data type, property or state, sub-type variant, or callable operation
61
+ - [ ] Common English words, adjectives, outcome descriptions, and structural descriptors remain in plain text without italics unless they constitute an introduced domain property
62
+ - [ ] Once introduced, all subsequent references to that term anywhere within the specification remain in plain text without italics
63
+ - [ ] Terms imported from upstream components remain in plain text without italics
64
+ - [ ] Built-in architecture constructs, lifecycle tiers, execution phases, and runtime framework concepts are not introduced by the specification and remain in plain text without italics
65
+ - [ ] Formal parameters of callable tools or explicit execution actions are italicized only upon initial introduction as newly defined parameter entities; general service capabilities express inputs, criteria, and operational context in natural plain-text prose without artificial parameter italics
66
+ - [ ] Literal tokens, method names, and identifiers mentioned in message feedback or naming are enclosed in backticks
67
+ - [ ] External boundary specifications (`high/<name>_ext.md`) use zero semantic italics throughout the document
68
+ - [ ] No bolding (`**term**`) is used anywhere in the specification, except for the `**Out of scope:**` and `**Delegated:**` prefixes
69
+
70
+ ## Canonical language and dual-term elimination
71
+
72
+ - [ ] Every domain concept is represented by exactly one canonical term; introducing synonyms, alternative verbs, or interchangeable nouns for the same concept is prohibited
73
+ - [ ] Different sides or opposite polarities of a single concept are expressed using the canonical term with negation or boolean qualifiers rather than introducing opposing dual terms
74
+ - [ ] Exceptional and failure conditions are phrased around the exceptional state rather than negating the normal path
75
+ - [ ] Domain verbs are pinned to a single canonical action across the specification rather than alternating between competing synonyms for the same action
76
+ - [ ] Specifications consistently distinguish between configuration schema definitions and runtime invocation values using distinct, consistent terms rather than interchangeable synonyms
77
+ - [ ] Registration and lifecycle management actions use a single canonical verb throughout the specification rather than mixing interchangeable operational verbs
78
+ - [ ] Outcome and result payloads use a single canonical noun throughout the specification rather than alternating between interchangeable synonyms
79
+ - [ ] Conjunctions in prose pair distinct conceptual conditions and never pair synonyms that imply non-existent states or dualities
80
+ - [ ] Relationships between entities are expressed through natural possessive phrasing rather than spatial containment or artificial container nouns
81
+ - [ ] Redundant explanatory gloss is omitted when naming already conveys type or variant intent; downstream enforcement rules belong in the components that enforce them
82
+
83
+ ## Lifecycle tiers and architecture
84
+
85
+ - [ ] Every singleton service declares its lifecycle tier using natural possessive phrasing rather than "is a" classification (e.g., "The *queue coordinator* of a render session..." or "A system's *resource manager*..."); polymorphic types do not specify a lifecycle tier
86
+ - [ ] Services do not form containment or ownership hierarchies; services within the same tier access each other directly without nested type definitions
87
+ - [ ] Aggregate services maintain collections via explicit operations, never as owned sub-types
88
+ - [ ] Lifecycle tiers form a hierarchy rooted at system with child tiers defined by interface components; descendant tiers may access ancestor tiers, but ancestor services never hold references to descendant services
89
+ - [ ] Subordinate lifecycle tiers are defined in interface components as child tiers of system or another ancestor tier, enabling dependent components to import and participate in that lifecycle
90
+ - [ ] Container and runner frameworks instantiate scoped phase services directly without factory objects
91
+ - [ ] Lifecycle phases are established as execution blocks where scoped services operate, without explicit start or stop operations; processing happens within a scoped lifecycle phase
92
+ - [ ] Lifecycle phase transitions are specified declaratively rather than procedurally, describing initial context provision rather than invocation sequences
93
+
94
+ ## Capabilities and operational rules
95
+
96
+ - [ ] Content is written in literate prose paragraphs, using selective single-level bullets separated by blank lines to enumerate parallel items or constituent collections
97
+ - [ ] Bullets are never nested; at most one level of bullet points exists
98
+ - [ ] Complete sentences terminate with a period (`.`) and never terminate with a colon (`:`)
99
+ - [ ] Bullets are preceded by a complete sentence ending with a period, followed by a separate sentence fragment header ending with a colon (`:`)
100
+ - [ ] Every bullet point grammatically completes the preceding fragment lead-in into a coherent English sentence
101
+ - [ ] Pseudo-code jargon is avoided: the term "optional" is never used, parameters state their purpose directly, and conceptual service capabilities describe inputs and outcomes in natural prose rather than procedural method signatures
102
+ - [ ] The term "flag" is avoided; boolean choices express domain actions or conditions directly
103
+ - [ ] Features, modes, and options express purpose rather than enablement; phrasing requirements around whether a feature is "enabled" or "disabled" is prohibited
104
+ - [ ] Requirements state capabilities and invariants declaratively, avoiding procedural step-by-step recipes or chronological narratives
105
+ - [ ] Prose paragraphs are concise and focused on a single responsibility or concept, containing at most three sentences; paragraphs never aggregate four or more sentences into dense prose blocks
106
+ - [ ] Multi-sentence branching conditions, operational rules, parameter catalogs, or parallel behavioral constraints are decomposed into single-level bullet lists rather than compressed into narrative paragraphs
107
+ - [ ] Every property, operational parameter, and dependency must have an explicit derivation path from known inputs, process environment, CLI flags, build manifests, upstream node data, or collaborators in scope
108
+ - [ ] Failure content provides actionable diagnostic messages and guidance on how to call the service correctly
109
+ - [ ] Operational feedback, error messages, and reminders communicate declaratively and impersonally without second-person pronouns ("you", "your")
110
+ - [ ] Injected model reasoning communicates thoughts from a first-person perspective ("I", "let me")
111
+
112
+ ## Common pitfalls
113
+
114
+ - [ ] Dual-term divergence — using different terms for different sides or polarities of the same concept instead of a single canonical term with negation
115
+ - [ ] Synonym drift — alternating between competing verbs or nouns for the same concept
116
+ - [ ] Over-italicization — italicizing common descriptive adjectives, outcome states, or general service inputs that do not represent newly introduced domain concepts or formal tool parameters
117
+ - [ ] Re-italicizing references — italicizing terms on subsequent mentions or when imported from upstream components
118
+ - [ ] Italicizing built-in constructs — italicizing lifecycle tiers, execution phases, or framework concepts that are built-in rather than introduced by the component
119
+ - [ ] Definition-only phantoms — introducing an entity, property, or configuration without a concrete derivation path for its runtime value
120
+ - [ ] Omitted edge-case branches — leaving non-standard outcomes, empty inputs, or boundary cases unhandled in the specification, forcing downstream implementations to guess behavior
121
+ - [ ] Floating directives — specifying that a component loads or resolves data without identifying the source or the mechanism that binds it
122
+ - [ ] Tier custody violations — an ancestor tier service holding direct references to descendant tier services without parameter passing
123
+ - [ ] Pseudo-code jargon — using "optional", "flags", procedural method signatures, or artificial parameter italics for conceptual services instead of declarative literate prose
124
+ - [ ] Enablement phrasing — writing "whether X is enabled" instead of stating the purpose or domain action of the feature
125
+ - [ ] Listing type names or polymorphic types in implements — including type names or polymorphic types rather than concrete interface component names in front-matter
126
+ - [ ] Incomplete interface closure — declaring an interface in implements without implementing all of its singleton types
127
+ - [ ] Overlapping imports and implements — listing an implemented interface component in imports
128
+ - [ ] Procedural recipes — describing chronological step-by-step algorithms or start/stop imperatives instead of declarative invariants
129
+ - [ ] Dangling lead-ins — writing bullets that clash grammatically with the introductory fragment lead-in
130
+ - [ ] Colon after complete sentence — ending a complete sentence with a colon before a bullet list
131
+ - [ ] Nested bullets — creating multi-level bullet trees instead of flat single-level bullet paragraphs
132
+ - [ ] Collaborator leakage in out of scope — naming specific components in out of scope instead of in delegated
133
+ - [ ] Bolding types — using `**term**` instead of `*term*` for introductions
134
+ - [ ] Spatial containment — writing "inside service X" instead of peer tier membership
135
+ - [ ] "Is-a" lifecycle classification — writing "service X is a system service" or "coordinator Y is a render session service" instead of natural possessive or containment phrasing ("A system's service X...", "The coordinator Y of a render session...", "A render session's coordinator Y...")
136
+ - [ ] Redundant gloss — appending wordy explanatory clauses that merely restate what a self-evident type or variant name already conveys (e.g., adding "synchronized with repository storage" to "synced document") or anticipating downstream component enforcement rules
137
+ - [ ] Second-person feedback — specifying failure feedback, error diagnostics, or reminders using second-person pronouns ("you", "your") instead of declarative, impersonal constraints
138
+ - [ ] Monolithic narrative paragraphs — packing multiple responsibilities, branching conditions, or operational outcomes into dense prose paragraphs of four or more sentences instead of decomposing them into concise paragraphs or declarative bullet points
139
+ - [ ] Assembly-level logic — placing operational behavior, extension registration, or algorithm logic inside an assembly component instead of delegating to constituent implementation components
140
+ - [ ] Ungrounded host file names — mentioning concrete host file names or persistence files without defining them in a dedicated external boundary specification (`high/<name>_ext.md`)
141
+ - [ ] Dead implementation imports — declaring imports in an implementation specification that are neither used in low AST nor cited in `GROUNDING:` sections
142
+
143
+ <!-- CLEANROOM METADATA
144
+ LAST_CLEANED: 2026-10-07T05:04:27Z
145
+ LAST_CHANGED: 2026-10-04T02:03:40Z
146
+ CHANGE: Clarify that cleanroom metadata headers are managed automatically by submit
147
+ CODE_HASH: 8954564f670a
148
+ -->