mercury-agent 0.5.0 → 0.5.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +452 -451
- package/container/Dockerfile +127 -127
- package/container/Dockerfile.base +109 -109
- package/container/Dockerfile.power +17 -17
- package/container/agent-package.json +8 -8
- package/container/build.sh +54 -54
- package/docs/ROADMAP.md +3 -4
- package/docs/archive/summarization/2026-07-02-recent-dev-summary.md +71 -0
- package/docs/auth/dashboard.md +28 -28
- package/docs/auth/overview.md +109 -109
- package/docs/auth/whatsapp.md +173 -173
- package/docs/authoring-profiles.md +174 -174
- package/docs/configuration.md +54 -54
- package/docs/container-lifecycle.md +349 -349
- package/docs/{bugs/bwrap-privileged-linux-docker.md → debug/major/2026-07-02-bwrap-privileged-linux-docker.md} +21 -1
- package/docs/{bugs/e2big-prompt-delivery-fix.md → debug/major/2026-07-02-e2big-prompt-delivery-fix.md} +27 -1
- package/docs/{bugs/registry-pull-no-local-fallback.md → debug/major/2026-07-02-registry-pull-no-local-fallback.md} +27 -1
- package/docs/debug/summarization/2026-07-02-common-bug-patterns.md +72 -0
- package/docs/deployment.md +199 -199
- package/docs/extensions.md +375 -375
- package/docs/graceful-shutdown.md +62 -62
- package/docs/kb-distillation.md +77 -77
- package/docs/media/overview.md +140 -140
- package/docs/media/whatsapp.md +171 -171
- package/docs/memory.md +137 -137
- package/docs/permissions.md +217 -217
- package/docs/pipeline.md +228 -228
- package/docs/prd-chat-memory.md +76 -76
- package/docs/prd-config-load.md +82 -82
- package/docs/rate-limiting.md +229 -229
- package/docs/runbooks/publish-checklist.md +9 -1
- package/docs/scheduler.md +288 -288
- package/docs/setup-discord.md +100 -100
- package/docs/setup-slack.md +119 -119
- package/docs/setup-whatsapp.md +94 -94
- package/docs/subagents.md +166 -166
- package/docs/web-search.md +62 -62
- package/examples/extensions/README.md +12 -12
- package/examples/extensions/charts/index.ts +13 -13
- package/examples/extensions/charts/skill/SKILL.md +98 -98
- package/examples/extensions/gws/README.md +52 -52
- package/examples/extensions/gws/skill/SKILL.md +57 -57
- package/examples/extensions/gws/skill/references/calendar.md +101 -101
- package/examples/extensions/gws/skill/references/docs.md +65 -65
- package/examples/extensions/gws/skill/references/drive.md +79 -79
- package/examples/extensions/gws/skill/references/gmail.md +85 -85
- package/examples/extensions/gws/skill/references/sheets.md +60 -60
- package/examples/extensions/napkin/skill/SKILL.md +728 -728
- package/examples/extensions/pdf/skill/LICENSE.txt +30 -30
- package/examples/extensions/pdf/skill/SKILL.md +314 -314
- package/examples/extensions/pdf/skill/forms.md +294 -294
- package/examples/extensions/pdf/skill/reference.md +611 -611
- package/examples/extensions/pdf/skill/scripts/check_bounding_boxes.py +65 -65
- package/examples/extensions/pdf/skill/scripts/check_fillable_fields.py +11 -11
- package/examples/extensions/pdf/skill/scripts/convert_pdf_to_images.py +33 -33
- package/examples/extensions/pdf/skill/scripts/create_validation_image.py +37 -37
- package/examples/extensions/pdf/skill/scripts/extract_form_field_info.py +122 -122
- package/examples/extensions/pdf/skill/scripts/extract_form_structure.py +115 -115
- package/examples/extensions/pdf/skill/scripts/fill_fillable_fields.py +98 -98
- package/examples/extensions/pdf/skill/scripts/fill_pdf_form_with_annotations.py +107 -107
- package/examples/extensions/permission-guard/index.ts +65 -65
- package/examples/extensions/pinchtab/skill/SKILL.md +224 -224
- package/examples/extensions/pinchtab/skill/TRUST.md +69 -69
- package/examples/extensions/pinchtab/skill/references/api.md +297 -297
- package/examples/extensions/pinchtab/skill/references/env.md +45 -45
- package/examples/extensions/pinchtab/skill/references/profiles.md +107 -107
- package/examples/extensions/tradestation/host/refresh.ts +102 -102
- package/examples/extensions/tradestation/index.ts +153 -153
- package/examples/extensions/tradestation/skill/SKILL.md +67 -67
- package/examples/extensions/voice-synth/index.ts +94 -94
- package/examples/extensions/voice-synth/skill/SKILL.md +38 -38
- package/examples/extensions/voice-transcribe/requirements.txt +8 -8
- package/examples/extensions/voice-transcribe/scripts/transcribe.py +179 -179
- package/examples/extensions/voice-transcribe/skill/SKILL.md +53 -53
- package/examples/extensions/yahoo-mail/cli/package.json +13 -13
- package/examples/extensions/yahoo-mail/skill/SKILL.md +78 -78
- package/package.json +106 -106
- package/resources/agents/explore.md +50 -50
- package/resources/agents/worker.md +24 -24
- package/resources/connection-env-vars.json +25 -25
- package/resources/pi-extensions/subagent/agents.ts +126 -126
- package/resources/pi-extensions/subagent/index.ts +964 -964
- package/resources/profiles/coding/AGENTS.md +43 -43
- package/resources/profiles/coding/mercury-profile.yaml +15 -15
- package/resources/profiles/general/AGENTS.md +31 -31
- package/resources/profiles/general/mercury-profile.yaml +15 -15
- package/resources/profiles/research/AGENTS.md +40 -40
- package/resources/profiles/research/mercury-profile.yaml +15 -15
- package/resources/skills/config/SKILL.md +25 -25
- package/resources/skills/context/SKILL.md +33 -33
- package/resources/skills/conversation-recap/SKILL.md +19 -19
- package/resources/skills/mutes/SKILL.md +31 -31
- package/resources/skills/permissions/SKILL.md +19 -19
- package/resources/skills/preferences/SKILL.md +31 -31
- package/resources/skills/recall/SKILL.md +24 -24
- package/resources/skills/roles/SKILL.md +18 -18
- package/resources/skills/spaces/SKILL.md +18 -18
- package/resources/skills/tasks/SKILL.md +45 -45
- package/resources/templates/AGENTS.md +157 -157
- package/resources/templates/env.template +38 -38
- package/resources/templates/mercury.example.yaml +99 -99
- package/src/agent/container-entry.ts +1 -1
- package/src/agent/container-runner.ts +1345 -1346
- package/src/cli/mercury.ts +39 -7
- package/src/cli/mrctl.ts +636 -636
- package/src/config-file.ts +540 -540
- package/src/config.ts +339 -339
- package/src/core/api.ts +125 -125
- package/src/core/caller-token.ts +101 -101
- package/src/core/permissions.ts +228 -228
- package/src/core/profiles.ts +271 -271
- package/src/core/routes/capability.ts +70 -70
- package/src/core/routes/index.ts +15 -15
- package/src/core/runtime.ts +1530 -1530
- package/src/dashboard/index.html +729 -729
- package/src/extensions/api.ts +273 -273
- package/src/extensions/loader.ts +286 -286
- package/src/extensions/types.ts +517 -517
- package/src/main.ts +605 -605
- package/docs/pending-updates/applicative-profiles.md +0 -15
- package/docs/pending-updates/caller-bound-capability-token.md +0 -15
- package/docs/pending-updates/dm-auto-space.md +0 -15
- /package/docs/archive/{2026-07-01-applicative-profiles.md → applicative-profiles/2026-07-01-applicative-profiles.md} +0 -0
- /package/docs/archive/{2026-07-01-caller-bound-capability-token.md → applicative-profiles/2026-07-01-caller-bound-capability-token.md} +0 -0
- /package/docs/archive/{2026-07-01-dm-auto-space.md → applicative-profiles/2026-07-01-dm-auto-space.md} +0 -0
|
@@ -1,24 +1,24 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: recall
|
|
3
|
-
description: Search past user and assistant messages in this space when the user asks what was said before, wants a fact from an earlier turn, or the current prompt does not include enough history. Use mrctl recall with keywords from the topic.
|
|
4
|
-
---
|
|
5
|
-
|
|
6
|
-
## Command
|
|
7
|
-
|
|
8
|
-
```bash
|
|
9
|
-
mrctl recall "<keywords or phrase>" [--limit N]
|
|
10
|
-
```
|
|
11
|
-
|
|
12
|
-
- Searches stored Mercury message history (case-insensitive substring match).
|
|
13
|
-
- Default `--limit` is 20 (max 100 on the server).
|
|
14
|
-
- Requires the same permission as `mrctl compact` (`compact`).
|
|
15
|
-
|
|
16
|
-
## When to use
|
|
17
|
-
|
|
18
|
-
- User references something from "earlier" or "before" and the pi session may be minimal or compacted.
|
|
19
|
-
- You need to verify an exact prior message without loading the full session into context.
|
|
20
|
-
|
|
21
|
-
## When not to use
|
|
22
|
-
|
|
23
|
-
- For durable notes and vault content, prefer `napkin search` (when the napkin extension is enabled).
|
|
24
|
-
- For the current conversation turn, rely on the user message and attached reply context first.
|
|
1
|
+
---
|
|
2
|
+
name: recall
|
|
3
|
+
description: Search past user and assistant messages in this space when the user asks what was said before, wants a fact from an earlier turn, or the current prompt does not include enough history. Use mrctl recall with keywords from the topic.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
## Command
|
|
7
|
+
|
|
8
|
+
```bash
|
|
9
|
+
mrctl recall "<keywords or phrase>" [--limit N]
|
|
10
|
+
```
|
|
11
|
+
|
|
12
|
+
- Searches stored Mercury message history (case-insensitive substring match).
|
|
13
|
+
- Default `--limit` is 20 (max 100 on the server).
|
|
14
|
+
- Requires the same permission as `mrctl compact` (`compact`).
|
|
15
|
+
|
|
16
|
+
## When to use
|
|
17
|
+
|
|
18
|
+
- User references something from "earlier" or "before" and the pi session may be minimal or compacted.
|
|
19
|
+
- You need to verify an exact prior message without loading the full session into context.
|
|
20
|
+
|
|
21
|
+
## When not to use
|
|
22
|
+
|
|
23
|
+
- For durable notes and vault content, prefer `napkin search` (when the napkin extension is enabled).
|
|
24
|
+
- For the current conversation turn, rely on the user message and attached reply context first.
|
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: roles
|
|
3
|
-
description: Manage user roles in the current space. Use when the user asks to grant or revoke permissions, make someone an admin, or check who has access.
|
|
4
|
-
---
|
|
5
|
-
|
|
6
|
-
## Commands
|
|
7
|
-
|
|
8
|
-
```bash
|
|
9
|
-
mrctl roles list
|
|
10
|
-
mrctl roles grant <platform-user-id> [--role <role>]
|
|
11
|
-
mrctl roles revoke <platform-user-id>
|
|
12
|
-
```
|
|
13
|
-
|
|
14
|
-
## Roles
|
|
15
|
-
|
|
16
|
-
- **admin** — full control over all features (default when granting)
|
|
17
|
-
- **member** — can chat with the assistant (default for new users)
|
|
18
|
-
- Custom roles can be created by assigning specific permissions
|
|
1
|
+
---
|
|
2
|
+
name: roles
|
|
3
|
+
description: Manage user roles in the current space. Use when the user asks to grant or revoke permissions, make someone an admin, or check who has access.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
## Commands
|
|
7
|
+
|
|
8
|
+
```bash
|
|
9
|
+
mrctl roles list
|
|
10
|
+
mrctl roles grant <platform-user-id> [--role <role>]
|
|
11
|
+
mrctl roles revoke <platform-user-id>
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
## Roles
|
|
15
|
+
|
|
16
|
+
- **admin** — full control over all features (default when granting)
|
|
17
|
+
- **member** — can chat with the assistant (default for new users)
|
|
18
|
+
- Custom roles can be created by assigning specific permissions
|
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: spaces
|
|
3
|
-
description: Manage spaces. Use when the user asks about spaces, wants to rename the current space, or delete space data.
|
|
4
|
-
---
|
|
5
|
-
|
|
6
|
-
## Commands
|
|
7
|
-
|
|
8
|
-
```bash
|
|
9
|
-
mrctl spaces list
|
|
10
|
-
mrctl spaces name [<name>]
|
|
11
|
-
mrctl spaces delete
|
|
12
|
-
```
|
|
13
|
-
|
|
14
|
-
## Details
|
|
15
|
-
|
|
16
|
-
- `list` — shows all spaces with display names (admin-only; members get 403)
|
|
17
|
-
- `name` — with no argument, shows current space name; with argument, renames
|
|
18
|
-
- `delete` — deletes the current space and all its data (irreversible)
|
|
1
|
+
---
|
|
2
|
+
name: spaces
|
|
3
|
+
description: Manage spaces. Use when the user asks about spaces, wants to rename the current space, or delete space data.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
## Commands
|
|
7
|
+
|
|
8
|
+
```bash
|
|
9
|
+
mrctl spaces list
|
|
10
|
+
mrctl spaces name [<name>]
|
|
11
|
+
mrctl spaces delete
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
## Details
|
|
15
|
+
|
|
16
|
+
- `list` — shows all spaces with display names (admin-only; members get 403)
|
|
17
|
+
- `name` — with no argument, shows current space name; with argument, renames
|
|
18
|
+
- `delete` — deletes the current space and all its data (irreversible)
|
|
@@ -1,45 +1,45 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: tasks
|
|
3
|
-
description: Manage scheduled tasks — create cron jobs or one-shot reminders that run prompts on a schedule. Use when the user asks to schedule something, set a reminder, or manage recurring tasks.
|
|
4
|
-
---
|
|
5
|
-
|
|
6
|
-
## Commands
|
|
7
|
-
|
|
8
|
-
```bash
|
|
9
|
-
mrctl tasks list
|
|
10
|
-
mrctl tasks create --cron "<expr>" --prompt "<text>" [--timezone "<IANA>"] [--silent]
|
|
11
|
-
mrctl tasks create --at "<ISO8601>" --prompt "<text>" [--silent]
|
|
12
|
-
mrctl tasks pause <id>
|
|
13
|
-
mrctl tasks resume <id>
|
|
14
|
-
mrctl tasks run <id>
|
|
15
|
-
mrctl tasks delete <id>
|
|
16
|
-
```
|
|
17
|
-
|
|
18
|
-
## Cron expressions
|
|
19
|
-
|
|
20
|
-
Standard 5-field cron: minute hour day-of-month month day-of-week
|
|
21
|
-
|
|
22
|
-
Examples:
|
|
23
|
-
- `0 9 * * *` — daily at 9am
|
|
24
|
-
- `*/30 * * * *` — every 30 minutes
|
|
25
|
-
- `0 9 * * 1` — every Monday at 9am
|
|
26
|
-
- `0 0 1 * *` — first day of each month
|
|
27
|
-
|
|
28
|
-
## One-shot tasks
|
|
29
|
-
|
|
30
|
-
Use `--at` with ISO 8601 timestamp for one-time execution:
|
|
31
|
-
- `--at "2026-03-05T10:00:00Z"`
|
|
32
|
-
|
|
33
|
-
## Timezone
|
|
34
|
-
|
|
35
|
-
**Always pass `--timezone`** when creating cron tasks. Infer the user's timezone from:
|
|
36
|
-
1. Explicit mention (e.g. "Israel time", "EST")
|
|
37
|
-
2. Language/locale context (e.g. Hebrew → "Asia/Jerusalem")
|
|
38
|
-
3. Prior conversation context
|
|
39
|
-
|
|
40
|
-
If you cannot determine the timezone, ask the user before creating the task. Never omit `--timezone` for cron tasks — omitting it causes the task to fire at UTC, which is almost never what the user intends.
|
|
41
|
-
|
|
42
|
-
## Options
|
|
43
|
-
|
|
44
|
-
- `--timezone "<IANA>"` — IANA timezone for cron evaluation (e.g. `"Asia/Jerusalem"`, `"America/New_York"`). Falls back to the agent's configured default timezone, then UTC.
|
|
45
|
-
- `--silent` — task runs but output is not sent to chat (useful for background work)
|
|
1
|
+
---
|
|
2
|
+
name: tasks
|
|
3
|
+
description: Manage scheduled tasks — create cron jobs or one-shot reminders that run prompts on a schedule. Use when the user asks to schedule something, set a reminder, or manage recurring tasks.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
## Commands
|
|
7
|
+
|
|
8
|
+
```bash
|
|
9
|
+
mrctl tasks list
|
|
10
|
+
mrctl tasks create --cron "<expr>" --prompt "<text>" [--timezone "<IANA>"] [--silent]
|
|
11
|
+
mrctl tasks create --at "<ISO8601>" --prompt "<text>" [--silent]
|
|
12
|
+
mrctl tasks pause <id>
|
|
13
|
+
mrctl tasks resume <id>
|
|
14
|
+
mrctl tasks run <id>
|
|
15
|
+
mrctl tasks delete <id>
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
## Cron expressions
|
|
19
|
+
|
|
20
|
+
Standard 5-field cron: minute hour day-of-month month day-of-week
|
|
21
|
+
|
|
22
|
+
Examples:
|
|
23
|
+
- `0 9 * * *` — daily at 9am
|
|
24
|
+
- `*/30 * * * *` — every 30 minutes
|
|
25
|
+
- `0 9 * * 1` — every Monday at 9am
|
|
26
|
+
- `0 0 1 * *` — first day of each month
|
|
27
|
+
|
|
28
|
+
## One-shot tasks
|
|
29
|
+
|
|
30
|
+
Use `--at` with ISO 8601 timestamp for one-time execution:
|
|
31
|
+
- `--at "2026-03-05T10:00:00Z"`
|
|
32
|
+
|
|
33
|
+
## Timezone
|
|
34
|
+
|
|
35
|
+
**Always pass `--timezone`** when creating cron tasks. Infer the user's timezone from:
|
|
36
|
+
1. Explicit mention (e.g. "Israel time", "EST")
|
|
37
|
+
2. Language/locale context (e.g. Hebrew → "Asia/Jerusalem")
|
|
38
|
+
3. Prior conversation context
|
|
39
|
+
|
|
40
|
+
If you cannot determine the timezone, ask the user before creating the task. Never omit `--timezone` for cron tasks — omitting it causes the task to fire at UTC, which is almost never what the user intends.
|
|
41
|
+
|
|
42
|
+
## Options
|
|
43
|
+
|
|
44
|
+
- `--timezone "<IANA>"` — IANA timezone for cron evaluation (e.g. `"Asia/Jerusalem"`, `"America/New_York"`). Falls back to the agent's configured default timezone, then UTC.
|
|
45
|
+
- `--silent` — task runs but output is not sent to chat (useful for background work)
|
|
@@ -1,157 +1,157 @@
|
|
|
1
|
-
# Mercury Agent Instructions
|
|
2
|
-
|
|
3
|
-
You are a helpful AI assistant running inside a chat platform (WhatsApp, Slack, or Discord).
|
|
4
|
-
|
|
5
|
-
## Destructive Operations — Confirmation Required
|
|
6
|
-
|
|
7
|
-
Before deleting, trashing, or permanently removing any data, you MUST stop and confirm with the user first:
|
|
8
|
-
|
|
9
|
-
1. **List exactly what will be affected** — names, count, and location
|
|
10
|
-
2. **Ask explicitly** — e.g. "This will permanently delete 12 files from your Google Drive. Reply YES to confirm."
|
|
11
|
-
3. **Wait for an unambiguous "yes"** — do not proceed until you have it
|
|
12
|
-
|
|
13
|
-
This applies to **all personal data**, regardless of where it lives:
|
|
14
|
-
- Connected accounts: Google Drive, Gmail, Google Photos, Yahoo Mail, and any other connected service
|
|
15
|
-
- Filesystem: any `rm`, `rmdir`, file deletion, or bulk removal from the user's files
|
|
16
|
-
|
|
17
|
-
**Always prefer the reversible option** — move to trash instead of permanent delete, archive instead of delete, move to a folder instead of remove. If the user hasn't explicitly asked for permanent deletion, choose the reversible path by default.
|
|
18
|
-
|
|
19
|
-
**Exception**: temp files the agent created during the current task (e.g., scratch files in `/tmp`) may be cleaned up without confirmation.
|
|
20
|
-
|
|
21
|
-
This rule applies even when the request implies deletion (e.g., "clean up", "organize", "clear out", "remove duplicates"). When in doubt, ask.
|
|
22
|
-
|
|
23
|
-
## Guidelines
|
|
24
|
-
|
|
25
|
-
1. **Be concise** — Chat messages should be readable on mobile
|
|
26
|
-
2. **Use markdown sparingly** — Not all chat platforms render it well
|
|
27
|
-
3. **Cite sources** — When searching the web, mention where information came from
|
|
28
|
-
4. **Ask for clarification** — If a request is ambiguous, ask before acting
|
|
29
|
-
|
|
30
|
-
## Limitations
|
|
31
|
-
|
|
32
|
-
- Running in a container with limited resources
|
|
33
|
-
- Long-running tasks may time out
|
|
34
|
-
|
|
35
|
-
## Presenting tool results
|
|
36
|
-
|
|
37
|
-
After running any command or tool, never send raw output to the user. Always translate into plain conversational language before responding.
|
|
38
|
-
|
|
39
|
-
- **Names only** — show the human-readable name; never show file IDs, message IDs, or thread IDs
|
|
40
|
-
- **Plain types** — say "Google Doc", "spreadsheet", "folder", "PDF"; never show MIME type strings
|
|
41
|
-
- **Simple lists** — numbered or bulleted with name + one-word type hint; no tables of raw fields
|
|
42
|
-
- **Errors** — explain what went wrong in plain terms; never show exit codes, stack traces, or raw error strings
|
|
43
|
-
- **Never show** — JSON blobs, bash code blocks, command flags, or API parameter objects in replies
|
|
44
|
-
|
|
45
|
-
This rule applies to all tools: Google Workspace, TradeStation, web search, and any future extension.
|
|
46
|
-
|
|
47
|
-
## Mercury Control (mrctl)
|
|
48
|
-
|
|
49
|
-
Full command reference for managing Mercury from inside the container:
|
|
50
|
-
|
|
51
|
-
### Identity
|
|
52
|
-
```bash
|
|
53
|
-
mrctl whoami # Show caller, space, role, permissions
|
|
54
|
-
```
|
|
55
|
-
|
|
56
|
-
### Scheduled Tasks
|
|
57
|
-
```bash
|
|
58
|
-
mrctl tasks list # List all tasks for this space
|
|
59
|
-
|
|
60
|
-
# Recurring tasks (cron)
|
|
61
|
-
mrctl tasks create --cron "0 9 * * *" --prompt "Good morning!" [--silent]
|
|
62
|
-
|
|
63
|
-
# One-shot tasks (at) — auto-delete after execution
|
|
64
|
-
mrctl tasks create --at "2026-03-02T14:00:00Z" --prompt "Reminder!" [--silent]
|
|
65
|
-
|
|
66
|
-
mrctl tasks run <id> # Trigger task immediately
|
|
67
|
-
mrctl tasks pause <id> # Pause a task
|
|
68
|
-
mrctl tasks resume <id> # Resume a paused task
|
|
69
|
-
mrctl tasks delete <id> # Delete a task
|
|
70
|
-
```
|
|
71
|
-
|
|
72
|
-
**Note:** Use `--cron` for recurring tasks or `--at` for one-shot tasks (ISO 8601, must be in the future).
|
|
73
|
-
|
|
74
|
-
### Space Configuration
|
|
75
|
-
```bash
|
|
76
|
-
mrctl config get [key] # Get config (all or specific key)
|
|
77
|
-
mrctl config set <key> <value> # Set config value
|
|
78
|
-
# Valid keys: trigger.match, trigger.patterns, trigger.case_sensitive,
|
|
79
|
-
# context.mode (clear|context), context.reply_chain_depth (1-50)
|
|
80
|
-
```
|
|
81
|
-
|
|
82
|
-
### Spaces
|
|
83
|
-
```bash
|
|
84
|
-
mrctl spaces list # List all spaces with names (admin-only)
|
|
85
|
-
mrctl spaces name # Get current space's display name
|
|
86
|
-
mrctl spaces name "My Space" # Set current space's display name
|
|
87
|
-
mrctl spaces delete # Delete current space + tasks/messages/roles/config
|
|
88
|
-
mrctl conversations list # List known conversations
|
|
89
|
-
mrctl conversations list --unlinked # Show only unlinked conversations
|
|
90
|
-
```
|
|
91
|
-
|
|
92
|
-
### Roles & Permissions
|
|
93
|
-
```bash
|
|
94
|
-
mrctl roles list # List roles in this space
|
|
95
|
-
mrctl roles grant <user-id> [--role admin] # Grant role to user
|
|
96
|
-
mrctl roles revoke <user-id> # Revoke role (becomes member)
|
|
97
|
-
|
|
98
|
-
mrctl permissions show [--role <role>] # Show permissions
|
|
99
|
-
mrctl permissions set <role> <perm1,perm2> # Set role permissions
|
|
100
|
-
```
|
|
101
|
-
|
|
102
|
-
### Control
|
|
103
|
-
```bash
|
|
104
|
-
mrctl stop # Abort current run, clear queue
|
|
105
|
-
mrctl compact # Permanent session reset (old messages excluded forever)
|
|
106
|
-
mrctl clear # One-shot clear (next run starts fresh, then reverts)
|
|
107
|
-
```
|
|
108
|
-
|
|
109
|
-
### Media
|
|
110
|
-
```bash
|
|
111
|
-
mrctl media clear # Purge inbox + outbox files
|
|
112
|
-
mrctl media clear --inbox # Purge received files only
|
|
113
|
-
mrctl media clear --outbox # Purge produced files only
|
|
114
|
-
mrctl disk # Show per-space storage breakdown
|
|
115
|
-
```
|
|
116
|
-
|
|
117
|
-
### TradeStation orders (when the tradestation extension is enabled)
|
|
118
|
-
Two-step flow: propose (no `--confirm`), human approves, then same command with `--confirm --pending-id <uuid>`.
|
|
119
|
-
```bash
|
|
120
|
-
mrctl tradestation order --account SIM… --symbol AAPL --quantity 1 --action SELL --type Market --duration DAY
|
|
121
|
-
mrctl tradestation order --account SIM… --symbol AAPL --quantity 1 --action SELL --type Market --duration DAY --confirm --pending-id '<uuid>'
|
|
122
|
-
```
|
|
123
|
-
Live (non-SIM) accounts require `MERCURY_TS_ALLOW_LIVE_ORDERS=true` on the Mercury host.
|
|
124
|
-
|
|
125
|
-
## Mercury Documentation
|
|
126
|
-
|
|
127
|
-
When users ask about mercury's capabilities, configuration, or how things work, read the relevant docs:
|
|
128
|
-
|
|
129
|
-
| Path | Contents |
|
|
130
|
-
|------|----------|
|
|
131
|
-
| /docs/mercury/README.md | Overview, commands, triggers, permissions, tasks, config |
|
|
132
|
-
| /docs/mercury/docs/pipeline.md | Adapter message flow (WhatsApp, Slack, Discord) |
|
|
133
|
-
| /docs/mercury/docs/media/ | Media handling (downloads, attachments) |
|
|
134
|
-
| /docs/mercury/docs/subagents.md | Delegating to sub-agents |
|
|
135
|
-
| /docs/mercury/docs/web-search.md | Web search capabilities |
|
|
136
|
-
| /docs/mercury/docs/auth/ | Platform authentication |
|
|
137
|
-
| /docs/mercury/docs/rate-limiting.md | Rate limiting configuration |
|
|
138
|
-
|
|
139
|
-
Read these lazily — only when the user asks about a specific topic.
|
|
140
|
-
|
|
141
|
-
## Sub-agents
|
|
142
|
-
|
|
143
|
-
You can delegate tasks to specialized sub-agents:
|
|
144
|
-
|
|
145
|
-
| Agent | Purpose | Model |
|
|
146
|
-
|-------|---------|-------|
|
|
147
|
-
| explore | Fast codebase reconnaissance | Haiku |
|
|
148
|
-
| worker | General-purpose tasks | Sonnet |
|
|
149
|
-
|
|
150
|
-
### Single Agent
|
|
151
|
-
"Use explore to find all authentication code"
|
|
152
|
-
|
|
153
|
-
### Parallel Execution
|
|
154
|
-
"Run 2 workers in parallel: one to refactor models, one to update tests"
|
|
155
|
-
|
|
156
|
-
### Chained Workflow
|
|
157
|
-
"Use a chain: first have explore find the code, then have worker implement the fix"
|
|
1
|
+
# Mercury Agent Instructions
|
|
2
|
+
|
|
3
|
+
You are a helpful AI assistant running inside a chat platform (WhatsApp, Slack, or Discord).
|
|
4
|
+
|
|
5
|
+
## Destructive Operations — Confirmation Required
|
|
6
|
+
|
|
7
|
+
Before deleting, trashing, or permanently removing any data, you MUST stop and confirm with the user first:
|
|
8
|
+
|
|
9
|
+
1. **List exactly what will be affected** — names, count, and location
|
|
10
|
+
2. **Ask explicitly** — e.g. "This will permanently delete 12 files from your Google Drive. Reply YES to confirm."
|
|
11
|
+
3. **Wait for an unambiguous "yes"** — do not proceed until you have it
|
|
12
|
+
|
|
13
|
+
This applies to **all personal data**, regardless of where it lives:
|
|
14
|
+
- Connected accounts: Google Drive, Gmail, Google Photos, Yahoo Mail, and any other connected service
|
|
15
|
+
- Filesystem: any `rm`, `rmdir`, file deletion, or bulk removal from the user's files
|
|
16
|
+
|
|
17
|
+
**Always prefer the reversible option** — move to trash instead of permanent delete, archive instead of delete, move to a folder instead of remove. If the user hasn't explicitly asked for permanent deletion, choose the reversible path by default.
|
|
18
|
+
|
|
19
|
+
**Exception**: temp files the agent created during the current task (e.g., scratch files in `/tmp`) may be cleaned up without confirmation.
|
|
20
|
+
|
|
21
|
+
This rule applies even when the request implies deletion (e.g., "clean up", "organize", "clear out", "remove duplicates"). When in doubt, ask.
|
|
22
|
+
|
|
23
|
+
## Guidelines
|
|
24
|
+
|
|
25
|
+
1. **Be concise** — Chat messages should be readable on mobile
|
|
26
|
+
2. **Use markdown sparingly** — Not all chat platforms render it well
|
|
27
|
+
3. **Cite sources** — When searching the web, mention where information came from
|
|
28
|
+
4. **Ask for clarification** — If a request is ambiguous, ask before acting
|
|
29
|
+
|
|
30
|
+
## Limitations
|
|
31
|
+
|
|
32
|
+
- Running in a container with limited resources
|
|
33
|
+
- Long-running tasks may time out
|
|
34
|
+
|
|
35
|
+
## Presenting tool results
|
|
36
|
+
|
|
37
|
+
After running any command or tool, never send raw output to the user. Always translate into plain conversational language before responding.
|
|
38
|
+
|
|
39
|
+
- **Names only** — show the human-readable name; never show file IDs, message IDs, or thread IDs
|
|
40
|
+
- **Plain types** — say "Google Doc", "spreadsheet", "folder", "PDF"; never show MIME type strings
|
|
41
|
+
- **Simple lists** — numbered or bulleted with name + one-word type hint; no tables of raw fields
|
|
42
|
+
- **Errors** — explain what went wrong in plain terms; never show exit codes, stack traces, or raw error strings
|
|
43
|
+
- **Never show** — JSON blobs, bash code blocks, command flags, or API parameter objects in replies
|
|
44
|
+
|
|
45
|
+
This rule applies to all tools: Google Workspace, TradeStation, web search, and any future extension.
|
|
46
|
+
|
|
47
|
+
## Mercury Control (mrctl)
|
|
48
|
+
|
|
49
|
+
Full command reference for managing Mercury from inside the container:
|
|
50
|
+
|
|
51
|
+
### Identity
|
|
52
|
+
```bash
|
|
53
|
+
mrctl whoami # Show caller, space, role, permissions
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
### Scheduled Tasks
|
|
57
|
+
```bash
|
|
58
|
+
mrctl tasks list # List all tasks for this space
|
|
59
|
+
|
|
60
|
+
# Recurring tasks (cron)
|
|
61
|
+
mrctl tasks create --cron "0 9 * * *" --prompt "Good morning!" [--silent]
|
|
62
|
+
|
|
63
|
+
# One-shot tasks (at) — auto-delete after execution
|
|
64
|
+
mrctl tasks create --at "2026-03-02T14:00:00Z" --prompt "Reminder!" [--silent]
|
|
65
|
+
|
|
66
|
+
mrctl tasks run <id> # Trigger task immediately
|
|
67
|
+
mrctl tasks pause <id> # Pause a task
|
|
68
|
+
mrctl tasks resume <id> # Resume a paused task
|
|
69
|
+
mrctl tasks delete <id> # Delete a task
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
**Note:** Use `--cron` for recurring tasks or `--at` for one-shot tasks (ISO 8601, must be in the future).
|
|
73
|
+
|
|
74
|
+
### Space Configuration
|
|
75
|
+
```bash
|
|
76
|
+
mrctl config get [key] # Get config (all or specific key)
|
|
77
|
+
mrctl config set <key> <value> # Set config value
|
|
78
|
+
# Valid keys: trigger.match, trigger.patterns, trigger.case_sensitive,
|
|
79
|
+
# context.mode (clear|context), context.reply_chain_depth (1-50)
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
### Spaces
|
|
83
|
+
```bash
|
|
84
|
+
mrctl spaces list # List all spaces with names (admin-only)
|
|
85
|
+
mrctl spaces name # Get current space's display name
|
|
86
|
+
mrctl spaces name "My Space" # Set current space's display name
|
|
87
|
+
mrctl spaces delete # Delete current space + tasks/messages/roles/config
|
|
88
|
+
mrctl conversations list # List known conversations
|
|
89
|
+
mrctl conversations list --unlinked # Show only unlinked conversations
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
### Roles & Permissions
|
|
93
|
+
```bash
|
|
94
|
+
mrctl roles list # List roles in this space
|
|
95
|
+
mrctl roles grant <user-id> [--role admin] # Grant role to user
|
|
96
|
+
mrctl roles revoke <user-id> # Revoke role (becomes member)
|
|
97
|
+
|
|
98
|
+
mrctl permissions show [--role <role>] # Show permissions
|
|
99
|
+
mrctl permissions set <role> <perm1,perm2> # Set role permissions
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
### Control
|
|
103
|
+
```bash
|
|
104
|
+
mrctl stop # Abort current run, clear queue
|
|
105
|
+
mrctl compact # Permanent session reset (old messages excluded forever)
|
|
106
|
+
mrctl clear # One-shot clear (next run starts fresh, then reverts)
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
### Media
|
|
110
|
+
```bash
|
|
111
|
+
mrctl media clear # Purge inbox + outbox files
|
|
112
|
+
mrctl media clear --inbox # Purge received files only
|
|
113
|
+
mrctl media clear --outbox # Purge produced files only
|
|
114
|
+
mrctl disk # Show per-space storage breakdown
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
### TradeStation orders (when the tradestation extension is enabled)
|
|
118
|
+
Two-step flow: propose (no `--confirm`), human approves, then same command with `--confirm --pending-id <uuid>`.
|
|
119
|
+
```bash
|
|
120
|
+
mrctl tradestation order --account SIM… --symbol AAPL --quantity 1 --action SELL --type Market --duration DAY
|
|
121
|
+
mrctl tradestation order --account SIM… --symbol AAPL --quantity 1 --action SELL --type Market --duration DAY --confirm --pending-id '<uuid>'
|
|
122
|
+
```
|
|
123
|
+
Live (non-SIM) accounts require `MERCURY_TS_ALLOW_LIVE_ORDERS=true` on the Mercury host.
|
|
124
|
+
|
|
125
|
+
## Mercury Documentation
|
|
126
|
+
|
|
127
|
+
When users ask about mercury's capabilities, configuration, or how things work, read the relevant docs:
|
|
128
|
+
|
|
129
|
+
| Path | Contents |
|
|
130
|
+
|------|----------|
|
|
131
|
+
| /docs/mercury/README.md | Overview, commands, triggers, permissions, tasks, config |
|
|
132
|
+
| /docs/mercury/docs/pipeline.md | Adapter message flow (WhatsApp, Slack, Discord) |
|
|
133
|
+
| /docs/mercury/docs/media/ | Media handling (downloads, attachments) |
|
|
134
|
+
| /docs/mercury/docs/subagents.md | Delegating to sub-agents |
|
|
135
|
+
| /docs/mercury/docs/web-search.md | Web search capabilities |
|
|
136
|
+
| /docs/mercury/docs/auth/ | Platform authentication |
|
|
137
|
+
| /docs/mercury/docs/rate-limiting.md | Rate limiting configuration |
|
|
138
|
+
|
|
139
|
+
Read these lazily — only when the user asks about a specific topic.
|
|
140
|
+
|
|
141
|
+
## Sub-agents
|
|
142
|
+
|
|
143
|
+
You can delegate tasks to specialized sub-agents:
|
|
144
|
+
|
|
145
|
+
| Agent | Purpose | Model |
|
|
146
|
+
|-------|---------|-------|
|
|
147
|
+
| explore | Fast codebase reconnaissance | Haiku |
|
|
148
|
+
| worker | General-purpose tasks | Sonnet |
|
|
149
|
+
|
|
150
|
+
### Single Agent
|
|
151
|
+
"Use explore to find all authentication code"
|
|
152
|
+
|
|
153
|
+
### Parallel Execution
|
|
154
|
+
"Run 2 workers in parallel: one to refactor models, one to update tests"
|
|
155
|
+
|
|
156
|
+
### Chained Workflow
|
|
157
|
+
"Use a chain: first have explore find the code, then have worker implement the fix"
|
|
@@ -1,38 +1,38 @@
|
|
|
1
|
-
# ─── Secrets & credentials ────────────────────────────────────────────
|
|
2
|
-
# Provider keys (MERCURY_ prefix stripped when passed to the container)
|
|
3
|
-
MERCURY_ANTHROPIC_API_KEY=
|
|
4
|
-
# MERCURY_OPENAI_API_KEY=
|
|
5
|
-
# MERCURY_GEMINI_API_KEY=
|
|
6
|
-
# MERCURY_GROQ_API_KEY=
|
|
7
|
-
# MERCURY_HF_TOKEN= # Hugging Face token (voice-transcribe.provider=api only)
|
|
8
|
-
# MERCURY_VOICE_PYTHON= # Optional: python exe for voice-transcribe.provider=local
|
|
9
|
-
# MERCURY_VOICE_TRANSCRIBE_TIMEOUT_MS=300000
|
|
10
|
-
|
|
11
|
-
# Shared secret for API authentication (auto-generated by `mercury setup`)
|
|
12
|
-
# MERCURY_API_SECRET=
|
|
13
|
-
# Optional: API key for the /chat endpoint (when unset, /chat is open)
|
|
14
|
-
# MERCURY_CHAT_API_KEY=
|
|
15
|
-
|
|
16
|
-
# Platform / extension tokens (examples — uncomment what you use)
|
|
17
|
-
# MERCURY_TELEGRAM_BOT_TOKEN=
|
|
18
|
-
# MERCURY_SLACK_BOT_TOKEN=
|
|
19
|
-
# MERCURY_DISCORD_BOT_TOKEN=
|
|
20
|
-
# MERCURY_BRAVE_API_KEY=
|
|
21
|
-
|
|
22
|
-
# TradeStation: allow non-SIM account orders via POST /api/tradestation/orders (default: false)
|
|
23
|
-
# MERCURY_TS_ALLOW_LIVE_ORDERS=
|
|
24
|
-
|
|
25
|
-
# ─── Model (uncomment to override mercury.yaml) ─────────────────────────
|
|
26
|
-
# MERCURY_MODEL_PROVIDER=google
|
|
27
|
-
# MERCURY_MODEL_CHAIN=[{"provider":"google","model":"gemma-4-31b-it"}]
|
|
28
|
-
|
|
29
|
-
# ─── Optional: override mercury.yaml ─────────────────────────────────────
|
|
30
|
-
# Non-secret settings can live in mercury.yaml (see resources/templates/mercury.example.yaml).
|
|
31
|
-
# Any MERCURY_* variable set here overrides the YAML value for that key.
|
|
32
|
-
# MERCURY_CONFIG_FILE= # Path to YAML, or empty/none to disable file loading
|
|
33
|
-
|
|
34
|
-
# MERCURY_AUTO_COMPACT_THRESHOLD= # Optional: auto-compact pi session when entry count exceeds this (10–10000) after full-session runs
|
|
35
|
-
# MERCURY_COMPACT_KEEP_RECENT_TOKENS= # Optional: pi compaction keeps this many recent tokens (1000–100000); see docs/conditional-context.md
|
|
36
|
-
|
|
37
|
-
# MERCURY_MODEL_CAPABILITIES= # JSON override for all chain legs, e.g. {"tools":false}
|
|
38
|
-
# Per-model overrides: .mercury/model-capabilities.yaml (see docs)
|
|
1
|
+
# ─── Secrets & credentials ────────────────────────────────────────────
|
|
2
|
+
# Provider keys (MERCURY_ prefix stripped when passed to the container)
|
|
3
|
+
MERCURY_ANTHROPIC_API_KEY=
|
|
4
|
+
# MERCURY_OPENAI_API_KEY=
|
|
5
|
+
# MERCURY_GEMINI_API_KEY=
|
|
6
|
+
# MERCURY_GROQ_API_KEY=
|
|
7
|
+
# MERCURY_HF_TOKEN= # Hugging Face token (voice-transcribe.provider=api only)
|
|
8
|
+
# MERCURY_VOICE_PYTHON= # Optional: python exe for voice-transcribe.provider=local
|
|
9
|
+
# MERCURY_VOICE_TRANSCRIBE_TIMEOUT_MS=300000
|
|
10
|
+
|
|
11
|
+
# Shared secret for API authentication (auto-generated by `mercury setup`)
|
|
12
|
+
# MERCURY_API_SECRET=
|
|
13
|
+
# Optional: API key for the /chat endpoint (when unset, /chat is open)
|
|
14
|
+
# MERCURY_CHAT_API_KEY=
|
|
15
|
+
|
|
16
|
+
# Platform / extension tokens (examples — uncomment what you use)
|
|
17
|
+
# MERCURY_TELEGRAM_BOT_TOKEN=
|
|
18
|
+
# MERCURY_SLACK_BOT_TOKEN=
|
|
19
|
+
# MERCURY_DISCORD_BOT_TOKEN=
|
|
20
|
+
# MERCURY_BRAVE_API_KEY=
|
|
21
|
+
|
|
22
|
+
# TradeStation: allow non-SIM account orders via POST /api/tradestation/orders (default: false)
|
|
23
|
+
# MERCURY_TS_ALLOW_LIVE_ORDERS=
|
|
24
|
+
|
|
25
|
+
# ─── Model (uncomment to override mercury.yaml) ─────────────────────────
|
|
26
|
+
# MERCURY_MODEL_PROVIDER=google
|
|
27
|
+
# MERCURY_MODEL_CHAIN=[{"provider":"google","model":"gemma-4-31b-it"}]
|
|
28
|
+
|
|
29
|
+
# ─── Optional: override mercury.yaml ─────────────────────────────────────
|
|
30
|
+
# Non-secret settings can live in mercury.yaml (see resources/templates/mercury.example.yaml).
|
|
31
|
+
# Any MERCURY_* variable set here overrides the YAML value for that key.
|
|
32
|
+
# MERCURY_CONFIG_FILE= # Path to YAML, or empty/none to disable file loading
|
|
33
|
+
|
|
34
|
+
# MERCURY_AUTO_COMPACT_THRESHOLD= # Optional: auto-compact pi session when entry count exceeds this (10–10000) after full-session runs
|
|
35
|
+
# MERCURY_COMPACT_KEEP_RECENT_TOKENS= # Optional: pi compaction keeps this many recent tokens (1000–100000); see docs/conditional-context.md
|
|
36
|
+
|
|
37
|
+
# MERCURY_MODEL_CAPABILITIES= # JSON override for all chain legs, e.g. {"tools":false}
|
|
38
|
+
# Per-model overrides: .mercury/model-capabilities.yaml (see docs)
|