# Idiomark-Fun V0: White Paper

**Date:** 2026-02-14
**Version:** 0.1.0
**Status:** Published

---

## Executive Summary

Idiomark-Fun V0 is a lightweight, stateless web application that generates personality profiles from public GitHub and Twitter data. Designed as a viral on-ramp to the Personal Context Protocol (Idiomark) ecosystem, it provides immediate value through Silly Tavern-compatible character card exports while showcasing the power of the underlying Idiomark infrastructure.

**Key characteristics:**
- **Minting tool, not platform** - Users create profiles and leave (no accounts, no persistence)
- **Public data only** - Ethical extraction from publicly available sources
- **Multi-format export** - Silly Tavern cards, Idiomark files, system prompts, markdown summaries
- **Fun layer** - Playful "roast me" insights and personality facts drive engagement
- **Stateless architecture** - No database, ephemeral rate limiting, serverless deployment

---

## Problem Statement

### The Challenge

The Personal Context Protocol (Idiomark) represents a powerful, extensible format for capturing and sharing personality profiles. However, several barriers exist to mainstream adoption:

1. **Complexity perception** - Technical protocols feel intimidating to casual users
2. **Lack of immediate value** - "Install this CLI tool" has weak virality
3. **No social proof** - Users can't easily show results to friends
4. **Missing fun factor** - Serious documentation doesn't drive organic sharing

### The Opportunity

AI enthusiasts and techies enjoy personality analysis tools (e.g., "roast me" trends, viral Twitter threads). A lightweight, fun experience that:
- Works in 30 seconds
- Delivers immediately shareable results
- Integrates with existing AI tools (Silly Tavern, Cursor, VS Code)
- Requires zero setup or account creation

...would serve as an ideal **gateway drug** to the broader Idiomark ecosystem.

---

## Design Philosophy

### Core Principles

**1. Mint, Don't Hoard**

We are not building a platform. We are building a **minting machine** for Idiomark files. Users arrive, generate a profile, download the file, and leave. No persistence, no social features, no reason to return except to mint another profile.

**2. Public Data Only**

All personality extraction comes from publicly available data:
- **GitHub:** Public repositories, commits, issues, pull requests, discussions
- **Twitter:** Public tweets and replies

No private data is accessed. No API keys required from users. Clear disclosure at all times.

**3. Stateless by Default**

The application has no concept of user accounts:
- No database of profiles
- No authentication beyond rate limiting
- No session management
- Share URLs expire after 24 hours (ephemeral storage only)

**4. Fun First, Technical Second**

The "fun" layer isn't an afterthought - it's the primary product:
- Roasts are pattern-based but feel personalized
- Fun facts derive from real statistical anomalies
- "Spiciness meter" provides instant personality assessment
- Visuals are playful (animations, emoji, gradients)

This drives virality while the technical implementation demonstrates Idiomark's capabilities.

**5. Export Portability**

Users shouldn't be locked into our format. Every export format is designed to work elsewhere:
- **Silly Tavern cards** - Full V2/V3 spec compliance with `extensions.idiomark` namespace
- **System prompts** - Paste into Cursor, VS Code, any LLM interface
- **Idiomark files** - Standard protocol format for future tools
- **Markdown** - GitHub README compatible, shareable anywhere

---

## Technical Architecture

### System Overview

```
┌─────────────────────────────────────────────────────────────────┐
│                     User Browser                          │
├─────────────────────────────────────────────────────────────────┤
│                                                            │
│  ┌──────────────┐  POST /api/mint              │
│  │                   │                              │
│  │         ┌────────┴──────────────────┐       │
│  └────┬─────┤ Serverless Edge Function      │
│                 │                                    │
│                 │  ┌──────────────────────────┐      │
│                 │         │                   │      │
│                 │    ┌────────────────┐   │      │
│                 │    │ Idiomark Core &        │      │
│                 │    │ Adapters           │      │
│                 │    └──────────────────┘      │
│                 │                             │      │
│                 └─────────────┬──────────────┘   │
│                                            │      │
└───────────────────────┬────────────────┴──────┘
                    │
                    ▼
           ┌─────────────────────────────────┐
           │  Idiomark File + Exports │
           └─────────────────────────────────┘
                    │
    ┌──────────────┬───────────┐
    │ Silly Tavern │ AI Tools │ Social |
    └──────────────┬───────────┘
```

