[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M7AHCE9P1RZ556XRWZDR17TF":3,"skill-same:01M7AHCE9P1RZ556XRWZDR17TF":55},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":16,"categories":17,"keywords":18,"publishedAt":19,"linkOnly":20,"markdownContent":21,"markdownBody":22,"frontMatter":23,"refName":31,"commitSha":32,"skillDirectory":33,"forksCount":34,"repositoryHtmlUrl":35,"repositoryHomepageUrl":36,"ownerHtmlUrl":37,"ownerBlogUrl":38,"ownerDescription":39,"updatedAt":40,"install":41,"resources":54},"01M7AHCE9P1RZ556XRWZDR17TF","mantle-building-skills",null,"Authors Mantle skills: skill.md instructions, auto-discovered Python tools, and the progressive control ladder (tool constraints, scoped instructions, verbatim responses, ordered blocks, sub-skills). Use when creating or editing any file under skills\u002F, deciding how much control a skill needs, or composing skills together.","RasaHQ\u002Frasa-community-resources","RasaHQ","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F21214473?v=4","01M7ABXR532XTM0MWW7ZK48J12","Rasa","01M7AGG0E6HH8BMYVXAEY9SHWJ",44,"Apache-2.0","https:\u002F\u002Fgithub.com\u002FRasaHQ\u002Frasa-community-resources\u002Fblob\u002Fmain\u002Fheroes\u002Fwave-01-mantle\u002Fprojects\u002Fcycywanyeki20-stammy\u002F.github\u002Fskills\u002Fmantle-building-skills\u002FSKILL.md",[],[],"2026-11-15 14:19:17",false,"---\nname: mantle-building-skills\ndescription: >\n  Authors Mantle skills: skill.md instructions, auto-discovered Python tools, and\n  the progressive control ladder (tool constraints, scoped instructions, verbatim\n  responses, ordered blocks, sub-skills). Use when creating or editing any file under\n  skills\u002F, deciding how much control a skill needs, or composing skills together.\nlicense: Apache-2.0\nengine: mantle\nrasa_version: \">=3.18\"\nmetadata:\n  author: rasa\n  version: \"0.1.3\"\n  docs-url: https:\u002F\u002Frasa-2f7eb63d.mintlify.site\n---\n\n# Building Mantle skills\n\nA skill is a folder under `skills\u002F` holding one user goal. The only required file is\n`skill.md`: YAML frontmatter (metadata + control declarations) and a markdown body\n(prose instructions the LLM follows). Tools live in a single `tools.py` next to\n`skill.md` — every `@tool`-decorated function in it is auto-discovered, no registration.\n\n**The core discipline is progressive control: write prose first, add control levers\nonly when observed behavior must become guaranteed behavior. Every lever is additive\n— you never restructure what's already written.**\n\n## Workflow\n\n1. Scope the skill — one user goal per skill (see \"Scoping\").\n2. Write `skill.md` with `name`, `description`, and a prose body. No control levers.\n3. Write the tools it needs in `tools.py` (see \"Tools\").\n4. Train and converse: `rasa train && rasa inspect`. Treat `rasa train` errors as\n   validation feedback (undeclared memory, bad YAML, missing references) — fix and\n   retrain before debugging conversation behavior.\n5. Observe drift, then add the *narrowest* lever that fixes it (see \"The control\n   ladder\"). Re-test. Repeat.\n6. Extract shared behavior into sub-skills only when a second skill needs it.\n\n## Scoping\n\n- **One user goal, clear start and end**: `replace_card`, `check_balance`,\n  `book_appointment`. Verb-first `snake_case` names.\n- The `description` in frontmatter is what the orchestrator uses to route — write it\n  as a routing summary, including trigger phrasings (\"lost, stolen, damaged, or not\n  received\"), not marketing copy.\n- Too big: one skill mixing unrelated goals (returns + payments + tracking). Split.\n- Too small: a skill that only wraps one utterance or one tool call with no\n  conversation. Inline it into the skill that uses it.\n\n## The minimal skill\n\n```markdown skills\u002Fcard_replace\u002Fskill.md\n---\nname: Card Replace\ndescription: Replace a credit card -- lost, stolen, damaged, or not received\n---\n\nHelp the customer replace a credit card.\n\nCheck whether their account is eligible for replacement. If they have\nmultiple cards, ask which one. Ask why they need a replacement -- the valid\nreasons are lost, stolen, damaged, or not received.\n\nFor stolen or not-received cards, offer to lock the card while a new one\nships. Once everything is gathered, ask their shipping preference,\nconfirm the order, and process the replacement.\n```\n\nWrite the body like instructions to a competent human agent: what to gather, what\norder matters (softly), what to offer when. The skill id is the folder name\n(`card_replace`); `name:` is only a display label.\n\nName tools in plain prose (\"then call `lock_card`\"), since they are already in the\nmodel's schema while the skill is active. Jump tokens: `@block.\u003Cblock_id>` for an\nordered block in this skill, `@skill.\u003Cskill_id>` for another skill, and\n`@memory.\u003Cnamespace>.\u003Centry>` for a live memory value inline (see \"Memory in\nprose\"). Both block and skill tokens take ids, never display names.\n\n## Tools\n\n```python skills\u002Fcard_replace\u002Ftools.py\nfrom rasa.calm_v2.tools.decorator import ToolContext, tool\nfrom rasa.calm_v2.tools.result import ToolResult\n\n@tool(description=\"Lock a card to prevent further transactions\")\nasync def lock_card(\n    card_id: str,\n    context: ToolContext = None,\n) -> ToolResult:\n    \"\"\"Lock a card to prevent further transactions.\n\n    Args:\n        card_id: Card identifier from get_customer_info.\n    \"\"\"\n    result = await api.post(f\"\u002Fcards\u002F{card_id}\u002Flock\")\n    return ToolResult(llm_response={\"locked\": True, \"card_id\": card_id})\n```\n\n- Function name = tool name; `@tool(description=...)` = what the LLM sees; type\n  hints = input schema; Google-docstring `Args:` = per-argument descriptions.\n- `context: ToolContext = None` is injected, invisible to the LLM. Use\n  `context.memory.set(key, value)` to write memory (this is what `requires:`\n  conditions gate on), `context.send(text)` for immediate deterministic messages.\n  Every key you `set` must be declared in a `memory.yml` schema — `rasa train`\n  rejects undeclared writes (`undeclared_memory_write`).\n- Return `ToolResult(llm_response=...)` — the LLM reads this as the tool's result.\n  Write to memory for anything later steps or `requires:` conditions need.\n- Tools outside the skill folder need frontmatter declaration:\n\n```yaml\nimport_tools:\n  - get_customer_info        # shared: from tools\u002F at agent root\n```\n\n- A skill-local tool wins over a shared tool of the same name. Resolved once at\n  model load.\n- To validate or clean a value right after it is written, define\n  `run_after_setting_\u003Cmemory_entry>` in the same `tools.py`. It is an internal\n  hook, never offered to the LLM; return a JSON payload with a non-null `error`\n  to reject the write and roll it back. Ask for values in prose.\n\n### Interruptions\n\nA running tool is interrupted when the user barges in (or the session times out, or\nthe client cancels): `asyncio.CancelledError` is raised at the tool's current `await`\nand propagates through its helpers. Nothing to wire up.\n\nAn interrupted tool leaves **no record of the call** and does **not** advance the step,\nso it can run again next turn — while memory it already wrote is kept. Read-only tools\ndon't care. For irreversible ones:\n\n```python\n@tool(description=\"Execute a money transfer between accounts.\")\nasync def process_transfer(amount: float, context: ToolContext = None) -> ToolResult:\n    if ref := context.memory.get(\"transfer_ref\"):\n        return ToolResult(llm_response={\"ok\": True, \"reference\": ref})   # already ran\n    if context.is_cancelled:\n        return ToolResult(llm_response={\"ok\": False, \"reason\": \"interrupted\"})\n    ref = new_transfer_reference()\n    context.memory.set(\"transfer_ref\", ref)          # written before the call\n    await bank.transfer(amount, idempotency_key=ref)\n    return ToolResult(llm_response={\"ok\": True, \"reference\": ref})\n```\n\n- `context.is_cancelled` — check immediately before an irreversible operation, and\n  between consecutive ones. It guards what comes *next*; checking just to learn that\n  the previous `await` was interrupted is redundant (that arrives as an exception).\n  Returning early is clean: the call is recorded and the step advances.\n- Idempotency key in memory before the call — the only thing that covers an interrupt\n  landing *during* the call.\n- **Compensating actions** — idempotency prevents double-charge, not undo. If the\n  backend may have completed before the interrupt, check on the next turn and run a\n  domain-specific reversal in your tool\u002FAPI; the runtime will not do this for you.\n- `except asyncio.CancelledError` — allowed for cleanup, must re-raise, and must be\n  quick: the engine waits ~0.5s for an interrupted tool to unwind, then moves on and\n  cuts off whatever is still running.\n\n## The control ladder\n\nAdd levers in this order. Each row is a symptom you actually observed in testing —\ndon't add levers speculatively.\n\n| Observed drift | Lever | Where |\n|---|---|---|\n| Calls a tool before its inputs exist | `tool_constraints` → `requires:` | frontmatter |\n| Executes an irreversible action without asking | In-flow prose confirmation + `requires:` on a confirmation memory key (e.g. `order_confirmed`), or `requires_confirmation:` on the tool in `tool_constraints` | body + frontmatter |\n| Fixed wording after a gated tool succeeds or fails | `on_success:` \u002F `on_failure:` on the tool + templates in `responses.yml` | frontmatter |\n| Follows the wrong branch \u002F mixes workflows | one `if:` marker per case | body |\n| Paraphrases wording that must be exact (legal, compliance) | `utter:` triggers + `responses.yml` | frontmatter |\n| Skips or reorders steps where order IS the requirement | ordered block | body |\n| Enters the skill when it shouldn't | skill-level `requires:` | frontmatter |\n\n### Tool gating and verbatim outcomes\n\n`tool_constraints` gate when tools appear in the LLM schema and when they may\ndispatch. Use `requires:` to hide a tool until memory preconditions hold. Use\n`requires_confirmation:` with `enabled: true` on irreversible tools to pause\ndispatch and resume only after the user confirms via `resolve_tool_confirmation`\n(`confirmed=true` runs the stored call; `confirmed=false` cancels it). Nested\n`utter_for_confirmation` and `utter_on_user_denial` are optional names of\nresponses in `responses.yml`: the engine emits a supplied ask (WAIT) or denial\n(WAIT); the LLM handles a response whose name is omitted. Use\n`requires_confirmation: { enabled: true }` to enable the gate without\nengine-owned ask or denial text. Re-calling the gated tool while confirmation is\npending returns an error. Use `on_success:` \u002F `on_failure:` to name verbatim\nresponses emitted after the tool result (success vs error payload).\n\n```yaml\ntool_constraints:\n  - lock_card:\n      requires: \"session.project.selected_card_id\"\n  - process_card_replacement:\n      requires: >\n        session.card_replace.order_confirmed\n        and session.card_replace.shipping_type\n      requires_confirmation:\n        enabled: true\n        utter_for_confirmation: utter_ask_replacement_confirmation\n        utter_on_user_denial: utter_replacement_cancelled\n      on_success: utter_replacement_disclaimer\n      on_failure: utter_replacement_failed\n```\n\nPlaceholders in `responses.yml` bodies (including confirmation ask\u002Fdenial):\n\n- `{session.\u003Cnamespace>.\u003Centry>}` — e.g. `{session.project.selected_card_label}`\n- `{entry}` — bare memory field; resolved skill-local first, then project scope\n\nSupplied `utter_for_confirmation` \u002F `utter_on_user_denial` names must exist in\n`responses.yml` with a non-empty body (validated at train time). Unknown keys\nunder a tool entry (for example a flat `ask_confirmation:`) are also rejected —\nuse nested `requires_confirmation`. If a supplied ask resolves to blank text\nafter placeholder substitution, dispatch fails closed instead of pausing\nsilently. If a supplied denial resolves to blank text, the engine warns and lets\nthe LLM respond (same as omitting that name).\n\n`requires:` is a **string** memory expression. The map form\n(`selected_card_id: { exists: true }`) is rejected.\n\nIn **conditions** (`requires:`, `if:`, `complete_when:`, `utter:` `when:`, `next:`),\nevery memory reference uses three segments: `session.\u003Cskill_id>.\u003Centry>` for a\nskill's own memory, `session.project.\u003Centry>` for project-wide memory. A bare key\nis rejected at validation with `Unknown name '\u003Ckey>' in condition expression`, so\n`requires: selected_card_id` does not work. Within that form you can write a\ntruthiness check (`session.project.selected_card_id`), a boolean combination\n(`session.card_replace.order_confirmed and session.card_replace.shipping_type`,\n`not session.card_replace.fraud_report_filed`), or a comparison\n(`session.card_replace.replacement_reason == 'stolen'`). Use a folded `>` scalar\nwhen the expression spans lines.\n\nA closed gate removes the tool from the LLM's schema, so it cannot call what it\ncannot see. Every key referenced must be declared in a `memory.yml` schema.\n`tool_constraints` are enforced no matter who triggers the tool, the LLM or an\nordered-block `execute_tool:` step.\n\n### Scoped instructions (`if:`)\n\nDeterministic branching without restructuring. Pairs well with a `categorical`\nentry in `memory.yml`; the framework strips non-matching paragraphs from the\nprompt once the entry is set:\n\n```markdown\nif: session.card_replace.replacement_reason == 'stolen'\nTell the customer the card will be locked for their protection.\nConfirm, then call lock_card.\n\nif: session.card_replace.replacement_reason == 'lost' or session.card_replace.replacement_reason == 'not_received'\nCall check_transactions and review recent transactions with them.\n```\n\nA prose `if:` condition is **the rest of that one line**. YAML folding does not\napply here: `if: >` followed by indented lines makes the condition the literal\n`>` and turns the condition text into the paragraph body. Keep it on one line,\nhowever long.\n\nThere is one marker, `if:`. Write one paragraph per case, each stating its own\ncondition; `else:` in prose fails to compile. For exclusive either\u002For routing,\nuse an ordered block's `next:` branches.\n\n```yaml skills\u002Fcard_replace\u002Fmemory.yml\nschema:\n  public:\n    replacement_reason:\n      type: categorical\n      enum_values: [lost, stolen, damaged, not_received]\n      description: Why the card is being replaced.\n```\n\nA marker scopes only the paragraph immediately after it (up to the blank line).\nUnmarked paragraphs are always visible.\n\n### Memory in prose (`@memory`)\n\nFor a **live memory value inside LLM-facing instructions** (unmarked prose, text\nunder an `if:` body, or ordered-block `instructions:`), use\n`@memory.project.\u003Centry>` or `@memory.\u003Cskill_id>.\u003Centry>`. Access matches readable\nmemory while the skill is active (project fields; other skills' **public** fields;\nthis skill's **public and private** fields). Another skill's private fields and\n`@memory.system.*` fail `rasa train`.\n\nAt prompt build the engine substitutes the current value (same stringification as\nthe `### Memory:` section). Unset or unreadable refs stay as the literal token.\nSet PII fields become bare `[set]` (the whole token, not `field: [set]`).\n\nExample:\n\n```markdown\nUse the already chosen card @memory.project.selected_card_id for this request.\n```\n\nKeep `session.*` for structured YAML and conditions (`requires:`, `if:`,\n`execute_tool` `parameters:`). Use `{session.*}` in `responses.yml`. Do not put\nbare `session.*` in free prose — `rasa train` fails; use `@memory.…` instead.\nIncomplete `@memory` lookalikes (for example `@memory.project`) also fail train.\n\n### Verbatim responses (skill triggers)\n\nExact wording the LLM never touches. Declare triggers in frontmatter; put text in\n`responses.yml` (supports `{memory_key}` interpolation):\n\n- **`on: activate`** — fires once when the **owning skill** is activated (routing\n  into the skill). Does not fire on ordered-block entry or interrupt resume within\n  the same skill.\n- **`when:`** — a condition expression, same syntax as `requires:` \u002F\n  `complete_when:` (memory as `session.\u003Cskill_id>.\u003Centry>`). Fires **once** when the\n  condition **first becomes true** after a memory write — not on every turn it\n  still holds.\n\n```yaml\nutter:\n  - utter_recording_notice:\n      on: activate\n  - utter_stolen_warning:\n      when: session.card_replace.replacement_reason == \"stolen\"\n```\n\nTool outcome utters (`on_success:` \u002F `on_failure:`) are separate: they attach to a\ngated tool in `tool_constraints`, not to skill `utter:` frontmatter.\n\n### Ordered blocks — last resort, not first\n\nMost skills never need one. Reach for a block only when the *sequence itself* is the\nrequirement (compliance, multi-step approval). Prefer the hybrid form — one block\ninside prose, referenced with `@block.\u003Cid>`:\n\n```markdown\nAsk why they need a replacement. Once the reason is recorded, invoke\n@block.pick_card to check eligibility and settle which card this applies to.\n\n:::ordered_block id=pick_card\nsteps:\n  - id: check_eligibility\n    execute_tool: card_replace_eligibility\n  - id: fetch_cards\n    execute_tool: get_customer_info\n  - id: select_card\n    instructions: Show the customer their cards and ask which one needs replacing.\n    complete_when: \"session.project.selected_card_id\"\n:::\n```\n\nThe id is a **fence attribute** (`:::ordered_block id=pick_card`), not a YAML key\ninside the body. The body is YAML, so indent with spaces; a tab fails the parse.\n\nStep types: `execute_tool:` (framework calls the tool, no LLM), `instructions:` +\n`complete_when:` (LLM converses inside the step), `noop: true` + `next:`\n(deterministic routing), `collect:` + `utterance:` (framework collects a value,\n`utterance:` naming the question). Note `utterance:`, not `utter:`: a `collect:`\nstep given `utter:` is parsed as an action step and the collect is dropped.\n\nA block enforces local order only. Users can still interrupt to another skill; the\nblock resumes at the same step.\n\n## Composition\n\n- `@skill.\u003Cskill_id>` in the body runs another skill and the parent resumes\n  automatically when it finishes. It takes the target's folder name. A\n  user-initiated topic change is parked differently: the engine offers the\n  customer a resume rather than resuming on its own.\n- A skill's `public` fields are readable by every other skill at any time, so\n  there is no export step. Keep `public` small: it is the skill's API.\n- Default to small focused skills. Compose when a skill needs another's logic\n  mid-conversation (disputes needing transaction lookup).\n- The parent must have business logic of its own — a skill that is nothing but\n  `@skill.` references is the orchestrator's job, delete it.\n- Cross-skill dependencies go through memory, not direct coupling: gate with\n  `requires: session.project.authenticated` (a string expression) rather than\n  referencing the auth skill.\n\n## Don't\n\n- Don't add control levers the user's requirements don't demand — every lever costs\n  conversational flexibility.\n- Don't write a fully-controlled ordered block as the starting point; that recreates\n  the rigid state machines Mantle exists to replace.\n- Don't restate tool results in prose (\"the tool returns JSON with...\") — the LLM\n  sees `llm_response` directly.\n- Don't invent frontmatter fields. The complete set is `name`, `description`,\n  `requires`, `complete_when`, `import_tools`, `tool_constraints`, `utter`, and\n  `disabled`. Unknown keys are ignored rather than rejected, so a typo silently\n  does nothing.\n- Don't use a bare memory key in any **condition**. `requires:`, `if:`,\n  `complete_when:`, `utter:` `when:`, and `next:` branches all take the same\n  three-segment form: `session.\u003Cskill_id>.\u003Centry>` or `session.project.\u003Centry>`.\n- Don't put bare `session.*` in free instruction prose — use `@memory.…` for live\n  values there (see \"Memory in prose\").\n- Don't treat `rasa train` as optional. It is the validation gate for undeclared\n  memory writes, unknown response names, malformed conditions, and bad `@memory`\n  references, and its errors are authoring feedback rather than build noise.\n\n## Further reading\n\nFull Mantle documentation: https:\u002F\u002Frasa-2f7eb63d.mintlify.site\n\nFetch `https:\u002F\u002Frasa-2f7eb63d.mintlify.site\u002Fllms.txt` for the page index, or\n`https:\u002F\u002Frasa-2f7eb63d.mintlify.site\u002Fllms-full.txt` for every page in one file.\nRead the specific page when this file is not enough; do not guess syntax.\n\nMost relevant here:\n\n- [Project structure](https:\u002F\u002Frasa-2f7eb63d.mintlify.site\u002Freference\u002Fproject-structure): where a skill folder sits and what may live in it\n- [skill.md reference](https:\u002F\u002Frasa-2f7eb63d.mintlify.site\u002Freference\u002Fskill-md): frontmatter properties, body format, jump tokens\n- [Conditions](https:\u002F\u002Frasa-2f7eb63d.mintlify.site\u002Freference\u002Fconditions): the expression grammar for requires:, if:, complete_when:, next:\n- [Ordered block steps](https:\u002F\u002Frasa-2f7eb63d.mintlify.site\u002Freference\u002Fordered-block-steps): step kinds, step fields, branching\n- [Tools reference](https:\u002F\u002Frasa-2f7eb63d.mintlify.site\u002Freference\u002Ftools): ToolContext, ToolResult, gating, post-write hooks, cancellation\n- [memory.yml reference](https:\u002F\u002Frasa-2f7eb63d.mintlify.site\u002Freference\u002Fmemory-yml): scopes, types, visibility, access control\n- [Progressive control guides](https:\u002F\u002Frasa-2f7eb63d.mintlify.site\u002Fbuild-guide\u002Ftool-constraints): one lever at a time, with worked examples\n","# Building Mantle skills\n\nA skill is a folder under `skills\u002F` holding one user goal. The only required file is\n`skill.md`: YAML frontmatter (metadata + control declarations) and a markdown body\n(prose instructions the LLM follows). Tools live in a single `tools.py` next to\n`skill.md` — every `@tool`-decorated function in it is auto-discovered, no registration.\n\n**The core discipline is progressive control: write prose first, add control levers\nonly when observed behavior must become guaranteed behavior. Every lever is additive\n— you never restructure what's already written.**\n\n## Workflow\n\n1. Scope the skill — one user goal per skill (see \"Scoping\").\n2. Write `skill.md` with `name`, `description`, and a prose body. No control levers.\n3. Write the tools it needs in `tools.py` (see \"Tools\").\n4. Train and converse: `rasa train && rasa inspect`. Treat `rasa train` errors as\n   validation feedback (undeclared memory, bad YAML, missing references) — fix and\n   retrain before debugging conversation behavior.\n5. Observe drift, then add the *narrowest* lever that fixes it (see \"The control\n   ladder\"). Re-test. Repeat.\n6. Extract shared behavior into sub-skills only when a second skill needs it.\n\n## Scoping\n\n- **One user goal, clear start and end**: `replace_card`, `check_balance`,\n  `book_appointment`. Verb-first `snake_case` names.\n- The `description` in frontmatter is what the orchestrator uses to route — write it\n  as a routing summary, including trigger phrasings (\"lost, stolen, damaged, or not\n  received\"), not marketing copy.\n- Too big: one skill mixing unrelated goals (returns + payments + tracking). Split.\n- Too small: a skill that only wraps one utterance or one tool call with no\n  conversation. Inline it into the skill that uses it.\n\n## The minimal skill\n\n```markdown skills\u002Fcard_replace\u002Fskill.md\n---\nname: Card Replace\ndescription: Replace a credit card -- lost, stolen, damaged, or not received\n---\n\nHelp the customer replace a credit card.\n\nCheck whether their account is eligible for replacement. If they have\nmultiple cards, ask which one. Ask why they need a replacement -- the valid\nreasons are lost, stolen, damaged, or not received.\n\nFor stolen or not-received cards, offer to lock the card while a new one\nships. Once everything is gathered, ask their shipping preference,\nconfirm the order, and process the replacement.\n```\n\nWrite the body like instructions to a competent human agent: what to gather, what\norder matters (softly), what to offer when. The skill id is the folder name\n(`card_replace`); `name:` is only a display label.\n\nName tools in plain prose (\"then call `lock_card`\"), since they are already in the\nmodel's schema while the skill is active. Jump tokens: `@block.\u003Cblock_id>` for an\nordered block in this skill, `@skill.\u003Cskill_id>` for another skill, and\n`@memory.\u003Cnamespace>.\u003Centry>` for a live memory value inline (see \"Memory in\nprose\"). Both block and skill tokens take ids, never display names.\n\n## Tools\n\n```python skills\u002Fcard_replace\u002Ftools.py\nfrom rasa.calm_v2.tools.decorator import ToolContext, tool\nfrom rasa.calm_v2.tools.result import ToolResult\n\n@tool(description=\"Lock a card to prevent further transactions\")\nasync def lock_card(\n    card_id: str,\n    context: ToolContext = None,\n) -> ToolResult:\n    \"\"\"Lock a card to prevent further transactions.\n\n    Args:\n        card_id: Card identifier from get_customer_info.\n    \"\"\"\n    result = await api.post(f\"\u002Fcards\u002F{card_id}\u002Flock\")\n    return ToolResult(llm_response={\"locked\": True, \"card_id\": card_id})\n```\n\n- Function name = tool name; `@tool(description=...)` = what the LLM sees; type\n  hints = input schema; Google-docstring `Args:` = per-argument descriptions.\n- `context: ToolContext = None` is injected, invisible to the LLM. Use\n  `context.memory.set(key, value)` to write memory (this is what `requires:`\n  conditions gate on), `context.send(text)` for immediate deterministic messages.\n  Every key you `set` must be declared in a `memory.yml` schema — `rasa train`\n  rejects undeclared writes (`undeclared_memory_write`).\n- Return `ToolResult(llm_response=...)` — the LLM reads this as the tool's result.\n  Write to memory for anything later steps or `requires:` conditions need.\n- Tools outside the skill folder need frontmatter declaration:\n\n```yaml\nimport_tools:\n  - get_customer_info        # shared: from tools\u002F at agent root\n```\n\n- A skill-local tool wins over a shared tool of the same name. Resolved once at\n  model load.\n- To validate or clean a value right after it is written, define\n  `run_after_setting_\u003Cmemory_entry>` in the same `tools.py`. It is an internal\n  hook, never offered to the LLM; return a JSON payload with a non-null `error`\n  to reject the write and roll it back. Ask for values in prose.\n\n### Interruptions\n\nA running tool is interrupted when the user barges in (or the session times out, or\nthe client cancels): `asyncio.CancelledError` is raised at the tool's current `await`\nand propagates through its helpers. Nothing to wire up.\n\nAn interrupted tool leaves **no record of the call** and does **not** advance the step,\nso it can run again next turn — while memory it already wrote is kept. Read-only tools\ndon't care. For irreversible ones:\n\n```python\n@tool(description=\"Execute a money transfer between accounts.\")\nasync def process_transfer(amount: float, context: ToolContext = None) -> ToolResult:\n    if ref := context.memory.get(\"transfer_ref\"):\n        return ToolResult(llm_response={\"ok\": True, \"reference\": ref})   # already ran\n    if context.is_cancelled:\n        return ToolResult(llm_response={\"ok\": False, \"reason\": \"interrupted\"})\n    ref = new_transfer_reference()\n    context.memory.set(\"transfer_ref\", ref)          # written before the call\n    await bank.transfer(amount, idempotency_key=ref)\n    return ToolResult(llm_response={\"ok\": True, \"reference\": ref})\n```\n\n- `context.is_cancelled` — check immediately before an irreversible operation, and\n  between consecutive ones. It guards what comes *next*; checking just to learn that\n  the previous `await` was interrupted is redundant (that arrives as an exception).\n  Returning early is clean: the call is recorded and the step advances.\n- Idempotency key in memory before the call — the only thing that covers an interrupt\n  landing *during* the call.\n- **Compensating actions** — idempotency prevents double-charge, not undo. If the\n  backend may have completed before the interrupt, check on the next turn and run a\n  domain-specific reversal in your tool\u002FAPI; the runtime will not do this for you.\n- `except asyncio.CancelledError` — allowed for cleanup, must re-raise, and must be\n  quick: the engine waits ~0.5s for an interrupted tool to unwind, then moves on and\n  cuts off whatever is still running.\n\n## The control ladder\n\nAdd levers in this order. Each row is a symptom you actually observed in testing —\ndon't add levers speculatively.\n\n| Observed drift | Lever | Where |\n|---|---|---|\n| Calls a tool before its inputs exist | `tool_constraints` → `requires:` | frontmatter |\n| Executes an irreversible action without asking | In-flow prose confirmation + `requires:` on a confirmation memory key (e.g. `order_confirmed`), or `requires_confirmation:` on the tool in `tool_constraints` | body + frontmatter |\n| Fixed wording after a gated tool succeeds or fails | `on_success:` \u002F `on_failure:` on the tool + templates in `responses.yml` | frontmatter |\n| Follows the wrong branch \u002F mixes workflows | one `if:` marker per case | body |\n| Paraphrases wording that must be exact (legal, compliance) | `utter:` triggers + `responses.yml` | frontmatter |\n| Skips or reorders steps where order IS the requirement | ordered block | body |\n| Enters the skill when it shouldn't | skill-level `requires:` | frontmatter |\n\n### Tool gating and verbatim outcomes\n\n`tool_constraints` gate when tools appear in the LLM schema and when they may\ndispatch. Use `requires:` to hide a tool until memory preconditions hold. Use\n`requires_confirmation:` with `enabled: true` on irreversible tools to pause\ndispatch and resume only after the user confirms via `resolve_tool_confirmation`\n(`confirmed=true` runs the stored call; `confirmed=false` cancels it). Nested\n`utter_for_confirmation` and `utter_on_user_denial` are optional names of\nresponses in `responses.yml`: the engine emits a supplied ask (WAIT) or denial\n(WAIT); the LLM handles a response whose name is omitted. Use\n`requires_confirmation: { enabled: true }` to enable the gate without\nengine-owned ask or denial text. Re-calling the gated tool while confirmation is\npending returns an error. Use `on_success:` \u002F `on_failure:` to name verbatim\nresponses emitted after the tool result (success vs error payload).\n\n```yaml\ntool_constraints:\n  - lock_card:\n      requires: \"session.project.selected_card_id\"\n  - process_card_replacement:\n      requires: >\n        session.card_replace.order_confirmed\n        and session.card_replace.shipping_type\n      requires_confirmation:\n        enabled: true\n        utter_for_confirmation: utter_ask_replacement_confirmation\n        utter_on_user_denial: utter_replacement_cancelled\n      on_success: utter_replacement_disclaimer\n      on_failure: utter_replacement_failed\n```\n\nPlaceholders in `responses.yml` bodies (including confirmation ask\u002Fdenial):\n\n- `{session.\u003Cnamespace>.\u003Centry>}` — e.g. `{session.project.selected_card_label}`\n- `{entry}` — bare memory field; resolved skill-local first, then project scope\n\nSupplied `utter_for_confirmation` \u002F `utter_on_user_denial` names must exist in\n`responses.yml` with a non-empty body (validated at train time). Unknown keys\nunder a tool entry (for example a flat `ask_confirmation:`) are also rejected —\nuse nested `requires_confirmation`. If a supplied ask resolves to blank text\nafter placeholder substitution, dispatch fails closed instead of pausing\nsilently. If a supplied denial resolves to blank text, the engine warns and lets\nthe LLM respond (same as omitting that name).\n\n`requires:` is a **string** memory expression. The map form\n(`selected_card_id: { exists: true }`) is rejected.\n\nIn **conditions** (`requires:`, `if:`, `complete_when:`, `utter:` `when:`, `next:`),\nevery memory reference uses three segments: `session.\u003Cskill_id>.\u003Centry>` for a\nskill's own memory, `session.project.\u003Centry>` for project-wide memory. A bare key\nis rejected at validation with `Unknown name '\u003Ckey>' in condition expression`, so\n`requires: selected_card_id` does not work. Within that form you can write a\ntruthiness check (`session.project.selected_card_id`), a boolean combination\n(`session.card_replace.order_confirmed and session.card_replace.shipping_type`,\n`not session.card_replace.fraud_report_filed`), or a comparison\n(`session.card_replace.replacement_reason == 'stolen'`). Use a folded `>` scalar\nwhen the expression spans lines.\n\nA closed gate removes the tool from the LLM's schema, so it cannot call what it\ncannot see. Every key referenced must be declared in a `memory.yml` schema.\n`tool_constraints` are enforced no matter who triggers the tool, the LLM or an\nordered-block `execute_tool:` step.\n\n### Scoped instructions (`if:`)\n\nDeterministic branching without restructuring. Pairs well with a `categorical`\nentry in `memory.yml`; the framework strips non-matching paragraphs from the\nprompt once the entry is set:\n\n```markdown\nif: session.card_replace.replacement_reason == 'stolen'\nTell the customer the card will be locked for their protection.\nConfirm, then call lock_card.\n\nif: session.card_replace.replacement_reason == 'lost' or session.card_replace.replacement_reason == 'not_received'\nCall check_transactions and review recent transactions with them.\n```\n\nA prose `if:` condition is **the rest of that one line**. YAML folding does not\napply here: `if: >` followed by indented lines makes the condition the literal\n`>` and turns the condition text into the paragraph body. Keep it on one line,\nhowever long.\n\nThere is one marker, `if:`. Write one paragraph per case, each stating its own\ncondition; `else:` in prose fails to compile. For exclusive either\u002For routing,\nuse an ordered block's `next:` branches.\n\n```yaml skills\u002Fcard_replace\u002Fmemory.yml\nschema:\n  public:\n    replacement_reason:\n      type: categorical\n      enum_values: [lost, stolen, damaged, not_received]\n      description: Why the card is being replaced.\n```\n\nA marker scopes only the paragraph immediately after it (up to the blank line).\nUnmarked paragraphs are always visible.\n\n### Memory in prose (`@memory`)\n\nFor a **live memory value inside LLM-facing instructions** (unmarked prose, text\nunder an `if:` body, or ordered-block `instructions:`), use\n`@memory.project.\u003Centry>` or `@memory.\u003Cskill_id>.\u003Centry>`. Access matches readable\nmemory while the skill is active (project fields; other skills' **public** fields;\nthis skill's **public and private** fields). Another skill's private fields and\n`@memory.system.*` fail `rasa train`.\n\nAt prompt build the engine substitutes the current value (same stringification as\nthe `### Memory:` section). Unset or unreadable refs stay as the literal token.\nSet PII fields become bare `[set]` (the whole token, not `field: [set]`).\n\nExample:\n\n```markdown\nUse the already chosen card @memory.project.selected_card_id for this request.\n```\n\nKeep `session.*` for structured YAML and conditions (`requires:`, `if:`,\n`execute_tool` `parameters:`). Use `{session.*}` in `responses.yml`. Do not put\nbare `session.*` in free prose — `rasa train` fails; use `@memory.…` instead.\nIncomplete `@memory` lookalikes (for example `@memory.project`) also fail train.\n\n### Verbatim responses (skill triggers)\n\nExact wording the LLM never touches. Declare triggers in frontmatter; put text in\n`responses.yml` (supports `{memory_key}` interpolation):\n\n- **`on: activate`** — fires once when the **owning skill** is activated (routing\n  into the skill). Does not fire on ordered-block entry or interrupt resume within\n  the same skill.\n- **`when:`** — a condition expression, same syntax as `requires:` \u002F\n  `complete_when:` (memory as `session.\u003Cskill_id>.\u003Centry>`). Fires **once** when the\n  condition **first becomes true** after a memory write — not on every turn it\n  still holds.\n\n```yaml\nutter:\n  - utter_recording_notice:\n      on: activate\n  - utter_stolen_warning:\n      when: session.card_replace.replacement_reason == \"stolen\"\n```\n\nTool outcome utters (`on_success:` \u002F `on_failure:`) are separate: they attach to a\ngated tool in `tool_constraints`, not to skill `utter:` frontmatter.\n\n### Ordered blocks — last resort, not first\n\nMost skills never need one. Reach for a block only when the *sequence itself* is the\nrequirement (compliance, multi-step approval). Prefer the hybrid form — one block\ninside prose, referenced with `@block.\u003Cid>`:\n\n```markdown\nAsk why they need a replacement. Once the reason is recorded, invoke\n@block.pick_card to check eligibility and settle which card this applies to.\n\n:::ordered_block id=pick_card\nsteps:\n  - id: check_eligibility\n    execute_tool: card_replace_eligibility\n  - id: fetch_cards\n    execute_tool: get_customer_info\n  - id: select_card\n    instructions: Show the customer their cards and ask which one needs replacing.\n    complete_when: \"session.project.selected_card_id\"\n:::\n```\n\nThe id is a **fence attribute** (`:::ordered_block id=pick_card`), not a YAML key\ninside the body. The body is YAML, so indent with spaces; a tab fails the parse.\n\nStep types: `execute_tool:` (framework calls the tool, no LLM), `instructions:` +\n`complete_when:` (LLM converses inside the step), `noop: true` + `next:`\n(deterministic routing), `collect:` + `utterance:` (framework collects a value,\n`utterance:` naming the question). Note `utterance:`, not `utter:`: a `collect:`\nstep given `utter:` is parsed as an action step and the collect is dropped.\n\nA block enforces local order only. Users can still interrupt to another skill; the\nblock resumes at the same step.\n\n## Composition\n\n- `@skill.\u003Cskill_id>` in the body runs another skill and the parent resumes\n  automatically when it finishes. It takes the target's folder name. A\n  user-initiated topic change is parked differently: the engine offers the\n  customer a resume rather than resuming on its own.\n- A skill's `public` fields are readable by every other skill at any time, so\n  there is no export step. Keep `public` small: it is the skill's API.\n- Default to small focused skills. Compose when a skill needs another's logic\n  mid-conversation (disputes needing transaction lookup).\n- The parent must have business logic of its own — a skill that is nothing but\n  `@skill.` references is the orchestrator's job, delete it.\n- Cross-skill dependencies go through memory, not direct coupling: gate with\n  `requires: session.project.authenticated` (a string expression) rather than\n  referencing the auth skill.\n\n## Don't\n\n- Don't add control levers the user's requirements don't demand — every lever costs\n  conversational flexibility.\n- Don't write a fully-controlled ordered block as the starting point; that recreates\n  the rigid state machines Mantle exists to replace.\n- Don't restate tool results in prose (\"the tool returns JSON with...\") — the LLM\n  sees `llm_response` directly.\n- Don't invent frontmatter fields. The complete set is `name`, `description`,\n  `requires`, `complete_when`, `import_tools`, `tool_constraints`, `utter`, and\n  `disabled`. Unknown keys are ignored rather than rejected, so a typo silently\n  does nothing.\n- Don't use a bare memory key in any **condition**. `requires:`, `if:`,\n  `complete_when:`, `utter:` `when:`, and `next:` branches all take the same\n  three-segment form: `session.\u003Cskill_id>.\u003Centry>` or `session.project.\u003Centry>`.\n- Don't put bare `session.*` in free instruction prose — use `@memory.…` for live\n  values there (see \"Memory in prose\").\n- Don't treat `rasa train` as optional. It is the validation gate for undeclared\n  memory writes, unknown response names, malformed conditions, and bad `@memory`\n  references, and its errors are authoring feedback rather than build noise.\n\n## Further reading\n\nFull Mantle documentation: https:\u002F\u002Frasa-2f7eb63d.mintlify.site\n\nFetch `https:\u002F\u002Frasa-2f7eb63d.mintlify.site\u002Fllms.txt` for the page index, or\n`https:\u002F\u002Frasa-2f7eb63d.mintlify.site\u002Fllms-full.txt` for every page in one file.\nRead the specific page when this file is not enough; do not guess syntax.\n\nMost relevant here:\n\n- [Project structure](https:\u002F\u002Frasa-2f7eb63d.mintlify.site\u002Freference\u002Fproject-structure): where a skill folder sits and what may live in it\n- [skill.md reference](https:\u002F\u002Frasa-2f7eb63d.mintlify.site\u002Freference\u002Fskill-md): frontmatter properties, body format, jump tokens\n- [Conditions](https:\u002F\u002Frasa-2f7eb63d.mintlify.site\u002Freference\u002Fconditions): the expression grammar for requires:, if:, complete_when:, next:\n- [Ordered block steps](https:\u002F\u002Frasa-2f7eb63d.mintlify.site\u002Freference\u002Fordered-block-steps): step kinds, step fields, branching\n- [Tools reference](https:\u002F\u002Frasa-2f7eb63d.mintlify.site\u002Freference\u002Ftools): ToolContext, ToolResult, gating, post-write hooks, cancellation\n- [memory.yml reference](https:\u002F\u002Frasa-2f7eb63d.mintlify.site\u002Freference\u002Fmemory-yml): scopes, types, visibility, access control\n- [Progressive control guides](https:\u002F\u002Frasa-2f7eb63d.mintlify.site\u002Fbuild-guide\u002Ftool-constraints): one lever at a time, with worked examples\n",{"name":5,"engine":24,"license":15,"metadata":25,"description":29,"rasa_version":30},"mantle",{"author":26,"version":27,"docs-url":28},"rasa","0.1.3","https:\u002F\u002Frasa-2f7eb63d.mintlify.site","Authors Mantle skills: skill.md instructions, auto-discovered Python tools, and the progressive control ladder (tool constraints, scoped instructions, verbatim responses, ordered blocks, sub-skills). Use when creating or editing any file under skills\u002F, deciding how much control a skill needs, or composing skills together.\n",">=3.18","main","082746ff3466e3beb59eba5fa274b6a90ac38419","heroes\u002Fwave-01-mantle\u002Fprojects\u002Fcycywanyeki20-stammy\u002F.github\u002Fskills\u002Fmantle-building-skills",19,"https:\u002F\u002Fgithub.com\u002FRasaHQ\u002Frasa-community-resources","https:\u002F\u002Frasa.community\u002F","https:\u002F\u002Fgithub.com\u002FRasaHQ","https:\u002F\u002Frasa.com","Rasa is a conversational AI framework for building reliable, scalable AI agents.","2026-11-14 12:02:45",{"source":8,"skillName":5,"commands":42,"prompt":52,"zipAvailable":53},[43,46,49],{"tool":44,"command":45},"npx","npx skills add RasaHQ\u002Frasa-community-resources --skill mantle-building-skills",{"tool":47,"command":48},"bunx","bunx skills add RasaHQ\u002Frasa-community-resources --skill mantle-building-skills",{"tool":50,"command":51},"pnpm","pnpm dlx skills add RasaHQ\u002Frasa-community-resources --skill mantle-building-skills","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002FRasaHQ\u002Frasa-community-resources\u002Fblob\u002Fmain\u002Fheroes\u002Fwave-01-mantle\u002Fprojects\u002Fcycywanyeki20-stammy\u002F.github\u002Fskills\u002Fmantle-building-skills\u002FSKILL.md",true,[],[56,63,70,77,84,89],{"skillNo":57,"name":58,"nameZh":6,"description":59,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":60,"categories":61,"keywords":62,"publishedAt":19},"01M7AJ24E15F9CMBGM3QZSKV6S","Build a travel desk","Handle developer requests to build or extend a Mantle travel agent using four approved travel tools.","https:\u002F\u002Fgithub.com\u002FRasaHQ\u002Frasa-community-resources\u002Fblob\u002Fmain\u002Fworkshops\u002Fsoftware-factories-masterclass\u002Fstudio\u002Fskills\u002Fbuild_agent\u002Fskill.md",[],[],{"skillNo":64,"name":65,"nameZh":6,"description":66,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":67,"categories":68,"keywords":69,"publishedAt":19},"01M7AJ20RB027VHFWF2MAM79WC","Travel briefing","Answer questions about flight status, tonight’s departures, airport weather and currency conversion.","https:\u002F\u002Fgithub.com\u002FRasaHQ\u002Frasa-community-resources\u002Fblob\u002Fmain\u002Fworkshops\u002Fsoftware-factories-masterclass\u002Freference\u002Ffinished-agent\u002Fskills\u002Ftravel_briefing\u002Fskill.md",[],[],{"skillNo":71,"name":72,"nameZh":6,"description":73,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":74,"categories":75,"keywords":76,"publishedAt":19},"01M7AJ1XQ9HR7H1ENZRX9YF5EJ","Review Dispute","Ask the outside reviewer about a card dispute, then block the card if the caller confirms. Activate when the caller reports a card transaction they did not make.","https:\u002F\u002Fgithub.com\u002FRasaHQ\u002Frasa-community-resources\u002Fblob\u002Fmain\u002Fworkshops\u002Fsoftware-factories-masterclass\u002Fopenai-mcp\u002Fproject\u002Fskills\u002Freview_dispute\u002Fskill.md",[],[],{"skillNo":78,"name":79,"nameZh":6,"description":80,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":81,"categories":82,"keywords":83,"publishedAt":19},"01M7AJ1W0KTP19WYFACXY9WTRD","Block Card","Block a customer's lost or stolen card. Activate when the caller wants a card blocked.","https:\u002F\u002Fgithub.com\u002FRasaHQ\u002Frasa-community-resources\u002Fblob\u002Fmain\u002Fworkshops\u002Fsoftware-factories-masterclass\u002Ffactory\u002Fcandidates\u002Fblock-card-tamper\u002Fproduct\u002Fskills\u002Fblock_card\u002Fskill.md",[],[],{"skillNo":85,"name":79,"nameZh":6,"description":80,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":86,"categories":87,"keywords":88,"publishedAt":19},"01M7AJ1T5489X484B6V0KPR2AA","https:\u002F\u002Fgithub.com\u002FRasaHQ\u002Frasa-community-resources\u002Fblob\u002Fmain\u002Fworkshops\u002Fsoftware-factories-masterclass\u002Ffactory\u002Fcandidates\u002Fblock-card-hangs\u002Fproduct\u002Fskills\u002Fblock_card\u002Fskill.md",[],[],{"skillNo":90,"name":79,"nameZh":6,"description":80,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":91,"categories":92,"keywords":93,"publishedAt":19},"01M7AJ1RBPS99DXH3YY373ERWW","https:\u002F\u002Fgithub.com\u002FRasaHQ\u002Frasa-community-resources\u002Fblob\u002Fmain\u002Fworkshops\u002Fsoftware-factories-masterclass\u002Ffactory\u002Fcandidates\u002Fblock-card-good\u002Fproduct\u002Fskills\u002Fblock_card\u002Fskill.md",[],[]]