Technical Specification

Socrates Platform

The Hub of AI β€” a universal marketplace and execution layer for AI tools, prompt apps, agents, models, and connectors. Built by anyone, scaled by the platform.

πŸ“„ Version 1.0 πŸ“… April 2026 πŸ” Confidential MVP Spec

1. Platform Overview

Socrates is a two-sided marketplace platform where:

Core Thesis Most AI marketplaces are link lists. Socrates differentiates by running everything natively: every tool executes inside the platform, every run produces ranking data, every fork generates attribution revenue. The platform gets smarter and more defensible the more it is used.

Core Primitives

PrimitiveDescriptionExamplesCreator Type
Prompt AppStatic or templated prompt with defined inputs/outputs. Simplest primitive.Essay Writer, Email Generator, TranslatorAnyone
Chat AgentPersistent conversational AI with memory, persona, and optional tools.D&D DM, Tutor Bot, Support AgentAnyone
Workflow AgentMulti-step autonomous executor. Can call tools, search web, write files.Research Agent, PR Writer, SEO AuditorAdvanced builders
Connector / ToolCallable function that integrates with an external API. Used by agents.Gmail Reader, Slack Notifier, Stripe LookupDevelopers
Model WrapperExposes a hosted or fine-tuned model via a clean API endpoint.MedGPT, Legal-LM, Domain-specific modelsML Engineers
DatasetStructured evaluation sets, training examples, or RAG corpora.Med benchmarks, law case sets, FAQ corporaResearchers

2. Architecture

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚ SOCRATES PLATFORM β”‚ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ FRONTEND (Next.js 15 / React 18) β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚ Marketplace β”‚ β”‚ Tool Runnerβ”‚ β”‚ Studio β”‚ β”‚ Dashboard β”‚ β”‚ (Discovery) β”‚ β”‚ (Execute) β”‚ β”‚ (Build) β”‚ β”‚ (Analytics)β”‚ β””β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”˜ β””β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”˜ β””β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”˜ β””β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”˜ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β”‚ API GATEWAY (Next.js API Routes + tRPC) β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚ β”‚ CORE SERVICES PLATFORM SERVICES β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚ Tool Service β”‚ β”‚ User/Auth β”‚ β”‚ Ranking β”‚ β”‚ (CRUD, ver.) β”‚ β”‚ Service β”‚ β”‚ Engine β”‚ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚ Run Service β”‚ β”‚ Billing β”‚ β”‚ Analytics β”‚ β”‚ (Execution) β”‚ β”‚ Service β”‚ β”‚ Pipeline β”‚ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚ Safety Layer β”‚ β”‚ Notif. β”‚ β”‚ Search β”‚ β”‚ (Scan/Block) β”‚ β”‚ Service β”‚ β”‚ (Elastic) β”‚ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β”‚ AI EXECUTION LAYER β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚ Sandboxed Runners β”‚ Model Router β”‚ Tool Orchestrator β”‚ β”‚ (per-run VMs) β”‚ (GPT/Claude/ β”‚ (LangChain/Custom) β”‚ β”‚ β”‚ Gemini/etc.) β”‚ β”‚ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β”‚ DATA LAYER β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚ PostgreSQL β”‚ β”‚ Redis β”‚ β”‚ S3/R2 β”‚ β”‚Elasticsearchβ”‚ β”‚ (primary) β”‚ β”‚ (cache/ β”‚ β”‚ (files, β”‚ β”‚(search + β”‚ β”‚ β”‚ β”‚ queues) β”‚ β”‚ outputs) β”‚ β”‚ analytics) β”‚ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

Tech Stack

