Local stdout/stderr capture for AI coding agents. Run any process under trail, then ask Codex, Claude Code, Cursor, Windsurf, or another MCP-capable agent to query the captured logs without pasting terminal output into chat. Single static binary.
FAQ
trail is a Claude Code plugin with 2 hand-picked skills for development work, indexed on Flowy. Install it with the command on its page. It includes debug-with-trail, debug-with-trail. Its skills do not fire on their own yet. Request auto-invocation to have Flowy route them as you prompt. Free and open source.
> /plugin marketplace add Pratham-Mishra04/trail> /plugin install trail@pratham
Local stdout/stderr capture for AI coding agents.
Run any process under trail, then ask Codex, Claude Code, Cursor, Windsurf, or another MCP-capable agent to query the captured logs without pasting terminal output into chat.
Single static binary. Plain JSONL files on disk. No daemon, no database, no cloud.
Trail is most useful when the agent needs to move beyond "read the last error" and run a disciplined debugging loop: inspect captured logs, keep a ledger, add temporary probes only when needed, wait for the dev server to restart, reproduce the issue, verify the fix, and remove every probe.
The important constraint is cleanup. Every temporary log line carries a unique TRAIL-DEBUG-<id> marker, and the workflow is not done until the agent verifies that marker is gone from the repo.
All integrations need the trail binary on your PATH first:
curl -fsSL https://raw.githubusercontent.com/Pratham-Mishra04/trail/main/install.sh | sh
trail version
Then add the integration for your agent.
codex plugin marketplace add Pratham-Mishra04/trail --ref main
codex plugin add trail@pratham
Start a new Codex thread, then ask:
Use Trail to list my captured sessions.
/plugin marketplace add Pratham-Mishra04/trail
/plugin install trail@pratham
/reload-plugins
Verify by asking:
What skills are available?
You should see pratham:trail:debug-with-trail.
Use the manual MCP config in Editor Setup. You will get the list_sessions and get_logs tools, but not the bundled Codex/Claude guided debugging skill.

