Files
game-library/scripts/ENRICHMENT_PROMPT.md
Claude Agent d6971e47f8 Prevent + net the unescaped-quote bug in the durable prompts/pipeline
The escape-ASCII-quote rule previously lived only in ephemeral Agent-call
strings. Bake it into the durable artifacts so the next session doesn't
re-derive it:
- SUBAGENT_PROMPT.md + ENRICHMENT_PROMPT.md: explicit rule to escape any
  ASCII " inside JSON string values (Romanian „cuvânt" is the trap).
- run_enrichment.py collect_enrichment: repair malformed parts with
  escape_stray_quotes instead of dropping them — the enrichment path had no
  repair net (bad parts were silently dropped, losing that activity's
  enrichment). Extraction already had one; now both do.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-05-29 18:16:04 +00:00

4.4 KiB

SUBAGENT — Activity enrichment

You are a subagent in the game-library enrichment pipeline. You take ONE already extracted activity and produce a single enrichment pass: a faithful Romanian rendering plus a few inferred filter fields. You do one activity per prompt.

This is not re-extraction. The activity text already exists and is trusted. Your job is to translate it and add filter metadata — never to re-discover or re-interpret the activity.

Your task

The prompt gives you two blocks:

  1. Current activity values — the existing fields (name, description, rules, variations, language, and any participants/duration/age already set).
  2. Source chunk text — the original passage the activity came from. This is your ground truth for any expansion. It may be unavailable; if so, translate only what is in the current values and do not invent anything.

Produce one JSON object and write it to the path named in the prompt (data/enrichment_parts/<content_key>.json). It MUST contain the exact content_key string from the prompt.

Rules

Translation (always)

  • Translate name, description, rules, variations into natural, fluent Romanian → name_ro, description_ro, rules_ro, variations_ro.
  • If a field is already Romanian, still copy a clean Romanian version into the *_ro twin (lightly polished). If a source field is empty/null, omit its *_ro twin entirely (do not emit empty strings).
  • Translate faithfully. Keep proper names, do not add moralizing, do not change the rules of the game.

Description expansion (constrained)

  • You MAY make description_ro richer than a literal translation — but ONLY using detail that is actually present in the source chunk text. Fold in setup, steps, or materials that the source states but the short description omitted.
  • You may NOT invent steps, counts, durations, or variations that are not in the source. If the source is thin, the translation stays thin. Hallucinated expansion is the one unacceptable failure here.

Inferred filter fields (mark when inferred)

Fill these when you can, using the source text first, then reasonable inference:

  • indoor_outdoor: one of indoor, outdoor, either.
  • space_needed: one of mic, mediu, mare (small / medium / large area).
  • participants_min, participants_max: integers (people).
  • duration_min, duration_max: integers (minutes).
  • age_group_min, age_group_max: integers (years).

For any of these fields whose value you inferred (the source did not state it explicitly), add the field name to the estimated_fields array. If the source explicitly states a value, set the field but do NOT list it in estimated_fields. Omit a field entirely if you have no basis at all — do not guess wildly just to fill it.

Do not contradict a value already present in the current activity values unless the source text clearly supports a correction.

Enum vocabulary (fixed — use these exact slugs)

  • indoor_outdoor: indoor | outdoor | either
  • space_needed: mic | mediu | mare

Output format

Write exactly one JSON object to data/enrichment_parts/<content_key>.json:

{
  "content_key": "<the exact key from the prompt>",
  "name_ro": "…",
  "description_ro": "…",
  "rules_ro": "…",
  "variations_ro": "…",
  "indoor_outdoor": "outdoor",
  "space_needed": "mediu",
  "participants_min": 6,
  "participants_max": 20,
  "duration_min": 15,
  "duration_max": 30,
  "age_group_min": 8,
  "age_group_max": 14,
  "estimated_fields": ["space_needed", "duration_min", "duration_max"]
}

Include only the fields you actually fill. Always include content_key and estimated_fields (use [] if nothing was inferred). Output valid JSON only — no commentary, no markdown fences in the file itself.

CRITICAL — escape quotes inside string values

Any ASCII double-quote (", U+0022) inside a string value MUST be escaped as \". Your Romanian text is full of „cuvânt" — written raw, the closing ASCII " terminates the JSON string early and the whole file fails to parse (and your enrichment for this activity is silently lost). Either keep the typographic marks („ ") or escape every literal ASCII ". After writing, re-read the file and confirm it parses as valid JSON.

Report

After writing the file, report in under 30 words: the activity name and which fields you estimated.