@jamesaphoenix/tx 0.4.2 → 0.4.4

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 ADDED
@@ -0,0 +1,309 @@
1
+ # tx
2
+
3
+ **Primitives, not frameworks.** Headless infrastructure for AI agents.
4
+
5
+ Memory, tasks, and orchestration — you own the loop.
6
+
7
+ ```bash
8
+ # CLI (global install)
9
+ npm install -g @jamesaphoenix/tx-cli
10
+
11
+ # Library (project dependency)
12
+ npm install @jamesaphoenix/tx
13
+ ```
14
+
15
+ ---
16
+
17
+ ## The Problem
18
+
19
+ 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.
20
+
21
+ ## The Solution
22
+
23
+ Composable primitives that handle the hard parts. You keep control of the orchestration.
24
+
25
+ ```
26
+ ┌─────────────────────────────────────────────────────────┐
27
+ │ Your Orchestration (your code, your rules) │
28
+ ├─────────────────────────────────────────────────────────┤
29
+ │ tx primitives │
30
+ │ │
31
+ │ tx ready tx done tx context tx learn │
32
+ │ tx claim tx block tx sync tx trace │
33
+ │ │
34
+ └─────────────────────────────────────────────────────────┘
35
+ ```
36
+
37
+ ---
38
+
39
+ ## Primitives
40
+
41
+ ### Memory
42
+
43
+ Learnings that persist and surface when relevant.
44
+
45
+ ```bash
46
+ # Store knowledge
47
+ tx learning:add "Use bcrypt for passwords, not SHA256"
48
+ tx learning:add "Redis cache invalidation has race conditions" -c database
49
+
50
+ # Attach learnings to file paths
51
+ tx learn "src/auth/*.ts" "Services must use Effect-TS patterns"
52
+
53
+ # Retrieve via search or task context
54
+ tx learning:search "authentication"
55
+ tx context tx-abc123 # Get relevant learnings for a task
56
+ tx recall "src/auth/hash.ts" # Recall learnings for a file
57
+ ```
58
+
59
+ Hybrid search (BM25 + vector with RRF fusion) finds relevant knowledge.
60
+
61
+ ### Tasks
62
+
63
+ Dependency-aware task management. Agents only see work they can actually do.
64
+
65
+ ```bash
66
+ # Create with dependencies
67
+ tx add "Implement auth service" --score 800
68
+ tx add "Design auth schema" --score 900
69
+ tx block tx-impl tx-schema # impl waits for schema
70
+
71
+ # Work on what's ready
72
+ tx ready # Only unblocked tasks
73
+ tx done tx-schema # Completes → unblocks dependents
74
+ ```
75
+
76
+ Full hierarchy support. Epics contain milestones contain tasks contain subtasks.
77
+
78
+ ### Coordination
79
+
80
+ Lease-based claims prevent parallel agents from colliding.
81
+
82
+ ```bash
83
+ tx claim tx-abc123 worker-1 # Claim with 30-min lease
84
+ tx claim tx-abc123 worker-1 --lease 60 # Custom lease duration
85
+ tx claim:renew tx-abc123 worker-1 # Extend lease
86
+ tx claim:release tx-abc123 worker-1 # Release early
87
+ ```
88
+
89
+ ### Attempts
90
+
91
+ Track what approaches have been tried on a task.
92
+
93
+ ```bash
94
+ tx try tx-abc123 "Used Redux" --failed "Too complex for this use case"
95
+ tx try tx-abc123 "Used Zustand" --succeeded
96
+ tx attempts tx-abc123 # See all attempts
97
+ ```
98
+
99
+ ### Docs
100
+
101
+ Structured documentation as primitives. YAML-based with versioning, locking, and linking.
102
+
103
+ ```bash
104
+ tx doc add prd auth-system --title "Auth System PRD"
105
+ tx doc render # Generate markdown from YAML
106
+ tx doc lock auth-system # Lock doc (immutable)
107
+ tx doc link auth-prd auth-dd # Link PRD to DD
108
+ tx doc drift # Detect stale docs
109
+ ```
110
+
111
+ ### Invariants
112
+
113
+ Track and verify project invariants across sessions.
114
+
115
+ ```bash
116
+ tx invariant list # List all invariants
117
+ tx invariant show INV-001 # Show details
118
+ tx invariant record INV-001 --passed # Record check result
119
+ tx invariant sync # Sync from CLAUDE.md
120
+ ```
121
+
122
+ ### Cycle Scan
123
+
124
+ Sub-agent swarm scanning for codebase analysis.
125
+
126
+ ```bash
127
+ tx cycle --task-prompt "Review auth" --scan-prompt "Find bugs"
128
+ ```
129
+
130
+ ---
131
+
132
+ ## Your Loop, Your Rules
133
+
134
+ We ship **example loops**, not **the loop**:
135
+
136
+ ```bash
137
+ # Simple: one agent, one task
138
+ while task=$(tx ready --limit 1 --json | jq -r '.[0].id'); do
139
+ claude "Work on task $task, then run: tx done $task"
140
+ done
141
+ ```
142
+
143
+ ```bash
144
+ # Parallel: N agents with claims
145
+ for i in {1..5}; do
146
+ (while task=$(tx ready --json --limit 1 | jq -r '.[0].id // empty'); do
147
+ [ -z "$task" ] && break
148
+ tx claim "$task" "worker-$i" || continue
149
+ claude "Complete $task" && tx done "$task"
150
+ done) &
151
+ done
152
+ wait
153
+ ```
154
+
155
+ ```bash
156
+ # Human-in-loop: agent proposes, human approves
157
+ task=$(tx ready --json --limit 1 | jq -r '.[0].id')
158
+ claude "Plan implementation for $task" > plan.md
159
+ read -p "Approve? [y/n] " && claude "Execute plan.md"
160
+ tx done $task
161
+ ```
162
+
163
+ **The flow is yours.** Serial, parallel, swarm, human-in-loop. Your call.
164
+
165
+ ---
166
+
167
+ ## TypeScript SDK
168
+
169
+ This package (`@jamesaphoenix/tx`) is the library entry point. It re-exports everything from `@jamesaphoenix/tx-core` plus convenience helpers.
170
+
171
+ ```typescript
172
+ import { TaskService, LearningService, makeAppLayer } from "@jamesaphoenix/tx";
173
+ import { Effect } from "effect";
174
+
175
+ const program = Effect.gen(function* () {
176
+ const tasks = yield* TaskService;
177
+ const ready = yield* tasks.getReady({ limit: 5 });
178
+ return ready;
179
+ });
180
+
181
+ // Run with the default layer (SQLite-backed)
182
+ const layer = makeAppLayer(".tx/tasks.db");
183
+ await Effect.runPromise(program.pipe(Effect.provide(layer)));
184
+ ```
185
+
186
+ For a Promise-based HTTP client, use the Agent SDK:
187
+
188
+ ```typescript
189
+ import { TxClient } from "@jamesaphoenix/tx-agent-sdk";
190
+
191
+ const tx = new TxClient({ apiUrl: "http://localhost:3456" });
192
+ const ready = await tx.tasks.ready({ limit: 10 });
193
+ ```
194
+
195
+ ---
196
+
197
+ ## Why tx?
198
+
199
+ | | Native Tasks | CLAUDE.md | tx |
200
+ |---|---|---|---|
201
+ | **Persistence** | Session-scoped | File grows forever | Git-native, branch-aware |
202
+ | **Multi-agent** | Collisions | Manual coordination | Claim with lease expiry |
203
+ | **Knowledge** | Lost each session | Static dump | Hybrid search, contextual retrieval |
204
+ | **Orchestration** | None | None | Primitives for any pattern |
205
+
206
+ ---
207
+
208
+ ## Design Principles
209
+
210
+ - **No opinions on orchestration.** Serial, parallel, swarm, human-in-loop. Your call.
211
+ - **Powerful defaults.** `tx ready` just works. So does dependency resolution.
212
+ - **Escape hatches everywhere.** Raw SQL access, JSONL export, custom scoring.
213
+ - **Framework agnostic.** CLI, MCP, REST API, TypeScript SDK. Use what fits.
214
+ - **Local-first.** SQLite + git. No server required. Works offline.
215
+
216
+ ---
217
+
218
+ ## Packages
219
+
220
+ | Package | Description |
221
+ |---------|-------------|
222
+ | [`@jamesaphoenix/tx`](https://www.npmjs.com/package/@jamesaphoenix/tx) | Library entry point (this package) |
223
+ | [`@jamesaphoenix/tx-cli`](https://www.npmjs.com/package/@jamesaphoenix/tx-cli) | CLI binary (`tx` command) |
224
+ | [`@jamesaphoenix/tx-core`](https://www.npmjs.com/package/@jamesaphoenix/tx-core) | Core services (Effect-TS) |
225
+ | [`@jamesaphoenix/tx-types`](https://www.npmjs.com/package/@jamesaphoenix/tx-types) | Shared type definitions |
226
+ | [`@jamesaphoenix/tx-agent-sdk`](https://www.npmjs.com/package/@jamesaphoenix/tx-agent-sdk) | Promise-based HTTP client |
227
+ | [`@jamesaphoenix/tx-mcp-server`](https://www.npmjs.com/package/@jamesaphoenix/tx-mcp-server) | MCP server (42 tools) |
228
+ | [`@jamesaphoenix/tx-api-server`](https://www.npmjs.com/package/@jamesaphoenix/tx-api-server) | REST API server |
229
+
230
+ ---
231
+
232
+ ## Interfaces
233
+
234
+ | Interface | Use Case |
235
+ |-----------|----------|
236
+ | **CLI** | Scripts, terminal workflows, agent loops |
237
+ | **MCP Server** | Claude Code integration (42 tools) |
238
+ | **REST API** | Custom dashboards, external integrations |
239
+ | **TypeScript SDK** | Programmatic access from your agents |
240
+ | **Dashboard** | Visual monitoring and management |
241
+
242
+ ---
243
+
244
+ ## Quick Reference
245
+
246
+ ```bash
247
+ # Tasks
248
+ tx add <title> # Create task
249
+ tx list # List all tasks
250
+ tx ready # List unblocked tasks
251
+ tx show <id> # View details
252
+ tx update <id> # Update task fields
253
+ tx done <id> # Complete task
254
+ tx delete <id> # Delete task
255
+ tx block <id> <blocker> # Add dependency
256
+ tx tree <id> # Show hierarchy
257
+
258
+ # Context & Learnings
259
+ tx learning:add <content> # Store knowledge
260
+ tx learning:search <query> # Search learnings
261
+ tx context <task-id> # Contextual retrieval
262
+ tx learn <path> <note> # Attach to file
263
+ tx recall [path] # Query by file
264
+
265
+ # Coordination
266
+ tx claim <id> <worker> # Lease-based claim
267
+ tx claim:renew <id> <worker> # Extend lease
268
+ tx claim:release <id> <worker> # Release early
269
+ tx try <id> <approach> # Record attempt
270
+
271
+ # Docs & Invariants
272
+ tx doc add <type> <slug> # Create doc
273
+ tx doc render # Generate markdown
274
+ tx invariant list # List invariants
275
+ tx invariant sync # Sync from CLAUDE.md
276
+
277
+ # Sync
278
+ tx sync export # SQLite → JSONL (git-friendly)
279
+ tx sync import # JSONL → SQLite
280
+ tx sync claude --team <name> # Push to Claude Code team
281
+
282
+ # Traces & Utilities
283
+ tx cycle # Sub-agent swarm scan
284
+ tx trace list # Recent runs
285
+ tx stats # Queue metrics
286
+ tx doctor # System diagnostics
287
+ tx dashboard # Launch dashboard
288
+ ```
289
+
290
+ ---
291
+
292
+ ## Storage
293
+
294
+ ```
295
+ .tx/
296
+ ├── tasks.db # SQLite (gitignored)
297
+ ├── tasks.jsonl # Git-tracked
298
+ ├── learnings.jsonl # Git-tracked
299
+ ├── runs.jsonl # Git-tracked
300
+ └── docs/ # YAML doc sources
301
+ ```
302
+
303
+ Local SQLite for speed. JSONL for git sync. Branch your knowledge with your code.
304
+
305
+ ---
306
+
307
+ ## License
308
+
309
+ MIT
package/dist/index.d.ts CHANGED
@@ -36,6 +36,6 @@
36
36
  */
37
37
  export * from "@jamesaphoenix/tx-core";
38
38
  export { createTx, type CreateTxOptions, type TxClient } from "./create-tx.js";
39
- export type { TaskStatus, TaskId, Task, TaskWithDeps, TaskTree, TaskDependency, CreateTaskInput, UpdateTaskInput, TaskFilter, LearningSourceType, LearningId, Learning, LearningWithScore, CreateLearningInput, UpdateLearningInput, LearningQuery, ContextOptions, ContextResult, RetrievalOptions, AttemptOutcome, AttemptId, Attempt, CreateAttemptInput, RunId, RunStatus, Run, CreateRunInput, UpdateRunInput, AnchorId, AnchorType, AnchorStatus, Anchor, CreateAnchorInput, EdgeId, NodeType, EdgeType, Edge, CreateEdgeInput, } from "@jamesaphoenix/tx-types";
40
- export { TASK_STATUSES, VALID_TRANSITIONS, LEARNING_SOURCE_TYPES, ATTEMPT_OUTCOMES, RUN_STATUSES, ANCHOR_TYPES, ANCHOR_STATUSES, NODE_TYPES, EDGE_TYPES, } from "@jamesaphoenix/tx-types";
39
+ export type { TaskStatus, TaskId, Task, TaskWithDeps, TaskTree, TaskDependency, CreateTaskInput, UpdateTaskInput, TaskFilter, LearningSourceType, LearningId, Learning, LearningWithScore, CreateLearningInput, UpdateLearningInput, LearningQuery, ContextOptions, ContextResult, RetrievalOptions, AttemptOutcome, AttemptId, Attempt, CreateAttemptInput, RunId, RunStatus, Run, CreateRunInput, UpdateRunInput, } from "@jamesaphoenix/tx-types";
40
+ export { TASK_STATUSES, VALID_TRANSITIONS, LEARNING_SOURCE_TYPES, ATTEMPT_OUTCOMES, RUN_STATUSES, } from "@jamesaphoenix/tx-types";
41
41
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmCG;AAGH,cAAc,wBAAwB,CAAC;AAGvC,OAAO,EAAE,QAAQ,EAAE,KAAK,eAAe,EAAE,KAAK,QAAQ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,EACH,cAAc,EACd,cAAc,GACf,MAAM,yBAAyB,CAAC;AAGjC,OAAO,EACL,aAAa,EACb,iBAAiB,EACjB,qBAAqB,EACrB,gBAAgB,EAChB,YAAY,GACb,MAAM,yBAAyB,CAAC"}
package/dist/index.js CHANGED
@@ -39,5 +39,5 @@ export * from "@jamesaphoenix/tx-core";
39
39
  // Export createTx and related types
40
40
  export { createTx } from "./create-tx.js";
41
41
  // Re-export constants from types
42
- export { TASK_STATUSES, VALID_TRANSITIONS, LEARNING_SOURCE_TYPES, ATTEMPT_OUTCOMES, RUN_STATUSES, ANCHOR_TYPES, ANCHOR_STATUSES, NODE_TYPES, EDGE_TYPES, } from "@jamesaphoenix/tx-types";
42
+ export { TASK_STATUSES, VALID_TRANSITIONS, LEARNING_SOURCE_TYPES, ATTEMPT_OUTCOMES, RUN_STATUSES, } from "@jamesaphoenix/tx-types";
43
43
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmCG;AAEH,mDAAmD;AACnD,cAAc,wBAAwB,CAAC;AAEvC,oCAAoC;AACpC,OAAO,EAAE,QAAQ,EAAuC,MAAM,gBAAgB,CAAC;AAkD/E,iCAAiC;AACjC,OAAO,EACL,aAAa,EACb,iBAAiB,EACjB,qBAAqB,EACrB,gBAAgB,EAChB,YAAY,EACZ,YAAY,EACZ,eAAe,EACf,UAAU,EACV,UAAU,GACX,MAAM,yBAAyB,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmCG;AAEH,mDAAmD;AACnD,cAAc,wBAAwB,CAAC;AAEvC,oCAAoC;AACpC,OAAO,EAAE,QAAQ,EAAuC,MAAM,gBAAgB,CAAC;AAsC/E,iCAAiC;AACjC,OAAO,EACL,aAAa,EACb,iBAAiB,EACjB,qBAAqB,EACrB,gBAAgB,EAChB,YAAY,GACb,MAAM,yBAAyB,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jamesaphoenix/tx",
3
- "version": "0.4.2",
3
+ "version": "0.4.4",
4
4
  "description": "TanStack for AI agents - headless primitives for memory, tasks, and orchestration",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -25,18 +25,12 @@
25
25
  "prepublishOnly": "npm run build"
26
26
  },
27
27
  "dependencies": {
28
- "@jamesaphoenix/tx-core": "^0.4.2",
29
- "@jamesaphoenix/tx-types": "^0.4.2"
28
+ "@jamesaphoenix/tx-core": "*",
29
+ "@jamesaphoenix/tx-types": "*"
30
30
  },
31
31
  "peerDependencies": {
32
- "better-sqlite3": "^11.0.0",
33
32
  "effect": "^3.0.0"
34
33
  },
35
- "peerDependenciesMeta": {
36
- "better-sqlite3": {
37
- "optional": false
38
- }
39
- },
40
34
  "repository": {
41
35
  "type": "git",
42
36
  "url": "https://github.com/jamesaphoenix/tx.git",