finderscope
finderscopev0.4.0MIT
Turn V8 CPU and heap profiles into short, ranked reports with runnable next commands for coding agents.
Install
npm install finderscope- Source on GitHub
- Uses: archstrict, nukadoko, stryker-agent-reporter
- Used by: autospawn
finderscope turns a V8 profile (.cpuprofile, .heapprofile, or .heapsnapshot) into a short, ranked report that a coding agent can read in one pass.
The report ends with a do: line that names the next command to run.
Its summary ranks the functions the agent can edit by the cost they caused.
Each sample belongs to the deepest function in your own code, so time spent inside a dependency counts against the code that called it.
Features
Section titled “Features”- Profile a command.
finderscope run -- <command>profiles the command and keeps a scratch directory with the profile and the child’s output. It writes the full report toreport.txt, orreport.jsonwith--json. - Your code first.
ownmeans real source the agent can edit. Each row shows a function’s self time and its three largest calls into other areas, such as a package. The firstimport()orrequire()of a JavaScript file counts as module loading, the same as a static import, and the summary adds anote:when module loading is at least half of a CPU profile. - Commands to dig in.
top,callers,callees, andlinestake a function key exactly as a report printed it, or a name that matches one function. A failed lookup prints up to three runnable commands for the closest keys. - Time windows.
timelinesplits a CPU profile into 20 equal buckets, and--fromand--tolimit any report to one window. - Memory.
run --heaprecords a heap profile, andrun --heap-snapshotwrites a snapshot asheapUsedreaches higher peaks.retainers <snapshot> <constructor-or-#id>shows what retains an object. - Comparison and JSON.
finderscope diff <before> <after>compares two profiles. Every--jsonreport has a top-levelunit,"us"for a CPU profile or"bytes"for a heap profile.
How an agent uses it
Section titled “How an agent uses it”The package includes a skill with a short profiling workflow.
- Run
finderscope run -- <command>. - Read the fix candidates and the
do:line at the end. - Run the
do:command, such asfinderscope lines, thencallersorcalleesto follow the cost. - After a change, compare the old and new profiles with
finderscope diff.
Every argument in a do: command is single-quoted, so the line survives sh -c whatever the path contains.
Getting started
Section titled “Getting started”npm install --save-dev finderscopenpx finderscope run -- node app.js