Problem
ReduceSynthesis and GroupSynthesis concatenate all input artifacts into a single prompt string with no token/size limit:
artifacts_text = "\n\n---\n\n".join(f"### {a.label}\n{a.content}" for a in sorted_inputs)
For large corpora (hundreds or thousands of artifacts), this will exceed context windows and cause hard failures with no useful error message.
Impact
- O(total_input_size) memory and token usage
- Silent failures when prompt exceeds model context window
- Affects both
ReduceSynthesis (all inputs → 1 output) and GroupSynthesis (per-group concatenation)
Suggested approach
- Add an optional
max_tokens or context_budget parameter (like CoreSynthesis has)
- Truncate or chunk inputs when they'd exceed the limit
- Log a warning when truncation occurs
- Consider automatic chunking with recursive reduce for very large input sets
Scope
This is a scale optimization — the current implementation works correctly for typical pipeline sizes (dozens of artifacts). It only becomes a problem with large corpora.
Problem
ReduceSynthesisandGroupSynthesisconcatenate all input artifacts into a single prompt string with no token/size limit:For large corpora (hundreds or thousands of artifacts), this will exceed context windows and cause hard failures with no useful error message.
Impact
ReduceSynthesis(all inputs → 1 output) andGroupSynthesis(per-group concatenation)Suggested approach
max_tokensorcontext_budgetparameter (likeCoreSynthesishas)Scope
This is a scale optimization — the current implementation works correctly for typical pipeline sizes (dozens of artifacts). It only becomes a problem with large corpora.