Workflow & orchestration

panto-agent

rock 0.3.2-1Source

The agent.* extension suite for pantograph's panto CLI: coding-agent conveniences packaged as a luarocks rock.

Extensions

agent.rules

Puts your project's instructions into the system prompt.

AGENTS.md wins over CLAUDE.md: whichever exists, never both. Rules are read from three layers, and every file becomes one system message headed context from <path>::

LayerDirectory
base${XDG_DATA_HOME:-~/.local/share}/panto/agent
user${XDG_CONFIG_HOME:-~/.config}/panto
projectthe project root

Paths come from panto.ext.dirs, not from HOME or XDG_* directly. Symlinks are resolved.

Each directory may also hold a git-ignored AGENTS.local.md (or CLAUDE.local.md). It is injected right after the shared file, so personal rules refine the team's.

The session header lists every candidate path that was searched, or rules: (none). A resumed session (/resume, /reload) gets the rules again unless its system prompt still carries the same text, so an edited AGENTS.md is picked up without restarting.

Reading a file below the session root pulls in the rules files between it and the root, root excluded:

TEXT
src/auth/session.zig        ->  src/auth/AGENTS.md, src/AGENTS.md

Those arrive on the tool result as ----separated context from <path>: sections, and each real file is injected at most once per agent session. A separate render_tool_result handler keeps the read's own output in the transcript, with a + rules: <path> line per attached file.

agent.skills

Exposes an agent.skill tool for loading Agent Skills on demand.

A skill is a subdirectory containing a SKILL.md with YAML frontmatter. Skills are discovered at activation from these directories, lowest priority first:

Directory
${XDG_DATA_HOME:-~/.local/share}/panto/agent/skills
${XDG_CONFIG_HOME:-~/.config}/panto/skills
~/.agents/skills
<cwd>/.panto/skills
<cwd>/.agents/skills
<cwd>/.panto/local/skills

The frontmatter name, not the directory name, is the skill's identity. Later directories shadow same-named skills from earlier ones.

Surviving names and descriptions are baked into the tool's description and its input schema's enum. Calling the tool returns the SKILL.md instructions with frontmatter stripped, behind a preamble that tells the model to resolve the skill's relative paths against its directory.

Each skill also registers a /skill:<name> command that submits the same instructions directly:

TEXT
/skill:writing-subagents now review my draft

Trailing command arguments replace every $ARGUMENTS in the skill body. The session header lists every discovered skill. On hosts exposing render_header.commands, those exact skill commands are omitted from the generic header command list, not from invocation or completion.

With no skills discovered it shows skills: (none) and registers neither the tool nor any skill commands.

agent.commands

Discovers slash commands from commands/ under each config layer directory, lowest priority first:

Directory
${XDG_DATA_HOME:-~/.local/share}/panto/agent/commands
${XDG_CONFIG_HOME:-~/.config}/panto/commands
<cwd>/.panto/commands
<cwd>/.panto/local/commands

A Lua file returns a command table:

LUA
return {
  name = "review",
  description = "Review the working tree.",
  handler = function(args) return "reviewing " .. args end,
}

A Markdown file is a prompt template with optional name and description frontmatter; the name defaults to the filename.

MARKDOWN
---
description: Explain the selected code.
---

Explain what this does, in two sentences:

$ARGUMENTS

Later layers shadow earlier commands by final name, then survivors are registered in sorted order. Invoking a Markdown command replaces every $ARGUMENTS and submits the prompt as a native agent turn.

Install

Via the rock:

TOML
[extensions]
rocks = ["panto-agent"]

Or as a local checkout:

TOML
[extensions]
paths = ["/path/to/panto-agent"]

Individual extensions can be toggled with the usual policy globs, e.g. deny = ["agent.rules"].

Dependencies

api7-lua-tinyyaml parses the YAML frontmatter on SKILL.md files and Markdown commands. A rocks entry installs it automatically; a paths checkout needs it put in panto's own tree first:

SH
TREE="$(echo ~/.local/share/panto/rocks/lua-*)"
luarocks --lua-version 5.4 --tree "$TREE" install api7-lua-tinyyaml

It is pure Lua, so there is no system library to install alongside it.

  • It covers every quoting, escaping and block-scalar form frontmatter uses.
  • It does not cover anchors/aliases: a warning, rather than misreading *alias as literal text.
  • It does not cover plain multi-line scalars: also a warning.

Full-spec lyaml was the alternative, rejected because binding the system libyaml makes the rock fail to build wherever that library is absent.

Development

Run the self-check (needs panto for its embedded Lua + luv):

SH
panto lua _selfcheck.lua

Layout note: the sources live under panto-agent/ (matching the installed module tree) so require works identically installed and from a checkout; _selfcheck.lua is _-prefixed so panto's directory scan skips it.