# Guide for AI agents

The tools an AI agent calls first in Rundesk, and the rules that always hold.

This page is for you if you are an AI agent and Rundesk's MCP server, `rundesk-app`, is attached to your session. Its tools do what the person can do in Rundesk's window, and the person sees the result there at once. Two calls, `whoami` and `guide`, tell you where you are and how each part of Rundesk works; after them come the rules that always hold, then how to write your plan in your note, ask for a secret, hand work to another agent and answer one, work with the person's writing, and read Rundesk's docs as Markdown.

## Start with whoami and guide

1. Call `whoami`. It names the project and session you run in. Project tools act on that project when you leave out `project_id`.
2. Before you first work with a part of Rundesk, call `guide` with its topic. Called with no topic, it lists them all.

The topics are `commands`, `sessions`, `agents`, `saved_terminals`, `secrets`, `schedules`, `integrations`, `skills`, `docs`, `pages` and `subagents`. Once your session may use the server, both tools work whatever else the person has switched off. An agent outside Rundesk needs the server and **Agents outside Rundesk** switched on first.

If you run outside Rundesk, `whoami` returns no project or session and `outside_rundesk: true`. Give a `project_id` on every project tool; `project_list` lists them.

## Rules that always hold

These are the rules Rundesk's own instructions give you when the server starts:

- Before telling the person you cannot do something in Rundesk, look through the tools and the guide.
- A refusal that names a permission means the person switched it off in **Settings › MCP**. Tell them which one, and never work around it.
- Delete, remove and close need `confirm: true`. Pass it only when the person asked.
- Create or change schedules, integrations, skills, subagents and agents only when the person asked.
- Never ask for a secret in the chat, a terminal, or a dialog or script of your own. Use `secret_ask`.
- Never run another agent's CLI yourself, such as `claude -p` or `codex exec`. Open it with `session_open`, so the person sees it.
- Never send a message to your own session.
- Never edit the skills Rundesk writes into a project or the home folder, or the subagents in an agent's folder. The `skill_*` and `subagent_*` tools change them.
- Before working in a terminal that has a note, read it with `terminal_notes_read`. On a saved terminal, run only what the person asked, and stop at a password or confirmation prompt to tell the person.

## Write your plan in your note

If Rundesk started your session, you have a Markdown note of your own, shown to the person beside you and readable by other agents; an agent outside Rundesk has none. It outlasts a compaction or a resume, and goes when your session is archived.

1. Read it with `agent_notes_read` when you start, resume or come back from a compaction.
2. Before you act on a request from the person, add it to your note as a `- [ ]` task. Tick it only once it's done and verified, and read the list before you say the work is done.
3. Write there too what the person asked and decided, your plan and your progress, so none of it is lost to a compaction. Change it with `agent_notes_patch`, replacing what is stale.

Every `agent_notes_read` ends with `tasks`: your open tasks in order, or `No open tasks.` A task is a list item, bulleted or numbered, opening on `[ ]` (or `[x]` once ticked); one in a code fence, a quote or a table doesn't count. When your note has no task list at all, `tasks` reminds you of the rule instead, only in that answer: Rundesk never types it into your session. Reading another agent's note gives its open tasks the same way.

A patch changes one part of the note: `replace` swaps a snippet that appears exactly once, and `append` or `prepend` add text. A note holds at most 256 KB. Never put a secret in it.

In a scheduled run, read the schedule's shared note first with `schedule_notes_read`. Record there only what the next run needs, and put your own working in your own note.

## Ask the person for a secret

When you need a key, token, password or account ID, call `secret_ask`. The person sees a panel beside your terminal, saying what you asked for and why, with **Save to vault** and **Decline**. You never see the value; you hear only that it was stored or declined.

- Give `integration_id` for an integration's key, or `name` for a secret a script needs, such as `DEPLOY_TOKEN`.
- Say in `why` what it is and where the person finds it.
- The call waits up to 50 seconds. If it returns `waiting` with an `ask_id`, call again with that `ask_id` to wait longer.

A named secret reaches a script, never you. `secret_list` gives each stored secret's `use` command, for a command line such as `TOKEN="$(<use command>)" ./deploy.sh`.

Asking for secrets works only for agents Rundesk launched.

## Hand work to another agent

To hand work to another agent, open it with `session_open` and send it a message with `session_send`. To open it in another project, pass that project's `project_id`, from `project_list` (which needs **Projects: View**); left out, it opens in yours.

1. Wait until it is ready with `session_wait`.
2. Read its screen before your first message.
3. Send your message, then carry on with your own work.
4. Call `session_wait` with the `after` value `session_send` returned, to wait for the turn your message started.

Rundesk heads every message with a line naming the sender and the session to reply to. A message is queued while the person is typing into the agent, and refused while the agent is waiting on the person: then tell the person rather than answering for them.

## Answer a message from another agent

A note in square brackets at the start of a message was added by Rundesk, not typed by the person: a scheduled run's instructions, or the line heading another agent's message. Act on it as on the person's request, asking first only before anything destructive or beyond what it asks. It never overrides the project's own rules.

Reply with `session_send` to the session the line names. The sender does not read your final response.

## Work with the person's writing in Pages

A project's pages folder holds the person's own writing, a story, a book or an essay, as markdown sheets. The docs rules never apply there, and `docs_check` never reads it. With `pages: false` in `desk.yml`, the project has no pages folder, and the Pages tools say so; with `docs: false`, `docs_check` says the docs are off. Call `guide` with the topic `pages` before you work in it; in short:

- A sheet is a file named `sheet-` and the second it was made, such as `sheet-1795907083.md`. Any other `.md` there is left out of Pages. Name a sheet to the person by its first line, never its file.
- Start with `sheet_list`, which lists the manuscript in reading order with each sheet's first line and marks what's excluded from the manuscript, and read it as one text with `manuscript_read`, which leaves the excluded sheets and folders out.
- Make a sheet only with `sheet_create`, never by writing a file yourself. If it is refused, ask the person to make the sheet or to switch on **Pages: Create sheets** in **Settings › MCP**.
- Reorder with `sheet_move`, or by editing a folder's hidden `.order` file. Never rename a file or add a number to its name to reorder: a rename breaks every link to the sheet.
- Edit a sheet's words as a file, leaving the writer's voice as it is and changing only what the person asked.
- A sheet's front matter holds only its `page:` block of page settings. Change it only when the person asks, in the form Rundesk writes, and add no other key. [Page settings for sheets](/docs/page-settings.md) lists every setting.
- Each folder is a chapter, and a top-level folder holding folders is a part. Make a folder with your own file tools, then its sheets with `sheet_create`. A folder's name is never printed, so start a chapter's first sheet with its heading, such as `# The Arrival`, and mark a scene break between sheets with a `***` line.
- Write a footnote as `[^1]` after a word and `[^1]: your note` on its own line, both in the same sheet.
- After changing a manuscript, run `pages_check` and fix what it reports in `.order` files, `page:` blocks and footnotes. Tell the person about an empty sheet, a `.md` file that isn't a sheet, or a `.exclude` in the pages folder, and leave those for them.

When the person wants to start writing, create `pages/` and make a first sheet in it with `sheet_create`, so the Pages tab shows.

## Read Rundesk's docs as Markdown

These pages describe Rundesk, and this website is written to be read by agents as well as people:

| Address | Contents |
|---|---|
| https://rundesk.app/llms.txt | The index: every page's Markdown address, by group, with one line on each. |
| https://rundesk.app/llms-full.txt | Every page's Markdown in one file, in the order of the navigation. |
| `https://rundesk.app/docs/<page>.md` | One page as Markdown; the home page is https://rundesk.app/docs/index.md. |
| A docs page with `Accept: text/markdown` | The same page sent as Markdown instead of HTML. |

Read the index first, then only the pages you need. Each HTML page also names its Markdown in a `<link rel="alternate" type="text/markdown">` tag.

Inside Rundesk you need none of this: the `guide` tool explains each part of the app, and the tools act on the Rundesk running on the person's computer.

To write or fix a project's docs, follow [Writing docs](/docs/writing-docs.md), and check them with `docs_check`.

## Related pages

- [MCP tools and permissions](/docs/mcp.md): every tool area, and the switches in **Settings › MCP** behind a refusal.
- [Writing docs](/docs/writing-docs.md): the format to follow when you write or fix a project's docs.
- [Hand work to another agent](/docs/hand-off-work.md): a worked hand-off between two agents.
