# Guest access: someone outside the business asks your Knowledge

Only where `features.knowledge_guests` is available. A **guest** is one person outside the
business (an agency, a contractor, an adviser) with a link to ask the parts of Knowledge the owner
picks, until a date the owner sets. Say "guest" and "Guest access" to the owner, never "key" unless
they ask about the developer form.

Who may: the account owner, or someone at the Owner level, from their own Claude Code. Never a
team member at View or Full, never while Claude Code acts for the owner, never our staff giving or
changing access (staff may see and end it), never the Hub Key. A refusal says who may; relay it
and stop. On the Claude and ChatGPT connector the owner can list guests, read a guest's log, end
access or narrow it; giving access, a new link or wider access there becomes a card for the owner
in the hub, and chat never sees a key.

## Tools

| Want | Call |
|---|---|
| Who has access, what they read, ends, answers this month, places | `awesomate_knowledge_agents {action:'guests'}` |
| What one guest asked (newest first, 50 at a time) | `awesomate_knowledge_agents {action:'guest_log', guestId, limit?, cursor?}` |
| Give access | `awesomate_knowledge_agents_change {action:'guest_give', name, collectionIds?, tags?, endsInDays? or endsAt?, cap?, keepQuestions?}` |
| Change it (applies within seconds; `collectionIds` replaces only their collections and `tags` only their tags, `[]` clears that part) | `awesomate_knowledge_agents_change {action:'guest_update', guestId, ...any of the same fields}` |
| A new link (the old one stops) | `awesomate_knowledge_agents_change {action:'guest_roll', guestId, confirm:true}` |
| End it for good | `awesomate_knowledge_agents_change {action:'guest_remove', guestId, confirm:true}` |

## Before `guest_give`, ask the owner

1. **Who** it is for, in their words ("Jordan, ads manager"). The name is a person's name: say it
   only to the owner.
2. **What they can read**: one or more collections (`awesomate_knowledge_collections list`) or
   tags, or both. There is no "everything". Documents only the owner can see are never shown to
   a guest, whatever is picked.
3. **How long**: 7, 30, 90 (the default), 180 or 365 days, or a date within a year.
4. **Answers a month**: left out, half the account's monthly answers. A guest's answers count
   toward the account's.
5. **Keep their questions** for 30 days (on unless they say no): the owner sees what was asked,
   and the guest is told when they ask.

Then call once. If a give or roll gets no answer or a 5xx, call it again once with exactly the
same details: the hub hands back the same guest and key, never a second one. Any other way, list
`guests` first: an earlier attempt may have gone through.

To narrow what a guest reads to one collection, send `collectionIds` and `tags: []` together:
sending only `collectionIds` keeps the tags they had.

## The key is shown once

`guest_give` and `guest_roll` return `ready`: `ask_link` (what most guests use: it opens in a
browser), `claude_code` (a command for a guest who uses Claude Code, when present) and `api_key`
(for a developer). Show all three to the owner, on their screen, with the line the answer's note
gives, word for word. Then:

- never write the key or the link to a file, page, message, email, task, commit or any other
  tool's input, and never send it to the guest yourself: the owner sends it;
- never repeat it later in the conversation; if the owner lost it, `guest_roll` gives a new one.

Every other answer (`guests`, `guest_log`, `guest_update`, `guest_remove`) never shows a key.

## Ask before roll and remove

Both stop a link that someone is using. Say what happens in the words the answer's note gives,
then call with `confirm:true` only after the owner says yes. Roll when someone new takes over, or
when the link may have gone further than it should (a guest whose `places` is above 2 is the hint).

## Reading the log

`where` is `ask_page` (the Ask link), `ai_app` (an AI app such as Claude Code) or `api`.
`question` is there only while their questions are kept, and only for the owner. Summarise
("12 questions this week, all from the Ask page"), and quote questions only when asked.
