NAME
Langertha::Raider::CronTools - Internal session-scoped scheduled prompts: cron_create, cron_delete and cron_list
VERSION
version 0.504
SYNOPSIS
my $cron = Langertha::Raider::CronTools->new(
loop => $app->loop,
tasks => $app->tasks,
);
my $server = $cron->server; # MCP::Server with cron_create, cron_delete, cron_list
$cron->tick; # what the loop's timer does once a second
DESCRIPTION
Internal module. Its interface may change without notice.
The scheduled prompts of raider, shaped after Claude Code's CronCreate, CronDelete and CronList (Langertha::Raider::ToolNames, ADR 0031). A job is a five-field cron expression (Langertha::Raider::Cron), in local time, a prompt, and whether it recurs or fires once. Jobs belong to the session -- they are entries of the application's Langertha::Raider::Tasks (kind cron, IDs cron_N) and go when raider does; nothing is written to disk.
A timer on the application's loop looks once a second for jobs that are due. A due job does not interrupt anything: its prompt waits in the registry's queue cron ("recipient") until the surface is free -- the REPL at its prompt with nothing typed -- and then runs as a new turn. Several fires of one job that wait are one (no catch-up: a job whose time passed while a turn ran fires once when the turn is over). A recurring job expires seven days after its creation: it fires one more time, then it is deleted. Run times are shifted the way Claude Code does it ("jitter" in Langertha::Raider::Cron).
loop
Required. The loop the timer runs on -- the application's.
tasks
Required. The application's registry: the jobs are its entries, the fires its queue.
recipient
The queue of Langertha::Raider::Tasks the prompts of due jobs are posted to: cron. It is not main: a prompt that is due is not a notification and must not be pulled into a turn that is running.
clock
The clock, a code reference that returns epoch seconds: time. Tests give it a clock they move by hand.
max_jobs
How many jobs a session may hold: 50, as in Claude Code.
expire_after
Seconds a recurring job lives: seven days.
tick_interval
Seconds between two looks at the jobs: one.
timer
True (the default) when the object runs the timer on the loop. Without it the caller calls "tick" itself.
server
The MCP::Server with cron_create, cron_delete and cron_list, built once.
create
my ( $text, $is_error ) = $cron->create({ cron => '*/5 * * * *', prompt => 'check the build' });
The cron_create tool: schedules the job and answers with its ID. The expression must parse ("validate" in Langertha::Raider::Cron), the prompt must not be empty, and the session may hold "max_jobs" jobs.
delete
my ( $text, $is_error ) = $cron->delete({ id => 'cron_1' });
The cron_delete tool: Cancelled job ID., or the error No scheduled job with ID: X.
list
my ( $text ) = $cron->list({});
The cron_list tool: one line per job -- ID, expression, recurring or one-shot, the next run (local time) and the prompt -- or No scheduled jobs.
jobs
my @jobs = $cron->jobs; # the entries of the jobs that are scheduled, oldest first
my $n = $cron->jobs;
tick
$cron->tick;
$cron->tick($epoch);
Fires every job that is due at $epoch (default: the clock): its prompt is queued for the surface ("recipient"), the next run of a recurring job is set -- counted from now, so missed runs are not made up -- and a one-shot job, or a recurring one past its expiry, is finished. A job whose previous fire still waits in the queue is not queued again. Returns the IDs of the jobs that fired.
stop_all
Deletes every job and stops the timer; the application going away does it.
SEE ALSO
SUPPORT
Issues
Please report bugs and feature requests at https://github.com/Getty/langertha-raider/issues.
IRC
Join #langertha on irc.perl.org or message Getty directly.
CONTRIBUTING
Contributions are welcome! Please fork the repository and submit a pull request.
AUTHOR
Torsten Raudssus <torsten@raudssus.de> https://raudssus.de/
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.