Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{"type": "queue-operation", "operation": "enqueue", "timestamp": "2026-09-12T06:45:37.097Z", "sessionId": "s1", "content": "ok if there is a better fix, then jsut do it"}
{"type": "assistant", "timestamp": "2026-09-12T06:46:00.000Z", "sessionId": "s1", "message": {"role": "assistant", "content": [{"type": "text", "text": "still working"}]}}
{"type": "user", "timestamp": "2026-09-12T06:50:28.468Z", "sessionId": "s1", "promptId": "p9", "origin": {"kind": "human"}, "message": {"role": "user", "content": "ok if there is a better fix, then jsut do it"}}
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
{"type": "queue-operation", "operation": "enqueue", "timestamp": "2026-09-12T06:45:37.097Z", "sessionId": "s1", "content": "ok if there is a better fix, then jsut do it"}
{"type": "assistant", "timestamp": "2026-09-12T06:46:00.000Z", "sessionId": "s1", "message": {"role": "assistant", "content": [{"type": "text", "text": "still working"}]}}
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{"type": "user", "timestamp": "2026-09-12T06:10:43.745Z", "sessionId": "s1", "promptId": "p1", "origin": {"kind": "human"}, "stackedOriginalInput": "/reflect /cat-mode please prevent this shit from happening again", "message": {"role": "user", "content": "<command-message>reflect</command-message>\n<command-name>/reflect</command-name>\n<command-args>please prevent this shit from happening again</command-args>"}}
{"type": "user", "timestamp": "2026-09-12T06:10:43.745Z", "sessionId": "s1", "promptId": "p1", "isMeta": true, "turnCompanion": true, "message": {"role": "user", "content": "Base directory for this skill: /skills/reflect\n\n# Reflect\n\nbody"}}
{"type": "user", "timestamp": "2026-09-12T06:10:43.786Z", "sessionId": "s1", "promptId": "p1", "origin": {"kind": "human"}, "stackedExpansion": true, "message": {"role": "user", "content": "<command-message>cat-mode</command-message>\n<command-name>/cat-mode</command-name>\n<command-args>please prevent this shit from happening again</command-args>"}}
{"type": "user", "timestamp": "2026-09-12T06:10:43.786Z", "sessionId": "s1", "promptId": "p1", "isMeta": true, "turnCompanion": true, "message": {"role": "user", "content": "Base directory for this skill: /skills/cat-mode\n\n# cat-mode\n\nbody"}}
31 changes: 31 additions & 0 deletions engine/skills/reflect/scripts/tests/test_transcript_provenance.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,37 @@ def test_human_complaint_beside_teammate_relay_still_fires(self):
self.assertEqual(len(direct), 1)
self.assertTrue(direct[0].text.startswith("I told you to reproduce my screenshot"))

def test_one_submission_with_two_slash_commands_is_one_human_message(self):
"""`/reflect /cat-mode <text>` writes the same args twice, tens of
milliseconds apart. The second row is marked stackedExpansion, and the
two skill bodies are isMeta. One human message, not three."""
path = os.path.join(FIXTURES, "stacked_commands", "claude.jsonl")
direct = provenance.direct_human_utterances(path, "claude")
self.assertEqual(
[row.text for row in direct],
["please prevent this shit from happening again"],
)
rows = provenance.extract_utterances(path, "claude")
self.assertEqual([row.provenance for row in rows], ["direct_human", "hook", "hook"])

def test_a_queued_message_and_its_delivery_are_one_human_message(self):
"""Typing while the agent is busy writes an enqueue row, and the
delivery writes a user row minutes later. One message, counted once,
or the gap between them reads as the user re-sending in frustration."""
path = os.path.join(FIXTURES, "queued_message", "claude.jsonl")
direct = provenance.direct_human_utterances(
path, "claude", include_queue_operations=True,
)
self.assertEqual(len(direct), 1, [row.text for row in direct])
self.assertEqual(direct[0].text, "ok if there is a better fix, then jsut do it")

def test_an_undelivered_queued_message_still_counts_once(self):
path = os.path.join(FIXTURES, "queued_undelivered", "claude.jsonl")
direct = provenance.direct_human_utterances(
path, "claude", include_queue_operations=True,
)
self.assertEqual(len(direct), 1, [row.text for row in direct])

def test_negative_subagent_copies_share_lineage_but_are_not_direct_human(self):
cases = {
"claude": ("claude-root.jsonl", "agent-claude.jsonl"),
Expand Down
2 changes: 2 additions & 0 deletions engine/skills/reflect/scripts/transcript_provenance.py
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,8 @@ def _claude_utterances(
}}
if row.get("type") != "user":
continue
if row.get("stackedExpansion"):
continue
message = row.get("message")
content = message.get("content") if isinstance(message, dict) else None
if isinstance(content, list) and any(
Expand Down
Loading