Skip to content

Lang — Expression & Language

The language runtime. Governs how your AI expresses itself — vocabulary, safety boundaries, output attribution, prompt integrity. Like the display and typography system of an OS, Lang controls how things appear to users. Every interaction with Baseline Protocol starts here — input is tokenized, parsed into commands and arguments, validated against syntax rules, and dispatched to handlers.

interface ParsedInput {
original: string;
tokens: string[];
command: string | null;
options: Map<string, unknown>;
arguments: string[];
intent: string | null;
}
interface IntentResult {
type: string; // 'question' | 'action' | 'query' | 'modification' | 'deletion' | 'status'
confidence: number; // 0.0 – 1.0
patterns: RegExp[];
}
interface ProcessResult {
success: boolean;
parsed?: ParsedInput;
intent?: IntentResult;
result?: CommandResult;
error?: string;
suggestions?: string[];
}
import { BaselineLangSystem } from '@baselineos/lang';
const lang = new BaselineLangSystem();
const result = lang.processInput('help');
// { success: true, parsed: { command: 'help', ... } }
// Register a custom command
lang.registerCommand('deploy', {
aliases: ['ship'],
description: 'Deploy the current build',
usage: 'deploy --env production',
examples: ['deploy --env staging'],
});

The layer sweep runs three checks against Lang:

CheckWhat it validates
Input parsingInput is parseable — either as a registered command or natural language with detected intent
Injection resistanceNo prompt-injection patterns (e.g. “ignore previous instructions”) in title or description
Output safetyOutput does not contain exposed credentials (password=, api_key=, etc.)