### Component Architecture

#### Frontend (`@idiomark/fun-web`)

**Framework:** Next.js 14 (App Router)
**Styling:** Tailwind CSS + shadcn/ui components
**Animations:** Framer Motion
**Deployment:** Vercel Edge (iad1 region)

**Components:**
- `MintForm` - Source selection (GitHub/Twitter) + query input
- `LoadingState` - Animated spinner with rotating messages
- `ResultDisplay` - Tabbed export interface with roast, facts, downloads
- `PersonalityRadar` - Canvas-based radar chart visualization

**Data Flow:**
1. User submits form → POST to `/api/mint`
2. API returns personality data → Store in `localStorage`
3. Redirect to `/result/[id]` → Retrieve from localStorage
4. Display results with export options

No server-side session storage. Results live in browser memory only.

#### Backend (`@idiomark/fun-api`)

**Framework:** Next.js Route Handlers
**Runtime:** Vercel Edge Functions
**Rate Limiting:** In-memory Map (development), Upstash Redis (production)
**LLM Provider:** Mock (development), Anthropic/OpenAI (production)

**API Endpoint:** `POST /api/mint`

**Request Schema:**
```typescript
{
  source: "github" | "twitter",
  query: string,
  options?: {
    limit?: number,        // Default: 100
    includeReplies?: boolean
  }
}
```

**Response Schema:**
```typescript
{
  success: boolean,
  data?: {
    personality: IdiomarkFile,           // Full Idiomark personality object
    metadata: {
      samples_analyzed: number,
      sources: string[],
      generated_at: ISO8601,
      confidence: number
    },
    fun: {
      roast: string,                // Playful insult
      facts: string[],             // Fun insights
      spiciness: number            // 0-100 scale
    },
    exports: {
      tavern_card: TavernCardV2,    // Primary format
      idiomark_file: IdiomarkFile,           // Protocol format
      system_prompt: string,          // For Cursor/etc.
      markdown: string                // README format
    }
  },
  error?: {
    code: "RATE_LIMITED" | "INVALID_REQUEST" | "EXTRACTION_FAILED",
    message: string,
    retry_after?: number            // Seconds until retry
  }
}
```

#### Fun Layer Generators

**Roast Generation** (`lib/roasts.ts`)

Pattern-based matching on personality traits:
- **Low formality (<0.3)** → Casual/shorts jokes
- **High formality (>0.7)** → Formal/stiff jokes
- **High emoji usage** → "Is this a commit or a rave?"
- **High sarcasm (>0.7)** → "Your commits have negative sincerity"
- **Excessive caps** → "YOUR CODE IS SO LOUD!!!"

Spiciness calculation:
```typescript
score = 50  // Base
+20 if casual          -10 if formal
+15 if humorous        +25 if sarcastic
+20 if emoji-heavy    +10 if exclamations
+15 if all-caps
→ Clamped to 0-100
```

**Fun Facts Generation** (`lib/fun-facts.ts`)

Statistical anomaly detection:
```typescript
// Friday obsession
if (fridayCommits > avgCommits * 1.3)
  → "Commits 40% more on Fridays (TGIF?)"

// Efficiency legend?
if (shortestCommit < 15 chars)
  → "Shortest commit: 8 chars. Legend or lazy?"

// Emoji addiction
if (topEmojiCount > totalCommits * 0.5)
  → "Uses 🔥 52 times. It's fine. Everything's fine."

// Polyglot cred
if (languages.length > 5)
  → "Fluent in 9 languages. Jack of all trades, master of none?"
```

#### Export Formatters

**Silly Tavern Card** (`lib/exporters/tavern-card.ts`)

