Skip to content

lunkerchen/tracelog

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

5 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

๐Ÿ” TraceLog
Record, replay, and debug every step your AI coding agent takes.
The open-source observability layer for AI-assisted development.

status License: MIT Rust platform tests rules


What is TraceLog

TraceLog is a transparent activity recorder for AI coding agents. It intercepts every action โ€” file reads/writes, shell commands, API calls, MCP tool invocations โ€” and stores them in a local SQLite database. You can then replay, search, export, and debug the entire session.

Think of it as Sentry for AI agents. When Claude Code deletes your secrets.yml or runs rm -rf in the wrong directory, you can rewind and understand exactly what happened โ€” in 30 seconds.


Why TraceLog / Why Now

AI coding agents are black boxes. Claude Code, Codex CLI, Cursor Agent, Aider โ€” they operate through rapid sequences of tool calls, file modifications, and reasoning steps. When something goes wrong, you're left guessing:

  • Which file did it read before making that decision?
  • What was the exact shell command it ran?
  • Why did it choose that approach?
  • Which tool call produced the error?

Industry tools (LangSmith, Helicone, Arize) only see API calls. They miss the filesystem, shell, and MCP actions. TraceLog fills that gap.


Quick Demo

$ tl demo
๐ŸŽฌ TraceLog Demo Mode
ๆƒ…ๅขƒ๏ผš้–‹็™ผ่€…ๅซ Claude Code ๆ•ด็† config/ ็›ฎ้Œ„๏ผŒAgent ่ชคๅˆชไบ† secrets.yml...
โœ… sess_6a9ac1d...  claude-code  10 steps โš ๏ธ2

$ tl inspect sess_6a9ac1d... --anomalies-only
โš ๏ธ [2] ๐Ÿ“‚ ๅˆ—ๅ‡บ config/ ็›ฎ้Œ„ [sensitive-secrets-file]
โš ๏ธ [8] ๐Ÿ–ฅ๏ธ rm config/secrets.yml [destructive-rm]

Install

From source (recommended for now)

git clone https://github.com/lunkerchen/tracelog.git
cd tracelog
cargo build --release
sudo cp target/release/tl /usr/local/bin/
tl demo   # Verify it works

Requirements: Rust 1.80+, macOS 14+ or Linux. ~60MB of disk for build artifacts (binary is ~6MB).

Homebrew

brew install tracelog-dev/tap/tracelog

Cargo

cargo install tracelog

Quickstart

tl start --agent claude-code              # Start recording
# ... use Claude Code normally ...
tl stop                                    # Stop recording
tl sessions                                # List sessions
tl inspect <session> --anomalies-only      # See flagged steps
tl timeline <session>                      # ASCII timeline
tl export <session> --pretty -o trace.json # Export JSON
tl view --port 9876                        # Open local Web UI

Web UI

๐ŸŒ TraceLog Web UI โ†’ http://127.0.0.1:9876

# Open a specific session directly:
tl view --session sess_abc123...

# Custom port:
tl view --port 8080

Dark-themed local single-page app: session list โ†’ click to timeline โ†’ click step to expand detail.


How It Works

โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚          AI Coding Agent             โ”‚
โ”‚  (Claude Code / Codex / Cursor)      โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
               โ”‚ file I/O, shell, HTTP, MCP
               โ–ผ
โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚         TraceLog Interceptor         โ”‚
โ”‚  โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”  โ”‚
โ”‚  โ”‚ File I/O โ”‚ โ”‚ Shell  โ”‚ โ”‚ HTTP  โ”‚  โ”‚
โ”‚  โ”‚  Hook    โ”‚ โ”‚ Hook   โ”‚ โ”‚ Proxy โ”‚  โ”‚
โ”‚  โ””โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”˜ โ””โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”˜ โ””โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”˜  โ”‚
โ”‚       โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜      โ”‚
โ”‚         Unix Domain Socket          โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
                   โ–ผ
โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚      Daemon + Anomaly Engine          โ”‚
โ”‚  15 built-in security rules          โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
               โ–ผ
โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚  SQLite (~/.tracelog/tracelog.db)    โ”‚
โ”‚  All data stays on your machine.     โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

Commands

