Claude Cursor Skill

echolot

The door to echolot — localise Android performance regressions from a Perfetto trace, from the metric down to a place in the code. /echolot with nothing after it reads the project's state and takes the next step (install the layer, build the config, or hunt); with words it takes

LLM Mart · 0 points · 0 views 5 listing impressions 0 install-command copies
Download grishan0v-echolot-echolot_claude_skills_echolot-a071076.zip · 89 KB

Install

skills CLI npx skills add https://github.com/grishan0v/echolot/tree/main/echolot/claude/skills/echolot
Claude Code claude plugin marketplace add https://llmmart.ai/marketplace.json && claude plugin install grishan0v-echolot@llmmart
Git git clone https://github.com/grishan0v/echolot.git

The skills CLI installs just this skill, for any of its supported agents. Claude Code installs the whole grishan0v/echolot collection as a plugin from our marketplace. Git is the plain clone.

Skill manifest

echolot

A deterministic layer between the Perfetto trace and you.

The one rule

Never open the trace yourself. No hand-rolled TraceProcessor, no ad-hoc SQL, no reading .perfetto-trace. A trace is tens of megabytes and hundreds of thousands of slices; everything you need, echolot hands you as a table of about twenty rows, one per detector, and each detector's own rows are one command away.

Live proportions, measured on a large Kotlin app's cold start, five repeats, default thresholds: twelve detectors fired with 255 rows, and report.json holds every one of them in about 240 KB. What analyze prints to you is the overview, about 3.5 KB; echolot report -d <id> gives one detector's first five rows: a row found in every repeat before a longer one found once.

If the report seems to be missing data, that is not a reason to open the trace. It is a reason to fix the config (anchors that did not match, the wrong process), to add instrumentation and re-record, or to add a detector.

/echolot is the door

When you are invoked as /echolot, do not guess what the human wants from the state of the project — ask the tool. First:

echolot            # where things stand: layer, config, traces, report, doctor — and `next`

Show that output to the human as it is, then act on the next line (echolot status --next gives it as one word):

next what you do
upgrade the .claude/ layer here was written by a newer echolot than the one installed, or its manifest names a version the installed one cannot read, and the installed one writes nothing into it. Show the layer line to the human as it is — it names both versions and the command to upgrade — and stop. Do not run echolot init: it refuses
init run echolot init, show the result; then run echolot again and continue from its new next
doctor run echolot doctor, show what failed, stop — no report is trustworthy until it passes
setup invoke the echolot-setup skill (the Skill tool) — it builds echolot.yml
fix-config show the parse error, ask the human to fix echolot.yml, stop
resume-or-new ask before attaching to anything — see below
init-force files in .claude/ may carry edits made here, and echolot init --all would overwrite them — ask first, see below
fix-settings .claude/settings.json does not parse, so echolot's permission is not in it and no flag of init can put it there. Show the layer line — it says what to merge in — and tell the human to fix the file by hand, then do what the hunt row says
hunt invoke the echolot-hunt skill (the Skill tool) — never run the loop here; it asks what regressed and after which change, opens the investigation, hands the work to perf-hunter and waits for its answer, then closes the investigation with it

resume-or-new: whose question are we answering

An investigation is open, it left traces and a report on disk, and nobody has worked on it for a while. Attaching to that history without asking is how a question about scrolling gets answered with cold-start traces.

echolot has already printed the recap under the table — the question, when it was last worked on, how many traces it would reuse, what the last report said, and anything that drifted since. Show that recap as it is, then ask with AskUserQuestion:

the human picks what you do
carry on echolot hunt --resume, then the echolot-hunt skill, saying the human chose to carry on: it works inside that investigation, with the question and the change it recorded
something new the echolot-hunt skill with their question: it asks for the change and opens the new investigation before anything is recorded for it. Opening it closes the open one: ask first whether that one came to something, and if it did, record it with echolot hunt --done "<what it came to>" — otherwise it is closed as abandoned
a new report, outside it measure, as the measurement route under "With an argument" says: collect, then analyze without --hunt, and show the report. The investigation stays open, as it was
just show the report print .echolot/out/report.md — .echolot/out/<scenario>/report.md, the investigation's scenario, when the config names several — and stop

Lean towards "something new" when the recap shows a ! line — the scenario changed, the config changed, or it has been untouched for over a week.

A new investigation is opened by echolot hunt "<question>", which the echolot-hunt skill runs. It moves the previous set of traces aside before anything is recorded, so the new investigation cannot inherit them, and it says on stderr if the previous one left AGENTTMP_ markers in the sources. Deal with those before hunting: echolot mark --remove takes out what mark --apply wrote, and anything added by hand has to go by hand. Instrumentation nobody meant to leave behind is the starting condition of the next investigation otherwise.

When the human's own words name a question — /echolot why does the list stutter, /echolot hunt <words> — and an investigation is open, ask this same question whatever next says, and offer "something new" first with their words filled in. A new formulation is sometimes a sharper version of the same hunt, and only the human can say which.

Two things this is never asked about. Inside perf-hunter's loop: it re-records and re-instruments on purpose, works inside an investigation it was handed, and never calls status at all. And a bare /echolot within half an hour of the investigation's own last collect or analyze — that is the same sitting, and next says hunt. Only a run inside it counts: --hunt <n>, the flag the hunt and its loop pass. A collect or an analyze without it runs outside any investigation, files nothing under it and renews nothing, and stderr says so.

init-force: edits made here

The package has moved on from files this project edited (conflict), or from files nothing can tell apart from an edit (differs — a layer installed before echolot kept a manifest). echolot init leaves them alone; echolot init --all overwrites them, and the edit goes with the old copy.

Run echolot init: it touches nothing edited here and lists each file --all would overwrite on a ≠ line — the customised ones too, since --all does not choose. Show those lines, then ask with AskUserQuestion:

the human picks what you do
overwrite them echolot init --all, then echolot again and continue from its new next. Say that the edits are in git, to carry over by hand
keep them leave them, and do what the hunt row says. next asks again while they differ from the package

