API Reference

Complete reference for all Tauri IPC commands and events. These are the functions the React frontend calls to interact with the Rust backend.

Info

All commands are invoked via Tauri's invoke("command_name", { args }) function from the frontend. Events are listened to via listen("event-name", callback).

Agent Management

list_agents(projectPath: string)AgentInfo[]

Lists all .md agent files in .claude/agents/ with auto-extracted descriptions.

read_agent(path: string){ name: string, path: string, content: string }

Reads the full Markdown content of an agent file.

write_agent(path: string, content: string)void

Overwrites an agent file with new content.

create_agent(projectPath: string, name: string, content: string)string (file path)

Creates a new agent .md file. Returns the full path.

delete_agent(path: string)void

Deletes an agent file from the filesystem.

Pipeline Management

list_pipelines(projectPath: string)PipelineInfo[]

Lists all .pipeline.json files in .claude/pipelines/.

read_pipeline(path: string)Pipeline

Reads and parses a pipeline JSON file.

write_pipeline(projectPath: string, pipeline: Pipeline)string (file path)

Saves a pipeline to disk. Also auto-generates agent markdown from pipeline nodes.

delete_pipeline(projectPath: string, path: string)void

Deletes a pipeline JSON file.

rename_pipeline(projectPath: string, oldPath: string, newName: string)string (new path)

Renames a pipeline file.

generate_pipeline(prompt: string, cliPath: string, projectPath: string)Pipeline

Uses Claude CLI to generate a pipeline from a natural language description.

Execution

start_run(pipeline: Pipeline, inputs: Record<string, string>, claudeCliPath: string, projectPath: string)string (run ID)

Starts executing a pipeline. Returns run ID immediately; execution continues async.

cancel_run((none))void

Cancels the currently active run. Sends SIGTERM to active processes.

respond_to_approval(approved: boolean)void

Responds to a pending approval gate. true = continue, false = fail the node.

get_run_state((none))RunState | null

Returns the current run state or null if no run is active.

resume_run(originalRunId: string, pipeline: Pipeline, inputs: Record<string, string>, claudeCliPath: string, projectPath: string)string (new run ID)

Resumes a failed run from the point of failure, reusing successful steps.

Run History & Analytics

list_run_history(limit?: number)RunRow[]

Lists past runs ordered by start time descending.

get_run_details(runId: string)[RunRow, RunStepRow[]]

Returns the run record and all its step records.

get_cost_summary((none)){ totalCost: number, runs: CostRun[] }

Total cost and per-run cost breakdown.

get_usage_stats((none))UsageStats

Comprehensive analytics: totals, averages, top nodes, top pipelines.

get_avg_ai_cost((none))number | null

Average cost per AI task execution.

Project Management

scan_project(projectPath: string)ProjectInfo

Scans a directory for .claude/ existence, agent count, and pipeline count.

init_project(projectPath: string)void

Creates .claude/agents/ and .claude/pipelines/ directories.

detect_project_from_cwd((none))string | null

Walks parent directories looking for .claude/. Returns the project root or null.

get_recent_projects((none))RecentProjects

Returns the list of recently opened projects.

add_recent_project(projectPath: string)void

Adds a project to the recent list.

remove_recent_project(projectPath: string)void

Removes a project from the recent list.

Settings

get_settings((none))AppSettings

Returns the current app settings.

save_settings(settings: AppSettings)void

Persists settings to the JSON file.

detect_claude_cli((none))string | null

Auto-detects the Claude CLI path. Returns the path or null.

detect_claude_cli_detailed((none)){ path: string, version: string, source: string }

Detailed detection with version info and the source where it was found.

File Watching

start_watching(projectPath: string)void

Starts watching .claude/agents/ and .claude/pipelines/ for changes.

stop_watching((none))void

Stops the file watcher.

Error Logging

get_error_log(limit?: number)LogInfo { path, sizeBits, entries[] }

Returns recent error log entries.

get_full_log((none))string

Returns the full log file content.

get_log_path((none))string

Returns the absolute path to the log file.

clear_error_log((none))void

Clears the error log.

Events

The Rust backend emits these events to the frontend via Tauri's event system:

run-update

Emitted on every status change during pipeline execution.

RunState { runId, status, nodeStates, totalCost }
node-log

Emitted for each line of stdout/stderr from an executing node.

{ runId: string, nodeId: string, line: string }
approval-requested

Emitted when execution reaches an approval gate, pausing for human input.

{ runId: string, nodeId: string, name: string }
file-changed

Emitted when the file watcher detects changes in .claude/ directories. Debounced at 500ms.

{ kind: "Modify" | "Create" | "Remove", paths: string[] }

Database Schema

AgentFlow uses SQLite (via SQLx) stored at ~/.cache/com.agentflow.app/agentflow.db

runs table
sql
CREATE TABLE runs (
  id TEXT PRIMARY KEY,                -- "run-{timestamp_ms}"
  pipeline_name TEXT NOT NULL,
  started_at TEXT NOT NULL,           -- ISO 8601 UTC
  finished_at TEXT,                   -- NULL until completion
  status TEXT NOT NULL DEFAULT 'running',
  trigger_input TEXT,                 -- JSON string
  resumed_from TEXT,                  -- Original run ID
  failed_node_id TEXT,
  pipeline_hash TEXT                  -- SHA256 of instructions
);
run_steps table
sql
CREATE TABLE run_steps (
  id INTEGER PRIMARY KEY AUTOINCREMENT,
  run_id TEXT NOT NULL,
  node_id TEXT NOT NULL,
  node_name TEXT,
  started_at TEXT,
  finished_at TEXT,
  status TEXT NOT NULL DEFAULT 'pending',
  exit_code INTEGER,
  log_output TEXT,                    -- Full captured output
  attempt INTEGER DEFAULT 1,
  cost_usd REAL,                     -- NULL for non-AI nodes
  model TEXT,
  approval_state TEXT,               -- "approved" | "rejected"
  instructions_hash TEXT,            -- SHA256 for resume
  FOREIGN KEY (run_id) REFERENCES runs(id)
);