agentleFS
viitrixviitrix/vt-claw/web/CLAUDE.md

vt-claw / web

CLAUDE.md27 starsChanged 7 months agoMITView on GitHub

VT-Claw Web is an AI chatbot frontend built with SvelteKit 5 (Svelte 5 runes syntax). It acts as a web client that proxies chat requests to a separate backend service (the "Claw" server) via SSE-based streaming. The app supports email/password auth, WeChat QR code login, and an anonymous walkie-talkie voice chat mode. The web app does not call LLM APIs directly. Instead, src/lib/server/claw-client.ts proxies all AI interactions to a Claw backend (CLAW_API_URL, default http://localhost:3000). The backend handles web chat (/api/web-chat),…

The file

We split this CLAUDE.md into the rules it gives an agent

1 rule. About 0 are common, 0 are distinctive, and 1 is very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈0

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 1

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    All DB queries in src/lib/server/db/queries.ts return ResultAsync from the neverthrow library (no exceptions thrown)

    line 31

≈ “Common” is an estimate: at least 1 in 5 of the 12,729 CLAUDE.md files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
CLAUDE.md

CLAUDE.md

This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.

Project Overview

VT-Claw Web is an AI chatbot frontend built with SvelteKit 5 (Svelte 5 runes syntax). It acts as a web client that proxies chat requests to a separate backend service (the "Claw" server) via SSE-based streaming. The app supports email/password auth, WeChat QR code login, and an anonymous walkie-talkie voice chat mode.

Commands

  • pnpm dev — Start dev server (listens on 0.0.0.0)
  • pnpm build — Production build
  • pnpm preview — Preview production build
  • pnpm check — TypeScript checking via svelte-check
  • pnpm lint — Prettier check + ESLint
  • pnpm format — Format with Prettier
  • pnpm db:push — Push Drizzle schema changes to SQLite

Architecture

Backend Proxy Pattern

The web app does not call LLM APIs directly. Instead, src/lib/server/claw-client.ts proxies all AI interactions to a Claw backend (CLAW_API_URL, default http://localhost:3000). The backend handles web chat (/api/web-chat), talkie chat (/api/talkie-chat), WeChat login flows, file serving, and role management.

The ClawChatModel class (src/lib/server/ai/claw-model.ts) implements the Vercel AI SDK LanguageModelV1 interface, adapting the Claw backend's SSE stream into the AI SDK's streaming protocol. This allows the chat UI to use streamText() from the ai package while the actual model execution happens remotely.

Database

  • SQLite via @libsql/client + Drizzle ORM — stored at data/chatbot.db
  • Schema in src/lib/server/db/schema.ts — four tables: User, Session, Chat, Message
  • All DB queries in src/lib/server/db/queries.ts return ResultAsync from the neverthrow library (no exceptions thrown)
  • Error types use a tagged union pattern: TaggedError base class → DbEntityNotFoundError | DbInternalError

Authentication

  • Session-based auth using @oslojs/crypto for token hashing — see src/lib/server/auth/
  • hooks.server.ts validates session cookies on every request via SvelteKit's sequence handle
  • Routes under src/routes/(auth)/ handle signup/signin with Zod validation
  • App.Locals provides user and session to all server-side code

Routes

  • / — Landing page (unauthenticated) or redirect to chat
  • /chat — Main chat interface (layout loads user + chat history)
  • /chat/[chatId] — Individual chat conversation
  • /walkie — Walkie-talkie voice chat (CSR only, no auth required, in-memory message buffer)
  • /weixin — WeChat QR code login flow
  • /api/chat — POST to stream AI responses, DELETE to remove chats
  • /api/files/upload and /api/files/download/[...path] — File upload/download proxied to Claw backend's share folder
  • /api/roles, /api/wxlogin, /api/qrcode, /api/qrstatus — WeChat login proxies to Claw backend

UI

  • shadcn-svelte component library (configured via components.json)
  • Tailwind CSS v4 with @tailwindcss/vite plugin
  • bits-ui for headless UI primitives
  • Svelte 5 runes ($state, $effect, $derived) used throughout — no legacy Svelte stores
  • Custom fonts (Geist) loaded from /static/fonts/

Key Conventions

  • Package manager is pnpm (see packageManager field in package.json)
  • neverthrow ResultAsync/safeTry used for all fallible operations instead of try/catch
  • Svelte 5 runes syntax exclusively — use $state(), $effect(), $derived() not legacy reactive declarations
  • Unused variables prefixed with _ (enforced by ESLint)
  • API routes use @sveltejs/kit error helper, not thrown Response objects
  • File uploads restricted to JPEG/PNG, max 5MB (validated with Zod in upload route)

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.