Wrap the process you want to debug:
trail run -- npm run dev
Trail prints a session id and file path, then forwards your app's stdout/stderr normally while also capturing every line:
trail: capturing "npm run dev" -> 39f6875e-3417-4146-867b-c430971b7489 (file: /Users/you/.config/trail/sessions/39f6875e-3417-4146-867b-c430971b7489.jsonl)
Now ask your agent:
List my Trail sessions, then show me the errors from the most recent one.
Or query from the terminal:
trail sessions
trail logs --session 39f6875e-3417-4146-867b-c430971b7489 --level error
trail logs --session 39f6875e-3417-4146-867b-c430971b7489 --query "ECONNREFUSED"
The agent calls list_sessions and get_logs over MCP. Trail filters the logs in the Go process and returns structured results instead of a wall of text.
trail run -- <cmd> wraps any command, captures stdout/stderr, forwards signals, and mirrors the child's exit code.trail docker <container> captures docker logs -f for an already-running container.trail mcp exposes list_sessions and get_logs over stdio MCP.trail sessions and trail logs --session <id> expose the same query surface in the terminal.~/.config/trail/sessions/.The Codex and Claude Code plugins ship a debug-with-trail skill for runtime debugging. It turns Trail into a repeatable agent workflow for server crashes, failing tests, silent failures, and "what happened in the logs?" investigations.
Ask in plain English:
My Express server returns 500 on POST /orders. Use Trail to debug it.
The skill walks the agent through:
trail is installed and the relevant process is being captured.TRAIL-DEBUG-<id> marker.rg TRAIL-DEBUG-<id> returns nothing.The cleanup rule is the important part: every added probe carries a unique marker, and the agent is instructed to remove the whole log statement after the fix is verified.
Read the exact skill instructions:
npm run dev, python manage.py runserver, go run ., or any other server and let the agent query only the relevant logs.trail run -- go test -v ./..., trail run -- pytest -v, or trail run -- npm test, then ask what failed and why.trail docker <name> to make container logs queryable without flooding the agent context.In every case, the pattern is the same: attach terminal output to your agent by handing it a session id, instead of piping logs through prompts.
The Codex and Claude Code plugins are the recommended setup because they include both MCP wiring and the guided debugging skill.
For manual MCP setup, make sure trail is on the $PATH of the shell that launches your editor. macOS GUI apps do not always inherit your shell path; if the MCP server fails to start, check which trail from the editor's terminal.
claude mcp add trail -s user -- trail mcp
This path wires up the raw MCP tools (list_sessions, get_logs) only — it does not include the bundled debug-with-trail skill.
.cursor/mcp.json:
{
"mcpServers": {
"trail": {
"command": "trail",
"args": ["mcp"]
}
}
}
Settings -> MCP:
{
"mcpServers": {
"trail": {
"command": "trail",
"args": ["mcp"]
}
}
}
claude_desktop_config.json:
{
"mcpServers": {
"trail": {
"command": "trail",
"args": ["mcp"]
}
}
}
curl -fsSL https://raw.githubusercontent.com/Pratham-Mishra04/trail/main/install.sh | sh
The installer detects your OS/arch, downloads the matching prebuilt binary from the latest GitHub Release, verifies its SHA-256 checksum, and installs trail to ~/.local/bin/trail.
If ~/.local/bin is not on your $PATH, the installer prints the exact export line to add. Override the destination with BIN_DIR=/usr/local/bin or pin a version with VERSION=v0.1.0.
wget works too:
wget -qO- https://raw.githubusercontent.com/Pratham-Mishra04/trail/main/install.sh | sh
ARCHIVE=trail_darwin_arm64.tar.gz
BASE=https://github.com/Pratham-Mishra04/trail/releases/latest/download
wget "$BASE/$ARCHIVE"
wget "$BASE/checksums.txt"
grep " $ARCHIVE\$" checksums.txt | shasum -a 256 -c -
tar xzf "$ARCHIVE"
sudo mv trail /usr/local/bin/
Available archives:
trail_darwin_arm64.tar.gztrail_darwin_amd64.tar.gztrail_linux_arm64.tar.gztrail_linux_amd64.tar.gzgo install github.com/Pratham-Mishra04/trail@latest
Go's go install does not inject release metadata, so trail version may print trail dev (commit none, built unknown). The binary still works normally.
git clone https://github.com/Pratham-Mishra04/trail
cd trail
make install
This runs go install with version metadata baked in. The binary lands at $(go env GOPATH)/bin/trail.
macOS and Linux on amd64/arm64. Windows is not supported.
When an agent reads raw log files into its context to filter them, every query pays for re-loading the file's tokens through the LLM. Trail filters in the Go process and returns only matching entries.
This means:
| Source | Command | Notes |
|---|---|---|
| Wrapped command | trail run -- <cmd> | Wraps any binary; separate stdout/stderr pipes preserve stream attribution. |
| Docker container | trail docker <name> | Wraps docker logs -f; passes --since through. |
Both commands accept --name <label> to override the auto-derived session name and --ephemeral to delete the session file when the capturer exits cleanly. The file survives a SIGKILL; only graceful shutdown triggers cleanup.
Trail does not capture:
ptrace or eBPF.tail, lnav, or normal file tools for those.The MCP server exposes two tools:
list_sessions(active_only?, limit?): returns session metadata including the absolute file path of each session JSONL file, ordered active-first.get_logs(session_id, filters?): returns matching entries.get_logs filters include:
limit, page, and orderquery as a case-insensitive regexlevel: error, warn, info, debug, unknown, or allstart_time / end_time as RFC3339 timestampsduration as a Go-style duration, such as "10m" or "2h"start_line / end_lineTime-window, duration, and line-range filters are mutually exclusive. Combining them returns an error.
If a result looks incomplete, the response includes the absolute file_path and the agent can read the JSONL file directly with its file tools.
trail sessions # table
trail sessions --json # JSON for scripting
trail sessions rm <id> # delete one
trail sessions rm --all # delete all
trail logs --session <id> # last 100, pretty
trail logs --session <id> -n 50 # last 50
trail logs --session <id> --level error # errors only
trail logs --session <id> --query "ECONNREFUSED" # case-insensitive regex
trail logs --session <id> --format json # raw JSON entries
trail logs --session is required. There is no implicit "most recent" default; the MCP tool follows the same rule.
trail run / trail docker) own session files. The MCP server is read-only and spawned by the editor on demand; it never starts, modifies, or stops captures.~/.config/trail/sessions/<uuid>.jsonl. The first line is a meta header; every subsequent line is one captured entry.os.OpenFile(O_APPEND)); maxRawLen caps the Raw/Message fields but not the whole marshaled JSON line, so concurrent reads rely on the reader being tolerant of malformed or partial trailing lines (see internal/store/reverse.go and TestRead_TolerantOfPartialLastLine) rather than on kernel-level atomicity.Order=newest, Limit>0, Page≤1, no time/line bounds) use a reverse scan from the end of the file.level field, logfmt level=, or an anchored prefix like ERROR:.MIT
.agents/
plugins/
marketplace.json
.claude-plugin/
marketplace.json
.github/
dependabot.yml
workflows/
release.yml
.gitignore
.goreleaser.yml
docs/
architecture.png
guided-debugging-flow.svg
go.mod
go.sum
install.sh
integrations/
claude-code/
.claude-plugin/
plugin.json
.mcp.json
README.md
skills/
debug-with-trail/
examples.md
reference.md
SKILL.md
codex/
.codex-plugin/
plugin.json
.mcp.json
README.md
skills/
debug-with-trail/
examples.md
reference.md
SKILL.md
internal/
capture/
banner.go
capture_test.go
capture.go
exec_signal_test.go
exec.go
run_test.go
run.go
cli/
cli.go
docker.go
logs.go
mcp.go
run.go
sessions.go
theme.go
version.go
docker/
docker.go
logentry/
logentry.go
sessionview.go
logger/
logger_test.go
logger.go
mcp/
handlers_test.go
handlers.go
server.go
tools.go
parser/
parser_test.go
parser.go
store/
jsonl.go
meta.go
perf_test.go
reverse.go
store_test.go
store.go
LICENSE
main.go
Makefile
README.md
tests/
mcp_load_test.go© 2026 Flowy · Free and open source
Built for Claude Code · Not affiliated with Anthropic