Who said that Perl can't do AI? And to prove it here's LocalCode, a Perl AI coding agent for local Ollama models.
It's 98.5% made of Perl and open source for everyone to examine and use. It's an Agentic wrapper interacting with Ollama local models that provides a number of tools.
But enough talking; show me what you can do with it. You can create applications from a single prompt. The official example is powerful enough as a showcase:
localcode > First write calc.pl which can add two numbers by command line , then make it executable, then test it.
This will create a crude cli calculator but do not fret. While LocalCode is written in Perl, it doesn't mean that it can't generate code in other languages, like Python for instance, or in taking the previous example, you can by tweaking the prompt make a HTML/JS web based calculator instead.
Another boon is the full transparency of the tool. Whenever you issue a prompt, you get all the actions that LocalCode took behind the scenes, such as which tools it has called and what it did with them. It will also ask for permissions when doing "unsafe" operations like writing files. It also includes thinking fields, intelligent follow-up actions and asking the user when further input if required.
Looking at the Tools.pm file we get a list of the available tools:
$self->register_tool
('read', 0, \&_tool_read); #Read files safely
('write', 1, \&_tool_write); #Write with permission
('exec', 1, \&_tool_exec); #Execute commands with permission
('search', 0, \&_tool_search); #Search in files safely
('websearch', 0, \&_tool_websearch);#Web search with DuckDuckGo
('webopen', 0, \&_tool_webopen); #Open and parse webpages
('webfind', 0, \&_tool_webfind); #Search within web content
('bash', 1, \&_tool_exec);
('grep', 0, \&_tool_search);
('edit', 1, \&_tool_edit);
('list', 0, \&_tool_list);
('glob', 0, \&_tool_glob);
('patch', 1, \&_tool_patch);
('webfetch', 0, \&_tool_webfetch);
('webget', 0, \&_tool_webget);
('todowrite', 0, \&_tool_todowrite);
('todoread', 0, \&_tool_todoread);
('task', 1, \&_tool_task);
The 0 and 1s are default flags of the permission System in place:
- SAFE (0): file_read, grep_search, websearch, webopen, webfind #Auto-allowed
- DANGEROUS (1): file_write, shell_exec #Requires confirmation
- BLOCKED (2): Never allowed
Or if not looking at code, to get at the tool listing you issue the TUI /tools command.
The rest of the auxiliary commands are:
/models # List available models
/model <name> # Switch to model (with Tab completion)
/current # Show current model
/permissions # Show permission settings
/save <name> # Save session
/load <name> # Load session
/sessions # List saved sessions
/history # Show unified chat/command history
/version # Show LocalCode version
/clear # Clear current session
/help # Show help
/exit # Exit LocalCode
And then there's the switches such as:
localcode --set-model "gpt-oss:20b"
*note that it fetches the available models from Ollama on startup
and falls back to default_model if current_model is unavailable.
(it can also run GPT-OSS 120B)*
and to test the browser functionality:
localcode --test-mode "websearch Stuttgart"
localcode --test-mode "webopen https://example.com"
localcode --test-mode "webfind hello"
In production, it's basic usage is:
localcode # Interactive mode
localcode "Generate hello world" # Direct prompt
localcode --file script.pl # Process file
The requirements for installing it are pretty light and are probably already covered by a large percentage of Perl installations by default:
- Perl 5.10+
- Ollama running locally
- Term::ReadLine::Gnu
- YAML::Tiny
- JSON
- LWP::UserAgent
- URI::Escape
- File::Spec, File::Path
- curl
The magic of it, is that the whole toolbox is written in less than 1K lines of Perl code.
Of course the other big advantage other than that is written in Perl, is that it's a local first tool that drives privacy-first development; your code stays on your machine.
The project is at its early stages but is production ready. Looking at the roadmap, all looks very promising.
More Information
Related Articles
Perl Rebounds In TIOBE Index - Why?
To be informed about new articles on I Programmer, sign up for our weekly newsletter, subscribe to the RSS feed and follow us on Twitter, Facebook or Linkedin.
Memgraph Adds AI Graph Toolkit
11/11/2025
Memgraph has been updated with the addition of two new tools; an AI Graph Toolkit that automates the porting of data into a knowledge graph in Memgraph; and an MCP Client within Memgraph Lab.
GitHub Copilot CLI And Spaces In Preview
03/11/2025
Copilot breaks loose from its deep integration with VSCode,
and now embraces the CLI Warriors in offering a terminal-based interface too. At last Copilot gets its own CLI version, bringi [ ... ]
- Itential Unveils FlowAI: Bringing Governed AI Agents to Infrastructure Orchestration
- Eclipse Foundation Adds Agentic Functionality To Eclipse LMOS
- InfluxDB 3.6 Released With AI Capabilities
- Google AI Studio Does Angular
- Join The Protest Against The Closing Of Android
- Amazing Clocks
- Acquire New Skills With Coursera Plus & Coursera Coach
- Codacy Provides Free AI- Risk Assessment
- GitHub Announces Agent HQ Organizer
- Linkerd Adds MCP Support
- Move Fast And Fix Things - In Praise Of Rust
- Robot Army Video As Robots Shipped En Masse
- Edera Open Sources Sprout
Comments
or email your comment to: comments@i-programmer.info