A Go CLI tool that records terminal sessions via PTY wrapping, captures git diffs, and generates a structured Markdown report using an AI API (Gemini or OpenAI).
Platform: macOS and Linux only.
go install github.com/0xendale/devtrace/cmd/devtrace@latestOr build from source:
git clone https://github.com/0xendale/devtrace
cd devtrace
go build -o devtrace ./cmd/devtrace# 1. Run interactive setup (first time only)
devtrace setup
# 2. Start recording your terminal session
devtrace start
# 3. Do your work — write code, run tests, build things
# 4. Stop recording
devtrace stop
# 5. Generate a Markdown report
devtrace genREPORT.md is written to your current directory.
Run the interactive setup wizard to configure your API key:
devtrace setupdevtrace setup
Select provider:
[1] Gemini (free tier available — https://aistudio.google.com/apikey)
[2] OpenAI (https://platform.openai.com/api-keys)
[3] Other (any OpenAI-compatible endpoint)
Choice [1]:
API key: ********
[devtrace] config written to ~/.devtrace/config.toml
Config is saved to ~/.devtrace/config.toml with 0600 permissions.
~/.devtrace/config.toml (created by devtrace setup or on first run):
provider = "gemini" # "gemini" or "openai" (default: openai)
api_key = "AIza..." # or set DEVTRACE_API_KEY env var
model = "gemini-2.0-flash" # model to use
hours = 8 # git diff time window in hours
endpoint = "" # custom endpoint for OpenAI-compatible APIs (Groq, Ollama, etc.)API key resolution order: DEVTRACE_API_KEY env var → api_key in config.
There is no --api-key CLI flag by design — passing secrets on the command line exposes them to shell history and ps.
Gemini (free tier):
provider = "gemini"
api_key = "AIza..."
model = "gemini-2.0-flash"Get a free key at aistudio.google.com/apikey.
OpenAI:
provider = "openai"
api_key = "sk-..."
model = "gpt-4o"Groq (free tier, OpenAI-compatible):
api_key = "gsk_..."
model = "llama-3.1-8b-instant"
endpoint = "https://api.groq.com/openai/v1/chat/completions"Get a free key at console.groq.com.
Place a config.toml in your project directory to override the global config. It is loaded first if present. Add it to .gitignore — it contains your API key.
Wraps your $SHELL in a PTY recorder. All terminal output is captured through a redaction pipeline and appended to ~/.devtrace/session.log. Stdin (keystrokes) is forwarded to the shell but never logged.
Sends SIGTERM to the recorder. Waits up to 5 seconds for a clean exit, then escalates to SIGKILL. Removes the PID file.
- Reads
~/.devtrace/session.log - Fetches the git diff for the last N hours from the current directory
- Runs a second redaction pass on all content
- Shows a confirmation dialog (default: N)
- Calls the AI API
- Writes
REPORT.mdto the current directory
About to send to generativelanguage.googleapis.com:
Session log: 142 lines
Git diff: 87 lines
Total: ~4.1 KB
Redactions: 5 (across both log write and prompt assembly passes)
Proceed? [y/N]
Interactive wizard to configure provider, API key, and model. Writes ~/.devtrace/config.toml.
Print the installed version.
- No
--api-keyflag — prevents shell history andpsexposure 0600permissions onsession.log,recorder.pid, andconfig.toml- Redaction pipeline runs twice: at write-time and before the API call
- Outbound confirmation required before any data leaves your machine
| Pattern | Matches |
|---|---|
sk-[A-Za-z0-9]{20,} |
OpenAI API keys |
ghp_[A-Za-z0-9]{36} |
GitHub PATs |
AKIA[0-9A-Z]{16} |
AWS access key IDs |
Bearer \S+ |
Authorization headers |
(password|secret|token|api_key)=\S+ |
Generic key=value secrets |
Redacted values are replaced with [REDACTED:<pattern-name>] and reported to stderr only.
~/.devtrace/
session.log — append-only output log (0600)
recorder.pid — recorder PID, managed by devtrace stop (0600)
config.toml — API key and settings (0600)
The session log is append-only across multiple devtrace start runs. Delete it to start fresh:
rm ~/.devtrace/session.log# Build
go build -o devtrace ./cmd/devtrace
# Run all tests
go test ./...
# Run a single package
go test ./internal/recorder/...
# Run a single test
go test -run TestRedactOpenAIKey ./internal/recorder/...
# Lint (requires golangci-lint)
golangci-lint run ./...
# Build with version tag
go build -ldflags "-X main.version=v0.1.0" -o devtrace ./cmd/devtraceREPORT.md is structured with four sections:
- Summary — what was worked on
- Changes — meaningful code changes
- Test Results — build and test output
- Issues — errors or problems encountered
The model filters out noise (repetitive errors, trivial commands like ls, cd, pwd) and focuses on meaningful work.