Skip to content

feat: scaffold Debate Arena agent kit#197

Open
HEMANTH-A-7 wants to merge 22 commits into
Lamatic:mainfrom
HEMANTH-A-7:feat/debate-arena-kit
Open

feat: scaffold Debate Arena agent kit#197
HEMANTH-A-7 wants to merge 22 commits into
Lamatic:mainfrom
HEMANTH-A-7:feat/debate-arena-kit

Conversation

@HEMANTH-A-7

@HEMANTH-A-7 HEMANTH-A-7 commented Jul 8, 2026

Copy link
Copy Markdown

Summary

Adds a new kit, "Debate Arena": two AI agents debate opposing positions on any tradeoff or decision across multiple rounds, then an impartial judge synthesizes a pros/cons matrix and a final recommendation with an honest confidence level.

Three Lamatic flows:

  • debate-setup - neutrally reframes a raw topic into two clearly opposed positions
  • debate-round - generates one side's opening argument or rebuttal per call (invoked in a loop by the app)
  • debate-judge - extracts the pros/cons actually argued, picks the strongest argument per side, and gives a recommendation + confidence + caveats

Plus a Next.js app in apps/ that orchestrates the three flows end-to-end and renders the debate live.

PR Checklist

1. Select Contribution Type

  • Kit (kits//)
  • Bundle (bundles//)
  • Template (templates//)

2. General Requirements

  • PR is for one project only (no unrelated changes)
  • No secrets, API keys, or real credentials are committed
  • Folder name uses kebab-case
  • All changes are documented in README.md (purpose, setup, usage)

3. File Structure

  • lamatic.config.ts present with valid metadata (name, description, tags, steps, author, env keys)
  • flows/.ts present for every step, referencing extracted prompts/, model-configs/, and constitutions/default.md
  • .env.example with placeholder values only, plus the three deployed flow IDs
  • No hand-edited flow node graphs - flow docs mirror what's configured and tested in Lamatic Studio

4. Validation

  • npm install && npm run dev works locally (verified npm run build and npm run lint both pass cleanly)
  • PR title is clear
  • GitHub Actions workflows pass (all checks are green)
  • All CodeRabbit or other PR review comments are addressed and resolved
  • No unrelated files or projects are modified
  • Added kit docs & config (kits/debate-arena/)
    • kits/debate-arena/README.md
    • kits/debate-arena/agent.md
    • kits/debate-arena/constitutions/default.md
    • kits/debate-arena/lamatic.config.ts
    • kits/debate-arena/.env.example
    • kits/debate-arena/.gitignore
  • Added Lamatic flow definitions (kits/debate-arena/flows/)
    • kits/debate-arena/flows/debate-setup.ts
    • kits/debate-arena/flows/debate-round.ts
    • kits/debate-arena/flows/debate-judge.ts
  • Added flow prompt templates (kits/debate-arena/prompts/)
    • kits/debate-arena/prompts/debate-setup_instructorllmnode-980_system_0.md
    • kits/debate-arena/prompts/debate-setup_instructorllmnode-980_user_1.md
    • kits/debate-arena/prompts/debate-round_instructorllmnode-435_system_0.md
    • kits/debate-arena/prompts/debate-round_instructorllmnode-435_user_1.md
    • kits/debate-arena/prompts/debate-judge_instructorllmnode-239_system_0.md
    • kits/debate-arena/prompts/debate-judge_instructorllmnode-239_user_1.md
  • Added model config stubs (kits/debate-arena/model-configs/)
    • kits/debate-arena/model-configs/debate-setup_instructorllmnode-980_generative-model-name.ts
    • kits/debate-arena/model-configs/debate-round_instructorllmnode-435_generative-model-name.ts
    • kits/debate-arena/model-configs/debate-judge_instructorllmnode-239_generative-model-name.ts
  • Added Next.js debate app (kits/debate-arena/apps/)
    • kits/debate-arena/apps/.env.example
    • kits/debate-arena/apps/.eslintrc.json
    • kits/debate-arena/apps/actions/orchestrate.ts
    • kits/debate-arena/apps/app/globals.css
    • kits/debate-arena/apps/app/layout.tsx
    • kits/debate-arena/apps/app/page.tsx
    • kits/debate-arena/apps/lib/lamatic-client.ts
    • kits/debate-arena/apps/next-env.d.ts
    • kits/debate-arena/apps/next.config.mjs
    • kits/debate-arena/apps/package.json
    • kits/debate-arena/apps/package-lock.json
    • kits/debate-arena/apps/postcss.config.mjs
    • kits/debate-arena/apps/tsconfig.json
  • Flow node types introduced & high-level flow behavior (verified in kits/debate-arena/flows/*.ts; no flow.json artifacts found under kits/debate-arena/)
    • Node types used across all three flows
      • triggerNode (GraphQL/API trigger with advance_schema)
      • dynamicNode (InstructorLLM node configured via model/prompt references, outputs structured JSON)
      • responseNode (maps Instructor output fields into the flow response)
    • Edge types used across all three flows
      • defaultEdge (trigger → dynamicNode → responseNode)
      • responseEdge (trigger → responseNode)
    • debate-setup
      • Input: { topic }
      • Dynamic output: { cleanTopic, positionA, positionB, context } (topic reframed into two opposed positions)
    • debate-round
      • Input: { topic, position, opponentPosition, transcript, round, isRebuttal }
      • Dynamic output: { statement, keyPoint } (opening vs rebuttal behavior; transcript-grounded)
    • debate-judge
      • Input: { topic, positionA, positionB, transcript }
      • Dynamic output: transcript-grounded pros/cons for each side, strongestArgA/B, recommendation, confidence (low/medium/high), and caveats

@coderabbitai

coderabbitai Bot commented Jul 8, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review

Walkthrough

This PR adds the Debate Arena kit, including its flow definitions, prompt and model wiring, Next.js app scaffold, server actions, and a client page that runs setup, debate rounds, and judging while saving history and rendering results.

Changes

Debate Arena kit

Layer / File(s) Summary
Docs and guardrails
kits/debate-arena/README.md, kits/debate-arena/agent.md, kits/debate-arena/constitutions/default.md, kits/debate-arena/.gitignore, kits/debate-arena/.env.example, kits/debate-arena/apps/.env.example
Adds the kit documentation, shared constitution, ignore rules, and environment placeholders for Lamatic credentials and flow IDs.
Debate setup flow
kits/debate-arena/flows/debate-setup.ts, kits/debate-arena/prompts/debate-setup_*, kits/debate-arena/model-configs/debate-setup_*
Defines the setup flow graph, prompts, and model configuration for framing the topic and two positions.
Debate round flow
kits/debate-arena/flows/debate-round.ts, kits/debate-arena/prompts/debate-round_*, kits/debate-arena/model-configs/debate-round_*
Defines the round flow graph, prompts, and model configuration for opening statements and rebuttals.
Debate judge flow
kits/debate-arena/flows/debate-judge.ts, kits/debate-arena/prompts/debate-judge_*, kits/debate-arena/model-configs/debate-judge_*
Defines the judge flow graph, prompts, and model configuration for verdict synthesis.
Kit configuration
kits/debate-arena/lamatic.config.ts
Declares kit metadata, required step chaining, and deployment links.
Next.js app scaffold and client
kits/debate-arena/apps/package.json, kits/debate-arena/apps/tsconfig.json, kits/debate-arena/apps/next.config.mjs, kits/debate-arena/apps/next-env.d.ts, kits/debate-arena/apps/.eslintrc.json, kits/debate-arena/apps/postcss.config.mjs, kits/debate-arena/apps/app/layout.tsx, kits/debate-arena/apps/lib/lamatic-client.ts, kits/debate-arena/apps/app/globals.css, kits/debate-arena/apps/app/page.tsx
Sets up the app project, build/type tooling, layout shell, cached Lamatic client helper, page state machine, and styles.
Server actions
kits/debate-arena/apps/actions/orchestrate.ts
Adds typed schemas and server actions that call the debate flows and normalize their results.

Suggested reviewers: amanintech, d-pamneja

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Title check ✅ Passed Clear, concise title that matches the main change: adding a new Debate Arena kit.
Description check ✅ Passed The description follows the checklist structure and covers the kit, flows, env files, docs, and validation.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@github-actions

github-actions Bot commented Jul 8, 2026

Copy link
Copy Markdown
Contributor

:robot_face: AgentKit Structural Validation

New Contributions Detected

  • Kit: kits/debate-arena

Check Results

Check Status
No edits to existing kits ✅ Pass
Required root files present ✅ Pass
Flow .ts files present ✅ Pass
lamatic.config.ts valid ✅ Pass
No changes outside kits/ ✅ Pass

🎉 All checks passed! This contribution follows the AgentKit structure.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 6

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
kits/debate-arena/apps/app/globals.css (1)

1-229: 📐 Maintainability & Code Quality | 🟠 Major | ⚡ Quick win

Use CSS variables for styling per kit guidelines.

The coding guideline for kits/*/apps/**/*.{ts,tsx,css} requires CSS variables for styling, but this file uses ~15+ hardcoded hex/rgba color values scattered across selectors with no :root custom properties. This hurts maintainability — changing the accent color or background requires editing dozens of lines.

As per coding guidelines: "For kit Next.js apps: use CSS variables for styling."

♻️ Proposed refactor — extract colors into :root variables
+:root {
+  --bg-primary: `#0f1115`;
+  --bg-secondary: `#181b21`;
+  --bg-tertiary: `#14171d`;
+  --text-primary: `#e8e9ed`;
+  --text-secondary: `#c3c6cf`;
+  --text-muted: `#9aa0ab`;
+  --border-default: `#2a2e37`;
+  --border-disabled: `#35394a`;
+  --accent: `#5b7cfa`;
+  --accent-a: rgba(91, 124, 250, 0.1);
+  --accent-a-border: rgba(91, 124, 250, 0.4);
+  --accent-b: rgba(250, 121, 91, 0.1);
+  --accent-b-border: rgba(250, 121, 91, 0.4);
+  --success: rgba(91, 250, 178, 0.08);
+  --success-border: rgba(91, 250, 178, 0.3);
+  --error: rgba(250, 91, 91, 0.1);
+  --error-border: rgba(250, 91, 91, 0.35);
+  --error-text: `#ff9b9b`;
+}
+
 * {
   box-sizing: border-box;
 }
 
 html,
 body {
   padding: 0;
   margin: 0;
-  background: `#0f1115`;
-  color: `#e8e9ed`;
+  background: var(--bg-primary);
+  color: var(--text-primary);
   font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
 }

Then replace all remaining hardcoded values with the corresponding var(--...) references throughout the file.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@kits/debate-arena/apps/app/globals.css` around lines 1 - 229, The global
stylesheet uses many repeated hardcoded color values instead of kit-required CSS
variables, making theme changes hard to maintain. Add a :root block with
reusable custom properties for the background, text, borders, accent colors, and
translucent variants, then update the selectors in globals.css to reference
those variables everywhere. Keep the existing styling intent intact while
replacing the hex/rgba literals across html/body, controls, cards, bubbles,
verdict, recommendation, and error states.

Source: Coding guidelines

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@kits/debate-arena/apps/actions/orchestrate.ts`:
- Around line 63-69: The flow response handling in orchestrate should validate
the returned payload before treating it as a DebateSetup. Introduce small zod
schemas at the boundary around client.executeFlow and res.result, then parse the
successful output and only return it when validation passes; otherwise surface
the existing error path. Update the res.status/result check in orchestrate so
the cast to DebateSetup is replaced by schema-backed parsing and the UI never
receives drifted flow data.
- Around line 1-3: The orchestrate action is still hardcoding flow ID env
lookups instead of using the kit config as the source of truth. Update the logic
in orchestrate.ts to import ../../lamatic.config, read each step’s envKey from
steps, and use those values when resolving flow IDs rather than calling
requireFlowId with DEBATE_*_FLOW_ID strings. Keep the existing getLamaticClient
flow wiring, but make the step-to-flow mapping come directly from the kit
config.

In `@kits/debate-arena/apps/app/page.tsx`:
- Around line 127-133: The topic textarea in page.tsx is missing a programmatic
label, so add an accessible name by pairing it with a visible <label htmlFor>
using a stable id on the textarea, or by adding an aria-label directly to the
textarea element. Also update the error banner component in the same file to use
role="alert" so failures are announced immediately to assistive technologies.

In `@kits/debate-arena/apps/package.json`:
- Around line 12-17: The package.json dependencies block is missing several
guideline-required UI/form packages. Update the dependencies section to include
the Next.js app’s required frontend stack: Tailwind CSS v4+, shadcn/ui,
lucide-react, react-hook-form, and zod alongside the existing next/react
packages. Make sure the app’s package manifest reflects any UI libraries used by
the app so the dependency list matches the coding guidelines and the components
in the app can resolve correctly.

In `@kits/debate-arena/flows/debate-setup.ts`:
- Around line 80-88: The prompt entries in debate-setup use the same UUIDs as
debate-round, which can collide if Lamatic treats prompt IDs globally. Update
the system and user prompt IDs in the debate-setup flow to new unique UUIDs, and
keep the corresponding prompt references in the same flow aligned so each prompt
can be resolved independently without overlapping debate-round’s IDs.

In `@kits/debate-arena/prompts/debate-judge_instructorllmnode-239_user_1.md`:
- Line 1: The judge prompt is interpolating structured values directly, so the
model may see opaque object/array text instead of usable debate content. Update
the prompt source in debate-judge_instructorllmnode-239_user_1.md to serialize
triggerNode_1.output.positionA, triggerNode_1.output.positionB, and
triggerNode_1.output.transcript into JSON text before insertion. Keep the Topic
field as-is, but ensure the debate inputs are rendered as explicit JSON payloads
so the judge can reliably evaluate the actual data.

---

Outside diff comments:
In `@kits/debate-arena/apps/app/globals.css`:
- Around line 1-229: The global stylesheet uses many repeated hardcoded color
values instead of kit-required CSS variables, making theme changes hard to
maintain. Add a :root block with reusable custom properties for the background,
text, borders, accent colors, and translucent variants, then update the
selectors in globals.css to reference those variables everywhere. Keep the
existing styling intent intact while replacing the hex/rgba literals across
html/body, controls, cards, bubbles, verdict, recommendation, and error states.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI (base), Organization UI (inherited)

Review profile: ASSERTIVE

Plan: Pro

Run ID: 3624d9d9-d047-4c3e-a93c-57e003f5bf01

📥 Commits

Reviewing files that changed from the base of the PR and between dafde4c and 23d0b60.

⛔ Files ignored due to path filters (1)
  • kits/debate-arena/apps/package-lock.json is excluded by !**/package-lock.json
📒 Files selected for processing (28)
  • kits/debate-arena/.gitignore
  • kits/debate-arena/README.md
  • kits/debate-arena/agent.md
  • kits/debate-arena/apps/.env.example
  • kits/debate-arena/apps/.eslintrc.json
  • kits/debate-arena/apps/actions/orchestrate.ts
  • kits/debate-arena/apps/app/globals.css
  • kits/debate-arena/apps/app/layout.tsx
  • kits/debate-arena/apps/app/page.tsx
  • kits/debate-arena/apps/lib/lamatic-client.ts
  • kits/debate-arena/apps/next-env.d.ts
  • kits/debate-arena/apps/next.config.mjs
  • kits/debate-arena/apps/package.json
  • kits/debate-arena/apps/tsconfig.json
  • kits/debate-arena/constitutions/default.md
  • kits/debate-arena/flows/debate-judge.ts
  • kits/debate-arena/flows/debate-round.ts
  • kits/debate-arena/flows/debate-setup.ts
  • kits/debate-arena/lamatic.config.ts
  • kits/debate-arena/model-configs/debate-judge_instructorllmnode-239_generative-model-name.ts
  • kits/debate-arena/model-configs/debate-round_instructorllmnode-435_generative-model-name.ts
  • kits/debate-arena/model-configs/debate-setup_instructorllmnode-980_generative-model-name.ts
  • kits/debate-arena/prompts/debate-judge_instructorllmnode-239_system_0.md
  • kits/debate-arena/prompts/debate-judge_instructorllmnode-239_user_1.md
  • kits/debate-arena/prompts/debate-round_instructorllmnode-435_system_0.md
  • kits/debate-arena/prompts/debate-round_instructorllmnode-435_user_1.md
  • kits/debate-arena/prompts/debate-setup_instructorllmnode-980_system_0.md
  • kits/debate-arena/prompts/debate-setup_instructorllmnode-980_user_1.md

Comment thread kits/debate-arena/apps/actions/orchestrate.ts
Comment thread kits/debate-arena/apps/actions/orchestrate.ts Outdated
Comment thread kits/debate-arena/apps/app/page.tsx
Comment on lines +12 to +17
"dependencies": {
"lamatic": "^0.3.2",
"next": "14.2.35",
"react": "^18.3.1",
"react-dom": "^18.3.1"
},

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

📐 Maintainability & Code Quality | 🟠 Major | ⚡ Quick win

Missing Tailwind CSS and other guideline-required dependencies.

Per coding guidelines, kit Next.js apps must use Tailwind CSS v4+, shadcn/ui components, lucide-react for icons, and react-hook-form + zod for forms. The dependencies block includes lamatic, next, and react/react-dom but omits tailwindcss, shadcn/ui, lucide-react, react-hook-form, and zod. If the app UI uses any of these, they need to be declared here.

As per coding guidelines: kits/*/apps/**/*.{ts,tsx,js,jsx} — "use Next.js 14-15, React 18, TypeScript, Tailwind CSS v4+, shadcn/ui components, react-hook-form + zod for forms, lucide-react for icons, and Vercel for deployment".

📦 Suggested additions to dependencies
   "dependencies": {
     "lamatic": "^0.3.2",
     "next": "14.2.35",
     "react": "^18.3.1",
-    "react-dom": "^18.3.1"
+    "react-dom": "^18.3.1",
+    "tailwindcss": "^4",
+    "lucide-react": "^0.400.0",
+    "react-hook-form": "^7",
+    "zod": "^3"
   },
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
"dependencies": {
"lamatic": "^0.3.2",
"next": "14.2.35",
"react": "^18.3.1",
"react-dom": "^18.3.1"
},
"dependencies": {
"lamatic": "^0.3.2",
"next": "14.2.35",
"react": "^18.3.1",
"react-dom": "^18.3.1",
"tailwindcss": "^4",
"lucide-react": "^0.400.0",
"react-hook-form": "^7",
"zod": "^3"
},
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@kits/debate-arena/apps/package.json` around lines 12 - 17, The package.json
dependencies block is missing several guideline-required UI/form packages.
Update the dependencies section to include the Next.js app’s required frontend
stack: Tailwind CSS v4+, shadcn/ui, lucide-react, react-hook-form, and zod
alongside the existing next/react packages. Make sure the app’s package manifest
reflects any UI libraries used by the app so the dependency list matches the
coding guidelines and the components in the app can resolve correctly.

Source: Coding guidelines

Comment thread kits/debate-arena/flows/debate-setup.ts Outdated
@@ -0,0 +1 @@
Topic: {{triggerNode_1.output.topic}} Position A: {{triggerNode_1.output.positionA}} Position B: {{triggerNode_1.output.positionB}} Debate Transcript: {{triggerNode_1.output.transcript}} Evaluate the debate above and produce your verdict as valid JSON matching the output schema.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# Check if any existing kit prompt files demonstrate object serialization in Mustache templates.
rg -n 'output\.\w+\b' --glob 'kits/*/prompts/*.md' | head -30

Repository: Lamatic/AgentKit

Length of output: 154


🏁 Script executed:

#!/bin/bash
set -euo pipefail

# Locate the debate prompt files and any template-engine helpers relevant to interpolation.
printf '\n## prompt files\n'
git ls-files 'kits/debate-arena/prompts/*.md' || true

printf '\n## search for template serialization or mustache-style rendering\n'
rg -n --hidden --glob '!node_modules' --glob '!dist' --glob '!build' \
  'JSON\.stringify|stringify\(|mustache|handlebars|template engine|interpolat|serialize' \
  .

Repository: Lamatic/AgentKit

Length of output: 30023


🏁 Script executed:

#!/bin/bash
set -euo pipefail

# Inspect the specific prompt file and nearby prompt patterns.
printf '\n## file size\n'
wc -l kits/debate-arena/prompts/debate-judge_instructorllmnode-239_user_1.md

printf '\n## prompt content\n'
cat -n kits/debate-arena/prompts/debate-judge_instructorllmnode-239_user_1.md

printf '\n## neighboring debate prompts\n'
git ls-files 'kits/debate-arena/prompts/*.md' | sed -n '1,40p'

Repository: Lamatic/AgentKit

Length of output: 1010


🏁 Script executed:

#!/bin/bash
set -euo pipefail

# Inspect all debate-arena prompt files for interpolation style and any explicit serialization.
for f in kits/debate-arena/prompts/*.md; do
  echo "### $f"
  sed -n '1,4p' "$f"
  echo
done

printf '\n## search for literal object/array fields in debate prompts\n'
rg -n '\{\{[^}]+\}\}' kits/debate-arena/prompts/*.md

Repository: Lamatic/AgentKit

Length of output: 4507


🌐 Web query:

Lamatic template engine object interpolation mustache JSON stringify prompt variables

💡 Result:

In Lamatic.ai, template engines and prompt interfaces utilize a double-brace syntax ({{variableName}}) for object interpolation and variable injection [1][2][3]. Key aspects of variable handling include: Interpolation Syntax: Variables are injected into prompts and configurations using the {{key}} format [4][2][3]. When referencing output from specific nodes, the syntax typically follows the pattern {{nodeId.output.field}} [1][5]. Prompt Templates: The Prompt IDE and LLM nodes support modular prompt construction [2][3]. You can insert variables by typing {{ to open a selection menu or by manually typing the variable name [2][6][3]. These templates can be saved, versioned, and reused across different flows [2][6][3]. Structured Data and JSON: While prompt variables are interpolated as strings within the template text, you can manage complex structured data using Code Nodes [7][8]. In a Code Node, you can perform standard JavaScript operations, including JSON.stringify to convert objects into strings before passing them to downstream nodes or prompt templates [7]. Additionally, the platform provides specific nodes, such as the Generate JSON Node, which uses Zod-based schemas to ensure AI output conforms to a strict JSON structure [9]. Variable Management: Variables can be managed centrally via Variable Nodes or project-level settings (Secrets), allowing for dynamic data passing and secure configuration management without hardcoding values [1][10].

Citations:


🏁 Script executed:

#!/bin/bash
set -euo pipefail

# Read the target prompt and inspect nearby prompt files for templating style.
printf '## target file\n'
wc -l kits/debate-arena/prompts/debate-judge_instructorllmnode-239_user_1.md
cat -n kits/debate-arena/prompts/debate-judge_instructorllmnode-239_user_1.md

printf '\n## all prompt files in kits/debate-arena/prompts\n'
git ls-files 'kits/debate-arena/prompts/*.md'

Repository: Lamatic/AgentKit

Length of output: 1011


🏁 Script executed:

#!/bin/bash
set -euo pipefail

# Inspect the debate-arena flow and any code that shapes the values fed into these prompts.
printf '## debate arena files\n'
git ls-files 'kits/debate-arena/**' | sed -n '1,120p'

printf '\n## search for positionA, positionB, transcript, and debate-round wiring\n'
rg -n --hidden --glob '!node_modules' --glob '!dist' --glob '!build' \
  'positionA|positionB|transcript|debate-judge_instructorllmnode-239|debate-round_instructorllmnode-435|debate-setup_instructorllmnode-980' \
  kits/debate-arena

Repository: Lamatic/AgentKit

Length of output: 15187


🏁 Script executed:

#!/bin/bash
set -euo pipefail

# Read the flow source if present and the surrounding docs that describe how prompts receive data.
fd -a 'debate-arena' kits

Repository: Lamatic/AgentKit

Length of output: 192


🏁 Script executed:

#!/bin/bash
set -euo pipefail

# Find the debate-arena flow source and inspect the trigger/output mapping for the judge node.
flow_file="$(fd -a 'debate-arena.*\.ts$|debate-arena.*\.js$|debate-arena' kits | head -1 || true)"
printf 'flow candidate: %s\n' "$flow_file"
if [ -n "$flow_file" ] && [ -f "$flow_file" ]; then
  wc -l "$flow_file"
  cat -n "$flow_file"
fi

Repository: Lamatic/AgentKit

Length of output: 208


🏁 Script executed:

#!/bin/bash
set -euo pipefail

# Check whether the debate-arena kit already serializes these structured fields before the prompt node.
rg -n --hidden --glob '!node_modules' --glob '!dist' --glob '!build' \
  'JSON\.stringify\(|positionA|positionB|transcript|debate-arena' \
  kits/debate-arena

Repository: Lamatic/AgentKit

Length of output: 12296


Serialize the judge inputs before interpolation (kits/debate-arena/prompts/debate-judge_instructorllmnode-239_user_1.md). positionA, positionB, and transcript are structured values; emit JSON text here so the judge sees the real debate data instead of opaque object/array text.

🧰 Tools
🪛 markdownlint-cli2 (0.22.1)

[warning] 1-1: First line in a file should be a top-level heading

(MD041, first-line-heading, first-line-h1)

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@kits/debate-arena/prompts/debate-judge_instructorllmnode-239_user_1.md` at
line 1, The judge prompt is interpolating structured values directly, so the
model may see opaque object/array text instead of usable debate content. Update
the prompt source in debate-judge_instructorllmnode-239_user_1.md to serialize
triggerNode_1.output.positionA, triggerNode_1.output.positionB, and
triggerNode_1.output.transcript into JSON text before insertion. Keep the Topic
field as-is, but ensure the debate inputs are rendered as explicit JSON payloads
so the judge can reliably evaluate the actual data.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@kits/debate-arena/.env.example`:
- Around line 7-9: Replace the hard-coded debate flow UUIDs in the .env.example
template with generic placeholders, since these values are deployment-specific
and should not point new installs to a particular workspace. Update the example
entries for DEBATE_SETUP_FLOW_ID, DEBATE_ROUND_FLOW_ID, and DEBATE_JUDGE_FLOW_ID
in the debate-arena env template, while keeping the existing “copy flow id”
guidance so users know where to obtain the real values.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI (base), Organization UI (inherited)

Review profile: ASSERTIVE

Plan: Pro

Run ID: d9fb03c6-6b29-48fc-93bb-207ae6a2f813

📥 Commits

Reviewing files that changed from the base of the PR and between 23d0b60 and 853b2d9.

📒 Files selected for processing (1)
  • kits/debate-arena/.env.example

Comment thread kits/debate-arena/.env.example Outdated
@HEMANTH-A-7

Copy link
Copy Markdown
Author

Pushed fixes for all 6 review comments plus the follow-up on .env.example:

  1. Flow IDs from configorchestrate.ts now resolves each step's env var through lamatic.config.ts's steps array instead of hardcoding the env var name at each call site.
  2. Zod validation — added schemas for DebateSetup, DebateTurn, and DebateVerdict; all three server actions now safeParse the flow response instead of blind as casts.
  3. Accessibility — added a sr-only label for the topic textarea and role="alert" on the error banner.
  4. Tailwind CSS + zod dependency — added Tailwind CSS v4 (@import "tailwindcss"; + @tailwindcss/postcss) alongside the existing custom CSS, and added zod as a dependency. Skipped shadcn/ui, react-hook-form, and lucide-react since this UI has no icons and only one free-text field with no complex validation needs — happy to add them if you'd rather see the full set regardless.
  5. Duplicate prompt UUIDs — regenerated unique system/user prompt UUIDs per flow; the three flows no longer share the same two IDs.
  6. Judge prompt interpolation — left as-is intentionally. positionA/positionB/transcript are sent as structured objects/arrays (not pre-stringified) to debate-round and debate-judge, and this was tested end-to-end in Lamatic Studio with real nested payloads — the model correctly parses the interpolated structured data and produces valid verdicts. Let me know if you're seeing different behavior on your end and I'll add explicit JSON.stringify calls.
  7. .env.example hardcoded flow IDs (from your second pass) — replaced my deployed workspace flow IDs with YOUR_*_FLOW_ID placeholders in both kits/debate-arena/.env.example and apps/.env.example, matching the convention in sre-incident-postmortem-agent.

npm run build, npm run lint, and npm run type-check all pass cleanly after these changes.

@github-actions

github-actions Bot commented Jul 8, 2026

Copy link
Copy Markdown
Contributor

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Jul 8, 2026

Copy link
Copy Markdown
Contributor
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
kits/debate-arena/apps/app/globals.css (1)

218-378: 📐 Maintainability & Code Quality | 🟠 Major | 🏗️ Heavy lift

Mission brief: convert these hardcoded palette values to CSS variables.

Agent, the accent (#5b7cfa), border (#2a2e37), text (#e8e9ed/#9aa0ab), and surface (#181b21/#14171d) colors, plus the confidence/danger rgba(...) tints, recur across dozens of selectors here. The project standard for kit apps is to drive styling through CSS variables. Centralize these in a :root token set and reference via var(--...) so theming stays consistent and a single edit propagates.

As per coding guidelines: "For kit Next.js apps: use CSS variables for styling."

🎨 Illustrative token approach
+:root {
+  --color-accent: `#5b7cfa`;
+  --color-border: `#2a2e37`;
+  --color-surface: `#181b21`;
+  --color-surface-alt: `#14171d`;
+  --color-text: `#e8e9ed`;
+  --color-text-muted: `#9aa0ab`;
+  --color-danger: `#fa5b5b`;
+}

Then, e.g.:

 .ghost-button:hover {
-  border-color: `#5b7cfa`;
-  color: `#e8e9ed`;
+  border-color: var(--color-accent);
+  color: var(--color-text);
 }
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@kits/debate-arena/apps/app/globals.css` around lines 218 - 378, The palette
in this stylesheet is still hardcoded, while the kit app standard requires CSS
variables for theming and consistency. Move the repeated accent, border, text,
surface, and confidence/danger tint values into a :root token set in
globals.css, then update the affected selectors (such as .ghost-button,
.error-banner, .history-panel, .history-list button, and the confidence-tag
variants) to reference var(--...) tokens instead of literal colors. Keep the
existing visual styles intact while centralizing the values so future theme
changes flow through one place.

Source: Coding guidelines

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@kits/debate-arena/apps/app/page.tsx`:
- Around line 276-308: regenerateRound currently updates only the selected turn,
which can leave later rebuttals inconsistent with the revised statement. In
page.tsx, either restrict the Regenerate action to the latest turn, or when
regenerateRound runs, also mark or rebuild downstream turns after the updated
index so transcript stays coherent. Use regenerateRound, runDebateRound, and
setTranscript as the key places to adjust the behavior.
- Around line 34-44: The persisted history parsing in loadHistory() only
verifies the top-level JSON is an array, so invalid items can still reach
loadFromHistory() and break when accessing entry.setup or entry.verdict. Update
loadHistory() to validate each parsed item against the SavedDebate shape (or add
equivalent type guards before returning), and filter out any malformed entries
so only safe records are returned for loadFromHistory() to consume.

---

Outside diff comments:
In `@kits/debate-arena/apps/app/globals.css`:
- Around line 218-378: The palette in this stylesheet is still hardcoded, while
the kit app standard requires CSS variables for theming and consistency. Move
the repeated accent, border, text, surface, and confidence/danger tint values
into a :root token set in globals.css, then update the affected selectors (such
as .ghost-button, .error-banner, .history-panel, .history-list button, and the
confidence-tag variants) to reference var(--...) tokens instead of literal
colors. Keep the existing visual styles intact while centralizing the values so
future theme changes flow through one place.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI (base), Organization UI (inherited)

Review profile: ASSERTIVE

Plan: Pro

Run ID: eaadd456-b8c7-4a9d-a1d8-f2838863625c

📥 Commits

Reviewing files that changed from the base of the PR and between f6e9f7a and aba1c53.

📒 Files selected for processing (3)
  • kits/debate-arena/apps/app/globals.css
  • kits/debate-arena/apps/app/page.tsx
  • kits/debate-arena/prompts/debate-judge_instructorllmnode-239_system_0.md

Comment thread kits/debate-arena/apps/app/page.tsx
Comment thread kits/debate-arena/apps/app/page.tsx
@HEMANTH-A-7

Copy link
Copy Markdown
Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Jul 8, 2026

Copy link
Copy Markdown
Contributor
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
kits/debate-arena/apps/app/page.tsx (1)

334-366: 🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

Regenerating the last turn leaves the verdict and saved record out of sync.

Good work sealing off the earlier turns. But this button also stays live once phase === "done". When an operative regenerates the final turn, transcript is swapped for a fresh statement while verdict (still on screen) and the already-persisted history entry keep referencing the retired statement. The "Download as Markdown" then exports the new transcript stapled to the stale verdict, and the saved history record diverges from what's displayed.

Simplest containment: when regenerating with a verdict present, invalidate it so the debate is clearly no longer "judged" (and let the user re-run the judge), rather than showing a contradictory pairing.

🧩 One option: drop the stale verdict on regenerate
     const updated = [...transcript];
     updated[turnIndex] = res.data;
     setTranscript(updated);
+
+    // The prior verdict/history entry were judged against the replaced
+    // statement -- clear them so the UI doesn't show a contradictory pairing.
+    if (verdict) {
+      setVerdict(null);
+      setPhase("debating");
+    }
   }
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@kits/debate-arena/apps/app/page.tsx` around lines 334 - 366, The
regenerateRound flow in page.tsx leaves the final verdict and persisted history
stale when the last turn is regenerated. Update regenerateRound so that after a
successful replacement of the turn in transcript, any existing verdict is
cleared (and any related judged/completed state is reset) when phase is done or
a verdict is present, using the regenerateRound, setTranscript, and
verdict-related state in the page component. This keeps the displayed debate and
saved/exported record aligned and forces the judge to be rerun on the new
transcript.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@kits/debate-arena/apps/app/globals.css`:
- Around line 249-253: The .field-error rule is using a hardcoded error color
instead of the shared theme token. Update the stylesheet to use a CSS variable
for this color, and define the token alongside the other theme variables in the
html/body theme block so .field-error and .error-banner can share the same
source of truth. Use the existing .field-error selector and the main theme token
definitions to locate the change.

---

Outside diff comments:
In `@kits/debate-arena/apps/app/page.tsx`:
- Around line 334-366: The regenerateRound flow in page.tsx leaves the final
verdict and persisted history stale when the last turn is regenerated. Update
regenerateRound so that after a successful replacement of the turn in
transcript, any existing verdict is cleared (and any related judged/completed
state is reset) when phase is done or a verdict is present, using the
regenerateRound, setTranscript, and verdict-related state in the page component.
This keeps the displayed debate and saved/exported record aligned and forces the
judge to be rerun on the new transcript.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI (base), Organization UI (inherited)

Review profile: ASSERTIVE

Plan: Pro

Run ID: b4ddf53d-dd99-4c79-beb8-1e63bef60324

📥 Commits

Reviewing files that changed from the base of the PR and between aba1c53 and 1a75b26.

📒 Files selected for processing (2)
  • kits/debate-arena/apps/app/globals.css
  • kits/debate-arena/apps/app/page.tsx

Comment thread kits/debate-arena/apps/app/globals.css
@HEMANTH-A-7

Copy link
Copy Markdown
Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Jul 8, 2026

Copy link
Copy Markdown
Contributor
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@HEMANTH-A-7

Copy link
Copy Markdown
Author

@coderabbitai full review

@coderabbitai

coderabbitai Bot commented Jul 8, 2026

Copy link
Copy Markdown
Contributor
✅ Action performed

Full review finished.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@kits/debate-arena/apps/app/page.tsx`:
- Around line 437-449: Disable the history entry buttons and the Clear history
button while a debate is active or regeneration is in progress, and update
loadFromHistory to defensively reset regeneratingRound when loading a past
debate. Use the existing isRunning state and regeneratingRound state around the
history list rendering and clearHistory action, and make sure loadFromHistory
remains the only place that restores ctxRef.current and related debate state.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI (base), Organization UI (inherited)

Review profile: ASSERTIVE

Plan: Pro

Run ID: 9b379144-6e34-4ba0-a5f8-691c668edac1

📥 Commits

Reviewing files that changed from the base of the PR and between dafde4c and 97b986b.

⛔ Files ignored due to path filters (1)
  • kits/debate-arena/apps/package-lock.json is excluded by !**/package-lock.json
📒 Files selected for processing (30)
  • kits/debate-arena/.env.example
  • kits/debate-arena/.gitignore
  • kits/debate-arena/README.md
  • kits/debate-arena/agent.md
  • kits/debate-arena/apps/.env.example
  • kits/debate-arena/apps/.eslintrc.json
  • kits/debate-arena/apps/actions/orchestrate.ts
  • kits/debate-arena/apps/app/globals.css
  • kits/debate-arena/apps/app/layout.tsx
  • kits/debate-arena/apps/app/page.tsx
  • kits/debate-arena/apps/lib/lamatic-client.ts
  • kits/debate-arena/apps/next-env.d.ts
  • kits/debate-arena/apps/next.config.mjs
  • kits/debate-arena/apps/package.json
  • kits/debate-arena/apps/postcss.config.mjs
  • kits/debate-arena/apps/tsconfig.json
  • kits/debate-arena/constitutions/default.md
  • kits/debate-arena/flows/debate-judge.ts
  • kits/debate-arena/flows/debate-round.ts
  • kits/debate-arena/flows/debate-setup.ts
  • kits/debate-arena/lamatic.config.ts
  • kits/debate-arena/model-configs/debate-judge_instructorllmnode-239_generative-model-name.ts
  • kits/debate-arena/model-configs/debate-round_instructorllmnode-435_generative-model-name.ts
  • kits/debate-arena/model-configs/debate-setup_instructorllmnode-980_generative-model-name.ts
  • kits/debate-arena/prompts/debate-judge_instructorllmnode-239_system_0.md
  • kits/debate-arena/prompts/debate-judge_instructorllmnode-239_user_1.md
  • kits/debate-arena/prompts/debate-round_instructorllmnode-435_system_0.md
  • kits/debate-arena/prompts/debate-round_instructorllmnode-435_user_1.md
  • kits/debate-arena/prompts/debate-setup_instructorllmnode-980_system_0.md
  • kits/debate-arena/prompts/debate-setup_instructorllmnode-980_user_1.md

Comment thread kits/debate-arena/apps/app/page.tsx
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant