Skip to content

Commit 33ae364

Browse files
committed
Add otel llm.report skill
1 parent 54ba1fd commit 33ae364

1 file changed

Lines changed: 49 additions & 0 deletions

File tree

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
---
2+
name: investigate
3+
description: Investigate a rewatch OTEL trace report from a span ID.
4+
user-invocable: true
5+
---
6+
7+
# OTEL Investigation Skill
8+
9+
The user invokes this as `/investigate-otel <span_id>` where `<span_id>` is a 16-character hex string identifying an `lsp.llm_report` span in the local otel-viewer.
10+
11+
## OTEL Viewer API (http://localhost:4707)
12+
13+
Only these endpoints exist — do NOT invent others:
14+
15+
- `GET /api/spans/{span_id}/context`**start here** for `lsp.llm_report` spans. Returns the report's `message` attribute AND the session timeline (filtered `did_save`/`did_change`/`flush` siblings) in one call.
16+
- `GET /api/spans/{span_id}/flush` — structured flush summary with errors inlined. Use for flush spans found in the context.
17+
- `GET /api/spans/{span_id}` — full span detail (attributes, events). Use for drill-down.
18+
- `GET /api/spans/{span_id}/children` — direct children of a span. Use for drill-down.
19+
20+
## Procedure
21+
22+
1. **Fetch context** — this is the entry point, gives you the report message and session timeline:
23+
24+
```
25+
curl -s http://localhost:4707/api/spans/{SPAN_ID}/context | jq .
26+
```
27+
28+
The `target_span.attributes.message` is the user's problem description. `session_spans` is the chronological editing session.
29+
30+
2. **Drill into flushes** — for `lsp.flush` spans in `session_spans` (especially with `has_error: true`):
31+
32+
```
33+
curl -s http://localhost:4707/api/spans/{FLUSH_SPAN_ID}/flush | jq .
34+
```
35+
36+
3. **Drill deeper** if needed via `/api/spans/{id}` or `/api/spans/{id}/children`.
37+
38+
4. **Read rewatch source** based on what the traces reveal:
39+
- `rewatch/src/lsp/` — LSP logic
40+
- `rewatch/src/build/` — build system
41+
- `rewatch/src/watcher.rs` — file watching
42+
43+
5. **Summarize**: what the report describes, session timeline, where things went wrong, root cause hypothesis, suggested fix.
44+
45+
## Notes
46+
47+
- Attributes like `code.filepath`, `code.namespace`, `code.lineno`, `thread.name` are instrumentation noise — ignore them.
48+
- The `/context` endpoint already filters to session-relevant spans with gap detection.
49+
- The `/flush` endpoint shows build stages with error texts inlined; collapsed subtrees have `span_id` for drill-down.

0 commit comments

Comments
 (0)