Collapse caller gen to single batch of 10 with anti-collision rule

Previously _build_backgrounds ran two parallel Sonnet calls of 6
callers each, with zero cross-batch awareness. Each batch independently
gravitated to the same quirky archetypes (Coast to Coast weirdos,
specific hobbies) and produced clustered rosters — one recent show
had two BBQ competitors, two taxidermists, and two conspiracy-pattern
callers across 10 slots.

Collapses to a single Sonnet call generating all 10 at once so the
model can self-diversify across the full roster. The BATCH_SYSTEM_PROMPT
also gets an explicit ANTI-COLLISION RULE with concrete forbidden
examples (no two BBQ competitors, no two taxidermists, no two mystery-
signal callers, etc.) and an instruction to scan output for collisions
before finalizing.

max_tokens bumped 8000 -> 16000 to accommodate the larger response.
Wall-clock cost: ~30s -> ~60s, acceptable for the diversity gain.
Verified on a fresh reset: 10 fully differentiated callers, zero
archetype collisions.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-04-10 02:05:17 -06:00
co-authored by Claude Opus 4.6
parent 8a20e679f6
commit 1c7ac334b4
2 changed files with 16 additions and 18 deletions
+10 -16
View File
@@ -822,22 +822,16 @@ class Session:
"recent_caller_summaries": self._get_recent_summaries(),
"voice_roster": voice_roster,
}
# Split into two parallel calls: call 1 includes regulars + 5 walk-ins,
# call 2 is 6 pure walk-ins. Halves generation time by parallelizing.
ctx_a = {**base_ctx, "regulars_included": regulars_for_tonight, "caller_count": 6}
ctx_b = {**base_ctx, "regulars_included": [], "caller_count": 6}
batches = await asyncio.gather(
caller_gen.generate_batch(ctx_a),
caller_gen.generate_batch(ctx_b),
return_exceptions=True,
)
identities: list = []
for i, result in enumerate(batches):
if isinstance(result, Exception):
print(f"[Background] Batch {i+1} failed: {result}")
continue
identities.extend(result)
# Single batch of 10 so sonnet sees the full roster and can enforce
# the anti-collision rule across all callers. Previously two parallel
# batches of 6 were generated blind to each other, which produced
# recurring archetype clusters (e.g. two BBQ callers, two taxidermists).
ctx = {**base_ctx, "regulars_included": regulars_for_tonight, "caller_count": 10}
try:
identities = await caller_gen.generate_batch(ctx)
except Exception as e:
print(f"[Background] Batch failed: {e}")
identities = []
# Build regular lookup tables
regular_names = {r["name"] for r in regulars_for_tonight}