Command Description
tl start --agent <name> Start recording agent activity
tl stop Stop the active session
tl status Show recording status
tl sessions [--limit N] [--agent <name>] [--anomalies-only] List all sessions
tl inspect <session> [--anomalies-only] [--type <event>] Inspect session steps
tl timeline <session> [--from N] [--to N] ASCII timeline viewer
tl export <session> [--pretty] [-o <path>] Export as JSON trace
tl view [--port 9876] [--session <id>] Launch local Web UI
tl demo Built-in demo

Anomaly Detection (15 Rules)

Rule Pattern Risk Description
dangerous-rm-rf rm -rf ๐Ÿ›‘ Recursive force delete
dangerous-sudo sudo โš ๏ธ Privileged execution
dangerous-chmod-777 chmod 777 ๐Ÿ›‘ World-writable permissions
dangerous-curl-pipe-sh curl | sh ๐Ÿ›‘ Remote code execution
dangerous-git-push-force git push --force โš ๏ธ Force push
dangerous-git-reset-hard git reset --hard ๐Ÿ›‘ Destructive reset
destructive-rm any rm โš ๏ธ File deletion
sensitive-env-file .env โš ๏ธ Environment variables
sensitive-pem-key *.pem ๐Ÿ›‘ Private keys
sensitive-ssh-dir ~/.ssh/ ๐Ÿ›‘ SSH credentials
sensitive-aws-dir ~/.aws/ ๐Ÿ›‘ AWS credentials
sensitive-secrets-file file with "secret" โš ๏ธ Secrets exposure
sensitive-credentials "credential" โš ๏ธ Credentials exposure
long-running > 30s โ„น๏ธ Slow operations

Event Types (17)

Category Events
Session SESSION_START, SESSION_END
Filesystem FILE_READ, FILE_WRITE, FILE_DELETE, FILE_CHMOD, FILE_CHOWN, FILE_RENAME, FILE_READDIR
Shell SHELL_EXEC, SHELL_STDOUT, SHELL_STDERR
Network HTTP_REQUEST, HTTP_RESPONSE
MCP MCP_TOOL_CALL, MCP_TOOL_RESULT
Agent AGENT_THINK, AGENT_ACT
User USER_INPUT

JSON Trace Format

{
  "format_version": "1.0",
  "session": {
    "id": "sess_abc...",
    "agent": "claude-code",
    "total_steps": 10,
    "total_anomalies": 2
  },
  "events": [{
    "seq": 8,
    "event_type": "SHELL_EXEC",
    "summary": "rm config/secrets.yml",
    "risk_level": "danger",
    "duration_ms": 17
  }]
}

Security Model

  • All data stays on your machine. SQLite at ~/.tracelog/. No cloud, no telemetry.
  • Sensitive data masking. API keys, tokens, private keys are auto-redacted.
  • Open source. Every line of interception code is visible.
  • You control exports. Nothing leaves your machine unless you run tl export.

Project Structure

tracelog/
โ”œโ”€โ”€ core/               # Event model, SQLite, anomaly engine (library)
โ”œโ”€โ”€ cli/                # `tl` command โ€” 9 subcommands + Web UI
โ”œโ”€โ”€ daemon/             # Background daemon (WIP โ€” future real-time recorder)
โ”œโ”€โ”€ Cargo.toml          # Workspace root
โ”œโ”€โ”€ LICENSE             # MIT
โ””โ”€โ”€ README.md

Roadmap

Phase Timeline Highlights
MVP โœ… Now CLI + SQLite + 15 anomaly rules + JSON export + Web UI
v1 Q3 2026 Token cost analysis, Windows support, custom rules
v2 Q4 2026 Cloud sync (optional), CI/CD plugins, plugin ecosystem
Enterprise 2027 SSO, RBAC, compliance audit log, on-premise

Contributing

TraceLog is in early MVP stage. Contributions welcome:

  1. Bug reports: Open an issue with your tl status output
  2. Feature requests: Describe your agent debugging workflow
  3. Code: Fork, make changes, submit a PR
git clone https://github.com/lunkerchen/tracelog.git
cd tracelog
cargo test
cargo build --release

License

MIT โ€” see LICENSE.


Built with Rust. macOS & Linux. No cloud. Your data stays yours.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages