@jamesaphoenix/tx-types 0.11.0 → 0.12.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -1,425 +1,170 @@
1
1
  # tx
2
2
 
3
- **Primitives, not frameworks.** Headless infrastructure for AI agents.
3
+ **Primitives, not frameworks.** Headless, local infrastructure for AI agents.
4
4
 
5
- Memory, tasks, and orchestration. You own the loop.
5
+ tx gives you a small set of reusable primitives for task state, docs-first specs, memory, coordination, and observability. You keep the orchestration loop.
6
+
7
+ ## Install
6
8
 
7
9
  ```bash
8
- # Standalone binary (recommended — no runtime needed)
10
+ # Standalone binary (recommended)
9
11
  curl -fsSL https://raw.githubusercontent.com/jamesaphoenix/tx/main/install.sh | sh
10
12
 
11
13
  # Or via npm (requires bun)
12
14
  npm install -g @jamesaphoenix/tx-cli
13
15
  ```
14
16
 
15
- ```bash
16
- tx init
17
- ```
18
-
19
- Agent onboarding (optional, both supported):
20
-
21
- ```bash
22
- tx init --claude # CLAUDE.md + .claude/skills
23
- tx init --codex # AGENTS.md + .codex/agents
24
- tx init --claude --codex # scaffold both
25
- ```
26
-
27
- Watchdog onboarding (optional, default off):
28
-
29
- ```bash
30
- tx init --watchdog # scaffold watchdog assets with runtime auto-detect
31
- tx init --watchdog --watchdog-runtime codex
32
- tx init --watchdog --watchdog-runtime both
33
- ```
34
-
35
- ---
36
-
37
- ## The Problem
38
-
39
- Your agents lose context between sessions. Tasks collide when multiple agents work in parallel. Learnings vanish into conversation history. You're rebuilding the same infrastructure every project.
40
-
41
- ## The Solution
42
-
43
- Composable primitives that handle the hard parts. You keep control of the orchestration.
44
-
45
- ```
46
- ┌─────────────────────────────────────────────────────────┐
47
- │ Your Orchestration (your code, your rules) │
48
- ├─────────────────────────────────────────────────────────┤
49
- │ tx primitives │
50
- │ │
51
- │ tx ready tx done tx memory tx pin │
52
- │ tx claim tx block tx sync tx trace │
53
- │ │
54
- └─────────────────────────────────────────────────────────┘
55
- ```
17
+ ## Start Small
56
18
 
57
- ---
19
+ The recommended first path is:
58
20
 
59
- ## Primitives
21
+ 1. Task Management
22
+ 2. Spec-Driven Development
23
+ 3. Memory & Context
24
+ 4. Bounded Autonomy
25
+ 5. Coordination
26
+ 6. Observability
60
27
 
61
- ### Memory
28
+ Most users should start with just the first two.
62
29
 
63
- Filesystem-backed knowledge that persists, links, and surfaces when relevant.
30
+ ### Day 1: Task Management
64
31
 
65
32
  ```bash
66
- # Register a directory of markdown files
67
- tx memory source add ./docs
68
-
69
- # Index and search your knowledge
70
- tx memory index
71
- tx memory search "authentication patterns"
72
- tx memory search "auth" --semantic --expand # BM25 + vector + graph
73
-
74
- # Create, tag, and link documents
75
- tx memory add "JWT Guide" --tags auth,security
76
- tx memory tag mem-a7f3bc12 reviewed
77
- tx memory link mem-a7f3bc12 mem-b8e4cd56
78
-
79
- # Navigate the knowledge graph
80
- tx memory links mem-a7f3bc12 # Outgoing wikilinks + edges
81
- tx memory backlinks mem-a7f3bc12 # What links to this?
33
+ tx init --codex # or: --claude, or plain tx init
34
+ tx add "Write auth PRD" --json
35
+ tx add "Implement auth flow" --json
36
+ tx block <implement-task-id> <prd-task-id>
37
+ tx ready
38
+ tx show <prd-task-id>
39
+ tx done <prd-task-id>
40
+ tx ready
41
+ tx sync export
82
42
  ```
83
43
 
84
- Three search modes: BM25 keyword search, vector similarity (`--semantic`), and graph expansion (`--expand`) via wikilinks and `frontmatter.related`. Combined with RRF fusion for best results.
44
+ This proves the basic loop:
85
45
 
86
- ### Learnings
46
+ - the queue works
47
+ - dependencies affect readiness
48
+ - completion advances the queue
49
+ - state exports cleanly to `.tx/streams`
87
50
 
