@@ -6,6 +6,13 @@ argument-hint: "[what to look for in the run logs]"
66
77# Read run logs
88
9+ > ** ⚠️ Reading a run sends its contents to the model — that * is* the leak, and it's how
10+ > this skill works.** Run logs routinely contain auth/refresh/push tokens, emails, and
11+ > customer data; the moment you read one, that data is sent to the model. Invoking
12+ > ` /read-logs ` means ** consciously accepting** that this captured run gets sent. Don't run
13+ > it against production or real-customer data unless you've accepted that risk. (See the
14+ > plugin README for redaction options and the full data-handling note.)
15+
916Load the running app's ` flutter run ` output as context for the task the user gave when
1017invoking this skill. Editor setup (making the app write the log file) is documented in this
1118plugin's ` README.md ` — that is canonical. The ** First-run setup** section below intentionally
@@ -21,11 +28,6 @@ skill auto-detects which:
2128- ** VS Code / Cursor (` dart.dapLogFile ` ):** Debug Adapter Protocol log (JSON-framed; the
2229 app's output is inside ` event:"output" ` messages).
2330
24- > ** ⚠️ Logs can contain secrets and customer data** — auth/push tokens, emails, account
25- > details, anything logged at runtime. The file stays local in ` /tmp ` , but reading ** sends
26- > the slice you read to the model** . Be mindful of what a run captured, especially against
27- > production or real customer data.
28-
2931** This skill loads logs as CONTEXT — it is not a standalone analyzer.** Don't summarize the
3032run, surface all errors, or volunteer a diagnosis on your own. Read the logs so you have
3133them, then carry out the task you were invoked with (e.g. "why did login flash", "does auth
@@ -74,11 +76,12 @@ text, then read it with the **task as your lens** — not a fixed filter.
7476
7577``` bash
7678CLEAN=" ${L% .log} .clean.log"
77- if head -50 " $L " | grep -q ' \[DAP\]\ |"event": "output"' ; then
79+ if head -50 " $L " | grep -qE ' \[DAP\]|"event"[[:space:]]*:[[:space:]]* "output"' ; then
7880 echo " [format: DAP — extracting app output]"
7981 # grep first: only the output-event lines reach the JSON parser, not the whole protocol —
80- # so extraction cost tracks app output, not total DAP traffic.
81- grep ' "event":"output"' " $L " | python3 -c '
82+ # so extraction cost tracks app output, not total DAP traffic. -E (not \|) for portable
83+ # alternation; [[:space:]]* tolerates non-compact JSON.
84+ grep -E ' "event"[[:space:]]*:[[:space:]]*"output"' " $L " | python3 -c '
8285import json, sys
8386for line in sys.stdin:
8487 i = line.find("{")
@@ -89,16 +92,21 @@ for line in sys.stdin:
8992 sys.stdout.write(m.get("body", {}).get("output", ""))
9093' > " $CLEAN " 2> /dev/null
9194 # jq fallback if python3 is unavailable:
92- # grep '"event": "output"' "$L" | sed -E 's/^[^{]*//' | jq -rj 'select(.event=="output") | .body.output' > "$CLEAN"
95+ # grep -E '"event"[[:space:]]*:[[:space:]]* "output"' "$L" | sed -E 's/^[^{]*//' | jq -rj 'select(.event=="output") | .body.output' > "$CLEAN"
9396else
9497 echo " [format: plain transcript]"
9598 sed -E $' s/\x1b \\ [[0-9;?]*[ -\\ /]*[@-~]//g; s/\r $//' " $L " > " $CLEAN "
9699fi
97100wc -l " $CLEAN "
98101```
99102
100- (If a DAP log can't be extracted because neither ` python3 ` nor ` jq ` is present, tell the
101- user to ` brew install jq ` and fall back to reading matching raw lines so they're not blocked.)
103+ (If a DAP log can't be extracted because neither ` python3 ` nor ` jq ` is present: ` python3 `
104+ ships on most systems; otherwise install ` jq ` via the platform's package manager —
105+ ` brew install jq ` on macOS, ` apt install jq ` / ` dnf install jq ` on Linux. Until then, fall
106+ back to reading matching raw lines so the user isn't blocked.)
107+
108+ ** Transparency:** before reading, surface one line to the dev — * "reading ` <path> ` — its
109+ contents go to the model"* — so each read is a visible, conscious step (no blocking prompt).
102110
103111** Then read ` $CLEAN ` with the task as the lens — go as deep as the task needs:**
104112
@@ -137,6 +145,11 @@ Goal: leave the dev with their editor configured to capture logs, with no surpri
137145guess silently and never commit anything. (The ` README.md ` is the canonical copy of these
138146steps; this inline version exists so setup works at runtime.)
139147
148+ ** This is the conscious opt-in moment.** Before wiring anything up, make sure the dev
149+ understands that enabling capture means Claude will read run logs into context — which
150+ ** sends them to the model** — and that runs can contain tokens and customer data. Get a
151+ clear yes before applying the setup; if they prefer not to take that risk, don't wire it.
152+
140153### 1. Determine which editor the dev runs the app in
141154
142155Detection is a convenience to skip a question — never a hard dependency. In order:
0 commit comments