From Role-Based Access to Fine-Grained Authorization
Palette worked with Mastra to build fine-grained access control into the platform.
When Palette needed AI agents that could see private company data without leaking it, role-based access control wasn't flexible enough. So together with Mastra they built fine-grained authorization.
What Palette Does
Palette is a context layer for AI. Its main product, Palette Desktop, lets non-engineers talk to any agent — Claude, ChatGPT, Mistral, a local model — with Palette's context injected automatically for more grounded answers.
The goal is what the team calls a "multiplayer approach." Most AI is one-on-one. Palette connects what one teammate is working on with what another is working on, pulling signals in through connectors — Slack, Jira, Linear, GitHub, with Google Drive on the way.
The Permissions Problem
That kind of context-sharing raises an obvious question: who's allowed to see what. Some customers run private teams inside their own company — a founders' group, a stealth project — and not even an org admin should see into those. Palette itself also handles cross-client conversations that can never leak between accounts.
Role-based access control (RBAC) — define roles, map them to permissions — was the common starting point. But it wasn't flexible enough. A team admin might need scope on one specific team, not all of them. An org admin might need almost everything, except the private teams. RBAC couldn't express that cleanly, so Palette layered on fine-grained authorization (FGA) instead, using WorkOS FGA.
"It's just so much easier to check: okay, who has this permission? Role explosion was already a problem pre-AI. And now that we're getting AI agents, I think more companies are going to start going to FGA." — Tiffany Lozenski, Founding Product Engineer, Palette
Why Mastra
Palette chose Mastra for two reasons: the stack, and the relationship. Palette already ran TypeScript for its frontend and, less conventionally, its Node.js backend, and wanted the agent layer on the same language rather than bolting on a separate Python stack for AI — a consistency that helps the humans reading the code and the coding agents working in it alongside them.
Just as important was the working relationship Palette built with Mastra's team, bouncing ideas back and forth and getting visibility into the roadmap in a way Palette didn't have with the other frameworks it considered.
Building FGA Into Mastra
That relationship is also how FGA became a Mastra feature in the first place. It wasn't originally an option — Palette proposed building it and worked directly with Mastra's team to make the case. Because Mastra already had RBAC support for WorkOS, extending it into FGA was a smaller lift than building from scratch.
Today, every Palette agent runs inside Mastra. Once authentication clears, Mastra checks the actor's permissions before anything happens — if it's not allowed, the LLM doesn't act. That holds even if someone bypasses the Palette app and hits the Mastra instance directly.
Getting there wasn't frictionless. Locking permissions down to the resource level came with its own risk, and Palette hit it in beta: tool authorization was scoped per session instead of per tool, so one unauthorized tool blocked every tool in that session.
They shipped a temporary bypass and are now building the real fix: a new actor type that lets them assign permissions per agent, not just per user.
Merging Into Hono
Permissions weren't the only place the deeper Mastra integration paid off. Palette's CTO merged Mastra directly into their Hono backend, and the performance gain was huge.
"Our application used to take maybe 30 seconds to spin up, and then now it would take 5 seconds to spin up." — Tiffany Lozenski
On a 3-person team running 10-plus sessions at once, that adds up fast. It also simplified the codebase — easier for the humans, and easier for the coding agents working alongside them.
What's Next
Back on the permissions side, Palette's FGA setup is live in production today, checking every agent's actions before they execute. But the work isn't finished. The next step is distinct permission sets per agent, not just per user. No user can currently take destructive actions in Palette at all — write access to Notion, Linear, and GitHub sits behind a feature flag limited to two engineers, until FGA is fully wired in.
"Building on Mastra was the right call because it gives us a lot of flexibility, allows us to work with TypeScript, not have to add Python into our tech stack. We've had a really good collaboration — Palette and Mastra, just as companies in general — and that has been super invaluable. There are some things you can't really put a price on." — Tiffany Lozenski, Founding Product Engineer, Palette