LayerTechnologyWhy
FrontendNext.js 15, React 18, Tailwind CSS, shadcn/uiSSR for SEO, App Router for streaming, fast DX
APItRPC + Next.js API RoutesType-safe end-to-end, easy to extend
DatabasePostgreSQL via SupabaseRelational integrity, auth, real-time subscriptions
Cache / QueuesRedis (Upstash)Run queuing, rate limiting, session cache
File StorageCloudflare R2Cheap egress, S3-compatible, outputs + assets
SearchElasticsearch / TypesenseFull-text search across 48K+ tools with facets
AI ExecutionCustom orchestration layerRoute to GPT-4, Claude 3.5, Gemini, local models
AuthClerk or Supabase AuthOAuth (Google, GitHub), email/pass, SSO for enterprise
PaymentsStripe + Stripe ConnectSubscriptions, usage billing, builder payouts
AnalyticsPostHog (self-hosted) + custom pipelineProduct analytics + proprietary ranking signals
HostingVercel (frontend) + Railway/Fly.io (services)Fast deploys, global edge, autoscale
Execution SandboxFirecracker microVMs / E2BIsolated per-run execution for agents with tools

3. Data Models

Tool Schema

-- tools table (PostgreSQL)
CREATE TABLE tools (
  id            UUID        PRIMARY KEY DEFAULT gen_random_uuid(),
  slug          TEXT        UNIQUE NOT NULL,   -- url-friendly id
  creator_id    UUID        REFERENCES users(id),
  name          TEXT        NOT NULL,
  description   TEXT        NOT NULL,
  type          tool_type   NOT NULL,           -- enum
  category      TEXT        NOT NULL,
  tags          TEXT[],
  icon_emoji    TEXT,
  
  -- The actual tool definition
  system_prompt TEXT,                                -- for prompt apps / agents
  input_schema  JSONB       NOT NULL DEFAULT '[]', -- field definitions
  output_schema JSONB,                               -- expected output structure
  sample_output TEXT,
  model_config  JSONB,                               -- model, temp, max_tokens, etc.
  tool_calls    JSONB,                               -- for agents: callable connectors
  
  -- Versioning
  version       TEXT        NOT NULL DEFAULT '1.0.0',
  changelog     TEXT,
  forked_from   UUID        REFERENCES tools(id),
  
  -- Monetization
  price_model   price_type  NOT NULL DEFAULT 'free',
  price_amount  NUMERIC(10,2),
  stripe_price_id TEXT,
  
  -- Status
  status        tool_status NOT NULL DEFAULT 'pending_review',
  is_featured   BOOLEAN     DEFAULT false,
  
  -- Timestamps
  created_at    TIMESTAMPTZ DEFAULT now(),
  updated_at    TIMESTAMPTZ DEFAULT now()
);

CREATE TYPE tool_type    AS ENUM ('prompt_app', 'chat_agent', 'workflow_agent', 'connector', 'model_wrapper', 'dataset');
CREATE TYPE price_type   AS ENUM ('free', 'monthly', 'per_run', 'one_time');
CREATE TYPE tool_status  AS ENUM ('pending_review', 'live', 'suspended', 'draft');

Input Schema (JSONB array)

[
  {
    "id":          "topic",
    "label":       "Essay Topic",
    "type":        "text",        // text | textarea | select | number | file
    "placeholder": "e.g. The fall of Rome",
    "required":    true,
    "options":     null           // only for "select" type
  },
  {
    "id":          "length",
    "label":       "Length",
    "type":        "select",
    "options":     ["Short", "Medium", "Long"],
    "required":    true
  }
]

User Schema (abbreviated)

CREATE TABLE users (
  id              UUID    PRIMARY KEY,
  username        TEXT    UNIQUE NOT NULL,
  email           TEXT    UNIQUE NOT NULL,
  role            TEXT    DEFAULT 'user',     -- user | builder | verified_builder | admin
  stripe_account  TEXT,                           -- Stripe Connect account ID
  balance_cents   INT     DEFAULT 0,
  created_at      TIMESTAMPTZ DEFAULT now()
);

CREATE TABLE runs (
  id          UUID        PRIMARY KEY DEFAULT gen_random_uuid(),
  tool_id     UUID        REFERENCES tools(id),
  user_id     UUID        REFERENCES users(id),
  inputs      JSONB       NOT NULL,
  output      TEXT,
  model_used  TEXT,
  tokens_in   INT,
  tokens_out  INT,
  latency_ms  INT,
  rating      SMALLINT,  -- 1-5 star, user-provided
  thumbs      SMALLINT,  -- 1 = up, -1 = down
  re_ran      BOOLEAN    DEFAULT false,
  created_at  TIMESTAMPTZ DEFAULT now()
);

