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:
- Task Management
- Spec-Driven Development
- Memory & Context
- Bounded Autonomy
- Coordination
- 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
Spec-driven development
Memory & context
Bounded autonomy
Coordination
Observability
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 5Best 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:3456curl http://localhost:3456/api/tasks/ready?limit=5
curl -X POST http://localhost:3456/api/tasks/tx-abc123/doneBest 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 fromcurl, a script, or a custom UI, sendx-tx-actor: human. - The dashboard already sends
x-tx-actor: humanfor task update and completion requests. - CLI task updates and completion default to
agent. Use--humanon commands such astx doneandtx updatewhen a person is performing the action. - This is most visible with gate-linked tasks. If a gate pin stores
taskIdand.tx/config.tomlleaves[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.
Recommended Learning Order
0. Agent Setup And Workflow Surfaces
| Surface | Purpose | Interfaces | Status |
|---|---|---|---|
| Getting Started | Initialize .tx/, install generated agent bundles, and verify the first local loop | CLI | Available |
tx skills | Generate and sync target-specific Claude Code and Codex skill bundles | CLI | Available |
| Ralph Loop | Run manual tx-based Ralph loops against the global queue or one design-doc slice | Shell + CLI | Available |
| Watchdog Runbook | Add detached supervision on top of the manual Ralph loop when needed later | Shell + service templates | Available |
1. Task Management
| Primitive | Purpose | Interfaces | Status |
|---|---|---|---|
tx init | Initialize .tx/ and optional agent scaffolds | CLI | Available |
tx add | Create work items to pull from the queue | CLI, SDK, MCP, API | Available |
tx ready | Get next workable task (unblocked, highest priority) | CLI, SDK, MCP, API | Available |
tx show | Inspect one task before an agent or human works it | CLI, SDK, MCP, API | Available |
tx done | Complete task, potentially unblocking others | CLI, SDK, MCP, API | Available |
tx dep block | Declare dependencies between tasks | CLI, SDK, MCP, API | Available |
tx sync | Persist to git-friendly stream event logs | CLI, SDK, MCP, API | Available |
Start here if you are evaluating tx. This is the smallest loop that proves queueing, dependencies, and persistence.
2. Spec-Driven Development
| Primitive | Purpose | Interfaces | Status |
|---|---|---|---|
tx doc * | Docs-as-primitives with structured documentation and EARS linting (tx spec lint) | CLI, SDK, MCP, API | Available |
tx decompose | Turn a design doc into an explicit first-pass task graph | CLI, SDK, MCP, API | Available |
tx spec * | Spec-to-test traceability, multi-language discovery, and FCI phase scoring | CLI, Core, MCP, API | Available |
tx decision | Capture implementation decisions and review state as first-class artifacts | CLI, SDK, MCP, API | Available |
Add this once the task loop feels natural and you want intent, decomposition, tests, and closure to stay aligned.
3. Memory & Context
| Primitive | Purpose | Interfaces | Status |
|---|---|---|---|
tx pin | Pin key-value metadata to CLAUDE.md / AGENTS.md files | CLI, SDK, MCP, API | Available |
tx memory | Search markdown knowledge across registered directories | CLI, SDK, MCP, API | Available |
Bring this in once you want durable context, reusable learnings, and automatic prompt enrichment.
4. Bounded Autonomy
| Primitive | Purpose | Interfaces | Status |
|---|---|---|---|
tx auto label | Organize tasks with labels for ready queue scoping | CLI, SDK, MCP, API | Available |
tx auto guard | Set task creation limits to prevent unbounded proliferation | CLI, SDK, MCP, API | Available |
tx auto verify | Attach machine-checkable done criteria to tasks | CLI, SDK, MCP, API | Available |
tx auto reflect | Session retrospective with structured signals | CLI, SDK, MCP, API | Available |
tx auto gate | Human approval checkpoints for phase transitions | CLI, 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
| Primitive | Purpose | Interfaces | Status |
|---|---|---|---|
tx group-context:* | Attach shared task-group context inherited by related tasks | CLI, SDK, MCP, API | Available |
tx claim | Claim task with lease to prevent parallel collisions | CLI, SDK, MCP, API | Available |
tx msg inbox | Send, read, and acknowledge agent messages on channels | CLI, SDK, MCP, API | Available |
Reach for coordination once more than one worker, operator, or long-lived channel is involved.
6. Observability
| Primitive | Purpose | Interfaces | Status |
|---|---|---|---|
tx trace * | Execution tracing and run observability | CLI, SDK, MCP, API | Available |
tx spec health | Repo rollup for docs, tests, decisions, and drift | CLI | Available |
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-abc123Example 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"
doneParallel: 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
waitHuman-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:
| Option | Description |
|---|---|
--json | Output as JSON for scripting |
--db <path> | Custom database path (default: .tx/tasks.db) |
--help | Show command help |
Task Lifecycle
backlog → ready → planning → active → blocked → review → needs_review → doneA task is ready when:
- Its status is workable (
backlog,ready,planning,active,blocked, orreview) - All tasks blocking it have status
done