惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

I
InfoQ
博客园_首页
美团技术团队
M
MIT News - Artificial intelligence
人人都是产品经理
人人都是产品经理
Blog — PlanetScale
Blog — PlanetScale
H
Help Net Security
J
Java Code Geeks
T
Tailwind CSS Blog
Jina AI
Jina AI
量子位
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
G
Google Developers Blog
爱范儿
爱范儿
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
宝玉的分享
宝玉的分享
小众软件
小众软件
MongoDB | Blog
MongoDB | Blog
博客园 - 三生石上(FineUI控件)
L
LangChain Blog
酷 壳 – CoolShell
酷 壳 – CoolShell
V
Visual Studio Blog
博客园 - Franky
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知

Hacker News - Newest: "AI"

AI can't read an investor deck AI as an attorney? Student uses ChatGPT, Gemini to sue UW over alleged racial discrimination Hacking MCP Servers in AI Systems – The Rug Pull: Tool Changes After Approval GitHub - MeepCastana/KubeezCut: Free Web based video editor Can AI judge journalism? A Thiel-backed startup says yes, even if it risks chilling whistleblowers Coming soon: 10 Things That Matter in AI Right Now DARPA built an AI to fact-check enemy weapons claims What explains heterogeneity in AI adoption? When AI Meets Muscle: Context-Aware Electrical Stimulation Promises a New Way to Guide Human Movements - Department of Computer Science AI Changed How We Build. It Did Not Change What Matters. Linux rules on using AI-generated code - Copilot is OK, but humans must take 'full responsibility for the… Meta spins up AI version of Mark Zuckerberg to engage with employees Code Mode: Let Your AI Write Programs, Not Just Call Tools | TanStack Blog GitHub - Delavalom/graft: Go framework for building AI agents. Type-safe tools, multi-provider (OpenAI, Anthropic, Gemini, Bedrock), zero vendor SDKs. India's TCS tops estimates, says new AI models did not dent services demand Gen Z's fading AI hype Strong feeling: we are in a folded AI reality GitHub - machinarii/total-recall-catalog: A reference catalog of latest knowledge retrieval, memory & RAG systems GitHub - mensfeld/code-on-incus: Give each AI agent its own isolated machine with root, Docker, and systemd. Active defense detects and stops threats automatically.. Quantization, LoRA, and the 8% Problem: Benchmarking Local LLMs for Production AI Iran war: We spoke to the man making Lego-style AI videos that experts say are powerful propaganda Powell, Bessent discussed Anthropic's Mythos AI cyber threat with major U.S. banks GitHub - immartian/bellamem: Persistent belief-graph memory for AI agents. Retrieves decisive context by importance — not recency, not RAG, not /compact. recursive-mode: The Repo-Native Operating System for AI Engineering After the attack on Sam Altman's home, will AI CEO's go on the offensive? The biggest advance in AI since the LLM Opus 4.6 vs GPT 5.4 One Prompt Unity World Generation Test “AI polls” are fake polls Client Challenge Can AI be a 'child of God'? Inside Anthropic's meeting with Christian leaders
GitHub - arzumanabbasov/claw-learn: AI-powered visual mat...
Arzuman · 2026-05-30 · via Hacker News - Newest: "AI"

Talk to it. Watch it teach.

Claw Learn is an AI-powered visual math tutor with a real-time voice interface — powered by the ElevenLabs Speech Engine. Ask any math or physics question by voice or text, and watch a synchronized animated explanation generate live in the browser.

License: MIT Next.js TypeScript Speech Engine by ElevenLabs

Live Demo · Report a Bug · Request a Feature


Watch the video

What is Claw Learn?

Claw Learn combines the ElevenLabs Speech Engine with an AI scene planner and a custom canvas renderer to turn math questions into live animated explanations with synchronized narration.