88
- Structured insights that attach to tasks and file paths.
51
+ ### Day 2: Spec-Driven Development
89
52
 
90
53
  ```bash
91
- # Store knowledge
92
- tx memory add "Use bcrypt for passwords" --tags security
93
-
94
- # Attach learnings to file paths
95
- tx memory learn "src/auth/*.ts" "Services must use Effect-TS patterns"
96
-
97
- # Retrieve via search or task context
98
- tx memory search "authentication"
99
- tx memory context tx-abc123 # Get relevant memory for a task
100
- tx memory recall "src/auth/hash.ts" # Recall learnings for a file
54
+ tx doc add prd auth-flow --title "Auth Flow"
55
+ # add or update tests with [INV-*], _INV_*, @spec, or .tx/spec-tests.yml
56
+ tx spec discover
57
+ tx spec status --doc auth-flow
58
+ vitest run --reporter=json | tx spec batch --from vitest
59
+ tx spec complete --doc auth-flow --by you
101
60
  ```
102
61
 
103
- Hybrid search (BM25 + vector with RRF fusion) finds relevant knowledge.
62
+ Use the spec primitives like this:
104
63
 
105
- ### Tasks
64
+ - `tx spec fci`: compact machine score for agents and automation
65
+ - `tx spec status`: human-readable blocker view for one scope
66
+ - `tx spec health`: repo rollup, not part of the minimum day-1 loop
106
67
 
107
- Dependency-aware task management. Agents only see work they can actually do.
68
+ ## The Six Layers
108
69
 
109
- ```bash
110
- # Create with dependencies
111
- tx add "Implement auth service" --score 800
112
- tx add "Design auth schema" --score 900
113
- tx block tx-impl tx-schema # impl waits for schema
114
-
115
- # Work on what's ready
116
- tx ready # Only unblocked tasks
117
- tx done tx-schema # Completes → unblocks dependents
118
- ```
70
+ ### 1. Task Management
119
71
 
120
- Full hierarchy support. Epics contain milestones contain tasks contain subtasks.
72
+ Core queue and persistence:
121
73
 
122
- ### Coordination
74
+ - `tx init`
75
+ - `tx add`
76
+ - `tx ready`
77
+ - `tx show`
78
+ - `tx done`
79
+ - `tx block`
80
+ - `tx sync`
123
81
 
124
- Lease-based claims prevent parallel agents from colliding.
82
+ ### 2. Spec-Driven Development
125
83
 
126
- ```bash
127
- tx claim tx-abc123 worker-1 # Claim with 30-min lease
128
- tx claim tx-abc123 worker-1 --lease 60 # Custom lease duration
129
- tx claim renew tx-abc123 worker-1 # Extend lease
130
- tx claim release tx-abc123 worker-1 # Release early
131
- ```
132
-
133
- ### Docs
84
+ Docs-first intent and closure:
134
85
 
135
- Structured documentation as primitives. YAML-based with versioning, locking, and linking.
86
+ - `tx doc`
87
+ - `tx spec`
88
+ - `tx decision`
136
89
 
137
- ```bash
138
- tx doc add prd auth-system --title "Auth System PRD"
139
- tx doc render # Generate markdown from YAML
140
- tx doc lock auth-system # Lock doc (immutable)
141
- tx doc link auth-prd auth-dd # Link PRD to DD
142
- tx doc drift # Detect stale docs
143
- ```
90
+ ### 3. Memory & Context
144
91
 
145
- ### Invariants
92
+ Durable knowledge and prompt context:
146
93
 
147
- Track and verify project invariants across sessions.
94
+ - `tx memory`
95
+ - `tx pin`
148
96
 
149
- ```bash
150
- tx invariant list # List all invariants
151
- tx invariant show INV-001 # Show details
152
- tx invariant record INV-001 --passed # Record check result
153
- tx invariant sync # Sync from CLAUDE.md
154
- ```
97
+ ### 4. Bounded Autonomy
155
98
 
156
- ### Cycle Scan
99
+ Controls for agents with more freedom:
157
100
 
158
- Sub-agent swarm scanning for codebase analysis.
101
+ - `tx label`
102
+ - `tx guard`
103
+ - `tx verify`
104
+ - `tx reflect`
105
+ - `tx gate`
159
106
 
160
- ```bash
161
- tx cycle --task-prompt "Review auth" --scan-prompt "Find bugs"
162
- ```
107
+ ### 5. Coordination
163
108
 
164
- ---
109
+ Multi-worker and multi-actor primitives:
165
110
 
166
- ## Your Loop, Your Rules
111
+ - `tx claim`
112
+ - `tx send` / `tx inbox`
113
+ - `tx group-context`
167
114
 
168
- We ship **example loops**, not **the loop**:
115
+ ### 6. Observability
169
116
 
170
- ```bash
171
- # Simple: one agent, one task
172
- AGENT_CMD=${AGENT_CMD:-codex} # or: claude
173
- while task=$(tx ready --limit 1 --json | jq -r '.[0].id'); do
174
- "$AGENT_CMD" "Work on task $task, then run: tx done $task"
175
- done
176
- ```
117
+ Operational visibility once the earlier layers are in place:
177
118
 
178
- ```bash
179
- # Parallel: N agents with claims
180
- AGENT_CMD=${AGENT_CMD:-codex} # or: claude
181
- for i in {1..5}; do
182
- (while task=$(tx ready --json --limit 1 | jq -r '.[0].id // empty'); do
183
- [ -z "$task" ] && break
184
- tx claim "$task" "worker-$i" || continue
185
- "$AGENT_CMD" "Complete $task" && tx done "$task"
186
- done) &
187
- done
188
- wait
189
- ```
119
+ - `tx trace`
120
+ - `tx spec health`
121
+ - `tx stats`
122
+ - dashboard
190
123
 
191
- ```bash
192
- # Human-in-loop: agent proposes, human approves
193
- AGENT_CMD=${AGENT_CMD:-codex} # or: claude
194
- task=$(tx ready --json --limit 1 | jq -r '.[0].id')
195
- "$AGENT_CMD" "Plan implementation for $task" > plan.md
196
- read -p "Approve? [y/n] " && "$AGENT_CMD" "Execute plan.md"
197
- tx done $task
198
- ```
199
-
200
- ```bash
201
- # File-based: agent reads markdown, no CLI polling needed
202
- AGENT_CMD=${AGENT_CMD:-claude} # or: codex
203
- while true; do
204
- tx md-export # materialize ready tasks to .tx/tasks.md
205
- "$AGENT_CMD" "Read .tx/tasks.md and complete the highest priority task. When done, run: tx done <id>"
206
- done
207
- ```
208
-
209
- **The flow is yours.** Serial, parallel, swarm, human-in-loop, file-based. Your call.
210
-
211
- ---
212
-
213
- ## Watchdog (Opt-In)
124
+ ## Interfaces
214
125
 
215
- Use watchdog when you want detached, self-healing RALPH loops that can survive terminal closes and reconcile stale runs/tasks automatically.
126
+ | Interface | Best For |
127
+ |-----------|----------|
128
+ | CLI | Shell scripts, human operators, local loops |
129
+ | MCP Server | Claude Code, Cursor, IDE integrations |
130
+ | TypeScript SDK | Custom Node/Bun agents |
131
+ | REST API | Language-agnostic HTTP clients |
132
+ | Dashboard | Visual monitoring and management |
216
133
 
217
- Use it for:
218
- - Long-running unattended execution
219
- - Automatic stalled-run reaping and orphan task reset
220
- - Background supervision through launchd/systemd
134
+ ## Optional Later
221
135
 
222
- Skip it for:
223
- - Short interactive sessions
224
- - One-off local runs you supervise manually
136
+ Watchdog is intentionally not part of the main getting-started path.
225
137
 
226
- Quick start:
138
+ Use it only if you need detached, long-running supervision:
227
139
 
228
140
  ```bash
229
141
  tx init --watchdog --watchdog-runtime auto
230
142
  ./scripts/watchdog-launcher.sh start
231
- ./scripts/watchdog-launcher.sh status
232
143
  ```
233
144
 
234
- Detailed rollout, detached service setup, rollback, and troubleshooting:
145
+ Runbook:
146
+
235
147
  - [Watchdog Runbook](https://txdocs.dev/docs/watchdog-runbook)
236
148
 
237
- ## Why tx?
149
+ ## Why tx
238
150
 
239
- | | Native Tasks | CLAUDE.md | tx |
151
+ | | Native Tasks | Static Agent Docs | tx |
240
152
  |---|---|---|---|
241
- | **Persistence** | Session-scoped | File grows forever | Git-native, branch-aware |
242
- | **Multi-agent** | Collisions | Manual coordination | Claim with lease expiry |
243
- | **Knowledge** | Lost each session | Static dump | Filesystem memory, hybrid search, graph links |
244
- | **Orchestration** | None | None | Primitives for any pattern |
245
-
246
- ---
247
-
248
- ## Design Principles
249
-
250
- - **No opinions on orchestration.** Serial, parallel, swarm, human-in-loop. Your call.
251
- - **Powerful defaults.** `tx ready` just works. So does dependency resolution.
252
- - **Escape hatches everywhere.** Raw SQL access, JSONL export, custom scoring.
253
- - **Framework agnostic.** CLI, MCP, REST API, TypeScript SDK. Use what fits.
254
- - **Local-first.** SQLite + git. No server required. Works offline.
255
-
256
- ---
257
-
258
- ## Non-Goals
259
-
260
- - **Not an agent framework.** You bring your own orchestration.
261
- - **Not a hosted memory product.** Local-first, your data stays yours.
262
- - **Not a prompt library.** Primitives, not templates.
263
- - **Not a replacement for your issue tracker.** (Unless you want it to be.)
264
-
265
- ---
266
-
267
- ## Interfaces
268
-
269
- | Interface | Use Case |
270
- |-----------|----------|
271
- | **CLI** | Scripts, terminal workflows, agent loops |
272
- | **MCP Server** | Claude Code integration (42 tools) |
273
- | **REST API** | Custom dashboards, external integrations |
274
- | **TypeScript SDK** | Programmatic access from your agents |
275
- | **Dashboard** | Visual monitoring and management |
276
-
277
- ---
278
-
279
- ## Quick Reference
280
-
281
- ```bash
282
- # Tasks
283
- tx add <title> # Create task
284
- tx list # List all tasks
285
- tx ready # List unblocked tasks
286
- tx show <id> # View details
287
- tx update <id> # Update task fields
288
- tx done <id> # Complete task
289
- tx reset <id> # Reset to backlog
290
- tx delete <id> # Delete task
291
- tx md-export # Export tasks to markdown file (.tx/tasks.md)
292
- tx block <id> <blocker> # Add dependency
293
- tx unblock <id> <blocker> # Remove dependency
294
- tx children <id> # List child tasks
295
- tx tree <id> # Show hierarchy
296
-
297
- # Memory (filesystem-backed .md search)
298
- tx memory source add <dir> # Register directory
299
- tx memory source rm <dir> # Unregister directory
300
- tx memory source list # Show registered directories
301
- tx memory add <title> # Create .md file (--content, --tags, --dir)
302
- tx memory index # Index all sources (--incremental, --status)
303
- tx memory search <query> # BM25 search (--semantic, --expand, --tags, --prop)
304
- tx memory show <id> # Display document
305
- tx memory tag <id> <tags> # Add tags to frontmatter
306
- tx memory untag <id> <t> # Remove tags
307
- tx memory relate <id> <t> # Add to frontmatter.related
308
- tx memory set <id> <k> <v> # Set property
309
- tx memory unset <id> <k> # Remove property
310
- tx memory props <id> # Show properties
311
- tx memory links <id> # Outgoing wikilinks + edges
312
- tx memory backlinks <id> # Incoming links
313
- tx memory list # List documents (--source, --tags)
314
- tx memory link <src> <tgt> # Create explicit edge
315
-
316
- # Memory
317
- tx memory add <title> # Create .md knowledge file
318
- tx memory search <query> # BM25 search (--semantic, --expand)
319
- tx memory context <id> # Task-relevant memory retrieval
320
- tx memory learn <p> <note> # Attach learning to file path/glob
321
- tx memory recall [path] # Query file-specific learnings
322
- tx memory index # Index all sources
323
-
324
- # Coordination
325
- tx claim <id> <worker> # Lease-based claim
326
- tx claim renew <id> <worker> # Extend lease
327
- tx claim release <id> <worker> # Release early
328
-
329
- # Docs
330
- tx doc add <type> <slug> # Create doc
331
- tx doc edit <slug> # Edit doc
332
- tx doc show <slug> # Show doc
333
- tx doc list # List docs
334
- tx doc render # Generate markdown
335
- tx doc lock <slug> # Lock (immutable)
336
- tx doc version <slug> # Create version
337
- tx doc link <from> <to> # Link docs
338
- tx doc attach <slug> <task> # Attach to task
339
- tx doc patch <slug> # Apply patch
340
- tx doc validate # Validate all docs
341
- tx doc drift # Detect stale docs
342
-
343
- # Invariants
344
- tx invariant list # List invariants
345
- tx invariant show <id> # Show details
346
- tx invariant record <id> # Record check result
347
- tx invariant sync # Sync from CLAUDE.md
348
-
349
- # Sync
350
- tx sync export # SQLite → JSONL (git-friendly)
351
- tx sync import # JSONL → SQLite
352
- tx sync status # Show sync status
353
- tx sync auto # Auto-sync on change
354
- tx sync compact # Compact JSONL files
355
- tx sync claude --team <name> # Push to Claude Code team
356
- tx sync codex # Push to Codex
357
-
358
- # Traces
359
- tx trace list # Recent runs
360
- tx trace show <id> # Show trace details
361
- tx trace transcript <id> # View transcript
362
- tx trace stderr <id> # View stderr
363
- tx trace errors # Recent errors
364
-
365
- # Bulk
366
- tx bulk done <ids...> # Complete multiple tasks
367
- tx bulk score <ids...> # Score multiple tasks
368
- tx bulk reset <ids...> # Reset multiple tasks
369
- tx bulk delete <ids...> # Delete multiple tasks
370
-
371
- # Cycle
372
- tx cycle # Sub-agent swarm scan
373
-
374
- # Utilities
375
- tx stats # Queue metrics
376
- tx validate # Database health checks
377
- tx migrate status # Migration status
378
- tx doctor # System diagnostics
379
- tx dashboard # Launch dashboard
380
- tx mcp-server # Start MCP server
381
- ```
382
-
383
- ---
384
-
385
- ## Storage
386
-
387
- ```
388
- .tx/
389
- ├── tasks.db # SQLite (gitignored)
390
- ├── tasks.jsonl # Git-tracked
391
- ├── learnings.jsonl # Git-tracked
392
- ├── runs.jsonl # Git-tracked
393
- └── docs/ # YAML doc sources
394
- ```
395
-
396
- Local SQLite for speed. JSONL for git sync. Branch your knowledge with your code.
397
-
398
- ---
399
-
400
- ## Packages
401
-
402
- | Package | Description |
403
- |---------|-------------|
404
- | [`@jamesaphoenix/tx`](https://www.npmjs.com/package/@jamesaphoenix/tx) | Public SDK |
405
- | [`@jamesaphoenix/tx-cli`](https://www.npmjs.com/package/@jamesaphoenix/tx-cli) | CLI |
406
- | [`@jamesaphoenix/tx-core`](https://www.npmjs.com/package/@jamesaphoenix/tx-core) | Core service layer (Effect-TS) |
407
- | [`@jamesaphoenix/tx-types`](https://www.npmjs.com/package/@jamesaphoenix/tx-types) | Shared type definitions |
408
- | [`@jamesaphoenix/tx-agent-sdk`](https://www.npmjs.com/package/@jamesaphoenix/tx-agent-sdk) | TypeScript Agent SDK |
409
- | [`@jamesaphoenix/tx-mcp-server`](https://www.npmjs.com/package/@jamesaphoenix/tx-mcp-server) | MCP server (42 tools) |
410
- | [`@jamesaphoenix/tx-api-server`](https://www.npmjs.com/package/@jamesaphoenix/tx-api-server) | REST API server |
411
-
412
- ---
153
+ | Persistence | Session-scoped | Manual file edits | SQLite + git-backed streams |
154
+ | Multi-agent safety | Easy collisions | Manual coordination | Claims, dependencies, messaging |
155
+ | Intent tracking | Weak | Weak | Docs-first specs + decision capture |
156
+ | Knowledge reuse | Lost each session | Static dump | Searchable memory + pins |
157
+ | Orchestration | Fixed by tool | None | You own the loop |
413
158
 
414
- ## Documentation
159
+ ## Docs
415
160
 
416
- - **[txdocs.dev](https://txdocs.dev)**: Documentation
417
- - **[CLAUDE.md](https://github.com/jamesaphoenix/tx/blob/main/CLAUDE.md)**: Doctrine and quick reference
418
- - **[AGENTS.md](https://github.com/jamesaphoenix/tx/blob/main/AGENTS.md)**: Codex onboarding and quick reference
419
- - **[PRDs](https://txdocs.dev/docs/prd)** and **[Design Docs](https://txdocs.dev/docs/design)**: Product and architecture specs
161
+ - [Getting Started](https://txdocs.dev/docs/getting-started)
162
+ - [Primitives](https://txdocs.dev/docs/primitives)
163
+ - [Agent SDK](https://txdocs.dev/docs/agent-sdk)
164
+ - [PRDs and Design Docs](https://txdocs.dev/docs/prd)
420
165
 
421
- ---
166
+ ## Principle
422
167
 
423
- ## License
168
+ tx should stay small.
424
169
 
425
- MIT
170
+ It is not an agent framework, not a hosted memory product, and not a prescribed workflow. It is a local set of primitives you can compose into your own loop.