tx

Primitives

Composable building blocks for agent infrastructure

Overview

tx provides a set of composable primitives for managing tasks, dependencies, memory, and stream-log synchronization. These primitives are the building blocks for any agent orchestration pattern.

If you are new to tx, do not try to learn everything at once. Use this order:

  1. Task Management
  2. Spec-Driven Development
  3. Memory & Context
  4. Bounded Autonomy
  5. Coordination
  6. Observability

Philosophy

tx is about primitives, not frameworks. We don't dictate how you orchestrate your agents. Instead, we provide headless infrastructure that you compose however you need.

Headless Layers

Your Layer

Your orchestration

Your code, your rules, your handoffs.

Task management

tx readytx donetx dep blocktx sync

Spec-driven development

tx doctx spectx decision

Memory & context

tx pintx memory

Bounded autonomy

tx auto labeltx auto guardtx auto verifytx auto reflecttx auto gate

Coordination

tx claimtx msg inboxtx group-context

Observability

tx tracetx spec healthtx diag stats
tx stays below your orchestration layer. You keep the loop design; tx provides reusable primitives underneath it, and you can adopt them in stages.

Access Patterns

Every tx primitive is available through multiple interfaces. Choose the one that fits your workflow:

Install the standalone binary and use from any terminal or shell script:

curl -fsSL https://raw.githubusercontent.com/jamesaphoenix/tx/main/install.sh | sh
tx ready --limit 5

Best for: shell scripts, agent loops, CI/CD pipelines.

Use the SDK for programmatic access with full type safety:

import { TxClient } from '@jamesaphoenix/tx-agent-sdk'

const tx = new TxClient({ apiUrl: 'http://localhost:3456' })
// or: new TxClient({ dbPath: '.tx/tasks.db' })

const ready = await tx.tasks.ready({ limit: 5 })
const { task, nowReady } = await tx.tasks.done(ready[0].id)
await tx.memory.add({ title: 'Use retry logic for flaky calls', tags: ['learning'] })

Best for: TypeScript/JavaScript agents, custom orchestrators, programmatic workflows.

Use tx as an MCP server for Claude, Cursor, or any MCP-compatible client:

{
  "mcpServers": {
    "tx": {
      "command": "npx",
      "args": ["@jamesaphoenix/tx-mcp-server"]
    }
  }
}

Tools: tx_ready, tx_done, tx_dep_block, tx_add, tx_memory_search, tx_memory_context, etc.

Best for: AI assistants, Claude Code, Cursor, IDE integrations.

Run the API server for HTTP access from any language:

npx @jamesaphoenix/tx-api-server
# Server running on http://localhost:3456
curl http://localhost:3456/api/tasks/ready?limit=5
curl -X POST http://localhost:3456/api/tasks/tx-abc123/done

Best for: non-TypeScript agents, distributed systems, web dashboards.

Update And Completion Actor Semantics

Task update and completion flows can behave differently for agents and humans.

  • REST API task update and completion requests default to agent. If a human is driving the request from curl, a script, or a custom UI, send x-tx-actor: human.
  • The dashboard already sends x-tx-actor: human for task update and completion requests.
  • CLI task updates and completion default to agent. Use --human on commands such as tx done and tx update when a person is performing the action.
  • This is most visible with gate-linked tasks. If a gate pin stores taskId and .tx/config.toml leaves [pins].block_agent_done_when_task_id_present = true (default), agent callers cannot complete that linked task.

See tx done and tx gate for the concrete completion rules.

0. Agent Setup And Workflow Surfaces

SurfacePurposeInterfacesStatus
Getting StartedInitialize .tx/, install generated agent bundles, and verify the first local loopCLIAvailable
tx skillsGenerate and sync target-specific Claude Code and Codex skill bundlesCLIAvailable
Ralph LoopRun manual tx-based Ralph loops against the global queue or one design-doc sliceShell + CLIAvailable
Watchdog RunbookAdd detached supervision on top of the manual Ralph loop when needed laterShell + service templatesAvailable

1. Task Management

PrimitivePurposeInterfacesStatus
tx initInitialize .tx/ and optional agent scaffoldsCLIAvailable
tx addCreate work items to pull from the queueCLI, SDK, MCP, APIAvailable
tx readyGet next workable task (unblocked, highest priority)CLI, SDK, MCP, APIAvailable
tx showInspect one task before an agent or human works itCLI, SDK, MCP, APIAvailable
tx doneComplete task, potentially unblocking othersCLI, SDK, MCP, APIAvailable
tx dep blockDeclare dependencies between tasksCLI, SDK, MCP, APIAvailable
tx syncPersist to git-friendly stream event logsCLI, SDK, MCP, APIAvailable