The Speech Engine is the core of the experience — it handles both voice input and audio output over WebRTC, so you can speak your question, interrupt mid-explanation, and ask follow-ups without ever touching a keyboard. When the Speech Engine isn't configured, the app falls back to REST TTS and browser-based speech recognition.

No slides. No textbooks. No pre-recorded videos. Every explanation is generated fresh for your exact question.

You:  "Why does the derivative represent slope?"

App:  → ElevenLabs Speech Engine captures your voice over WebRTC
      → AI generates a 10-scene visual teaching plan
      → Canvas renders: axes, parabola, tangent line, slope formula
      → Speech Engine narrates each scene in sync with the animation
      → Interrupt at any time to ask a follow-up — just speak

Demo

Add a GIF or screenshot here

Try these questions:

  • "How does matrix multiplication work?"
  • "Explain the Fourier transform visually"
  • "What is integration and why does it find area?"
  • "Show me Euler's formula e^(iπ) + 1 = 0"
  • "How does gravity create orbits?"

Tech Stack

Layer Technology
Framework Next.js 16 (App Router, Turbopack)
UI React 19, Tailwind CSS v4, Framer Motion
AI Any OpenAI-compatible API (Gemini, OpenAI, Ollama, etc.)
Voice I/O ElevenLabs Speech Engine (WebRTC)
TTS fallback ElevenLabs REST API
STT fallback Web Speech API
Animations Custom 2D Canvas renderer
Language TypeScript 5
Deployment Vercel

Getting Started

Prerequisites

1. Clone and install

git clone https://github.com/arzumanabbasov/claw-learn.git
cd claw-learn
npm install

2. Configure environment variables

cp .env.local.example .env.local

Open .env.local and fill in your keys:

# ── AI Provider (required) ────────────────────────────────────────────────────
OPENAI_API_KEY=your_api_key_here
OPENAI_BASE_URL=https://generativelanguage.googleapis.com/v1beta/openai
OPENAI_MODEL=gemini-2.5-flash

# ── Auth (required) ───────────────────────────────────────────────────────────
# Generate a secret: openssl rand -base64 32
AUTH_SECRET=your_auth_secret_here

# Google OAuth — https://console.cloud.google.com/
GOOGLE_CLIENT_ID=your_google_client_id
GOOGLE_CLIENT_SECRET=your_google_client_secret

# ── Rate limiting — Upstash Redis (recommended) ───────────────────────────────
# Without these, rate limiting falls back to in-memory (resets on server restart)
# Create a free Redis DB at https://console.upstash.com/
UPSTASH_REDIS_REST_URL=https://your-db.upstash.io
UPSTASH_REDIS_REST_TOKEN=your_token_here

# ── ElevenLabs Voice (optional) ───────────────────────────────────────────────
ELEVENLABS_API_KEY=your_elevenlabs_api_key_here
ELEVENLABS_VOICE_ID=pNInz6obpgDQGcFmaJgB

# Speech Engine — full WebRTC voice I/O
# Create an agent at https://elevenlabs.io/app/conversational-ai
ELEVENLABS_SPEECH_ENGINE_ID=agent_xxxxxxxxxxxxxxxxxxxx

# ── Security ──────────────────────────────────────────────────────────────────
ALLOWED_ORIGIN=https://your-domain.com

3. Run

Open http://localhost:3000.


Authentication

Claw Learn uses NextAuth.js v5 with Google OAuth. All routes require a valid session — unauthenticated users are redirected to /login.

Setup:

  1. Go to console.cloud.google.com → APIs & Services → Credentials
  2. Create an OAuth 2.0 Client ID (Web application)
  3. Add your domain to Authorized JavaScript origins and https://your-domain.com/api/auth/callback/google to Authorized redirect URIs
  4. Copy the Client ID and Secret into your env vars
  5. Generate AUTH_SECRET with openssl rand -base64 32

For local dev, add http://localhost:3000 as an authorized origin and http://localhost:3000/api/auth/callback/google as a redirect URI.


