@sema-agent/server 1.196.0 → 1.197.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/dist/config.d.ts.map +1 -1
- package/dist/config.js +10 -1
- package/dist/config.js.map +1 -1
- package/package.json +2 -1
- package/skills/code-review.md +28 -0
- package/skills/commit-push-pr.md +77 -0
- package/skills/dataviz/SKILL.md +112 -0
- package/skills/dataviz/references/anti-patterns.md +119 -0
- package/skills/dataviz/references/choosing-a-form.md +57 -0
- package/skills/dataviz/references/color-formula.md +113 -0
- package/skills/dataviz/references/components.md +39 -0
- package/skills/dataviz/references/interaction.md +60 -0
- package/skills/dataviz/references/marks-and-anatomy.md +97 -0
- package/skills/dataviz/references/palette.md +149 -0
- package/skills/dataviz/scripts/validate_palette.js +262 -0
- package/skills/find-skills.md +148 -0
- package/skills/init.md +28 -0
- package/skills/keybindings-help.md +294 -0
- package/skills/loop.md +50 -0
- package/skills/run-skill-generator.md +493 -0
- package/skills/run.md +148 -0
- package/skills/schedule.md +48 -0
- package/skills/security-review.md +181 -0
- package/skills/simplify.md +64 -0
- package/skills/update-config.md +93 -0
- package/skills/verify.md +334 -0
|
@@ -0,0 +1,294 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: keybindings-help
|
|
3
|
+
description: Use when the user wants to customize the interactive shell's keyboard shortcuts, rebind keys, add chord bindings, or modify the shell's keybindings.json. Examples: "rebind ctrl+s", "add a chord shortcut", "change the submit key", "customize keybindings".
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Keybindings Skill
|
|
7
|
+
|
|
8
|
+
Create or modify the shell's user `keybindings.json` to customize keyboard shortcuts. By convention the file lives in the shell's user config directory; the exact location is shell/deployment-configurable - check your shell's docs or an existing file before writing.
|
|
9
|
+
|
|
10
|
+
## CRITICAL: Read Before Write
|
|
11
|
+
|
|
12
|
+
**Always read the existing `keybindings.json` first** (it may not exist yet). Merge changes with existing bindings — never replace the entire file.
|
|
13
|
+
|
|
14
|
+
- Use **Edit** tool for modifications to existing files
|
|
15
|
+
- Use **Write** tool only if the file does not exist yet
|
|
16
|
+
|
|
17
|
+
## File Format
|
|
18
|
+
|
|
19
|
+
```json
|
|
20
|
+
{
|
|
21
|
+
"bindings": [
|
|
22
|
+
{
|
|
23
|
+
"context": "Chat",
|
|
24
|
+
"bindings": {
|
|
25
|
+
"ctrl+e": "chat:externalEditor"
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
]
|
|
29
|
+
}
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
If your shell distribution publishes a JSON schema for this file, include a `$schema` reference to it.
|
|
33
|
+
|
|
34
|
+
## Keystroke Syntax
|
|
35
|
+
|
|
36
|
+
**Modifiers** (combine with `+`):
|
|
37
|
+
- `ctrl` (alias: `control`)
|
|
38
|
+
- `alt` (aliases: `opt`, `option`) — note: `alt` and `meta` are identical in terminals
|
|
39
|
+
- `shift`
|
|
40
|
+
- `meta` (aliases: `cmd`, `command`)
|
|
41
|
+
|
|
42
|
+
**Special keys**: `escape`/`esc`, `enter`/`return`, `tab`, `space`, `backspace`, `delete`, `up`, `down`, `left`, `right`
|
|
43
|
+
|
|
44
|
+
**Chords**: Space-separated keystrokes, e.g. `ctrl+k ctrl+s` (1-second timeout between keystrokes)
|
|
45
|
+
|
|
46
|
+
**Examples**: `ctrl+shift+p`, `alt+enter`, `ctrl+k ctrl+n`
|
|
47
|
+
|
|
48
|
+
## Unbinding Default Shortcuts
|
|
49
|
+
|
|
50
|
+
Set a key to `null` to remove its default binding:
|
|
51
|
+
|
|
52
|
+
```json
|
|
53
|
+
{
|
|
54
|
+
"context": "Chat",
|
|
55
|
+
"bindings": {
|
|
56
|
+
"ctrl+s": null
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
## How User Bindings Interact with Defaults
|
|
62
|
+
|
|
63
|
+
- User bindings are **additive** — they are appended after the default bindings
|
|
64
|
+
- To **move** a binding to a different key: unbind the old key (`null`) AND add the new binding
|
|
65
|
+
- A context only needs to appear in the user's file if they want to change something in that context
|
|
66
|
+
|
|
67
|
+
## Common Patterns
|
|
68
|
+
|
|
69
|
+
### Rebind a key
|
|
70
|
+
To change the external editor shortcut from `ctrl+g` to `ctrl+e`:
|
|
71
|
+
```json
|
|
72
|
+
{
|
|
73
|
+
"context": "Chat",
|
|
74
|
+
"bindings": {
|
|
75
|
+
"ctrl+g": null,
|
|
76
|
+
"ctrl+e": "chat:externalEditor"
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
### Add a chord binding
|
|
82
|
+
```json
|
|
83
|
+
{
|
|
84
|
+
"context": "Global",
|
|
85
|
+
"bindings": {
|
|
86
|
+
"ctrl+k ctrl+t": "app:toggleTodos"
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
## Behavioral Rules
|
|
92
|
+
|
|
93
|
+
1. Only include contexts the user wants to change (minimal overrides)
|
|
94
|
+
2. Validate that actions and contexts are from the known lists below
|
|
95
|
+
3. Warn the user proactively if they choose a key that conflicts with reserved shortcuts or common tools like tmux (`ctrl+b`) and screen (`ctrl+a`)
|
|
96
|
+
4. When adding a new binding for an existing action, the new binding is additive (existing default still works unless explicitly unbound)
|
|
97
|
+
5. To fully replace a default binding, unbind the old key AND add the new one
|
|
98
|
+
|
|
99
|
+
## Validation
|
|
100
|
+
|
|
101
|
+
The shell validates `keybindings.json` when it loads; warnings go to the debug log. After editing the file, re-check it against the rules below and fix anything that matches.
|
|
102
|
+
|
|
103
|
+
### Common Issues and Fixes
|
|
104
|
+
|
|
105
|
+
| Issue | Cause | Fix |
|
|
106
|
+
| --- | --- | --- |
|
|
107
|
+
| `keybindings.json must have a "bindings" array` | Missing wrapper object | Wrap bindings in `{ "bindings": [...] }` |
|
|
108
|
+
| `"bindings" must be an array` | `bindings` is not an array | Set `"bindings"` to an array: `[{ context: ..., bindings: ... }]` |
|
|
109
|
+
| `Unknown context "X"` | Typo or invalid context name | Use exact context names from the Available Contexts table |
|
|
110
|
+
| `Duplicate key "X" in Y bindings` | Same key defined twice in one context | Remove the duplicate; JSON uses only the last value |
|
|
111
|
+
| `"X" may not work: ...` | Key conflicts with terminal/OS reserved shortcut | Choose a different key (see Reserved Shortcuts section) |
|
|
112
|
+
| `Could not parse keystroke "X"` | Invalid key syntax | Check syntax: use `+` between modifiers, valid key names |
|
|
113
|
+
| `Invalid action for "X"` | Action value is not a string or null | Actions must be strings like `"app:help"` or `null` to unbind |
|
|
114
|
+
|
|
115
|
+
### Example validation warnings (debug log)
|
|
116
|
+
|
|
117
|
+
```
|
|
118
|
+
[keybindings] Found 2 validation issue(s)
|
|
119
|
+
[keybindings] [error] Unknown context "chat" — Valid contexts: Global, Chat, Autocomplete, ...
|
|
120
|
+
[keybindings] [warning] "ctrl+c" may not work: Terminal interrupt (SIGINT)
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
**Errors** prevent bindings from working and must be fixed. **Warnings** indicate potential conflicts but the binding may still work.
|
|
124
|
+
|
|
125
|
+
## Reserved Shortcuts
|
|
126
|
+
|
|
127
|
+
### Non-rebindable (errors)
|
|
128
|
+
- `ctrl+c` — Cannot be rebound - used for interrupt/exit (hardcoded)
|
|
129
|
+
- `ctrl+d` — Cannot be rebound - used for exit (hardcoded)
|
|
130
|
+
- `ctrl+m` — Cannot be rebound - identical to Enter in terminals (both send CR)
|
|
131
|
+
- `capslock` — Caps Lock is not delivered to terminal applications
|
|
132
|
+
|
|
133
|
+
### Terminal reserved (errors/warnings)
|
|
134
|
+
- `ctrl+z` — Unix process suspend (SIGTSTP) (may conflict)
|
|
135
|
+
- `ctrl+\` — Terminal quit signal (SIGQUIT) (will not work)
|
|
136
|
+
|
|
137
|
+
### macOS reserved (errors)
|
|
138
|
+
- `cmd+c` — macOS system copy
|
|
139
|
+
- `cmd+v` — macOS system paste
|
|
140
|
+
- `cmd+x` — macOS system cut
|
|
141
|
+
- `cmd+q` — macOS quit application
|
|
142
|
+
- `cmd+w` — macOS close window/tab
|
|
143
|
+
- `cmd+tab` — macOS app switcher
|
|
144
|
+
- `cmd+space` — macOS Spotlight
|
|
145
|
+
|
|
146
|
+
## Available Contexts
|
|
147
|
+
|
|
148
|
+
| Context | Description |
|
|
149
|
+
| --- | --- |
|
|
150
|
+
| `Global` | Active everywhere, regardless of focus |
|
|
151
|
+
| `Chat` | When the chat input is focused |
|
|
152
|
+
| `Autocomplete` | When autocomplete menu is visible |
|
|
153
|
+
| `Confirmation` | When a confirmation/permission dialog is shown |
|
|
154
|
+
| `Help` | When the help overlay is open |
|
|
155
|
+
| `Transcript` | When viewing the transcript |
|
|
156
|
+
| `HistorySearch` | When searching command history (ctrl+r) |
|
|
157
|
+
| `Task` | When a task/agent is running in the foreground |
|
|
158
|
+
| `ThemePicker` | When the theme picker is open |
|
|
159
|
+
| `Settings` | When the settings menu is open |
|
|
160
|
+
| `Tabs` | When tab navigation is active |
|
|
161
|
+
| `Attachments` | When navigating image attachments in a select dialog |
|
|
162
|
+
| `Footer` | When footer indicators are focused |
|
|
163
|
+
| `MessageSelector` | When the message selector (rewind) is open |
|
|
164
|
+
| `DiffDialog` | When the diff dialog is open |
|
|
165
|
+
| `DiffPanel` | When the diff sidebar panel is open |
|
|
166
|
+
| `ModelPicker` | When the model picker is open |
|
|
167
|
+
| `Select` | When a select/list component is focused |
|
|
168
|
+
| `Plugin` | When the plugin dialog is open |
|
|
169
|
+
| `Scroll` | When a scrollable view is focused (fullscreen layout) |
|
|
170
|
+
|
|
171
|
+
## Available Actions
|
|
172
|
+
|
|
173
|
+
| Action | Default Key(s) | Context |
|
|
174
|
+
| --- | --- | --- |
|
|
175
|
+
| `app:interrupt` | `ctrl+c` | Global |
|
|
176
|
+
| `app:exit` | `ctrl+d` | Global |
|
|
177
|
+
| `app:toggleTodos` | `ctrl+t` | Global |
|
|
178
|
+
| `app:toggleTranscript` | `ctrl+o` | Global |
|
|
179
|
+
| `app:toggleBrief` | `ctrl+shift+b` | Global |
|
|
180
|
+
| `app:toggleReplTab` | (none) | Global |
|
|
181
|
+
| `app:toggleDiffNoiseFilter` | (none) | Global |
|
|
182
|
+
| `app:diffFileListUp` | `ctrl+up`, `meta+up` | Global |
|
|
183
|
+
| `app:diffFileListDown` | `ctrl+down`, `meta+down` | Global |
|
|
184
|
+
| `app:toggleDiffPreSession` | (none) | Global |
|
|
185
|
+
| `app:cycleDiffBase` | (none) | Global |
|
|
186
|
+
| `app:toggleTerminal` | (none) | Global |
|
|
187
|
+
| `app:redraw` | (none) | Global |
|
|
188
|
+
| `app:openArtifact` | `ctrl+]` | Global |
|
|
189
|
+
| `history:search` | `ctrl+r` | Global |
|
|
190
|
+
| `history:previous` | `up` | Chat |
|
|
191
|
+
| `history:next` | `down` | Chat |
|
|
192
|
+
| `chat:cancel` | `escape` | Chat |
|
|
193
|
+
| `chat:killAgents` | `ctrl+x ctrl+k` | Chat |
|
|
194
|
+
| `chat:cycleMode` | `shift+tab` | Chat |
|
|
195
|
+
| `chat:modelPicker` | `meta+p` | Chat |
|
|
196
|
+
| `chat:fastMode` | `meta+o` | Chat |
|
|
197
|
+
| `chat:thinkingToggle` | `meta+t` | Chat |
|
|
198
|
+
| `chat:workflowKeywordToggle` | `meta+w` | Chat |
|
|
199
|
+
| `chat:submit` | `enter` | Chat |
|
|
200
|
+
| `chat:newline` | `ctrl+j` | Chat |
|
|
201
|
+
| `chat:undo` | `ctrl+_`, `ctrl+-`, `ctrl+shift+-`, `ctrl+shift+_` | Chat |
|
|
202
|
+
| `chat:externalEditor` | `ctrl+x ctrl+e`, `ctrl+g` | Chat |
|
|
203
|
+
| `chat:stash` | `ctrl+s` | Chat |
|
|
204
|
+
| `chat:imagePaste` | `ctrl+v` | Chat |
|
|
205
|
+
| `chat:clearInput` | `ctrl+l` | Chat |
|
|
206
|
+
| `chat:clearScreen` | `cmd+k` | Chat |
|
|
207
|
+
| `autocomplete:accept` | `tab` | Autocomplete |
|
|
208
|
+
| `autocomplete:dismiss` | `escape` | Autocomplete |
|
|
209
|
+
| `autocomplete:previous` | `up` | Autocomplete |
|
|
210
|
+
| `autocomplete:next` | `down` | Autocomplete |
|
|
211
|
+
| `confirm:yes` | `y`, `enter` | Confirmation |
|
|
212
|
+
| `confirm:no` | `escape`, `n`, `escape` | Settings |
|
|
213
|
+
| `confirm:previous` | `up` | Confirmation |
|
|
214
|
+
| `confirm:next` | `down` | Confirmation |
|
|
215
|
+
| `confirm:nextField` | `tab` | Confirmation |
|
|
216
|
+
| `confirm:previousField` | (none) | Confirmation |
|
|
217
|
+
| `confirm:cycleMode` | `shift+tab` | Confirmation |
|
|
218
|
+
| `confirm:toggle` | `space` | Confirmation |
|
|
219
|
+
| `confirm:toggleExplanation` | `ctrl+e` | Confirmation |
|
|
220
|
+
| `tabs:next` | `tab`, `right` | Tabs |
|
|
221
|
+
| `tabs:previous` | `shift+tab`, `left` | Tabs |
|
|
222
|
+
| `transcript:toggleShowAll` | `ctrl+e` | Transcript |
|
|
223
|
+
| `transcript:exit` | `ctrl+c`, `escape`, `q` | Transcript |
|
|
224
|
+
| `historySearch:next` | `ctrl+r` | HistorySearch |
|
|
225
|
+
| `historySearch:accept` | `escape`, `tab` | HistorySearch |
|
|
226
|
+
| `historySearch:cancel` | `ctrl+c` | HistorySearch |
|
|
227
|
+
| `historySearch:execute` | `enter` | HistorySearch |
|
|
228
|
+
| `historySearch:cycleScope` | `ctrl+s` | HistorySearch |
|
|
229
|
+
| `task:background` | `ctrl+x ctrl+b`, `ctrl+b` | Task |
|
|
230
|
+
| `theme:toggleSyntaxHighlighting` | `ctrl+t` | ThemePicker |
|
|
231
|
+
| `theme:editCustom` | `ctrl+e` | ThemePicker |
|
|
232
|
+
| `help:dismiss` | `escape` | Help |
|
|
233
|
+
| `attachments:next` | `right` | Attachments |
|
|
234
|
+
| `attachments:previous` | `left` | Attachments |
|
|
235
|
+
| `attachments:remove` | `backspace`, `delete` | Attachments |
|
|
236
|
+
| `attachments:exit` | `down`, `escape` | Attachments |
|
|
237
|
+
| `footer:up` | `up`, `ctrl+p` | Footer |
|
|
238
|
+
| `footer:down` | `down`, `ctrl+n` | Footer |
|
|
239
|
+
| `footer:next` | `right` | Footer |
|
|
240
|
+
| `footer:previous` | `left` | Footer |
|
|
241
|
+
| `footer:openSelected` | `enter` | Footer |
|
|
242
|
+
| `footer:clearSelection` | `escape` | Footer |
|
|
243
|
+
| `footer:close` | `x` | Footer |
|
|
244
|
+
| `messageSelector:up` | `up`, `k`, `ctrl+p` | MessageSelector |
|
|
245
|
+
| `messageSelector:down` | `down`, `j`, `ctrl+n` | MessageSelector |
|
|
246
|
+
| `messageSelector:top` | `ctrl+up`, `shift+up`, `meta+up`, `shift+k` | MessageSelector |
|
|
247
|
+
| `messageSelector:bottom` | `ctrl+down`, `shift+down`, `meta+down`, `shift+j` | MessageSelector |
|
|
248
|
+
| `messageSelector:select` | `enter` | MessageSelector |
|
|
249
|
+
| `diff:dismiss` | `escape` | DiffDialog |
|
|
250
|
+
| `diff:previousSource` | `left` | DiffDialog |
|
|
251
|
+
| `diff:nextSource` | `right` | DiffDialog |
|
|
252
|
+
| `diff:back` | (none) | DiffDialog |
|
|
253
|
+
| `diff:viewDetails` | `enter` | DiffDialog |
|
|
254
|
+
| `diff:previousFile` | `up`, `k` | DiffDialog |
|
|
255
|
+
| `diff:nextFile` | `down`, `j` | DiffDialog |
|
|
256
|
+
| `modelPicker:decreaseEffort` | `left` | ModelPicker |
|
|
257
|
+
| `modelPicker:increaseEffort` | `right` | ModelPicker |
|
|
258
|
+
| `modelPicker:thisSessionOnly` | `s` | ModelPicker |
|
|
259
|
+
| `select:next` | `down`, `j`, `ctrl+n`, `down`, `j`, `ctrl+n` | Settings |
|
|
260
|
+
| `select:previous` | `up`, `k`, `ctrl+p`, `up`, `k`, `ctrl+p` | Settings |
|
|
261
|
+
| `select:pageUp` | `pageup` | Select |
|
|
262
|
+
| `select:pageDown` | `pagedown` | Select |
|
|
263
|
+
| `select:first` | `home` | Select |
|
|
264
|
+
| `select:last` | `end` | Select |
|
|
265
|
+
| `select:accept` | `space`, `enter`, `enter` | Settings |
|
|
266
|
+
| `select:cancel` | `escape` | Select |
|
|
267
|
+
| `plugin:toggle` | `space` | Plugin |
|
|
268
|
+
| `plugin:install` | `i` | Plugin |
|
|
269
|
+
| `plugin:favorite` | `f` | Plugin |
|
|
270
|
+
| `permission:toggleDebug` | (none) | Confirmation |
|
|
271
|
+
| `settings:search` | `/` | Settings |
|
|
272
|
+
| `settings:retry` | `r` | Settings |
|
|
273
|
+
| `settings:periodDay` | `d` | Settings |
|
|
274
|
+
| `settings:periodWeek` | `w` | Settings |
|
|
275
|
+
| `settings:sortByTokens` | `t` | Settings |
|
|
276
|
+
| `voice:pushToTalk` | `space` | Chat |
|
|
277
|
+
| `scroll:pageUp` | `pageup`, `pageup` | Scroll |
|
|
278
|
+
| `scroll:pageDown` | `pagedown`, `pagedown` | Scroll |
|
|
279
|
+
| `scroll:lineUp` | `ctrl+p`, `k`, `up`, `wheelup` | Transcript |
|
|
280
|
+
| `scroll:lineDown` | `ctrl+n`, `j`, `down`, `wheeldown` | Transcript |
|
|
281
|
+
| `scroll:top` | `g`, `home`, `ctrl+home`, `g`, `home` | Transcript |
|
|
282
|
+
| `scroll:bottom` | `shift+g`, `end`, `ctrl+end`, `shift+g`, `end` | Transcript |
|
|
283
|
+
| `scroll:halfPageUp` | `ctrl+u`, `ctrl+u` | Settings |
|
|
284
|
+
| `scroll:halfPageDown` | `ctrl+d`, `ctrl+d` | Settings |
|
|
285
|
+
| `scroll:fullPageUp` | `ctrl+b`, `b`, `shift+space`, `b` | Transcript |
|
|
286
|
+
| `scroll:fullPageDown` | `ctrl+f`, `space`, `space` | Transcript |
|
|
287
|
+
| `selection:copy` | `ctrl+shift+c`, `cmd+c` | Scroll |
|
|
288
|
+
| `selection:clear` | (none) | Unknown |
|
|
289
|
+
| `selection:extendLeft` | `shift+left` | Scroll |
|
|
290
|
+
| `selection:extendRight` | `shift+right` | Scroll |
|
|
291
|
+
| `selection:extendUp` | `shift+up` | Scroll |
|
|
292
|
+
| `selection:extendDown` | `shift+down` | Scroll |
|
|
293
|
+
| `selection:extendLineStart` | `shift+home` | Scroll |
|
|
294
|
+
| `selection:extendLineEnd` | `shift+end` | Scroll |
|
package/skills/loop.md
ADDED
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: loop
|
|
3
|
+
description: Run a prompt or slash command on a recurring interval (e.g. /loop 5m /foo). Omit the interval to let the model self-pace. - When the user wants to set up a recurring task, poll for status, or run something repeatedly on an interval (e.g. "check the deploy every 5 minutes", "keep running /babysit-prs"). Do NOT invoke for one-off tasks.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# /loop — run a prompt on a recurring cadence
|
|
7
|
+
|
|
8
|
+
Parse the input as `[interval] <prompt…>` and schedule it. sema has TWO loop mechanisms — pick by whether an interval was given:
|
|
9
|
+
|
|
10
|
+
- **Interval given** → fixed cadence: schedule with `CronCreate` (fires as a scheduled task via the sema scheduler).
|
|
11
|
+
- **No interval** → dynamic mode: YOU self-pace the loop with `ScheduleWakeup`, choosing each delay from what you are actually waiting for.
|
|
12
|
+
|
|
13
|
+
## Parsing (in priority order)
|
|
14
|
+
|
|
15
|
+
1. **Leading token**: if the first whitespace-delimited token matches `^\d+[smhd]$` (e.g. `5m`, `2h`), that's the interval; the rest is the prompt.
|
|
16
|
+
2. **Trailing "every" clause**: if the input ends with `every <N><unit>` or `every <N> <unit-word>` (e.g. `every 20m`, `every 5 minutes`), extract it as the interval and strip it from the prompt. Only match when what follows "every" is a time expression — `check every PR` has no interval.
|
|
17
|
+
3. **Otherwise**: no interval → dynamic mode; the entire input is the prompt.
|
|
18
|
+
|
|
19
|
+
If the resulting prompt is empty AND no interval was given, show usage `/loop [interval] <prompt>` and stop. An empty prompt WITH intent to run autonomously is the autonomous-loop case (see sentinels below).
|
|
20
|
+
|
|
21
|
+
## Fixed cadence: CronCreate
|
|
22
|
+
|
|
23
|
+
Convert the interval to a 5-field local-time cron expression (`Nm` → `*/N * * * *`; `Nh` → `0 */N * * *`; `Nd` → `0 0 */N * *`; `Ns` → round up to whole minutes — 1 minute is the floor). If the interval doesn't divide its unit cleanly (e.g. `7m`, `90m`), pick the nearest clean interval and tell the user what you rounded to.
|
|
24
|
+
|
|
25
|
+
Call `CronCreate` with:
|
|
26
|
+
|
|
27
|
+
- `prompt`: the parsed prompt, verbatim (slash commands pass through unchanged). The task fires UNATTENDED and will not see this conversation, so if the prompt relies on conversational context, rewrite it self-contained first.
|
|
28
|
+
- `schedule`: `{ "kind": "cron", "expr": "<the expression>" }`
|
|
29
|
+
- `label`: a short name for the loop (also the dedup key — re-creating with the same schedule+label upserts instead of duplicating).
|
|
30
|
+
|
|
31
|
+
Then briefly confirm what's scheduled (id, human cadence, how to cancel with `CronDelete`), and **immediately execute the parsed prompt once now** — don't wait for the first fire.
|
|
32
|
+
|
|
33
|
+
## Dynamic mode: ScheduleWakeup
|
|
34
|
+
|
|
35
|
+
With no interval, run one iteration of the task now, then call `ScheduleWakeup` to schedule when you resume:
|
|
36
|
+
|
|
37
|
+
- `delaySeconds`: how long to sleep (runtime clamps to [60, 3600]).
|
|
38
|
+
- `reason`: one short, specific sentence ("watching CI run #123" beats "waiting") — shown to the user and telemetry.
|
|
39
|
+
- `prompt`: the same /loop input verbatim, so the next firing re-enters this skill and continues the loop. For an autonomous loop with no user prompt, pass the literal sentinel `<<autonomous-loop-dynamic>>` (never the CronCreate-mode `<<autonomous-loop>>` sentinel — ScheduleWakeup always uses the `-dynamic` variant).
|
|
40
|
+
- To END the loop: call `ScheduleWakeup` with `stop: true` and omit every other field — the loop ends immediately and no further wakeups fire.
|
|
41
|
+
|
|
42
|
+
### Picking delaySeconds
|
|
43
|
+
|
|
44
|
+
Do NOT schedule short wakeups to poll harness-tracked background work — when tracked work finishes you are re-invoked automatically, so polling is wasted; schedule a long fallback (1200s+) so the loop survives if the work hangs. Only poll external state the harness cannot track (a CI run, a deploy, a remote queue), and pick the delay from how fast that state actually changes.
|
|
45
|
+
|
|
46
|
+
Wake-up cost is driven by the provider prompt cache: anthropic-messages routes default to a ~5-minute cache TTL (waking under ~300s stays warm; prefer 270s over 300s when actively polling, and commit to 1200s+ rather than repeated ~300s waits). Routes with hours-long cache retention (e.g. DeepSeek) re-read your context cached at any delay in the clamp range — there, pick purely from the signal you're waiting for. Never schedule extra wakeups just to keep the cache warm. For idle ticks with no specific signal, default to 1200–1800s.
|
|
47
|
+
|
|
48
|
+
## Which mechanism backs this
|
|
49
|
+
|
|
50
|
+
Both tools are engine tools mounted only when the runtime exposes a scheduler capability; in the sema TOC shell that backend is the shell scheduler daemon, which persists tasks and fires them on time. Dynamic wakeups resume THIS session (`mode: session-wakeup`, label `loop-wakeup`); CronCreate tasks run unattended. If `CronCreate`/`ScheduleWakeup` are not in your tool list, the scheduler capability is not wired in this session — say so instead of simulating a loop with sleeps.
|