open-agentlens
Installation
SKILL.md
Open in AgentLens
AgentLens has no log directory of its own. It visualizes one planner trace (one agent reply) at a time. The Salesforce CLI writes those traces inside the user's DX project:
<project>/.sfdx/agents/<AgentApiName>/sessions/<sessionId>/
metadata.json, turn-index.json, transcript.jsonl <- bookkeeping, NOT traces
traces/<planId>.json <- one per agent reply; this is what opens
Copies saved with sf agent preview --output-dir land in <dir>/<Agent>/session_<sessionId>/ (default temp/agent-preview). Older CLIs wrote .sfdx/agents/<Agent>.agent/traces/<sessionId>-<planId>.json. The script reads all three layouts. Don't pick files by hand.
How to open
The script is scripts/open-agentlens.mjs, inside this skill's own folder (the folder that holds this SKILL.md). It needs Node 18+. Run it from the DX project directory (any subdirectory works), using the script's absolute path:
node <skill-folder>/scripts/open-agentlens.mjs [path] [--agent <name>] [--session <id>] [--turn <n|last>] [--plan <planId>]