Skip to content

API Reference

Radius communicates via Unix socket IPC using JSON-RPC style messages.

Architecture

radius (CLI) ─── Unix Socket ───> radiusd (Daemon)
                ~/.radius/daemon.sock

Message Format

Request

typescript
interface IpcRequest {
  command: string;
  args: Record<string, unknown>;
  tag?: string | null;  // Session tracking tag
  cwd?: string;         // Working directory
}

Response

typescript
interface IpcResponse {
  ok: boolean;
  data?: string;
  error?: string;
  tag?: string;         // New session tag
  warnings?: string[];  // Rewind warnings
}

Wire Protocol

Messages are framed with a length prefix:

[4 bytes: length (big-endian)] [JSON payload]

Commands Overview

CommandDescription
pingHealth check
shutdownStop daemon
viewDisplay file contents
read-varFind variable references
modify-varRename variable
str-replaceText replacement
insertInsert text at line
createCreate new file
rename-fileRename with import updates
solve-conflictResolve Git conflicts
undoUndo last change
redoRedo undone change
ext-installInstall extension
ext-listList extensions
ext-removeRemove extension
lsp-listList LSP servers

Session Tracking (Dog Tags)

Radius uses "dog tags" to detect conversation rewinds in LLM interactions.

How It Works

  1. Each command response includes a tag (e.g., e486-QUrUo-Od)
  2. Pass the tag back with --tag on subsequent commands
  3. If an old tag is received, Radius automatically undoes intervening operations

Tag Format

<project-hash-4char>-<random-8char>
Example: e486-QUrUo-Od

Rewind Detection

bash
# First change
radius str-replace file.ts --old "A" --new "B"
# Output: [tag: e486-abc12345]

# Second change
radius str-replace file.ts --old "B" --new "C" --tag e486-abc12345
# Output: [tag: e486-def67890]

# Rewind: use old tag
radius view file.ts --tag e486-abc12345
# warning: conversation rewind detected. Undoing 1 operation(s).
#   undone: str-replace (file.ts) [seq:2]
# Output: [tag: e486-abc12345]

Session Storage

  • Session path: ~/.radius/<project-hash>/session.json
  • Tags map to sequence numbers
  • Sequence numbers map to changeset IDs for undo

Daemon Lifecycle

  • Auto-start: Daemon starts on first command
  • Idle timeout: 900 seconds (15 minutes) default
  • Socket path: ~/.radius/daemon.sock
  • History path: ~/.radius/<project-hash>/history/
  • Session path: ~/.radius/<project-hash>/session.json
  • Extensions path: ~/.radius/extensions/

See Commands Reference for detailed documentation.

Released under the MIT License.