Files
ai-memory/hooks
Djalma Júnior b8cf2cf7f2 feat(hooks): per-project drop_subagent_captures opt-in with tail tracking
A project sets `drop_subagent_captures = "true"` in its .ai-memory.toml;
the host-side hook forwards it as the `drop_subagent` query flag (alongside
the existing workspace/project/project_strategy marker fields) so the ingest
router accepts but does not persist that project's subagent-session captures,
keeping only top-level sessions. Scoping the opt-in per project avoids a
server-global switch that would shed subagent captures for every project on a
shared instance.

Captures are accepted (HTTP 202 / counted in the /hook/batch ack) so clients
do not retry or spool them. Detection combines a per-event marker (subagentType
for grok; agent_type/agent_id for Claude Code) with a bounded LRU set of
subagent session ids, seeded by any marked event and by the newly registered
SubagentStart/SubagentStop lifecycle hooks (claude-code + grok) and cleared on
SubagentStop, so the unmarked tail of a subagent session (user_prompt_submit/
stop/session_end) is dropped too. The marker file only forwards the project's
opt-in; the server makes every drop decision. Only the ingest/hook layer is
touched; the observation store is not.
2026-06-29 13:56:06 -03:00
..