Skip to content


Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?

Latest commit


Git stats


Failed to load latest commit information.
Latest commit message
Commit time

Skynet for Perl6

Skynet is a collection of AI for your Perls6. Build Status


Using panda:

panda install Acme::Skynet

Slightly Usable


Attempts to determine your intended action from a command phrase. Look at examples/stabbing_reminders.p6 for more information.

The more knowledge you add, the hopefully better it will be able to parse.

Other than dumbing down, there's no additional text preprocessing yet. Punctuation can throw things off...

There's an option for passing contexts. I'll add some documentation later, but you can see us using it for testing in t/intent.t.

use v6;
use Acme::Skynet;

my $robotOverlord =;

my $time = sub () {
    say now;

# Route commands to actions.
$robotOverlord.add($time, "what time is it");
$robotOverlord.add($time, "current time");

my $stab = sub (@args) {
    say "Stabbed @args[0]";

# Basic support for commands with arguments
$robotOverlord.add($stab, "stab john", "john");
$robotOverlord.add($stab, "stuart deserves to be stabbed", "stuart");

# Perform some training and learning

# Provide some input
$robotOverlord.hears("stab carlos"); # Expected output: "stabbed carlos"
$robotOverlord.hears("what is the time"); # Expected output: the time

Chain Labelling

Does labeling have 1 l or 2? Spell check okays both... this is how it all starts...

You need a classifier in front of this. If you run a completely unrelated phrase through the labeler, your results will be completely unrelated. That's unexpected.

use v6;
use Acme::Skynet::ChainLabel;

# Create a new labeler
my $reminders =;

# Tell it some facts
$reminders.add("remind me at 7 to strech", "7", "strech");
$reminders.add("at 6 pm remind me to shower", "6 pm", "shower");
$reminders.add("remind me to run at the robot apocalypse", "the robot apocalypse", "run");

# Let it learn those facts.

my @ret = $reminders.get("at 6 pm remind me to let's shower");
say @ret[0]; # => "6 pm"
say @ret[1]; # => "let's shower"

@ret = $reminders.get("remind me to feed my cats at lunch time");
say @ret[0]; # => "lunch time"
say @ret[1]; # => "feed my cats"

Dumbing Down

AIs think in simpler terms than us humans. It's a process called "dumbing down". We needs to make things easier for them to understand.

use v6;
use Acme::Skynet::DumbDown;

say dumbdown("cats"); # => "cat"

say dumber('he eats cats'); # => "he eat cat"

say extraDumbedDown("what's the current o'clock"); # => "what is the current of the clock"

say labeledExtraDumbedDown("we're so cool"); # => [[we're, so, cool] [we are, so, cool]]


This is a rapid basic (or overly complicated) implementation of an ID3 Tree. It's how our robot overlords will identify what's going on around them and determine the action to take.

use v6;
use Acme::Skynet::ID3; # Should I rename this?

# We need to create a thingy so our classifier and
# thingy can talk and read each other

class FeatNum does Featurized {
  has $.value;
  method new($value){
  method getFeature($feature) {
    return ($.value % 2 == 0);
  # In training, label known, when querying,
  # this isn't used and can be left blank
  method getLabel() {
    return (($.value %2 == 0)) ?? "even" !! "odd";

my $Classifier =;
my @features = "value";
my @labels = "even", "odd";
for [1..10] -> $num {

say $Classifier.get(; # => "even"
say $Classifier.get(; # => "odd"

What about the 3 laws of robotics?

Rules were made to be broken.


  • Write Skynet V1
  • Add multiple layers of Machine Learning, supposed to make things better
  • Ability to save state. It'd be bad if our supreme leaders forgot things
  • Convince everyone I know what I'm doing
  • Acquire government funding and live it up
  • Add in 3 laws of robotics
  • Have no regrets




Skynet is a collection of AIs for your Perls6.






No packages published


  • Other 100.0%