radial 0.1.0

Task orchestration for LLM agents with contract-based coordination
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
use clap::{Parser, Subcommand};
use clap_complete::Shell;

use crate::models::Priority;

#[derive(Parser)]
#[command(name = "radial")]
#[command(about = "Task orchestration for LLM agents", long_about = None)]
pub struct Cli {
    #[command(subcommand)]
    pub command: Commands,
}

#[derive(Subcommand)]
pub enum Commands {
    /// Initialize radial in the current project
    Init {
        /// Initialize without committing to the repo (adds .radial to .gitignore or .git/info/exclude)
        #[arg(long)]
        stealth: bool,

        /// Output as JSON
        #[arg(long)]
        json: bool,
    },

    /// Manage goals
    #[command(subcommand)]
    Goal(GoalCommands),

    /// List all goals and their tasks in dependency order
    #[command(alias = "ls")]
    List {
        /// Output as JSON
        #[arg(long)]
        json: bool,

        /// Show full descriptions without truncating
        #[arg(long)]
        full: bool,

        /// Show archived goals instead of active goals
        #[arg(long)]
        archived: bool,
    },

    /// Manage tasks
    #[command(subcommand)]
    Task(TaskCommands),

    /// Edit a goal or task
    #[command(subcommand)]
    Edit(EditCommands),

    /// Show full details of a goal or task
    Show {
        /// The goal or task ID to show
        id: String,

        /// Output as JSON
        #[arg(long)]
        json: bool,
    },

    /// Remove completed goals and their tasks
    Clean {
        /// Remove all completed goals without prompting
        #[arg(long)]
        all: bool,

        /// Remove all goals regardless of status
        #[arg(long)]
        force: bool,

        /// Permanently delete instead of archiving
        #[arg(long)]
        purge: bool,

        /// Output as JSON. Implies non-interactive removal, as if --all were set
        #[arg(long)]
        json: bool,
    },

    /// Restore an archived goal
    Restore {
        /// Goal ID to restore from archive
        goal_id: String,

        /// Output as JSON
        #[arg(long)]
        json: bool,
    },

    /// Show status of goals and tasks
    Status {
        /// Show status of a specific goal
        #[arg(long)]
        goal: Option<String>,

        /// Show status of a specific task
        #[arg(long)]
        task: Option<String>,

        /// Filter tasks by assignee
        #[arg(long)]
        assignee: Option<String>,

        /// Output as JSON
        #[arg(long)]
        json: bool,
    },

    /// Show tasks ready to be worked on
    Ready {
        /// The goal ID to check for ready tasks. If omitted, uses the single
        /// active goal, if there is exactly one
        goal_id: Option<String>,

        /// Filter by priority level (p0, p1, p2, p3)
        #[arg(long)]
        priority: Option<Priority>,

        /// Output as JSON
        #[arg(long)]
        json: bool,
    },

    /// Output a preparation guide for LLM agents
    Prep {
        /// Output as JSON
        #[arg(long)]
        json: bool,
    },

    /// Compact completed/failed tasks into summaries
    #[command(subcommand)]
    Compact(CompactCommands),

    /// Generate a shell completion script
    ///
    /// Print the script to stdout and source it, e.g. for zsh:
    /// `radial completions zsh > "${fpath[1]}/_radial"`
    Completions {
        /// The shell to generate completions for
        shell: Shell,
    },
}

#[derive(Subcommand)]
pub enum GoalCommands {
    /// Create a new goal
    Create {
        /// The goal description
        description: String,

        /// Output as JSON
        #[arg(long)]
        json: bool,
    },

    /// List all goals
    List {
        /// Output as JSON
        #[arg(long)]
        json: bool,
    },

    /// Cancel a goal and all its non-terminal tasks
    Cancel {
        /// The goal ID to cancel
        goal_id: String,

        /// Reason for cancellation
        #[arg(long)]
        reason: Option<String>,

        /// Output as JSON
        #[arg(long)]
        json: bool,
    },
}

#[derive(Subcommand)]
pub enum TaskCommands {
    /// Create a new task
    Create {
        /// The goal ID this task belongs to
        goal_id: String,

        /// Task description
        description: String,

        /// Priority level (p0, p1, p2, p3). Defaults to p2
        #[arg(long)]
        priority: Option<Priority>,

        /// Parent task ID (creates this task as a subtask)
        #[arg(long)]
        parent: Option<String>,

        /// What this task receives (contract)
        #[arg(long)]
        receives: Option<String>,

        /// What this task produces (contract)
        #[arg(long)]
        produces: Option<String>,

        /// How to verify success (contract)
        #[arg(long)]
        verify: Option<String>,

        /// IDs of tasks this task is blocked by (comma or space separated)
        #[arg(long, value_delimiter = ',', num_args = 1..)]
        blocked_by: Option<Vec<String>>,

        /// Output as JSON
        #[arg(long)]
        json: bool,
    },

