GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Feature: Add sessionID to experimental.chat.system.transform hook for tracing integration · Issue #6142 · anomalyco/opencode

Feature: Add sessionID to experimental.chat.system.transform hook for tracing integration #6142

New issue
Copy link
New issue
Copy link
Closed as not planned
Closed as not planned
Feature: Add sessionID to experimental.chat.system.transform hook for tracing integration#6142
Copy link
Assignees
rekram1-node

Description

@ramarivera
ramarivera
opened on Dec 25, 2025
Issue body actions

Summary

When building observability plugins (e.g., Langfuse, OpenTelemetry exporters), it's valuable to capture the full system prompt for each LLM request and associate it with the correct trace/session. The experimental.chat.system.transform hook provides access to the system prompt, but currently lacks the sessionID needed to correlate it with a specific session.

Current Behavior

In packages/opencode/src/session/llm.ts line ~65:

await Plugin.trigger("experimental.chat.system.transform", {}, { system })

The input object is empty {}, so plugins cannot determine which session the system prompt belongs to.

Proposed Change

Pass the sessionID in the input:

await Plugin.trigger("experimental.chat.system.transform", { sessionID: input.sessionID }, { system })

And update the type definition in packages/plugin/src/index.ts:

"experimental.chat.system.transform"?: (
  input: { sessionID: string },
  output: { system: string[] },
) => Promise<void>

Use Case

This enables tracing plugins to:

  1. Capture the full system prompt (including environment context, file tree, custom instructions)
  2. Associate it with the correct Langfuse trace or OpenTelemetry span
  3. Provide complete observability into what context the LLM received

Additional Context

I'm building a Langfuse exporter plugin for OpenCode. Currently I can capture:

  • Session events
  • User messages with content
  • Assistant responses with token usage
  • Tool calls with input/output

But the system prompt is missing from traces, which makes debugging and analysis incomplete.


Note: Similar issues were searched before filing. This report was created with AI assistance.

Reacted by Jisu Yu, Victor Kasatkin, Jaid, nlp4whp, Ahn, zclllyybb, Julien LEICHER and StyleTang
Reacted by nlp4whp and zclllyybb

Activity

  1. github-actions
    assigned
    thdxr
    on Dec 25, 2025
  2. github-actions commented on Dec 25, 2025

    @github-actions
    github-actionsBot
    on Dec 25, 2025 – with GitHub Actions
    Contributor
    More actions

    This issue might be a duplicate of existing issues. Please check:

    • Feature Request: Add Langfuse Tracing #219: Feature Request: Add Langfuse Tracing - This issue is about integrating Langfuse for tracing/observability in OpenCode, which is directly related to your use case of building a Langfuse exporter plugin.

    Feel free to ignore if this doesn't address your specific case.

  3. rekram1-node
    assigned
    rekram1-node
    and unassigned
    thdxr
    on Dec 25, 2025
  4. rekram1-node commented on Dec 25, 2025

    @rekram1-node
    rekram1-node
    on Dec 25, 2025
    Member
    More actions

    sure pr welcome!

  5. thdxr commented on Mar 25, 2026

    @thdxr
    thdxr
    on Mar 25, 2026
    Member
    More actions

    To stay organized issues are automatically closed after 90 days of no activity. If the issue is still relevant please open a new one.

  6. ngbrown commented on Apr 14, 2026

    @ngbrown
    ngbrown
    on Apr 14, 2026
    More actions

    Session ID is present in the following (at least with Opencode 1.4.3):

    import type { Plugin } from "@opencode-ai/plugin";
    
    const serviceName = "log-session";
    
    export const LogSession: Plugin = async ({ project, client }) => {
      return {
        "experimental.chat.system.transform": async (input, output) => {
          console.log("system messages", input.sessionID, output.system);
        },
      };
    };
  7. rekram1-node
    closed this as not plannedon May 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

  • @rekram1-node
    rekram1-node

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

    You are visitor 01402775 — GeezerVison does not store the pages you look up.
    Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.