Rate Limiting

Each authenticated user gets 3 questions per day, tracked by their Google user ID and reset at UTC midnight.

Rate limiting uses Upstash Redis in production — an atomic INCR with a TTL set to the end of the current UTC day. This is serverless-safe and works across all Vercel edge instances.

Without Upstash credentials, the app falls back to an in-memory store that resets whenever the server restarts (fine for local dev, not suitable for production).

Setup:

  1. Create a free Redis database at console.upstash.com
  2. Copy the REST URL and token into UPSTASH_REDIS_REST_URL and UPSTASH_REDIS_REST_TOKEN

The remaining question count is shown in the top bar as a live badge and resets automatically each day.


Claw Learn uses the OpenAI-compatible API format, so it works with any provider that supports it.

Gemini (default)

OPENAI_API_KEY=your_gemini_api_key
OPENAI_BASE_URL=https://generativelanguage.googleapis.com/v1beta/openai
OPENAI_MODEL=gemini-2.5-flash

OpenAI

OPENAI_API_KEY=your_openai_api_key
OPENAI_BASE_URL=https://api.openai.com/v1
OPENAI_MODEL=gpt-4o

Ollama (local)

OPENAI_API_KEY=ollama
OPENAI_BASE_URL=http://localhost:11434/v1
OPENAI_MODEL=llama3.1

Voice Modes

Mode 1 — ElevenLabs Speech Engine (recommended)

The Speech Engine connects via WebRTC to an ElevenLabs Conversational AI agent and is the primary voice interface for Claw Learn. It handles both input and output in a single low-latency connection:

  • Voice input — speak your questions naturally, no typing needed
  • Streaming TTS — audio streams directly from ElevenLabs as each scene plays
  • Interruption — speak mid-explanation to redirect or ask a follow-up
  • Lower latency — WebRTC is significantly faster than the REST fallback

Setup:

  1. Go to elevenlabs.io/app/conversational-ai
  2. Create a new agent
  3. Set the system prompt to: "You are a math narration voice. Read exactly what the user sends you as clear, natural narration."
  4. Copy the Agent ID and set it as ELEVENLABS_SPEECH_ENGINE_ID in your .env.local

The Voice button in the top bar connects and disconnects the Speech Engine. When connected, a pulsing green indicator shows the session is live.

Mode 2 — REST TTS fallback

When ELEVENLABS_API_KEY is set but no Speech Engine is configured, each scene's narration is sent to the ElevenLabs REST API and played back as audio. No voice input in this mode.

Mode 3 — No voice

The app works fully without any ElevenLabs configuration — text input and silent animations only.


Deployment

Vercel (recommended)

Set these environment variables in the Vercel dashboard under Settings → Environment Variables:

Variable Required Description
OPENAI_API_KEY API key for your AI provider
OPENAI_BASE_URL Base URL of the OpenAI-compatible endpoint
OPENAI_MODEL Model name to use
AUTH_SECRET NextAuth secret (openssl rand -base64 32)
GOOGLE_CLIENT_ID Google OAuth client ID
GOOGLE_CLIENT_SECRET Google OAuth client secret
UPSTASH_REDIS_REST_URL Recommended Upstash Redis URL for persistent rate limiting
UPSTASH_REDIS_REST_TOKEN Recommended Upstash Redis token
ELEVENLABS_API_KEY Optional ElevenLabs REST TTS fallback
ELEVENLABS_VOICE_ID Optional Override default voice
ELEVENLABS_SPEECH_ENGINE_ID Recommended WebRTC voice agent ID
ALLOWED_ORIGIN Recommended Your production domain for CORS

The vercel.json in the repo is pre-configured.

Self-hosted

Requires Node.js 18+ and the environment variables above.


Visual Element Reference

The canvas renderer supports 30+ element types:

