Yogan Labs
Projects / Klippy

Free agent

In progress

Klippy. A small personal agent you build one lesson at a time.

Klippy is a personal agent on Cloudflare Workers that chats, keeps notes, remembers you, reads links and sends reminders. It is the reference build for the build-along courses on bits, with a git tag for every lesson.

  • Updated Nov 18, 2026
  • 9 technologies
  • 51 lessons
  • Public repo
Details

The problem

Most agent tutorials stop at a demo. Klippy goes from an empty folder to an agent in production, and every step is a commit you can check out and compare against.

Who it is for

Learners following the bits build-along courses, from no experience in course A to production in course F. Also any developer who wants a small, well-tested agent on Workers to fork.

What you will learn

  • Give each person their own agent on a Durable Object with the Cloudflare Agents SDK, its own SQL and scheduled reminders.
  • Write tools with the AI SDK and zod: descriptions the model follows, strict inputs that fail honestly, and approval before writes.
  • Block prompt injection by switching off every writing tool once a page or saved content is read, and prove it with a test.
  • Build retrieval properly: a durable ingest Workflow, chunking, Vectorize embeddings, keyword search, rank fusion, a reranker and cited answers.
  • Measure retrieval with a recall@5 eval on the agent’s own index.
  • Ship with per-user rate limits, a daily token budget, AI Gateway labels and Workers Previews that cannot reach production data.

The AI parts

  • Claude Haiku 5.5 through your own AI Gateway, with the key stored on the gateway.
  • A fallback to the free Workers AI model glm-4.7-flash, switched by one line.
  • Workers AI embeddings and a reranker for note search.
  • The Cloudflare Agents SDK and the Vercel AI SDK.
  • Cloudflare Agents SDK
  • Cloudflare Workers
  • Durable Objects
  • D1
  • Vectorize
  • Workflows
  • AI Gateway
  • AI SDK
  • Remix 3

Open these first

  1. 01
    apps/agent/src/agent.tsThe agent itself: one Durable Object per person.
  2. 02
    apps/agent/src/model.tsHow the gateway, the model and the fallback are chosen.
  3. 03
    apps/agent/src/toolsEach tool in its own file: links, memory, notes, reminders, search, weather.
  4. 04
    apps/agent/test/injection.spec.tsA fake model that obeys planted instructions, and the test that stops it.
  5. 05
    apps/agent/src/retrievalHybrid search, rank fusion and reranking in small files.
  6. 06
    apps/agent/src/budget.tsThe daily token budget reserved before each step.
  7. 07
    docs/outputsThe real terminal output for each lesson, with the date it was recorded.

Run it

Terminal
git clone https://github.com/ryanyogan/klippycd klippygit checkout a-05pnpm install --frozen-lockfilepnpm devpnpm testpnpm typecheck

Honest status

In progress

Courses A to F are built and every lesson tag passes typecheck and tests in CI. There is no live deploy yet, and the gateway has no Anthropic key, so every recorded answer so far came from the Workers AI fallback.

Answers the same questions