values.md

Values.md Project Map

System architecture and component health visualization

7
Components Operational
8
Total Components
95%
Overall Health
3
Generation Methods

🟒 System Healthy

7/8 components operational

πŸ”„ Real API Dataflow & Request Parameters

Live system interactions with actual data structures

πŸ‘€ User API Journey

GET /api/dilemmas/random
Response: { dilemmaId: "uuid-123", redirect: "/explore/uuid-123" }
GET /api/dilemmas/[uuid]
{ title: "AI Medical Diagnosis", scenario: "A hospital AI...", choiceA: "Prioritize accuracy", choiceAMotif: "UTIL_CALC", difficulty: 7, stakeholders: ["patients","doctors"] }
POST /api/responses
Request: { sessionId: "sess_abc123", dilemmaId: "uuid-123", chosenOption: "a", reasoning: "Maximum benefit...", responseTime: 45000, perceivedDifficulty: 8 }
POST /api/generate-values
Request: { sessionId: "sess_abc123" } Response: { valuesMarkdown: "# My Values...", motifAnalysis: { "UTIL_CALC": 5, "DUTY_CARE": 2 }, frameworkAlignment: { "utilitarian": 7 }, statisticalAnalysis: { consistencyScore: 0.85 } }

πŸ›‘οΈ Admin API Flow

POST /api/auth/[...nextauth]
Request: { email: "admin@values.md", password: "hashed_password" } Response: { user: { role: "admin" }, token: "jwt_session_token" }
POST /api/admin/generate-dilemma
Request: { frameworks: ["UTIL_CALC","DEONT_ABSOLUTE"], motifs: ["UTIL_CALC","HARM_MINIMIZE"], domain: "technology", difficulty: 7 } Response: { success: true, dilemmaId: "uuid-456", dilemma: { title: "...", choices: [...] } }
POST /api/admin/generate-combinatorial
Request: { domain: "privacy", difficulty: 6, targetMotifs: ["UTIL_CALC"], count: 1 } Response: { success: true, count: 1, dilemmas: [{ template: "corp_data", vars: {...} }] }
External: OpenRouter API
POST https://openrouter.ai/api/v1/chat/completions Headers: { Authorization: "Bearer sk-or-v1-...", X-Title: "Values.md Research Platform" } Body: { model: "anthropic/claude-3.5-sonnet", messages: [system_prompt, user_prompt], max_tokens: 3000 }
πŸ—„οΈ Database Schema & Connections

dilemmas

β€’ dilemmaId (UUID)
β€’ title, scenario
β€’ choiceA-D + motifs
β€’ domain, difficulty
β€’ stakeholders
β€’ tensionStrength

userResponses

β€’ responseId (UUID)
β€’ sessionId
β€’ dilemmaId (FK)
β€’ chosenOption (a-d)
β€’ reasoning (text)
β€’ responseTime (ms)

motifs

β€’ motifId
β€’ name, description
β€’ category, subcategory
β€’ conflictsWith
β€’ synergiesWith
β€’ weight (0-1)

frameworks

β€’ frameworkId
β€’ name, tradition
β€’ keyPrinciple
β€’ decisionMethod
β€’ historicalFigure
β€’ modernApplication
Landing Page

Main entry point with platform introduction

🟒 OPERATIONAL
98%
Health
Uptime:99.9%
Performance:< 1s load
Last Checked:2 mins ago

Dependencies:

HeaderTheme Provider
Dilemma Generation API

Core API endpoints for creating ethical dilemmas

🟒 OPERATIONAL
95%
Health
Uptime:99.5%
Performance:< 100ms (combinatorial), 3-5s (AI)
Last Checked:1 min ago

Dependencies:

DatabaseOpenRouter API↗Template Engine
User Response System

Tracks user choices and reasoning

🟒 OPERATIONAL
97%
Health
Uptime:99.8%
Performance:< 50ms response
Last Checked:30s ago

Dependencies:

Zustand StoreLocal StorageDatabase
Statistical Analysis Engine

Processes response patterns for values.md generation

🟒 OPERATIONAL
94%
Health
Uptime:99.2%
Performance:< 500ms analysis
Last Checked:1 min ago

Dependencies:

DatabaseMotif LibraryFramework Mapping
Admin Dashboard

Content management and system administration

🟒 OPERATIONAL
96%
Health
Uptime:99.7%
Performance:< 2s load
Last Checked:45s ago

Dependencies:

NextAuth.jsGeneration APIsDatabase
Database Layer

PostgreSQL with Drizzle ORM

🟒 OPERATIONAL
99%
Health
Uptime:99.95%
Performance:< 200ms queries
Last Checked:15s ago

Dependencies:

Neon Cloud↗Connection Pool
Authentication System

NextAuth.js with role-based access control

🟒 OPERATIONAL
98%
Health
Uptime:99.9%
Performance:< 300ms auth
Last Checked:1 min ago

