About PolyGen

PolyGen was built for the Governance & Accessibility track of the Anthropic x Maryland Hackathon. The inspiration came from a simple problem: politics often feels inaccessible, abstract, and impossible to influence. Most people hear about policy outcomes only after decisions are made, but they rarely get to explore how arguments, incentives, ideology, and persuasion interact inside a legislative process. PolyGen turns that complexity into an interactive simulation where users can write a policy idea, refine it into a bill, watch an initial vote, lobby individual politicians through conversation, and then see how the final vote changes. We built PolyGen for students, civic learners, organizers, and anyone who wants to better understand political strategy without needing to already understand legislative procedure. It is not meant to predict real-world politics. Instead, it is designed to make political causality feel legible: if you make a better argument to the right person, the system should show you how influence can shift.

How We Built It

PolyGen is a Vite + React + TypeScript app with a lightweight Hono API layer. The frontend owns the entire simulation state: generated politicians, bill data, vote outcomes, persuasion scores, chat history, and phase transitions. The backend is stateless and only handles AI interpretation tasks.

The app has five phases:

  • Policy creation
  • Bill refinement
  • Initial vote
  • Lobbying
  • Final vote

AI is used only as an interpretation layer. It helps convert a natural-language policy idea into a structured bill, scores how persuasive a lobbying message is, and generates politician-style replies. The final votes are never directly decided by the model. Instead, voting is computed in code using ideology, bill lean, influence, persuasion, and controlled randomness. This separation mattered to us because it keeps the simulation understandable. The model can interpret language, but the system rules decide outcomes.

How We Used AI

AI is used in three places:

  • Turning a user’s policy idea into a structured bill
  • Scoring lobbying messages from negative to positive persuasion
  • Generating short in-character politician responses

The persuasion score can be positive or negative, which means users can lose sway if they make a hostile, vague, or misaligned argument. This makes the lobbying phase more strategic and less like a guaranteed “AI says yes” button. The simulation follows a simple principle: [ \text{Final Vote} = f(\text{Ideology Alignment}, \text{Influence}, \text{Persuasion}, \text{Randomness}) ] The LLM provides interpretation, but the deterministic simulation engine owns the actual state changes and vote outcomes.

What We Learned

We learned that the hardest part of building an AI governance tool is not generating text. It is deciding what the AI should not control. Early versions made too much information editable or too directly exposed, such as ideological lean. We changed that so users can see the model’s interpretation but cannot manually tune the hidden political score. That made the experience feel more honest: the bill language should shape the simulation, not arbitrary slider manipulation. We also learned a lot about making AI interactions feel grounded. A lobbying chat is more useful when the politician starts by explaining their position, traits, and concerns. That gives the user something to respond to instead of forcing them to guess.

Challenges

The biggest challenge was balancing realism, clarity, and fun. Real politics is messy, but a hackathon prototype needs to be understandable within seconds. We had to simplify Congress into a fictional, probabilistic simulation while still making the user feel like their choices mattered. Another challenge was deciding how much power to give the model. We added strict guardrails so the LLM cannot directly decide votes or mutate persistent state. This avoids the simulation becoming a black box. We also had deployment and engineering challenges, including setting up CORS, deploying the Hono API through AWS/SST, and securely storing the OpenAI key as an SST secret instead of exposing it in frontend code or deploy commands.

What Could Go Wrong

A tool like this could accidentally imply that politics is simpler or more deterministic than it really is. To address that, PolyGen is framed as a narrative simulation, not a real-world prediction engine. There is also a risk that users could treat generated politicians as accurate representations of real people. The MVP defaults to fictional procedural politicians, and real member data is optional. If real data is used, the app still keeps final vote decisions in code rather than letting the model impersonate or predict real officials.

What We Would Build Next

With more time, we would add:

  • Better real-world member data loading
  • More transparent explanations for why each politician voted yes or no
  • Coalition-level lobbying strategies
  • Side-by-side comparison of different arguments
  • A classroom mode for civic education
  • More robust safeguards around real politician impersonation
  • Support for Claude as the primary model backend

PolyGen’s goal is to make democratic systems feel more accessible, interactive, and understandable. It helps users experiment with policy, persuasion, and political tradeoffs in a way that is visual, conversational, and safe.

Built With

Share this project:

Updates