« blib/lib/Langertha/Raider/Plugin/Situation.pm
↑ Summary
blib/lib/Langertha/Raider/ConnectCheck.pm »
| 1 | package Langertha::Raider::Skill; | ||||||||||||||||||||||||||||
| 2 | 62 | our $VERSION = '0.503'; | |||||||||||||||||||||||||||
| 3 | # ABSTRACT: Generate a "how to use raider" documentation file from a live Langertha::Raider::CLI configuration | ||||||||||||||||||||||||||||
| 4 | |||||||||||||||||||||||||||||
| 5 | 62 | ▶ | use Moose; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 6 | 62 | ▶ | use namespace::autoclean; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 7 | 62 | ▶ | use Path::Tiny; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 8 | |||||||||||||||||||||||||||||
| 9 | |||||||||||||||||||||||||||||
| 10 | 62 | has app => ( | |||||||||||||||||||||||||||
| 11 | is => 'ro', | ||||||||||||||||||||||||||||
| 12 | isa => 'Langertha::Raider::CLI', | ||||||||||||||||||||||||||||
| 13 | required => 1, | ||||||||||||||||||||||||||||
| 14 | ); | ||||||||||||||||||||||||||||
| 15 | |||||||||||||||||||||||||||||
| 16 | |||||||||||||||||||||||||||||
| 17 | 62 | has name => ( | |||||||||||||||||||||||||||
| 18 | is => 'ro', | ||||||||||||||||||||||||||||
| 19 | isa => 'Str', | ||||||||||||||||||||||||||||
| 20 | default => 'raider', | ||||||||||||||||||||||||||||
| 21 | ); | ||||||||||||||||||||||||||||
| 22 | |||||||||||||||||||||||||||||
| 23 | |||||||||||||||||||||||||||||
| 24 | 62 | has description => ( | |||||||||||||||||||||||||||
| 25 | is => 'ro', | ||||||||||||||||||||||||||||
| 26 | isa => 'Str', | ||||||||||||||||||||||||||||
| 27 | default => 'How to drive the `raider` CLI — an autonomous Perl command-line agent (Langertha::Raider::CLI) with filesystem, bash, and web tools.', | ||||||||||||||||||||||||||||
| 28 | ); | ||||||||||||||||||||||||||||
| 29 | |||||||||||||||||||||||||||||
| 30 | 28 | ▶ | sub _active_web_providers { | ||||||||||||||||||||||||||
|
Subroutine
_active_web_providers: called CC=5 SCAR=18.1
| |||||||||||||||||||||||||||||
| 31 | 28 | my @p = ('DuckDuckGo (keyless)'); | |||||||||||||||||||||||||||
| 32 | 28 | ▶ | push @p, 'Brave' if $ENV{BRAVE_API_KEY}; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 33 | 28 | ▶ | push @p, 'Serper' if $ENV{SERPER_API_KEY}; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 34 | 28 | ▶ | push @p, 'Google CSE' if $ENV{GOOGLE_API_KEY} && $ENV{GOOGLE_CSE_ID}; | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$ENV{"GOOGLE_API_KEY"} and $ENV{"GOOGLE_CSE_ID"}
MC/DC0%0/2
$ENV{"GOOGLE_API_KEY"} and $ENV{"GOOGLE_CSE_ID"}
$ENV{"GOOGLE_API_KEY"}
$ENV{"GOOGLE_CSE_ID"}
Truth table33%1/3
A and B
A= $ENV{"GOOGLE_API_KEY"}B= $ENV{"GOOGLE_CSE_ID"}
| |||||||||||||||||||||||||||||
| 35 | 28 | return join(', ', @p); | |||||||||||||||||||||||||||
| 36 | } | ||||||||||||||||||||||||||||
| 37 | |||||||||||||||||||||||||||||
| 38 | # The tool table: the tools the app mounts -- the same set its prompt | ||||||||||||||||||||||||||||
| 39 | # describes and its engine offers (ADR 0005) -- each with its signature and | ||||||||||||||||||||||||||||
| 40 | # the first sentence of its description. | ||||||||||||||||||||||||||||
| 41 | 28 | ▶ | sub _tools_table { | ||||||||||||||||||||||||||
|
Subroutine
_tools_table: called CC=5 SCAR=16.1
| |||||||||||||||||||||||||||||
| 42 | 28 | my ($self) = @_; | |||||||||||||||||||||||||||
| 43 | 28 | my $app = $self->app; | |||||||||||||||||||||||||||
| 44 | my @rows = map { | ||||||||||||||||||||||||||||
| 45 | 28 | ▶ | my $purpose = $_->description // ''; | ||||||||||||||||||||||||||
|
Condition50%1/2
$_->description // ""
MC/DC0%0/1
$_->description // ""
$_->description
Truth table50%1/2
A
A= $_->description
| |||||||||||||||||||||||||||||
| 46 | 212 | $purpose =~ s/\.(?:\s.*)?\z//s; | |||||||||||||||||||||||||||
| 47 | 212 | [ '`'.$app->_tool_signature($_).'`', $purpose =~ s/\|/\\|/gr ]; | |||||||||||||||||||||||||||
| 48 | } $app->_mounted_tools; | ||||||||||||||||||||||||||||
| 49 | 28 | my @width = ( length 'Tool', length 'Purpose' ); | |||||||||||||||||||||||||||
| 50 | 28 | for my $row (@rows) { | |||||||||||||||||||||||||||
| 51 | 212 | for my $col (0, 1) { | |||||||||||||||||||||||||||
| 52 | 424 | ▶ | $width[$col] = length $row->[$col] if length $row->[$col] > $width[$col]; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 53 | } | ||||||||||||||||||||||||||||
| 54 | } | ||||||||||||||||||||||||||||
| 55 | 28 | ▶ | my $line = sub { '| '.join(' | ', map { sprintf '%-'.$width[$_].'s', $_[$_] } 0, 1)." |\n" }; | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 56 | return $line->('Tool', 'Purpose') | ||||||||||||||||||||||||||||
| 57 | 56 | .'|'.join('|', map { '-' x ($_ + 2) } @width)."|\n" | |||||||||||||||||||||||||||
| 58 | 28 | .join('', map { $line->(@$_) } @rows); | |||||||||||||||||||||||||||
| 59 | } | ||||||||||||||||||||||||||||
| 60 | |||||||||||||||||||||||||||||
| 61 | |||||||||||||||||||||||||||||
| 62 | 28 | ▶ | sub markdown { | ||||||||||||||||||||||||||
|
Subroutine
markdown: called CC=8 SCAR=20.9
Pod
documented
| |||||||||||||||||||||||||||||
| 63 | 28 | my ($self) = @_; | |||||||||||||||||||||||||||
| 64 | 28 | my $app = $self->app; | |||||||||||||||||||||||||||
| 65 | 28 | my $source = $app->mission_source; | |||||||||||||||||||||||||||
| 66 | 28 | my $instructions = $app->instructions; | |||||||||||||||||||||||||||
| 67 | 28 | my $file = $instructions->label; | |||||||||||||||||||||||||||
| 68 | 28 | ▶ | my $persona = $source eq '-M' ? 'from -M ('.$file.' not used)' | ||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||
| 69 | : $source eq $file ? 'custom (loaded from '.$instructions->file.')' | ||||||||||||||||||||||||||||
| 70 | : 'Langertha (default viking persona)'; | ||||||||||||||||||||||||||||
| 71 | 28 | ▶ | $persona .= ', bare (no '.$file.' or skills, only explicit packs)' if $app->bare; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 72 | 28 | my $config = $app->config; | |||||||||||||||||||||||||||
| 73 | 28 | ▶ | my $yml_loaded = $config->file_exists && $config->data ? 'yes ('.$config->file.')' : 'no'; | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
$config->file_exists and $config->data
MC/DC50%1/2
$config->file_exists and $config->data
$config->file_exists
$config->data
Truth table66%2/3
A and B
A= $config->file_existsB= $config->data
| |||||||||||||||||||||||||||||
| 74 | 28 | ▶ | my $model = $app->has_model ? $app->model : '(engine default)'; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 75 | 28 | ▶ | my $env = $app->api_key_env // '(none)'; | ||||||||||||||||||||||||||
|
Condition50%1/2
$app->api_key_env // "(none)"
MC/DC0%0/1
$app->api_key_env // "(none)"
$app->api_key_env
Truth table50%1/2
A
A= $app->api_key_env
| |||||||||||||||||||||||||||||
| 76 | 28 | my $web = _active_web_providers(); | |||||||||||||||||||||||||||
| 77 | |||||||||||||||||||||||||||||
| 78 | 28 | return <<"MD"; | |||||||||||||||||||||||||||
| 79 | # Using `raider` | ||||||||||||||||||||||||||||
| 80 | |||||||||||||||||||||||||||||
| 81 | `raider` is a Perl CLI that wraps `Langertha::Raider` with a fixed toolbox | ||||||||||||||||||||||||||||
| 82 | and keeps a persistent conversation with an LLM. This is how to drive it. | ||||||||||||||||||||||||||||
| 83 | |||||||||||||||||||||||||||||
| 84 | ## Current live configuration | ||||||||||||||||||||||||||||
| 85 | |||||||||||||||||||||||||||||
| 86 | 28 | - Engine: **@{[ $app->engine_name ]}** (env: `$env`) | |||||||||||||||||||||||||||
| 87 | - Model: **$model** | ||||||||||||||||||||||||||||
| 88 | - Persona: $persona | ||||||||||||||||||||||||||||
| 89 | 28 | - Working root: `@{[ $app->root ]}` | |||||||||||||||||||||||||||
| 90 | 28 | - `@{[ $config->label ]}` loaded: $yml_loaded | |||||||||||||||||||||||||||
| 91 | - Web-search providers active: $web | ||||||||||||||||||||||||||||
| 92 | |||||||||||||||||||||||||||||
| 93 | ## Minimal usage | ||||||||||||||||||||||||||||
| 94 | |||||||||||||||||||||||||||||
| 95 | ```bash | ||||||||||||||||||||||||||||
| 96 | raider # REPL in the current directory | ||||||||||||||||||||||||||||
| 97 | raider "do this task" # one-shot | ||||||||||||||||||||||||||||
| 98 | echo "task" | raider # from a pipe | ||||||||||||||||||||||||||||
| 99 | raider --json "task" | jq . # script-friendly output | ||||||||||||||||||||||||||||
| 100 | ``` | ||||||||||||||||||||||||||||
| 101 | |||||||||||||||||||||||||||||
| 102 | Engine/model/api-key can be set via CLI: | ||||||||||||||||||||||||||||
| 103 | |||||||||||||||||||||||||||||
| 104 | ```bash | ||||||||||||||||||||||||||||
| 105 | raider -e openai -m gpt-4o-mini -k sk-... | ||||||||||||||||||||||||||||
| 106 | raider -o temperature=0.1 -o response_size=4096 | ||||||||||||||||||||||||||||
| 107 | ``` | ||||||||||||||||||||||||||||
| 108 | |||||||||||||||||||||||||||||
| 109 | Otherwise the first `*_API_KEY` in the environment picks the engine, and a | ||||||||||||||||||||||||||||
| 110 | cheap model is selected automatically. | ||||||||||||||||||||||||||||
| 111 | |||||||||||||||||||||||||||||
| 112 | ## Tools the agent has | ||||||||||||||||||||||||||||
| 113 | |||||||||||||||||||||||||||||
| 114 | 28 | @{[ $self->_tools_table ]} | |||||||||||||||||||||||||||
| 115 | Filesystem tools are confined to the working root. `bash` inherits it. | ||||||||||||||||||||||||||||
| 116 | |||||||||||||||||||||||||||||
| 117 | ## Telling the agent what to do | ||||||||||||||||||||||||||||
| 118 | |||||||||||||||||||||||||||||
| 119 | The agent runs until it stops emitting tool calls; then control returns to | ||||||||||||||||||||||||||||
| 120 | the REPL prompt, where your next line continues the same conversation. | ||||||||||||||||||||||||||||
| 121 | There is **no** ask/pause/abort tool — the agent just does things and | ||||||||||||||||||||||||||||
| 122 | reports when done. | ||||||||||||||||||||||||||||
| 123 | |||||||||||||||||||||||||||||
| 124 | The default persona speaks in terse caveman style (no articles, no filler, | ||||||||||||||||||||||||||||
| 125 | technical terms exact). Say "normal mode" to switch to prose. | ||||||||||||||||||||||||||||
| 126 | |||||||||||||||||||||||||||||
| 127 | Customize the persona and the rules with an instructions file in the | ||||||||||||||||||||||||||||
| 128 | working directory, `.raider/instructions.md` or the legacy `.raider.md`, or | ||||||||||||||||||||||||||||
| 129 | by running `/prompt` in the REPL (launches a sub-agent that edits the file | ||||||||||||||||||||||||||||
| 130 | in use for you). With both present only `.raider/instructions.md` is read, | ||||||||||||||||||||||||||||
| 131 | and raider warns about the other. | ||||||||||||||||||||||||||||
| 132 | |||||||||||||||||||||||||||||
| 133 | ## Slash commands inside the REPL | ||||||||||||||||||||||||||||
| 134 | |||||||||||||||||||||||||||||
| 135 | | Command | Does | | ||||||||||||||||||||||||||||
| 136 | |--------------------------|------------------------------------------------------| | ||||||||||||||||||||||||||||
| 137 | | `/help` | Command list | | ||||||||||||||||||||||||||||
| 138 | | `/clear` | Reset conversation history and token counters | | ||||||||||||||||||||||||||||
| 139 | | `/metrics` | Cumulative raid metrics | | ||||||||||||||||||||||||||||
| 140 | | `/stats` | Tokens in / out / total this session | | ||||||||||||||||||||||||||||
| 141 | | `/reload` | Re-read the instructions file, hot-swap the mission | | ||||||||||||||||||||||||||||
| 142 | | `/prompt` | Launch the prompt-builder (edits the instructions) | | ||||||||||||||||||||||||||||
| 143 | | `/skill [PATH]` | Export plain-markdown how-to-use doc | | ||||||||||||||||||||||||||||
| 144 | | `/skill-claude [PATH]` | Export Claude Code SKILL.md with YAML frontmatter | | ||||||||||||||||||||||||||||
| 145 | | `/config` | Show each setting and where it came from | | ||||||||||||||||||||||||||||
| 146 | | `/model [NAME]` | Save NAME as model to the config file (next start) | | ||||||||||||||||||||||||||||
| 147 | | `/model list [FILTER]` | List the engine's models | | ||||||||||||||||||||||||||||
| 148 | | `/packs` | List the packs and which are active | | ||||||||||||||||||||||||||||
| 149 | | `/pack on NAME` | Enable a pack, reloads the mission | | ||||||||||||||||||||||||||||
| 150 | | `/pack off NAME` | Disable a pack, reloads the mission | | ||||||||||||||||||||||||||||
| 151 | | `/pack NAME` | Toggle a pack | | ||||||||||||||||||||||||||||
| 152 | | `/quit` `/exit` `:q` | Leave | | ||||||||||||||||||||||||||||
| 153 | |||||||||||||||||||||||||||||
| 154 | ## Loading project skills | ||||||||||||||||||||||||||||
| 155 | |||||||||||||||||||||||||||||
| 156 | Profile flags preload per-tool agent files into the mission and persist | ||||||||||||||||||||||||||||
| 157 | themselves to the config file after first use: | ||||||||||||||||||||||||||||
| 158 | |||||||||||||||||||||||||||||
| 159 | - `--claude` — loads `CLAUDE.md` and any `.claude/skills/*/SKILL.md`. | ||||||||||||||||||||||||||||
| 160 | - `--openai` / `--codex` — loads `AGENTS.md`. | ||||||||||||||||||||||||||||
| 161 | - `--skills DIR` — extra plain-markdown directory (repeatable). | ||||||||||||||||||||||||||||
| 162 | |||||||||||||||||||||||||||||
| 163 | When a well-known file is present but its profile isn't active, the startup | ||||||||||||||||||||||||||||
| 164 | banner shows a `seeing FILE, ignoring (use --<profile> to load)` hint. | ||||||||||||||||||||||||||||
| 165 | |||||||||||||||||||||||||||||
| 166 | ## Engine options via the config file | ||||||||||||||||||||||||||||
| 167 | |||||||||||||||||||||||||||||
| 168 | The config file is `.raider/config.yml` in the working root, else the | ||||||||||||||||||||||||||||
| 169 | legacy `.raider.yml` there; both take the same keys. With both present only | ||||||||||||||||||||||||||||
| 170 | `.raider/config.yml` is read, and raider warns about the other. | ||||||||||||||||||||||||||||
| 171 | |||||||||||||||||||||||||||||
| 172 | Flat form: | ||||||||||||||||||||||||||||
| 173 | |||||||||||||||||||||||||||||
| 174 | ```yaml | ||||||||||||||||||||||||||||
| 175 | temperature: 0.2 | ||||||||||||||||||||||||||||
| 176 | response_size: 2048 | ||||||||||||||||||||||||||||
| 177 | ``` | ||||||||||||||||||||||||||||
| 178 | |||||||||||||||||||||||||||||
| 179 | Per-engine with a shared default: | ||||||||||||||||||||||||||||
| 180 | |||||||||||||||||||||||||||||
| 181 | ```yaml | ||||||||||||||||||||||||||||
| 182 | default: | ||||||||||||||||||||||||||||
| 183 | temperature: 0.3 | ||||||||||||||||||||||||||||
| 184 | anthropic: | ||||||||||||||||||||||||||||
| 185 | temperature: 0.7 | ||||||||||||||||||||||||||||
| 186 | response_size: 8192 | ||||||||||||||||||||||||||||
| 187 | ``` | ||||||||||||||||||||||||||||
| 188 | |||||||||||||||||||||||||||||
| 189 | CLI `-o key=value` overrides the file. | ||||||||||||||||||||||||||||
| 190 | |||||||||||||||||||||||||||||
| 191 | ## Context window and rate limits | ||||||||||||||||||||||||||||
| 192 | |||||||||||||||||||||||||||||
| 193 | - `max_context_tokens = 40000` | ||||||||||||||||||||||||||||
| 194 | - `context_compress_threshold = 0.7` | ||||||||||||||||||||||||||||
| 195 | - `max_iterations = 10000` | ||||||||||||||||||||||||||||
| 196 | |||||||||||||||||||||||||||||
| 197 | At 70% of the token budget, `Langertha::Raider` compresses the history | ||||||||||||||||||||||||||||
| 198 | automatically. Each raid prints `history N msgs, X/Y tok (Z%)` so you can | ||||||||||||||||||||||||||||
| 199 | see how close you are. | ||||||||||||||||||||||||||||
| 200 | |||||||||||||||||||||||||||||
| 201 | ## Environment variables for API keys | ||||||||||||||||||||||||||||
| 202 | |||||||||||||||||||||||||||||
| 203 | `ANTHROPIC_API_KEY`, `OPENAI_API_KEY`, `DEEPSEEK_API_KEY`, `GROQ_API_KEY`, | ||||||||||||||||||||||||||||
| 204 | `MISTRAL_API_KEY`, `GEMINI_API_KEY`, `MINIMAX_API_KEY`, `CEREBRAS_API_KEY`, | ||||||||||||||||||||||||||||
| 205 | `OPENROUTER_API_KEY`. | ||||||||||||||||||||||||||||
| 206 | |||||||||||||||||||||||||||||
| 207 | Web-search extras: `BRAVE_API_KEY`, `SERPER_API_KEY`, | ||||||||||||||||||||||||||||
| 208 | `GOOGLE_API_KEY` + `GOOGLE_CSE_ID`. | ||||||||||||||||||||||||||||
| 209 | MD | ||||||||||||||||||||||||||||
| 210 | } | ||||||||||||||||||||||||||||
| 211 | |||||||||||||||||||||||||||||
| 212 | |||||||||||||||||||||||||||||
| 213 | 4 | ▶ | sub claude_skill { | ||||||||||||||||||||||||||
|
Subroutine
claude_skill: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||
| 214 | 4 | my ($self) = @_; | |||||||||||||||||||||||||||
| 215 | 4 | my $name = $self->name; | |||||||||||||||||||||||||||
| 216 | 4 | my $desc = $self->description; | |||||||||||||||||||||||||||
| 217 | 4 | $desc =~ s/"/\\"/g; | |||||||||||||||||||||||||||
| 218 | 4 | my $frontmatter = <<"FM"; | |||||||||||||||||||||||||||
| 219 | --- | ||||||||||||||||||||||||||||
| 220 | name: $name | ||||||||||||||||||||||||||||
| 221 | description: | | ||||||||||||||||||||||||||||
| 222 | $desc | ||||||||||||||||||||||||||||
| 223 | Use this skill whenever the user invokes `raider`, asks about the | ||||||||||||||||||||||||||||
| 224 | `Langertha::Raider::CLI` CLI, wants to customize its persona via | ||||||||||||||||||||||||||||
| 225 | `.raider/instructions.md` or `.raider.md`, | ||||||||||||||||||||||||||||
| 226 | or is reading a transcript that contains `raider>` prompts and | ||||||||||||||||||||||||||||
| 227 | `bash`/`read_file`/`web_search` tool calls. | ||||||||||||||||||||||||||||
| 228 | --- | ||||||||||||||||||||||||||||
| 229 | |||||||||||||||||||||||||||||
| 230 | FM | ||||||||||||||||||||||||||||
| 231 | 4 | return $frontmatter . $self->markdown; | |||||||||||||||||||||||||||
| 232 | } | ||||||||||||||||||||||||||||
| 233 | |||||||||||||||||||||||||||||
| 234 | |||||||||||||||||||||||||||||
| 235 | 9 | ▶ | sub write_markdown { | ||||||||||||||||||||||||||
|
Subroutine
write_markdown: called CC=2 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||
| 236 | 9 | my ($self, $file) = @_; | |||||||||||||||||||||||||||
| 237 | 9 | my $p = path($file); | |||||||||||||||||||||||||||
| 238 | 9 | ▶ | $p->parent->mkpath unless -d $p->parent; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 239 | 9 | $p->spew_utf8($self->markdown); | |||||||||||||||||||||||||||
| 240 | 9 | return $p; | |||||||||||||||||||||||||||
| 241 | } | ||||||||||||||||||||||||||||
| 242 | |||||||||||||||||||||||||||||
| 243 | |||||||||||||||||||||||||||||
| 244 | 2 | ▶ | sub write_claude_skill { | ||||||||||||||||||||||||||
|
Subroutine
write_claude_skill: called CC=3 SCAR=11.6
Pod
documented
| |||||||||||||||||||||||||||||
| 245 | 2 | my ($self, $file) = @_; | |||||||||||||||||||||||||||
| 246 | 2 | ▶ | $file //= path($self->app->root)->child('.claude/skills', $self->name, 'SKILL.md'); | ||||||||||||||||||||||||||
|
Condition33%1/3
$file //= path($self->app->root)->child(".claude/skills", $self->name, "SKILL.md")
MC/DC0%0/2
$file //= path($self->app->root)->child(".claude/skills", $self->name, "SKILL.md")
$file
path($self->app->root)->child(".claude/skills", $self->name, "SKILL.md")
Truth table33%1/3
A //= B
A= $fileB= path($self->app->root)->child(".claude/skills", $self->name, "SKILL.md")
| |||||||||||||||||||||||||||||
| 247 | 2 | my $p = path($file); | |||||||||||||||||||||||||||
| 248 | 2 | ▶ | $p->parent->mkpath unless -d $p->parent; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 249 | 2 | $p->spew_utf8($self->claude_skill); | |||||||||||||||||||||||||||
| 250 | 2 | return $p; | |||||||||||||||||||||||||||
| 251 | } | ||||||||||||||||||||||||||||
| 252 | |||||||||||||||||||||||||||||
| 253 | |||||||||||||||||||||||||||||
| 254 | 3 | ▶ | sub legacy_claude_skill { | ||||||||||||||||||||||||||
|
Subroutine
legacy_claude_skill: called CC=2 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||
| 255 | 3 | my ($self) = @_; | |||||||||||||||||||||||||||
| 256 | 3 | my $p = path($self->app->root)->child('.claude/skills/app-raider/SKILL.md'); | |||||||||||||||||||||||||||
| 257 | 3 | ▶ | return -f $p ? $p : (); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 258 | } | ||||||||||||||||||||||||||||
| 259 | |||||||||||||||||||||||||||||
| 260 | 62 | __PACKAGE__->meta->make_immutable; | |||||||||||||||||||||||||||
| 261 | |||||||||||||||||||||||||||||
| 262 | 62 | 1; | |||||||||||||||||||||||||||
| 263 | |||||||||||||||||||||||||||||
| 264 | __END__ | ||||||||||||||||||||||||||||
| 265 | |||||||||||||||||||||||||||||
| 266 | =pod | ||||||||||||||||||||||||||||
| 267 | |||||||||||||||||||||||||||||
| 268 | =encoding UTF-8 | ||||||||||||||||||||||||||||
| 269 | |||||||||||||||||||||||||||||
| 270 | =head1 NAME | ||||||||||||||||||||||||||||
| 271 | |||||||||||||||||||||||||||||
| 272 | Langertha::Raider::Skill - Generate a "how to use raider" documentation file from a live Langertha::Raider::CLI configuration | ||||||||||||||||||||||||||||
| 273 | |||||||||||||||||||||||||||||
| 274 | =head1 VERSION | ||||||||||||||||||||||||||||
| 275 | |||||||||||||||||||||||||||||
| 276 | version 0.503 | ||||||||||||||||||||||||||||
| 277 | |||||||||||||||||||||||||||||
| 278 | =head1 SYNOPSIS | ||||||||||||||||||||||||||||
| 279 | |||||||||||||||||||||||||||||
| 280 | my $skill = Langertha::Raider::Skill->new(app => $app); | ||||||||||||||||||||||||||||
| 281 | |||||||||||||||||||||||||||||
| 282 | # Plain markdown for any AI tool / human | ||||||||||||||||||||||||||||
| 283 | my $md = $skill->markdown; | ||||||||||||||||||||||||||||
| 284 | |||||||||||||||||||||||||||||
| 285 | # Claude Code SKILL.md with frontmatter, written to .claude/skills/... | ||||||||||||||||||||||||||||
| 286 | $skill->write_claude_skill('.claude/skills/raider/SKILL.md'); | ||||||||||||||||||||||||||||
| 287 | |||||||||||||||||||||||||||||
| 288 | =head1 DESCRIPTION | ||||||||||||||||||||||||||||
| 289 | |||||||||||||||||||||||||||||
| 290 | Builds a self-describing how-to-use-raider document from a running | ||||||||||||||||||||||||||||
| 291 | L<Langertha::Raider::CLI> instance. The generated text reflects the actual live | ||||||||||||||||||||||||||||
| 292 | configuration: selected engine and model, which web-search providers are | ||||||||||||||||||||||||||||
| 293 | currently enabled based on environment variables, which persona layer is | ||||||||||||||||||||||||||||
| 294 | active (default Langertha, a custom F<.raider/instructions.md> or | ||||||||||||||||||||||||||||
| 295 | F<.raider.md>, or a C<-M> mission), | ||||||||||||||||||||||||||||
| 296 | and so on. Its tool table lists the tools the app mounts -- the same set | ||||||||||||||||||||||||||||
| 297 | its prompt describes and its engine offers (ADR 0005) -- each with its | ||||||||||||||||||||||||||||
| 298 | signature and the first sentence of its description, so the Perl tools | ||||||||||||||||||||||||||||
| 299 | appear only when granted and the Hall tools only under a Hall. | ||||||||||||||||||||||||||||
| 300 | |||||||||||||||||||||||||||||
| 301 | Two output variants are supported: | ||||||||||||||||||||||||||||
| 302 | |||||||||||||||||||||||||||||
| 303 | =over | ||||||||||||||||||||||||||||
| 304 | |||||||||||||||||||||||||||||
| 305 | =item * L</markdown> — engine-agnostic markdown (no frontmatter). Drop into | ||||||||||||||||||||||||||||
| 306 | any README-ish place or feed it to a non-Claude agent. | ||||||||||||||||||||||||||||
| 307 | |||||||||||||||||||||||||||||
| 308 | =item * L</claude_skill> — Claude Code SKILL.md with a proper YAML | ||||||||||||||||||||||||||||
| 309 | frontmatter block. Write to C<.claude/skills/raider/SKILL.md> (or | ||||||||||||||||||||||||||||
| 310 | wherever your skill directory lives) with L</write_claude_skill>. | ||||||||||||||||||||||||||||
| 311 | |||||||||||||||||||||||||||||
| 312 | =back | ||||||||||||||||||||||||||||
| 313 | |||||||||||||||||||||||||||||
| 314 | =head2 app | ||||||||||||||||||||||||||||
| 315 | |||||||||||||||||||||||||||||
| 316 | The L<Langertha::Raider::CLI> instance to describe. Required. | ||||||||||||||||||||||||||||
| 317 | |||||||||||||||||||||||||||||
| 318 | =head2 name | ||||||||||||||||||||||||||||
| 319 | |||||||||||||||||||||||||||||
| 320 | Skill name used in the Claude frontmatter. Defaults to C<raider>. | ||||||||||||||||||||||||||||
| 321 | |||||||||||||||||||||||||||||
| 322 | =head2 description | ||||||||||||||||||||||||||||
| 323 | |||||||||||||||||||||||||||||
| 324 | One-line description used in the Claude frontmatter. | ||||||||||||||||||||||||||||
| 325 | |||||||||||||||||||||||||||||
| 326 | =head2 markdown | ||||||||||||||||||||||||||||
| 327 | |||||||||||||||||||||||||||||
| 328 | Returns the plain markdown document (no frontmatter). | ||||||||||||||||||||||||||||
| 329 | |||||||||||||||||||||||||||||
| 330 | =head2 claude_skill | ||||||||||||||||||||||||||||
| 331 | |||||||||||||||||||||||||||||
| 332 | Returns the markdown with a Claude Code YAML frontmatter block prepended. | ||||||||||||||||||||||||||||
| 333 | |||||||||||||||||||||||||||||
| 334 | =head2 write_markdown | ||||||||||||||||||||||||||||
| 335 | |||||||||||||||||||||||||||||
| 336 | $skill->write_markdown('/path/to/SKILL.md'); | ||||||||||||||||||||||||||||
| 337 | |||||||||||||||||||||||||||||
| 338 | Writes the plain markdown to a file (creates parent dirs). | ||||||||||||||||||||||||||||
| 339 | |||||||||||||||||||||||||||||
| 340 | =head2 write_claude_skill | ||||||||||||||||||||||||||||
| 341 | |||||||||||||||||||||||||||||
| 342 | $skill->write_claude_skill; # default path | ||||||||||||||||||||||||||||
| 343 | $skill->write_claude_skill('path/to/SKILL.md'); | ||||||||||||||||||||||||||||
| 344 | |||||||||||||||||||||||||||||
| 345 | Writes the Claude SKILL.md (with frontmatter) to C<$path>. The default path | ||||||||||||||||||||||||||||
| 346 | is C<< .claude/skills/<name>/SKILL.md >> relative to the app's working root. | ||||||||||||||||||||||||||||
| 347 | |||||||||||||||||||||||||||||
| 348 | =head2 legacy_claude_skill | ||||||||||||||||||||||||||||
| 349 | |||||||||||||||||||||||||||||
| 350 | Returns the L<Path::Tiny> of a Claude skill exported by an older release | ||||||||||||||||||||||||||||
| 351 | under the former default name (C<.claude/skills/app-raider/SKILL.md> below | ||||||||||||||||||||||||||||
| 352 | the working root), or nothing when there is none. The C<--claude> profile | ||||||||||||||||||||||||||||
| 353 | would load it next to the current one, so the CLI points it out after an | ||||||||||||||||||||||||||||
| 354 | export. | ||||||||||||||||||||||||||||
| 355 | |||||||||||||||||||||||||||||
| 356 | =head1 SEE ALSO | ||||||||||||||||||||||||||||
| 357 | |||||||||||||||||||||||||||||
| 358 | =over | ||||||||||||||||||||||||||||
| 359 | |||||||||||||||||||||||||||||
| 360 | =item * L<Langertha::Raider::CLI> | ||||||||||||||||||||||||||||
| 361 | |||||||||||||||||||||||||||||
| 362 | =item * L<Langertha::Raider> | ||||||||||||||||||||||||||||
| 363 | |||||||||||||||||||||||||||||
| 364 | =back | ||||||||||||||||||||||||||||
| 365 | |||||||||||||||||||||||||||||
| 366 | =head1 SUPPORT | ||||||||||||||||||||||||||||
| 367 | |||||||||||||||||||||||||||||
| 368 | =head2 Issues | ||||||||||||||||||||||||||||
| 369 | |||||||||||||||||||||||||||||
| 370 | Please report bugs and feature requests on GitHub at | ||||||||||||||||||||||||||||
| 371 | L<https://github.com/Getty/langertha-raider/issues>. | ||||||||||||||||||||||||||||
| 372 | |||||||||||||||||||||||||||||
| 373 | =head2 IRC | ||||||||||||||||||||||||||||
| 374 | |||||||||||||||||||||||||||||
| 375 | Join C<#langertha> on C<irc.perl.org> or message Getty directly. | ||||||||||||||||||||||||||||
| 376 | |||||||||||||||||||||||||||||
| 377 | =head1 CONTRIBUTING | ||||||||||||||||||||||||||||
| 378 | |||||||||||||||||||||||||||||
| 379 | Contributions are welcome! Please fork the repository and submit a pull request. | ||||||||||||||||||||||||||||
| 380 | |||||||||||||||||||||||||||||
| 381 | =head1 AUTHOR | ||||||||||||||||||||||||||||
| 382 | |||||||||||||||||||||||||||||
| 383 | Torsten Raudssus <torsten@raudssus.de> L<https://raudssus.de/> | ||||||||||||||||||||||||||||
| 384 | |||||||||||||||||||||||||||||
| 385 | =head1 COPYRIGHT AND LICENSE | ||||||||||||||||||||||||||||
| 386 | |||||||||||||||||||||||||||||
| 387 | This software is copyright (c) 2026 by Torsten Raudssus. | ||||||||||||||||||||||||||||
| 388 | |||||||||||||||||||||||||||||
| 389 | This is free software; you can redistribute it and/or modify it under | ||||||||||||||||||||||||||||
| 390 | the same terms as the Perl 5 programming language system itself. | ||||||||||||||||||||||||||||
| 391 | |||||||||||||||||||||||||||||
| 392 | =cut | ||||||||||||||||||||||||||||