Gateway: one endpoint that knows who is asking
An optional service (decision #58, proposal in identity.md). Clients connect to the gateway instead of to each service. It works out which person is calling, shows only that person’s tools, adds that person’s own credentials on the way to each service, holds removals until they confirm, and records who did what.
What a person gets
Section titled “What a person gets”- Their own tools only. Tool names carry the entry they belong to:
hindsight_tmeuze__recall,outline_everything__create_document,tududi_tui__create_task. A person never sees, and cannot call, another person’s entries, even by guessing a name. - Their own credentials downstream. The service sees
tmeuze’s key, so Outline and Tududi attribute the action to the right account. The caller never holds that key. The gateway does. - Adding is immediate, removing is confirmed. Create, add and retain run at
once. A delete, clear or similar is held, the person gets a notification with
a link that shows exactly what will be removed, and the call waits for
Approve or Deny (180 seconds by default). Approve runs it. Deny, or silence,
does nothing. Updates and moves are allowed and logged. To hold those
too, add
modifytoconfirmingateway.yaml. - Accounting. Every call is logged with person, how they were identified,
entry, tool, kind of action, decision and outcome. Never the arguments or the
results, only the argument names.
novak gateway audit [person].
The household (voice satellites) gets household entries and can read and add, but removals are not even listed: there is nobody to confirm them.
How a caller is identified
Section titled “How a caller is identified”Strongest first.
- A Pocket ID token whose audience is the gateway. The gateway checks the
signature against Pocket ID’s published keys and reads the person from the
preferred_usernameclaim, so identity is issued, not claimed. Turn it on withGATEWAY_OIDC_ISSUER(Pocket ID’s address) andGATEWAY_OIDC_AUDIENCE(the API resource registered in Pocket ID for the gateway, normally<gateway address>/mcp). The gateway also serves/.well-known/oauth-protected-resourceand answers 401 with a pointer to it, which is what an MCP client that can sign in uses to find Pocket ID. VERIFY against a real Pocket ID and a real client: tested here against a stand-in issuer only. - A trusted client (Open WebUI) sends its own key and names the user in
the
X-Novak-Userheader, matched against a person’snamesoremails. Only as safe as the network: nothing but that client may reach the gateway. Make the key withnovak gateway client open-webui. - A person’s own key, as
Authorization: Bearer <key>or in the URL (/mcp/k/<key>) for clients that cannot send headers, such as a Home Assistant pipeline.novak person addandnovak person keyprint it once. A person’s key cannot be used to claim to be someone else.
Household: /mcp/household with the household key (or /mcp/household/k/<key> for clients that cannot send headers) (novak gateway household-key), for satellites.
Setting it up
Section titled “Setting it up”.env:GATEWAY_ENABLED=true,GATEWAY_BIND=<Tailscale IP>,GATEWAY_HA_TOKEN(a Home Assistant token, for confirmations; use its own, not the drift or ingest token). Thennovak up, which builds the image, writesgateway.env(only the credentials the directory names, mode 600) and starts the gateway.- Everyone is a person:
novak person add tmeuzeasks for their sign-in name, the email Open WebUI knows them by, a Ticker category (or Home Assistant notify service) for confirmations, and whether to create their Hindsight bank, then which existing entries are theirs. Credentials for each entry are set the usual way (novak secret set TUDUDI_TUI_API_TOKEN). - Household:
novak person share brave-search hindsight-household, thennovak gateway household-key. - Open WebUI: an admin registers one MCP connection to
http://gateway:8000/mcpwith the trusted-client key as a bearer token and a custom headerX-Novak-Userfilled with the signed-in user’s email (Open WebUI fills template tokens per request; VERIFY the exact token name on the running version). Remove the old per-service connections it replaces. - Home Assistant: one Assist pipeline per person whose agent’s MCP server is
<gateway>/mcp/k/<their key>. The household pipeline for satellites uses/mcp/household. Identity comes from which pipeline a device selects.
Addresses that are secrets
Section titled “Addresses that are secrets”Some endpoints carry their credential in the URL (HA-MCP’s private path, for
instance). Such an entry names the variable instead of writing the address:
url_env: HA_MCP_URL. The variable is treated as a secret (novak secret set HA_MCP_URL, shown masked, never printed by novak registry), is passed to the
gateway like any token, and the entry is skipped with a reason while it is unset.
novak add mcp asks whether the URL is secret.
Keys for apps, and roles
Section titled “Keys for apps, and roles”Give each app its own key with a role, so it can reach only what it needs and can be turned off alone (decision #89). A role only takes away: a key never reaches anything its person does not have, and a connection’s own headers can narrow it but not widen it.
novak role listnovak key create tmeuze --role code-memory --label "Cursor on laptop" --expires 180dThe key is shown once. The gateway keeps only its hash, in registry/keys.yaml, and rereads that file by
itself. novak key list shows each key’s role, expiry and last use. novak key rotate ID gives it a new
secret and stops the old one at once; novak key revoke ID turns it off. Both take effect from the key’s
next request. Run these on the host, in your own terminal: whatever records that terminal records the key.
| Role | Reaches | May |
|---|---|---|
personal |
Everything the person has | Everything; removals still ask their phone |
read-only |
The person’s entries, the house state, the tasks snapshot, profile and mail | Read. No web search |
code-memory |
code-memory-* entries, recall and retain only |
Read and add |
house-control |
The house tools | Read and change; their own limits and approvals still apply |
Your own roles go under gateway.roles in gateway.yaml: entries (globs over entry names), builtin
(any of house, tasks, profile, mail, web), actions (read, append, modify, destructive)
and optionally tools (globs over <alias>__<tool>). A built-in role cannot be redefined. A role or key
that does not make sense is refused, not guessed at; novak gateway check says why. A keys.yaml that
cannot be read refuses every issued key.
read is judged from a tool’s name unless tool_overrides says otherwise, and a name that also says it
writes counts as a write. A badly named tool could still change something under read-only (VERIFY the
tools of each service you rely on this for). Web search and mail keep their other conditions: a connection
still has to name them in its headers.
A person’s older single key (novak person key) keeps working and has no role, so it reaches everything
they have. Open WebUI keeps its own client key, which vouches for whoever is signed in. These keys open
Novak’s gateway only: not the model router, and not any service behind the gateway.
A coding tool. Make a code-memory key, then add the gateway to the tool as a remote MCP server at
http://<this host's tailnet address>:13410/mcp with the header Authorization: Bearer <key>. The
memory bank has to exist: novak gateway banks creates any that is missing. Setup in each particular
coding tool is not yet tested (VERIFY).
Which tools each entry offers
Section titled “Which tools each entry offers”A model given every tool a service has does worse: it spends its context on
definitions and goes exploring. On the first live use through Open WebUI a
read-only question made a 14B model reach for delete_knowledge_node among 55
tools (the gateway held it and nothing was removed, which is the point of the
hold, but it should not have been offered the chance so readily). tool_filters
in gateway.yaml limits each kind of entry to the tools people use, by glob on
the entry name: allow keeps only the listed tools, deny removes more. A
filtered tool is not listed and cannot be called by name. Removal tools that
stay on the list still need confirmation. The shipped defaults give Hindsight
16 tools and Outline 11; Tududi is unfiltered until its tool list is seen.
Open WebUI: people, groups and models
Section titled “Open WebUI: people, groups and models”Three things that look like one setting, and each can hide the others:
- A person is a person once they sign in. Their Open WebUI account appears the
first time they use Continue with Inti, as a plain User. The gateway recognises
them by the email Open WebUI has for them, which must match
people.yaml. - Groups follow Inti, not Open WebUI.
OWUI_OIDC_GROUP_MANAGEMENTis on: at every sign-in Open WebUI removes the user from any of its groups whose name is not in their Intigroupsclaim, as long as the claim has at least one group. A group you build by hand in Open WebUI and fill by hand (for example “Users Novak”) loses its members the next time they sign in, unless an Inti group has exactly that name and they belong to it. Name the Open WebUI group after an Inti group, or turn group management off and manage groups in Open WebUI only. - API keys are off until switched on. A group’s API Keys permission does
nothing while
OWUI_ENABLE_API_KEYSis false; set it true in.envandnovak up.
If someone cannot see a shared model or the Workspace tab, the quickest check is what the server itself thinks they may read (their groups, the model grants, and their permissions); a stale browser session that predates the sharing is the other usual cause, and a reload or sign-out and in fixes it.
Entries and people
Section titled “Entries and people”An entry (in mcp-servers.yaml) holds one credential, so it belongs to one
person or to the household, never two people. novak person attach refuses to
give one entry to two people; check reports it. Tududi’s sharing between
accounts happens inside Tududi, so each person just has their own entry.
Commands
Section titled “Commands”novak person add NAME |
create a person, optionally their memory bank, and a gateway key |
novak person list |
who exists and what is theirs |
novak person attach/detach NAME ENTRY... |
their entries |
novak person share/unshare ENTRY... |
household entries |
novak person key NAME |
new key (the old one stops working) |
novak gateway client NAME |
a trusted client key |
novak gateway household-key |
the satellites’ key |
novak gateway status / check / audit [person] |
health, directory problems, accounting |
Limits, honestly
Section titled “Limits, honestly”- The gateway holds every credential and sits in every request path. It is the most valuable thing here to compromise and a single point of failure.
- A held removal blocks the calling request while it waits. A client with a short timeout may give up first, and the approval then does nothing because it expires.
- Tool classification is by name.
tool_overridesingateway.yamlfixes a misleading one. An unknown name counts as an update: allowed and logged. - Hindsight’s own port is still open until step 5 of the plan in identity.md (close it to everything but the gateway). Until then a person who knows the shared key can still reach any bank directly.
- Not built: per-person self-service for pasting a key (an admin enters it), streaming responses (replies are plain JSON), and resources and prompts (only tools are proxied).
Approve and Deny buttons
Section titled “Approve and Deny buttons”A person whose notify is {kind: ha, service: <name>} gets a Home Assistant
notification with real Approve and Deny buttons (plus a Review link). service
may be a notify service (mobile_app_pyrite), a list of them, or a name from
notify_groups in gateway.yaml (mgmt: [mobile_app_pyrite, mobile_app_aquarius] sends
to both phones; whichever presses first decides, and a decision is final).
With approval_helper set the notification has no link: the review page is on the tailnet, so a tap on the body just opens the app. A button press is an event inside Home Assistant (mobile_app_notification_action). The
gateway cannot subscribe to events without an admin token, and it should not hold one, so
the press is passed on through a helper the gateway can read with its ordinary token:
- Settings, Devices & services, Helpers, Create helper, Text. Name it
novak_approval, maximum length 255 (entityinput_text.novak_approval). - One automation: trigger Event
mobile_app_notification_action; action input_text.set_value on that helper with the value{{ trigger.event.data.action }}. Add a condition so only Novak’s presses count: the action starts withNOVAK_. - In
gateway.yaml:approval_helper: input_text.novak_approval.
While a confirmation is waiting the gateway reads the helper every second and a half, and acts only on an action carrying that approval’s own token. Nothing polls when nothing waits. A press takes a second or two to land. If the helper or automation is missing, the buttons do nothing and the Review link still works.
The approvals page
Section titled “The approvals page”Buttons tell you less than the call itself, so a tap on the notification opens a page in Home Assistant that shows what is being asked, with Approve and Deny. The gateway’s token is not an admin one and cannot publish a sensor state, but it can call services, so it fills a second helper and the page reads that:
- Helper: Text, name
novak_pending, maximum length 255 (input_text.novak_pending). - Two scripts that write the decision to the approval helper, using the token in the pending one:
novak_approvesetsinput_text.novak_approvaltoNOVAK_APPROVE_{{ (states('input_text.novak_pending') | from_json).t }}, andnovak_denythe same withNOVAK_DENY_. Both do nothing when the pending helper is empty. - A dashboard (URL path
novak-approvals, viewapprovals) with a Markdown card that shows{{ (states('input_text.novak_pending') | from_json).who }}and.do, and two button cards that run the scripts. - In
gateway.yaml:pending_helper: input_text.novak_pendingandapproval_page: /novak-approvals/approvals.
With several requests waiting the page shows the newest; the notification buttons on each phone still carry their own request’s token, so none is lost.
Narrowing a connection: X-Novak-Scope
Section titled “Narrowing a connection: X-Novak-Scope”A connection may send X-Novak-Scope: <entry glob>[, ...] to see only some of the entries
its person may already use (ha-* for the house alone). It only ever narrows: a scope cannot
add an entry the person is not allowed, and a call outside it is refused as an unknown tool.
Open WebUI uses it to give a “Home” preset a connection that offers just the house tools, since
a preset can switch on a whole connection but not individual tools.
Approvals through Supernotify
Section titled “Approvals through Supernotify”notify: {kind: supernotify, target: person.tyler_meuse} (set with novak person set NAME --supernotify person.tyler_meuse) sends the confirmation through Supernotify,
a Home Assistant integration. It reads each person’s phones from Home Assistant’s own people, so a new
phone is added in Home Assistant and nothing here changes. The call carries the Approve and Deny buttons
and the page a tap opens; the press comes back through the same automation and helper as before
(the buttons). notify_default takes a list of people, for anything that is
not one person’s.
The call’s shape was checked against a live install, because a wrong guess is not harmless: actions,
delivery and dry_run go at the top level of the call (inside advanced they are passed to the phone
as plain data), and delivery.mobile_push.target is a list. A simulated call (dry_run: simulate) sends
nothing and is not recorded.
Lean tool lists: X-Novak-Tools and the house tools
Section titled “Lean tool lists: X-Novak-Tools and the house tools”A model can only use the tools that fit in its context. The models here have an 8,192-token window; Home Assistant’s own tools are about 21,000 tokens of definitions for the house alone and the gateway offers 79 tools in all (about 34,000). A model given them loses the start of its prompt, so it ignores its instructions and invents arguments.
X-Novak-Tools: <glob>[, ...]limits one connection to the tools whose namespaced name (<entry>__<tool>) matches. Like the scope header it only narrows. The Open WebUI registry uses it to give the main connection a short list and the Home connection only the house tools. The token counts measured before decision #87 no longer hold (VERIFY).- The house tools (
house__house_state,house__lights_setand the four in Thermostats, fans, media and scenes; their definitions are about 2,900 characters, roughly 700 tokens, VERIFY) are built into the gateway and call Home Assistant’s REST API directly (house: {ha: 1, people: [tmeuze]}ingateway.yaml; blank turns them off).hais the instance id: the gateway readsGATEWAY_HA_URL(the address of that instance) and the secretHA_1_ADMIN_API_TOKEN, a long-lived token of a dedicated admin user (HA lets only an admin render the template that finds floors and areas). Only the listed people get them, the household never does, and the model never sees the token: the gateway calls two endpoints, one template and a fixed set of services. The light tools take floor and area names (“floor 2” matches areas labelledL2), resolve the lights themselves, and an unknown name returns an error that lists the real ones. Lights need no confirmation. A change shows in Home Assistant’s state a few seconds later, so the prompt tells the model to trust the result oflights_setinstead of re-reading straight away. - Profiles (
<username>__profile, for exampletmeuze__profile, about 60 tokens) serve a person’s standing instructions: how to talk to them, how to plan with them, what to hold them to. The text is one file per person,profiles/<username>.mdin the registry directory on the host (private, never in the repo;registry/profiles/example.mdis a model). It is read each time, so an edit takes effect at once. Only that person gets the tool, and only when their file exists. The household never does. The tool’s description tells the model to call it once at the start of every conversation, which is why no shared prompt has to name a per-person tool. Keep it to about 250 tokens; it is cut at 4,000 characters. - Mail (
mail__mail_state,mail__mail_search,mail__mail_read) is built in too, on MailFlow 4.3.0 or later. See Mail. - The tasks snapshot (
tasks__tasks_state, about 100 tokens) is built in the same way on the person’s own Tududi entry (the first entry whose name starts withtududi). It readslist_tasksfor today and upcoming, drops the seventy-odd fields Tududi returns per task, and answers with a few lines: overdue, due today, the next seven days, later or undated, each task as#id name | due | priority | status. “Today” follows the gateway’sTZ(set fromINGEST_TZ). Completing or adding goes through the ordinary Tududi tools, which take the ids shown. It reads only, and people without a Tududi entry do not get it.
Thermostats, fans, media and scenes
Section titled “Thermostats, fans, media and scenes”climate_set, fan_set, media_set and scene_run change them, and house_state with what reads
them. The limits are enforced by the gateway (decision #87):
house: ha: 1 people: [tmeuze] climate: entities: [climate.l1_thermostat, climate.l2_thermostat] # globs; none listed means no thermostats # min: 60 # default 60 to 80 Fahrenheit, or 16 to 27 Celsius # max: 80 # off_needs_approval: true # media: {max_volume_pct: 80} # exclude: ["media_player.childs_tv"] # hidden from fans, media, scenes and thermostats- Thermostats are seen only if listed, because Home Assistant often has more climate entries than thermostats (room controllers, overrides, a car). A temperature outside the limits, or outside the thermostat’s own, is refused. One request changes every named thermostat or none: an unknown name, a bad value or one temperature given to a thermostat that holds a range changes nothing. A thermostat that is not responding is skipped and named. Turning one off asks the person’s phone. After sending, the gateway reads the thermostats back for about eight seconds and reports each as confirmed or not.
- Fans go on, off or to a speed.
- Media commands go only to players that are on and support them. Players that share a name get one command. Only pause and stop may go to every player. Volume is capped. It does not choose what to play.
- Scenes run without asking only when they list nothing but lights, fans and media players. Any other, including one that does not list its contents, asks the person’s phone.
excludedoes not hide lights.
These tools see everything the admin token sees. Home Assistant’s “expose to Assist” setting does not
limit them. Use exclude for anything Novak should leave alone.
Status for the console: GET /admin/today
Section titled “Status for the console: GET /admin/today”The console’s Today page reads one read-only endpoint. It has its own key (novak gateway admin-key, stored as
the hash admin.key_sha256 in gateway.yaml, and as CONSOLE_GATEWAY_KEY for the console), and that key opens
this path and nothing else: it cannot list or call a tool, and it cannot decide an approval. With no key configured
the path answers 401 to everyone.
It returns counts since local midnight, the latest audit rows (who, which tool, what was decided; never arguments,
results or what a person said), and pending and recent approvals without their tokens (the token is the capability to
decide, so it never leaves the gateway except in the phone notification). ?person=<name> narrows everything to one
person; the console applies it for anyone who is not an admin.
Set approval_page in gateway.yaml to where a tap on the notification body should go: a path inside Home
Assistant, or the console’s Approvals page (https://<console>/approvals). It is sent as both clickAction
(Android) and url (iOS); without it the app opens on whatever page it last showed. On iOS the Approve and
Deny buttons appear only when the notification is long-pressed or expanded, which is how iOS shows any
notification actions. VERIFY: that url makes an iOS tap open the page, which was not yet tested.
Changes the console asks for: POST /admin/changes
Section titled “Changes the console asks for: POST /admin/changes”The console is the configuration plane but never the decider. To change something it posts
{person, action, ...} here with its change key (novak gateway change-key, kept as the hash
admin.change_key_sha256; a different key from the read-only status key, which cannot ask and cannot
be used to ask). The gateway checks the action against a short fixed list, checks the parameters and that
the entry is one of that person’s own, then holds the request exactly like a removal asked for through
Open WebUI: a notification with Approve and Deny, a wait, and only on Approve does it call the entry’s
tool as that person with that person’s own credential. Denied or unanswered, nothing happens. The audit
records it with via: console. At most three requests per person may wait at once, so a stolen key can make
a phone buzz three times and nothing more.
Today’s one action is forget_memory ({bank, memory_id}): it calls invalidate_memory on the person’s own
hindsight-<name> or code-memory-<name> entry, which retires the memory without erasing it and can be
reversed with restore. The household bank is not on the list.
Mail, read only, through MailFlow
Section titled “Mail, read only, through MailFlow”The gateway can show a person what in their mail needs them. mail_state lists the unread messages that
look like they are from a person or need action, and counts newsletters, promotions and automated mail by
sender instead of listing them. mail_search finds messages, and mail_read opens one as short plain
text. Messages are cut at about 2,500 characters and links are replaced with [link].
Set it up (you need MailFlow 4.3.0 or later):
- In MailFlow, as the person: Settings, Security, API tokens. Make a token with only the Read scope. MailFlow then refuses anything that would change mail. Tokens expire (the longest choice is a year), so note the date.
- In
gateway.yamlon the host, set the address and who gets the tools:mail: {instance: 1, url: "https://your-mailflow", people: [tmeuze]}.instancenumbers your MailFlow, and the address is the one the gateway container can reach. novak secret set MAILFLOW_1_TMEUZE_API_TOKEN(the name follows the instance number and the person), thennovak upandnovak owui apply.- In Open WebUI, pick the Mail preset and ask what needs you.
Why it is separate. Mail is the one source anyone in the world can write into, and a message can be
written to look like an instruction. So the gateway offers mail tools only to a connection whose
X-Novak-Scope names mail, and on that connection it refuses everything that isn’t a read: no lights, no
new tasks, no memory writes, whatever the model decides. The household, voice pipelines and the everyday
presets never get the tools. Each result also tells the model that the text is data. Those instructions
help, but the read-only rule is what you can rely on. The Mail preset runs on a local model, and mail
should never be sent to a hosted one.
Web search
Section titled “Web search”web__search gives a model five results from the Brave Search API: title, address, age when Brave gives
one, and a short excerpt. The gateway never opens a result.
Set it up:
novak secret set BRAVE_API_KEY(a key from Brave’s search API).- In
gateway.yamlon the host, list who may search:web: {people: [tmeuze]}. novak up, thennovak owui apply.
Who has it. A listed person, on a connection whose X-Novak-Tools names web__. A catch-all such as
*, or no tool list, does not count. In the shipped presets only Novak and Novak Deep name it. A
connection that reads mail never searches, whatever it asks for, and neither does the household.
What leaves the host. The search words go to Brave. The gateway refuses a query over 200 characters, or one holding an email address or a run of nine or more digits. It cannot recognise a name, an address or a health detail, so keeping those out depends on the model following its prompt. The audit records that a search happened and whether it worked, never the words.
Limits. 20 searches per person in 10 minutes, kept at least a second apart. The counts reset when the gateway restarts. Brave applies its own monthly limit to the key.
A chat that has searched can only search and talk (decision #86). Results are fenced and labelled as data, but a label does not stop a model from obeying them, so the gateway does. Once results reach a chat, it refuses every other tool there, reads included: no lights, tasks, notes, memory or profile. It also returns results only once per message, so a result cannot start a second search in the same turn. Ask for anything else in a new chat. When one request needs both, the other tools have to run first.
The gateway knows the chat from X-Novak-Chat, and the message from X-Novak-Message, which Open WebUI
fills in. It remembers a searched chat for 90 days, across restarts. A client that sends no chat id is held
for that person as a whole for 30 minutes after a search, and gets no one-per-message limit.
What this does not cover. A result can still shape what the model says, including false statements and links, so check what matters. In a later message, a result could steer another search toward something already in the chat. Whether Open WebUI loads a remote image that a reply links to, which would send the address to another server, has not been checked (VERIFY). A copy or branch of a searched chat has a new id, so the gateway does not recognise it. Another client’s own tools are outside the gateway’s control.
When a service is down
Section titled “When a service is down”If a service a connection uses cannot be reached, the connection gets one extra tool,
novak__services_down, whose description names what is not working and tells the model not to guess, not to
substitute silently and not to claim the action happened. A failed call says the same. The gateway then waits
30 seconds before trying that service again, and gives up on connecting or listing after 8 seconds per try,
so one dead service delays a chat once rather than every time. A service that is switched on but has no
address or credential counts as down. The model still has to follow the notice. VERIFY: how reliably each
local model does.
See also
Section titled “See also”| Read | For |
|---|---|
| identity.md | Why the gateway exists, and the reasoning behind who can see what |
| cli.md | The novak gateway and novak person commands in full |
| home-assistant.md | Connecting Home Assistant agents and the approvals dashboard |
| ingest.md | The service that adds notes and tasks through the gateway as a person |
| decisions.md | Why each piece is the way it is, one entry per choice |