RFC-0026: Distributing Perfetto skills to OSS coding agents #5892
Replies: 2 comments
|
Thanks for writing this up. Makes a lot of sense to me. |
0 replies
|
📝 RFC Document Updated View changes: Commit History |
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
📄 RFC Doc: 0026-distributing-skills-to-coding-agents.md
Distributing Perfetto skills to OSS coding agents
Authors: @LalitMaganti
Status: Implemented
The release bundle, agent extension manifests, fallback installer and user
documentation have landed. The implementation consolidated the original set of
skills into one
perfettoskill and supports agents through the manifests inai/extensions/orget.perfetto.dev/agents-install. See thecurrent AI documentation
for the authoritative installation instructions.
Problem
RFC-0025 section 3 sets out the broad direction
for AI integration outside the Perfetto UI: ship Perfetto-flavoured
skills so that any OSS coding agent
(Claude Code, Gemini CLI, OpenAI Codex, OpenCode) can drive
trace_processorto load, query and reason about traces. The seed commit39c023b
landed the first three skills in
ai/skills/and established theauthoring conventions.
This RFC pins down the packaging, distribution and update story.
Today, a user who wants Perfetto's skills inside their agent has to clone
google/perfetto, installtrace_processorseparately, and copyai/skills/*into the right location for each agent. They then have toremember to repeat that work whenever we ship changes. Concrete
problems:
trace_processorbinary are acquired throughdifferent channels, so users have to do two installs and keep both
versions in sync themselves.
trace_processorevolves.no marketplace listing, no docs page, no install snippet to paste.
This RFC proposes a single packaging mechanism, tied to the existing
Perfetto release process, that addresses all four for the four agents
that matter today while leaving room for the long tail.
Decision
Pending. The body proposes the following:
main, underai/skills/andai/extensions/<agent>/.ext/agentsbranch on each release. The branch carries a pristine, root-level
layout that every supported agent's install command can fetch
directly via git ref pinning. OpenCode reads the same content via
its
skills.urlsconfig.trace_processorPython wrapper(
tools/trace_processor) so users do not need a separatetrace_processorinstall step.on the Perfetto docs site under an AI integration page.
and copies the bundled skills and the
trace_processorscript intoa user-chosen path. This is the install path for any agent we do not
officially support (Cursor, Continue, homegrown agents).
trace_processorCLI plus skills cover the workflow.We do not ship an MCP server or a binary plugin, and we do not add
an
install-skillssubcommand totrace_processor.through at least one release cycle.
Design
Source-of-truth layout in
mainSkills are already at
ai/skills/. We add per-agent extension manifestsalongside, in their own subdirectories:
Each manifest holds the minimum the agent's loader requires: name,
version, the list of skills, and (when we choose to ship them later)
slash commands. There is no per-agent skill content. All four agents
use the agentskills.io
SKILL.mdformat, so a single canonicalskills/tree serves all of them.A skill's SKILL.md frontmatter can declare which install targets it
applies to. The release pipeline reads this and includes or excludes
the skill per target. The motivating case is
perfetto-infra-getting-trace-processor: it is needed for thefallback installer (where users may want to set up
trace_processormanually) but redundant for the native extensions (which bundle the
script).
The
ext/agentsrelease branchext/agentsis produced by the Perfetto release pipeline alongsidethe
trace_processorbinary release. Each commit to it corresponds1:1 with a Perfetto release tag, and the manifest
versionfields allcarry that tag. Treat it as a release artefact, not as a working
branch.
Its root is shaped to satisfy every agent's discovery contract at the
same time:
The branch carries only the extension surface. There is no
src/,docs/ortools/content. A user installing the extension pulls afew tens of kilobytes rather than the full
google/perfettotree.The four manifest filenames are namespace-distinct, so each tool only
sees its own. Skills live in one shared
skills/tree because all fourtools agree on
<root>/skills/<slug>/SKILL.mdand respect theagentskills.io frontmatter; nothing is duplicated.
Coupling to the release process
ext/agentsis part of the release artefact set, not built frommaindirectly. The whole point of this coupling is that the
trace_processorbinary, the bundled wrapper script and the skillsmove together: when users update one, they update everything. Doc and
skill state on
maindoes not surprise installed users mid-cycle.The release pipeline assembles the branch from
mainat the releasetag, copies in the manifests, skills (filtered by target), and the
trace_processorwrapper, sets every manifest'sversionfield tothe release tag, and commits. A separate linter step in regular
mainCI validates each manifest against its tool's schema so we catch
broken JSON before it reaches the release pipeline.
Every commit on
ext/agentsrecords the SHA of themaincommit itwas built from, in a small metadata file at the branch root. The
fallback install script is regenerated at the same release tag and
embeds that same SHA. When the script runs, it walks
ext/agentshistory (via a single GitHub API call) to find the commit whose
recorded SHA matches the embedded one, and downloads that commit's
tarball. This makes installs deterministic across release boundaries:
a user who saves the script locally and reruns it later gets the same
bundle they would have gotten on the day it was published, even if
newer releases have landed in the meantime.
Per-agent install commands
These five lines are the entire user-facing install surface:
/plugin marketplace add google/perfetto@ext/agentsgemini extensions install https://github.com/google/perfetto --ref ext/agentscodex plugin marketplace add google/perfetto --ref ext/agents"skills": { "urls": ["https://raw.githubusercontent.com/google/perfetto/ext/agents/skills/index.json"] }toopencode.jsoncurl -fsSL https://get.perfetto.dev/agents-install.sh | bash -s -- --target <path>Each tool's native update path applies for the first four. Claude
/plugin update, Geminiextensions update, the Codex marketplacerefresh, OpenCode's startup URL re-fetch. The release pipeline pushes
to
ext/agents; users get the changes through the channel theyalready know. The fallback script's update path is to re-run the same
command, which overwrites the target directory.
Bundling
trace_processorThe release pipeline vendors the auto-generated
tools/trace_processorPython wrapper intoext/agents/bin/. Userswho install the extension also get the script, so there is no
separate
trace_processorinstall step.The exact mechanism each native extension uses to expose the wrapper
to its skills (relative path from plugin root, declared
binin themanifest, install-time
PATHentry) is settled per-agent duringmanifest authoring.
Fallback installer
The installer script lives in
tools/inmain, alongside our otherend-user scripts, and is served from
get.perfetto.devthe same way.It downloads the
ext/agentstarball at the latest release tag (orthe ref passed via
--ref), extractsskills/andbin/trace_processorinto the path passed via--target, and printsa
PATHhint.The script is the install path for any agent without a native
extension. It is also the recommended path for users who want a single
on-disk source of truth regardless of agent, including OpenCode users
who want the bundled wrapper rather than installing
trace_processorseparately (
--target ~/.config/opencode/).Extension store / marketplace submissions
Each of the three plugin-style agents has, or is in the process of
establishing, a public extension index (Gemini CLI's
extensions index,
Claude Code's
code.claude.com/plugins, the upcoming Codex publicindex). We submit Perfetto's extension to each once it has been live
in
ext/agentsfor at least one release cycle. The submission foreach is a small, tool-specific PR; it is not on the critical path for
the docs page or for v1 install support.
OpenCode has no marketplace surface (plugins are discovered via npm),
so no submission is required.
Documentation
A new page on the Perfetto docs site carries the five install lines,
a one-line summary of each shipped skill, and a pointer to
ai/skills/README.mdfor teams who want to author or contribute theirown. It also documents the project-scope variant for each install
path, for teams who want to check skills into a shared repo
(
.claude/skills/,.opencode/skills/, etc.) so every developer onthe team gets the same baseline.
The page links back to this RFC and to RFC-0025.
Out of scope
Several adjacent topics come up in the same conversation but belong in
their own RFCs or follow-ups:
trace_processor(idle-timeout,optional parent-PID watch, stdin-EOF detection). The querying skill
already teaches the
--httpdbackground pattern and agents handlethe process lifecycle through their existing background-shell
tooling. Cleanup robustness is a
trace_processorwork-item, not apackaging one.
this. The packaging mechanism here would extend naturally because a
team's extension server can publish its own
index.jsonand ateam's local config can list multiple
skills.urls. The server-sideAPI is separate work.
/perfetto-load,/perfetto-investigate-jank, ...). Cheap, discoverable, easy toadd later once we know which workflows users repeatedly type in
natural language. Skills-only in v1.
perfetto_querytool or auto-spawn hooks. Deferred until there isevidence skills alone are insufficient.
Alternatives considered
A.
trace_processor ai install-skillssubcommandBundle the skills into the binary and ship a subcommand that copies
them into the user's agent skill directories.
Pros: Works fully offline. Skill version equals the binary version.
Cons: Snapshots at install time; users have to re-run after every
release. Encodes the agent skill-directory layout into
trace_processor, which leaks packaging concerns into the analysisengine. Each new agent we want to support requires a code change.
B. Subdirectory installs (no branch)
Use Codex's
--sparseand Claude'sgit-subdirsource format toinstall directly out of
main'sai/extensions/<tool>/subdirectories.
Pros: No release-pipeline branch building.
Cons: Gemini CLI does not support subdirectory installs for extensions
(only its standalone
gemini skills installdoes), so this approachcannot cover all four tools. Forces every install to clone the full
google/perfettohistory, which is hundreds of megabytes for a fewKB of extension content. Couples installed state to whatever happens
to be on
mainat the moment of install rather than to a release.C. First-class MCP server
Ship a
trace_processor mcpmode (or a separateperfetto-mcpbinary) that exposes the existing RPC as MCP tools, and have each
extension declare it as an MCP server in the agent's config.
Pros: MCP is a recognisable install ritual. Typed tool surface. Server
holds agent state. The server process is cleaned up automatically when
the agent dies (via stdio EOF).
Cons: Buys little over skills plus a CLI binary in practice. The
trace_processorCLI is well-shaped, agents construct shellinvocations reliably from a skill, and the long-running
--httpdmodealready covers iterative querying. An MCP layer is duplicate plumbing.
The cleanup advantage MCP enjoys is a property of stdio child
processes, not of the protocol; we can get the same property for
trace_processorvia a small--exit-on-stdin-eofor--idle-timeoutchange without adopting MCP.D. Custom OpenCode npm plugin
Publish
@perfetto/opencode-pluginto npm and rely on it for theOpenCode install path.
Pros: Matches OpenCode's documented plugin install ritual. Lets us
register custom tools and hooks alongside the skills.
Cons: OpenCode's plugin API cannot register skill paths at runtime;
the only first-class skill-distribution mechanism is
skills.urls,which we already use. An npm package adds a release artefact and a
publishing pipeline for what would, in v1, be a strictly worse
skill-discovery experience than the URL approach. Worth revisiting if
real users ask for the tool/hook surface.
Open questions
skills.urlscache invalidation behaviour needs aprototype. Confirm that pushes to
ext/agentspropagate to users onthe next session start and that the cache does not pin a stale copy
indefinitely.
bundled
trace_processorwrapper to skills (relative path fromplugin root, declared
binin the manifest, install-timePATHentry) needs to be settled per-agent during manifest authoring.
official non-default-branch example. Prototype the
google/perfetto@ext/agentsinstall upfront, before the releasepipeline work, to confirm the contract.
💬 Discussion Guidelines:
All reactions