Skip to content

Commit dcc222f

Browse files
fix: remove the dead prompt-synthesis path, and stop calling two corpora mirrors (#304)
Merge PR #304
1 parent 0e80690 commit dcc222f

2 files changed

Lines changed: 51 additions & 99 deletions

File tree

‎CLAUDE.md‎

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -157,8 +157,8 @@ Level 2: SDLC Execution Core (9 active steps: Steps 0-8)
157157
+-- k8s/ # Kubernetes manifests (deployment, service, hpa, configmap, secret)
158158
+-- tests/ # 45 test files (37 unit, 4 integration, 3 e2e, 1 load)
159159
+-- docs/ # ALL documentation, segregated by kind -- see docs/README.md for the index
160-
| +-- standards/ (52) # numbered rules 01-46 + per-language standards; mirrors ~/.claude/rules/ (that copy is what Standards loads)
161-
| +-- policies/ (46) # one file per pipeline policy; mirrors ~/.claude/policies/ (that copy is what get_policies_dir() reads)
160+
| +-- standards/ (52) # numbered rules 01-46 + per-language standards; the loaded copy is ~/.claude/rules/, NOT this one
161+
| +-- policies/ (46) # pipeline policy documentation. NOT a mirror of ~/.claude/policies/ -- see the note below
162162
| +-- architecture/ (17) # ADRs, pipeline/level design, flow diagrams, orchestration prompt
163163
| +-- guides/ (14) # getting started, deployment, testing, troubleshooting, runbooks
164164
| +-- reports/ (20) # point-in-time investigations, audits, migration notes
@@ -168,6 +168,24 @@ Level 2: SDLC Execution Core (9 active steps: Steps 0-8)
168168
+-- uml/ drawio/ # Auto-generated UML + draw.io diagrams (13 types each)
169169
```
170170

171+
#### `docs/policies/` and `~/.claude/policies/` are two different things
172+
173+
This file used to call them mirrors. They are not, and had drifted apart by 25 files
174+
when that was checked on 2026-08-08: 18 names in `docs/policies/` are absent from the
175+
machine, and 7 on the machine are in no repository at all -- several of them for
176+
plan-mode and skill-agent-selection, which v1.15.2 purged.
177+
178+
They are not meant to match. `docs/policies/` is **documentation** of what the pipeline
179+
does at each step (`quality-gate-policy.md`, `pr-code-review-policy.md`), and nothing
180+
loads it. `~/.claude/policies/` is the **runtime corpus** that `get_policies_dir()`
181+
reads, and the standards selector consumes a narrow slice of it -- the
182+
`02-standards-system/` tier plus language-mapped files. Calling them mirrors invited
183+
the assumption that editing one affected the other, which it never did in either
184+
direction.
185+
186+
`CLAUDE_POLICIES_DIR` overrides the runtime location. The 7 machine-only files are
187+
unversioned: if that machine is lost, so are they.
188+
171189
### Key Components
172190

173191
| Component | Location | Purpose |

‎langgraph_engine/orchestrator.py‎

Lines changed: 31 additions & 97 deletions
Original file line numberDiff line numberDiff line change
@@ -259,105 +259,39 @@ def verify_prompt_integrity(state: FlowState) -> bool:
259259

260260

261261
def synthesize_prompt_with_flow_data(state: FlowState) -> dict:
262-
"""Synthesize comprehensive prompt using all collected 3-level flow data.
262+
"""Report that prompt synthesis is unavailable.
263+
264+
This function used to load a PromptGenerator from
265+
``scripts/architecture/03-execution-system/00-prompt-generation/prompt-generation-policy.py``
266+
and build a synthesised prompt from the whole flow. That file was deleted on
267+
2026-05-04 in 683c23a, so the dynamic import has raised on every run since,
268+
and the ninety lines of flow-data assembly that followed it were unreachable
269+
the entire time. They are removed here rather than left to read as live code.
270+
271+
What replaced them, and why it is not a fallback: the old except-branch
272+
returned ``state[USER_MESSAGE]`` under the key ``synthesized_prompt``, and
273+
flow_trace_converter writes that key to ``current-synthesis.txt`` and reports
274+
"Synthesis: Generated (N chars)". So for three months the trace claimed a
275+
synthesis had been produced while writing out the raw task. Returning empty
276+
lets the consumer's own guard skip the file, which is the honest outcome --
277+
nothing was synthesised, so nothing should be reported as synthesised.
278+
279+
The per-run stderr WARNING is gone with it. It announced a permanent
280+
condition as though it were an incident, on every single run.
263281
264-
SYNTHESIS PROCESS:
265-
1. Collect data from all levels
266-
2. Call PromptGenerator.synthesize_with_flow_data()
267-
3. Create comprehensive prompt
268-
4. Return synthesized prompt for actual work
269-
"""
270-
try:
271-
import importlib.util
272-
import sys
273-
from pathlib import Path
282+
Args:
283+
state: Pipeline state (unused; kept for the node signature).
274284
275-
# Import PromptGenerator from prompt-generation-policy.py
276-
scripts_path = (
277-
Path(__file__).parent.parent / "scripts" / "architecture" / "03-execution-system" / "00-prompt-generation"
278-
)
279-
spec = importlib.util.spec_from_file_location(
280-
"prompt_generation_policy", scripts_path / "prompt-generation-policy.py"
281-
)
282-
pg_module = importlib.util.module_from_spec(spec)
283-
spec.loader.exec_module(pg_module)
284-
285-
generator = pg_module.PromptGenerator()
286-
287-
# Prepare flow data for synthesis - use ACTUAL pipeline results
288-
# Collect validated tasks for TodoList
289-
validated_tasks = state.get(StepKeys.TASKS_VALIDATED, [])
290-
raw_tasks = state.get(StepKeys.TASKS, {}).get("tasks", [])
291-
all_tasks = validated_tasks if validated_tasks else raw_tasks
292-
293-
# Collect plan phases
294-
plan_exec = state.get(StepKeys.PLAN_EXECUTION, {})
295-
plan_phases = plan_exec.get("phases", []) if isinstance(plan_exec, dict) else []
296-
297-
flow_data = {
298-
"level0_preflight": {
299-
"unicode_check": state.get(StepKeys.UNICODE_CHECK, False),
300-
"encoding_check": state.get(StepKeys.ENCODING_CHECK, False),
301-
"windows_path_check": state.get(StepKeys.WINDOWS_PATH_CHECK, False),
302-
},
303-
"level1_context_sync": {
304-
"context_percentage": state.get(StepKeys.CONTEXT_PERCENTAGE, 0),
305-
"session_chain_loaded": state.get(StepKeys.SESSION_CHAIN_LOADED, False),
306-
"patterns_detected": state.get(StepKeys.PATTERNS_DETECTED, []),
307-
"project_type": state.get(StepKeys.DETECTED_FRAMEWORK, "Unknown"),
308-
},
309-
"standards": {
310-
"standards_count": state.get(StepKeys.STANDARDS_COUNT, 0),
311-
"is_java_project": state.get(StepKeys.IS_JAVA_PROJECT, False),
312-
"java_standards_loaded": state.get(StepKeys.JAVA_STANDARDS_LOADED, False),
313-
},
314-
"level2_sdlc_pipeline": {
315-
"task_type": state.get(StepKeys.TASK_TYPE, "General"),
316-
"complexity": state.get(StepKeys.COMPLEXITY, 5),
317-
"suggested_model": state.get(StepKeys.SELECTED_MODEL, "complex_reasoning"),
318-
"plan_mode_suggested": state.get(StepKeys.PLAN_REQUIRED, False),
319-
"reasoning": state.get(StepKeys.REASONING, ""),
320-
"tasks": all_tasks,
321-
"task_count": len(all_tasks),
322-
"plan_phases": plan_phases,
323-
"selected_skill": state.get(StepKeys.SKILL, ""),
324-
"selected_agent": state.get(StepKeys.AGENT, ""),
325-
"selected_skills": state.get(StepKeys.SKILLS, []),
326-
"selected_agents": state.get(StepKeys.AGENTS, []),
327-
"skill_definition": state.get(StepKeys.SKILL_DEFINITION, ""),
328-
"agent_definition": state.get(StepKeys.AGENT_DEFINITION, ""),
329-
},
330-
}
331-
332-
# SYNTHESIS: Create comprehensive prompt
333-
# Priority: user_message > user_message_original > env var CURRENT_USER_MESSAGE
334-
import os
335-
336-
user_msg = (
337-
state.get(StepKeys.USER_MESSAGE)
338-
or state.get(StepKeys.USER_MESSAGE_ORIGINAL)
339-
or os.environ.get("CURRENT_USER_MESSAGE", "")
340-
)
341-
synthesis_result = generator.synthesize_with_flow_data(user_msg, flow_data)
342-
343-
return {
344-
"synthesized_prompt": synthesis_result.get("synthesized_prompt", ""),
345-
"synthesis_metadata": {
346-
"original_message": synthesis_result.get("original_message"),
347-
"context_level": synthesis_result.get("context_level"),
348-
"data_used": synthesis_result.get("data_used"),
349-
},
350-
}
351-
352-
except Exception as e:
353-
import sys
354-
355-
print(f"[WARNING] Prompt synthesis failed: {e}", file=sys.stderr)
356-
# Fallback: return original message
357-
return {
358-
"synthesized_prompt": state.get(StepKeys.USER_MESSAGE, ""),
359-
"synthesis_metadata": {"status": "fallback"},
360-
}
285+
Returns:
286+
dict: Empty ``synthesized_prompt`` and metadata naming the cause.
287+
"""
288+
return {
289+
"synthesized_prompt": "",
290+
"synthesis_metadata": {
291+
"status": "unavailable",
292+
"reason": "prompt-generation-policy.py was removed in 683c23a (2026-05-04)",
293+
},
294+
}
361295

362296

363297
def output_node(state: FlowState) -> dict:

0 commit comments

Comments
 (0)