Skip to content

Pixel-CLI/pixel / .agents/skills/pixel-retro

pixel-retro

Verified

Mine the last 24 h (or a given window) of pixel usage — every repo's `.pixel/actions.jsonl` plus the agent transcripts indexed by `pixel recall` (claude, codex, pi…) — for frictions pixel actually caused, verify each one against the current binary and code, and propose ranked, evidence-backed improvements (bug fix, error message, flag, agent prompt, rule, doc); for the pixel repo itself, also measure each pull request from first edit to validated CI and where agents sat idle (`lead_time.py`). Suggests only; implements nothing without the user's pick. Use when the user says "/pixel-retro", "retro pixel", "qu'est-ce qui a coincé avec pixel", "améliorations pixel depuis les transcripts", "pixel friction", "où l'agent attend", "bottleneck", "lead time", or asks what to improve in pixel or its development workflow from recent sessions.

FileKindSize
SKILL.mdskill md21.9 KB
adherence.pyscript18.3 KB
lead_time.pyscript22.7 KB
ledger.pyscript1.5 KB
roots.pyscript3.2 KB
slow.pyscript5.6 KB
test_adherence.pyscript9.6 KB
test_lead_time.pyscript17.4 KB
test_slow.pyscript2.4 KB
# SPDX-FileCopyrightText: The Pixel contributors
# SPDX-License-Identifier: MIT

"""Group the slow read ops of a window by how they were served.

Usage: python3 slow.py <window> <actions.jsonl>... [--min-ms 5000]
       (window: 12h, 7d, 3w, or an ISO date, as for roots.py)

Each slow line is attributed from its `serve` steps (pixel >= #241): the
route that answered, the in-process reason, and the phase that took the
most time. Lines are grouped on (command, route, reason, phase) with their
count, total and worst duration, and the invocation ids of the three worst,
so every number in the report can be re-opened. A line without `serve`
predates the field and lands in the `unattributed` group: its cause is
unknown, and a warm replay will not reproduce a cold start.

`recall` counts only for its read subcommands (`search`, `ask`,
`context`, `show`, `sessions`, `status`): `index`, `embed`, `setup`,
`export` and `daemon` write, and a slow ingest is not a slow answer.

Runs of pixel's own test suite are counted apart, never mixed into the
groups: a cwd under a `crates/` directory, or in the system temp dir
(`/var/folders/` on macOS, `/tmp/` on Linux) except the `/tmp/pxwt/`
worktrees the skill reads on purpose.

A line is counted once, by its `invocation_id`, however many logs hold it:
a worktree bootstrap that copies the main checkout's `.pixel/` copies its
`actions.jsonl` too (four copies of one `find-symbol` on 2026-10-16 read as
`n=4 repos=4`). `repos` counts the distinct `cwd` the calls ran in, not the
files they were read from.
"""
import collections, datetime, json, re, sys

UTC = datetime.timezone.utc
READ_OPS = re.compile(r"(search-|find-).*|impact|who-calls|call-path|scope-task|pack-context|recall|status|repo-state")
RECALL_READS = {"search", "ask", "context", "show", "sessions", "status"}
PHASES = ("probe_ms", "start_ms", "request_ms", "open_ms", "handle_ms")
TEST_CWD = re.compile(r"/crates/|^/(private/)?var/folders/|^/(private/)?tmp/(?!pxwt/)")


def is_read_op(event):
    """A read op by command, and for `recall` by the subcommand in `args`
    (`args` may open on global flags: `--metrics off recall show …`)."""
    command = event.get("command", "")
    if not READ_OPS.fullmatch(command):
        return False
    if command != "recall":
        return True
    words = event.get("args", "").split()
    after = words[words.index("recall") + 1:] if "recall" in words else []
    return bool(after) and after[0] in RECALL_READS


def parse_window(arg, now):
    m = re.fullmatch(r"(\d+)([hdw])", arg)
    if m:
        hours = {"h": 1, "d": 24, "w": 168}[m.group(2)] * int(m.group(1))
        return now - datetime.timedelta(hours=hours)
    start = datetime.datetime.fromisoformat(arg)
    return start if start.tzinfo else start.replace(tzinfo=UTC)


