Track work-cycle review and outcome events in PostHog
Capture human direction of live agents, resolved review threads, human pushes to task branches, and task-linked pull requests closed without a merge. Make the execution context a required parameter of agent sessions and mentions. Plannotator review returned no changes requested. All 106 tests, typecheck, production build, and diff checks pass.
4 decisions
Treat one task as one work cycle, identified by repo_id and task_number, and derive review rounds and outcomes from ordered events.
Why
- Task numbers are stable and already on every work event
- A separate cycle ID adds no information while one task holds one cycle of work
Assumes
- The first agent.directed on a task is usually the assignment, not a redirect
Touches
analytics.tsproduct-analytics.md
Capture agent.directed inside deliverMentions, only for a person naming a live agent session.
Why
- Every path that directs an agent goes through deliverMentions
- Mentions of no live session do not direct work
Touches
mentions.ts
Count a human push to an existing tasks/<n> branch as work.corrected and a task-linked pull request closed without a merge as work.rejected.
Why
- These are the cheapest server-side signals of human correction and negative outcomes
- Neither sends code, text, or branch names
Assumes
- Pilot interviews confirm rejection reasons and correction size
Touches
index.ts
Pass the execution context as a required parameter to agentSessions and deliverMentions.
Why
- Optional context silently dropped analytics in some paths
Touches
sessions.tsmentions.tsmcp.ts