Scenario refiner
Skill tough-tongue/toughtongue-skills/skills/scenario-refiner
Agent skills and MCP server for Tough Tongue AI. Create voice-agent scenarios, refine them from real transcripts, and analyze session performance from Claude Code, Codex, or Cursor.
npx -y skills add tough-tongue/toughtongue-skills --skill scenario-refinerAssembled from the repository path, not quoted from the project. Check it against their README if it does not work.
One thing to look at
- 5 stars5 stars. Stars are a popularity signal and not a quality one, but at this level it is likely that nobody has read this closely except its author, and you would be relying on your own review.
What its author says it does
Copied from the file, not written here
Fix and refine live Tough Tongue AI scenarios from real session evidence via the ttai MCP server. Diagnoses whether an issue lives in ai_instructions, tools_config, or strategy, then applies the smallest possible edit with ttai:update_scenario. Use when the user says "refine the scenario", "fix the scenario", "the agent said X instead of Y", "it ended the call too early", "it skipped a step", "make it sound more natural", or pastes a transcript or complaint about a live scenario.
SKILL.md
7.4 KB, as published. Nobody here has run it
Scenario Refiner
Diagnose → plan → surgical edit → verify. Never expand tokens when you can tighten. The agent runs on a system prompt that is already long — every word you add is a word the model has to ignore at runtime.
Read references/runtime-behavior.md before diagnosing anything about prompt assembly, tool registration, conductor, or silence mechanics.
Prerequisites
- The ttai MCP server must be connected. Tool references below use the
ttai:server prefix (e.g.ttai:update_scenario); some agents surface these asmcp__ttai__update_scenario. If the tools are missing, point the user at the repo README and https://app.toughtongueai.com/developer for aTTAI_PATtoken.
Workflow
Step 1: Gather evidence
- Call
ttai:list_organizations; passorg_idon subsequent calls if the scenario belongs to an organization. - Fetch the scenario with
ttai:get_scenario(needs the scenario ID — find it viattai:list_scenariosif the user only gave a name). Read the entireai_instructions, plusstrategy,tools_config, andsession_analysis. - Get the failure evidence:
- If the user pasted a transcript or complaint, use that.
- Otherwise pull sessions:
ttai:list_sessionsfiltered byscenario_id(and date range), pick the relevant ones (e.g. lowest scores), thenttai:get_sessions_batchfor details. Fetchtranscript_urlcontents for the actual conversation text.
- Identify the exact turn where things went wrong. Cross-reference: what did the scenario PRESCRIBE for that moment, and what did the agent actually DO? Quote both in your diagnosis.
If the transcript is in another language (Hindi, Hinglish, ...), do not translate — the scenario is in the same language. Quote the original.
Step 2: Diagnose root cause
Classify into one of these buckets. Each maps to a different fix location.
| Symptom | Likely cause | Fix location |
|---|---|---|
Agent called end_session too early / too late / not at all | Tool timing instruction weak, or add_to_system_prompt: false | ai_instructions end-of-call block, or tools_config.tools.end_session |
| Agent took the wrong conversation branch | Branch trigger words too narrow, or path priority unclear | ai_instructions flow section (strengthen trigger list or add tie-breaker rule) |
| Agent used the wrong closing line | Closing rule not bound to the path it came from | ai_instructions closing section (bind closings to paths explicitly) |
| Agent skipped a prescribed step/question | "Read-the-room" rule too aggressive, or step ordering implicit | ai_instructions — make step 1 → step 2 a hard sequence with NEVER skip |
| Agent monologued / two questions in one turn | Style rules buried | Bold/cap a single rule in the style section; do not add a new section |
| Agent revealed AI identity or said a tool name aloud | Guardrails section missing or weak | ai_instructions GUARDRAILS / THINGS YOU MUST NEVER DO |
| Agent stayed silent too long, then ended the call | silence.silence_threshold too low, or silence.end_session: true | strategy.silence |
| Wrap-up fired during active conversation | Conductor time_seconds too low or end_turn: true | strategy.conductor.messages |
| Wrong voice / language / accent | Voice or language config | appearance.voice, appearance.language_code, transcribe_config |
Agent said a placeholder like {{ firstname }} literally | Missing-context fallback not specified | ai_instructions CONTEXT section — add "If blank, do X" |
| Robotic opening / restarts opening when interrupted | Quoted speech in welcome_instructions | strategy.welcome_instructions — rewrite in directive form |
If the cause is architectural (template selection, tool registration, conductor injection), open references/runtime-behavior.md and cite the relevant mechanism. Don't guess.
Step 3: Plan the edit
Before calling any tool, write the edit out — old text and new text side by side — and check it against these principles:
Token discipline (in priority order):
- Replace existing text > tighten existing text > add new text
- If you must add, ask: can I delete something stale to compensate?
- Flag the user if the total
ai_instructionsdelta exceeds +50 tokens (~3 lines) - Never add a "while I'm here" change. One issue = one edit.
Effective prompt writing:
- Imperative voice: "NEVER call end_session before X" not "The agent should not call end_session before X"
- NEVER / ALWAYS / ONLY caps markers for hard constraints
- One concrete example beats three abstract rules
- Bind rules to triggers: "When customer says X → do Y" beats "Be empathetic"
- Forbid the failure mode by name: if the agent skipped a step, write "NEVER skip [step], even if the issue seems minor"
Where to put a new rule inside ai_instructions:
- Hard prohibition →
## GUARDRAILSor## THINGS YOU MUST NEVER DO - Conditional behavior → inside the matching phase / path
- Tool timing → right after the prescribed closing lines
- Tone / style → the style rules block near the top
Step 4: Apply via ttai:update_scenario
- Send only
idplus the fields you changed — partial updates are supported, and untouched fields must not be re-sent (avoids clobbering concurrent edits). - For an
ai_instructionsedit: apply your surgical replacement to the full fetched string and send the complete updated field. Verify no collateral changes (whitespace, adjacent bullets). - Pass
org_idif the scenario belongs to an organization.
Step 5: Verify and report
- Re-fetch with
ttai:get_scenarioand confirm the change landed as planned. - Conclude with exactly this structure:
- Diagnosis (1-2 sentences) — what went wrong and why
- Change — field + before/after summary
- Token delta — estimate (e.g. "+38 tokens, under the 50-token threshold")
- Reminder — the change applies to new sessions only; running sessions keep their compiled system prompt
Quick recipes
"Agent ended the call too early"
- Search
ai_instructionsforend_session. Is there an explicit "ONLY after closing line AND customer farewell" rule? - If not, add a 3-4 bullet rule block right after the closing templates.
- Check
tools_config.tools.end_session.tool_settings.disconnectDelaySeconds— too low (< 8) on emotional calls feels abrupt.
"Closing line was generic instead of path-specific"
Strengthen the closing section with: "Based on the path you actually took above, pick the matching closing — never substitute a generic 'thank you'."
"Scenario scores dropped after a change"
Pull sessions before and after the change date with ttai:list_sessions
(from_date / to_date), compare evaluation_results, and check whether the
prior edit introduced the regression before adding anything new.