def attribute(event):
    """(route, reason, dominant phase) of one event; the step with the
    longest phase decides, since the first request usually pays a cold start."""
    best = None
    for step in event.get("serve") or []:
        for phase in PHASES:
            ms = step.get(phase)
            if isinstance(ms, int) and (best is None or ms > best[0]):
                best = (ms, step.get("route", "?"), step.get("reason", "-"), phase)
    if best is None:
        return ("unattributed", "-", "-")
    return best[1:]


def identity(event):
    """What makes two log lines one invocation: its id, or for a line
    without one its pid, time and arguments."""
    return event.get("invocation_id") or (event.get("pid"), event.get("ts_ms"), event.get("args"))


def collect(paths, since_ms, min_ms):
    """(groups, test-suite lines skipped, copies dropped) over `paths`."""
    groups = collections.defaultdict(list)
    skipped = copies = 0
    seen = set()
    for path in paths:
        with open(path) as log:
            for line in log:
                try:
                    event = json.loads(line)
                except ValueError:
                    continue
                if (event.get("ts_ms", 0) < since_ms
                        or event.get("duration_ms", 0) < min_ms
                        or not is_read_op(event)):
                    continue
                if identity(event) in seen:
                    copies += 1
                    continue
                seen.add(identity(event))
                if TEST_CWD.search(event.get("cwd", "")):
                    skipped += 1
                    continue
                key = (event["command"],) + attribute(event)
                groups[key].append((event["duration_ms"], event.get("invocation_id", "?"), event.get("cwd", path)))
    return groups, skipped, copies


def main(argv):
    min_ms = 5000
    if "--min-ms" in argv:
        i = argv.index("--min-ms")
        min_ms = int(argv[i + 1])
        del argv[i:i + 2]
    if len(argv) < 2:
        sys.exit(__doc__)
    since_ms = parse_window(argv[0], datetime.datetime.now(UTC)).timestamp() * 1000
    groups, skipped, copies = collect(argv[1:], since_ms, min_ms)
    print(f"slow read ops >= {min_ms} ms since {argv[0]}: {sum(map(len, groups.values()))} line(s)"
          f", {skipped} from the test suite left out, {copies} copied line(s) counted once")
    for key, rows in sorted(groups.items(), key=lambda kv: -sum(r[0] for r in kv[1])):
        rows.sort(reverse=True)
        command, route, reason, phase = key
        repos = len({r[2] for r in rows})
        worst = ", ".join(r[1] for r in rows[:3])
        print(f"{command:<15} {route:<14} {reason:<19} {phase:<10} n={len(rows):<3} repos={repos} "
              f"total={sum(r[0] for r in rows)} max={rows[0][0]}  worst: {worst}")


if __name__ == "__main__":
    main(sys.argv[1:])
reverse-engineer-anythingmorluto/reaReverse engineer native, managed, Electron/JavaScript, packaged, firmware, and browser targets with REA, and build agent environments (AgentEnv bundles) of web applications from a live instance or a capture, and of Linux desktop apps with a task from a request. Use shipped-artifact or requested runtime evidence to explain features, compare versions, decompile code, or guide a reconstruction. Skip REA for ordinary source-repository architecture analysis.Stars: 469kUpdated Claude CodeCodexVerifiedInstall
diagnosing-superpowersobra/superpowersUse when a superpowers session went wrong and your human partner wants to know why — repeated work, ignored plans, stumbles, poor results, a skill that didn't fire, "it took too long", "why is it so expensive", "what is it doing" — or wants to build a bug report for the superpowers maintainers, for the current session or a past one identified by id or path, on any harness.Stars: 321kUpdated Claude CodeCodexVerifiedInstall
dispatching-parallel-agentsobra/superpowersUse when facing 2+ independent tasks that can be worked on without shared state or sequential dependenciesStars: 321kUpdated Claude CodeCodexVerifiedInstall
executing-plansobra/superpowersUse when executing an implementation plan in the current session as the implementer yourself — your human partner chose inline execution, or no subagent tool is availableStars: 321kUpdated Claude CodeCodexVerifiedInstall