OpenCode Integration
OpenCode is an open-source AI coding assistant. AgentLogs provides integration with OpenCode for automatic transcript sync.Features
- Automatic sync - Transcripts are uploaded automatically when the session becomes idle
- Git commit enhancement - Automatically adds transcript links to git commit messages
- Commit tracking - Tracks which commits were made during each session
Installation
1. Authentication
Run the following command in the terminal:2. Configure OpenCode
Add the plugin to youropencode.json config file:
How It Works
The plugin is lightweight and shells out to the AgentLogs CLI for all processing:Transcript Upload
When a session becomes idle, the plugin triggers the CLI to upload the transcript. Transcripts are automatically deduplicated server-side based on session ID. Repeated idle events are combined into one upload per session per minute. If another turn finishes during that minute or while an upload is running, the plugin schedules a final update while OpenCode remains open. Closing the session’s OpenCode instance cancels pending updates; use a manual upload if needed afterward. Uploads and commit hooks share a queue within each OpenCode process. A CLI run that exceeds one minute is stopped, including its child processes, so later hooks can continue. The CLI command is resolved once per OpenCode process:VI_CLI_PATH takes precedence for local development, followed by an installed agentlogs executable on PATH, then npx -y agentlogs@latest as a fallback. Restart OpenCode after changing the CLI installation or override.
Git Commit Enhancement
When a git commit is detected:- The plugin intercepts the command before execution
- Generates a stable transcript ID
- Appends a transcript link to the commit message
- Uploads a partial transcript so the link works immediately
Commit Tracking
After a git commit completes, the CLI extracts the commit SHA, branch, and title, then associates them with the transcript for easy navigation.Manual Upload
You can manually upload transcripts using the CLI:upload command discovers transcripts from all agents and lets you pick one to upload. Sessions are read from ~/.local/share/opencode/storage/.