Never run echolot init --all without that answer.

With an argument

A verb wins over the state:

  • /echolot init — run echolot init. Not setup: init installs or updates this layer; the config is setup's job.
  • /echolot setup — the echolot-setup skill.
  • /echolot doctor, /echolot status, /echolot analyze …, /echolot anr … — run that command, show the output.
  • /echolot reflect — the echolot-reflect skill: how the last session went, what to change in the tool.

Every verb after /echolot is a CLI verb of the same name, except setup — that one needs an agent and has no shell half. Where a verb has both, /echolot X runs echolot X and then whatever loop it needs.

Words are a request, and not every request is a hunt. Run echolot first, as without an argument, and show it: an upgrade, init, doctor, setup or fix-config in its next comes first, as the table above says, and its hunt line says whether an investigation is open. Then the first route that fits the words:

the words ask for the route
an ANR: a freeze, "not responding", a Crashlytics or Play Console issue, a drop box record, an issue's id the section "When what arrived is an ANR" below: echolot anr <the report's file> --root .. An id or a link and no file: an event your Crashlytics tool returns reads too, saved to a file as the tool gave it — one thread, see that section — and otherwise ask the human for the report itself, exported as text: echolot reads a file. Nothing opens, and the open investigation is not asked about
traces already on disk, no device: "from last month's traces", "no phone today", a path echolot analyze <those traces, named> -c echolot.yml, no collect and no --hunt, then echolot report and its views. Two sets: analyse each with its own -o, then echolot compare <a>/report.json <b>/report.json. Nothing opens, nothing is filed
a measurement with nothing to blame: "record a baseline", "just measure", "how long does the cold start take now" echolot collect -c echolot.yml, then echolot analyze <the traces it printed, named> -c echolot.yml, both without --hunt, and show the report. Nothing opens, and an open investigation stays as it was
a regression to find: hunt <words>, "why is startup slow", "the list stutters since the redesign" with no investigation open, the echolot-hunt skill with those words: it asks for the change, opens the investigation with echolot hunt "<words>" --since … — the same word in a shell, which does that half and nothing else — hands the loop to perf-hunter, and closes the investigation with its answer. With one open, ask first, as resume-or-new says, "something new" first with their words: never echolot hunt "<words>" before the human has answered, since it closes the open one

Only the hunt opens an investigation, and only after that question. The other three run outside any: without --hunt, nothing of theirs is filed under the open one, and its freshness is not renewed.

/echolot-setup, /echolot-hunt and /echolot-reflect still exist for whoever knows where they are going; /echolot is the door for everyone else.

The order of work

echolot doctor -q                               # does the environment compute correctly?
echolot analyze .echolot/traces -c echolot.yml  # or the trace files, named

A directory is one set: .echolot/traces is the scenario collect recorded there, a set put aside is its own directory, .echolot/traces/<scenario>-<stamp>, and a macrobenchmark's output directory is one test's latest sitting (--test <name> when it holds several, and the refusal lists them). The first stderr line says what was read and what was left out.

analyze writes .echolot/out/report.json (for you) and report.md (for humans), next to the config. Read the json — it has a stable schema — through echolot report, never whole. What analyze prints to you is the overview echolot report prints — the window, every warning that the numbers are not about the scenario, a line per detector — not report.md, which is a terminal's; echolot report -d <id> is one detector's rows, a row found in every repeat before a longer one found once. --full prints the whole report and is never the way in.

No config? That is next: setup. No idea what is in the trace? echolot probe <trace> --process '<package>*'.

Silence is relative to the thresholds. The report's Config: line and detectors[].params_source say whether the numbers are the shipped defaults or calibrated ones. Calibrated on the runs that hold the regression means the bar sits above it: look with echolot analyze … --defaults before calling a run clean.

Two reports, one question

analyze says where the time went in one set of traces. "It was 3 s, now it is 7 s" needs two sets, and subtracting two twenty-row tables by reading them is the work this tool exists to remove.

echolot compare                      # inside an investigation: previous round vs latest
echolot compare --hunt 3             # its first report against its last
echolot compare old.json new.json    # or name them

One table sorted by how far each row moved — the main thread's moves that hold first, the moves that do not hold last — plus comparison.json beside the report. Three things decide how to read it:

  • change — appeared, grew, shrank, vanished, steady. An appeared row is usually the answer.
  • holds — true means the move's 95% range, in shift, is past the row's floor (shift.floor_ms) on one side and the move survives a re-record; false means the range reaches into the floor or through zero — the runs cannot tell the move from the floor, so record another round before concluding — shift.more_runs says how many more on each side, and null there with shift.runs_needed over a hundred means more rounds will not settle it; null means the row is on one side only, or it has too few runs of its own: a row found in 2/5 runs gets null with no warning, and its before.runs and after.runs say why. For the report as a whole, too few repeats is the single or few warning.
  • warnings — reasons the two may not be comparable. thresholds is the one to read first: against a moved bar, appeared and gone mean "the bar moved", not "the app changed". instrumentation names rows that appeared because you added AGENTTMP_ markers between the rounds.

When what arrived is an ANR, not a regression

Sometimes the question is not "it was 3 s, now it is 7 s" but a report from Crashlytics, Play Console, or the device's own drop box: the app stopped answering somewhere you cannot see. Different first move, and most of it needs no device and no trace.

echolot anr report.txt --root .

Reads and prints — it opens no investigation and leaves nothing on disk but the line every command adds to .echolot/log/runs.jsonl, so a folder of exports goes through it in one loop and the ones worth chasing are the ones that name a lock chain.

What you hold from a Crashlytics tool is an event, not the console's export, and anr reads it too: save it to a file as the tool returned it — YAML, JSON, or just its Thread: text — one event per file. Such an event carries one thread, the one Crashlytics blamed, with no state, no tid and no lock note, so no lock chain can come out of it; the report says so first under what it does not say, beside the revision, process state and Crashlytics' own reading the event adds. Do not build an export by hand from it: made-up states and tids are what the report would then read.

