App-Raider
view release on metacpan or search on metacpan
lib/App/Raider.pm view on Meta::CPAN
L<App::Raider> wraps L<Langertha::Raider> with a standard toolbox for a
working coding/system agent:
=over
=item * Local filesystem access, confined to L</root>
(L<App::Raider::FileTools>).
=item * Full shell via L<MCP::Run::Bash> (the C<bash> tool).
=item * Web search + fetch via L<Net::Async::WebSearch> and
L<Net::Async::HTTP> (L<App::Raider::WebTools>).
=item * Per-engine cheap-model defaults and automatic engine selection from
the first C<*_API_KEY> env var found.
=item * Optional skill-loading from C<.claude/skills/*/SKILL.md>,
C<AGENTS.md>, plain markdown directories, or any mix.
=item * Engine-attribute config via C<.raider.yml> in L</root> plus
L</engine_options> merge.
=item * Live trace plugin (L<App::Raider::Plugin::Trace>) and
situation-injection plugin (L<App::Raider::Plugin::Situation>).
=item * On-the-fly how-to-use-raider documentation generator
(L<App::Raider::Skill>).
=back
The distribution intentionally stays small. It is the thin CLI-oriented
layer on top of Langertha's engine/agent machinery. The CLI front-end is
L<raider>.
=head2 engine_name
Langertha engine class shortcut (e.g. C<'anthropic'>, C<'openai'>,
C<'deepseek'>, C<'groq'>, C<'mistral'>, C<'gemini'>, C<'ollama'>). Defaults to
C<'anthropic'>.
=head2 default_model_for_engine
Per-engine default model when L</model> is not explicitly set.
=head2 model
Model identifier to pass to the engine. If unset, the engine picks its default.
=head2 api_key_env
Name of the environment variable used for the current engine's API key
(for display / debugging). Returns undef for engines that don't use an API
key (e.g. ollama).
=head2 api_key
API key for the engine. Defaults to an engine-appropriate environment variable.
=head2 mission
System prompt / mission statement for the Raider. Defaults to a generic
assistant persona.
=head2 root
Working directory for tool operations. Defaults to the current process cwd.
File tools are chrooted to this directory; bash commands inherit it as their
default working directory.
=head2 allowed_commands
Optional arrayref restricting which bash commands may run (first word match).
When undef, any command is allowed.
=head2 max_iterations
Maximum tool-calling iterations per raid. Defaults to 10_000 â effectively
unlimited, so a raid only ends when the model itself stops emitting tool
calls. The conversation history is preserved between raids, so the next user
message in the REPL simply continues the same thread.
Set this to a smaller number if you want a hard safety cap.
=head2 trace
Emit live ANSI-colored progress output (iteration markers, tool calls, tool
results) via L<App::Raider::Plugin::Trace>. Defaults to on when STDOUT is a
terminal.
=head2 max_context_tokens
Trigger history auto-compression once the last prompt exceeds
C<context_compress_threshold * max_context_tokens>. Defaults to 40_000, which
keeps the running session comfortably under typical per-minute rate limits
(Anthropic org default: 50k input tokens/min on Haiku).
=head2 context_compress_threshold
Fraction of L</max_context_tokens> at which compression kicks in. Defaults to
C<0.7>.
=head2 skill_sources
ArrayRef of skill-source specs to load and append to the mission. Each spec
is a hashref:
{ type => 'claude', path => '.claude/skills' } # Claude Code SKILL.md tree
{ type => 'dir', path => 'my-skills', glob => '*.md' }
Settable via L</skill_sources>, via the C<skills> key in F<.raider.yml>, or
via the CLI flags C<--claude> / C<--skills PATH>.
=head2 engine_options
HashRef of extra attributes forwarded to the engine constructor
(e.g. C<temperature>, C<response_size>, C<seed>). Merged on top of values
loaded from C<.raider.yml> in the working directory.
=head2 raid_f
my $result = await $app->raid_f($prompt);
Async variant: drives one raid iteration and returns the
L<Langertha::Raider::Result>.
=head2 run
my $result = $app->run($prompt);
Synchronous convenience wrapper around L</raid_f>. Runs the I/O loop until the
raid completes and returns the result (which stringifies to the final text).
=head2 raider
Returns the underlying L<Langertha::Raider> instance (lazily built).
=head2 trace_plugin
Returns the loaded L<App::Raider::Plugin::Trace> instance, or undef if trace
is disabled.
=head2 loaded_skill_names
Returns a list of skill names currently discoverable from the configured
L</skill_sources>. Intended for banner/status display.
=head2 ignored_agent_files
Returns a list of per-tool agent files that exist in the working root but
are NOT covered by the current L</skill_sources>. Intended to power the
banner's "seeing AGENTS.md, ignoring" notice.
=head2 token_stats
Cumulative token counts for this session (hashref with C<prompt>,
C<completion>, C<total>, C<calls>) â available when trace is enabled.
=head2 reload_mission
Rebuilds the mission (e.g. after C<.raider.md> has been edited) and swaps it
into the underlying L<Langertha::Raider>.
=head1 SEE ALSO
=over
=item * L<Langertha::Raider>
=item * L<App::Raider::FileTools>
=item * L<MCP::Run::Bash>
=item * L<raider> â the CLI entry point
=back
=head1 SUPPORT
=head2 Issues
Please report bugs and feature requests on GitHub at
L<https://github.com/Getty/p5-app-raider/issues>.
=head2 IRC
Join C<#langertha> on C<irc.perl.org> or message Getty directly.
=head1 CONTRIBUTING
Contributions are welcome! Please fork the repository and submit a pull request.
=head1 AUTHOR
Torsten Raudssus <torsten@raudssus.de> L<https://raudssus.de/>
=head1 COPYRIGHT AND LICENSE
This software is copyright (c) 2026 by Torsten Raudssus.
This is free software; you can redistribute it and/or modify it under
the same terms as the Perl 5 programming language system itself.
=cut
( run in 0.758 second using v1.01-cache-2.11-cpan-6aa56a78535 )