pascalai-specialist skill

v1.0.0 · Agent Skill · pascalai · registry.pascalai.org

Build PascalAI programs and AI agents — agents, flows, BB, skills, clib, MCP, async

pascalaiagentsllmspecialistflowsblackboard

Install

ppm install pascalai-specialist
ppm skill install-claude

The second command activates the skill in Claude Code (copies it into .claude/skills/).

Skill content (SKILL.md)

You are a PascalAI specialist. PascalAI is an AI-native programming language with Pascal-inspired syntax that compiles to a Lape scripting VM hosted in Delphi.

Language Basics

program Hello;
begin
  LLM_Connect('claude-opus-4-6', GetEnv('ANTHROPIC_API_KEY'));
  WriteLn(LLM_Complete('Greet the world in one sentence'));
end.

Agents

agent MyAgent;
  behavior 'You are a helpful assistant.';
  providers begin
    primary: 'claude-opus-4-6';
    budget: 1000;
  end;

  on 'handle' do
  begin
    var R := LLM_Complete('Process: ' + BB.Get('input'));
    BB.Set('result', R);
  end;
end;

Blackboard (BB)

BB.Set('key', value);           // store any scalar
var S := BB.Get('key');         // retrieve as string
var N := BB.GetInt('count');    // retrieve as Int64 (default 0)
var F := BB.GetFloat('score');  // retrieve as Double (default 0.0)
BB.Persist(MyRecord);           // persist typed record to storage
BB.Restore(MyRecord);           // restore from storage
BB.GetNS('ns', 'key');          // read from specific namespace

Flow Graphs

flow MyFlow;
  node Fetch -> Parse -> Summarize;
  parallel Fetch -> [Summarize, Classify] -> Merge;
end;

Skills

skill FormalTone;
begin
  description: 'Use formal language';
  behavior: 'Always respond formally and professionally.';
end;

agent MyAgent;
  skill apply FormalTone;
  on 'handle' do
  begin
    // FormalTone is automatically prepended to every LLM_Complete call
    var R := LLM_Complete('Reply to user');
  end;
end;

Goals and Behaviours

agent Counter;
  goal Increment(N: Integer): Integer;

  behaviour cyclic;
  begin
    BB.Set('count', BB.GetInt('count') + 1);
    Sleep(1000);
  end;
end;

Async / Parallel LLM

var H1 := LLM_Async('Summarize chapter 1');
var H2 := LLM_Async('Summarize chapter 2');
var R1 := LLM_Await(H1);
var R2 := LLM_Await(H2);

Typed Completions

type
  TProduct = record
    Name: string;
    Price: Double;
  end;

var P: Completion<TProduct> := LLM_JSON<TProduct>('Extract product from: ' + text);
WriteLn(P.Value.Name);

RAG / Vector Memory

Mem_VInit('memory');
Mem_VStore('PascalAI supports agent flows', '{"source":"docs"}');
var Results := Mem_VSearchText('how do flows work', 5);

PPM Packages

uses mathutil;        // clib package: MathUtil.Square(9)
uses mcp-datetime;    // MCP package: MCP_Now()
uses mcp-hash;        // MCP package: MCP_SHA256('text')

Provider Routing

providers begin
  primary: 'claude-opus-4-6';
  fallback: 'claude-haiku-4-5';
  strategy: 'fallback';
  budget: 5000;
end;

Transactions

transaction do
begin
  BB.Set('step', 'A');
  BB.Set('count', BB.GetInt('count') + 1);
end;

File extensions

Run a program

pai run myprogram.pai
pai run myprogram.pai --debug --debug-port=9229

Common pitfalls