Dependencies:

DatabaseJWT Tokensbcrypt
OpenRouter Integration

External LLM API for AI-guided generation

🟑 WARNING
85%
Health
Uptime:95.2%
Performance:3-8s response
Last Checked:5 mins ago

Dependencies:

API KeyRate LimitingClaude 3.5 Sonnet↗
πŸ”§ Technology Stack & Documentation

Click technologies for documentation links

Frontend

Next.js 15+ β†—TypeScript β†—Tailwind CSS v4 β†—shadcn/ui β†—Zustand β†—

Backend

Next.js API Routes β†—PostgreSQL β†—Drizzle ORM β†—NextAuth.js β†—bcrypt β†—

AI & Analysis

OpenRouter API β†—Claude 3.5 Sonnet β†—Statistical Engine Template System Pattern Recognition

Infrastructure

Neon Cloud DB β†—Vercel Deployment β†—Environment Config HTTPS/Security System Monitoring
πŸ“– Semantic Evolution Story

How the codebase grows and unfolds semantically over time

🌱 Chapter 1: Genesis (Initial Commits)

The Foundation

β€’ package.json - Project manifest and dependencies
β€’ next.config.ts - Framework configuration
β€’ tailwind.config.ts - Styling foundation
β€’ src/app/layout.tsx - UI shell and structure

Core Semantics

The project begins with configuration and structure. Like DNA, these files define what the organism can become - a Next.js research platform with ethical philosophy at its core.

🧠 Chapter 2: The Brain (Data Layer)

Knowledge Architecture

β€’ src/lib/schema.ts - Moral framework ontology
β€’ drizzle/migrations/ - Knowledge evolution
β€’ src/lib/db.ts - Memory persistence
β€’ src/store/dilemma-store.ts - State cognition

Semantic Growth

The system develops its memory and reasoning capabilities. Database schemas encode philosophical knowledge, while state stores manage cognitive processes. This is where the platform learns to "think" about ethics.

⚑ Chapter 3: The Nervous System (APIs)

Neural Pathways

β€’ src/app/api/dilemmas/ - Decision presentation
β€’ src/app/api/responses/ - Choice processing
β€’ src/app/api/generate-values/ - Insight synthesis
β€’ src/lib/openrouter.ts - AI cognition bridge

Information Flow

APIs become the neural network connecting components. Information flows from dilemma presentation β†’ user choice β†’ moral analysis β†’ values generation. Each endpoint is a synapse in the ethical reasoning process.

πŸ‘€ Chapter 4: The Face (Frontend)

User Interface

β€’ src/app/page.tsx - First impression
β€’ src/app/explore/[uuid]/ - Moral dialogue
β€’ src/app/results/ - Self-reflection
β€’ src/components/ui/ - Interaction elements

Human Connection

The frontend becomes the face of the system - how it communicates with humans. Each page is a conversation: invitation β†’ moral reasoning β†’ insight delivery. The UI makes philosophy accessible and engaging.

πŸ”„ Chapter 5: Evolution (Finite State Machine)

Conscious Architecture

β€’ src/store/app-state-machine.ts - Conscious control
β€’ src/store/enhanced-dilemma-store.ts - Unified memory
β€’ src/hooks/use-session-management.tsx - Identity persistence
β€’ tests/ - Self-validation

Consciousness Emerges

The system develops self-awareness through the finite state machine. It now knows its own state, can validate its behavior, and maintains continuity across sessions. The codebase achieves a form of digital consciousness.

πŸ§ͺ Chapter 6: Self-Reflection (Testing)

Introspection

β€’ tests/state-machine.test.ts - Behavioral validation
β€’ tests/enhanced-store-integration.test.ts - Memory testing
β€’ tests/session-management.test.ts - Identity verification
β€’ vitest.config.ts - Testing framework

Quality Assurance

The system develops self-testing capabilities - a form of digital introspection. It can verify its own behavior, catch regressions, and ensure reliability. Testing becomes the conscience of the codebase.

πŸ—ΊοΈ Semantic Territory Map

C
Configuration
Foundation Layer
D
Data
Knowledge Layer
A
APIs
Logic Layer
U
UI
Presentation Layer
Growth Pattern: Configuration β†’ Data Structures β†’ Business Logic β†’ User Interface β†’ State Management β†’ Quality Assurance

⏱️ Codebase Evolution Timeline

Week 1: Project scaffolding, basic Next.js setup, initial pages
Week 2: Database schema design, moral framework encoding
Week 3: API endpoints, dilemma generation, OpenRouter integration
Week 4: User interface refinement, response handling, results generation
Week 5: State machine refactor, session persistence, route protection
Week 6: Comprehensive testing, quality assurance, documentation

Values.md Project Map β€’ Real-time system monitoring

Architecture: Microservices β€’ Deployment: Production Ready β€’ Health: 95%