    /// List tasks for a goal
    List {
        /// The goal ID to list tasks for. If omitted, uses the single active
        /// goal, if there is exactly one
        goal_id: Option<String>,

        /// Filter by priority level (p0, p1, p2, p3)
        #[arg(long)]
        priority: Option<Priority>,

        /// Output as JSON
        #[arg(long)]
        json: bool,

        /// Show comments on tasks
        #[arg(short, long)]
        verbose: bool,

        /// Filter tasks by assignee
        #[arg(long)]
        assignee: Option<String>,

        /// Show full descriptions without truncating
        #[arg(long)]
        full: bool,
    },

    /// Mark a task as started
    Start {
        /// The task ID to start
        task_id: String,

        /// Who is claiming this task
        #[arg(long)]
        assignee: String,

        /// Override blocked state and start anyway
        #[arg(long)]
        force: bool,

        /// Output as JSON
        #[arg(long)]
        json: bool,
    },

    /// Mark a task as completed
    Complete {
        /// The task ID to complete
        task_id: String,

        /// Summary of what was accomplished
        #[arg(long)]
        result: String,

        /// Artifact paths created (comma-separated)
        #[arg(long, value_delimiter = ',')]
        artifacts: Option<Vec<String>>,

        /// Total tokens used for this task
        #[arg(long)]
        tokens: Option<i64>,

        /// Elapsed time in milliseconds. Derived from the task's start time if omitted
        #[arg(long)]
        elapsed: Option<i64>,

        /// Output as JSON
        #[arg(long)]
        json: bool,
    },

    /// Mark a task as failed
    Fail {
        /// The task ID to fail
        task_id: String,

        /// Reason for failure
        #[arg(long)]
        reason: Option<String>,

        /// Compact the task immediately using the reason as its summary
        #[arg(long, requires = "reason")]
        compact: bool,

        /// Output as JSON
        #[arg(long)]
        json: bool,
    },

    /// Cancel a task that is no longer needed
    Cancel {
        /// The task ID to cancel
        task_id: String,

        /// Reason for cancellation
        #[arg(long)]
        reason: Option<String>,

        /// Cascade cancellation to all downstream dependent tasks
        #[arg(long)]
        cascade: bool,

        /// Output as JSON
        #[arg(long)]
        json: bool,
    },

    /// Retry a failed task
    Retry {
        /// The task ID to retry
        task_id: String,

        /// Output as JSON
        #[arg(long)]
        json: bool,
    },

    /// Release a claimed task back to pending
    Release {
        /// The task ID to release (mutually exclusive with --stale and --all-in-progress)
        task_id: Option<String>,

        /// Release tasks in progress longer than this duration (e.g. 1h, 30m, 2h30m)
        #[arg(long, conflicts_with = "task_id")]
        stale: Option<String>,

        /// Release all in-progress tasks regardless of duration
        #[arg(long, conflicts_with_all = ["task_id", "stale"])]
        all_in_progress: bool,

        /// Output as JSON
        #[arg(long)]
        json: bool,
    },

    /// Delete a pending task
    Delete {
        /// The task ID to delete
        task_id: String,

        /// Output as JSON
        #[arg(long)]
        json: bool,
    },

    /// Add a comment to a task
    Comment {
        /// The task ID to comment on
        task_id: String,

        /// The comment text
        text: String,

        /// Output as JSON
        #[arg(long)]
        json: bool,
    },

    /// View all comments on a task
    Comments {
        /// The task ID to view comments for
        task_id: String,

        /// Output as JSON
        #[arg(long)]
        json: bool,
    },
}

#[derive(Subcommand)]
pub enum EditCommands {
    /// Edit a goal's description
    Goal {
        /// The goal ID to edit
        goal_id: String,

        /// New description
        #[arg(long)]
        description: String,

        /// Output as JSON
        #[arg(long)]
        json: bool,
    },

    /// Edit a task's description or contract
    Task {
        /// The task ID to edit
        task_id: String,

        /// New description
        #[arg(long)]
        description: Option<String>,

        /// New priority level (p0, p1, p2, p3)
        #[arg(long)]
        priority: Option<Priority>,

        /// New receives (contract)
        #[arg(long)]
        receives: Option<String>,

        /// New produces (contract)
        #[arg(long)]
        produces: Option<String>,

        /// New verify (contract)
        #[arg(long)]
        verify: Option<String>,

        /// Add a blocked-by dependency (comma or space separated)
        #[arg(long, value_delimiter = ',', num_args = 1..)]
        blocked_by: Option<Vec<String>>,

        /// Output as JSON
        #[arg(long)]
        json: bool,
    },
}

#[derive(Subcommand)]
pub enum CompactCommands {
    /// List tasks eligible for compaction
    Analyze {
        /// Filter to a specific goal
        #[arg(long)]
        goal: Option<String>,

        /// Output as JSON
        #[arg(long)]
        json: bool,
    },

    /// Apply a summary to a completed/failed task, compacting it
    Apply {
        /// The task ID to compact
        task_id: String,

        /// The summary to replace the task's detailed content
        #[arg(long)]
        summary: String,

        /// Output as JSON
        #[arg(long)]
        json: bool,
    },
}