跳到主要内容
    ↑↓ 选择↵ 打开esc 关闭
    中文English
    frankhommers

    Logger

    v1.0.3可观测与分析
    @frankhommers/opencode-plugin-logger

    A JSONL session event logger plugin for OpenCode

    GitHub 星标

    0

    月装机量

    51

    近 7 天 9

    综合评分SCORE

    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"]
    }

    opencode 启动时会通过内嵌运行时自动加载 npm 依赖并缓存至本地目录,无需手动在全局环境执行安装。

    License: MIT

    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

    1. Add the plugin to your OpenCode config:

      {
        "$schema": "https://opencode.ai/config.json",
        "plugin": ["@frankhommers/opencode-plugin-logger"]
      }
      
    2. Enable logging via the logger_set tool 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 parts
    • tool_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"]
    }