what it says your next move
a lock chain with the main thread behind it you have the mechanism. Open the frames of the thread at the root of the chain — the stack anr prints for it. The direct holder is often queued itself, a victim like the threads behind it. No trace needed
the main thread was idle (nativePollOnce) it was not the culprit. Read the threads that were working — each is listed by the frame nearest the app, with its top beside it
the main thread was waiting for a garbage collection (main.waiting_for: "gc") the frame it allocated in is not the cause; how much the app allocates and keeps is. Read the threads named as stopped too, then record the scenario and read gc_pressure, or take a heap dump. gc.cause: "explicit" is a System.gc() call: open that line
"every frame belongs to the platform or a library", then "the frames nearest to the app" the platform is a dead end, a library the app drives is not: SystemJobScheduler.cancel points at the app's WorkManager setup. Read that setup
"every frame belongs to the platform or a library", then a platform frame such as JobServiceEngine$JobHandler.ackStopMessage with what it was doing still a lead: the main thread was telling the system a JobScheduler job had stopped. Read the app's WorkManager or JobService setup
"Who was holding what" under what it does not say this file carries no lock notes; an empty chain list is the file's limit, not the freeze's. Get the device's own record
"The other threads, their states and their locks" under what it does not say the input was a Crashlytics event: one thread. Read it for what it shows, as the rows above say; when the question is a lock — Crashlytics' subtitle says deadlock — or the main thread is not in it, ask the human for the console's export of that event, or the device's own record
"This checkout is at the build's own revision" / "a line placed here may have moved since" the event named the build's revision: open the lines in the first case; in the second, git worktree add --detach <dir> <revision> and run anr again with --root <dir>
frames placed in the checkout open those lines, once anr marks none of them as now inside another function
"probably not the build that froze" above the placed frames most lines fall outside the function their frame names: check out the build the report names before opening any
frames landing nowhere check out the build the report names — line numbers go stale first
"What N frames are: they read as R8 named them" under what it does not say a minified build: run it again with --mapping and that build's mapping.txt, or set project.mapping in the config under --root. Until then nothing in it is the app's
a warning that frames R8 wrote have no place in the mapping, or name another mapping's id the mapping is another build's: find the one that froze before reading the names

--json is the same findings in the shape you walk: chains, main.stack, main.waiting_for / .gc, working[].where / .top / .stack / .cut / .waiting_for, nearest, leads, lock_notes, heap, code.placed, code.is_the_build, event, retrace and minified. Read it rather than the file: the frames that decide sit three to six deep, and awk over the dump is what this replaces.

The idle main thread is the case that wastes a day if you miss it: the dump is a snapshot taken five seconds in, and whatever caused the freeze had often let go by then. Reading its top frame as the culprit sends you into Android's message queue.

Then echolot mark --from-anr report.txt proposes markers on the methods that were on the stack, and refuses the ones that would lie — a line that falls in a different function than the frame names, a return in the body, a one-line body. Show the reasons rather than working around them.

To measure a freeze rather than read about one, record long enough for anr_risk and anr to see it: the seconds until the freeze starts, plus the five an unanswered input event is given before the system declares an ANR, plus a few for it to write the record. A freeze eight seconds in needs about sixteen, past the default duration_ms: 12000.

Reading the report

How to read it is references/report.md, a page that names a topic for each part it leaves out (references/report-schema.md and the rest); one detector is echolot explain <id>. Three things here that you will get wrong without them. And one habit to drop: do not cut report.json up with jq or python one-liners. echolot report prints what fired, echolot report --detector <id> --top 5 one detector's rows with the evidence kept short, --window and --markers the rest, --json any of them as a small json.

