From b231bc55227d4960b8b694f40b8db1e3f6457920 Mon Sep 17 00:00:00 2001 From: "Danilo M." Date: Wed, 25 Nov 2026 10:15:58 +0100 Subject: tools: vikunja, title search falls back to done, then open tasks Live, Gemma did not retry with all=1 for a task the user had closed, and an Italian word never matched an English title. Both are now answered by the script, with a line saying what was found. Co-Authored-By: Claude Opus 5.5 --- examples/tools/vikunja.py | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) (limited to 'examples/tools') diff --git a/examples/tools/vikunja.py b/examples/tools/vikunja.py index 30e36fb..13b4f8c 100755 --- a/examples/tools/vikunja.py +++ b/examples/tools/vikunja.py @@ -177,9 +177,22 @@ def do_list(query, project, due_before, all_, id_): # ponytail: first 50 matches sorted here; with more open tasks than that, # the soonest due can be missed. Server-side sort_by if it happens. items = call("tasks_list", **args)["items"] + head = "" + if not items and query.strip() and f[0] == "done = false": + # The model does not retry with all=1 on its own: a task the user + # names after closing it ("delete the bread one") must still be found. + args["filter"] = " && ".join(f[1:]) + items = call("tasks_list", **args)["items"] + head = "no open tasks match; done ones that do:\n" if items else "" + if not items: + # Titles are Italian or English, the question may be the other: + # "piante" never matches "Water the plants". Let the model pick. + args["filter"] = " && ".join([f[0]] + f[2:]) + items = call("tasks_list", **args)["items"] + head = f"no task title contains {query.strip()!r}; open tasks:\n" if items else "" far = datetime.max.replace(tzinfo=timezone.utc) items.sort(key=lambda t: (when(t["due_date"]) or far, t["id"])) - return "\n".join(line(t, ps) for t in items) or "no tasks" + return head + "\n".join(line(t, ps) for t in items) or "no tasks" def do_add(title, description, due, project): -- cgit v1.2.3