Feature - Agent Context Logging (Phase 1: Initial Prompt Capture) #212

Closed
opened 2026-04-07 11:55:55 +02:00 by shoko · 0 comments
Owner

Summary

Phase 1 of Agent Context Logging - Integrate existing context dump/load functions into the delegation flow to capture the initial user prompt.

Background

Context logging tracks agent contexts at key decision points for:

  • Session resumption
  • Pattern analysis (Phase 3)
  • Feedback-driven prompt improvements

This is tracked by meta issue #125.

Current State

The codebase has kugetsu_context_dump() and kugetsu_context_update_message() functions defined in kugetsu script, but they are dead code - never called anywhere.

Existing infrastructure:

  • Storage: ~/.kugetsu/context/{issue-ref}.json
  • Structure: JSON with issue_ref, last_message, conversation_history

What to Implement

Integrate kugetsu_context_dump() into the delegation flow:

  1. Call site: Before fork_agent() in cmd_continue() and cmd_start()
  2. Parameters: issue_ref, message (user prompt), branch_name
  3. Result: Writes to ~/.kugetsu/context/{issue-ref}.json

The function already exists and is well-structured - just needs to be called.

Phase 1 Scope

In scope:

  • Call kugetsu_context_dump() when delegating a task
  • Ensure it captures the initial user prompt

Out of scope (Phase 2):

  • Session-end detection
  • Final message capture
  • Outcome tracking

Files to Modify

  1. skills/kugetsu/scripts/kugetsu-session.sh
    • In fork_agent() or cmd_continue(), call kugetsu_context_dump() before forking

Acceptance Criteria

  • kugetsu_context_dump() is called when delegating via kugetsu start
  • kugetsu_context_dump() is called when delegating via kugetsu continue
  • Context JSON is created/updated with initial prompt
  • No breaking changes to existing behavior
  • Meta issue: #125 (Agent Context Logging)
  • Phase 2: #125.2 (Session-end detection + final capture) - blocked, needs research
  • Phase 3: #125.3 (Pattern detection) - 0.3.x
## Summary Phase 1 of Agent Context Logging - Integrate existing context dump/load functions into the delegation flow to capture the initial user prompt. ## Background Context logging tracks agent contexts at key decision points for: - Session resumption - Pattern analysis (Phase 3) - Feedback-driven prompt improvements This is tracked by meta issue #125. ## Current State The codebase has `kugetsu_context_dump()` and `kugetsu_context_update_message()` functions defined in `kugetsu` script, but they are **dead code** - never called anywhere. Existing infrastructure: - Storage: `~/.kugetsu/context/{issue-ref}.json` - Structure: JSON with `issue_ref`, `last_message`, `conversation_history` ## What to Implement Integrate `kugetsu_context_dump()` into the delegation flow: 1. **Call site**: Before `fork_agent()` in `cmd_continue()` and `cmd_start()` 2. **Parameters**: `issue_ref`, `message` (user prompt), `branch_name` 3. **Result**: Writes to `~/.kugetsu/context/{issue-ref}.json` The function already exists and is well-structured - just needs to be called. ## Phase 1 Scope **In scope:** - Call `kugetsu_context_dump()` when delegating a task - Ensure it captures the initial user prompt **Out of scope (Phase 2):** - Session-end detection - Final message capture - Outcome tracking ## Files to Modify 1. **`skills/kugetsu/scripts/kugetsu-session.sh`** - In `fork_agent()` or `cmd_continue()`, call `kugetsu_context_dump()` before forking ## Acceptance Criteria - [ ] `kugetsu_context_dump()` is called when delegating via `kugetsu start` - [ ] `kugetsu_context_dump()` is called when delegating via `kugetsu continue` - [ ] Context JSON is created/updated with initial prompt - [ ] No breaking changes to existing behavior ## Related - Meta issue: #125 (Agent Context Logging) - Phase 2: #125.2 (Session-end detection + final capture) - blocked, needs research - Phase 3: #125.3 (Pattern detection) - 0.3.x
shoko added the ready label 2026-04-07 11:56:05 +02:00
shoko closed this issue 2026-04-08 04:22:01 +02:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: shoko/kugetsu#212