You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[FEATURE] Session metrics and lifecycle hooks for plugin analytics #23454
External tools and plugins building session analytics need token usage data and session lifecycle signals. Currently there is no way to know how many tokens a session consumed, what it cost, or when tasks within a session start and end.
What's needed
Token counts per session — tokens_in, tokens_out exposed via hooks, events, or API
Session/task lifecycle events — signals when a session starts/ends and when logical tasks within a session begin/complete
Tool call observability — post-tool-execution event should include truncated response content, not just tool name and exit code
Usage introspection — API or CLI to query remaining usage limits
Use case
Building a session observatory that shows developers:
Cost per session and per task
Session drill-down with tool call inputs AND outputs
Quality metrics (first-try-right rate, rework rate) correlated with cost
opencode's open architecture and plugin system are ideal for this — richer lifecycle data than proprietary alternatives would be a strong differentiator.
Activity
github-actions commentedon Apr 19, 2026
This issue doesn't fully meet our contributing guidelines.
What needs to be fixed:
Please edit this issue to address the above within 2 hours, or it will be automatically closed.
This issue might be a duplicate of existing issues. Please check:
session.start/session.end,preToolUse/postToolUse— directly overlapping with the lifecycle hooks requested herechat.messagehook expose message bodies for telemetry/observability use cases — overlapping with the tool call observability goal hereIf you believe this was flagged incorrectly, please let a maintainer know.
github-actions commentedon Apr 20, 2026
This issue has been automatically closed because it was not updated to meet our contributing guidelines within the 2-hour window.
Feel free to open a new issue that follows our issue templates.