Subagents that report through SubagentHandback never produce passive captures
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 72/100
- Issue type
- Bug
- Clarity
- Clearly specified
- Activity status
- Active
- Domain
- developer-experience, tooling
Research direction
Start in the plugin's subagent-stop.sh hook, at the place where it reads last_assistant_message and stdout from the hook input on stdin. Extend that read to also parse agent_transcript_path, pulling the last assistant tool_use entry named SubagentHandback and using its input.message when non-empty. Build a small fixture transcript with a handback-only subagent and confirm the ## Key Learnings block reaches passive observations; the issue's own jq snippet and the referenced #653 / #1403 fixes are the model to follow.
Written by the indexing model from the issue text.
Description
Existing Issue Search
- I searched existing issues and will add evidence to a canonical tracker when applicable.
📝 Observed Consequence
Newer Claude Code versions often have subagents deliver their final report through the SubagentHandback tool. When that happens, nothing gets captured: the ## Key Learnings in the report never reach engram, and there's no error anywhere. Over 5 days I had 17 subagents like that and none of their learnings were saved (64 in total). Every subagent that ended with a normal text reply was captured fine.
🔄 Steps to Reproduce
- Use Claude Code v2.1.271 or later with the engram plugin.
- Run a subagent that hands back its report through SubagentHandback, without a plain text final message, and with a ## Key Learnings block in it.
- Check passive observations. Nothing new shows up.
✅ Expected Behavior
The learnings in the handback report get captured like any other subagent's.
❌ Actual Behavior
Nothing is captured.
Operating System
macOS
Release Version (Report Context)
3.6.0 (Claude Code plugin 0.1.14)
Agent / Client
Claude Code
📋 Relevant Logs
💡 Additional Context
According to the Claude Code hooks docs, when a subagent uses SubagentHandback, last_assistant_message only has the closing text and the report is the tool call's message input. subagent-stop.sh only reads last_assistant_message and stdout, so it never sees the report. This is not Windows-specific, it's just where I ran into it.
Locally I patched the hook to take the last SubagentHandback message from agent_transcript_path and prefer it when there is one:
HANDBACK=null
TRANSCRIPT=$(printf '%s' "$INPUT" | jq -r '.agent_transcript_path // empty')
TRANSCRIPT=${TRANSCRIPT%$'\r'}
if [ -n "$TRANSCRIPT" ] && [ -f "$TRANSCRIPT" ]; then
HANDBACK=$(tail -n 50 "$TRANSCRIPT" 2>/dev/null | jq -Rnac '[inputs | fromjson? | select(type == "object" and .message?.role? == "assistant") | .message.content[]? | select(type == "object" and .type? == "tool_use" and .name? == "SubagentHandback") | .input.message?] | last' 2>/dev/null)
HANDBACK=${HANDBACK%$'\r'}
[ -n "$HANDBACK" ] || HANDBACK=null
fi
Then I pass it with --argjson handback "$HANDBACK" and use it as the content when it's a non-empty string. I only read the last 50 lines because some of my subagent transcripts are close to 200 MB. The \r trim is there because scoop's jq on Windows outputs CRLF.
A PostToolUse hook on SubagentHandback that reads tool_input.message might be a cleaner way to do it. Earlier fixes to this same hook: #653, #1403.
- Dominant language
- Go
- Stars
- 7.1k
- Forks
- 729
- Avg merge
- 9h 44m
- Merged PRs (30d)
- 278
Getting set up
Starts the project's dev container in your browser, under your own GitHub account.
- No Dockerfile or Docker Compose file
- Has a pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from Gentleman-Programming/engram
-
status:needs-review type:bug
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
Gentleman-Programming/engram#2205 ·
Maintainers usually reply within 1 day
-
status:needs-review type:bug
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
Gentleman-Programming/engram#2204 ·
Maintainers usually reply within 1 day
-
status:needs-review type:bug
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
Gentleman-Programming/engram#2138 · 1 comment ·
Maintainers usually reply within 1 day
-
status:needs-review
Difficulty 2/5 1-3 hours Newbie friendliness 85/100
Gentleman-Programming/engram#2065 ·
Maintainers usually reply within 1 day
-
feat(ci): prepare trusted-main Go Race cache integrationPossibly taken @dnlrsls claimed this today. Openstatus:approved type:feature
Gentleman-Programming/engram#2207 · 1 assignee ·
Maintainers usually reply within 1 day
All issues in Gentleman-Programming/engram
Similar issues
-
docs(prompts): IF BLOCKED workflow-scope branch says to comment on the issue on jira/local trackersOpenagent-butler-finding bug
Difficulty 2/5 1-3 hours Newbie friendliness 77/100
jordansmall/spindrift#6238 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 85/100
microcks/microcks-cli#608 · 1 comment ·
Maintainers usually reply within 1 day
-
bug from-studio
Difficulty 2/5 1-3 hours Newbie friendliness 65/100
esengine/DeepSeek-Reasonix#14868 ·
Maintainers usually reply within 1 day
-
Install notes print "Camunda REST API: https://" without a host when global.host is setPossibly taken @irisfield claimed this today. Open
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
camunda/camunda-platform-helm#7790 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
wso2/agent-manager#2220 ·
Maintainers usually reply within 1 day