One query, start to finish.
You ask a question. The classifier checks memory, the retriever checks facts, and every answer carries a score for how much to trust it.
The fragmentation tax
Before the reference material below, the reason it's shaped like this: most teams run their AI assistant bolted onto a dozen SaaS tools it can only half-see. The cost of that shows up long before anyone asks the assistant a question.
Everything from here down is the reference for how that single binary actually works, starting with how someone gets into it in the first place.
Getting in, and signing in
There's no desktop client and no browser extension. The app is a website that also happens to be installable, so the same HTTPS origin serves the login page, the dashboard, and the install prompt. Once someone's there, two ways in: single sign-on for organizations that already have an identity provider, and a local account with multi-factor for everyone else. Both end at the same signed, server-side session.
-
Open it in a browserWorks over plain HTTPS, no login required to see the marketing pages. Everything behind
/homerequires an authenticated session. -
Install it as a PWAThe server dynamically serves
/manifest.jsonand/sw.js, and the browser's own "Install app" prompt handles the rest. No app-store review, no separate binary to distribute or patch. -
Sign inEither single sign-on or a local account below, and either way the result is the same server-side session cookie.
On sign-in, the session ID is deliberately regenerated rather than reused. That's a standard defence against session-fixation, where an attacker tries to pre-set a victim's session before they log in.
Who can see and do what
Authorization is layered rather than a single flag: a role, an organization boundary, access guards on every piece of content the assistant reads, and, for the handful of routes that matter most, a second independent check.
| Role | Scope | Where it comes from |
|---|---|---|
| user | Own org's data; own personal notes | Default for every account |
| manager | Same as user, plus team-level views | user_roles collection |
| admin | Full org administration | user_roles collection, falls back to ADMIN_USERS env var |
| super_user | Can query across organizations, not just their own | user_roles collection (rare, manually granted) |
Every account also belongs to exactly one organization, resolved from its email domain through an admin-managed list of each organization's domains (one organization can own several), and retrieval for regular users never crosses that boundary. Personal notes go a step further and are scoped to the individual, not just the org, since nobody else should ever be able to search them.
Inside the organization, the assistant adds a third layer, AIME Guards. Every email, message, ticket, document and knowledge atom carries a sensitivity tier (org_public, internal, project_only, finance_confidential, hr_confidential, restricted). The asker's clearance becomes a filter inside every database query, and each result is checked again before the model reads it. Content with no label, or a tier the check does not know, is refused rather than shared. A leak checker that tries every test user against every result has found 0 leaks across 61,209 results. More on the AIME page.
Admin-only routes check the session role first; the most sensitive ones add a second, independent IP-allowlist check, so a single compromised admin session isn't automatically enough on its own.
The home dashboard and what it's actually made of
The home screen isn't one big payload. It's several small, independently-loading endpoints, so a slow one (say, generating insights) never blocks the rest of the page from showing up.
| Endpoint | What it renders |
|---|---|
| /home/summary | The top-line daily overview |
| /home/activity | Recent activity across connected modules |
| /home/insights | Per-channel AI summaries of what's happened in chat since it was last read |
| /home/insight-summary | A condensed version for the summary card |
| /home/email-summary | Unread and priority email at a glance |
| /home/feed | The combined activity feed |
| /home/assistant | The AI chat box itself |
Every message typed into the assistant is classified into one of a small set of command types before anything else happens, which is what lets the same input box handle a question, a statement, and an action without the person having to pick a mode:
- Outside company dataGeneral-knowledge requests ("write me Python code") are politely declined without calling the answering model. Greetings and thanks still get a friendly reply.
- Company questionNeeds company context, so it triggers the retrieval pipeline described next.
- Email querySpecifically about inbox contents, so it's scoped to the email collections.
- Action / write intent"Create a ticket for…" style commands that create real records (incidents, Jira issues) rather than just answering. Requests to reveal or change credentials are refused by rule before any model runs.
- StatementNot a question at all ("thanks", "got it"), so it's acknowledged without spending a retrieval or an LLM call.
What's actually behind AI Insights
"Insights" on the home screen isn't a vague analytics blurb. It's a concrete feature: for every chat channel with new activity, the model reads the unread messages and writes a 3–5 sentence summary of the key topics, decisions, and action items, so catching up on a busy channel doesn't mean scrolling through it.
Each summary is cached by channel and the timestamp of its last message. If nothing new has been said, the same summary is reused instead of re-summarizing on every page load. The cache is capped at 1,000 entries and clears itself once full, rather than growing without bound.
One input box, many modes
Typing / in the assistant's input box opens a filtered command menu. The same box that answers a question can also switch into composing an email, saving a note to the knowledge base, or opening a specific integration, without navigating away.
| Command | Switches the input to |
|---|---|
| Compose mode, cursor jumps straight to the "To" field | |
| /chat | Direct-message compose to a teammate |
| /knowledge | Save a note to the knowledge base |
| /note | A personal note, scoped only to the person writing it |
| /ticket | A new incident/ticket |
| /incident | Same as /ticket, opens the incident modal directly, handled both client-side and as a server-side fallback |
| /gmail, /outlook, /calendar | The connected Google, Outlook, or calendar view |
| /slack, /confluence, /jira, /servicenow | The relevant connected integration |
| @mention | Not a slash command, but the same trigger pattern, tags a teammate inline |
The command list also seeds the rotating suggestion chips on the home screen, so first-time users discover what the box can do without reading documentation first.
What happens between your question and your answer
Every query anyone sends to the assistant is watched by its own observability engine, internally called AIO. It doesn't just answer, it traces the answer, so a bad response is something we get alerted to, not something a customer has to report. One query, six stages, walked through end to end below: retrieval and the language model never touch the query directly: everything passes through classification first, with the answer cache checked alongside the search.
A fast model (with a regex fallback if it's unavailable) reads the message and decides: is this something that needs real company data, a general question, or just a "thanks"? Only the first kind triggers retrieval, so a passing remark doesn't burn a database query, and a general-knowledge request is declined there and then without calling the answering model.
While retrieval starts, the question is also compared against recently-cached queries. Three outcomes, one router: it picks the cheapest honest path rather than always running the full pipeline. The cache is per person: a match is only ever made against the asker's own earlier answers, and it must name the same tickets and people, so an answer about INC-1 is never reused for INC-2. Answers older than 7 days are still served but refreshed in the background.
Same question, same answer, served from rag_query_cache with no LLM call at all.
Close enough to reuse context, not close enough to skip a real answer.
Genuinely new territory: classify, retrieve, assemble, and route from scratch.
The retriever searches email (whole messages and the passages inside long ones), internal chat, the knowledge base, incidents, personal notes, content synced in from connected tools, and the short knowledge atoms distilled from tickets and documents, all at the same time, each with its own deadline so one slow source cannot stall the answer. Most sources are searched twice, by exact words (MongoDB text indexes) and by meaning (768-number vectors stored on the same documents), and the two rankings are merged with Reciprocal Rank Fusion. Ties are broken by document ID, so the same question always gathers the same evidence. Every search carries the asker's access filter from AIME Guards; a cross-org super_user can widen the query beyond one organization, everyone else is hard-scoped to their own.
| Source | Collection | Scope |
|---|---|---|
| email_messages, rag_email_chunks | Mailboxes the asker can open, then by sensitivity | |
| Chat | msg_messages | Channels the asker is a member of |
| Knowledge base | knowledge_chunks | Org, by sensitivity tier |
| Incidents | inc_incidents | By sensitivity tier and project |
| Personal notes | user_notes | User-only, never shared across accounts |
| Synced integrations | rag_integration_chunks | Org content by tier, plus the asker's own connected mailboxes |
| Knowledge atoms | rag_refined_knowledge | Same rules as the ticket or document each atom came from |
Results are trimmed to fit and stitched into a single context block, with every fact tagged to where it came from: an email thread, a ticket, a chat message. The model can tell the difference, and so can the person reading the answer. Each source gets a weighted share of the 12,000 characters (email 40, chat 30, knowledge 25, incidents 25; personal notes capped at 1,500), and knowledge atoms replace the raw tickets and document passages they summarise, so the context stays the same size as knowledge grows.
The context and question go to openai/gpt-oss-120b on Groq. If it is rate-limited, failing or slower than 12 seconds, a backup model (gpt-oss-20b) answers instead, and the failing one sits out a cool-down: 30 seconds for a rate limit or server error, 5 minutes for a wrong key or retired model. The model is told to answer only from the context and to say where facts came from. If several items match, it asks which one is meant; if nothing matches, it says so and suggests the detail that would help. A locally-run Ollama model can take over synthesis instead, opt-in for privacy. Full breakdown of why it's routed this way, and what each option costs, in Cost & Latency below.
Sources used, how long it took, roughly what it cost, and a quality score get written down automatically, along with an output check that runs before the reply ever renders. If retrieval came back empty but the model answered anyway, a source timed out, or a query took unusually long, it's flagged right there, not left for someone to notice after a customer complains.
One MongoDB instance, every module
There's exactly one database. Every module writes to its own set of collections, prefixed by name, so it's obvious at a glance which module owns which data, without needing a separate database, schema, or connection per module.
| Prefix | Owned by |
|---|---|
| email_* | Email module: mailboxes, messages, domains |
| msg_* | Internal messaging / chat |
| knowledge_* | Knowledge base documents and chunks |
| inc_* | Incidents / support tickets |
| pm_* | Projects and project tasks |
| rag_* | RAG pipeline: email passages, integration chunks, knowledge atoms, distillation state, query cache |
| integration_* | Connected third-party tool config and sync state |
| aio_* | AIO traces and quality scoring |
| audit_* | Tamper-evident, hash-chained audit log |
| user_* | Accounts, roles, personal notes |
| org_* | Organization records and settings |
| cal_* / calendar_events | Calendar module |
Search runs on MongoDB's own text indexes plus embeddings stored as plain number arrays on the same documents, rather than in a separate vector store. One instance to back up, one instance to restore, no cross-database consistency problem to reason about.
A full mail server, not an inbox viewer
The email module isn't a thin client bolted onto Gmail. It's an actual SMTP and IMAP implementation, so a KaryoSpace address sends and receives mail directly.
-
Inbound & SPFIncoming mail is checked against the sender domain's SPF record before it's trusted.
-
Spam scoringEvery message gets a score from keyword patterns, SPF failure, ALL-CAPS ratio, and bulk-mail headers. A score of 5 or higher routes straight to Spam, not the inbox.
-
DKIM signingOutbound mail is signed with a per-domain key, stored encrypted at rest. It's the same mechanism that keeps Gmail from flagging KaryoSpace mail as forged.
-
Outbound queue & retriesA failed send doesn't just vanish. It's retried at 5 minutes, 30 minutes, 2 hours, 6 hours, then 24 hours (6 attempts total) before the sender gets a bounce notice.
-
IMAP accessStandard IMAP folders (Inbox, Sent, Drafts, Trash, Spam) mean any real mail client can connect to it, so the web UI isn't the only way in.
Real-time chat, three channel shapes
Internal messaging runs over its own WebSocket connection (/ws/messaging), not polling, so presence, typing, and new messages show up without the client asking for them.
| Channel type | What it is |
|---|---|
| public | Org-wide channels, the #general / #engineering style shared space |
| direct | A 2-person DM |
| group | A named group DM with 3 or more people |
Presence (online / away / offline) is stored with a 90-second TTL. If a client disconnects without saying so, it ages out on its own rather than showing someone as permanently online. Typing indicators and presence changes are separate WebSocket event types, sent the moment they happen, not bundled into the next message poll.
Every message channel is also a RAG source: the assistant can answer questions about what was discussed in a channel the same way it answers questions about email or tickets, scoped to channels the asking user is actually a member of.
Knowledge base: upload, ask, and a two-person delete
This is where org documentation lives, and the one place in the product where deleting something isn't a single click.
-
UploadText, Markdown, or PDF (text layer only), chunked into 500-word windows the moment it's ingested, per the chunking rules above.
-
Search & Ask
/knowledge/searchdoes a direct lookup;/knowledge/askis rate-limited separately from the main assistant and runs a question through the same RAG-style retrieval, scoped to knowledge docs. -
ShareIndividual docs can get a public share link, for the cases where something needs to go outside the org without exporting it manually.
-
Delete: request, then approveDeleting a document doesn't remove it outright: it's marked pending, and a separate admin-only approval step has to confirm it before it's actually gone. One person's mistake, or a bad-faith delete, can't quietly erase org knowledge on its own.
Project management: epics, sprints, and an AI that can create tasks
Not a Jira clone. It's a lighter internal PM module that mirrors into the same retrieval and assistant pipeline as everything else.
| Concept | What it covers |
|---|---|
| Projects | The top-level container everything else belongs to |
| Epics | Groupings of related tasks inside a project |
| Tasks | Assignable units of work with status, comments, due dates |
| Sprints | Time-boxed groupings of tasks |
| Comments | Threaded discussion on a task, same audit trail as everything else |
Two AI-specific endpoints sit on top: one lets the assistant create a task directly from a natural-language request ("create a task for the login bug"), the other generates a sprint summary on demand rather than someone writing a status update by hand. /projects/overdue-tasks and /projects/my-tasks back the "what's overdue?" and "what do I have to do?" questions the assistant gets asked most.
Everything else running in the same binary
Smaller modules, each scoped to its own org and still searchable by the same RAG fan-out.
Admin, Feedback & Analytics
The parts that keep the product honest to its own operators, not just its users.
A
Admin Panel
Org configuration, roles, provider swap
Admin routes check the session role first; the most sensitive ones add a second, independent IP-allowlist check, so a single compromised admin session isn't automatically enough on its own.
| Area | Covers |
|---|---|
| Users & roles | List users, change role, change org, enable/disable an account |
| Settings | Org-wide configuration, LLM provider, integration credentials |
| Usage & billing | Per-org usage, plan/billing admin |
| Audit | Browse the audit log, plus a one-click hash-chain integrity check |
| Email queue | Inspect the outbound queue, force-retry a stuck send, mailbox stats |
| AI queries & logs | Review what the assistant has been asked, application logs |
The audit-verify check exists because the log is hash-chained: each entry embeds a hash of the one before it, so a single click confirms nothing in the chain has been quietly edited, rather than trusting that it wasn't.
F
Feedback
In-app reports, size-capped
Feedback is submitted in-app, categorized, and stored in its own collection. The AI can help polish a rough draft into something clearer before it's sent, and the person's original point stays theirs, just easier to read.
S
Analytics
Page visits, KPIs, city-level geography
Page-visit events feed a small set of product KPIs, including city-level geolocation (via GeoIP) for understanding where usage comes from.
One binary, five layers
No microservices to orchestrate, no queue to lose a message in. Each request takes the same short path, click a band to see what's actually running inside it.
1
Client
Browser or installed PWA
The app is installable (PWA) and talks to the server over HTTPS only. No plugin, no desktop client to keep updated.
2
nginx
TLS termination, reverse proxy
Terminates TLS and forwards everything to the app over plain HTTP inside a private network. The Go binary never talks directly to the internet.
3
The Go binary
One process, standard-library router
Every module (email, chat, the knowledge base, tickets, projects, calendar, the RAG pipeline) is a package inside one Go binary, routed with the standard library's own router. Nothing here is a separate service with its own deploy, its own network hop, or its own way of failing.
4
MongoDB
One instance, grouped by domain
A single MongoDB instance holds everything. Search runs on native text indexes and on embeddings stored as plain arrays on the documents themselves, so there's no separate vector store to provision, back up, or lose sync with.
5
Integrations
8 connectors, same retrieval path
External tools are polled on a schedule, chunked, embedded where possible, and merged into the exact same retrieval fan-out described above. The assistant doesn't treat a Jira ticket differently from an internal one.
Data Chunking
Before anything gets searched, it has to be split into pieces small enough for the model to actually read. Every source uses overlapping windows, sized for what it holds: knowledge base uploads, synced integration content, and long email threads.
Overlapping windows mean a fact sitting right at a chunk boundary still shows up whole in at least one chunk, so nothing important gets silently cut in half. Supported source formats are plain text, Markdown, and the text layer of PDFs; anything else is rejected at ingest rather than silently mis-parsed.
Each chunk is embedded once at ingest time with Ollama's nomic-embed-text (768 dimensions), running on the same server, so text is never sent out to be embedded. Gemini's gemini-embedding-001 (3072 dimensions) can be configured instead, and the two are never mixed in one field. The vector is stored directly on the document. If the embedder is unavailable, search falls back to MongoDB's native text index instead of failing. In the background, a small local model (gemma3:4b) also distils tickets and documents into one-line knowledge atoms that name their source; see the AIME page.
AIO: the observability engine watching every answer
Every AI response gets a quality score, starting at 100 and losing points for specific, named failure patterns. It's not a vague "confidence" number, but an itemized deduction anyone can audit.
empty_retrieval_answered: RAG query, zero chunks found, model answered anywayno_sources: RAG query returned zero source categorieslow_similarity: Best match similarity score below 0.35slow_llm: Model response took longer than 10sslow_total: Whole pipeline took longer than 20spartial_branches: One or more sources timed out, errored or crashedhigh_cost: Estimated cost above $0.05Each trace records exactly which sources were used, latency at every stage, an estimated cost, and the resulting quality score, written to aio_traces automatically, on every query, not sampled. The worst pattern the score exists to catch is a model confidently answering from nothing. That's the −35, the single largest penalty on the table, because it's the failure a user is least likely to notice on their own.
Guardrails, not an afterthought
Nothing here is exotic. It's the same handful of protections any system handling company data should have, applied consistently rather than bolted on later.
Built on boring, well-understood pieces
Nothing here needs a specialist to operate. That's deliberate: the tools are the tools, chosen because they're well understood, not because they're impressive on a slide.
AI routing is intentionally swappable, a config choice rather than a rewrite; full breakdown of why in Cost & Latency below.
| Layer | Choice |
|---|---|
| Language | Go 1.24, one binary, ~28 internal packages, no web framework (standard library router) |
| Frontend | Server-rendered HTML (Go's html/template), vanilla JavaScript, Tailwind pre-built, no build step, no bundler |
| Sessions | gorilla/sessions (signed, encrypted cookies) |
| Database driver | Official MongoDB Go driver |
| Realtime | gorilla/websocket |
| Email protocols | emersion's go-imap, go-message, go-msgauth (DKIM) |
| Auth | golang.org/x/oauth2 (OIDC), pquerna/otp (TOTP) |
| Security utilities | bluemonday (HTML sanitizing), geoip2 (coarse geolocation) |
| Push & metrics | webpush-go, Prometheus client |
No React, no Vue, no Node build pipeline in production. Pages are templated server-side and shipped as plain HTML/CSS/JS. That's a deliberate trade: less flexibility for a highly dynamic UI, in exchange for zero client-side build step and one runtime to reason about.
Building, installing, and deploying it
For the person using it day to day, "installing" the app means the PWA install prompt covered earlier. For the person running it, here's the actual build and deploy path.
The runtime image is deliberately minimal, Alpine plus CA certificates and a handful of small utilities (tzdata, curl, git), and the app runs as a dedicated non-root user inside the container rather than root, standard least-privilege practice for anything internet-facing.
Topology is the same regardless of where it's hosted: nginx terminates TLS and reverse-proxies to the app container, MongoDB runs alongside it, and there's no dependency on any single cloud provider. The whole stack is three things (nginx, the Go binary, MongoDB) that run anywhere a container can.
A handful of environment variables are all that's required to bring up a new instance: a MongoDB connection string, a session signing key, and a key for encrypting DKIM private keys at rest. Everything else (which LLM provider, which integrations are enabled, SMTP relay settings) has a sane default and can be turned on later without a rebuild.
The insights panel
Two endpoints feed it, one summarized, one raw, and each click behaves differently on purpose.
Briefing: GET /home/assistant
- Cached 5 minutes per user;
?refresh=1forces a rebuild - Summarizes emails, tasks, incidents, and calendar into short sections
- The LLM only runs when channel messages actually need summarizing
Activity feed: GET /home/feed
- Up to 5 emails, 10 tasks, 5 incidents, 5 calendar events
- Sorted newest-first, capped at 50 items total
- Every item carries its own destination URL
Right answer, lowest cost
Every lever above compounds. Repeat questions skip the model entirely, out-of-scope requests stop before it, and everything else runs under a hard budget.
Cloud: Groq (default, gpt-oss-120b)
- Median 1.4 s end to end on the live site (measured)
- Traces estimate $0.15 / $0.60 per million input/output tokens
- No local GPU needed; a backup model takes over after 12 s
Local: Ollama (opt-in)
- 10–100s response time, hardware-dependent
- $0 marginal cost per query
- On via
USE_LOCAL_FOR_SYNTHESIS, only when retrieval found real context
Eight ways in, one way to run it
Every connector feeds the same retriever. Every deploy is the same three pieces.
Want to see it running?
The best way to understand the architecture is to watch it answer a real question.