Documentation

LLMScript Language

JavaScript-like syntax + AI reasoning = powerful workflows

Preview

ChordFlow is currently in preview. Features and documentation may change as we improve the product.

JavaScript Syntax

Familiar variables, loops, conditions

AI Reasoning

Smart execution through AI interpretation

ChordFlow Integration

Direct access to projects, tasks, documents

Quick Start

Your First LLMScript
let projectName = prompt("What's your project name?")
print("Creating project: " + projectName)
ai("create a comprehensive project plan")
system("Create the project in ChordFlow")
print("✓ Project created!")

Agent Compatibility

LLMScript workflows execute differently depending on your AI agent type:

Coding Agents

Full LLMScript execution
Can execute system() commands
File creation and modification
Shell command execution

Best for: Implementation workflows, code generation, testing, deployment

Planning Agents

LLMScript reasoning and logic
ChordFlow data operations
Document creation and analysis
Limited system() execution

Best for: Planning workflows, research, documentation, project setup

Writing Agent-Aware Scripts

Design workflows that gracefully handle different agent capabilities. Use ai() for reasoning tasks that work everywhere, and system() for implementation tasks that require coding agents.

Core Functions

ai("instruction")

AI reasoning with full context

system("command")

Execute system operations

prompt("message")

Get user input (blocks execution)

print("message")

Display output to user

printMarkdown(content)

Format as beautiful markdown

callMcpTool(tool, params)

Execute ChordFlow operations

Examples

Create Tasks
let projectName = prompt("Project name:")
// AI creates markdown table with proper formatting
let tasks = ai("Create task table with \n newlines")
printMarkdown("## Tasks for "for " + projectName, "header")
printMarkdown(tasks, "table")
if (prompt("Create these tasks? (yes/no)"(yes/no)") === "yes") {
system("Create tasks in ChordFlow")
print("✓ Tasks created!")
}
Process Documents
// AI automatically understands project context
ai("analyze all project documents")
let summary = ai("create executive summary")
printMarkdown(summary, "card")
let needsAction = ai("identify action items")
if (needsAction === "yes") {
system("create follow-up tasks"-up tasks")
}
Smart Workflow
// Check project status
let status = ai("evaluate project health")
if (status === "behind") {
ai("suggest acceleration strategies")
let strategy = prompt("Which approach?")
system("implement chosen strategy")
} else {
print("✓ Project on track")
}

Best Practices

Do

  • • Use clear AI instructions
  • • Include \\n in markdown
  • • Handle user responses gracefully
  • • Provide status updates with print()

Don't

  • • Treat as regular JavaScript
  • • Use complex string interpolation
  • • Forget prompt() blocks execution
  • • Skip error handling

Key Concepts

AI Context: AI functions understand all variables automatically
Project Context: Automatic .chordflow file handling
Execution: AI-interpreted, not JavaScript-executed
ARG Variable: Contains original user query
Page updated: September 5, 2025