Silent detectors matter as much as firing ones. They stay in the report with empty rows. Silence means that ground was checked and is clean — do not go there. Unless the detector says checked: false: the trace, or its window, did not hold what it reads, reason says what, and its empty rows say nothing about the app. report.md names those apart from Silent. A trace of another journey is analyze <trace> --whole-trace, and a stretch of one trace spotted in Perfetto is analyze <trace> --range <start>..<end> (raw trace ns, or 500ms..900ms from the trace's start): neither is an edit of the config's anchors.

self_ms versus total_ms. Self time, with children subtracted, is where the time actually went. traversal with total_ms: 354 and self_ms: 79 does almost nothing itself; dig into its children. Never add total_ms across rows: they nest inside one another. Nor self_ms across detectors: a disk wait inside a slice is in both. How much of the window the findings cover is window.main_thread.in_rows_pct, each moment counted once.

Warnings inside window. If start_anchor.matches == 0 or end_anchor.matches == 0, the window ran to the edge of the trace and none of the numbers are about your scenario. Fix the config rather than hunting a problem. Same for process_alternatives — you may be analysing the wrong process. A scenario with window: launch has no anchors: window.defined_by says what closed it, the launch's end, the end of the launch a splash handed the start over to, or the app's reportFullyDrawn(), and defined_by_runs in a merged report means the repeats did not agree: the app called it in some and not in others. A call before the first frame is the same window, counted in before_first_frame_runs, and not a disagreement. window.after is what the app drew after a launch closed on its first frame; with material: true the header's After the window: line says the content may have come after the window.

frame_jank is about single frames, not totals. Most of the others aggregate by name and gate on sums, which is right for "cold start got slower" and blind to a heavy tail: one 86 ms frame among thousands disappears into every sum there is. This one reads SurfaceFlinger's per-frame record instead, so it needs no instrumentation and answers a question the sums cannot.

Its total_ms and max_ms are time past the deadline; the frame's own length is in detail, which is where a benchmark's percentiles can be matched. detail also leads with the platform's verdict on whose deadline was missed — Self Jank is the app, Other Jank is the compositor and is not something to go into the code over. Buffer Stuffing is neither: frames queued behind the one before reach the screen late and smoothly, latency rather than stutter, so that row counts its frames with 0 past the deadline and comes after every late frame. A frame that also missed a deadline keeps the miss's tag, and its overrun includes the wait in the queue. Nor is Dropped Frame: frames dropped for a later one were never shown, and whose they were the trace does not say, so that row counts them with 0 past the deadline too, after the late frames, its detail leading with never shown.

Its silence is ambiguous: no bad frames, and no frame timeline in the trace at all, look the same. Android 11 and below have none, and neither does a capture that did not ask for it. Check before calling a scenario smooth.

It judges the app's windows and nothing else. A map, a game or a video a thread of the app draws into a SurfaceView with Vulkan or GL has no frame in the timeline; the report says how many it presented there, on which thread and with which call (window.frames.unjudged), and a silent frame_jank says nothing of them.

From a finding to the code

  1. A firing detector gives you a location — a slice or thread name. A row with code has already been placed: places[].file and .line name the method that waited for a lock and the one holding it, the class a View slice is, or, in a sampled recording, the app's own method the samples found (role sampled). Open that; skip the grep.
  2. The domains section of echolot.yml maps that name to a module and file.
  3. Not in domains? Run echolot domains --root . — it maps literals inside trace("...") and names kept in a const val and passed through the project's own wrapper. Still nothing? Grep the repository for the slice name: a literal survives minification and is found exactly, and a constant's declaration is one grep away from its calls.
  4. Nothing found? The slice is most likely a system one (bindApplication, Choreographer#doFrame, binder transaction). See references/naming.md.

When uninstrumented_cpu fires in a recording without runner.sampling, there is no code behind the finding by definition: the thread burned CPU with no instrumentation. That is an address for adding trace{}, not the location of a bug. In a sampled recording, detail names what ran on the stacks, then ours: and the app's own method under it, and code and places[] (role sampled) give its file: open that first. ours: none is work a pool ran with its caller off the stack; ours: cut is a stack that ended in the framework before anything of ours.

main_thread_outlier is not main_thread_block again. One gates on the sum for a name and answers "where did the time go"; the other gates on a single occurrence against the median for that same name and answers "which one was out of line". A name in both is telling you two things.

They lead to different places in the code. Expensive every time means the fix is in that work. Usually fine and once not means the cause is the state it hit that once — a cold cache, a lock, a first-run path. detail carries the median and how many occurrences it came from, which is what to hold a benchmark's percentiles against.

Boundaries

The tool localises one specific regression: you know "it was 3 s, now it is 7 s" and need to find where. It does not search for the unknown across a pile of traces. A complaint about how it is now — "the list stutters", with no earlier build to set it against — is hunted all the same and answered as what it is: what counts as slow for the scenario, how this build stands against it, and where it spends its time, not a located change. Traces of an earlier build make it one, and the echolot-hunt skill asks for them.

Networking in benchmarks is mocked on purpose — we hunt problems in code, not network speed.

Thresholds are tied to a device and a scenario. When either changes, run echolot calibrate on healthy runs instead of nudging numbers by hand.

When the question is about the tool rather than the app — "how did that session go, what should change in echolot" — that is /echolot reflect (the echolot-reflect skill), not a hunt.

References

  • references/report.md — how to read a report, in one page, and which topic has the rest; open the one topic a question needs, never all of them:
    • references/report-schema.md — report.json key by key
    • references/report-window.md — where the window went: the main thread, crowding, frames, startup
    • references/report-environment.md — the device: clock, temperature, compile state, sampling
    • references/report-markers.md — the markers table
    • references/report-checks.md — every check before a conclusion, with what to do
    • references/report-columns.md — every column of a row, the ranking, spread
    • references/report-detectors.md — every detector, and what matters about each
    • references/report-compare.md — echolot compare: its fields and its warnings
  • references/config.md — the echolot.yml sections, what the code reads and what it does not
  • references/naming.md — how ART names GC, locks and binder; facts from live Android 14
  • references/collect.md — capturing a trace: perfetto and adb commands, verified in practice
Files (echolot)
  • references
    • collect.md 23.8 KB
      Loading…
    • config.md 34.3 KB
      Loading…
    • naming.md 12.6 KB
      Loading…
    • report-checks.md 16.3 KB
      Loading…
    • report-columns.md 8.3 KB
      Loading…
    • report-compare.md 22.2 KB
      Loading…
    • report-detectors.md 28.1 KB
      Loading…
    • report-environment.md 7.2 KB
      Loading…
    • report-markers.md 4.2 KB
      Loading…
    • report-schema.md 16.8 KB
      Loading…
    • report-window.md 14.6 KB
      Loading…
    • report.md 7.8 KB
      Loading…
  • SKILL.md 27.5 KB
    ---
    name: echolot
    description: The door to echolot — localise Android performance regressions from a Perfetto trace, from the metric down to a place in the code. /echolot with nothing after it reads the project's state and takes the next step (install the layer, build the config, or hunt); with words it takes the route they ask for — a hunt, a measurement, an ANR, or traces already on disk. Use when cold start regressed, scrolling stutters, TTI grew, a benchmark dropped, or there is a .perfetto-trace to analyse. Also for questions like "why is startup slow", "where does main thread time go", "what is burning CPU".
    ---
    
    # echolot
    
    A deterministic layer between the Perfetto trace and you.
    
    ## The one rule
    
    **Never open the trace yourself.** No hand-rolled TraceProcessor, no ad-hoc
    SQL, no reading `.perfetto-trace`. A trace is tens of megabytes and hundreds of
    thousands of slices; everything you need, `echolot` hands you as a table of
    about twenty rows, one per detector, and each detector's own rows are one
    command away.
    
    Live proportions, measured on a large Kotlin app's cold start, five repeats,
    default thresholds: twelve detectors fired with 255 rows, and `report.json`
    holds every one of them in about 240 KB. What `analyze` prints to you is the
    overview, about 3.5 KB; `echolot report -d <id>` gives one detector's first
    five rows: a row found in every repeat before a longer one found once.
    
    If the report seems to be missing data, that is not a reason to open the trace.
    It is a reason to fix the config (anchors that did not match, the wrong
    process), to add instrumentation and re-record, or to add a detector.
    
    ## `/echolot` is the door
    
    When you are invoked as `/echolot`, do not guess what the human wants from
    the state of the project — ask the tool. First:
    
    ```bash
    echolot            # where things stand: layer, config, traces, report, doctor — and `next`
    ```
    
    Show that output to the human as it is, then act on the `next` line
    (`echolot status --next` gives it as one word):
    
    | `next` | what you do |
    |---|---|
    | `upgrade` | the `.claude/` layer here was written by a newer echolot than the one installed, or its manifest names a version the installed one cannot read, and the installed one writes nothing into it. Show the `layer` line to the human as it is — it names both versions and the command to upgrade — and stop. Do not run `echolot init`: it refuses |
    | `init` | run `echolot init`, show the result; then run `echolot` again and continue from its new `next` |
    | `doctor` | run `echolot doctor`, show what failed, stop — no report is trustworthy until it passes |
    | `setup` | invoke the `echolot-setup` skill (the Skill tool) — it builds `echolot.yml` |
    | `fix-config` | show the parse error, ask the human to fix `echolot.yml`, stop |
    | `resume-or-new` | **ask before attaching to anything** — see below |
    | `init-force` | files in `.claude/` may carry edits made here, and `echolot init --all` would overwrite them — **ask first**, see below |
    | `fix-settings` | `.claude/settings.json` does not parse, so echolot's permission is not in it and no flag of `init` can put it there. Show the `layer` line — it says what to merge in — and tell the human to fix the file by hand, then do what the `hunt` row says |
    | `hunt` | invoke the `echolot-hunt` skill (the Skill tool) — **never run the loop here**; it asks what regressed and after which change, opens the investigation, hands the work to `perf-hunter` and waits for its answer, then closes the investigation with it |
    
    ## `resume-or-new`: whose question are we answering
    
    An investigation is open, it left traces and a report on disk, and nobody has
    worked on it for a while. Attaching to that history without asking is how a
    question about scrolling gets answered with cold-start traces.
    
    `echolot` has already printed the recap under the table — the question, when it
    was last worked on, how many traces it would reuse, what the last report said,
    and anything that drifted since. **Show that recap as it is**, then ask with
    `AskUserQuestion`:
    
    | the human picks | what you do |
    |---|---|
    | carry on | `echolot hunt --resume`, then the `echolot-hunt` skill, saying the human chose to carry on: it works inside that investigation, with the question and the change it recorded |
    | something new | the `echolot-hunt` skill with their question: it asks for the change and opens the new investigation before anything is recorded for it. Opening it closes the open one: ask first whether that one came to something, and if it did, record it with `echolot hunt --done "<what it came to>"` — otherwise it is closed as `abandoned` |
    | a new report, outside it | measure, as the measurement route under "With an argument" says: `collect`, then `analyze` without `--hunt`, and show the report. The investigation stays open, as it was |
    | just show the report | print `.echolot/out/report.md` — `.echolot/out/<scenario>/report.md`, the investigation's scenario, when the config names several — and stop |
    
    Lean towards "something new" when the recap shows a `!` line — the scenario
    changed, the config changed, or it has been untouched for over a week.
    
    A new investigation is opened by `echolot hunt "<question>"`, which the
    `echolot-hunt` skill runs. It moves the previous set of traces aside before
    anything is recorded, so the new investigation cannot inherit them, and it
    says on stderr if the previous one left `AGENTTMP_` markers in the sources.
    **Deal with those before hunting**: `echolot mark --remove` takes out what
    `mark --apply` wrote, and anything added by hand has to go by hand.
    Instrumentation nobody meant to leave behind is the starting condition of the
    next investigation otherwise.
    
    When the human's own words name a question — `/echolot why does the list
    stutter`, `/echolot hunt <words>` — and an investigation is open, ask this
    same question whatever `next` says, and offer "something new" first with their
    words filled in. A new formulation is sometimes a sharper version of the same
    hunt, and only the human can say which.
    
    Two things this is never asked about. Inside `perf-hunter`'s loop: it
    re-records and re-instruments on purpose, works inside an investigation it was
    handed, and never calls `status` at all. And a bare `/echolot` within half an
    hour of the investigation's own last `collect` or `analyze` — that is the same
    sitting, and `next` says `hunt`. Only a run inside it counts: `--hunt <n>`, the
    flag the hunt and its loop pass. A `collect` or an `analyze` without it runs
    outside any investigation, files nothing under it and renews nothing, and
    stderr says so.
    
    ## `init-force`: edits made here
    
    The package has moved on from files this project edited (`conflict`), or from
    files nothing can tell apart from an edit (`differs` — a layer installed before
    echolot kept a manifest). `echolot init` leaves them alone;
    `echolot init --all` overwrites them, and the edit goes with the old copy.
    
    Run `echolot init`: it touches nothing edited here and lists each file `--all`
    would overwrite on a `≠` line — the `customised` ones too, since `--all` does
    not choose. Show those lines, then ask with `AskUserQuestion`:
    
    | the human picks | what you do |
    |---|---|
    | overwrite them | `echolot init --all`, then `echolot` again and continue from its new `next`. Say that the edits are in git, to carry over by hand |
    | keep them | leave them, and do what the `hunt` row says. `next` asks again while they differ from the package |
    
    Never run `echolot init --all` without that answer.
    
    ## With an argument
    
    A verb wins over the state:
    
    - `/echolot init` — run `echolot init`. Not setup: `init` installs or
      updates **this** layer; the config is setup's job.
    - `/echolot setup` — the `echolot-setup` skill.
    - `/echolot doctor`, `/echolot status`, `/echolot analyze …`,
      `/echolot anr …` — run that command, show the output.
    - `/echolot reflect` — the `echolot-reflect` skill: how the last session
      went, what to change in the tool.
    
    Every verb after `/echolot` is a CLI verb of the same name, except
    `setup` — that one needs an agent and has no shell half. Where a verb has
    both, `/echolot X` runs `echolot X` and then whatever loop it needs.
    
    Words are a request, and not every request is a hunt. Run `echolot` first, as
    without an argument, and show it: an `upgrade`, `init`, `doctor`, `setup` or
    `fix-config` in its `next` comes first, as the table above says, and its
    `hunt` line says whether an investigation is open. Then the first route that
    fits the words:
    
    | the words ask for | the route |
    |---|---|
    | an ANR: a freeze, "not responding", a Crashlytics or Play Console issue, a drop box record, an issue's id | the section "When what arrived is an ANR" below: `echolot anr <the report's file> --root .`. An id or a link and no file: an event your Crashlytics tool returns reads too, saved to a file as the tool gave it — one thread, see that section — and otherwise ask the human for the report itself, exported as text: echolot reads a file. Nothing opens, and the open investigation is not asked about |
    | traces already on disk, no device: "from last month's traces", "no phone today", a path | `echolot analyze <those traces, named> -c echolot.yml`, no `collect` and no `--hunt`, then `echolot report` and its views. Two sets: analyse each with its own `-o`, then `echolot compare <a>/report.json <b>/report.json`. Nothing opens, nothing is filed |
    | a measurement with nothing to blame: "record a baseline", "just measure", "how long does the cold start take now" | `echolot collect -c echolot.yml`, then `echolot analyze <the traces it printed, named> -c echolot.yml`, both without `--hunt`, and show the report. Nothing opens, and an open investigation stays as it was |
    | a regression to find: `hunt <words>`, "why is startup slow", "the list stutters since the redesign" | with no investigation open, the `echolot-hunt` skill with those words: it asks for the change, opens the investigation with `echolot hunt "<words>" --since …` — the same word in a shell, which does that half and nothing else — hands the loop to `perf-hunter`, and closes the investigation with its answer. With one open, ask first, as `resume-or-new` says, "something new" first with their words: never `echolot hunt "<words>"` before the human has answered, since it closes the open one |
    
    Only the hunt opens an investigation, and only after that question. The other
    three run outside any: without `--hunt`, nothing of theirs is filed under the
    open one, and its freshness is not renewed.
    
    `/echolot-setup`, `/echolot-hunt` and `/echolot-reflect` still exist for
    whoever knows where they are going; `/echolot` is the door for everyone else.
    
    ## The order of work
    
    ```bash
    echolot doctor -q                               # does the environment compute correctly?
    echolot analyze .echolot/traces -c echolot.yml  # or the trace files, named
    ```
    
    A directory is one set: `.echolot/traces` is the scenario `collect` recorded
    there, a set put aside is its own directory, `.echolot/traces/<scenario>-<stamp>`,
    and a macrobenchmark's output directory is one test's latest sitting
    (`--test <name>` when it holds several, and the refusal lists them). The
    first stderr line says what was read and what was left out.
    
    `analyze` writes `.echolot/out/report.json` (for you) and `report.md` (for
    humans), next to the config. Read the **json** — it has a stable schema —
    through `echolot report`, never whole. What `analyze` prints to you is the
    overview `echolot report` prints — the window, every warning that the
    numbers are not about the scenario, a line per detector — not `report.md`,
    which is a terminal's; `echolot report -d <id>` is one detector's rows, a
    row found in every repeat before a longer one found once. `--full` prints the whole report and
    is never the way in.
    
    No config? That is `next: setup`. No idea what is in the trace?
    `echolot probe <trace> --process '<package>*'`.
    
    **Silence is relative to the thresholds.** The report's `Config:` line and
    `detectors[].params_source` say whether the numbers are the shipped defaults
    or calibrated ones. Calibrated on the runs that hold the regression means the
    bar sits above it: look with `echolot analyze … --defaults` before calling a
    run clean.
    
    ## Two reports, one question
    
    `analyze` says where the time went in one set of traces. "It was 3 s, now it is
    7 s" needs two sets, and subtracting two twenty-row tables by reading them is
    the work this tool exists to remove.
    
    ```bash
    echolot compare                      # inside an investigation: previous round vs latest
    echolot compare --hunt 3             # its first report against its last
    echolot compare old.json new.json    # or name them
    ```
    
    One table sorted by how far each row moved — the main thread's moves that
    hold first, the moves that do not hold last — plus `comparison.json` beside the
    report. Three things decide how to read it:
    
    - **`change`** — `appeared`, `grew`, `shrank`, `vanished`, `steady`. An
      appeared row is usually the answer.
    - **`holds`** — `true` means the move's 95% range, in `shift`, is past the
      row's floor (`shift.floor_ms`) on one side and the move survives a
      re-record; `false` means the range reaches into the floor or through zero —
      the runs cannot tell the move from the floor, so record another round
      before concluding — `shift.more_runs` says how many more on each side, and
      `null` there with `shift.runs_needed` over a hundred means more rounds will
      not settle it; `null` means the row is on one side only, or it has too few runs of its
      own: a row found in `2/5` runs gets `null` with no warning, and its
      `before.runs` and `after.runs` say why. For the report as a whole, too few
      repeats is the `single` or `few` warning.
    - **`warnings`** — reasons the two may not be comparable. `thresholds` is the
      one to read first: against a moved bar, appeared and gone mean "the bar
      moved", not "the app changed". `instrumentation` names rows that appeared
      because you added `AGENTTMP_` markers between the rounds.
    
    ## When what arrived is an ANR, not a regression
    
    Sometimes the question is not "it was 3 s, now it is 7 s" but a report from
    Crashlytics, Play Console, or the device's own drop box: the app stopped
    answering somewhere you cannot see. Different first move, and most of it needs
    no device and no trace.
    
    ```bash
    echolot anr report.txt --root .
    ```
    
    Reads and prints — it opens no investigation and leaves nothing on disk but
    the line every command adds to `.echolot/log/runs.jsonl`, so a folder of
    exports goes through it in one loop and the ones worth chasing are the ones
    that name a lock chain.
    
    What you hold from a Crashlytics tool is an event, not the console's export,
    and `anr` reads it too: save it to a file as the tool returned it — YAML,
    JSON, or just its `Thread:` text — one event per file. Such an event carries
    **one thread**, the one Crashlytics blamed, with no state, no tid and no lock
    note, so no lock chain can come out of it; the report says so first under what
    it does not say, beside the revision, process state and Crashlytics' own
    reading the event adds. Do not build an export by hand from it: made-up states
    and tids are what the report would then read.
    
    | what it says | your next move |
    |---|---|
    | a lock chain with the main thread behind it | you have the mechanism. Open the frames of the thread at the root of the chain — the stack `anr` prints for it. The direct holder is often queued itself, a victim like the threads behind it. No trace needed |
    | the main thread was **idle** (`nativePollOnce`) | it was not the culprit. Read the threads that were working — each is listed by the frame nearest the app, with its top beside it |
    | the main thread was **waiting for a garbage collection** (`main.waiting_for: "gc"`) | the frame it allocated in is not the cause; how much the app allocates and keeps is. Read the threads named as stopped too, then record the scenario and read `gc_pressure`, or take a heap dump. `gc.cause: "explicit"` is a `System.gc()` call: open that line |
    | "every frame belongs to the platform or a library", then "the frames nearest to the app" | the platform is a dead end, a library the app drives is not: `SystemJobScheduler.cancel` points at the app's WorkManager setup. Read that setup |
    | "every frame belongs to the platform or a library", then a platform frame such as `JobServiceEngine$JobHandler.ackStopMessage` with what it was doing | still a lead: the main thread was telling the system a JobScheduler job had stopped. Read the app's WorkManager or JobService setup |
    | "Who was holding what" under what it does not say | this file carries no lock notes; an empty chain list is the file's limit, not the freeze's. Get the device's own record |
    | "The other threads, their states and their locks" under what it does not say | the input was a Crashlytics event: one thread. Read it for what it shows, as the rows above say; when the question is a lock — Crashlytics' subtitle says deadlock — or the main thread is not in it, ask the human for the console's export of that event, or the device's own record |
    | "This checkout is at the build's own revision" / "a line placed here may have moved since" | the event named the build's revision: open the lines in the first case; in the second, `git worktree add --detach <dir> <revision>` and run `anr` again with `--root <dir>` |
    | frames placed in the checkout | open those lines, once `anr` marks none of them as now inside another function |
    | "probably not the build that froze" above the placed frames | most lines fall outside the function their frame names: check out the build the report names before opening any |
    | frames landing nowhere | check out the build the report names — line numbers go stale first |
    | "What N frames are: they read as R8 named them" under what it does not say | a minified build: run it again with `--mapping` and that build's `mapping.txt`, or set `project.mapping` in the config under `--root`. Until then nothing in it is the app's |
    | a warning that frames R8 wrote have no place in the mapping, or name another mapping's id | the mapping is another build's: find the one that froze before reading the names |
    
    `--json` is the same findings in the shape you walk: `chains`, `main.stack`,
    `main.waiting_for` / `.gc`, `working[].where` / `.top` / `.stack` / `.cut` /
    `.waiting_for`, `nearest`, `leads`, `lock_notes`, `heap`, `code.placed`,
    `code.is_the_build`, `event`, `retrace` and `minified`.
    Read it rather than the file: the frames that decide sit three to six deep,
    and `awk` over the dump is what this replaces.
    
    The idle main thread is the case that wastes a day if you miss it: the dump is
    a snapshot taken five seconds in, and whatever caused the freeze had often let
    go by then. Reading its top frame as the culprit sends you into Android's
    message queue.
    
    Then `echolot mark --from-anr report.txt` proposes markers on the methods that
    were on the stack, and refuses the ones that would lie — a line that falls in a
    different function than the frame names, a `return` in the body, a one-line
    body. Show the reasons rather than working around them.
    
    To measure a freeze rather than read about one, record long enough for
    `anr_risk` and `anr` to see it: the seconds until the freeze starts, plus the
    five an unanswered input event is given before the system declares an ANR,
    plus a few for it to write the record. A freeze eight seconds in needs about
    sixteen, past the default `duration_ms: 12000`.
    
    ## Reading the report
    
    How to read it is `references/report.md`, a page that names a topic for each
    part it leaves out (`references/report-schema.md` and the rest); one
    detector is `echolot explain <id>`. Three things here that you will get
    wrong without them. And one habit to drop: do not cut `report.json` up with
    jq or python one-liners. `echolot report` prints what fired,
    `echolot report --detector <id> --top 5` one detector's rows with the
    evidence kept short, `--window` and `--markers` the rest, `--json` any of
    them as a small json.
    
    **Silent detectors matter as much as firing ones.** They stay in the report
    with empty `rows`. Silence means that ground was checked and is clean — do not
    go there. Unless the detector says `checked: false`: the trace, or its window,
    did not hold what it reads, `reason` says what, and its empty `rows` say
    nothing about the app. report.md names those apart from `Silent`. A trace of
    another journey is `analyze <trace> --whole-trace`, and a stretch of one
    trace spotted in Perfetto is `analyze <trace> --range <start>..<end>` (raw
    trace ns, or `500ms..900ms` from the trace's start): neither is an edit of
    the config's anchors.
    
    **`self_ms` versus `total_ms`.** Self time, with children subtracted, is where
    the time actually went. `traversal` with `total_ms: 354` and `self_ms: 79` does
    almost nothing itself; dig into its children. Never add `total_ms` across rows:
    they nest inside one another. Nor `self_ms` across detectors: a disk wait
    inside a slice is in both. How much of the window the findings cover is
    `window.main_thread.in_rows_pct`, each moment counted once.
    
    **Warnings inside `window`.** If `start_anchor.matches == 0` or
    `end_anchor.matches == 0`, the window ran to the edge of the trace and none of
    the numbers are about your scenario.
    Fix the config rather than hunting a problem. Same for `process_alternatives` —
    you may be analysing the wrong process.
    A scenario with `window: launch` has no anchors: `window.defined_by` says what
    closed it, the launch's end, the end of the launch a splash handed the start
    over to, or the app's `reportFullyDrawn()`, and
    `defined_by_runs` in a merged report means the repeats did not agree: the app
    called it in some and not in others. A call before the first frame is the
    same window, counted in `before_first_frame_runs`, and not a disagreement.
    `window.after` is what the app drew after a launch closed on its first frame;
    with `material: true` the header's `After the window:` line says the content
    may have come after the window.
    
    **`frame_jank` is about single frames, not totals.** Most of the others
    aggregate by name and gate on sums, which is right for "cold start got slower"
    and blind to a heavy tail: one 86 ms frame among thousands disappears into
    every sum there is. This one reads SurfaceFlinger's per-frame record instead,
    so it needs no instrumentation and answers a question the sums cannot.
    
    Its `total_ms` and `max_ms` are time **past the deadline**; the frame's own
    length is in `detail`, which is where a benchmark's percentiles can be matched.
    `detail` also leads with the platform's verdict on whose deadline was missed —
    `Self Jank` is the app, `Other Jank` is the compositor and is not something to
    go into the code over. `Buffer Stuffing` is neither: frames queued behind the
    one before reach the screen late and smoothly, latency rather than stutter, so
    that row counts its frames with 0 past the deadline and comes after every late
    frame. A frame that also missed a deadline keeps the miss's tag, and its
    overrun includes the wait in the queue. Nor is `Dropped Frame`: frames
    dropped for a later one were never shown, and whose they were the trace does
    not say, so that row counts them with 0 past the deadline too, after the
    late frames, its `detail` leading with `never shown`.
    
    Its silence is ambiguous: no bad frames, and no frame timeline in the trace at
    all, look the same. Android 11 and below have none, and neither does a capture
    that did not ask for it. Check before calling a scenario smooth.
    
    It judges the app's windows and nothing else. A map, a game or a video a
    thread of the app draws into a `SurfaceView` with Vulkan or GL has no frame in
    the timeline; the report says how many it presented there, on which thread and
    with which call (`window.frames.unjudged`), and a silent `frame_jank` says
    nothing of them.
    
    ## From a finding to the code
    
    1. A firing detector gives you a `location` — a slice or thread name.
       A row with `code` has already been placed: `places[].file` and `.line`
       name the method that waited for a lock and the one holding it, the class
       a View slice is, or, in a sampled recording, the app's own method the
       samples found (role `sampled`). Open that; skip the grep.
    2. The `domains` section of `echolot.yml` maps that name to a module and file.
    3. Not in `domains`? Run `echolot domains --root .` — it maps literals inside
       `trace("...")` and names kept in a `const val` and passed through the
       project's own wrapper. Still nothing? Grep the repository for the slice
       name: a literal survives minification and is found exactly, and a
       constant's declaration is one grep away from its calls.
    4. Nothing found? The slice is most likely a system one (`bindApplication`,
       `Choreographer#doFrame`, `binder transaction`). See `references/naming.md`.
    
    When `uninstrumented_cpu` fires in a recording without `runner.sampling`,
    there is no code behind the finding by definition: the thread burned CPU with
    no instrumentation. That is an address for adding `trace{}`, not the location
    of a bug. In a sampled recording, `detail` names what ran on the stacks, then
    `ours:` and the app's own method under it, and `code` and `places[]` (role
    `sampled`) give its file: open that first. `ours: none` is work a pool ran
    with its caller off the stack; `ours: cut` is a stack that ended in the
    framework before anything of ours.
    
    **`main_thread_outlier` is not `main_thread_block` again.** One gates on the
    sum for a name and answers "where did the time go"; the other gates on a
    single occurrence against the median for that same name and answers "which one
    was out of line". A name in both is telling you two things.
    
    They lead to different places in the code. Expensive every time means the fix
    is in that work. Usually fine and once not means the cause is the state it hit
    that once — a cold cache, a lock, a first-run path. `detail` carries the median
    and how many occurrences it came from, which is what to hold a benchmark's
    percentiles against.
    
    ## Boundaries
    
    The tool **localises one specific regression**: you know "it was 3 s, now it is
    7 s" and need to find where. It does not search for the unknown across a pile
    of traces. A complaint about how it is now — "the list stutters", with no
    earlier build to set it against — is hunted all the same and answered as what
    it is: what counts as slow for the scenario, how this build stands against
    it, and where it spends its time, not a located change. Traces of an earlier
    build make it one, and the `echolot-hunt` skill asks for them.
    
    Networking in benchmarks is mocked on purpose — we hunt problems in code, not
    network speed.
    
    Thresholds are tied to a device and a scenario. When either changes, run
    `echolot calibrate` on healthy runs instead of nudging numbers by hand.
    
    When the question is about the tool rather than the app — "how did that
    session go, what should change in echolot" — that is `/echolot reflect`
    (the `echolot-reflect` skill), not a hunt.
    
    ## References
    
    - `references/report.md` — how to read a report, in one page, and which topic has the rest;
      open the one topic a question needs, never all of them:
      - `references/report-schema.md` — `report.json` key by key
      - `references/report-window.md` — where the window went: the main thread, crowding, frames, startup
      - `references/report-environment.md` — the device: clock, temperature, compile state, sampling
      - `references/report-markers.md` — the markers table
      - `references/report-checks.md` — every check before a conclusion, with what to do
      - `references/report-columns.md` — every column of a row, the ranking, `spread`
      - `references/report-detectors.md` — every detector, and what matters about each
      - `references/report-compare.md` — `echolot compare`: its fields and its warnings
    - `references/config.md` — the `echolot.yml` sections, what the code reads and what it does not
    - `references/naming.md` — how ART names GC, locks and binder; facts from live Android 14
    - `references/collect.md` — capturing a trace: perfetto and adb commands, verified in practice
    

Comments

Sign in to join the conversation.

No comments yet. Start the conversation.

Reviews (0)

No reviews yet.