AgentScope uses adapters to convert agent tool-call logs into the standard trace format. This document outlines the adapter roadmap: what they are, which agents are targeted, and what the interface looks like.
The CLI recorder (npm run agentscope -- record -- <command>) is a good starting point: it wraps a shell command and captures exit code, stdout, stderr, duration, working directory, and git branch.
But the most valuable trace data comes from the agent's own tool calls: every file read, every code edit, every command executed, every test result, and every summary. These are the building blocks of a full agent run timeline. The CLI recorder cannot see them because it only wraps one process.
Adapters bridge that gap. They read the agent's native log format and normalize it into the AgentScope trace schema -- giving you a complete, interactive timeline in the Web UI.
| Source | What the CLI recorder captures | What an adapter adds |
|---|---|---|
npm test |
exit code, stdout, stderr, duration | -- |
| Agent tool calls | -- | file reads, code edits, command runs, test results, summaries, risk assessment |
The following agents are on the roadmap. Generic JSONL and Session JSON are available now; native agent-specific parsers are still planned.
| Adapter | Input source | Status |
|---|---|---|
| Generic JSONL | Line-delimited JSON with tool calls | MVP available |
| Session JSON | JSON array/object with common tool-call fields | MVP available |
| Claude Code native | Session export or hooks output | Planned |
| Codex native | Session log or export | Planned |
| Cursor | Export or local log | Planned |
| Aider | Chat log / edit history | Planned |
Every adapter follows the same contract:
Input: a source of raw agent data (JSONL file, session export, CLI hook output, log file).
Output: an object conforming to docs/trace-schema.json. The output includes:
schemaVersion: always"1.0.0"runs: array ofAgentRunobjects, each with:- Run metadata:
id,title,agent,branch,status,trustScore,startedAt,duration,cost - Summary metrics:
filesChanged,commands actions: array ofTraceActionobjects, each with:id,type,title,timestamp,duration,risk,summary,details- Optional:
file,command,output,diff
- Run metadata:
The adapter should fill as many fields as the source data allows. Missing optional fields default to undefined -- the Web UI handles them gracefully.
The first adapter shipped is a generic JSONL importer. It reads line-delimited JSON files where each line represents one agent action and converts them into a valid AgentScope trace.
npm run agentscope -- import-jsonl examples/generic-agent.jsonlThis produces .agentscope/YYYY-MM-DD-HHmmss.trace.json. Validate the output with:
npm run agentscope -- validate .agentscope/2026-06-06-140342.trace.jsonThen import the trace into the Web UI via the Import button or drag-and-drop.
Each line is a JSON object with these fields:
| Field | Required | Default | Notes |
|---|---|---|---|
type |
Yes | -- | One of: read_file, edit_file, run_command, test_failed, test_passed, generate_summary |
title |
No | "Untitled action" |
Short label for the timeline |
timestamp |
No | Import time | Action start time (e.g. "14:03:12") |
duration |
No | "0s" |
Action duration (e.g. "18s", "1m 12s") |
risk |
No | "low" |
One of: low, medium, high |
summary |
No | title or "Untitled action" |
One-to-two sentence description |
details |
No | [] |
Array of evidence strings |
file |
No | -- | File path (for read_file / edit_file) |
command |
No | -- | Shell command (for run_command / test actions) |
output |
No | -- | Captured stdout / stderr |
diff |
No | -- | Unified diff (for edit_file) |
See examples/generic-agent.jsonl for a 7-action trace covering all 6 action types.
{"type":"read_file","title":"Read config","file":"src/config.ts","risk":"low","summary":"Inspected config file for the rate-limit setting."}
{"type":"edit_file","title":"Bump rate limit","file":"src/config.ts","risk":"medium","summary":"Changed rate limit from 100 to 200.","details":["Default rate limit was too low for production traffic"]}
{"type":"run_command","title":"Run tests","command":"npm test","risk":"low","summary":"All tests pass."}When converting JSONL to a trace, the adapter auto-generates run-level fields:
run id:run-jsonl-<timestamp>(e.g.run-jsonl-2026-06-06-140342)agent:"Generic JSONL"branch: detected from current git branchstatus: inferred from action types (failedif anytest_failed, otherwisepassedif anytest_passed, otherwisewarning)trustScore: 85 for passed, 60 for warning, 35 for failedfilesChanged: count of unique files inedit_fileactionscommands: count ofrun_command/test_failed/test_passedactions
Each adapter exposes a single entry point:
// Generic sketch -- not implemented
interface Adapter {
/** One-line label shown in UI / CLI. */
readonly name: string
/** Parses raw agent output into an AgentScope trace. */
parse(input: string): AgentScopeTrace
}
// Example: a generic JSONL adapter
function parseJsonl(raw: string): AgentScopeTrace {
const lines = raw.trim().split('\n').map(line => JSON.parse(line))
return {
schemaVersion: '1.0.0',
runs: [
{
id: generateRunId(),
title: inferTitle(lines),
agent: inferAgent(lines),
branch: inferBranch(),
status: inferStatus(lines),
trustScore: computeTrust(lines),
startedAt: lines[0]?.timestamp ?? '',
duration: computeDuration(lines),
cost: inferCost(lines),
filesChanged: countUniqueFiles(lines),
commands: countCommands(lines),
actions: lines.map(normalize),
},
],
}
}
function normalize(entry: Record<string, unknown>): TraceAction {
return {
id: entry.id as string,
type: mapActionType(entry),
title: readString(entry.title) ?? readString(entry.action) ?? 'Untitled action',
timestamp: readString(entry.timestamp) ?? '',
duration: readString(entry.duration) ?? '',
risk: inferRisk(entry),
summary: readString(entry.summary) ?? '',
details: readStringArray(entry.details),
file: readString(entry.file),
command: readString(entry.command),
output: readString(entry.output),
diff: readString(entry.diff),
}
}
function readString(value: unknown): string | undefined {
return typeof value === 'string' ? value : undefined
}
function readStringArray(value: unknown): string[] {
return Array.isArray(value) && value.every(item => typeof item === 'string') ? value : []
}The normalize function is the core of each adapter: it maps one raw tool-call entry to one TraceAction. The action type mapping depends on the source agent's naming conventions.
The Session JSON adapter imports common Claude/Codex-style session exports without requiring an exact upstream schema. It accepts either a JSON array or a JSON object with events, messages, actions, entries, toolCalls, tool_calls, or steps.
npm run agentscope -- import-session examples/agent-session.jsonThe adapter recognizes common tool-call fields such as tool, tool_name, input.file_path, input.command, output, result, and patch, then maps them to AgentScope action types. See docs/session-json.md for the full field mapping and limitations.
- Generic JSONL adapter (available). A line-delimited JSON format that any agent framework or log exporter can emit. This gives immediate coverage for all agents without writing agent-specific parsers.
- Session JSON adapter (available). A permissive importer for JSON session exports with common Claude/Codex-style tool-call fields.
- Claude Code / Codex native adapters (next priority). Native parsers can preserve richer metadata once stable export samples are available.
- Cursor / Aider (later priority). Cursor logs and Aider chat/edit history may require more normalization work.
- Adapters do not read private IDE internal data. They only process publicly exported logs, session files, or hook output that the user explicitly provides.
- No unauthorized log scraping. Adapters are passive parsers; they consume files the user chooses to feed in.
- The trace schema will evolve. Adapter authors should pin a
schemaVersionand be prepared for minor breaking changes as the format stabilizes. - Agent output formats change. Each adapter may need periodic updates when the upstream agent changes its export format.
See CONTRIBUTING.md for general contribution guidelines. Adapter contributions should include:
- A parser module under
bin/agentscope.jsor a futuresrc/adapters/directory, depending on scope - A test that parses a real (anonymized) session export and produces a valid trace
- Updated
docs/adapters.mdwith the new adapter entry
If you have exported agent session data you are willing to share for testing, please include a small, anonymized sample.