tx

tx ready

List tasks that are ready to work on

Purpose

tx ready returns tasks that are ready to be worked on. A task is ready when:

  1. Its status is workable (backlog, ready, planning, active, blocked, or review)
  2. All tasks blocking it have status done

Tasks are sorted by score (highest first), making it easy for agents to pick the highest-priority unblocked task.

Usage

tx ready [options]
# Top 10 ready tasks
tx ready

# Top 5 ready tasks
tx ready -n 5

# JSON output for scripting
tx ready --json

# Get the ID of the highest-priority ready task
tx ready --json --limit 1 | jq -r '.[0].id'
import { TxClient } from '@jamesaphoenix/tx-agent-sdk'

// HTTP mode
const tx = new TxClient({ apiUrl: 'http://localhost:3456' })

// Or direct SQLite mode
const tx = new TxClient({ dbPath: '.tx/tasks.db' })

// Get ready tasks
const ready = await tx.tasks.ready({ limit: 5 })
// Returns SerializedTaskWithDeps[] with:
//   id, title, status, score, blockedBy, blocks, children, isReady,
//   groupContext, effectiveGroupContext, effectiveGroupContextSourceTaskId

Tool name: tx_ready

Arguments:

ArgTypeRequiredDescription
limitnumberNoMaximum tasks to return (default: 10)

Example request:

{
  "name": "tx_ready",
  "arguments": {
    "limit": 5
  }
}
GET /api/tasks/ready?limit=5

Query parameters:

ParamTypeRequiredDescription
limitnumberNoMaximum tasks to return (default: 10)

Example:

curl http://localhost:3456/api/tasks/ready?limit=5

Options

OptionDescription
--limit, -n <n>Maximum tasks to show (default: 10)
--claim <worker-id>Atomically claim the first ready task for the given worker
--lease <minutes>Lease duration when using --claim (default: 30)
--jsonOutput as JSON for scripting
--helpShow help

Output

Text Output

Ready tasks (sorted by score):

 1. tx-abc123  [800]  Implement authentication
 2. tx-def456  [600]  Add login page
 3. tx-ghi789  [500]  Write unit tests

JSON Output

[
  {
    "id": "tx-abc123",
    "title": "Implement authentication",
    "status": "ready",
    "score": 800,
    "blockedBy": [],
    "blocks": ["tx-def456"],
    "children": [],
    "isReady": true,
    "groupContext": null,
    "effectiveGroupContext": "Shared auth rollout context",
    "effectiveGroupContextSourceTaskId": "tx-root001"
  }
]

TaskWithDeps Response

Every response includes full dependency information per Rule 1:

FieldTypeDescription
blockedByTaskId[]Task IDs that block this task
blocksTaskId[]Task IDs this task blocks
childrenTaskId[]Direct child task IDs
isReadybooleanWhether this task can be worked on
groupContextstring | nullDirect task-group context set on this task
effectiveGroupContextstring | nullInherited task-group context used for this task
effectiveGroupContextSourceTaskIdTaskId | nullTask ID that provided effectiveGroupContext

Task-Group Context Inheritance

tx ready includes inherited task-group context fields so agents can pick up shared context automatically.

Set or clear direct context through the interface you are already using:

tx group-context set tx-root001 "Shared auth rollout context"
tx group-context clear tx-root001
await tx.tasks.setGroupContext("tx-root001", "Shared auth rollout context")
await tx.tasks.clearGroupContext("tx-root001")
{ "name": "tx_group_context_set", "arguments": { "taskId": "tx-root001", "context": "Shared auth rollout context" } }
{ "name": "tx_group_context_clear", "arguments": { "taskId": "tx-root001" } }
curl -X PUT http://localhost:3456/api/tasks/tx-root001/group-context \
  -H "Content-Type: application/json" \
  -d '{"context":"Shared auth rollout context"}'

curl -X DELETE http://localhost:3456/api/tasks/tx-root001/group-context

Atomic Ready + Claim

When running multiple workers in parallel, use --claim to atomically fetch the highest-priority ready task and claim it in a single operation. This eliminates the race window between tx ready and tx claim where multiple workers could pick the same task.

# Atomically get and claim the top ready task
tx ready --json --limit 1 --claim worker-1 --lease 30

# Returns the claimed task with claim info, or empty if nothing available

The --claim flag:

  1. Fetches a small batch of ready candidates (sorted by score)
  2. Attempts to claim each one in priority order
  3. Returns the first successfully claimed task
  4. Returns null if no tasks could be claimed (all taken by other workers)

This is the recommended approach for parallel agent loops. See tx claim for more on the claim lifecycle.

Agent Loop Pattern

#!/bin/bash
# Simple agent loop using tx ready

while true; do
  # Get highest priority ready task
  TASK=$(tx ready --json --limit 1 | jq -r '.[0].id // empty')

  # Exit if no ready tasks
  [ -z "$TASK" ] && break

  # Work on the task
  claude "Your task is $TASK. Run 'tx show $TASK' to see details."

  # Mark complete
  tx done "$TASK"
done

echo "All tasks complete!"
#!/bin/bash
# Parallel agent loop using atomic ready+claim
WORKER_ID="worker-$$"

while true; do
  RESULT=$(tx ready --json --limit 1 --claim "$WORKER_ID" --lease 30)
  TASK=$(echo "$RESULT" | jq -r '.task.id // empty')
  [ -z "$TASK" ] && break

  claude "Your task is $TASK. Run 'tx show $TASK' for details."
  tx done "$TASK"
done

On this page