Start here if you are evaluating tx. This is the smallest loop that proves queueing, dependencies, and persistence.

2. Spec-Driven Development

PrimitivePurposeInterfacesStatus
tx doc *Docs-as-primitives with structured documentation and EARS linting (tx spec lint)CLI, SDK, MCP, APIAvailable
tx decomposeTurn a design doc into an explicit first-pass task graphCLI, SDK, MCP, APIAvailable
tx spec *Spec-to-test traceability, multi-language discovery, and FCI phase scoringCLI, Core, MCP, APIAvailable
tx decisionCapture implementation decisions and review state as first-class artifactsCLI, SDK, MCP, APIAvailable

Add this once the task loop feels natural and you want intent, decomposition, tests, and closure to stay aligned.

3. Memory & Context

PrimitivePurposeInterfacesStatus
tx pinPin key-value metadata to CLAUDE.md / AGENTS.md filesCLI, SDK, MCP, APIAvailable
tx memorySearch markdown knowledge across registered directoriesCLI, SDK, MCP, APIAvailable

Bring this in once you want durable context, reusable learnings, and automatic prompt enrichment.

4. Bounded Autonomy

PrimitivePurposeInterfacesStatus
tx auto labelOrganize tasks with labels for ready queue scopingCLI, SDK, MCP, APIAvailable
tx auto guardSet task creation limits to prevent unbounded proliferationCLI, SDK, MCP, APIAvailable
tx auto verifyAttach machine-checkable done criteria to tasksCLI, SDK, MCP, APIAvailable
tx auto reflectSession retrospective with structured signalsCLI, SDK, MCP, APIAvailable
tx auto gateHuman approval checkpoints for phase transitionsCLI, SDK (via tx.pins), API (via /api/pins)Available

Use these when agents start doing enough work that you need boundaries, checks, and human checkpoints.

5. Coordination

PrimitivePurposeInterfacesStatus
tx group-context:*Attach shared task-group context inherited by related tasksCLI, SDK, MCP, APIAvailable
tx claimClaim task with lease to prevent parallel collisionsCLI, SDK, MCP, APIAvailable
tx msg inboxSend, read, and acknowledge agent messages on channelsCLI, SDK, MCP, APIAvailable

Reach for coordination once more than one worker, operator, or long-lived channel is involved.

6. Observability

PrimitivePurposeInterfacesStatus
tx trace *Execution tracing and run observabilityCLI, SDK, MCP, APIAvailable
tx spec healthRepo rollup for docs, tests, decisions, and driftCLIAvailable

Use observability after the earlier layers are in place and you need to understand what is drifting, failing, or stuck.

Quick CLI Examples

tx pin set coding-standards --file ./standards.md
tx memory search "database schema" --semantic
tx memory add "Use WAL mode for SQLite" -t learning
tx memory context tx-abc123
tx auto verify set tx-abc123 "bun test"
tx auto verify run tx-abc123

Example Orchestration Patterns

We ship example patterns, not a required workflow:

Simple: One Agent, One Task

while task=$(tx ready --limit 1 --json | jq -r '.[0].id'); do
  claude "Work on task $task, then run: tx done $task"
done

Parallel: N Agents Pulling from Queue

for i in {1..5}; do
  (while task=$(tx ready --limit 1 --json | jq -r '.[0].id'); do
    claude "Complete $task" && tx done $task
  done) &
done
wait

Human-in-Loop: Agent Proposes, Human Approves

task=$(tx ready --limit 1 --json | jq -r '.[0].id')
claude "Read the project instructions (for example AGENTS.md if present). For task $task: run tx show $task, make sure a paired PRD/design doc is linked, then decompose the work into tx subtasks and dependency edges."
echo "Review tx show $task, tx dep tree $task, and the linked PRD/DD docs, then press Enter to continue..."
read
claude "Read the project instructions (for example AGENTS.md if present). For task $task: execute the approved ready work from the linked PRD/DD docs and keep tx updated."

Global Options

All primitives support these global options:

OptionDescription
--jsonOutput as JSON for scripting
--db <path>Custom database path (default: .tx/tasks.db)
--helpShow command help

Task Lifecycle

backlog → ready → planning → active → blocked → review → needs_review → done

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

On this page