Skip to content

Commit 53ec802

Browse files
authored
Add todo suggestion quality-watch trigger (#1732)
1 parent 0550745 commit 53ec802

3 files changed

Lines changed: 41 additions & 0 deletions

File tree

docs/reference/protocols/todo-suggestion-prompt-v0.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,9 @@ Useful triggers:
2121
- explicit user request such as "what looks worth doing next?";
2222
- no runnable agent todo after status/quota inspection;
2323
- material repo changes since the last candidate review.
24+
- `quality-watch` cadence turns, where the agent should compare fresh signals
25+
against the last known state and return candidates only for new or
26+
still-uncovered evidence.
2427

2528
Avoid running this on every heartbeat. The default limit is 3 and the hard cap
2629
is 5.

examples/control_plane/todo-suggestion-prompt-smoke.py

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,35 @@ def main() -> int:
124124
assert "`requires_user_decision=true`" in task_body, task_body
125125
assert state_file.read_text(encoding="utf-8") == original_state
126126

127+
watch_result = run_cli(
128+
registry_path,
129+
"--format",
130+
"json",
131+
"todo",
132+
"suggest",
133+
"--goal-id",
134+
GOAL_ID,
135+
"--agent-id",
136+
"codex-product-capability",
137+
"--from",
138+
"failing-checks",
139+
"--from",
140+
"complexity-hotspots",
141+
"--trigger",
142+
"quality-watch",
143+
)
144+
watch_payload = json.loads(watch_result.stdout)
145+
assert watch_payload["ok"] is True, watch_payload
146+
assert watch_payload["trigger"] == "quality-watch", watch_payload
147+
assert watch_payload["sources"] == ["failing-checks", "complexity-hotspots"], watch_payload
148+
assert watch_payload["formal_todos_written"] is False, watch_payload
149+
watch_body = watch_payload["task_body"]
150+
assert "Because this is a `quality-watch` turn" in watch_body, watch_body
151+
assert "new or still-uncovered evidence" in watch_body, watch_body
152+
assert "return an empty list with a short rationale" in watch_body, watch_body
153+
assert "quality-watch" in watch_payload["frequency_policy"]["recommended_triggers"], watch_payload
154+
assert state_file.read_text(encoding="utf-8") == original_state
155+
127156
markdown = run_cli(
128157
registry_path,
129158
"todo",

loopx/todo_suggestion_prompt.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
"post-connect",
3131
"no-runnable-todo",
3232
"repo-changed",
33+
"quality-watch",
3334
)
3435

3536

@@ -86,6 +87,13 @@ def build_todo_suggestion_prompt_packet(
8687
project_hint = _project_hint(project)
8788
agent_label = agent_id or "current project agent"
8889
source_text = ", ".join(selected_sources)
90+
quality_watch_note = (
91+
"\n\nBecause this is a `quality-watch` turn, compare fresh signals against the "
92+
"last known state first. Return candidates only for new or still-uncovered "
93+
"evidence; otherwise return an empty list with a short rationale."
94+
if selected_trigger == "quality-watch"
95+
else ""
96+
)
8997

9098
task_body = f"""Generate a bounded candidate todo decision queue for LoopX goal `{goal_id}`.
9199
@@ -104,6 +112,7 @@ def build_todo_suggestion_prompt_packet(
104112
`loopx todo update`, `loopx todo complete`, or edit LoopX state in this turn.
105113
If the evidence is weak or already covered by existing runnable todos, return an
106114
empty list with a short rationale.
115+
{quality_watch_note}
107116
108117
Each candidate must use schema `{SUGGESTED_TODO_CANDIDATE_SCHEMA_VERSION}` and
109118
include: `candidate_id`, `title`, `why_now`, `evidence`, `first_safe_action`,

0 commit comments

Comments
 (0)