milaidy 1.0.0
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/LICENSE +8 -0
- package/README.md +538 -0
- package/dist/argv-CfSowvEA.js +63 -0
- package/dist/config-B-mboG4v.js +4 -0
- package/dist/eliza-CPJjgw-e.js +1491 -0
- package/dist/eliza.js +2192 -0
- package/dist/entry.js +232 -0
- package/dist/index.js +209 -0
- package/dist/links-BFKlWqSe.js +15 -0
- package/dist/paths-D_yh1DEJ.js +69 -0
- package/dist/plugins-cli-B7kSre2c.js +134 -0
- package/dist/program-6KwWwKKh.js +510 -0
- package/dist/register.agents-CPVmSjMG.js +17 -0
- package/dist/register.browser-B2ooXxNx.js +15 -0
- package/dist/register.channels-CMYQ6K6Y.js +42 -0
- package/dist/register.cron-D91lY1_Y.js +9 -0
- package/dist/register.devices-rU5I5L_y.js +13 -0
- package/dist/register.gateway-82SLAvw3.js +22 -0
- package/dist/register.hooks-B_XTBEkt.js +9 -0
- package/dist/register.logs-BgEGcPd8.js +10 -0
- package/dist/register.models-BJt9eVgZ.js +26 -0
- package/dist/register.nodes-B5xY1s8a.js +9 -0
- package/dist/register.skills-SFQqYIhg.js +10 -0
- package/dist/register.subclis-uF_AsbWR.js +187 -0
- package/dist/run-main-XODklzS-.js +56 -0
- package/dist/theme-DBvtuGeq.js +36 -0
- package/dist/utils-C1AUpp_V.js +42 -0
- package/dist/version-Cpn3yr5D.js +26 -0
- package/dist/workspace-Co3Wul2D.js +206 -0
- package/dist/workspace-DCA6MNVK.js +350 -0
- package/docs/.i18n/README.md +31 -0
- package/docs/.i18n/glossary.zh-CN.json +210 -0
- package/docs/.i18n/zh-CN.tm.jsonl +1329 -0
- package/docs/CNAME +1 -0
- package/docs/automation/cron-jobs.md +468 -0
- package/docs/automation/cron-vs-heartbeat.md +254 -0
- package/docs/automation/gmail-pubsub.md +256 -0
- package/docs/automation/poll.md +69 -0
- package/docs/automation/webhook.md +163 -0
- package/docs/bedrock.md +176 -0
- package/docs/brave-search.md +41 -0
- package/docs/broadcast-groups.md +442 -0
- package/docs/cli/acp.md +170 -0
- package/docs/cli/agent.md +24 -0
- package/docs/cli/agents.md +75 -0
- package/docs/cli/approvals.md +50 -0
- package/docs/cli/browser.md +107 -0
- package/docs/cli/channels.md +79 -0
- package/docs/cli/config.md +50 -0
- package/docs/cli/configure.md +33 -0
- package/docs/cli/cron.md +42 -0
- package/docs/cli/dashboard.md +16 -0
- package/docs/cli/devices.md +67 -0
- package/docs/cli/directory.md +63 -0
- package/docs/cli/dns.md +23 -0
- package/docs/cli/docs.md +15 -0
- package/docs/cli/doctor.md +41 -0
- package/docs/cli/gateway.md +199 -0
- package/docs/cli/health.md +21 -0
- package/docs/cli/hooks.md +291 -0
- package/docs/cli/index.md +1029 -0
- package/docs/cli/logs.md +24 -0
- package/docs/cli/memory.md +45 -0
- package/docs/cli/message.md +239 -0
- package/docs/cli/models.md +79 -0
- package/docs/cli/node.md +112 -0
- package/docs/cli/nodes.md +73 -0
- package/docs/cli/onboard.md +29 -0
- package/docs/cli/pairing.md +21 -0
- package/docs/cli/plugins.md +62 -0
- package/docs/cli/reset.md +17 -0
- package/docs/cli/sandbox.md +152 -0
- package/docs/cli/security.md +26 -0
- package/docs/cli/sessions.md +16 -0
- package/docs/cli/setup.md +29 -0
- package/docs/cli/skills.md +26 -0
- package/docs/cli/status.md +26 -0
- package/docs/cli/system.md +60 -0
- package/docs/cli/tui.md +23 -0
- package/docs/cli/uninstall.md +17 -0
- package/docs/cli/update.md +98 -0
- package/docs/cli/voicecall.md +34 -0
- package/docs/cli/webhooks.md +25 -0
- package/docs/concepts/agent-loop.md +146 -0
- package/docs/concepts/agent-workspace.md +229 -0
- package/docs/concepts/agent.md +122 -0
- package/docs/concepts/architecture.md +129 -0
- package/docs/concepts/channel-routing.md +114 -0
- package/docs/concepts/compaction.md +61 -0
- package/docs/concepts/context.md +159 -0
- package/docs/concepts/features.md +53 -0
- package/docs/concepts/group-messages.md +84 -0
- package/docs/concepts/groups.md +373 -0
- package/docs/concepts/markdown-formatting.md +130 -0
- package/docs/concepts/memory.md +546 -0
- package/docs/concepts/messages.md +154 -0
- package/docs/concepts/model-failover.md +149 -0
- package/docs/concepts/model-providers.md +315 -0
- package/docs/concepts/models.md +208 -0
- package/docs/concepts/multi-agent.md +376 -0
- package/docs/concepts/oauth.md +145 -0
- package/docs/concepts/plugins.md +454 -0
- package/docs/concepts/presence.md +102 -0
- package/docs/concepts/queue.md +89 -0
- package/docs/concepts/retry.md +69 -0
- package/docs/concepts/secrets.md +300 -0
- package/docs/concepts/session-pruning.md +122 -0
- package/docs/concepts/session-tool.md +193 -0
- package/docs/concepts/session.md +188 -0
- package/docs/concepts/sessions.md +10 -0
- package/docs/concepts/skills.md +392 -0
- package/docs/concepts/streaming.md +135 -0
- package/docs/concepts/system-prompt.md +114 -0
- package/docs/concepts/timezone.md +91 -0
- package/docs/concepts/typebox.md +289 -0
- package/docs/concepts/typing-indicators.md +68 -0
- package/docs/concepts/usage-tracking.md +35 -0
- package/docs/custom.css +4 -0
- package/docs/date-time.md +128 -0
- package/docs/debugging.md +162 -0
- package/docs/docs.json +1599 -0
- package/docs/environment.md +81 -0
- package/docs/hooks.md +876 -0
- package/docs/index.md +179 -0
- package/docs/install/ansible.md +208 -0
- package/docs/install/bun.md +59 -0
- package/docs/install/development-channels.md +75 -0
- package/docs/install/docker.md +567 -0
- package/docs/install/index.md +185 -0
- package/docs/install/installer.md +123 -0
- package/docs/install/migrating.md +192 -0
- package/docs/install/nix.md +96 -0
- package/docs/install/node.md +78 -0
- package/docs/install/uninstall.md +128 -0
- package/docs/install/updating.md +228 -0
- package/docs/logging.md +350 -0
- package/docs/multi-agent-sandbox-tools.md +395 -0
- package/docs/network.md +54 -0
- package/docs/nodes/audio.md +114 -0
- package/docs/nodes/camera.md +156 -0
- package/docs/nodes/images.md +72 -0
- package/docs/nodes/index.md +341 -0
- package/docs/nodes/location-command.md +113 -0
- package/docs/nodes/media-understanding.md +379 -0
- package/docs/nodes/talk.md +90 -0
- package/docs/nodes/voicewake.md +65 -0
- package/docs/northflank.mdx +53 -0
- package/docs/perplexity.md +80 -0
- package/docs/platforms/android.md +129 -0
- package/docs/platforms/digitalocean.md +262 -0
- package/docs/platforms/exe-dev.md +125 -0
- package/docs/platforms/fly.md +486 -0
- package/docs/platforms/gcp.md +503 -0
- package/docs/platforms/hetzner.md +330 -0
- package/docs/platforms/index.md +53 -0
- package/docs/platforms/ios.md +106 -0
- package/docs/platforms/linux.md +94 -0
- package/docs/platforms/mac/bundled-gateway.md +73 -0
- package/docs/platforms/mac/canvas.md +125 -0
- package/docs/platforms/mac/child-process.md +69 -0
- package/docs/platforms/mac/dev-setup.md +102 -0
- package/docs/platforms/mac/health.md +34 -0
- package/docs/platforms/mac/icon.md +31 -0
- package/docs/platforms/mac/logging.md +57 -0
- package/docs/platforms/mac/menu-bar.md +81 -0
- package/docs/platforms/mac/peekaboo.md +65 -0
- package/docs/platforms/mac/permissions.md +44 -0
- package/docs/platforms/mac/release.md +85 -0
- package/docs/platforms/mac/remote.md +83 -0
- package/docs/platforms/mac/signing.md +47 -0
- package/docs/platforms/mac/skills.md +33 -0
- package/docs/platforms/mac/voice-overlay.md +60 -0
- package/docs/platforms/mac/voicewake.md +67 -0
- package/docs/platforms/mac/webchat.md +41 -0
- package/docs/platforms/mac/xpc.md +61 -0
- package/docs/platforms/macos-vm.md +281 -0
- package/docs/platforms/macos.md +203 -0
- package/docs/platforms/oracle.md +303 -0
- package/docs/platforms/raspberry-pi.md +358 -0
- package/docs/platforms/windows.md +159 -0
- package/docs/plugin.md +651 -0
- package/docs/plugins/agent-tools.md +99 -0
- package/docs/plugins/manifest.md +71 -0
- package/docs/plugins/voice-call.md +273 -0
- package/docs/plugins/zalouser.md +70 -0
- package/docs/providers/anthropic.md +152 -0
- package/docs/providers/claude-max-api-proxy.md +148 -0
- package/docs/providers/cloudflare-ai-gateway.md +71 -0
- package/docs/providers/deepgram.md +93 -0
- package/docs/providers/glm.md +33 -0
- package/docs/providers/index.md +63 -0
- package/docs/providers/minimax.md +208 -0
- package/docs/providers/models.md +51 -0
- package/docs/providers/moonshot.md +142 -0
- package/docs/providers/ollama.md +223 -0
- package/docs/providers/openai.md +62 -0
- package/docs/providers/opencode.md +36 -0
- package/docs/providers/openrouter.md +37 -0
- package/docs/providers/qwen.md +53 -0
- package/docs/providers/synthetic.md +99 -0
- package/docs/providers/venice.md +267 -0
- package/docs/providers/vercel-ai-gateway.md +50 -0
- package/docs/providers/xiaomi.md +64 -0
- package/docs/providers/zai.md +36 -0
- package/docs/railway.mdx +99 -0
- package/docs/reference/templates/AGENTS.md +9 -0
- package/docs/reference/templates/BOOTSTRAP.md +3 -0
- package/docs/reference/templates/HEARTBEAT.md +3 -0
- package/docs/reference/templates/IDENTITY.md +3 -0
- package/docs/reference/templates/TOOLS.md +3 -0
- package/docs/reference/templates/USER.md +3 -0
- package/docs/render.mdx +165 -0
- package/docs/start/docs-directory.md +63 -0
- package/docs/start/getting-started.md +212 -0
- package/docs/start/milaidy.md +247 -0
- package/docs/start/onboarding.md +258 -0
- package/docs/start/pairing.md +86 -0
- package/docs/start/quickstart.md +81 -0
- package/docs/start/setup.md +149 -0
- package/docs/start/showcase.md +416 -0
- package/docs/start/wizard.md +418 -0
- package/docs/testing.md +368 -0
- package/docs/token-use.md +112 -0
- package/docs/tools/agent-send.md +53 -0
- package/docs/tools/apply-patch.md +50 -0
- package/docs/tools/browser-linux-troubleshooting.md +139 -0
- package/docs/tools/browser-login.md +68 -0
- package/docs/tools/browser.md +576 -0
- package/docs/tools/chrome-extension.md +178 -0
- package/docs/tools/clawhub.md +257 -0
- package/docs/tools/creating-skills.md +54 -0
- package/docs/tools/elevated.md +57 -0
- package/docs/tools/exec-approvals.md +246 -0
- package/docs/tools/exec.md +179 -0
- package/docs/tools/firecrawl.md +61 -0
- package/docs/tools/index.md +508 -0
- package/docs/tools/llm-task.md +115 -0
- package/docs/tools/reactions.md +22 -0
- package/docs/tools/skills-config.md +76 -0
- package/docs/tools/skills.md +300 -0
- package/docs/tools/slash-commands.md +196 -0
- package/docs/tools/subagents.md +151 -0
- package/docs/tools/thinking.md +73 -0
- package/docs/tools/web.md +261 -0
- package/docs/tui.md +159 -0
- package/docs/vps.md +43 -0
- package/docs/web/control-ui.md +221 -0
- package/docs/web/dashboard.md +46 -0
- package/docs/web/index.md +116 -0
- package/docs/web/webchat.md +49 -0
- package/milaidy.mjs +14 -0
- package/package.json +271 -0
- package/skills/.cache/catalog.json +88519 -0
|
@@ -0,0 +1,188 @@
|
|
|
1
|
+
---
|
|
2
|
+
summary: "Session management rules, keys, and persistence for chats"
|
|
3
|
+
read_when:
|
|
4
|
+
- Modifying session handling or storage
|
|
5
|
+
title: "Session Management"
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
# Session Management
|
|
9
|
+
|
|
10
|
+
Milaidy treats **one direct-chat session per agent** as primary. Direct chats collapse to `agent:<agentId>:<mainKey>` (default `main`), while group/channel chats get their own keys. `session.mainKey` is honored.
|
|
11
|
+
|
|
12
|
+
Use `session.dmScope` to control how **direct messages** are grouped:
|
|
13
|
+
|
|
14
|
+
- `main` (default): all DMs share the main session for continuity.
|
|
15
|
+
- `per-peer`: isolate by sender id across channels.
|
|
16
|
+
- `per-channel-peer`: isolate by channel + sender (recommended for multi-user inboxes).
|
|
17
|
+
- `per-account-channel-peer`: isolate by account + channel + sender (recommended for multi-account inboxes).
|
|
18
|
+
Use `session.identityLinks` to map provider-prefixed peer ids to a canonical identity so the same person shares a DM session across channels when using `per-peer`, `per-channel-peer`, or `per-account-channel-peer`.
|
|
19
|
+
|
|
20
|
+
### Secure DM mode (recommended)
|
|
21
|
+
|
|
22
|
+
If your agent can receive DMs from **multiple people** (pairing approvals for more than one sender, a DM allowlist with multiple entries, or `dmPolicy: "open"`), enable **secure DM mode** to avoid cross-user context leakage:
|
|
23
|
+
|
|
24
|
+
```json5
|
|
25
|
+
// ~/.milaidy/milaidy.json
|
|
26
|
+
{
|
|
27
|
+
session: {
|
|
28
|
+
// Secure DM mode: isolate DM context per channel + sender.
|
|
29
|
+
dmScope: "per-channel-peer",
|
|
30
|
+
},
|
|
31
|
+
}
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
Notes:
|
|
35
|
+
|
|
36
|
+
- Default is `dmScope: "main"` for continuity (all DMs share the main session).
|
|
37
|
+
- For multi-account inboxes on the same channel, prefer `per-account-channel-peer`.
|
|
38
|
+
- If the same person contacts you on multiple channels, use `session.identityLinks` to collapse their DM sessions into one canonical identity.
|
|
39
|
+
|
|
40
|
+
## Gateway is the source of truth
|
|
41
|
+
|
|
42
|
+
All session state is **owned by the gateway** (the “master” Milaidy). UI clients (macOS app, WebChat, etc.) must query the gateway for session lists and token counts instead of reading local files.
|
|
43
|
+
|
|
44
|
+
- In **remote mode**, the session store you care about lives on the remote gateway host, not your Mac.
|
|
45
|
+
- Token counts shown in UIs come from the gateway’s store fields (`inputTokens`, `outputTokens`, `totalTokens`, `contextTokens`). Clients do not parse JSONL transcripts to “fix up” totals.
|
|
46
|
+
|
|
47
|
+
## Where state lives
|
|
48
|
+
|
|
49
|
+
- On the **gateway host**:
|
|
50
|
+
- Store file: `~/.milaidy/agents/<agentId>/sessions/sessions.json` (per agent).
|
|
51
|
+
- Transcripts: `~/.milaidy/agents/<agentId>/sessions/<SessionId>.jsonl` (Telegram topic sessions use `.../<SessionId>-topic-<threadId>.jsonl`).
|
|
52
|
+
- The store is a map `sessionKey -> { sessionId, updatedAt, ... }`. Deleting entries is safe; they are recreated on demand.
|
|
53
|
+
- Group entries may include `displayName`, `channel`, `subject`, `room`, and `space` to label sessions in UIs.
|
|
54
|
+
- Session entries include `origin` metadata (label + routing hints) so UIs can explain where a session came from.
|
|
55
|
+
- Milaidy does **not** read legacy Pi/Tau session folders.
|
|
56
|
+
|
|
57
|
+
## Session pruning
|
|
58
|
+
|
|
59
|
+
Milaidy trims **old tool results** from the in-memory context right before LLM calls by default.
|
|
60
|
+
This does **not** rewrite JSONL history. See [/concepts/session-pruning](/concepts/session-pruning).
|
|
61
|
+
|
|
62
|
+
## Pre-compaction memory flush
|
|
63
|
+
|
|
64
|
+
When a session nears auto-compaction, Milaidy can run a **silent memory flush**
|
|
65
|
+
turn that reminds the model to write durable notes to disk. This only runs when
|
|
66
|
+
the workspace is writable. See [Memory](/concepts/memory) and
|
|
67
|
+
[Compaction](/concepts/compaction).
|
|
68
|
+
|
|
69
|
+
## Mapping transports → session keys
|
|
70
|
+
|
|
71
|
+
- Direct chats follow `session.dmScope` (default `main`).
|
|
72
|
+
- `main`: `agent:<agentId>:<mainKey>` (continuity across devices/channels).
|
|
73
|
+
- Multiple phone numbers and channels can map to the same agent main key; they act as transports into one conversation.
|
|
74
|
+
- `per-peer`: `agent:<agentId>:dm:<peerId>`.
|
|
75
|
+
- `per-channel-peer`: `agent:<agentId>:<channel>:dm:<peerId>`.
|
|
76
|
+
- `per-account-channel-peer`: `agent:<agentId>:<channel>:<accountId>:dm:<peerId>` (accountId defaults to `default`).
|
|
77
|
+
- If `session.identityLinks` matches a provider-prefixed peer id (for example `telegram:123`), the canonical key replaces `<peerId>` so the same person shares a session across channels.
|
|
78
|
+
- Group chats isolate state: `agent:<agentId>:<channel>:group:<id>` (rooms/channels use `agent:<agentId>:<channel>:channel:<id>`).
|
|
79
|
+
- Telegram forum topics append `:topic:<threadId>` to the group id for isolation.
|
|
80
|
+
- Legacy `group:<id>` keys are still recognized for migration.
|
|
81
|
+
- Inbound contexts may still use `group:<id>`; the channel is inferred from `Provider` and normalized to the canonical `agent:<agentId>:<channel>:group:<id>` form.
|
|
82
|
+
- Other sources:
|
|
83
|
+
- Cron jobs: `cron:<job.id>`
|
|
84
|
+
- Webhooks: `hook:<uuid>` (unless explicitly set by the hook)
|
|
85
|
+
- Node runs: `node-<nodeId>`
|
|
86
|
+
|
|
87
|
+
## Lifecycle
|
|
88
|
+
|
|
89
|
+
- Reset policy: sessions are reused until they expire, and expiry is evaluated on the next inbound message.
|
|
90
|
+
- Daily reset: defaults to **4:00 AM local time on the gateway host**. A session is stale once its last update is earlier than the most recent daily reset time.
|
|
91
|
+
- Idle reset (optional): `idleMinutes` adds a sliding idle window. When both daily and idle resets are configured, **whichever expires first** forces a new session.
|
|
92
|
+
- Legacy idle-only: if you set `session.idleMinutes` without any `session.reset`/`resetByType` config, Milaidy stays in idle-only mode for backward compatibility.
|
|
93
|
+
- Per-type overrides (optional): `resetByType` lets you override the policy for `dm`, `group`, and `thread` sessions (thread = Slack/Discord threads, Telegram topics, Matrix threads when provided by the connector).
|
|
94
|
+
- Per-channel overrides (optional): `resetByChannel` overrides the reset policy for a channel (applies to all session types for that channel and takes precedence over `reset`/`resetByType`).
|
|
95
|
+
- Reset triggers: exact `/new` or `/reset` (plus any extras in `resetTriggers`) start a fresh session id and pass the remainder of the message through. `/new <model>` accepts a model alias, `provider/model`, or provider name (fuzzy match) to set the new session model. If `/new` or `/reset` is sent alone, Milaidy runs a short “hello” greeting turn to confirm the reset.
|
|
96
|
+
- Manual reset: delete specific keys from the store or remove the JSONL transcript; the next message recreates them.
|
|
97
|
+
- Isolated cron jobs always mint a fresh `sessionId` per run (no idle reuse).
|
|
98
|
+
|
|
99
|
+
## Send policy (optional)
|
|
100
|
+
|
|
101
|
+
Block delivery for specific session types without listing individual ids.
|
|
102
|
+
|
|
103
|
+
```json5
|
|
104
|
+
{
|
|
105
|
+
session: {
|
|
106
|
+
sendPolicy: {
|
|
107
|
+
rules: [
|
|
108
|
+
{ action: "deny", match: { channel: "discord", chatType: "group" } },
|
|
109
|
+
{ action: "deny", match: { keyPrefix: "cron:" } },
|
|
110
|
+
],
|
|
111
|
+
default: "allow",
|
|
112
|
+
},
|
|
113
|
+
},
|
|
114
|
+
}
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
Runtime override (owner only):
|
|
118
|
+
|
|
119
|
+
- `/send on` → allow for this session
|
|
120
|
+
- `/send off` → deny for this session
|
|
121
|
+
- `/send inherit` → clear override and use config rules
|
|
122
|
+
Send these as standalone messages so they register.
|
|
123
|
+
|
|
124
|
+
## Configuration (optional rename example)
|
|
125
|
+
|
|
126
|
+
```json5
|
|
127
|
+
// ~/.milaidy/milaidy.json
|
|
128
|
+
{
|
|
129
|
+
session: {
|
|
130
|
+
scope: "per-sender", // keep group keys separate
|
|
131
|
+
dmScope: "main", // DM continuity (set per-channel-peer/per-account-channel-peer for shared inboxes)
|
|
132
|
+
identityLinks: {
|
|
133
|
+
alice: ["telegram:123456789", "discord:987654321012345678"],
|
|
134
|
+
},
|
|
135
|
+
reset: {
|
|
136
|
+
// Defaults: mode=daily, atHour=4 (gateway host local time).
|
|
137
|
+
// If you also set idleMinutes, whichever expires first wins.
|
|
138
|
+
mode: "daily",
|
|
139
|
+
atHour: 4,
|
|
140
|
+
idleMinutes: 120,
|
|
141
|
+
},
|
|
142
|
+
resetByType: {
|
|
143
|
+
thread: { mode: "daily", atHour: 4 },
|
|
144
|
+
dm: { mode: "idle", idleMinutes: 240 },
|
|
145
|
+
group: { mode: "idle", idleMinutes: 120 },
|
|
146
|
+
},
|
|
147
|
+
resetByChannel: {
|
|
148
|
+
discord: { mode: "idle", idleMinutes: 10080 },
|
|
149
|
+
},
|
|
150
|
+
resetTriggers: ["/new", "/reset"],
|
|
151
|
+
store: "~/.milaidy/agents/{agentId}/sessions/sessions.json",
|
|
152
|
+
mainKey: "main",
|
|
153
|
+
},
|
|
154
|
+
}
|
|
155
|
+
```
|
|
156
|
+
|
|
157
|
+
## Inspecting
|
|
158
|
+
|
|
159
|
+
- `milaidy status` — shows store path and recent sessions.
|
|
160
|
+
- `milaidy sessions --json` — dumps every entry (filter with `--active <minutes>`).
|
|
161
|
+
- `milaidy gateway call sessions.list --params '{}'` — fetch sessions from the running gateway (use `--url`/`--token` for remote gateway access).
|
|
162
|
+
- Send `/status` as a standalone message in chat to see whether the agent is reachable, how much of the session context is used, current thinking/verbose toggles, and when your WhatsApp web creds were last refreshed (helps spot relink needs).
|
|
163
|
+
- Send `/context list` or `/context detail` to see what’s in the system prompt and injected workspace files (and the biggest context contributors).
|
|
164
|
+
- Send `/stop` as a standalone message to abort the current run, clear queued followups for that session, and stop any sub-agent runs spawned from it (the reply includes the stopped count).
|
|
165
|
+
- Send `/compact` (optional instructions) as a standalone message to summarize older context and free up window space. See [/concepts/compaction](/concepts/compaction).
|
|
166
|
+
- JSONL transcripts can be opened directly to review full turns.
|
|
167
|
+
|
|
168
|
+
## Tips
|
|
169
|
+
|
|
170
|
+
- Keep the primary key dedicated to 1:1 traffic; let groups keep their own keys.
|
|
171
|
+
- When automating cleanup, delete individual keys instead of the whole store to preserve context elsewhere.
|
|
172
|
+
|
|
173
|
+
## Session origin metadata
|
|
174
|
+
|
|
175
|
+
Each session entry records where it came from (best-effort) in `origin`:
|
|
176
|
+
|
|
177
|
+
- `label`: human label (resolved from conversation label + group subject/channel)
|
|
178
|
+
- `provider`: normalized channel id (including extensions)
|
|
179
|
+
- `from`/`to`: raw routing ids from the inbound envelope
|
|
180
|
+
- `accountId`: provider account id (when multi-account)
|
|
181
|
+
- `threadId`: thread/topic id when the channel supports it
|
|
182
|
+
The origin fields are populated for direct messages, channels, and groups. If a
|
|
183
|
+
connector only updates delivery routing (for example, to keep a DM main session
|
|
184
|
+
fresh), it should still provide inbound context so the session keeps its
|
|
185
|
+
explainer metadata. Extensions can do this by sending `ConversationLabel`,
|
|
186
|
+
`GroupSubject`, `GroupChannel`, `GroupSpace`, and `SenderName` in the inbound
|
|
187
|
+
context and calling `recordSessionMetaFromInbound` (or passing the same context
|
|
188
|
+
to `updateLastRoute`).
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
---
|
|
2
|
+
summary: "Alias for session management docs"
|
|
3
|
+
read_when:
|
|
4
|
+
- You looked for docs/sessions.md; canonical doc lives in docs/session.md
|
|
5
|
+
title: "Sessions"
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
# Sessions
|
|
9
|
+
|
|
10
|
+
Canonical session management docs live in [Session management](/concepts/session).
|
|
@@ -0,0 +1,392 @@
|
|
|
1
|
+
---
|
|
2
|
+
summary: "Skills: directories, precedence, eligibility, and configuration"
|
|
3
|
+
read_when:
|
|
4
|
+
- Adding or configuring skills
|
|
5
|
+
- Understanding skill loading and gating
|
|
6
|
+
- Creating custom skills
|
|
7
|
+
title: "Skills"
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
# Skills
|
|
11
|
+
|
|
12
|
+
Skills teach Milaidy agents how to use tools. Each skill is a directory
|
|
13
|
+
containing a `SKILL.md` file with YAML frontmatter and instructions. Skills
|
|
14
|
+
are [AgentSkills](https://agentskills.io)-compatible.
|
|
15
|
+
|
|
16
|
+
## Skill Locations and Precedence
|
|
17
|
+
|
|
18
|
+
Skills load from three locations (highest to lowest precedence):
|
|
19
|
+
|
|
20
|
+
| Location | Path | Scope |
|
|
21
|
+
|----------|------|-------|
|
|
22
|
+
| **Workspace** | `<workspace>/skills/` | Per-agent |
|
|
23
|
+
| **Managed/Local** | `~/.milaidy/skills/` | All agents |
|
|
24
|
+
| **Bundled** | Shipped with install | All agents |
|
|
25
|
+
|
|
26
|
+
If a skill name conflicts, the higher-precedence location wins.
|
|
27
|
+
|
|
28
|
+
### Extra Directories
|
|
29
|
+
|
|
30
|
+
Add additional skill folders via config:
|
|
31
|
+
|
|
32
|
+
```json
|
|
33
|
+
{
|
|
34
|
+
"skills": {
|
|
35
|
+
"load": {
|
|
36
|
+
"extraDirs": ["/path/to/shared/skills"]
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
Extra directories have the lowest precedence.
|
|
43
|
+
|
|
44
|
+
## Skill Format
|
|
45
|
+
|
|
46
|
+
A minimal `SKILL.md`:
|
|
47
|
+
|
|
48
|
+
```markdown
|
|
49
|
+
---
|
|
50
|
+
name: my-skill
|
|
51
|
+
description: Does something useful
|
|
52
|
+
---
|
|
53
|
+
|
|
54
|
+
## Instructions
|
|
55
|
+
|
|
56
|
+
Use this skill when you need to do X...
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
### Required Frontmatter
|
|
60
|
+
|
|
61
|
+
| Field | Type | Description |
|
|
62
|
+
|-------|------|-------------|
|
|
63
|
+
| `name` | string | Skill identifier |
|
|
64
|
+
| `description` | string | Short description |
|
|
65
|
+
|
|
66
|
+
### Optional Frontmatter
|
|
67
|
+
|
|
68
|
+
| Field | Type | Default | Description |
|
|
69
|
+
|-------|------|---------|-------------|
|
|
70
|
+
| `homepage` | string | - | Website URL |
|
|
71
|
+
| `user-invocable` | boolean | `true` | Expose as slash command |
|
|
72
|
+
| `disable-model-invocation` | boolean | `false` | Exclude from model prompt |
|
|
73
|
+
| `command-dispatch` | string | - | Set to `tool` for direct dispatch |
|
|
74
|
+
| `command-tool` | string | - | Tool to invoke |
|
|
75
|
+
| `command-arg-mode` | string | `raw` | Argument handling mode |
|
|
76
|
+
|
|
77
|
+
## Eligibility Gating
|
|
78
|
+
|
|
79
|
+
Skills can specify requirements via `metadata`:
|
|
80
|
+
|
|
81
|
+
```markdown
|
|
82
|
+
---
|
|
83
|
+
name: my-skill
|
|
84
|
+
description: Requires specific tools
|
|
85
|
+
metadata: {"milaidy": {"requires": {"bins": ["uv"], "env": ["MY_API_KEY"], "config": ["browser.enabled"]}, "primaryEnv": "MY_API_KEY"}}
|
|
86
|
+
---
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
### Gating Fields
|
|
90
|
+
|
|
91
|
+
| Field | Description |
|
|
92
|
+
|-------|-------------|
|
|
93
|
+
| `metadata.milaidy.always` | Always include (skip other gates) |
|
|
94
|
+
| `metadata.milaidy.os` | Platform filter (`darwin`, `linux`, `win32`) |
|
|
95
|
+
| `metadata.milaidy.requires.bins` | Required binaries on PATH |
|
|
96
|
+
| `metadata.milaidy.requires.anyBins` | At least one must exist |
|
|
97
|
+
| `metadata.milaidy.requires.env` | Required environment variables |
|
|
98
|
+
| `metadata.milaidy.requires.config` | Required config paths (truthy) |
|
|
99
|
+
| `metadata.milaidy.primaryEnv` | Associated API key name |
|
|
100
|
+
| `metadata.milaidy.emoji` | Display emoji |
|
|
101
|
+
| `metadata.milaidy.homepage` | Website URL |
|
|
102
|
+
| `metadata.milaidy.install` | Installer specifications |
|
|
103
|
+
|
|
104
|
+
### Example with Full Metadata
|
|
105
|
+
|
|
106
|
+
```markdown
|
|
107
|
+
---
|
|
108
|
+
name: gemini-cli
|
|
109
|
+
description: Use Gemini CLI for coding assistance
|
|
110
|
+
metadata:
|
|
111
|
+
{
|
|
112
|
+
"milaidy":
|
|
113
|
+
{
|
|
114
|
+
"emoji": "♊️",
|
|
115
|
+
"requires": { "bins": ["gemini"] },
|
|
116
|
+
"install":
|
|
117
|
+
[
|
|
118
|
+
{
|
|
119
|
+
"id": "brew",
|
|
120
|
+
"kind": "brew",
|
|
121
|
+
"formula": "gemini-cli",
|
|
122
|
+
"bins": ["gemini"],
|
|
123
|
+
"label": "Install Gemini CLI (brew)",
|
|
124
|
+
},
|
|
125
|
+
],
|
|
126
|
+
},
|
|
127
|
+
}
|
|
128
|
+
---
|
|
129
|
+
```
|
|
130
|
+
|
|
131
|
+
## Configuration
|
|
132
|
+
|
|
133
|
+
### Enable/Disable Skills
|
|
134
|
+
|
|
135
|
+
```json
|
|
136
|
+
{
|
|
137
|
+
"skills": {
|
|
138
|
+
"entries": {
|
|
139
|
+
"my-skill": {
|
|
140
|
+
"enabled": true,
|
|
141
|
+
"apiKey": "MY_KEY_HERE",
|
|
142
|
+
"env": {
|
|
143
|
+
"MY_API_KEY": "MY_KEY_HERE"
|
|
144
|
+
},
|
|
145
|
+
"config": {
|
|
146
|
+
"endpoint": "https://api.example.com"
|
|
147
|
+
}
|
|
148
|
+
},
|
|
149
|
+
"disabled-skill": {
|
|
150
|
+
"enabled": false
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
```
|
|
156
|
+
|
|
157
|
+
### Config Fields
|
|
158
|
+
|
|
159
|
+
| Field | Description |
|
|
160
|
+
|-------|-------------|
|
|
161
|
+
| `enabled` | Enable/disable the skill |
|
|
162
|
+
| `apiKey` | Convenience for `primaryEnv` |
|
|
163
|
+
| `env` | Environment variables to inject |
|
|
164
|
+
| `config` | Custom per-skill configuration |
|
|
165
|
+
|
|
166
|
+
### Bundled Skills Allowlist
|
|
167
|
+
|
|
168
|
+
Restrict which bundled skills load:
|
|
169
|
+
|
|
170
|
+
```json
|
|
171
|
+
{
|
|
172
|
+
"skills": {
|
|
173
|
+
"allowBundled": ["skill-a", "skill-b"]
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
```
|
|
177
|
+
|
|
178
|
+
## Environment Injection
|
|
179
|
+
|
|
180
|
+
When an agent run starts:
|
|
181
|
+
|
|
182
|
+
1. Reads skill metadata
|
|
183
|
+
2. Applies `skills.entries.<key>.env` and `apiKey` to `process.env`
|
|
184
|
+
3. Builds system prompt with eligible skills
|
|
185
|
+
4. Restores original environment after run
|
|
186
|
+
|
|
187
|
+
This is **scoped to the agent run**, not global.
|
|
188
|
+
|
|
189
|
+
## Plugin Skills
|
|
190
|
+
|
|
191
|
+
Plugins can ship skills via their manifest:
|
|
192
|
+
|
|
193
|
+
```json
|
|
194
|
+
{
|
|
195
|
+
"id": "my-plugin",
|
|
196
|
+
"skills": ["skills/tool-a", "skills/tool-b"]
|
|
197
|
+
}
|
|
198
|
+
```
|
|
199
|
+
|
|
200
|
+
Plugin skills:
|
|
201
|
+
- Load when the plugin is enabled
|
|
202
|
+
- Participate in normal precedence rules
|
|
203
|
+
- Can be gated via plugin config
|
|
204
|
+
|
|
205
|
+
## ClawHub
|
|
206
|
+
|
|
207
|
+
Browse and install skills from [ClawHub](https://clawhub.com):
|
|
208
|
+
|
|
209
|
+
```bash
|
|
210
|
+
# Install a skill
|
|
211
|
+
clawhub install <skill-slug>
|
|
212
|
+
|
|
213
|
+
# Update all skills
|
|
214
|
+
clawhub update --all
|
|
215
|
+
|
|
216
|
+
# Sync (scan + publish)
|
|
217
|
+
clawhub sync --all
|
|
218
|
+
```
|
|
219
|
+
|
|
220
|
+
Default install location: `./skills` (workspace skills).
|
|
221
|
+
|
|
222
|
+
## Skills Watcher
|
|
223
|
+
|
|
224
|
+
Auto-reload skills when files change:
|
|
225
|
+
|
|
226
|
+
```json
|
|
227
|
+
{
|
|
228
|
+
"skills": {
|
|
229
|
+
"load": {
|
|
230
|
+
"watch": true,
|
|
231
|
+
"watchDebounceMs": 250
|
|
232
|
+
}
|
|
233
|
+
}
|
|
234
|
+
}
|
|
235
|
+
```
|
|
236
|
+
|
|
237
|
+
## Session Snapshot
|
|
238
|
+
|
|
239
|
+
Skills are snapshotted when a session starts and reused for subsequent turns.
|
|
240
|
+
Changes take effect on the next new session (or via hot reload when watching).
|
|
241
|
+
|
|
242
|
+
## Remote Nodes
|
|
243
|
+
|
|
244
|
+
If a Linux Gateway has a connected macOS node with `system.run` allowed,
|
|
245
|
+
macOS-only skills become eligible. The agent executes these via `nodes.run`.
|
|
246
|
+
|
|
247
|
+
## Token Impact
|
|
248
|
+
|
|
249
|
+
Skills add to the system prompt:
|
|
250
|
+
|
|
251
|
+
- **Base overhead:** ~195 characters (when ≥1 skill)
|
|
252
|
+
- **Per skill:** ~97 characters + name + description + location
|
|
253
|
+
|
|
254
|
+
Rough estimate: ~24 tokens per skill plus field content.
|
|
255
|
+
|
|
256
|
+
## Dependency Installation
|
|
257
|
+
|
|
258
|
+
### Install Specifications
|
|
259
|
+
|
|
260
|
+
```json
|
|
261
|
+
{
|
|
262
|
+
"install": [
|
|
263
|
+
{
|
|
264
|
+
"id": "brew",
|
|
265
|
+
"kind": "brew",
|
|
266
|
+
"formula": "tool-name",
|
|
267
|
+
"bins": ["tool-name"],
|
|
268
|
+
"label": "Install via Homebrew"
|
|
269
|
+
},
|
|
270
|
+
{
|
|
271
|
+
"id": "npm",
|
|
272
|
+
"kind": "node",
|
|
273
|
+
"package": "@scope/tool",
|
|
274
|
+
"bins": ["tool-name"],
|
|
275
|
+
"label": "Install via npm"
|
|
276
|
+
},
|
|
277
|
+
{
|
|
278
|
+
"id": "download",
|
|
279
|
+
"kind": "download",
|
|
280
|
+
"url": "https://example.com/tool.tar.gz",
|
|
281
|
+
"archive": "tar.gz",
|
|
282
|
+
"targetDir": "~/.milaidy/tools/tool-name"
|
|
283
|
+
}
|
|
284
|
+
]
|
|
285
|
+
}
|
|
286
|
+
```
|
|
287
|
+
|
|
288
|
+
### Install Kinds
|
|
289
|
+
|
|
290
|
+
| Kind | Description |
|
|
291
|
+
|------|-------------|
|
|
292
|
+
| `brew` | Homebrew formula |
|
|
293
|
+
| `node` | npm/pnpm package |
|
|
294
|
+
| `go` | Go install |
|
|
295
|
+
| `uv` | Python uv |
|
|
296
|
+
| `download` | Direct download |
|
|
297
|
+
|
|
298
|
+
### Node Manager
|
|
299
|
+
|
|
300
|
+
Set the node package manager for skill installs:
|
|
301
|
+
|
|
302
|
+
```json
|
|
303
|
+
{
|
|
304
|
+
"skills": {
|
|
305
|
+
"install": {
|
|
306
|
+
"nodeManager": "pnpm"
|
|
307
|
+
}
|
|
308
|
+
}
|
|
309
|
+
}
|
|
310
|
+
```
|
|
311
|
+
|
|
312
|
+
Options: `npm`, `pnpm`, `yarn`, `bun` (npm default)
|
|
313
|
+
|
|
314
|
+
## Sandboxing Notes
|
|
315
|
+
|
|
316
|
+
Binary requirements (`requires.bins`) are checked on the **host** at load time.
|
|
317
|
+
|
|
318
|
+
For sandboxed agents, binaries must also exist **inside the container**:
|
|
319
|
+
|
|
320
|
+
```json
|
|
321
|
+
{
|
|
322
|
+
"agents": {
|
|
323
|
+
"defaults": {
|
|
324
|
+
"sandbox": {
|
|
325
|
+
"docker": {
|
|
326
|
+
"setupCommand": "apt-get install -y tool-name"
|
|
327
|
+
}
|
|
328
|
+
}
|
|
329
|
+
}
|
|
330
|
+
}
|
|
331
|
+
}
|
|
332
|
+
```
|
|
333
|
+
|
|
334
|
+
## Security
|
|
335
|
+
|
|
336
|
+
- **Treat third-party skills as untrusted code**
|
|
337
|
+
- Skills with `env` inject into the host process
|
|
338
|
+
- Use sandboxed runs for risky tools
|
|
339
|
+
- Keep secrets out of prompts and logs
|
|
340
|
+
|
|
341
|
+
## Creating Skills
|
|
342
|
+
|
|
343
|
+
### Basic Structure
|
|
344
|
+
|
|
345
|
+
```
|
|
346
|
+
my-skill/
|
|
347
|
+
├── SKILL.md # Required
|
|
348
|
+
├── scripts/ # Optional helper scripts
|
|
349
|
+
└── templates/ # Optional templates
|
|
350
|
+
```
|
|
351
|
+
|
|
352
|
+
### SKILL.md Template
|
|
353
|
+
|
|
354
|
+
```markdown
|
|
355
|
+
---
|
|
356
|
+
name: my-skill
|
|
357
|
+
description: Short description of what this skill does
|
|
358
|
+
metadata: {"milaidy": {"requires": {"env": ["MY_API_KEY"]}, "primaryEnv": "MY_API_KEY"}}
|
|
359
|
+
---
|
|
360
|
+
|
|
361
|
+
## Overview
|
|
362
|
+
|
|
363
|
+
This skill enables the agent to...
|
|
364
|
+
|
|
365
|
+
## Usage
|
|
366
|
+
|
|
367
|
+
Use this skill when you need to...
|
|
368
|
+
|
|
369
|
+
## Examples
|
|
370
|
+
|
|
371
|
+
Example invocation:
|
|
372
|
+
- "Do X with Y"
|
|
373
|
+
- "Create Z for me"
|
|
374
|
+
|
|
375
|
+
## Configuration
|
|
376
|
+
|
|
377
|
+
The skill requires the following:
|
|
378
|
+
- `MY_API_KEY`: API key for the service
|
|
379
|
+
|
|
380
|
+
## Notes
|
|
381
|
+
|
|
382
|
+
- Additional notes about behavior
|
|
383
|
+
- Limitations or caveats
|
|
384
|
+
```
|
|
385
|
+
|
|
386
|
+
## Related Docs
|
|
387
|
+
|
|
388
|
+
- [Skills Config](/tools/skills-config) - Full configuration schema
|
|
389
|
+
- [ClawHub](/tools/clawhub) - Skills registry
|
|
390
|
+
- [Creating Skills](/tools/creating-skills) - Development guide
|
|
391
|
+
- [Plugins](/concepts/plugins) - Plugin-provided skills
|
|
392
|
+
- [Security](/gateway/security) - Security considerations
|