4. API Reference

All endpoints are RESTful JSON. Authentication via Bearer JWT. Rate limits apply per user tier.

Tools Endpoints

MethodEndpointAuthDescription
GET/api/toolsOptionalList tools. Supports ?category, ?type, ?sort, ?q, ?page.
GET/api/tools/:slugOptionalGet single tool details and input schema.
POST/api/toolsRequiredCreate a new tool draft. Returns tool ID.
PATCH/api/tools/:idOwnerUpdate tool. Bumps version if system_prompt or schema changes.
DELETE/api/tools/:idOwnerArchive tool (soft delete). Does not remove run history.
POST/api/tools/:id/publishOwnerSubmit for review. Status: draft β†’ pending_review.
POST/api/tools/:id/forkRequiredFork a tool. Sets forked_from = original ID.

Run Endpoint

This is the most critical endpoint. It accepts user inputs, routes to the correct model, executes the tool, streams the output, and records analytics.

// POST /api/tools/:slug/run
// Request
{
  "inputs": {
    "topic":  "The fall of the Roman Empire",
    "length": "Medium",
    "tone":   "Academic"
  },
  "stream": true
}

// Response (streaming SSE when stream: true)
event: chunk
data: {"delta": "The Roman Empire, at its height..."}

event: chunk
data: {"delta": "...commanded over 70 million subjects..."}

event: done
data: {
  "run_id":    "run_abc123",
  "tokens_in":  312,
  "tokens_out": 874,
  "latency_ms": 1840
}
Execution Flow 1. Validate inputs against tool's input_schema β†’ 2. Check user's subscription/credit balance β†’ 3. Render system prompt with input interpolation β†’ 4. Route to configured model (with fallback) β†’ 5. Stream response β†’ 6. Write run record β†’ 7. Trigger analytics event β†’ 8. Charge if pay-per-run

SDK & CLI

TypeScript/JavaScript SDK and a CLI for publishing tools and pulling run history are planned to wrap these REST endpoints with auth refresh and typed models. Track progress in the roadmap (Phase 4).

5. Pages & Flows

Marketplace Page /explore

Publish Flow /studio/new

  1. Step 1 β€” Type Selection: Pick primitive (Prompt App / Agent / Chat / Model / Connector / Dataset)
  2. Step 2 β€” Details: Name (60 chars), description (200 chars), category, tags, icon emoji
  3. Step 3 β€” Inputs & Prompt: Visual input field builder + system prompt editor with variable interpolation ({{variable}})
  4. Step 4 β€” Test & Price: Live test against the real model + pricing model (free / monthly / per-run)
  5. Step 5 β€” Review & Publish: Terms acceptance β†’ submit for review (auto + human queue)

Run Flow /tools/:slug/run

6. Monetization

Revenue Models

ModelHow it worksPlatform cutBuilder gets
FreeNo charge. Platform subsidizes execution cost for marketing/retention.β€”β€”
Monthly SubscriptionUser pays $X/month via Stripe. Unlimited runs within limits.20%80%
Pay-per-RunUser pays $X per execution. Charged to Socrates Credits balance.20%80%
One-Time PurchasePermanent access to a tool for a single payment.20%80%
Enterprise LicensePrivate org deployment. Platform negotiates and manages.25%75%
Fork AttributionWhen a forked tool earns revenue, 8% flows to the original creator.β€”8% upstream

Socrates Credits

Users maintain a credit balance (like Roblox Robux). Credits are spent on per-run tools and can be purchased in bundles. This decouples payment from individual micro-transactions and reduces friction.

Builder Payouts

7. Safety & Trust

Non-Negotiable Safety infrastructure must be in place before any public launch. Without it, one viral bad-actor tool destroys the platform's reputation permanently.

Automated Checks (at publish time)

Human Review Queue

Runtime Safety

8. Analytics System

The analytics system is a core competitive moat. It produces signals that power ranking, helps builders improve their tools, and creates data network effects as usage grows.

Events Captured (per run)

{
  "event":       "tool_run",
  "tool_id":     "uuid",
  "user_id":     "uuid | null",
  "session_id":  "uuid",
  "latency_ms":  1840,
  "tokens_in":   312,
  "tokens_out":  874,
  "thumbs":      1,        // 1=up, -1=down, 0=none
  "re_ran":      false,    // did user run this tool again within session?
  "copied":      true,     // did user copy the output?
  "forked":      false,
  "source":      "trending",// how they found it
  "category":    "writing",
  "timestamp":   "ISO8601"
}

Builder Dashboard Metrics

9. Ranking Algorithm

Trending score is recalculated every 15 minutes. It rewards tools that users actually find valuable β€” not just ones with the most raw clicks.

TrendingScore = ( RecencyWeight Γ— log(runs_last_48h + 1) + QualityWeight Γ— (thumbs_up_rate Γ— 0.4 + re_run_rate Γ— 0.35 + copy_rate Γ— 0.25) + GrowthWeight Γ— (runs_today / avg_runs_last_7d) + RatingWeight Γ— normalize(avg_rating, 0, 5) βˆ’ PenaltyWeight Γ— report_rate ) Where: RecencyWeight = 1.0 (most important β€” recency keeps things fresh) QualityWeight = 2.5 (highest β€” quality over volume) GrowthWeight = 0.8 (momentum matters) RatingWeight = 0.6 (lagging indicator, weighted lower) PenaltyWeight = 5.0 (strong deterrent for safety violations)
Anti-Gaming The algorithm is designed so the only way to rank high is to build a genuinely useful tool. Raw clicks and self-promotion do not help. Quality signals (re-run rate, copy rate, thumbs) are weighted highest because they are hardest to fake.

10. Roadmap

1
Months 1–2 Β· Foundation
MVP: Marketplace + Run + Publish
βœ“ Auth (Clerk) + user profiles
βœ“ Tool CRUD + 5-step publish flow
βœ“ In-browser tool runner (Prompt Apps only)
βœ“ Basic marketplace (browse + search)
βœ“ Safety: automated scan + human review queue
βœ“ Basic analytics (runs, unique users, thumbs)
βœ“ Free tools only at this stage
2
Months 3–4 Β· Monetization + Chat Agents
Revenue + Engagement
βœ“ Stripe Connect: subscriptions + credits system
βœ“ Builder payouts + earnings dashboard
βœ“ Chat Agent support (persistent conversation, memory)
βœ“ Fork + remix + attribution revenue
βœ“ Full builder analytics dashboard
βœ“ Trending algorithm v1
βœ“ Collections (save tools to playlists)
3
Months 5–7 Β· Agents + Connectors
Power Users + Ecosystem
βœ“ Workflow Agents (multi-step, tool-calling)
βœ“ Connector marketplace (Slack, Gmail, Notion, etc.)
βœ“ Sandboxed execution (Firecracker/E2B)
βœ“ Agent-to-agent calling (agents import other tools)
βœ“ API access for builders (external integrations)
βœ“ Verified Builder program
βœ“ AI Insights recommendations for builders
4
Months 8–12 Β· Models + Enterprise
Full Platform
βœ“ Model Wrapper support (hosted fine-tuned models)
βœ“ Dataset marketplace
βœ“ Enterprise: private org deployments
βœ“ White-label Socrates for companies
βœ“ SDK + CLI for developer builders
βœ“ Advanced ranking (personalized, not just trending)
βœ“ Builder program: grants, spotlight, conferences
Launch Strategy Start with an invite-only builder beta (50–100 builders, hand-selected for quality). Let them publish 500+ tools before opening to the public. Launch publicly with "500 AI tools on day one" as the hook. This avoids the cold-start problem and ensures quality from the start β€” exactly what Roblox did by partnering with game developers before launch.