/* Expert Panel: Duso Language Review Generate random experts, get their analysis in parallel, synthesize findings */ claude = require("claude") md = require("markdown") // Get the language spec and context readme = load("README.md") spec = load("docs/learning-duso.md") ref = load("docs/reference/index.md") print(md.ansi(""" # Expert Panel Review: Duso Language A fun demo that asks Claude to invent 5 programmer experts with their individual backgrounds. Then asks all at once to review the language primer and reference index doc files. Then asks claude to analyze and summarize their responses, questions, and concerns. """)) // Generate 5 random experts via one-shot prompt busy("Inventing 5 random experts...") experts_prompt = """ Invent 5 diverse programmer experts with different specialties. Return as JSON array with this exact structure for each expert: { "name": "expert first name", "expertise": "their specialty area", "background": "one sentence about their background" } Make them diverse: different ages, genders, backgrounds, and specialties. Return ONLY valid JSON array, no other text. """ experts_json = claude.prompt(experts_prompt, { max_tokens = 1024 }) // Strip markdown code blocks if present if contains(experts_json, "```") then experts_json = replace(experts_json, ~```(json)?\n~, "") experts_json = replace(experts_json, ~\n```~, "") end experts = parse_json(experts_json) panel = "## Panel members:\n" for expert in experts do panel = panel + "\n- **{{expert.name}}**: {{expert.expertise}}" end print(md.ansi(panel)) write("Expert analysis: ") busy("running in parallel") // Run all expert analyses in parallel expert_responses = parallel(map(experts, function(expert) return function() system = """ You are {{expert.name}}, a {{expert.expertise}} expert. Background: {{expert.background}} """ prompt = """ Evaluate this language designed for agent orchestration and LLM integration. Provide your top 3 pros, top 3 cons, and top 3 questions in markdown format. PROJECT OVERVIEW: {{readme}} LEARNING DUSO: {{spec}} LANGUAGE PRIMER: {{ref}} Use clear headers (##) for each section and numbered lists. """ analysis = claude.prompt(prompt, { system = system, max_tokens = 1000 }) return { expert = expert.name, expertise = expert.expertise, analysis = analysis } end end)) print("done.") write("Synthesizing results: ") busy("running analysis") // Synthesize across all experts review_sections = [] for analysis in expert_responses do push(review_sections, """ {{analysis.expert}} ({{analysis.expertise}}): {{analysis.analysis}} """) end synthesis_prompt = """ You have {{len(expert_responses)}} expert reviews of a programming language called Duso. EXPERT REVIEWS: {{join(review_sections, "\n\n---\n\n")}} Find patterns across these reviews. Provide: 1. **Consensus Strengths** - What nearly all praised 3. **Key Tensions** - Where experts disagreed, and why 4. **Perspective-Specific Insights** - Important to specific backgrounds 5. **Most Important Questions** - Key questions across experts Include 3-5 relevant quotes from the experts throughout to support your analysis. Keep your text short and sweet, use bullet points, and make the language short and to the point. Use markdown format with clear headers and lists. """ synthesis = claude.prompt(synthesis_prompt, { max_tokens = 8000 }) print("done.\n") print(md.ansi(""" ## Duso Expert Panel Review - Generated: {{format_time(now())}} - Experts: {{len(expert_responses)}} ## Synthesis --- {{synthesis}} """))