Skip to content

Runbooks, skills, and memory

asksh supports three ways to persist workflows and context: deterministic runbooks (RUNBOOK.md), reusable prompt skills (SKILL.md), and key-value procedural memory (memory.toml).

Runbooks

Runbooks are Markdown files with YAML frontmatter that run shell steps deterministically without calling an LLM.

Discovery and precedence

asksh discovers top-level *.md files and nested RUNBOOK.md files (at any depth) in two directories:

  1. Global: ~/.config/asksh/runbooks/
  2. Project: <project-root>/.asksh/runbooks/ (overrides global runbooks with the same name)

Here <project-root> is your .jj or .git root, or your current directory outside a repository.

Writing a runbook

Create .asksh/runbooks/greendale-deploy.md (or .asksh/runbooks/greendale-deploy/RUNBOOK.md):

---
name: greendale-deploy
description: Build and verify the Greendale service release
params:
  - name: env
    description: Target environment
    default: staging
    required: true
steps:
  - title: Build binary
    command: make build ENV={{env}}
    verify: test -x bin/greendale
    rollback: rm -f bin/greendale
  - title: Check version
    command: ./bin/greendale --version
---

Runs a deterministic local build and smoke check.

Use {{param}} placeholders inside step command, verify, and rollback strings. asksh escapes substituted parameter values according to the surrounding shell quoting context (single-quoted, double-quoted, or unquoted).

You can also generate a runbook from an interactive TUI session with /save-runbook <name>, which captures your suggested commands and successful execute_shell_command steps.

Running and listing runbooks

asksh runbooks
asksh run greendale-deploy env=prod
asksh run greendale-deploy env=staging --yolo

Every step runs AST preflight and permissions.toml checks:

  • Steps rated Deny fail immediately.
  • Steps rated Allow run automatically unless AST preflight flags high risk.
  • Steps rated Ask (or high risk) prompt [y/N] in an interactive terminal unless --yolo is passed, and fail non-interactively.
  • verify commands run after exit 0 and fail if evaluated as Deny or high risk.

Skills

Skills inject specialized instructions into a conversation on demand.

Discovery and format

asksh walks these directories recursively for files named exactly SKILL.md:

  1. Global: ~/.config/asksh/skills/
  2. Project: <project-root>/.asksh/skills/ (overrides global skills with the same name)

Example .asksh/skills/study-notes/SKILL.md:

---
name: study-notes
description: Summarize recent repository changes for Troy and Abed.
disable-model-invocation: false
---

Inspect git history in this directory and summarize changes for: $ARGUMENTS
  • name: defaults to the parent directory name if omitted.
  • description: defaults to the first paragraph of the body if omitted (clipped to 1,024 bytes in prompt summaries).
  • disable-model-invocation: when true, hides the skill from the LLM system prompt and the load_skill tool while keeping /<name> available to you in the TUI.

Invoke a skill manually in the TUI with /study-notes last 5 commits, or let the model invoke it via load_skill (up to a 12,000-character summary budget in the system prompt).

If $ARGUMENTS is present in the skill body, asksh replaces it with your arguments; otherwise non-empty arguments are appended as ARGUMENTS: <args>.

Skills also support dynamic shell substitution blocks (```! ... ``` and inline !`...`) that run via sh -c in the working directory with a 10-second timeout. Skills with dynamic commands require LoadSkill approval in permissions.toml; static skills are allowed by default.

Procedural memory

Procedural memory stores short key = value facts that asksh injects into every system prompt (up to 4,000 characters).

Storage and precedence

  1. Global: ~/.config/asksh/memory.toml
  2. Project: <project-root>/.asksh/memory.toml (overrides global entries with the same key; disabled when the current directory is $HOME)

Manage entries from the CLI or inside the TUI:

asksh memory set deploy_branch main
asksh memory set editor nvim --global
asksh memory list
asksh memory rm deploy_branch

In the TUI, run /remember deploy_branch=main to save an entry and update the live session prompt immediately.