tx

PRD-001: Core Task Management System

Persistent, queryable, dependency-aware task store for AI agents that works across sessions

Status: Draft Priority: P0 (Must Have) Owner: TBD Last Updated: 2025-01-28


Problem Statement

AI coding agents struggle with long-horizon tasks because they lose context across sessions. Current approaches have significant limitations:

  1. Markdown-based plans lack structure, can't be queried, and become stale
  2. Git issue trackers (GitHub Issues, Linear) are designed for humans, not agents - they're slow to query and lack programmatic access patterns
  3. Beads (the closest solution) ties tasks to git worktrees, which is heavyweight for subtasks and milestones
  4. Claude Code's built-in TodoWrite is session-scoped and doesn't persist across conversations

Agents need a persistent, queryable, dependency-aware task store that works across sessions and can be programmatically manipulated.


Target Users

User TypePrimary ActionsFrequency
AI Agents (primary)Create tasks, query ready tasks, update status, mark completeHigh (every session)
Human EngineersReview tasks, reprioritize, approve, add contextMedium (daily)
CI/CD SystemsQuery task status, trigger workflowsLow (on events)

Goals

  1. Persistence: Tasks survive across agent sessions and machine restarts
  2. Speed: Sub-100ms queries for common operations (list, ready, get)
  3. Programmatic: JSON output, typed API, MCP integration
  4. Minimal: Single dependency (SQLite), no external services required
  5. Composable: Works with any agent framework (Claude Code, Agent SDK, custom)

Non-Goals

  • Real-time collaboration (sync is explicit, not live)
  • Web UI (CLI and API only for v1)
  • Multi-project management (one DB per project)
  • Integration with external issue trackers (no GitHub/Linear sync)

Success Metrics

MetricTargetMeasurement
Task creation latency<50msP95 via CLI
Ready query latency<100msP95 with 1000 tasks
Agent task completion rate+20%A/B vs markdown plans
Context retention100%Tasks persist across sessions

User Stories

US-001: Query Ready Tasks

As an AI agent,
I want to query tasks that are ready to work on,
So that I can pick the highest-priority unblocked task.

Acceptance Criteria:

  • tx ready returns tasks sorted by score
  • Only tasks with no open blockers are returned
  • Response includes blockedBy, blocks, isReady fields

US-002: Create Subtasks

As an AI agent,
I want to create subtasks as I decompose work,
So that I can track granular progress without losing the big picture.

Acceptance Criteria:

  • tx add "Task" --parent=tx-xxx creates a child task
  • Parent-child relationship is queryable
  • Unlimited nesting depth supported

US-003: View Active Tasks

As a human engineer,
I want to see all active tasks sorted by priority,
So that I can adjust scores and ensure agents work on the right things.

Acceptance Criteria:

  • tx list --status=active shows active tasks
  • Tasks are sorted by score by default
  • Score can be updated via tx score <id> <value>

US-004: Pause for Human Review

As a human engineer,
I want to mark tasks as "human_needs_to_review",
So that agents pause and wait for my input on sensitive changes.

Acceptance Criteria:

  • tx update <id> --status=human_needs_to_review pauses task
  • Task does not appear in tx ready output
  • Agent can query for tasks needing review

Requirements

Must Have (P0)

IDRequirementValidation
R-001Create, read, update, delete tasksIntegration tests
R-002Flexible parent-child hierarchy (N-level nesting)Unit tests
R-003Status lifecycle: backlog → ready → planning → active → blocked → review → human_needs_to_review → doneSchema validation
R-004Blocking/blocked-by relationships between tasksIntegration tests
R-005Ready detection: find tasks with no open blockersIntegration tests
R-006CLI interface with JSON outputE2E tests
R-007SQLite persistenceIntegration tests

Should Have (P1)

IDRequirementValidation
R-008Priority scoring (numeric, LLM-updateable)Unit tests
R-009MCP server for Claude Code integrationMCP tests
R-010Task metadata (arbitrary key-value pairs)Unit tests
R-011Export to JSON/JSONLIntegration tests

Nice to Have (P2)

IDRequirementValidation
R-012LLM-based deduplicationManual testing
R-013LLM-based compaction/summarization with CLAUDE.md outputManual testing
R-014Agent SDK integrationIntegration tests
R-015Git-backed export for version controlManual testing
R-016OpenTelemetry observability (traces, metrics, logs)Integration tests
R-017Structured JSON logging for all operationsUnit tests
R-018DB corruption detection and recoveryIntegration tests

Technical Constraints

  • Storage: SQLite only (no external DB), WAL mode enabled
  • Runtime: Node.js 18+ or Bun
  • Framework: Effect-TS for all business logic
  • CLI: @effect/cli for command parsing
  • Observability: OpenTelemetry (optional, zero-cost when disabled)
  • ANTHROPIC_API_KEY: Optional — core CRUD, ready detection, CLI all work without it. Only LLM features (dedupe, compact, reprioritize) require it. If set as env var, use it automatically.
  • Logging: Structured JSON logging via OTEL or console fallback

Build System

ToolConfig FilePurpose
TypeScripttsconfig.jsonType checking, ES2022 target
tsuptsup.config.tsBundling CLI + library
Vitestvitest.config.tsTesting
ESLinteslint.config.jsLinting

package.json Structure

{
  "name": "tx",
  "version": "0.1.0",
  "type": "module",
  "bin": { "tx": "./dist/cli.js" },
  "exports": {
    ".": "./dist/index.js",
    "./mcp": "./dist/mcp/server.js"
  },
  "scripts": {
    "build": "tsup",
    "test": "vitest run",
    "test:unit": "vitest run test/unit",
    "test:integration": "vitest run test/integration",
    "test:coverage": "vitest run --coverage",
    "lint": "eslint src/ test/"
  },
  "peerDependencies": {
    "@opentelemetry/api": "^1.7",
    "@opentelemetry/sdk-node": "^0.48"
  },
  "peerDependenciesMeta": {
    "@opentelemetry/api": { "optional": true },
    "@opentelemetry/sdk-node": { "optional": true }
  }
}

Dependencies

DependencyVersionPurposeRequired
effect^3.0Core frameworkYes
@effect/cli^0.40CLI parsingYes
@effect/sql^0.20Database accessYes
better-sqlite3^11.0SQLite driverYes
@anthropic-ai/sdk^0.30LLM featuresOptional
@opentelemetry/api^1.7ObservabilityOptional
@opentelemetry/sdk-node^0.48OTEL SDKOptional
zod^3.22MCP input validationYes
@modelcontextprotocol/sdk^1.0MCP serverYes

Error Recovery

ScenarioRecovery Strategy
DB file corruptedDetect via PRAGMA integrity_check; log error; suggest re-init
DB file lockedRetry with exponential backoff (3 attempts)
Migration failureRoll back transaction; report version mismatch
LLM API unavailableGraceful degradation — skip LLM features, log warning
OTEL exporter downNoop — telemetry failures never block operations

On this page