Caleb PalmquistContact

cpalm.dev

Portfolio site with BEAM-E, a live AI assistant that answers questions about my work on either Claude or GPT. Messages are screened for injection and abuse before they reach the model, with per-visitor rate limits and a daily spend cap, all backed by a test suite and CI.

  • Next.js
  • TypeScript
  • LLM
  • AI Safety
View on GitHub

What it is

This site. It presents my projects and includes BEAM-E, a streaming assistant that answers questions about my work. Visitors can run it on Claude Haiku 5.5 or GPT 5.6 Luna.

It's built with Next.js (App Router), React, TypeScript, Tailwind CSS and the Vercel AI SDK.

How BEAM-E works

BEAM-E answers using only my resume and project write-ups, which are placed in its system prompt. It isn't a retrieval system: everything it knows is in that prompt, and it's told to say so when something isn't covered. Replies stream to the browser as plain text.

Safeguards before a message reaches the model

Every request passes these checks, in order, before any model is called:

  • A same-origin check, so requests that don't come from a page on this site are refused.
  • Per-visitor rate limits: 5 requests a minute and 60 an hour. Blocked messages also add strike points, 2 for abuse, illegal requests and injection attempts and 1 for spam, gibberish and off-topic. Reaching 4 points in 10 minutes locks the visitor out for 10 minutes, so two serious blocked messages are enough.
  • Request validation: capped body size, message count and message length, and the model must be one on the list.
  • Message screening for prompt injection, abuse, illegal requests, spam and links, gibberish, and off-topic requests such as homework. Input is normalized first, so leetspeak, zero-width characters and spaced-out letters don't slip through. The same rules run in the browser for instant feedback and on the server as the authoritative check.
  • A site-wide daily cap on model calls.

Testing

A script runs the guard against messages it must allow, including tricky honest questions like "I hacked together a prototype last week", and messages it must block. CI runs it on every push and pull request, along with the type check and lint.

Limits

  • The screening is heuristic. It's tuned to avoid blocking honest questions about a portfolio, and it won't catch everything.
  • Rate-limit and cap state lives in memory on each server instance, so a serverless host running several instances, or a restart, resets the counts. A shared store such as Upstash or Vercel KV is the upgrade for hard guarantees.
  • The same-origin check stops other websites from using the endpoint through their visitors' browsers. It doesn't stop a script or curl, which can send any headers.