claude-dev-env 1.17.2 → 1.19.0

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 (32) hide show
  1. package/bin/install.mjs +145 -63
  2. package/hooks/blocking/content-search-to-zoekt-redirector.py +55 -0
  3. package/hooks/blocking/content_search_zoekt_bash_block_reason.py +25 -0
  4. package/hooks/blocking/content_search_zoekt_block_payload.py +17 -0
  5. package/hooks/blocking/content_search_zoekt_indexed_paths.py +24 -0
  6. package/hooks/blocking/content_search_zoekt_indexed_roots_config.py +131 -0
  7. package/hooks/blocking/content_search_zoekt_redirect_guidance.py +19 -0
  8. package/hooks/blocking/destructive-command-blocker.py +53 -4
  9. package/hooks/blocking/test_content_search_to_zoekt_redirector_integration.py +54 -0
  10. package/hooks/blocking/test_content_search_to_zoekt_redirector_unit.py +51 -0
  11. package/hooks/blocking/test_content_search_zoekt_indexed_roots_config.py +102 -0
  12. package/hooks/blocking/test_destructive_command_blocker.py +108 -0
  13. package/package.json +4 -1
  14. package/skills/rule-audit/SKILL.md +2 -2
  15. package/hooks/HOOK_SPECS_PROMPT_WORKFLOW.md +0 -64
  16. package/hooks/blocking/prompt_workflow_clipboard.py +0 -63
  17. package/hooks/blocking/prompt_workflow_gate_config.py +0 -113
  18. package/hooks/blocking/prompt_workflow_gate_core.py +0 -289
  19. package/hooks/blocking/prompt_workflow_validate.py +0 -218
  20. package/hooks/blocking/test_prompt_workflow_clipboard.py +0 -54
  21. package/hooks/blocking/test_prompt_workflow_gate_core.py +0 -195
  22. package/hooks/blocking/test_prompt_workflow_validate.py +0 -339
  23. package/rules/prompt-workflow-context-controls.md +0 -48
  24. package/skills/agent-prompt/SKILL.md +0 -199
  25. package/skills/prompt-generator/ARCHITECTURE.md +0 -18
  26. package/skills/prompt-generator/REFERENCE.md +0 -254
  27. package/skills/prompt-generator/REFINEMENT_PIPELINE_RUNBOOK.md +0 -177
  28. package/skills/prompt-generator/SKILL.md +0 -354
  29. package/skills/prompt-generator/TARGET_OUTPUT.md +0 -133
  30. package/skills/prompt-generator/evals/prompt-generator.json +0 -207
  31. package/skills/prompt-generator/templates/skill-from-ground-up.md +0 -104
  32. package/skills/prompt-generator/templates/skill-refinement-package.md +0 -109