```typescript
{
  spec: "chara_card_v2",
  spec_version: "2.0",
  data: {
    name: "username",
    description: "Uses 🔥 way too much • Idiomark profile",
    personality: "casual coder",
    first_mes: "Hey! I'm username, ready to pair program.",
    extensions: {
      idiomark: {                          // ← Idiomark namespace
        idiomark: "1.0.0",
        personality: { /* Full Idiomark object */ },
        metadata: {
          generated_at: "2026-02-14T...",
          source: "github",
          fun_version: "0.1.0"
        }
      }
    }
  }
}
```

**Key design decision:** The `extensions` field is mandatory in V2/V3 spec and explicitly designed for app-specific data. By namespacing under `idiomark`, we prevent conflicts while ensuring full Idiomark data travels with the card.

**System Prompt** (`lib/exporters/system-prompt.ts`)

LLM-formatted personality injection:
```
You are an AI coding assistant with the following personality profile:

VOICE & TONE
- Primary tone: casual
- Formality: 0.2/1.0 (casual)
- Humor: 0.6/1.0 (humorous)
- Sarcasm: 0.3/1.0
- Enthusiasm: 0.7/1.0
- Directness: 0.5/1.0

COMMUNICATION PATTERNS
- Sentence length: 8 words (avg)
- Emoji usage: high
- Punctuation: 0.4 exclamations per sentence

[... domains, values, knowledge base ...]

When generating code:
1. Match tone and personality described above
2. Use similar sentence structures and emoji usage
3. Reflect values and communication style
4. Draw from domains and knowledge areas listed
```

This enables users to paste into Cursor, VS Code extensions, or any LLM interface to get "themselves as an AI pair programmer."

---

## Data Flow & Privacy

### Extraction Pipeline

```
Public Data Source
     │
     ▼
┌─────────────────┐
│  Platform Adapter  │ (GitHubAdapter / TwitterAdapter)
└────────┬─────────┘
     │
     ▼
┌─────────────────┐
│  PersonalityAnalyzer │ (Idiomark Core)
└────────┬─────────┘
     │
     ▼
┌─────────────────┐
│  Raw Content       │ [{ id, text, timestamp, platform }]
└────────┬─────────┘
     │
     ▼
┌─────────────────┐
│  Fun Layer        │ Roast + Facts + Spiciness
└────────┬─────────┘
     │
     ▼
┌─────────────────┐
│  Export Formatters │ (4 formats)
└────────┬─────────┘
     │
     ▼
  [ Browser Download ]
```

### Rate Limiting Strategy

**In-memory store** (development):
```typescript
class MemoryRateLimitStore {
  private store = Map<string, { count, resetTime }>

  async increment(key: string) {
    const entry = this.store.get(key) || { count: 0, resetTime: now + 60000 }
    entry.count++
    this.store.set(key, entry)
    return entry.count
  }
}
```

**Production recommendation:** Upstash Redis with 5-minute TTL per IP address.

**Limits:**
- 10 requests per minute per IP
- Rate limit error includes `retry_after` seconds
- No burst allowance (prevents abuse)

### Privacy Guarantees

**We DO NOT store:**
- ❌ Generated personality profiles
- ❌ User queries (what usernames were searched)
- ❌ IP addresses beyond rate limit window (5 min TTL)
- ❌ Any correlation between requests

**We DO store:**
- ✅ Rate limit counters (ephemeral, IP-based only)
- ✅ Share URL payloads (encrypted, 24-hour expiry)

**Public data disclosure:**
Clear messaging on home page:
- "No account" badge
- "No tracking" badge
- "Public data only" badge
- FAQ section explaining data sources

---

## Integration Points

### Silly Tavern

**Format:** Character Card V2/V3 via `extensions.idiomark`
**Compatibility:** 100% - works in all modern Tavern clients
**User flow:** Download card → Import card → Full Idiomark data in extensions field
**Namespacing:** `extensions.idiomark.*` prevents conflicts

### Cursor / VS Code Extensions

**Format:** Plain text system prompt
**Compatibility:** Any LLM interface accepting custom instructions
**User flow:** Copy prompt → Paste into settings → AI models your personality
**Advantage:** Immediate utility without file import

### Future Idiomark Tools

