Case study
Knowtis
Collaborative notes with an agent that acts on them — and asks first.
The problem
Note apps treat AI as a bolt-on chat sidebar that can read but never act. The moment an assistant can write, the trust problem shows up: nobody wants a model silently rewriting their notes, and anything it reads from the web or from a shared note is text an attacker could have authored.
The goal
Build an agent that can genuinely act on a knowledge base — search it, search the web, edit notes — while keeping the user in control of every write and treating untrusted text as hostile by default.
AI Engineering
How it's built.
6 disciplines that make an agent safe to ship, not just demo.
agentic loop · human-in-the-loop
An agent that acts — and asks first
A server-authoritative tool-use loop over nine tools, streamed over WebSocket. The user holds the write lock.
- Every note mutation arrives as a proposal — approve or reject, nothing auto-applies
- Proposals held in Redis across the approve round-trip
- Conversations and history live server-side, so a reconnect never loses a turn
guardrails · prompt injection defense
Untrusted text never reaches the model unchecked
Layered defense on every surface that carries text the user did not write.
- Heuristic injection scoring on user turns, fetched web content and retrieved notes
- Model-based classifier for the gray zone
- Blocked note bodies are replaced by a stub; titles and metadata survive
hybrid retrieval · RAG
Found by wording and by meaning
Two retrieval legs fused into one ranking, plus durable memory across conversations.
- Postgres full-text search + pgvector KNN, fused with Reciprocal Rank Fusion
- Mem0-style long-term memory, opt-in, extracted on a background job
evals · LLM evaluation
Measured, not vibes
A nightly eval harness keeps the AI surface honest as prompts and models change.
- Nightly runs over copilot, retrieval, memory and web search
- Tracks quality run-over-run as prompts and models evolve
cost engineering
Cheap and predictable under load
Every AI call is routed, cached and rate-limited before it spends a token.
- Exact-match response cache, SHA-256 keyed in Redis
- Model routing per action — Claude Sonnet 5 default, Haiku 4.5 for ghost text
- Three-provider failover; dual rate limiting with Redis primary and Postgres fallback
MCP server
The knowledge base is a tool surface
A dedicated Model Context Protocol server exposes notes to external agents.
- Eight tools behind OAuth 2.1
- Claude Desktop, Cursor and any MCP client can read and write notes
What it does
AI features that live inside the editor.
Everything streams over WebSocket — 20 AI actions reachable from the editor's bubble menu, slash commands and AI block, plus the voice-note pipeline.
Inline AI Assistant
20 AI actions across the Tiptap editor and voice capture — improve, fix spelling, summarize, translate, expand, change tone, outline, action items, chat, learn topic, generate flashcards, mind maps and more.
AI Study Tools
Auto-generate flashcards, quizzes, summaries and outlines from any note. SM2 spaced-repetition algorithm schedules optimal review.
Real-time CRDT
Yjs + Hocuspocus power multiplayer editing with live presence and remote cursors. Redis-backed for horizontal scale.
Voice Notes
Record voice memos with AI transcription processed into structured note content.
Offline-first
IndexedDB persistence with optimistic local-first updates. Keep writing without a connection; sync resumes seamlessly.
- summarize
- expand
- translate
- change tone
- outline
- action items
- ghost text
- chat
- improve writing
- fix spelling
- make shorter
- make longer
- learn topic
- generate flashcards
- generate quiz
- generate summary
- generate outline
- generate mind map
- voice transcription
- structure voice note
Tech stack
Everything under the hood.
- React 19
- NestJS
- TypeScript
- Vercel AI SDK
- Anthropic Claude
- MCP
- pgvector
- Tavily
- Socket.io
- Yjs
- Hocuspocus
- Tiptap
- TanStack Router
- TanStack Query
- Drizzle
- PostgreSQL
- Redis
- Tailwind CSS
- Vite
- Zustand
- CASL
- Nx
Try it live
Knowtis is deployed and free to explore — no signup needed.