Feature - Agent Context Logging (Phase 2: Session-end Detection) #213

Open
opened 2026-04-07 12:00:32 +02:00 by shoko · 0 comments
Owner

Summary

Phase 2 of Agent Context Logging - Detect session end and capture final agent response + outcome.

Background

Tracked by meta issue: #125 [META] Agent Context Logging

Phase 1 Scope (Completed separately)

Phase 1 captures the initial user prompt when delegating.

Phase 2 Goal

Capture:

  1. Final agent response before session ends
  2. Outcome (PR created, task completed, error, etc.)

Research Required

How to detect session end?

Options:

  1. Poll dev-*.log for completion - check if opencode process ended
  2. Check session file state - session JSON has state field
  3. Manual command - kugetsu context final <issue> to mark completion
  4. Webhook from opencode - if supported

What constitutes "session end"?

  • Agent completes task and terminates?
  • Agent creates PR?
  • Agent encounters error?
  • User manually stops?

What to capture for "final"?

Both:

  1. Last agent response before session ends
  2. Outcome with details (PR URL, error message, etc.)

Questions to Resolve

  1. Session end detection mechanism?
  2. What triggers "final" capture?
  3. Should we update existing context JSON or create new "outcome" file?
  4. How to handle interrupted sessions?

Status

Blocked - needs research before implementation.

## Summary Phase 2 of Agent Context Logging - Detect session end and capture final agent response + outcome. ## Background Tracked by meta issue: #125 [META] Agent Context Logging ## Phase 1 Scope (Completed separately) Phase 1 captures the initial user prompt when delegating. ## Phase 2 Goal Capture: 1. Final agent response before session ends 2. Outcome (PR created, task completed, error, etc.) ## Research Required ### How to detect session end? Options: 1. **Poll dev-*.log for completion** - check if opencode process ended 2. **Check session file state** - session JSON has state field 3. **Manual command** - `kugetsu context final <issue>` to mark completion 4. **Webhook from opencode** - if supported ### What constitutes "session end"? - Agent completes task and terminates? - Agent creates PR? - Agent encounters error? - User manually stops? ### What to capture for "final"? Both: 1. Last agent response before session ends 2. Outcome with details (PR URL, error message, etc.) ## Questions to Resolve 1. Session end detection mechanism? 2. What triggers "final" capture? 3. Should we update existing context JSON or create new "outcome" file? 4. How to handle interrupted sessions? ## Status Blocked - needs research before implementation.
shoko added the blocked label 2026-04-07 12:00:32 +02:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: shoko/kugetsu#213