claude-dev-env 8.118.1 → 8.119.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -14,12 +14,22 @@ on the first ask after each compaction::
14
14
  -> task list note + no title note
15
15
  "Sign the APKs", a later ask -> nothing, or the title note
16
16
  "did the export fail?" -> nothing
17
- "<task-notification>...</task-notification>"
17
+ "<task-notification>...</task-notification>", title shows a red flag
18
+ -> wake note
19
+ "<task-notification>...</task-notification>", any other title
18
20
  -> nothing
19
21
 
22
+ A turn that an event starts carries no message from the user. The hook counts a
23
+ prompt as an event when it is one ``<task-notification>`` envelope, such as a
24
+ finished delegate, a pull request wake, or a turn review notice, or one queued
25
+ ``<agent-message>`` hand-back, followed by nothing but reminder blocks. While
26
+ the title shows the red flag, the wake note asks the agent to set the status
27
+ that fits now if the event cleared what the user had to do. It shows on each
28
+ such prompt. Any other prompt gets no wake note.
29
+
20
30
  The note never blocks. The Stop gate ``open_tasks_stop_gate.py`` holds the turn
21
31
  once only when the agent skipped the task list. No hook holds a turn for the
22
- title. Both title notes need the title tool in the transcript, and the no title
32
+ title. All three title notes need the title tool in the transcript, and the no title
23
33
  note shows at most once in a session, compactions included.
24
34
  """
25
35
 
@@ -48,14 +58,19 @@ from hooks_constants.open_tasks_stop_gate_constants import (
48
58
  )
49
59
  from hooks_constants.pre_tool_use_stdin import read_hook_input_dictionary_from_stdin
50
60
  from hooks_constants.session_title_constants import (
61
+ ALL_NO_WAKE_SENDER_NAMES,
51
62
  ALL_STALE_AT_START_STATUSES,
52
63
  NO_TITLE_NUDGE_ONCE_MARKER_NAME,
53
64
  NO_TITLE_NUDGE_TEMPLATE,
65
+ RED_FLAG_STATUS,
54
66
  TITLE_NUDGE_TEMPLATE,
55
67
  TITLE_TOOL_DISPLAY_SEPARATOR,
68
+ WAKE_EVENT_ENVELOPE_PATTERN,
69
+ WAKE_FLAG_NUDGE_TEMPLATE,
70
+ WAKE_SENDER_GROUP_NAME,
56
71
  )
57
72
  from once_per_session import claim_first_showing, claim_only_showing
58
- from open_task_asks import is_ask
73
+ from open_task_asks import is_ask, prompt_without_reminders
59
74
  from session_title_transcript import (
60
75
  available_title_tools,
61
76
  read_transcript_entries,
@@ -96,19 +111,83 @@ def title_nudge(
96
111
  return TITLE_NUDGE_TEMPLATE.format(title=title, tool_name=tool_name)
97
112
 
98
113
 
114
+ def is_event_wake(prompt_text: str) -> bool:
115
+ """Return True when a harness event sent the whole prompt, with no words from the user.
116
+
117
+ ::
118
+
119
+ "<task-notification>...</task-notification>" -> True
120
+ '<agent-message from="a1">...</agent-message>' -> True
121
+ "<task-notification>...</task-notification><system-reminder>...</system-reminder>"
122
+ -> True
123
+ "<task-notification>...</task-notification> Why did it fail?" -> False
124
+ '<agent-message from=" Human">...</agent-message>', from="" -> False
125
+ "<task-notification>It quotes </task-notification>.</task-notification>"
126
+ -> False
127
+ '<task-notification id="a1">...', "<TASK-NOTIFICATION>..." -> False
128
+ "", "<system-reminder>...</system-reminder>", '<wake ...>...' -> False
129
+
130
+ The prompt must open, after white space, with one envelope. Its opening tag
131
+ is a bare lower case ``<task-notification>``, or ``<agent-message>`` with
132
+ ``from`` as its only attribute. The sender must not be empty or ``human``.
133
+ The sender check ignores letter case and the white space around the name.
134
+ Only reminder blocks and white space may follow the envelope.
135
+
136
+ The first closing tag ends the envelope. A body that quotes its own closing
137
+ tag reads as an envelope with typed text after it, so it is no wake.
138
+ """
139
+ text = prompt_text.lstrip()
140
+ envelope = WAKE_EVENT_ENVELOPE_PATTERN.match(text)
141
+ if envelope is None:
142
+ return False
143
+ sender = envelope.group(WAKE_SENDER_GROUP_NAME)
144
+ if sender is not None and sender.strip().casefold() in ALL_NO_WAKE_SENDER_NAMES:
145
+ return False
146
+ return not prompt_without_reminders(text[envelope.end() :])
147
+
148
+
149
+ def wake_flag_nudge(prompt_text: str, all_entries: list[dict[str, object]]) -> str | None:
150
+ """Return the wake note when an event starts the turn while the title shows the red flag.
151
+
152
+ ::
153
+
154
+ "<task-notification>...", title shows "\U0001f6a9 Merge approval" -> note naming it
155
+ "<task-notification>...", shows "✅ Gate" or "⏳ Export" -> None
156
+ "Export the APKs", title shows "\U0001f6a9 Merge approval" -> None
157
+ no title tool in the transcript -> None
158
+
159
+ Args:
160
+ prompt_text: The ``prompt`` field of the UserPromptSubmit payload.
161
+ all_entries: The transcript entries, oldest first.
162
+
163
+ Returns:
164
+ The note text, or None.
165
+ """
166
+ if not is_event_wake(prompt_text):
167
+ return None
168
+ all_title_tools = available_title_tools(all_entries)
169
+ title = shown_title(all_entries)
170
+ if not all_title_tools or title is None or title_status(title) != RED_FLAG_STATUS:
171
+ return None
172
+ tool_name = TITLE_TOOL_DISPLAY_SEPARATOR.join(all_title_tools)
173
+ return WAKE_FLAG_NUDGE_TEMPLATE.format(title=title, tool_name=tool_name)
174
+
175
+
99
176
  def ask_tracking_context(
100
177
  prompt_text: str,
101
178
  all_entries: list[dict[str, object]],
102
179
  all_hook_fields: Mapping[str, object],
103
180
  ) -> str | None:
104
- """Return the note for a prompt that asks for work, or None for any other prompt.
181
+ """Return the note for a prompt that asks for work, the wake note for an event, else None.
105
182
 
106
183
  The task list note shows on the session's first ask and on the first ask
107
- after each compaction. The title note shows on every ask while the title is stale,
108
- and the no title note on the first ask in the session that finds no title.
184
+ after each compaction. The title note shows on every ask while the title is
185
+ stale, and the no title note on the first ask in the session that finds no
186
+ title. A prompt that asks for no work gets only the wake note, and only when
187
+ ``wake_flag_nudge`` builds one.
109
188
  """
110
189
  if not is_ask(prompt_text):
111
- return None
190
+ return wake_flag_nudge(prompt_text, all_entries)
112
191
  tracker_note = (
113
192
  TASK_LIST_NUDGE
114
193
  if claim_first_showing(TASK_LIST_NUDGE_ONCE_MARKER_NAME, all_hook_fields)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "claude-dev-env",
3
- "version": "8.118.1",
3
+ "version": "8.119.1",
4
4
  "description": "Claude Code development standards — rules, hooks, agents, commands, and skills",
5
5
  "type": "module",
6
6
  "bin": {