Hey, thanks for such a well thought-out request. The Ask 1 to 5 breakdown with an example of the desired JSONL schema is exactly the level of detail we need. I’ve forwarded it as a feature request.
I also want to clarify the status on a few items so you don’t build a pipeline on the wrong expectations:
stoppayload: it fires in local CLI plus IDE and includesconversation_id,transcript_path,modelormodel_idormodel_params. Token usageinput_tokens,output_tokens,cache_*is not included in thestoppayload right now. That’s one of the key points in your request and it’s tracked.- Token usage, thinking, and assistant message are available today via headless
--printwith--output-format stream-json. The finalresultevent includes token usage and the request ID, and along the way you also get thinking deltas and the full assistant message. For cost dashboards and trace reconstruction, this is a workable interim option without transcript enrichment. afterAgentResponseandafterAgentThought: these do not fire in CLI right now, neither headless nor interactive. This is a known gap, see Hooks afterAgentResponse / afterAgentThought not firing in headless CLI. They work in the IDE.- Env for hooks Ask 4: the
sessionStarthook response can set env for later hook calls in the session, but there are important caveats. Subagents do not inherit that env, see SubAgents do not inherit environment variables, and variables are lost when you close and reopen a chat or restart Cursor.sessionStartis not replayed on resume, see Env exported in sessionStart hook does not persist across Cursor restarts. So as a channel for persistent secrets it’s not reliable right now. Sidecar files are the more honest option for now.
On the main asks, Ask 1 transcript schema enrichment, per-row timestamps, usage, tool_result with tool_use_id, stable IDs, per-row model, and Ask 2 flush or ready signal before stop, there’s no implementation timeline yet. The request is logged in that form.
Also, a sample current vs desired JSONL from your local agent-transcripts/ would be helpful. If you can share it here, it’ll help us pin down the minimum viable schema more precisely.