Skip to content

Agent context identification in logs #5

@djdarcy

Description

@djdarcy

Summary

When a Task subagent (Explore, Plan, etc.) runs tools, those tools should be identifiable in the sesslog as coming from an agent rather than the main session.

Current Behavior

[[2026-02-01 18:56:21]] {Bash: ls -d src/*/ }

No indication whether this Bash command was run by the main session or by a subagent.

Desired Behavior

[[2026-02-01 18:56:21]] {Bash|Explore: ls -d src/*/ }
[[2026-02-01 18:56:31]] {Bash: rm test.txt }  # Main session, no prefix

Format: {Tool|AgentType: content } when running inside a subagent.

Implementation Notes

  • Need to investigate PostToolUse JSON structure to determine how agent context propagates
  • Agent types include: Explore, Plan, Bash, general-purpose, claude-code-guide
  • Model info not needed (user can check transcript if needed)
  • Should handle nested agents gracefully

Analysis

See 2026-02-01__19-10-22__session-logger-enhancements-analysis.md for detailed analysis.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions