Skip to content

xlang-foundation/caslang

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

52 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

caslang

A highly constrained, JSONL-based execution language for LLMs. (Note: Not intended for human developers to write by hand)

caslang replaces multi-step LLM tool calls with a single, deterministically validated script to achieve two core objectives:

  1. Minimize Hallucinations: Single-pass generation in a strict format reduces LLM errors.
  2. Security Validation: Pre-execution schema checks guarantee safe host behavior.

Format: JSONL

We use JSONL (JSON Lines) as our standard script format. Each line in a caslang script is a valid JSON object representing a single command. This makes it highly LLM-friendly, easily parsable, and machine-validated.

Example: Semantic Video Search

An LLM can generate this entire plan to execute a semantic search over a SQL database, without escaping multiline strings:

{"op":"caslang","version":"0.3"}
{"op":"flow.set","name":"target","value":"a red car driving in the rain"}
{"op":"flow.set","name":"query","mode":"block","nonce":"__SQL__"}
SELECT image_id, device_id, timestamp
FROM VisionDB 
WHERE object_class = 'car' AND confidence > 0.85
ORDER BY timestamp DESC LIMIT 1000
{"op":"flow.end_set","name":"query","nonce":"__SQL__"}
{"op":"tool.call","tool_name":"semantic_search","target_text":"${target}","filter_sql":"${query}","as":"results"}
{"op":"flow.return","value":"${results}"}

Example 2: Local File Automation

caslang isn't just for backend tool calls—it can safely orchestrate local file operations to generate reports or process data on the host machine:

{"op":"caslang","version":"0.3"}
{"op":"fs.list","dir":"/data/results","pattern":"*.json","as":"files"}
{"op":"flow.set","name":"html","value":"<h1>Analysis Report</h1>"}

{"op":"flow.loop_start","var":"file","in":"${files}"}
    {"op":"fs.read_file","path":"${file}","as":"raw"}
    {"op":"json.parse","s":"${raw}","as":"data"}
    {"op":"flow.set","name":"html","value":"${html}<p>${data['summary']}</p>"}
{"op":"flow.loop_end"}

{"op":"fs.write_file","path":"/data/report.html","data":"${html}"}
{"op":"str.print","msg":"Report generated successfully!"}

Why caslang?

  • Single-pass execution: One script, one validation, one execution. Reduces latency and hallucination risks.
  • Privacy by default: Execution happens locally. Local data stays local.
  • Strong constraints: Strict argument schemas and a closed command set.
  • Separation of concerns: The language defines control, capabilities define what exists, and the executor defines how it runs.

What caslang is (and is not)

caslang is:

  • A machine-to-machine execution format generated by AI models.
  • LLM-friendly, machine-validated, and host-embedded.

caslang is not:

  • A language intended for human developers to write manually.
  • A general-purpose programming language.
  • An agent framework or chat protocol.

About

A constrained scripting language for expressing executable workflow plans (LLM-friendly, single-pass, validated and sandboxed).

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages

  • C++ 85.9%
  • Python 8.8%
  • Logos 3.2%
  • Batchfile 1.2%
  • Other 0.9%