@tangle-network/traces 0.19.0 → 0.20.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,6 +1,6 @@
1
1
  # traces
2
2
 
3
- > Point `traces` at any agent trace — OTLP spans your own system emits, or the session logs Claude Code, Codex, OpenCode and Gemini already write to disk. Get failure-mode and efficiency findings, plus a straight answer about what the trace cannot tell you. A CLI *and* an SDK.
3
+ > Point `traces` at any agent trace — OTLP spans your own system emits, or the session logs Claude Code, Codex, OpenCode, Pi, Kimi, Factory and Gemini already write to disk. Get failure-mode and efficiency findings, plus a straight answer about what the trace cannot tell you. A CLI *and* an SDK.
4
4
 
5
5
  ![traces analyzing a real Claude Code session](https://raw.githubusercontent.com/tangle-network/traces/main/docs/demo.gif)
6
6
 
@@ -33,6 +33,7 @@ Emitting the contract is the supported way to integrate a new system. The adapte
33
33
  - [Improvement engine](#improvement-engine)
34
34
  - [Ask questions](#ask-questions)
35
35
  - [Session facts](#session-facts)
36
+ - [Skill usage](#skill-usage)
36
37
  - [Diff two runs](#diff-two-runs)
37
38
  - [MCP server](#mcp-server)
38
39
  - [Session index](#session-index)
@@ -261,20 +262,22 @@ not the way to integrate a system you own — for that, [emit the contract](#int
261
262
  | `claude-code` (`claude`, `claudish`, `openclaw`, `nanoclaw`) | `~/.claude/projects/<cwd>/*.jsonl` (+ subagent sidechains), or an explicit `claude -p --output-format stream-json --verbose` JSONL file | verified |
262
263
  | `codex` (`codex-acp`) | `~/.codex/sessions/**/rollout-*.jsonl` | verified |
263
264
  | `codex-exec` (`codex-json`) | explicit `codex exec --json` JSONL file | fixture |
264
- | `opencode` | `~/.local/share/opencode/storage/` | verified |
265
+ | `opencode` | `~/.local/share/opencode/opencode.db` (shared reader), plus historical `storage/` JSON sessions (legacy reader) | verified |
265
266
  | `gemini` (`gemini-cli`) | `~/.gemini/tmp/<hash>/chats/session-*.json` | verified |
266
267
  | `pi` | `~/.pi/agent/sessions/<cwd>/*.jsonl` | verified |
267
- | `factory` (`factory-droids`, `droid`) | `~/.factory/sessions/<cwd>/*.jsonl` + `.settings.json` sidecar | locate verified, parse fixture |
268
+ | `kimi` (`kimi-code`) | `~/.kimi/sessions/<cwd hash>/<session id>/wire.jsonl` | verified |
269
+ | `factory` (`factory-droids`, `droid`) | `~/.factory/sessions/<cwd>/*.jsonl` + `.settings.json` sidecar | verified |
268
270
  | `qwen` (`qwen-code`) | `~/.qwen/projects/<cwd>/chats/*.jsonl` | fixture |
269
271
  | `amp` | `~/.local/share/amp/threads/T-*.json` | fixture |
270
272
  | `github-copilot` (`copilot`) | `~/.copilot/session-state/<id>/events.jsonl` | fixture |
271
273
  | `forge` (`forgecode`) | `/dump` JSON exports | fixture |
272
274
 
273
275
  Every adapter captures the conversation stored in one session file: the **user's prompt** and the **assistant's response** text, plus tool calls/results and token usage.
276
+ Claude Code, Codex, current OpenCode, Pi, Kimi, and Factory read native records through [`@tangle-network/harness-sessions`](https://github.com/tangle-network/agent-sdk/tree/main/packages/harness-sessions); traces adds conversation and workflow spans over its model and tool calls. Historical OpenCode JSON sessions remain readable through the older adapter because their IDs do not overlap the SQLite store. Kimi's wire log has no served-model field, so its model remains unknown rather than being guessed.
274
277
  Claude Code's nested subagent files are folded into the parent trace.
275
278
  Claude Code's stream-json output also records the tools the harness offered the model and whether the run failed.
276
279
  The root span keeps them as `gen_ai.tool.definitions` and `run.status`, so a trace contract can check what the harness enforced.
277
- Claude source UUIDs remain searchable in `traces.claude.source_*` attributes, while exported OTLP IDs use deterministic `deriveHexId` values.
280
+ Exported native-session span IDs derive deterministically from the session and record IDs.
278
281
  The Claude transcript proves turns and tool calls, but does not prove loop iterations or causal links, so those fields remain absent.
279
282
  Codex stores each worker in a separate session file; add `--workflow` to resolve the connected coordinator and worker files.
280
283
  `github-copilot` is the one exception: its log format carries no user prompt.
@@ -294,6 +297,7 @@ traces investigate --all --last 10 --out report.md # explicit investigation ali
294
297
  traces improve --all --last 10 --dir .traces/improvement
295
298
  traces ask --harness codex --session <id> --question "Which commands failed?"
296
299
  traces facts --harness codex --session <id> # the deterministic facts sheet, $0
300
+ traces skills --since 30d # skill use across every local session, incremental, $0
297
301
  traces diff run-a.otlp.jsonl run-b.otlp.jsonl # where two runs of one task first diverge
298
302
  traces mcp --otlp spans.otlp.jsonl # read-only trace tools for an MCP client
299
303
  traces analyze --all --since 2026-06-18 --out report.md
@@ -632,6 +636,37 @@ Three rules hold for every field:
632
636
 
633
637
  The same sheet reaches the model-backed analysts as prepared context, before their first model call — see [Trace analysts](docs/trace-analysts.md#session-facts-as-prepared-context).
634
638
 
639
+ ## Skill usage
640
+
641
+ `traces skills` indexes skill records in Claude Code, Codex, and Kimi Code sessions on this machine.
642
+ It makes no model call.
643
+
644
+ ```bash
645
+ traces skills # every stored event, with the installed catalog joined
646
+ traces skills --since 30d # one window
647
+ traces skills --unused # installed skills with no use in the window, one per line
648
+ traces skills --format json # rows, unused skills, refresh cost and sweep exclusions
649
+ traces skills --no-refresh # answer from the store without reading transcripts
650
+ ```
651
+
652
+ A run reads only transcript bytes appended since the previous run.
653
+ It parses only lines that can carry a skill record and stores the events in `~/.local/state/traces/skill-usage.json` (`--store`).
654
+ The first run reads the whole corpus: about two minutes for 41 GB on an M-series Mac.
655
+ Later runs take seconds, mostly to stat every session file.
656
+ Stored events survive a harness deleting old transcripts.
657
+
658
+ | Column | Harness | Counted record |
659
+ | --- | --- | --- |
660
+ | `model` | Claude Code | A Skill tool result that loaded a skill. A failed call does not count. |
661
+ | `slash` | Claude Code | A `/name` command whose next record is its expanded prompt. Built-in commands such as `/clear` do not expand and do not count. |
662
+ | `read` | Codex | A completed command that reads `<skill>/SKILL.md`. Codex records no skill event, so a read is the closest observable act. It does not show that the skill shaped the outcome. |
663
+ | `read` | Kimi Code | A successful `ReadFile` call or shell command that reads `<skill>/SKILL.md`, including streamed arguments. Kimi records no dedicated skill event. |
664
+
665
+ Each event is keyed by its record ID, so a resumed session that copies earlier records counts once.
666
+ One Codex or Kimi command that reads three or more skills (`--sweep`) is a catalog sweep, such as an audit; its reads are excluded and reported separately.
667
+ `installed` names the harnesses whose catalog lists the skill now: `~/.claude/skills` and enabled plugins for Claude Code, and `~/.codex/skills` and `~/.agents/skills` for Codex.
668
+ OpenCode, Pi, Gemini, Factory, and other harnesses are not indexed.
669
+
635
670
  ## Diff two runs
636
671
 
637
672
  `traces diff` pairs the steps of two runs of the same task and marks where they first stop agreeing.