Skip to content

RFC-002: Template Ecosystem for Deterministic Agent Output#1724

Draft
ChaiWithJai wants to merge 5 commits intofeat/web-ui-agentfrom
wip/template-ecosystem-rfc
Draft

RFC-002: Template Ecosystem for Deterministic Agent Output#1724
ChaiWithJai wants to merge 5 commits intofeat/web-ui-agentfrom
wip/template-ecosystem-rfc

Conversation

@ChaiWithJai
Copy link
Copy Markdown
Collaborator

@ChaiWithJai ChaiWithJai commented Dec 9, 2025

Summary

Implements a deterministic template ecosystem that eliminates hallucinated Liquid tags and ensures verifiable page creation with consistent 90s nostalgia styling.

Key Features:

  • 🎨 90s Nostalgia CSS applied to all generated pages automatically
  • Verified Liquid Tags - only tags that exist in Violet Rails
  • 🚫 Forbidden Tag Detection - blocks hallucinated tags like render_api_form
  • 🔍 Page Verification - confirms pages render without errors after creation

Architecture: Deep Agent Template Designer Subagent (DIAGNOSE → MULTI-EXPERT → ARTIFACT-FIRST → DOMAIN-NATIVE)

Tools (5):

Tool Purpose
list_templates Show available page templates
select_template Get template definition with required slots
get_liquid_tag Return verified Liquid syntax (never hallucinate)
generate_styled_page Create HTML with 90s nostalgia CSS embedded
verify_page HTTP check for render errors after creation

Template Types:

Type Use For
home Landing page with hero, categories, CTAs
category Topic/category landing pages
post_index List all posts with filtering
post_show Single post view with full content
write Form submission (uses render_form, NOT render_api_form)
about About/info pages

Problem Statement

Evaluation of agent-built artifacts revealed:

  • /write page BROKEN with NoMethodError: undefined method 'render_api_form'
  • Pages rendered without consistent styling
  • Agent hallucinated Liquid tags that don't exist in Violet Rails

Root Cause

# Agent hallucinated this tag (DOES NOT EXIST):
{{ render_api_form | namespace: 'stories' }}

# Correct tag (VERIFIED):
{{ render_form | namespace: 'stories' | submit_text: 'Submit' }}

Walking Through The Workflow

The Template Designer ensures consistent styling through a 3-step workflow:

Step 1: Generate Styled HTML

result = generate_styled_page(
    page_type="home",
    slot_values={
        "site_title": "The Cosmic Observer",
        "headline": "Exploring the Universe",
        "tagline": "Astronomy insights for curious minds",
    }
)
styled_html = result["html"]  # Contains 90s nostalgia CSS inline

Step 2: Create the Page

create_page(
    subdomain="cosmic-observer",
    title="Home",
    slug="home",
    page_type="custom",
    content=styled_html
)

Step 3: Verify It Renders

verify_page(subdomain="cosmic-observer", path="/home")
# Returns: {"success": True, "url": "http://cosmic-observer.localhost:5250/home"}

Result: Styled Page

Tested E2E with "Create a blog called The Cosmic Observer about astronomy":

  • ✅ Agent used Template Designer workflow
  • ✅ 90s nostalgia styling applied (cream background, Georgia serif, teal/coral accents)
  • ✅ Page verified successfully at cosmic-observer.localhost:5250/home

The 90s Nostalgia CSS

Design philosophy: "Don't Make Me Think Revisited"

/* Core palette */
--cream-bg: #fdf6e3;
--paper-white: #fffef9;
--teal-accent: #2a9d8f;
--coral-accent: #e76f51;

/* Typography */
font-family: Georgia, 'Times New Roman', serif;

/* Layout */
CSS Grid with generous whitespace

Visual characteristics:

  • Cream backgrounds for warmth
  • Paper-white content cards
  • Georgia serif for readability
  • Teal primary buttons, coral secondary
  • Generous whitespace and padding

Files Changed

File Purpose
prompts.py Added Template Designer workflow to Step 4
agent.py Import Template Designer tools for main agent
template_designer.py Page type docs, slot references, styling
subagents/__init__.py Export Template Designer constants
templates/styles/90s_nostalgia.css Complete CSS system
docs/RFC-002-template-ecosystem.md Full RFC documentation

Test Plan

  • Verify VERIFIED_LIQUID_TAGS matches actual Violet Rails tags
  • Verify FORBIDDEN_TAGS blocks render_api_form, api_resource
  • E2E test: agent uses generate_styled_page for pages
  • E2E test: created pages have 90s nostalgia CSS applied
  • E2E test: verify_page detects render errors

Run tests: cd violet-app-agent/apps/agent && pytest tests/ -v


Dependencies