@@ -1,195 +0,0 @@
1
- """Unit tests for shared prompt workflow gate logic."""
2
-
3
- from prompt_workflow_gate_core import (
4
- extract_fenced_xml_content,
5
- extract_fenced_xml_content_from_export,
6
- find_ambiguous_scope_terms,
7
- has_checklist_container,
8
- has_internal_object_leak,
9
- is_prompt_workflow_response,
10
- missing_context_control_signals,
11
- missing_checklist_rows,
12
- missing_required_xml_sections,
13
- missing_scope_anchors,
14
- normalize_prompt_workflow_export,
15
- )
16
-
17
- def test_internal_object_leak_detected() -> None:
18
- text = '{"pipeline_mode": "internal_section_refinement_with_final_audit"}'
19
- assert has_internal_object_leak(text)
20
-
21
- def test_missing_scope_anchors_returns_expected_rows() -> None:
22
- text = "target_local_roots only."
23
- missing = missing_scope_anchors(text)
24
- assert "target_canonical_roots" in missing
25
- assert "completion_boundary" in missing
26
-
27
- def test_missing_checklist_rows_detected() -> None:
28
- text = "checklist_results: structured_scoped_instructions only"
29
- missing = missing_checklist_rows(text)
30
- assert "completion_boundary_measurable" in missing
31
-
32
- def test_checklist_container_detection() -> None:
33
- assert has_checklist_container("checklist_results:\n- structured_scoped_instructions")
34
-
35
- def test_prompt_workflow_response_detection() -> None:
36
- message = (
37
- "overall_status: pass\n"
38
- "target_local_roots: /repo\n"
39
- "comparison_basis: current behavior vs deterministic guarantees\n"
40
- )
41
- assert is_prompt_workflow_response(message)
42
-
43
- def test_missing_context_control_signals_detected() -> None:
44
- missing = missing_context_control_signals("base_minimal_instruction_layer: true")
45
- assert "on_demand_skill_loading: true" in missing
46
-
47
- def test_ambiguous_scope_terms_detected() -> None:
48
- text = "Scope applies to this session and current files."
49
- terms = find_ambiguous_scope_terms(text)
50
- assert "this session" in terms
51
- assert "current files" in terms
52
-
53
- def _fenced_xml(body: str) -> str:
54
- return f"```xml\n{body}\n```"
55
-
56
- def _runtime_context_lines() -> tuple[str, ...]:
57
- return (
58
- "<runtime_context>",
59
- "base_minimal_instruction_layer: true",
60
- "on_demand_skill_loading: true",
61
- "</runtime_context>",
62
- "",
63
- )
64
-
65
- def _flattened_transcript(*lines: str) -> str:
66
- return "\n".join(lines) + "\n"
67
-
68
- def _flattened_attempt(*body_lines: str, audit_line: str = "Audit: pass 15/15") -> str:
69
- flattened_lines = [audit_line, ""]
70
- for line in body_lines:
71
- flattened_lines.append(f" {line}" if line else "")
72
- return "\n".join(flattened_lines)
73
-
74
- def test_missing_required_xml_sections_all_present_returns_empty() -> None:
75
- body = (
76
- "<role>R.</role>\n"
77
- "<background>C.</background>\n"
78
- "<instructions>I.</instructions>\n"
79
- "<constraints>Co.</constraints>\n"
80
- "<output_format>O.</output_format>\n"
81
- )
82
- assert missing_required_xml_sections(_fenced_xml(body)) == []
83
-
84
- def test_missing_required_xml_sections_missing_background() -> None:
85
- body = (
86
- "<role>R.</role>\n"
87
- "<instructions>I.</instructions>\n"
88
- "<constraints>Co.</constraints>\n"
89
- "<output_format>O.</output_format>\n"
90
- )
91
- assert missing_required_xml_sections(_fenced_xml(body)) == ["background"]
92
-
93
- def test_missing_required_xml_sections_missing_role_and_output_format() -> None:
94
- body = (
95
- "<background>C.</background>\n"
96
- "<instructions>I.</instructions>\n"
97
- "<constraints>Co.</constraints>\n"
98
- )
99
- missing = missing_required_xml_sections(_fenced_xml(body))
100
- assert missing == ["role", "output_format"]
101
-
102
- def test_missing_required_xml_sections_no_fence_returns_empty() -> None:
103
- assert missing_required_xml_sections("no fenced xml here") == []
104
-
105
- def test_missing_required_xml_sections_prose_without_tags_counts_as_missing() -> None:
106
- body = (
107
- "<role>R.</role>\n"
108
- "background appears in prose but has no tags.\n"
109
- "<instructions>I.</instructions>\n"
110
- "<constraints>Co.</constraints>\n"
111
- "<output_format>O.</output_format>\n"
112
- )
113
- assert missing_required_xml_sections(_fenced_xml(body)) == ["background"]
114
-
115
- def test_extract_fenced_xml_preserves_content_after_nested_inner_fence() -> None:
116
- message = (
117
- "```xml\n"
118
- "<role>R</role>\n"
119
- "<illustrations>\n"
120
- "```bash\necho hi\n```\n"
121
- "</illustrations>\n"
122
- "<background>B</background>\n"
123
- "<instructions>I</instructions>\n"
124
- "<constraints>C</constraints>\n"
125
- "<output_format>O</output_format>\n"
126
- "```\n"
127
- )
128
- extracted = extract_fenced_xml_content(message)
129
- assert "</illustrations>" in extracted
130
- assert "<background>B</background>" in extracted
131
-
132
- def test_normalize_prompt_workflow_export_rebuilds_fence_from_flattened_transcript() -> None:
133
- transcript = _flattened_transcript(
134
- _flattened_attempt(
135
- *_runtime_context_lines(),
136
- "<role>R</role>",
137
- "<background>B</background>",
138
- "<instructions>I</instructions>",
139
- "<constraints>C</constraints>",
140
- "<output_format>O</output_format>",
141
- "✻ Worked for 1m 7s",
142
- audit_line="● Audit: pass 15/15",
143
- ),
144
- )
145
- normalized = normalize_prompt_workflow_export(transcript)
146
- assert normalized.startswith("Audit: pass 15/15\n```xml\n")
147
- assert normalized.endswith("\n```")
148
- assert "<runtime_context>" in normalized
149
- assert "✻ Worked for 1m 7s" not in normalized
150
-
151
- def test_normalize_prompt_workflow_export_uses_last_audit_attempt() -> None:
152
- first_attempt = _flattened_attempt(
153
- "<role>FIRST</role>",
154
- "<background>Old</background>",
155
- "<instructions>Old</instructions>",
156
- "<constraints>Old</constraints>",
157
- "<output_format>Old</output_format>",
158
- audit_line="● Audit: pass 15/15",
159
- )
160
- second_attempt = _flattened_attempt(
161
- *_runtime_context_lines(),
162
- "<role>FINAL</role>",
163
- "<background>Fresh</background>",
164
- "<instructions>I</instructions>",
165
- "<constraints>C</constraints>",
166
- "<output_format>O</output_format>",
167
- "✻ Worked for 2m 8s",
168
- )
169
- transcript = _flattened_transcript(
170
- first_attempt,
171
- "",
172
- "● Re-emitting the full artifact with the runtime signals added.",
173
- "",
174
- second_attempt,
175
- )
176
- normalized = normalize_prompt_workflow_export(transcript)
177
- assert "<role>FINAL</role>" in normalized
178
- assert "<role>FIRST</role>" not in normalized
179
-
180
- def test_extract_fenced_xml_content_from_export_supports_flattened_transcript() -> None:
181
- transcript = _flattened_transcript(
182
- _flattened_attempt(
183
- "<role>R</role>",
184
- "<background>B</background>",
185
- "<instructions>I</instructions>",
186
- "<constraints>C</constraints>",
187
- "<output_format>O</output_format>",
188
- "✻ Worked for 31s",
189
- audit_line="● Audit: pass 15/15",
190
- ),
191
- )
192
- extracted = extract_fenced_xml_content_from_export(transcript)
193
- assert extracted.startswith("<role>R</role>")
194
- assert "<output_format>O</output_format>" in extracted
195
- assert "Worked for" not in extracted
@@ -1,339 +0,0 @@
1
- """Tests for prompt_workflow_validate module (shared validator + CLI entry point)."""
2
-
3
- import subprocess
4
- import sys
5
- from pathlib import Path
6
-
7
- import pytest
8
-
9
- from prompt_workflow_validate import ValidationResult, validate_prompt_workflow
10
-
11
- VALIDATOR_MODULE_PATH = Path(__file__).parent / "prompt_workflow_validate.py"
12
-
13
-
14
- def _full_checklist_rows() -> str:
15
- return (
16
- "checklist_results:\n"
17
- "- structured_scoped_instructions\n"
18
- "- sequential_steps_present\n"
19
- "- positive_framing\n"
20
- "- acceptance_criteria_defined\n"
21
- "- safety_reversibility_language\n"
22
- "- reversible_action_and_safety_check_guidance\n"
23
- "- concrete_output_contract\n"
24
- "- scope_boundary_present\n"
25
- "- explicit_scope_anchors_present\n"
26
- "- all_instructions_artifact_bound\n"
27
- "- scope_terms_explicit_and_anchored\n"
28
- "- completion_boundary_measurable\n"
29
- "- citation_grounding_policy_present\n"
30
- "- source_priority_rules_present\n"
31
- "- artifact_language_confidence\n"
32
- )
33
-
34
-
35
- def _wrap_five_section_scaffold(inner_body: str) -> str:
36
- has_instructions = "<instructions>" in inner_body
37
- has_constraints = "<constraints>" in inner_body
38
- instructions_section = (
39
- "" if has_instructions else "<instructions>Test instructions sentence one.</instructions>\n"
40
- )
41
- constraints_section = (
42
- "" if has_constraints else "<constraints>Test constraints sentence one.</constraints>\n"
43
- )
44
- return (
45
- "<role>Test role sentence one.</role>\n"
46
- "<background>Test background sentence one.</background>\n"
47
- f"{instructions_section}"
48
- f"{inner_body}\n"
49
- f"{constraints_section}"
50
- "<output_format>Test output format sentence one.</output_format>\n"
51
- )
52
-
53
-
54
- def _build_prompt_workflow_message_with_fenced_xml(fenced_xml_body: str) -> str:
55
- return (
56
- "Audit: pass 15/15\n"
57
- "```xml\n" + fenced_xml_body + "\n```\n"
58
- "overall_status: pass\n" + _full_checklist_rows() + "target_local_roots\n"
59
- "target_canonical_roots\n"
60
- "target_file_globs\n"
61
- "comparison_basis\n"
62
- "completion_boundary\n"
63
- "base_minimal_instruction_layer: true\n"
64
- "on_demand_skill_loading: true\n"
65
- )
66
-
67
-
68
- class TestValidatePromptWorkflowFunction:
69
- """Tests that exercise the shared validate_prompt_workflow function directly."""
70
-
71
- def test_allowed_complete_message_with_fenced_xml(self) -> None:
72
- fenced_content = _wrap_five_section_scaffold(
73
- "<instructions>Ensure all functions have explicit return types.</instructions>"
74
- )
75
- message = _build_prompt_workflow_message_with_fenced_xml(fenced_content)
76
- validation_result = validate_prompt_workflow(message)
77
- assert validation_result.allowed is True
78
- assert validation_result.reasons == ()
79
-
80
- def test_blocked_missing_context_control_lines(self) -> None:
81
- message = (
82
- "overall_status: pass\n"
83
- + _full_checklist_rows()
84
- + "target_local_roots\n"
85
- + "target_canonical_roots\n"
86
- + "target_file_globs\n"
87
- + "comparison_basis\n"
88
- + "completion_boundary\n"
89
- )
90
- validation_result = validate_prompt_workflow(message)
91
- assert validation_result.allowed is False
92
- assert "missing_context_signals" in validation_result.reason_codes
93
- assert any(
94
- "context-control" in each_message
95
- for each_message in validation_result.reason_messages
96
- )
97
-
98
- def test_allowed_empty_message(self) -> None:
99
- validation_result = validate_prompt_workflow("")
100
- assert validation_result.allowed is True
101
-
102
- def test_allowed_non_workflow_message(self) -> None:
103
- validation_result = validate_prompt_workflow("Just a regular response.")
104
- assert validation_result.allowed is True
105
-
106
- def test_blocked_internal_object_leak(self) -> None:
107
- leak_message = (
108
- '{"pipeline_mode": "internal_section_refinement_with_final_audit"}'
109
- )
110
- validation_result = validate_prompt_workflow(leak_message)
111
- assert validation_result.allowed is False
112
- assert "internal_object_leak" in validation_result.reason_codes
113
-
114
- def test_allowed_internal_object_with_debug_context(self) -> None:
115
- leak_message = (
116
- '{"pipeline_mode": "internal_section_refinement_with_final_audit"}'
117
- )
118
- validation_result = validate_prompt_workflow(
119
- leak_message,
120
- user_context="debug: show internal pipeline object",
121
- )
122
- assert validation_result.allowed is True
123
-
124
- def test_blocked_missing_checklist_rows(self) -> None:
125
- message = (
126
- "overall_status: pass\n"
127
- "checklist_results: structured_scoped_instructions\n"
128
- "target_local_roots\n"
129
- "target_canonical_roots\n"
130
- "target_file_globs\n"
131
- "comparison_basis\n"
132
- "completion_boundary\n"
133
- )
134
- validation_result = validate_prompt_workflow(message)
135
- assert validation_result.allowed is False
136
- assert "missing_checklist_rows" in validation_result.reason_codes
137
-
138
- def test_blocked_negative_keywords_in_fenced_xml(self) -> None:
139
- fenced_content = _wrap_five_section_scaffold(
140
- "<instructions>Do not leave return types implicit.</instructions>"
141
- )
142
- message = _build_prompt_workflow_message_with_fenced_xml(fenced_content)
143
- validation_result = validate_prompt_workflow(message)
144
- assert validation_result.allowed is False
145
- assert "negative_keywords_in_artifact" in validation_result.reason_codes
146
-
147
- def test_blocked_ambiguous_scope(self) -> None:
148
- message = (
149
- "overall_status: pass\n"
150
- + _full_checklist_rows()
151
- + "scope block includes target_local_roots target_canonical_roots "
152
- + "target_file_globs comparison_basis completion_boundary "
153
- + "base_minimal_instruction_layer: true\n"
154
- + "on_demand_skill_loading: true\n"
155
- + "and applies to this session."
156
- )
157
- validation_result = validate_prompt_workflow(message)
158
- assert validation_result.allowed is False
159
- assert "ambiguous_scope" in validation_result.reason_codes
160
-
161
- def test_reason_messages_property(self) -> None:
162
- message = (
163
- "overall_status: pass\n"
164
- + _full_checklist_rows()
165
- + "target_local_roots\n"
166
- + "target_canonical_roots\n"
167
- + "target_file_globs\n"
168
- + "comparison_basis\n"
169
- + "completion_boundary\n"
170
- )
171
- validation_result = validate_prompt_workflow(message)
172
- assert len(validation_result.reason_messages) == 1
173
- assert len(validation_result.reason_codes) == 1
174
-
175
- def test_blocked_missing_scope_anchors(self) -> None:
176
- message = (
177
- "overall_status: pass\n"
178
- + _full_checklist_rows()
179
- + "base_minimal_instruction_layer: true\n"
180
- + "on_demand_skill_loading: true\n"
181
- )
182
- validation_result = validate_prompt_workflow(message)
183
- assert validation_result.allowed is False
184
- assert "missing_scope_anchors" in validation_result.reason_codes
185
-
186
- def test_blocked_missing_xml_sections_in_fenced_artifact(self) -> None:
187
- fenced_body = (
188
- "<role>Test role sentence one.</role>\n"
189
- "<instructions>Test instructions sentence one.</instructions>\n"
190
- "<constraints>Test constraints sentence one.</constraints>\n"
191
- "<output_format>Test output format sentence one.</output_format>\n"
192
- )
193
- message = _build_prompt_workflow_message_with_fenced_xml(fenced_body)
194
- validation_result = validate_prompt_workflow(message)
195
- assert validation_result.allowed is False
196
- assert "missing_xml_sections" in validation_result.reason_codes
197
- assert any(
198
- "background" in each_message
199
- for each_message in validation_result.reason_messages
200
- )
201
-
202
- def test_allows_positive_phrasing_inside_fenced_xml(self) -> None:
203
- fenced_content = _wrap_five_section_scaffold(
204
- "<instructions>Ensure all functions have explicit return types.</instructions>"
205
- )
206
- message = _build_prompt_workflow_message_with_fenced_xml(fenced_content)
207
- validation_result = validate_prompt_workflow(message)
208
- assert validation_result.allowed is True
209
-
210
- def test_permits_negative_keywords_outside_fenced_xml(self) -> None:
211
- fenced_inner = _wrap_five_section_scaffold(
212
- "<instructions>Ensure all functions have explicit return types.</instructions>"
213
- )
214
- message = (
215
- "Audit: pass 15/15\n"
216
- "Do not skip the audit line.\n"
217
- "```xml\n" + fenced_inner + "\n```\n"
218
- "overall_status: pass\n" + _full_checklist_rows() + "target_local_roots\n"
219
- "target_canonical_roots\n"
220
- "target_file_globs\n"
221
- "comparison_basis\n"
222
- "completion_boundary\n"
223
- "base_minimal_instruction_layer: true\n"
224
- "on_demand_skill_loading: true\n"
225
- )
226
- validation_result = validate_prompt_workflow(message)
227
- assert validation_result.allowed is True
228
-
229
-
230
- @pytest.mark.parametrize(
231
- ("banned_pattern_name", "fenced_xml_content"),
232
- [
233
- ("do_not", "<instructions>Do not leave return types implicit.</instructions>"),
234
- ("avoid", "<instructions>Avoid missing return types.</instructions>"),
235
- ("never", "<constraints>Never store credentials in plain text.</constraints>"),
236
- ("without", "<instructions>Deploy without running tests first.</instructions>"),
237
- ("prevent", "<constraints>Prevent unauthorized access to the API.</constraints>"),
238
- ("reject", "<constraints>Reject all unsigned commits.</constraints>"),
239
- ("cannot", "<constraints>The API cannot accept unauthenticated requests.</constraints>"),
240
- ("unless", "<constraints>Skip the build step unless the user explicitly approves.</constraints>"),
241
- ("must_not", "<constraints>The script must not produce duplicates.</constraints>"),
242
- ("must_never", "<constraints>You must never store credentials in environment variables.</constraints>"),
243
- ("instead_of", "<instructions>Use explicit types instead of implicit ones.</instructions>"),
244
- ("rather_than", "<constraints>Prefer explicit types rather than inferred ones.</constraints>"),
245
- ("as_opposed_to", "<instructions>Use Grid as opposed to floats for layout.</instructions>"),
246
- ],
247
- )
248
- def test_blocks_banned_pattern_inside_fenced_xml(
249
- banned_pattern_name: str,
250
- fenced_xml_content: str,
251
- ) -> None:
252
- message = _build_prompt_workflow_message_with_fenced_xml(
253
- _wrap_five_section_scaffold(fenced_xml_content)
254
- )
255
- validation_result = validate_prompt_workflow(message)
256
- assert validation_result.allowed is False
257
- assert "negative_keywords_in_artifact" in validation_result.reason_codes
258
-
259
-
260
- class TestValidatorCli:
261
- """Tests that exercise the CLI entry point via subprocess."""
262
-
263
- def test_cli_exits_zero_for_valid_content(self, tmp_path: Path) -> None:
264
- fenced_content = _wrap_five_section_scaffold(
265
- "<instructions>Ensure all functions have explicit return types.</instructions>"
266
- )
267
- draft_file = tmp_path / "draft.xml"
268
- draft_file.write_text(
269
- _build_prompt_workflow_message_with_fenced_xml(fenced_content),
270
- encoding="utf-8",
271
- )
272
- completed_process = subprocess.run(
273
- [sys.executable, str(VALIDATOR_MODULE_PATH), str(draft_file)],
274
- capture_output=True,
275
- text=True,
276
- check=False,
277
- )
278
- assert completed_process.returncode == 0
279
- assert completed_process.stderr.strip() == ""
280
-
281
- def test_cli_exits_two_with_bracketed_reason_code_on_stderr(
282
- self,
283
- tmp_path: Path,
284
- ) -> None:
285
- message = (
286
- "overall_status: pass\n"
287
- + _full_checklist_rows()
288
- + "target_local_roots\n"
289
- + "target_canonical_roots\n"
290
- + "target_file_globs\n"
291
- + "comparison_basis\n"
292
- + "completion_boundary\n"
293
- )
294
- draft_file = tmp_path / "draft.xml"
295
- draft_file.write_text(message, encoding="utf-8")
296
- completed_process = subprocess.run(
297
- [sys.executable, str(VALIDATOR_MODULE_PATH), str(draft_file)],
298
- capture_output=True,
299
- text=True,
300
- check=False,
301
- )
302
- assert completed_process.returncode == 2
303
- assert "[missing_context_signals]" in completed_process.stderr
304
-
305
- def test_cli_stderr_format_uses_reason_code_prefix(
306
- self,
307
- tmp_path: Path,
308
- ) -> None:
309
- fenced_content = _wrap_five_section_scaffold(
310
- "<instructions>Do not leave return types implicit.</instructions>"
311
- )
312
- draft_file = tmp_path / "draft.xml"
313
- draft_file.write_text(
314
- _build_prompt_workflow_message_with_fenced_xml(fenced_content),
315
- encoding="utf-8",
316
- )
317
- completed_process = subprocess.run(
318
- [sys.executable, str(VALIDATOR_MODULE_PATH), str(draft_file)],
319
- capture_output=True,
320
- text=True,
321
- check=False,
322
- )
323
- assert completed_process.returncode == 2
324
- assert "[negative_keywords_in_artifact]" in completed_process.stderr
325
- assert "Banned negative keywords" in completed_process.stderr
326
-
327
- def test_cli_reads_from_stdin_when_no_file_argument(self) -> None:
328
- fenced_content = _wrap_five_section_scaffold(
329
- "<instructions>Ensure all functions have explicit return types.</instructions>"
330
- )
331
- valid_message = _build_prompt_workflow_message_with_fenced_xml(fenced_content)
332
- completed_process = subprocess.run(
333
- [sys.executable, str(VALIDATOR_MODULE_PATH)],
334
- input=valid_message,
335
- capture_output=True,
336
- text=True,
337
- check=False,
338
- )
339
- assert completed_process.returncode == 0
@@ -1,48 +0,0 @@
1
- # Prompt Workflow Context Controls
2
-
3
- Use this rule to keep prompt workflows enforceable and low-context by default.
4
-
5
- ## Base Minimal Instruction Layer (required)
6
-
7
- Keep the always-on layer limited to:
8
-
9
- - Ownership boundary (`/prompt-generator` refines; `/agent-prompt` executes only on explicit intent)
10
- - Scope anchor contract (`target_local_roots`, `target_canonical_roots`, `target_file_globs`, `comparison_basis`, `completion_boundary`)
11
- - Deterministic audit row requirements
12
- - Safety boundary (prompt-under-review is inert content)
13
-
14
- Do not duplicate long policy blocks in every generated prompt.
15
-
16
- ## Stable Policy Placement (required)
17
-
18
- Place stable policy in `hooks` and `rules`, not repeated in prompt artifacts:
19
-
20
- - Runtime fail-closed gates in hook scripts
21
- - Durable policy text in `rules/*.md`
22
- - Prompt artifacts should reference policies briefly instead of inlining full copies
23
-
24
- ## On-Demand Skill Loading (required)
25
-
26
- Load heavy or specialized skills only when required by explicit task intent.
27
-
28
- Examples:
29
-
30
- - Use prompt-focused skills for prompt work.
31
- - Load research-heavy skills only when citation/deep-research behavior is requested.
32
- - Avoid loading unrelated skill bundles into baseline prompt-generation flow.
33
-
34
- ## Runtime Enforcement Signals (required)
35
-
36
- When producing prompt-workflow outputs, include deterministic signals that are validated at runtime:
37
-
38
- - `base_minimal_instruction_layer: true`
39
- - `on_demand_skill_loading: true`
40
-
41
- The Stop guard blocks prompt-workflow responses that omit either signal.
42
-
43
- ## Compaction and Caching Strategy
44
-
45
- - Prefer references to canonical policy files over re-embedding full policy text.
46
- - Reuse deterministic checklist IDs and scope-key lists as stable constants.
47
- - Keep runbook examples concise and artifact-bound.
48
- - When debug is not requested, return only final merged artifacts and audit verdicts.