@frankhommers/opencode-plugin-loggerA JSONL session event logger plugin for OpenCode
0
51
近 7 天 9
22.7
生态多维模型
4 个月前
2026-03-25
快速安装与配置
opencode.json写入当前项目的 opencode.json,只对这个仓库生效。
opencode.json
{
"$schema": "https://opencode.ai/config.json",
"plugin": ["@frankhommers/opencode-plugin-logger@1.0.3"]
}写入 ~/.config/opencode/opencode.json,对所有项目生效。
~/.config/opencode/opencode.json
{
"$schema": "https://opencode.ai/config.json",
"plugin": ["@frankhommers/opencode-plugin-logger@1.0.3"]
}若你要在本地改造这个插件,先装到项目里再从本地路径引用。
shell
pnpm add -D @frankhommers/opencode-plugin-loggeropencode 启动时会通过内嵌运行时自动加载 npm 依赖并缓存至本地目录,无需手动在全局环境执行安装。
A JSONL session event logger plugin for OpenCode. Logs chat messages and tool executions as structured JSONL files, organized by session.
Inspired by opencode-plugin-simple-memory by Kris Nicolov.
Setup
Add the plugin to your OpenCode config:
{ "$schema": "https://opencode.ai/config.json", "plugin": ["@frankhommers/opencode-plugin-logger"] }Enable logging via the
logger_settool or configuration file.
Configuration
The plugin supports its own config files:
- Global defaults:
~/.config/opencode/logger.json - Per-project override:
.opencode/logger.json
Project config overrides global config.
Example:
{
"logger": {
"enabled": true,
"scopes": [],
"dir": "${project}/.agent-session-logs"
}
}
Supported placeholders:
${home}${project}(workspace/project root)${workspace}(alias of${project})${date}${env:VAR_NAME}
Tools
| Tool | Description |
|---|---|
logger_set |
Enable/disable logger and set scope filters |
logger_status |
Show active logger configuration |
Log Structure
Logs are organized by session:
.agent-session-logs/
2026-03-20-fix-auth-bug/
main.jsonl # Main session events
explore-ses_abc.jsonl # Subagent events
codex-ses_def.jsonl # Another subagent
Each line is a JSON object with fields like:
{
"ts": "2026-03-20T10:00:00.000Z",
"event": "chat_message",
"session_id": "ses_main",
"parent_session_id": null,
"root_session_id": "ses_main",
"agent": "main",
"message_id": "msg_1",
"model": { "providerID": "anthropic", "modelID": "claude-opus-4" }
}
Events Logged
chat_message— Chat messages with model info and partstool_execute_before— Tool call with args (before execution)tool_execute_after— Tool result with output (after execution)
Local Development
git clone https://github.com/frankhommers/opencode-plugin-logger.git
cd opencode-plugin-logger
bun install
Point your OpenCode config to the local checkout:
{
"$schema": "https://opencode.ai/config.json",
"plugin": ["file:///absolute/path/to/opencode-plugin-logger"]
}