Type Description
axes Coordinate axes with grid and tick labels
graph Function curve (JS math expression)
tangent Tangent line to a curve at a point
secant Secant line between two points
shaded_area Filled area under a curve
point Dot with optional label
vector Arrow with label
matrix Matrix grid with brackets and highlights
formula Math text in a pill box
histogram Bar chart for distributions
pie_chart Proportions and compositions
bar_chart Categorical comparisons
line_chart Discrete data series
scatter_plot Correlation with optional regression line
wave Propagating sine/cosine wave
axes_3d Isometric 3D axes
complex_plane Re/Im axes with unit circle
riemann_sum Rectangles approximating an integral
slope_field Directional arrows for dy/dx
parametric_curve x(t), y(t) traced as t varies
polygon Arbitrary shape from vertices
angle_arc Label an angle between two rays
spring Physics spring between two points
brace Curly brace annotation
table Data table with headers
highlight_region Shaded overlay

Coordinate system: origin at center, x right, y up. Typical visible range: x ∈ [-6, 6], y ∈ [-4, 4].


Project Structure

clawlearn/
├── app/
│   ├── api/
│   │   ├── explain/route.ts          # POST — AI scene plan generation
│   │   ├── narrate/route.ts          # POST — ElevenLabs REST TTS
│   │   └── speech-engine/token/      # GET  — WebRTC conversation token
│   ├── page.tsx                      # Root — landing ↔ tutor router
│   ├── layout.tsx                    # Fonts, metadata, global CSS
│   └── globals.css                   # Design tokens, animations
│
├── components/
│   ├── LandingPage.tsx               # Marketing page
│   ├── TutorApp.tsx                  # App shell
│   ├── AnimationCanvas.tsx           # Canvas + scene sequencer
│   ├── ConversationPanel.tsx         # Chat history
│   ├── QuestionInput.tsx             # Input bar
│   └── NarrationSubtitle.tsx         # Subtitle below canvas
│
├── hooks/
│   ├── useTutor.ts                   # Core orchestration
│   ├── useSpeechEngine.ts            # ElevenLabs Speech Engine (WebRTC)
│   └── useVoice.ts                   # Web Speech API fallback
│
├── lib/
│   ├── openai.ts                     # OpenAI-compatible client + system prompt
│   ├── animationEngine.ts            # Canvas renderer (30+ elements)
│   ├── elevenlabs.ts                 # ElevenLabs REST helpers
│   └── voiceRecognition.ts           # Web Speech API wrapper
│
├── types/
│   └── scene.ts                      # Scene plan TypeScript types
│
├── .env.local.example                # Environment variable template
├── CONTRIBUTING.md                   # Contribution guide
├── LICENSE                           # MIT
└── vercel.json                       # Vercel deployment config

Security

  • API keys are server-side only — never exposed to the browser
  • Input is length-limited and validated on every API route
  • CORS is locked to ALLOWED_ORIGIN in production
  • The canvas renderer uses a safe recursive-descent math parser — no eval or new Function
  • Security headers (X-Frame-Options, X-Content-Type-Options, Referrer-Policy, Permissions-Policy) are set on all responses

See SECURITY.md for the full security policy and how to report vulnerabilities.


Known Limitations

  • No persistence — conversation history is in-memory, cleared on page refresh
  • Voice input — Web Speech API fallback requires Chrome or Edge; the Speech Engine works in all modern browsers
  • JSON truncation — very complex topics may cause the AI to return truncated JSON; the parser attempts recovery by finding the last complete scene
  • ElevenLabs free tier — 10,000 characters/month; the app continues silently without narration when quota is exceeded

Contributing

Contributions are welcome. Please read CONTRIBUTING.md first.

# Fork, then:
git checkout -b feat/your-feature
# Make changes
npx tsc --noEmit   # must pass
git commit -m "feat: your feature"
git push origin feat/your-feature
# Open a pull request

Acknowledgments


License

MIT © 2025 Claw Learn Contributors