This PR builds on feat/web-ui-agent (PR #1719).

Related

Closes #1726 - Template ecosystem for deterministic output
Relates to #1720, #1721, #1722, #1723, #1724, #1725

🤖 Generated with Claude Code

RFC-002 documents the comprehensive evaluation of agent-built artifacts and
proposes a deterministic template ecosystem to address observed failures:

Composite Evaluation:
- 6 screenshots documenting conscious-observer.localhost artifact state
- /home: Working with 3 content cards (Toronto, Jersey City, Observation)
- /toronto, /jersey-city: Rich narrative content successfully rendered
- /write: BROKEN - NoMethodError for non-existent render_api_form
- /stories: Empty page - no content populated

Template Designer Subagent:
- VERIFIED_LIQUID_TAGS: Deterministic list of known-good tags
- FORBIDDEN_TAGS: Explicitly block render_api_form, api_resource, etc
- Blog templates: home, category, post_index, post_show, write, about
- verify_page tool: HTTP verification with error pattern detection
- generate_styled_page: Complete HTML with 90s nostalgia CSS

90s Low-Tech Nostalgia CSS:
- Design Philosophy: "Don't Make Me Think Revisited"
- Cream backgrounds (#f5f0e6), paper-white cards (#fffef9)
- Georgia serif typography for web 1.0 feel
- Teal/coral accents (#2a9d8f, #e76f51)
- CSS Grid layout with content-width container
- Mobile responsive with print styles

Success Criteria:
- PageVerificationCriteria class for systematic validation
- HTTP 200 + no Liquid errors + has_content check

Related: #1720, #1721, #1722, #1723, #1724, #1725

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@ChaiWithJai ChaiWithJai added enhancement New feature or request documentation Improvements or additions to documentation labels Dec 9, 2025
Jai Bhagat and others added 2 commits December 8, 2025 23:34
Adds Template Designer tools and subagent to the main Violet App Agent:

Tools added:
- list_templates: List available blog templates
- select_template: Choose template for page type
- get_liquid_tag: Get verified Liquid tag syntax
- generate_styled_page: Generate HTML with 90s nostalgia CSS
- verify_page: HTTP verification after page creation

Subagent added:
- Template Designer: Deterministic template generation with verified tags

Fix: Changed create_react_agent parameter from state_modifier to prompt
(API compatibility with current langgraph version)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Updates the system prompt to explicitly instruct the agent to use the
Template Designer workflow for all page creation, ensuring 90s nostalgia
CSS styling is consistently applied.

Changes:
- prompts.py: Added Template Designer workflow instructions to Step 4
- agent.py: Import Template Designer tools for main agent access
- template_designer.py: Added page type documentation and slot references
- subagents/__init__.py: Export Template Designer constants

The agent now follows this workflow for pages:
1. generate_styled_page() → Returns HTML with 90s nostalgia CSS
2. create_page() → Creates the page in CMS
3. verify_page() → Confirms page renders without errors

Tested E2E: cosmic-observer.localhost:5250/home renders with:
- Cream background (#fdf6e3)
- Georgia serif typography
- Teal/coral accent buttons

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
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.

@ChaiWithJai this error came up because its using the wrong syntax to render the form, it should be
https://github.com/restarone/violet_rails/wiki/API:-Entities,-Form-Rendering,-Interfaces-and-Actions#render-the-form
it should be something like;

{{ cms:helper render_form, 1 }}

@donrestarone
Copy link
Copy Markdown
Contributor

@ChaiWithJai do you want to merge this PR to the base branch you are currently targeting? I think the merge looks good, only concern is storing generated screenshots.

Of course if/when we eventually merge this to master we would need to strip the python directory when emitting the source code for the rails server deployment

Jai Bhagat and others added 2 commits December 9, 2025 09:31
Adds a complete demo package for the Violet Rails Hackathon:

- index.html: Landing page with 90s nostalgia styling
  - Hero: "One sentence. One deployed app."
  - Live demo section showing agent workflow
  - Features grid highlighting key capabilities
  - Hackathon CTA for "Building with AI" track
  - "Try It Live" button linking to chat UI

- DEMO_SCRIPT.md: Video recording script with timing
- SOCIAL_POSTS.md: Twitter, LinkedIn, YouTube, Reddit, HN posts
- demo-landing-page.png: Full page screenshot

Pull this PR to try the agent locally for the hackathon.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Comprehensive guide for hackathon participants to extend the Template
Ecosystem feature:

- Architecture overview with Deep Agent pattern
- Setup instructions for local development
- Key code locations and examples
- Extension ideas (beginner to advanced)
- Step-by-step guides for:
  - Adding new page templates
  - Creating CSS themes
  - Building new subagents
- Testing strategies and common pitfalls
- Submission checklist

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants