@tangle-network/traces 0.1.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 +73 -0
- package/dist/cli.js +1920 -0
- package/package.json +36 -0
package/README.md
ADDED
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
# traces
|
|
2
|
+
|
|
3
|
+
Point it at your coding-agent session traces and get **failure-mode + efficiency findings** — without instrumenting anything. It reads the logs your harness already writes to disk.
|
|
4
|
+
|
|
5
|
+
Built for the recurring problem: agents loop, re-send their whole history, stop verifying their own work, and get stuck. `traces` surfaces that from the trace, deterministically.
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npx @tangle-network/traces analyze --harness claude-code --last 1
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## What it does
|
|
12
|
+
|
|
13
|
+
1. Reads a harness's native session log (no OpenTelemetry setup required).
|
|
14
|
+
2. Normalizes it to OTLP-JSONL — the shape the [`@tangle-network/agent-eval`](https://www.npmjs.com/package/@tangle-network/agent-eval) analyst suite *and* [HALO](https://github.com/context-labs/halo) consume.
|
|
15
|
+
3. Runs the analysts and writes a markdown report.
|
|
16
|
+
|
|
17
|
+
The deterministic pass (token-growth, output-decay, tool-monoculture, missing self-verification) needs **no API key and costs nothing**. Add `--llm` for the agentic RLM analysts (failure-mode / knowledge-gap / knowledge-poisoning / improvement).
|
|
18
|
+
|
|
19
|
+
## Supported harnesses
|
|
20
|
+
|
|
21
|
+
Covers the coding-agent CLIs in the agent-dev-container nix profile. "Verified" = parser exercised against real on-disk sessions; "fixture" = parser exercised against a schema-accurate fixture (no local sessions to test); see the test suite.
|
|
22
|
+
|
|
23
|
+
| Harness (aliases) | Reads from | Status |
|
|
24
|
+
|---|---|---|
|
|
25
|
+
| `claude-code` (`claudish`, `openclaw`, `nanoclaw`) | `~/.claude/projects/<cwd>/*.jsonl` (+ subagent sidechains) | verified |
|
|
26
|
+
| `codex` (`codex-acp`) | `~/.codex/sessions/**/rollout-*.jsonl` | verified |
|
|
27
|
+
| `opencode` | `~/.local/share/opencode/storage/` | verified |
|
|
28
|
+
| `gemini` (`gemini-cli`) | `~/.gemini/tmp/<hash>/chats/session-*.json` | verified |
|
|
29
|
+
| `pi` | `~/.pi/agent/sessions/<cwd>/*.jsonl` | verified |
|
|
30
|
+
| `factory` (`factory-droids`, `droid`) | `~/.factory/sessions/<cwd>/*.jsonl` + `.settings.json` sidecar | locate verified, parse fixture |
|
|
31
|
+
| `qwen` (`qwen-code`) | `~/.qwen/projects/<cwd>/chats/*.jsonl` | fixture |
|
|
32
|
+
| `amp` | `~/.local/share/amp/threads/T-*.json` | fixture |
|
|
33
|
+
| `github-copilot` (`copilot`) | `~/.copilot/session-state/<id>/events.jsonl` | fixture |
|
|
34
|
+
| `forge` (`forgecode`) | `/dump` JSON exports (live `~/.forge/.forge.db` SQLite is a follow-up) | fixture |
|
|
35
|
+
|
|
36
|
+
Notes: Factory's token totals live in the `.settings.json` sidecar (no per-turn usage). Forge's primary store is SQLite; v1 reads its dependency-free `/dump` exports. ACP-only bridges (`claude-agent-acp`) may not persist a local transcript at all.
|
|
37
|
+
|
|
38
|
+
Adding a harness is one file implementing `HarnessTraceAdapter` (`locate` + `parse`) in `src/adapters/`.
|
|
39
|
+
|
|
40
|
+
## Commands
|
|
41
|
+
|
|
42
|
+
```bash
|
|
43
|
+
traces list --harness claude-code --last 20 # discover sessions
|
|
44
|
+
traces analyze --harness codex --last 1 # $0 deterministic report
|
|
45
|
+
traces analyze --all --since 2026-06-18 --out report.md
|
|
46
|
+
traces convert --harness claude-code --last 1 --otlp spans.jsonl # OTLP only → HALO
|
|
47
|
+
traces analyze --harness claude-code --last 1 --llm # +agentic (needs OPENAI_API_KEY)
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
### Options
|
|
51
|
+
|
|
52
|
+
| Flag | Meaning |
|
|
53
|
+
|---|---|
|
|
54
|
+
| `--harness <id>` | Harness or alias (default: `claude-code`) |
|
|
55
|
+
| `--all` | Sweep every known harness |
|
|
56
|
+
| `--last <n>` | Most-recent N sessions |
|
|
57
|
+
| `--session <path>` | Analyze one explicit session file |
|
|
58
|
+
| `--cwd <dir>` | Filter sessions by working directory |
|
|
59
|
+
| `--since <iso>` | Only sessions modified since this time |
|
|
60
|
+
| `--out <path>` | Write report to a file |
|
|
61
|
+
| `--otlp <path>` | OTLP artifact path |
|
|
62
|
+
| `--llm` | Enable agentic RLM analysts (needs `OPENAI_API_KEY`) |
|
|
63
|
+
| `--budget <usd>` | USD cap for agentic analysts |
|
|
64
|
+
|
|
65
|
+
## Develop
|
|
66
|
+
|
|
67
|
+
```bash
|
|
68
|
+
pnpm install
|
|
69
|
+
pnpm dev analyze --harness claude-code --last 1 # run from source via tsx
|
|
70
|
+
pnpm test
|
|
71
|
+
pnpm typecheck
|
|
72
|
+
pnpm build # → dist/cli.js (the published bin)
|
|
73
|
+
```
|