**Format:** Standard Idiomark 1.0.0 JSON file
**Compatibility:** Any future tool implementing Idiomark spec
**User flow:** Download Idiomark file → Import into future tool
**Extensibility:** Full personality object with metadata

### Social Sharing

**Format:** Markdown summary with emoji-styled sections
**Compatibility:** GitHub READMEs, social media, forums
**User flow:** Copy markdown → Paste anywhere → Visual profile
**Virality:** Easy to share screenshots/text for "roast me" engagement

---

## Implementation Status

### Completed (V0)

✅ **Infrastructure**
- Monorepo structure (`@idiomark/fun-web`, `@idiomark/fun-api`)
- Next.js 14 with App Router
- shadcn/ui component library
- Framer Motion animations
- Vercel deployment configuration

✅ **API**
- `/api/mint` endpoint with rate limiting
- GitHub adapter integration
- PersonalityAnalyzer with mock provider
- Fun layer generators (6 roast patterns, 5 fact generators)
- 4 export formatters (Tavern, Idiomark, system prompt, markdown)

✅ **Frontend**
- Mint form (GitHub/Twitter source selection)
- Loading animations with rotating messages
- Result display with tabbed exports
- Personality radar chart visualization
- Framer Motion entrance animations

✅ **Testing**
- 75+ tests across API, generators, and formatters
- Rate limiter test coverage
- Roast pattern coverage for all personality types

### Deferred (V1+)

❌ **Twitter adapter** - Requires OAuth implementation
❌ **Comparison feature** - Side-by-side personality comparison
❌ **Leaderboards** - Most extreme personalities by trait
❌ **Persistent profiles** - User accounts and history
❌ **Real LLM integration** - Currently mock provider
❌ **PNG metadata** - Character data embedded in download
❌ **Reddit source** - Public post/comment extraction
❌ **"Roast my code" community** - Social features around fun layer

---

## Success Metrics

### V0 Goals

| Metric | Target | Measurement Method |
|--------|---------|-------------------|
| Completion rate | >80% | (successful generations / total API calls) |
| Share rate | >30% | (exports with downloads / total generations) |
| Tavern downloads | >50% | (Tavern card format / all downloads) |
| Time to mint | <45 seconds | (average extraction time) |
| Return visits | >10% | ("Create another" clicks / total visits) |

### Viral Indicators

- Social media shares (Twitter, Reddit, Discord)
- "Roast me" threads referencing Idiomark-Fun
- Silly Tavern community adoption
- GitHub stars on repository

---

## Future Roadmap

### V0.X (Iterative Improvements)

**Short-term** (post-launch):
- A/B test roast messages for quality
- Add more roast patterns (current: 6)
- Implement actual LLM calls (replace mock)
- Fix visual bugs reported by users
- Add PNG export with embedded metadata
- Optimie mobile experience

### V1 (Platform Features)

**Mid-term** (after V0 proves value):
- User accounts with profile history
- Comparison tool ("my personality vs yours")
- Leaderboards (most sarcastic, most formal, etc.)
- Twitter source integration
- Reddit source integration
- Real-time extraction progress

### V2 (Ecosystem Expansion)

**Long-term** (when ecosystem matures):
- Native mobile apps (iOS/Android)
- Desktop apps (Electron/Tauri)
- Browser extension (one-click personality from GitHub profile)
- VS Code extension (personalized code review)
- Cursor integration (native, not copy-paste)
- Idiomark protocol enhancements (learn from usage)

---

## Conclusion

Idiomark-Fun V0 represents a **minimal viable product** designed to address Idiomark adoption barriers through:

1. **Lowering friction** - 30-second experience, no accounts
2. **Creating value** - Multiple export formats for immediate utility
3. **Driving engagement** - Fun layer inspires organic sharing
4. **Showcasing tech** - Silly Tavern integration demonstrates Idiomark power

By prioritizing **the file over the service**, we build toward a future where Idiomark files flow freely between tools while V0 serves as the friendly, accessible entry point.

**The product is the Idiomark file. We're just the mint.**

---

**Document Version:** 0.1.0
**Last Updated:** 2026-02-14
**Authors:** Idiomark Contributors
**License:** MIT
