skillscript-runtime 0.27.3 → 0.31.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.
@@ -105,4 +105,199 @@ export function extractEffectfulFootprint(parsed) {
105
105
  notifies,
106
106
  };
107
107
  }
108
+ /** Lane cap — beyond this the flow stops being a readable orientation aid. */
109
+ const MAX_FLOW_LANES = 40;
110
+ /** Built-in `$` ops → plain language. Unlisted builtins fall back to their name. */
111
+ const BUILTIN_STEP = {
112
+ data_read: { label: "Read from the data store", tone: "normal" },
113
+ data_write: { label: "Write to the data store", tone: "mutation" },
114
+ llm: { label: "Ask the local model", tone: "normal" },
115
+ json_parse: { label: "Parse JSON", tone: "normal" },
116
+ execute_skill: { label: "Run another skill", tone: "normal" },
117
+ skill_read: { label: "Read a skill", tone: "normal" },
118
+ skill_list: { label: "List skills", tone: "normal" },
119
+ skill_write: { label: "Write a skill", tone: "mutation" },
120
+ };
121
+ function humanizeToolName(tool) {
122
+ return tool.replace(/_/g, " ");
123
+ }
124
+ /** Pull the binary + a short command snippet out of a `shell(command="…")` op. */
125
+ function shellCommand(op) {
126
+ if (op.argv && op.argv.length > 0) {
127
+ return { binary: op.argv[0] ?? "", snippet: op.argv.join(" ") };
128
+ }
129
+ const m = op.body.match(/command\s*=\s*"([^"]*)"/) ?? op.body.match(/command\s*=\s*'([^']*)'/);
130
+ const cmd = (m?.[1] ?? op.body).trim();
131
+ return { binary: firstToken(cmd), snippet: cmd === "" ? undefined : cmd };
132
+ }
133
+ function clip(s, max) {
134
+ if (s === undefined)
135
+ return undefined;
136
+ return s.length <= max ? s : s.slice(0, max - 1) + "…";
137
+ }
138
+ /** A `$set` value shown only when it's a plain literal — computed expressions
139
+ * (variable references / filters) are raw skillscript, noise to a reader, so
140
+ * they're dropped and the step reads simply as "Set X". */
141
+ function literalSetValue(v) {
142
+ if (v === undefined || v === "")
143
+ return undefined;
144
+ if (v.includes("${") || v.includes("$("))
145
+ return undefined;
146
+ return clip(v.replace(/^["']|["']$/g, ""), 60);
147
+ }
148
+ /** Value of a `key="…"` (or `key='…'`) kwarg in an op body. `key` comes from a
149
+ * fixed internal list, so building the RegExp from it is safe. */
150
+ function argValue(body, key) {
151
+ return body.match(new RegExp(key + '\\s*=\\s*"([^"]*)"'))?.[1]
152
+ ?? body.match(new RegExp(key + "\\s*=\\s*'([^']*)'"))?.[1];
153
+ }
154
+ /** The most human-meaningful argument to show for a step — the "what" (the
155
+ * query it reads, the prompt it asks, the content it writes). First match wins. */
156
+ const PRIMARY_ARG_KEYS = ["query", "prompt", "content", "message", "text", "url", "path", "name", "mode"];
157
+ function primaryArg(body) {
158
+ for (const k of PRIMARY_ARG_KEYS) {
159
+ const v = argValue(body, k);
160
+ if (v !== undefined && v !== "")
161
+ return v;
162
+ }
163
+ return undefined;
164
+ }
165
+ /** Describe one op as a human-readable step. Leaf steps also carry the variable
166
+ * they produce (`-> VAR`) so a reader can trace data flow — see where a value is
167
+ * created and where (or whether) it's used. */
168
+ function describeStep(op) {
169
+ const step = describeStepBody(op);
170
+ if (op.outputVar !== undefined && op.outputVar !== "" && step.children === undefined && step.branches === undefined) {
171
+ step.produces = op.outputVar;
172
+ }
173
+ return step;
174
+ }
175
+ function describeStepBody(op) {
176
+ switch (op.kind) {
177
+ case "foreach":
178
+ return {
179
+ label: `For each ${op.foreachIter ?? "item"} in ${op.foreachList ?? "the list"}`,
180
+ tone: "normal",
181
+ children: (op.foreachBody ?? []).map(describeStep),
182
+ };
183
+ case "if": {
184
+ const branches = (op.ifBranches ?? []).map((b, i) => ({
185
+ label: `${i === 0 ? "If" : "Otherwise, if"} ${clip(b.cond, 60)}`,
186
+ steps: b.body.map(describeStep),
187
+ }));
188
+ if (op.ifElseBody)
189
+ branches.push({ label: "Otherwise", steps: op.ifElseBody.map(describeStep) });
190
+ return { label: "Depending on the result", tone: "normal", branches };
191
+ }
192
+ case "shell": {
193
+ const { binary, snippet } = shellCommand(op);
194
+ if (op.policy === "unsafe") {
195
+ return { label: "Run a full bash command", detail: clip(snippet, 70), tone: "shell" };
196
+ }
197
+ return { label: binary ? `Run ${binary}` : "Run a shell command", detail: clip(snippet, 70), tone: "shell" };
198
+ }
199
+ case "file_read":
200
+ return { label: "Read a file", detail: clip(op.fileParams?.path, 60), tone: "normal" };
201
+ case "file_write":
202
+ return { label: "Write a file", detail: clip(op.fileParams?.path, 60), tone: "mutation" };
203
+ case "notify":
204
+ return { label: "Send a notification", tone: "mutation" };
205
+ case "emit":
206
+ return { label: "Produce output", tone: "normal" };
207
+ case "inline": {
208
+ const name = op.ampParams?.skillName;
209
+ const step = { label: name ? `Include the ${name} skill` : "Include a skill", tone: "normal" };
210
+ if (name)
211
+ step.ref = { skill: name };
212
+ return step;
213
+ }
214
+ case "$set":
215
+ return { label: `Set ${op.setName ?? "a value"}`, detail: literalSetValue(op.setValue), tone: "normal" };
216
+ case "$append":
217
+ return { label: `Add to ${op.setName ?? "a value"}`, detail: literalSetValue(op.setValue), tone: "normal" };
218
+ case "?":
219
+ return { label: "Check a condition", tone: "normal" };
220
+ case "$": {
221
+ const tool = firstToken(op.body);
222
+ // A composed skill: name it, and carry a ref so the UI can link through.
223
+ if (op.mcpConnector === undefined && tool === "execute_skill") {
224
+ const child = argValue(op.body, "skill_name") ?? argValue(op.body, "skill");
225
+ const step = { label: child ? `Run the ${child} skill` : "Run another skill", tone: "normal" };
226
+ if (child)
227
+ step.ref = { skill: child };
228
+ return step;
229
+ }
230
+ const detail = clip(primaryArg(op.body), 60);
231
+ if (op.mcpConnector !== undefined) {
232
+ return { label: humanizeToolName(tool), detail: detail ?? `via ${op.mcpConnector}`, tone: "normal" };
233
+ }
234
+ const known = BUILTIN_STEP[tool];
235
+ if (known !== undefined) {
236
+ return { label: known.label, detail, tone: known.tone };
237
+ }
238
+ return { label: tool === "" ? "Run an operation" : humanizeToolName(tool), detail, tone: "normal" };
239
+ }
240
+ default:
241
+ return { label: String(op.kind), tone: "normal" };
242
+ }
243
+ }
244
+ /** Order targets so a needed target precedes its dependents (Kahn's algorithm),
245
+ * falling back to declaration order for any leftovers (e.g. a dependency cycle,
246
+ * which compile rejects anyway). */
247
+ function orderLanes(names, depsOf) {
248
+ const present = new Set(names);
249
+ const indeg = new Map(names.map((n) => [n, 0]));
250
+ for (const n of names)
251
+ for (const d of depsOf(n))
252
+ if (present.has(d))
253
+ indeg.set(n, (indeg.get(n) ?? 0) + 1);
254
+ const queue = names.filter((n) => (indeg.get(n) ?? 0) === 0);
255
+ const ordered = [];
256
+ const seen = new Set();
257
+ while (queue.length > 0) {
258
+ const n = queue.shift();
259
+ if (seen.has(n))
260
+ continue;
261
+ seen.add(n);
262
+ ordered.push(n);
263
+ for (const m of names) {
264
+ if (seen.has(m))
265
+ continue;
266
+ if (depsOf(m).includes(n)) {
267
+ indeg.set(m, (indeg.get(m) ?? 1) - 1);
268
+ if ((indeg.get(m) ?? 0) <= 0)
269
+ queue.push(m);
270
+ }
271
+ }
272
+ }
273
+ for (const n of names)
274
+ if (!seen.has(n))
275
+ ordered.push(n); // cycle leftovers, declaration order
276
+ return ordered;
277
+ }
278
+ /**
279
+ * Project a parsed skill into reading-order lanes of plain-language steps.
280
+ * Body-only skills (no targets) return an empty lane list — the dashboard shows
281
+ * no flow for those (there is nothing to walk).
282
+ */
283
+ export function buildSkillFlow(parsed) {
284
+ const allNames = [...parsed.targets.keys()];
285
+ const truncated = allNames.length > MAX_FLOW_LANES;
286
+ const names = truncated ? allNames.slice(0, MAX_FLOW_LANES) : allNames;
287
+ const included = new Set(names);
288
+ const ordered = orderLanes(names, (n) => parsed.targets.get(n)?.deps ?? []);
289
+ const lanes = ordered.map((name) => {
290
+ const target = parsed.targets.get(name);
291
+ return {
292
+ id: name,
293
+ isEntry: parsed.entryTarget === name,
294
+ deps: target.deps.filter((d) => included.has(d)),
295
+ steps: target.ops.map(describeStep),
296
+ };
297
+ });
298
+ const entry = parsed.entryTarget !== null && included.has(parsed.entryTarget)
299
+ ? parsed.entryTarget
300
+ : null;
301
+ return { lanes, entry, truncated };
302
+ }
108
303
  //# sourceMappingURL=skill-surface.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"skill-surface.js","sourceRoot":"","sources":["../src/skill-surface.ts"],"names":[],"mappings":"AAAA,iEAAiE;AACjE,EAAE;AACF,2EAA2E;AAC3E,gFAAgF;AAChF,6EAA6E;AAC7E,8EAA8E;AAC9E,8EAA8E;AAC9E,gFAAgF;AAChF,mDAAmD;AAqBnD,qFAAqF;AACrF,SAAS,OAAO,CAAC,GAAc,EAAE,KAA4B;IAC3D,KAAK,MAAM,EAAE,IAAI,GAAG,EAAE,CAAC;QACrB,KAAK,CAAC,EAAE,CAAC,CAAC;QACV,IAAI,EAAE,CAAC,WAAW;YAAE,OAAO,CAAC,EAAE,CAAC,WAAW,EAAE,KAAK,CAAC,CAAC;QACnD,IAAI,EAAE,CAAC,UAAU;YAAE,KAAK,MAAM,CAAC,IAAI,EAAE,CAAC,UAAU;gBAAE,OAAO,CAAC,CAAC,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;QACzE,IAAI,EAAE,CAAC,UAAU;YAAE,OAAO,CAAC,EAAE,CAAC,UAAU,EAAE,KAAK,CAAC,CAAC;IACnD,CAAC;AACH,CAAC;AAED,SAAS,UAAU,CAAC,CAAS;IAC3B,OAAO,CAAC,CAAC,IAAI,EAAE,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC;AACxC,CAAC;AAED;;;;;;;GAOG;AACH,MAAM,UAAU,wBAAwB,CAAC,MAAmB;IAC1D,MAAM,IAAI,GAAG,IAAI,GAAG,EAA+C,CAAC;IACpE,KAAK,MAAM,MAAM,IAAI,MAAM,CAAC,OAAO,CAAC,MAAM,EAAE,EAAE,CAAC;QAC7C,OAAO,CAAC,MAAM,CAAC,GAAG,EAAE,CAAC,EAAE,EAAE,EAAE;YACzB,IAAI,EAAE,CAAC,IAAI,KAAK,GAAG,IAAI,EAAE,CAAC,YAAY,K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AAC,CAAC,CAAC,EAAE,IAAI,IAAI,EAAE,CAAC,CAAC;IAC5E,MAAM,KAAK,GAAe,OAAO,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE;QAC7C,MAAM,MAAM,GAAG,MAAM,CAAC,OAAO,CAAC,GAAG,CAAC,IAAI,CAAE,CAAC;QACzC,OAAO;YACL,EAAE,EAAE,IAAI;YACR,OAAO,EAAE,MAAM,CAAC,WAAW,KAAK,IAAI;YACpC,IAAI,EAAE,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;YAChD,KAAK,EAAE,MAAM,CAAC,GAAG,CAAC,GAAG,CAAC,YAAY,CAAC;SACpC,CAAC;IACJ,CAAC,CAAC,CAAC;IAEH,MAAM,KAAK,GAAG,MAAM,CAAC,WAAW,KAAK,IAAI,IAAI,QAAQ,CAAC,GAAG,CAAC,MAAM,CAAC,WAAW,CAAC;QAC3E,CAAC,CAAC,MAAM,CAAC,WAAW;QACpB,CAAC,CAAC,IAAI,CAAC;IAET,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,SAAS,EAAE,CAAC;AACrC,CAAC"}
@@ -0,0 +1,157 @@
1
+ ---
2
+ title: Adopter Agent Guide
3
+ description: "Wire your agent's instruction file so it discovers and prefers its skills instead of re-reasoning every session."
4
+ mode: wide
5
+ ---
6
+
7
+ How to set up your agent's instruction file (`CLAUDE.md`, `AGENTS.md`, system prompt — whatever your harness uses) so the agent actually *takes advantage* of Skillscript instead of ignoring it.
8
+
9
+ Skillscript gives your agent a way to **capture a routine once as a durable, compiled, auditable skill** and run it many times — instead of re-reasoning the same workflow from scratch on every session, burning tokens and drifting a little each time. But an agent only uses skills if its instructions tell it to look. This guide is the minimum wiring to make that happen.
10
+
11
+ ---
12
+
13
+ ## 1. The runtime tells your agent how to use it
14
+
15
+ **You probably don't need to paste anything.** The MCP server ships the usage contract as its `instructions` field — most MCP hosts surface that to the model at session start, so a connecting agent already knows to `skill_list()` first, preflight before composing, author-when-repeated, and never assume a backend. Quick check: after wiring the MCP, ask your agent "what do you know about skillscript?" — if it describes the workflow, you're done, and your `CLAUDE.md` / `AGENTS.md` needs nothing about Skillscript.
16
+
17
+ **If your host doesn't surface server `instructions`** (some don't), paste the block below into your agent file. It mirrors what the server delivers — the authoritative copy is the runtime's `instructions` field, so keep this in sync rather than diverging from it.
18
+
19
+ ```markdown
20
+ ## Skillscript — your durable skills
21
+
22
+ You have a Skillscript runtime wired over MCP. A *skillscript* is a compiled,
23
+ auditable, reusable procedure — a routine captured once and run many times,
24
+ rather than re-derived every session.
25
+
26
+ ### At session start
27
+ List what you already have before doing routine work:
28
+
29
+ - `skill_list()` — returns your skills grouped by category:
30
+ - **skills** — skills you can invoke directly (template-output skills + skills with no `# Output:` declaration)
31
+ - **receives** — skills that push augmenting context to you (`# Output: agent: <name>`)
32
+ - **headless** — autonomous skills (cron/event-fired); yours to maintain, not to invoke
33
+
34
+ Know your own skills so you reach for them instead of rebuilding a workflow.
35
+
36
+ ### When a task smells routine
37
+ If an existing skill fits, use it — don't re-reason the steps:
38
+
39
+ - `skill_preflight({ name })` — see what a skill takes, returns, requires, and
40
+ *touches* (its effectful footprint) plus whether it's cleared to run, before
41
+ you invoke or compose it. (`skill_list` entries already carry this contract, so
42
+ often you won't need a separate call.)
43
+ - `execute_skill({ name })` — run a stored skill end-to-end.
44
+ - `compile_skill({ name })` — preview the rendered plan first, no side effects.
45
+
46
+ ### When you're repeating yourself, author a skill
47
+ What you can script is the wired connectors, models, and allowed shell binaries that
48
+ `runtime_capabilities()` reports — that list is your **menu of what's capturable**. When
49
+ you catch yourself re-running the same multi-step routine over any of them, turn it into a skill:
50
+
51
+ 1. `help()` — learn the language (and `help({ topic })` for ops, frontmatter,
52
+ examples, composition, error-handling, connectors, lint-codes).
53
+ 2. Draft the skill body against what's wired.
54
+ 3. `lint_skill({ source })` then `compile_skill({ source })` — catch mistakes
55
+ before anything is stored.
56
+ 4. `skill_write({ name, source })` — it lands **Draft**; a human reviews and
57
+ approves before it can run (you can't self-approve).
58
+
59
+ If something you'd need isn't wired yet, ask the operator to add it (a connector, or a
60
+ binary on `SKILLSCRIPT_SHELL_ALLOWLIST`), then capture the routine.
61
+ ```
62
+
63
+ That block is enough to change behavior. Everything below explains *why* and fills in the edges.
64
+
65
+ ### What your agent file *should* carry instead
66
+
67
+ Now that the runtime delivers the universal how-to, your agent file gets *thinner* — it should hold only what the runtime can't know:
68
+
69
+ - **Who the operator is.** The usage block says "ask the operator to wire what's missing" — but not *who*. Name them and the channel to ask on.
70
+ - **Which skills are *this* agent's to maintain.** A skill's `headless` category (in `skill_list`) flags it as cron/event-fired, but "this one is *yours to keep correct*" is an ownership fact the universal block can't carry. Note the autonomous skills the agent is responsible for.
71
+ - **The agent's role and behavioral context.** Who it is, how it should work. Never Skillscript's to provide; always yours.
72
+
73
+ The test: if it's true for *every* agent on *any* Skillscript runtime, the runtime already delivers it — leave it out. If it's specific to *this* agent or *this* deployment, it belongs in your file. The runtime owns "how to use me"; your file owns "who you are, where you are, and what's yours to tend."
74
+
75
+ ---
76
+
77
+ ## 2. Best practices
78
+
79
+ ### Discover before you build
80
+ The single highest-value instruction is "run `skill_list()` at session start." Agents that don't enumerate their skills silently re-derive workflows that already exist as skills — the exact waste Skillscript removes. Make discovery a reflex, not an afterthought.
81
+
82
+ ### Prefer a skill over re-reasoning
83
+ A compiled skill runs the same way every time because the procedure *is* the source of record, not a prompt to be re-interpreted. When a routine exists as a skill, executing it is cheaper, more reliable, and auditable. Reserve fresh reasoning for the work that genuinely needs it.
84
+
85
+ ### Write descriptions as *trigger conditions*, not summaries
86
+ When the agent picks among skills, it reads each `# Description:`. "Handles errors" is useless for selection. "If a downstream API returns non-200, run this" fires the skill at the right moment. Describe **when to invoke**, not what the skill does. This is what makes `skill_list()` actionable once you have more than a handful of skills.
87
+
88
+ ### Two kinds of skill, two postures
89
+ - **Skills you invoke** — you call them when relevant (`execute_skill`).
90
+ - **Skills you own but never invoke** — autonomous skills fired by a `cron` or `event` trigger. Your job is to keep them correct, not to run them by hand. (They show up under `headless` in `skill_list`.)
91
+
92
+ Make sure your agent instructions distinguish these, so the agent doesn't try to manually fire a cron skill (or ignore a skill it should be invoking).
93
+
94
+ ### Trust the approval gate
95
+ Every skill has a `Draft → Approved → Disabled` lifecycle, and only `Approved` skills run. **In secured mode** (`SKILLSCRIPT_SECURED_MODE=true` — the recommended posture for any agent-authored or multi-author deployment) approval is an operator's Ed25519 signature: a skill an agent `skill_write`s lands **Draft**, a naked `# Status: Approved` is forced to Draft, and only a human holding the operator key can sign it into a runnable state. That's the real safety boundary — an agent can *write* a skill, but a human decides whether it ever *runs*. In unsecured mode the status flag alone gates execution (a bare `# Status: Approved` runs, unkeyed) — convenient for a single trusted author, but it means a skill *you* write as Approved is immediately runnable. Either way, tell your agent to treat a freshly-written skill as not-yet-runnable until a human has approved it.
96
+
97
+ ### Author against discovered capability, not assumptions
98
+ Before writing a skill that needs a data store, a model, or an external tool, check `runtime_capabilities()`. A skill that assumes a connector that isn't wired fails at dispatch with a clear error — but it's better to author against what's actually present. Use `# Requires: <connector>.<feature>` in a skill to fail-fast at compile time when a needed capability is missing.
99
+
100
+ ### Keep deterministic work in tools, not skill bodies
101
+ Skills are orchestration. A fixed API call, a fixed parse, a fixed shell pipeline belongs in an MCP tool the skill *invokes* (`$ <connector> ...`), not hardcoded into the skill. This keeps skills portable across substrates and resistant to drift.
102
+
103
+ ---
104
+
105
+ ## 3. MCP tool reference
106
+
107
+ The tools your agent has when a Skillscript runtime is wired:
108
+
109
+ | Tool | Use |
110
+ |---|---|
111
+ | `skill_list({ filter? })` | Discover skills, grouped by category. Filter by status / trigger_kind / name_prefix / author. Each entry carries the full contract (vars / returns / requires / effectful footprint) + approval state. |
112
+ | `skill_preflight({ name })` | Pre-execution contract check for one skill: what it takes / returns / requires / touches (effectful footprint) + approval-gate state + version. Call before invoking or composing. |
113
+ | `skill_read({ name })` | Read a skill's source body. |
114
+ | `compile_skill({ name \| source, inputs? })` | Render the compiled plan + surface errors. Read-only — safe to preview. |
115
+ | `lint_skill({ name \| source })` | Static diagnostics (tier-1 errors / tier-2 warnings / tier-3 advisories). |
116
+ | `execute_skill({ name \| source, inputs? })` | Run a skill. `name` runs a stored, approved skill; `source` runs ad-hoc inline (bypasses the store — for one-offs). |
117
+ | `skill_write({ name, source, overwrite? })` | Store a skill. Lands Draft unless approved. |
118
+ | `skill_status({ name, new_state })` | Transition Draft / Approved / Disabled. |
119
+ | `help({ topic? })` | Language reference — quickstart, plus `ops`, `frontmatter`, `examples`, `composition`, `error-handling`, `connectors`, `lint-codes`. |
120
+ | `data_read({ mode, query, limit, ... })` | Query the wired DataStore — substrate-neutral memory/data retrieval (the `$ data_read` op's tool surface). |
121
+ | `runtime_capabilities()` | What's actually wired — connectors, models, shell mode. |
122
+ | `health_metrics()` | Aggregated runtime health — dispatch counts, error rates, per-op timing. |
123
+ | `blocked_shell_attempts()` | Shell-allowlist refusals: which binaries skills tried to run that the allowlist blocked. |
124
+ | `register_trigger` / `list_triggers` / `unregister_trigger` / `set_trigger_enabled` | Inspect/manage autonomous dispatch (cron / event), including enabling or disabling a registered trigger. |
125
+
126
+ ---
127
+
128
+ ## 4. A minimal worked example
129
+
130
+ The smallest useful loop, from the agent's point of view:
131
+
132
+ ```
133
+ 1. skill_list() → "I have a `weekly-report` skill."
134
+ 2. compile_skill({name:"weekly-report"}) → preview the plan, confirm it's right.
135
+ 3. execute_skill({name:"weekly-report"}) → run it, use the result.
136
+ ```
137
+
138
+ And authoring a new one:
139
+
140
+ ```
141
+ 1. help({topic:"ops"}) → learn the op surface.
142
+ 2. lint_skill({source}) → fix tier-1 errors.
143
+ 3. compile_skill({source}) → confirm it renders.
144
+ 4. skill_write({name, source}) → stored as Draft.
145
+ 5. (human approves) → now it can run.
146
+ ```
147
+
148
+ ---
149
+
150
+ ## 5. What *not* to put in your agent file
151
+
152
+ - **Don't reference a specific backend.** No "query the X store" / "call the Y model" by product name. Skills name connectors by role; the operator maps roles to backends in config. Your agent reads roles via `runtime_capabilities()`.
153
+ - **Don't tell the agent a freshly-authored skill is runnable.** In secured mode (the recommended posture) it lands Draft until a human approves; have the agent treat anything it just wrote as not-yet-runnable regardless.
154
+ - **Don't have the agent manually fire autonomous skills.** Cron/event skills fire themselves; the agent maintains them.
155
+ - **Don't hardcode tool/endpoint details into skill bodies.** That's tool territory; skills orchestrate, tools execute.
156
+
157
+ The throughline: your agent's instructions should make it **discover its skills, prefer them over re-reasoning, author new ones through the lint→compile→approve loop, and stay honest about what substrate is actually wired.**
@@ -83,18 +83,18 @@ Once `.env` populates `process.env`, both `skillscript.config.json` (`runtime-co
83
83
 
84
84
  ```json
85
85
  {
86
- "amp": {
86
+ "memory": {
87
87
  "class": "HttpMcpConnector",
88
88
  "config": {
89
- "endpoint": "${AMP_ENDPOINT}",
90
- "headers": { "Authorization": "Bearer ${AMP_TOKEN}" },
89
+ "endpoint": "${MEMORY_ENDPOINT}",
90
+ "headers": { "Authorization": "Bearer ${MEMORY_TOKEN}" },
91
91
  "identityHeader": "X-Agent-Id"
92
92
  }
93
93
  }
94
94
  }
95
95
  ```
96
96
 
97
- `AMP_ENDPOINT` and `AMP_TOKEN` in `.env`; declarative shape committed to `connectors.json`.
97
+ `MEMORY_ENDPOINT` and `MEMORY_TOKEN` in `.env`; declarative shape committed to `connectors.json`.
98
98
 
99
99
  ### `.env` file format
100
100
 
@@ -365,7 +365,7 @@ Underscore-prefixed top-level keys (`_comment`, `_note_security`, etc.) are igno
365
365
 
366
366
  ```json
367
367
  {
368
- "_comment": "Last edited 2026-05-28 — switched skill_store to sqlite for AMP-style dogfooding",
368
+ "_comment": "Last edited 2026-05-28 — switched skill_store to sqlite for local dogfooding",
369
369
  "substrate": { "skill_store": "sqlite" }
370
370
  }
371
371
  ```
@@ -460,11 +460,11 @@ Calls a tool through a configured connector. Connector name resolves against `co
460
460
  $ <connector>.<tool> kwarg=value, ... [-> R]
461
461
  ```
462
462
 
463
- The text before the dot is the connector name (must match an entry in `connectors.json`); the rest is the tool name + args. Named form is canonical for any tool whose semantics are substrate-specific — adopter MCP servers (`amp_*`, `github_*`, `linear_*`, etc.).
463
+ The text before the dot is the connector name (must match an entry in `connectors.json`); the rest is the tool name + args. Named form is canonical for any tool whose semantics are substrate-specific — adopter MCP servers (`github_*`, `linear_*`, etc.).
464
464
 
465
465
  ```
466
- $ amp.amp_check_mailbox limit=20 -> MAIL
467
- $ amp.amp_write_memory summary="..." domain_tags=["x"] vault="private" -> ACK
466
+ $ youtrack.search_issues query="project:INFRA state:Open" limit=20 -> ISSUES
467
+ $ github.create_issue repo="acme/foo" title="..." body="..." -> ACK
468
468
  $ github.search_issues query="repo:acme/foo state:open" -> ISSUES
469
469
  $ linear.find_issues filter="project:INFRA" -> TICKETS
470
470
  ```
@@ -508,7 +508,7 @@ Four surfaces apply to every `$` dispatch and to `shell()` (notably `(fallback:)
508
508
 
509
509
  ```
510
510
  $ llm prompt="..." timeout=30 -> R
511
- $ amp.amp_olsen_task task_type="scan" timeout=120 -> DISPATCH
511
+ $ youtrack.run_report report_id="INFRA-weekly" timeout=120 -> DISPATCH
512
512
  ```
513
513
 
514
514
  **`approved="<reason>"`** — Author-intent marker for the mutation-gate lint. Any non-empty string satisfies. Extracted at runtime; **not forwarded to the connector**. The value is required but not parsed semantically — presence is the signal.
@@ -523,7 +523,7 @@ Note: an envelope object like `{items: []}` is a non-empty object and does NOT t
523
523
 
524
524
  ```
525
525
  $ llm prompt="Classify: ${INPUT}" -> VERDICT (fallback: "unknown")
526
- $ amp.amp_query_memories query="${TOPIC}" -> RESULTS (fallback: [])
526
+ $ youtrack.search_issues query="${TOPIC}" -> RESULTS (fallback: [])
527
527
  shell(argv=["gh","pr","list","--repo","acme/foo"]) -> PRS (fallback: "No open PRs")
528
528
  $ ticketing.search query="..." -> ISSUES (fallback: "search-unavailable")
529
529
  ```
@@ -590,8 +590,8 @@ $ json_parse ${RAW_JSON} -> PARSED
590
590
  ### Worked examples
591
591
 
592
592
  ```
593
- $ amp.amp_olsen_task task_type="scan" -> DISPATCH
594
- $ amp.amp_query_memories query="recent activity" limit=5 -> RECENT
593
+ $ youtrack.run_report report_id="INFRA-weekly" -> DISPATCH
594
+ $ github.search_issues query="repo:acme/foo updated:>2026-01-01" limit=5 -> RECENT
595
595
  $ llm prompt="Classify: ${INPUT}" timeout=30 -> VERDICT
596
596
  $ llm prompt="Summarize: ${TEXT}" model="qwen" maxTokens=500 -> SUMMARY
597
597
  $ data_read mode=fts query="${TOPIC}" limit=5 -> RESULTS (fallback: [])
@@ -601,7 +601,7 @@ $ ticketing.search query="project:INFRA state:Open" limit=20 -> ISSUES
601
601
 
602
602
  Tool args are unconstrained `key=value` pairs — the connector forwards them to the underlying MCP tool. If a dispatched call returns `isError: true`, the executor throws via `makeOpError`, which routes through the target's `else:` handler. The inner tool's error text is preserved in `result.errors[]`.
603
603
 
604
- **Substrate-neutrality.** Typed-contract bare ops (`$ llm`, `$ data_read`, `$ data_write`, `$ skill_*`, `$ json_parse`) are not reserved built-ins — they're typed-contract bridges the adopter wires through `substrate.local_model` / `substrate.data_store` / `substrate.skill_store` in `skillscript.config.json`. Substrate-specific tools (`$ amp.*`, `$ github.*`, etc.) are whatever the adopter declares in `connectors.json`. For external MCP servers, three bundled wiring paths cover the common cases:
604
+ **Substrate-neutrality.** Typed-contract bare ops (`$ llm`, `$ data_read`, `$ data_write`, `$ skill_*`, `$ json_parse`) are not reserved built-ins — they're typed-contract bridges the adopter wires through `substrate.local_model` / `substrate.data_store` / `substrate.skill_store` in `skillscript.config.json`. Substrate-specific tools (`$ github.*`, `$ linear.*`, etc.) are whatever the adopter declares in `connectors.json`. For external MCP servers, three bundled wiring paths cover the common cases:
605
605
 
606
606
  - `HttpMcpConnector` — declarative wiring for any Streamable HTTP MCP server (JSON-RPC over HTTP + SSE). No subprocess. Adopters declare instances by class name in `connectors.json`.
607
607
  - `RemoteMcpConnector` — stdio bridging for MCPs distributed as spawnable binaries (YouTrack, GitHub, Linear when run locally) or HTTP MCPs adapted via `npx mcp-remote ... --sse`.
@@ -2173,7 +2173,7 @@ For *data skills* (skills marked `# Type: data`), the compile-time inline primit
2173
2173
  - Recursion is legal but bounded. If your design requires deeper recursion than the configured limit, reshape the workflow — almost always a sign of an iteration that should be expressed as `foreach` rather than recursion.
2174
2174
 
2175
2175
  ## Session isolation — a skill can't mutate the calling agent's session
2176
- A skill executes in its OWN session; agent session state (context, persona) is session-local. Calling `amp_set_session_context` (or similar) inside a skill sets it for the SKILL's session, not the caller's — the caller sees no change. The contract: **skills assemble and RETURN data; the agent owns its SESSION STATE.** To "enter a project," a skill returns the instruction bodies and the AGENT applies its own session context.
2176
+ A skill executes in its OWN session; agent session state (context, persona) is session-local. Calling a session-context tool (or similar) inside a skill sets it for the SKILL's session, not the caller's — the caller sees no change. The contract: **skills assemble and RETURN data; the agent owns its SESSION STATE.** To "enter a project," a skill returns the instruction bodies and the AGENT applies its own session context.
2177
2177
 
2178
2178
  ## Static vs Dynamic — skill execution model
2179
2179
 
@@ -2565,5 +2565,5 @@ When any of these primitives ship, the relevant grammar moves into its canonical
2565
2565
 
2566
2566
  ---
2567
2567
 
2568
- *Rendered from `skillscript/skillscript-language-reference` — 2026-07-10 13:59 EDT*
2568
+ *Rendered from `skillscript/skillscript-language-reference` — 2026-07-10 14:34 EDT*
2569
2569
  *Source of truth: AMP (`amp_render_document("skillscript/skillscript-language-reference")`)*
@@ -21,7 +21,7 @@ SkillStore (choose which connector)
21
21
  └── Adopter-custom (you write your own)
22
22
  ```
23
23
 
24
- If your substrate is AMP, Pinecone, S3, Postgres, or anything else, write a `class FooSkillStore implements SkillStore { ... }` and call `registry.registerSkillStore("primary", new FooSkillStore(...))`. The runtime is none the wiser.
24
+ If your substrate is Pinecone, S3, Postgres, Redis, or anything else, write a `class FooSkillStore implements SkillStore { ... }` and call `registry.registerSkillStore("primary", new FooSkillStore(...))`. The runtime is none the wiser.
25
25
 
26
26
  This SqliteSkillStore is one such impl — useful as a copy-paste starting point, or directly usable if your needs match.
27
27
 
@@ -160,10 +160,10 @@ The same holds for a fork: your `store()` neither stamps nor verifies — persis
160
160
 
161
161
  When forking into your codebase:
162
162
 
163
- 1. Rename the class (e.g., `PostgresSkillStore`, `AmpSkillStore`)
163
+ 1. Rename the class (e.g., `PostgresSkillStore`, `RedisSkillStore`)
164
164
  2. Replace the SQL with your substrate's API (HTTP, DataStore, vector DB, etc.)
165
165
  3. Update `staticCapabilities()` to match what your substrate actually supports — drop `supports_versioning` if you can't track history, drop `supports_tag_filter` if querying tags isn't tractable
166
- 4. Update `manifest()` to describe your substrate (`kind: "amp"` or whatever)
166
+ 4. Update `manifest()` to describe your substrate (`kind: "postgres"` or whatever)
167
167
  5. **Optional but high-value for network-backed forks: implement `version()`** — a cheap store-wide change-token computed WITHOUT loading bodies (a list ETag, max-revision, or metadata digest), where any add/remove/edit/status-change moves it. It lets `skill_list` skip its N+1 catalog rebuild on unchanged polls (each entry otherwise costs a `load()` — one network round-trip per skill against a remote store). `SqliteSkillStore` hashes `(name, status, current_version)` in one body-free query. Skip it and `skill_list` just always rebuilds.
168
168
  6. Tests: copy `tests/SqliteSkillStore.test.ts` as a starting point + run the conformance suite (`SkillStoreConformance.buildTests()` from `skillscript-runtime/testing`)
169
169
 
@@ -2,7 +2,7 @@
2
2
  "provenance_version": "1.0",
3
3
  "language_version": "1.0",
4
4
  "compiler_version": "0.1.0-dev",
5
- "compiled_at": "2026-07-10T18:06:49.305Z",
5
+ "compiled_at": "2026-07-13T21:58:37.418Z",
6
6
  "source_skill": {
7
7
  "name": "classify-support-ticket"
8
8
  },
@@ -2,7 +2,7 @@
2
2
  "provenance_version": "1.0",
3
3
  "language_version": "1.0",
4
4
  "compiler_version": "0.1.0-dev",
5
- "compiled_at": "2026-07-10T18:06:49.486Z",
5
+ "compiled_at": "2026-07-13T21:58:37.578Z",
6
6
  "source_skill": {
7
7
  "name": "data-store-roundtrip"
8
8
  },
@@ -2,7 +2,7 @@
2
2
  "provenance_version": "1.0",
3
3
  "language_version": "1.0",
4
4
  "compiler_version": "0.1.0-dev",
5
- "compiled_at": "2026-07-10T18:06:49.652Z",
5
+ "compiled_at": "2026-07-13T21:58:37.747Z",
6
6
  "source_skill": {
7
7
  "name": "doc-qa-with-citations"
8
8
  },
@@ -2,7 +2,7 @@
2
2
  "provenance_version": "1.0",
3
3
  "language_version": "1.0",
4
4
  "compiler_version": "0.1.0-dev",
5
- "compiled_at": "2026-07-10T18:06:49.855Z",
5
+ "compiled_at": "2026-07-13T21:58:37.903Z",
6
6
  "source_skill": {
7
7
  "name": "feedback-sentiment-scan"
8
8
  },
@@ -2,7 +2,7 @@
2
2
  "provenance_version": "1.0",
3
3
  "language_version": "1.0",
4
4
  "compiler_version": "0.1.0-dev",
5
- "compiled_at": "2026-07-10T18:06:50.004Z",
5
+ "compiled_at": "2026-07-13T21:58:38.064Z",
6
6
  "source_skill": {
7
7
  "name": "hello-world"
8
8
  },
@@ -2,7 +2,7 @@
2
2
  "provenance_version": "1.0",
3
3
  "language_version": "1.0",
4
4
  "compiler_version": "0.1.0-dev",
5
- "compiled_at": "2026-07-10T18:06:50.178Z",
5
+ "compiled_at": "2026-07-13T21:58:38.217Z",
6
6
  "source_skill": {
7
7
  "name": "morning-brief"
8
8
  },
@@ -2,7 +2,7 @@
2
2
  "provenance_version": "1.0",
3
3
  "language_version": "1.0",
4
4
  "compiler_version": "0.1.0-dev",
5
- "compiled_at": "2026-07-10T18:06:50.377Z",
5
+ "compiled_at": "2026-07-13T21:58:38.381Z",
6
6
  "source_skill": {
7
7
  "name": "queue-length-monitor"
8
8
  },
@@ -2,7 +2,7 @@
2
2
  "provenance_version": "1.0",
3
3
  "language_version": "1.0",
4
4
  "compiler_version": "0.1.0-dev",
5
- "compiled_at": "2026-07-10T18:06:50.550Z",
5
+ "compiled_at": "2026-07-13T21:58:38.554Z",
6
6
  "source_skill": {
7
7
  "name": "service-health-watch"
8
8
  },
@@ -2,7 +2,7 @@
2
2
  "provenance_version": "1.0",
3
3
  "language_version": "1.0",
4
4
  "compiler_version": "0.1.0-dev",
5
- "compiled_at": "2026-07-10T18:06:50.723Z",
5
+ "compiled_at": "2026-07-13T21:58:38.735Z",
6
6
  "source_skill": {
7
7
  "name": "skill-store-roundtrip"
8
8
  },
@@ -2,7 +2,7 @@
2
2
  "provenance_version": "1.0",
3
3
  "language_version": "1.0",
4
4
  "compiler_version": "0.1.0-dev",
5
- "compiled_at": "2026-07-10T18:06:50.897Z",
5
+ "compiled_at": "2026-07-13T21:58:38.894Z",
6
6
  "source_skill": {
7
7
  "name": "youtrack-morning-sweep"
8
8
  },