seeds: merge calendar and productivity_management into nextcloud

Consolidate the calendar and productivity_management seed categories into one
nextcloud category: create_event/next_event move from calendar, and
create_nextcloud_task becomes create_task (dropping the redundant prefix).
Replace the two CATEGORY_DESCRIPTIONS entries with a single nextcloud
description and update every reference across the repo (docs, bridge comments,
tests, navigation tuning labels, seed docstrings).
This commit is contained in:
gabby committed 2026-10-09 00:23:32 +00:00
1 parent e434b9fbe5
commit b8f86849ea
26 files changed
+134 -131

No files matched your search

+11 -11
View File
@@ -262,7 +262,7 @@ bridges/ standalone third-party API bridges (SimpleX, the LLM bridge,
and Notes (OCS) behind one JSON surface, so bodies never speak
DAV/OCS; no service daemon (stdlib-only), connection from
`bridges.nextcloud` with a fallback to the top-level
`nextcloud_*` values the calendar seeds use.
`nextcloud_*` values the nextcloud seeds use.
outlook.py + outlook_client.py: OutlookBridge — the user's
Microsoft account (Outlook / Microsoft 365) over Microsoft Graph:
mail, calendar events, Microsoft To Do tasks, contacts, and
@@ -383,7 +383,7 @@ CLI, unit tests (24) + integration tests (2).
model sent "book a flight to japan" to `simplex` (0.49 vs create_category
0.12); with descriptions it picks `create_category` 0.87. `Skill` carries
`category_description`, seeded by `CATEGORY_DESCRIPTIONS` for the built-ins
(response/calendar/simplex) and read from the registry for authored
(response/nextcloud/simplex) and read from the registry for authored
categories; `category_descriptions(tree)` collapses it per category so an
empty bucket is never offered bare. The old category threshold gate
(`create_tau`/`create_margin`) is **retired**. Leaf level: the softmax
@@ -460,13 +460,13 @@ CLI, unit tests (24) + integration tests (2).
path with `reason_kind="manual"`), and `cancel_build` (confirm, then discard a
queued/in-flight write and delete the half-built leaf). The target skill is an
**input variable**: the skill resolves it from the request if named
("delete skill calendar.foo") and otherwise **asks** for it ("delete skill" →
("delete skill nextcloud.foo") and otherwise **asks** for it ("delete skill" →
"Which skill?"), so the routed request never has to carry a task-like skill
name. Explicit command forms ("delete skill", "clear config variables for X",
"regen skill X", "cancel skill build") are recognized deterministically by
`parse_meta_command` and routed straight to the housekeeping leaf (trace
`meta_command`): the pinned 4B decision model reads a task-like name
(`calendar.create_event`) as the task itself and misroutes the generic guards,
(`nextcloud.create_event`) as the task itself and misroutes the generic guards,
so the explicit command is deterministic while natural-language phrasings
still go through navigation (the actionability guard's `action` option now
names skill-management commands). They are built-ins
@@ -860,12 +860,12 @@ CLI, unit tests (24) + integration tests (2).
loads them into every tree at startup; recorded config (credentials collected
at first fire) is written to the runtime store `data/skills/`, so the committed
seed never holds secrets, and a generated body with the same name replaces the
seed. `calendar.create_event` is the authoritative worked example (CalDAV PUT;
seed. `nextcloud.create_event` is the authoritative worked example (CalDAV PUT;
derives the title/date/time from the query, asks for missing fields and
resumes, resolves the target calendar with a SemIf choice over the owned
calendars — a strong winner is used, otherwise the configured default);
`calendar.next_event` is the read counterpart (Nextcloud CalDAV, recurring
events expanded server-side); `productivity_management.create_nextcloud_task`
`nextcloud.next_event` is the read counterpart (Nextcloud CalDAV, recurring
events expanded server-side); `nextcloud.create_task`
adds a task to a Nextcloud task list through the Nextcloud bridge (`GET
/tasklists` for a VTODO-capable target, `POST /tasks` to create it, the LLM
bridge to phrase the summary/description); `simplex.next_message` (read via the
@@ -876,7 +876,7 @@ CLI, unit tests (24) + integration tests (2).
is the top-level `timezone` config value (an IANA name such as
`America/Chicago`; `timers.local_now`/`resolve_timezone` resolve it via
`zoneinfo`), falling back to the host's own timezone when it is empty or
unknown; `TimerService` formats due/fired times in that zone too. The calendar
unknown; `TimerService` formats due/fired times in that zone too. The nextcloud
seeds derive "now" the same way, so a request time is parsed in the user's
zone rather than the host's;
`tests/test_seed_skills.py` keeps them honest.
@@ -1332,7 +1332,7 @@ CLI, unit tests (24) + integration tests (2).
(`enabled`/`host`/`port`/`token`). Bodies reach it via the derived
`llm_bridge_url` (+ optional `llm_bridge_token`). It runs inside the existing
`semif-bridge.service` process (all enabled bridges start together); with no
client it reports `502`, never a fabricated reply. `calendar.create_event` is
client it reports `502`, never a fabricated reply. `nextcloud.create_event` is
the first consumer (title + description extraction, cached in `request.meta`
across a `needs_input` resume).
- **Nextcloud bridge** (`bridges/nextcloud.py` + `bridges/nextcloud_client.py`).
@@ -1347,7 +1347,7 @@ CLI, unit tests (24) + integration tests (2).
and `verify_tls`/`timeout`); `build_bridge` passes the top-level
`nextcloud_url`/`nextcloud_username`/`nextcloud_app_password`/
`nextcloud_default_calendar`/`nextcloud_default_addressbook` as a fallback, so
the same account the calendar seeds collect is configured once and a block value
the same account the nextcloud seeds collect is configured once and a block value
wins. Bodies reach it via the derived `nextcloud_bridge_url` (+ optional
`nextcloud_bridge_token`); the `BridgeInfo` declares only those two config vars.
Routes (reads `GET`, mutations `POST`): files (`/files`, `/files/stat`,
@@ -1432,7 +1432,7 @@ The bridge read path (`simplex.next_message`) and contact-link lookup
generic `POST /chat` in front of the scheduler's configured `llm` client
(threaded through `run_bridges`/`build_bridge`, never re-configured), registered
in `CATALOG` and seeded under `bridges.llm` (its URL is derived from that block).
`calendar.create_event` extracts its title + description through it.
`nextcloud.create_event` extracts its title + description through it.
- [x] **5. More bridges.** Each new third-party API gets its own `bridges/<name>.py`
+ config block + `CATALOG` entry; the codegen prompts pick it up automatically
through `describe_bridges()`. Nextcloud shipped (`bridges/nextcloud.py` +
+7 -7
View File
@@ -21,7 +21,7 @@ A skill is three things:
talks to and how) and the `CONTRACT` constant (the values the runner must
provide).
The committed seed `seeds/calendar/create_event/` is the **authoritative worked
The committed seed `seeds/nextcloud/create_event/` is the **authoritative worked
example** of all three. Read its `manifest.json`, its `skill.py` (which declares
`INTEGRATION` and `CONTRACT`), and its `skill.test.py` alongside this file; a new
body should look and behave like it.
@@ -162,12 +162,12 @@ Rules:
real candidate set (fetched from the service), include any configured default as
one of the options, and threshold the winner: use it when its probability clears
the skill's confidence threshold, otherwise fall back to the configured default
(see `calendar.create_event` and `simplex.next_message`).
(see `nextcloud.create_event` and `simplex.next_message`).
- **Use the LLM bridge for text, not for routing or assessment.** Generated text
goes through the LLM bridge — a generic `POST /chat` whose base URL, token,
and endpoint shapes are in the bridge catalog injected below — never by
speaking a model's protocol directly. Keep the model extractive and bounded
(see how `calendar.create_event` asks only for a title and description), and
(see how `nextcloud.create_event` asks only for a title and description), and
report a real failure when the bridge is down rather than guessing the text.
- **Never blur the boundaries.** SemIf never generates; an LLM never routes,
selects, or assesses; deterministic code never invents a value it cannot
@@ -422,7 +422,7 @@ return ActionResult(..., decisions=[(decision, result)])
options, so the request can override the stored default.
- When the winner is weak (its probability is below the skill's confidence
threshold), fall back to the configured default; with no configured default,
keep the weak winner. See how `calendar.create_event` resolves its calendar.
keep the weak winner. See how `nextcloud.create_event` resolves its calendar.
### Producing the result (output)
@@ -515,7 +515,7 @@ Rules:
for. `request.meta` is a scratch dict carried on the same request across the
pause, so a body can cache a computed value or an already-collected answer
there and reuse it on the resume pass instead of recomputing or re-asking —
see how `calendar.create_event` caches the extracted title/description and the
see how `nextcloud.create_event` caches the extracted title/description and the
answers it collected.
- **Fail fast on budget.** Keep the work small; do not loop or retry in code.
- **The function is `act` exactly.** The module is imported under its registered
@@ -557,7 +557,7 @@ Rules:
- **Resolve the recipient/target with a SemIf sub-decision.** When more than one
conversation or target is relevant, resolve which one with a
`ctx.engine.call(...)` sub-decision over the catalog's list endpoint (e.g.
contacts or buffered senders), mirroring how `calendar.create_event` picks a
contacts or buffered senders), mirroring how `nextcloud.create_event` picks a
calendar. Use the catalog's default config var as the configured option when
the request does not already make it clear.
- **Sending requires user intent.** Send only because the request (or the
@@ -576,7 +576,7 @@ Rules:
- Single purpose, single file, single module.
- Avoid duplicating an existing skill in the same category.
- `act` resolves ambiguity (arguments, recipients, targets) with SemIf
sub-decisions, mirroring how `calendar.create_event` resolves which calendar
sub-decisions, mirroring how `nextcloud.create_event` resolves which calendar
to write to.
- `act` performs the concrete real action and writes a human-readable
`action_log` that the SemIf assessment step can judge. Include what the
+11 -6
View File
@@ -343,8 +343,9 @@ fine-tuning loop — it is not yet the fine-tune itself.
text-to-speech, all local (openWakeWord / faster-whisper / Piper).
- **Standalone bridge services** — a token-guarded localhost HTTP layer in front
of third-party systems, so generated bodies never speak native protocols.
- **Seeds** — shipped real starter skills: `calendar.create_event` (the
authoritative worked example), `calendar.next_event` (Nextcloud CalDAV), and
- **Seeds** — shipped real starter skills: `nextcloud.create_event` (the
authoritative worked example), `nextcloud.next_event` (Nextcloud CalDAV),
`nextcloud.create_task` (Nextcloud task list), and
`simplex.next_message` / `simplex.connect_link`.
- **Fatal-on-engine-loss** — the engine is always real; its absence exits the app.
- **Stdlib-only core** — SemIf/llama.cpp are lazy imports, so the package stays
@@ -385,7 +386,7 @@ semif_agent/
speech-to-text (faster-whisper), text-to-speech (Piper)
gateway/ messenger COMMAND intake/reply (SimpleX, LXMF, voice)
bridges/ standalone third-party API bridges (SimpleX, LLM, Nextcloud)
seeds/ committed starter skills (calendar, simplex)
seeds/ committed starter skills (nextcloud, simplex)
scripts/ bootstrap.sh, simplex-address.py, systemd/*.in
requirements/ staging.txt — the pinned engine deps
tests/ stdlib unit tests + tests/integration (real engine + LLM)
@@ -745,7 +746,7 @@ plain HTTPS) and is stdlib-only (`urllib` + `xml.etree`), so it starts instantly
in the same `semif-bridge` process. The connection (base URL, username, app
password) is configured in `bridges.nextcloud` and falls back to the top-level
`nextcloud_url` / `nextcloud_username` / `nextcloud_app_password` /
`nextcloud_default_calendar` the calendar seeds use, so the account is
`nextcloud_default_calendar` the nextcloud seeds use, so the account is
configured once. Skills call it at the address derived from `bridges.nextcloud`
(`nextcloud_bridge_url`, + optional `nextcloud_bridge_token`). Its HTTP surface:
@@ -856,15 +857,19 @@ folder format, plus a `manifest.json`. `merge_seed_store` loads them into every
tree at startup; recorded config is written to the runtime store, so the
committed seed never holds secrets.
- `calendar.create_event` — create an event on Nextcloud CalDAV (the
- `nextcloud.create_event` — create an event on Nextcloud CalDAV (the
authoritative worked example); resolves the target calendar with a SemIf
choice over the owned calendars (strong winner, else the configured default);
config vars `nextcloud_url`, `nextcloud_username`, `nextcloud_app_password`,
`nextcloud_default_calendar`, plus the LLM bridge (`llm_bridge_url`,
`llm_bridge_token`).
- `calendar.next_event` — next upcoming event from Nextcloud CalDAV (recurring
- `nextcloud.next_event` — next upcoming event from Nextcloud CalDAV (recurring
events expanded server-side); config vars `nextcloud_url`,
`nextcloud_username`, `nextcloud_app_password`, `nextcloud_default_calendar`.
- `nextcloud.create_task` — add a task to a Nextcloud task list through the
Nextcloud bridge (`GET /tasklists`, `POST /tasks`); config vars
`nextcloud_bridge_url`, `nextcloud_bridge_token`, `llm_bridge_url`,
`llm_bridge_token`.
- `simplex.next_message` — read the next unread message via the forwarding
bridge; config vars `simplex_bridge_url`, `simplex_bridge_token`,
`simplex_default_contact`.
+1 -1
View File
@@ -149,7 +149,7 @@
"token": ""
},
"nextcloud": {
"_comment": "Nextcloud bridge: files (WebDAV), calendar events and tasks (CalDAV), contacts (CardDAV), and Notes (the Notes app) over one uniform local JSON API, so skill bodies never speak the native DAV/OCS protocols. It has no service daemon (Nextcloud is plain HTTPS) and runs inside the same `semif-bridge` process as the other enabled bridges. The connection is configured HERE (url/username/app_password); when a value is blank the bridge falls back to the top-level nextcloud_url/nextcloud_username/nextcloud_app_password/nextcloud_default_calendar the calendar seeds already use, so the account is configured once. `app_password` is a Nextcloud app password (Settings > Security > Devices & sessions), not the account password. `default_calendar`/`default_task_calendar`/`default_addressbook` are used when a request names none and the account has several; task operations only ever target a VTODO-capable task list (GET /tasklists), never an event-only calendar. `verify_tls` false skips certificate verification (self-signed hosts). Skills call it at http://host:port (derived from this block; no top-level duplicate). Binds localhost only; an optional `token` is required in the X-Semif-Token header when set.",
"_comment": "Nextcloud bridge: files (WebDAV), calendar events and tasks (CalDAV), contacts (CardDAV), and Notes (the Notes app) over one uniform local JSON API, so skill bodies never speak the native DAV/OCS protocols. It has no service daemon (Nextcloud is plain HTTPS) and runs inside the same `semif-bridge` process as the other enabled bridges. The connection is configured HERE (url/username/app_password); when a value is blank the bridge falls back to the top-level nextcloud_url/nextcloud_username/nextcloud_app_password/nextcloud_default_calendar the nextcloud seeds already use, so the account is configured once. `app_password` is a Nextcloud app password (Settings > Security > Devices & sessions), not the account password. `default_calendar`/`default_task_calendar`/`default_addressbook` are used when a request names none and the account has several; task operations only ever target a VTODO-capable task list (GET /tasklists), never an event-only calendar. `verify_tls` false skips certificate verification (self-signed hosts). Skills call it at http://host:port (derived from this block; no top-level duplicate). Binds localhost only; an optional `token` is required in the X-Semif-Token header when set.",
"enabled": true,
"host": "127.0.0.1",
"port": 5230,
+1 -1
View File
@@ -629,7 +629,7 @@ Nextcloud bridge (files/calendar/tasks/contacts/notes for skills):
- Runs inside the same 'semif-bridge' process (Nextcloud is plain HTTPS, so
there is no separate daemon). Configure the account once in config.json under
bridges.nextcloud (url/username/app_password) — or reuse the top-level
nextcloud_* values the calendar seeds collect. Skills call it at the address
nextcloud_* values the nextcloud seeds collect. Skills call it at the address
derived from bridges.nextcloud (default http://127.0.0.1:5230).
EOF
+2 -2
View File
@@ -62,7 +62,7 @@ LEAF_EVAL: list[tuple[str, str]] = [
("send a simplex message to pepper saying hi", "simplex.send_simplex_message"),
("what is my simplex connection link?", "simplex.connect_link"),
("give me my simplex contact link", "simplex.connect_link"),
("tell me the next event in my nextcloud calendar", "calendar.next_event"),
("tell me the next event in my nextcloud calendar", "nextcloud.next_event"),
("translate my last simplex message to French", "create"),
("delete my next simplex message", "create"),
("book a flight to japan", "create"),
@@ -73,7 +73,7 @@ CATEGORY_EVAL: list[tuple[str, str]] = [
("what is my next message on simplex?", "simplex"),
("send a simplex message to pepper saying hi", "simplex"),
("what is my simplex connection link?", "simplex"),
("tell me the next event in my nextcloud calendar", "calendar"),
("tell me the next event in my nextcloud calendar", "nextcloud"),
("hello there", "response"),
("thanks!", "response"),
("what", "response"),
@@ -481,7 +481,7 @@ def _build_ics(uid, summary, start, end, all_day, stamp, description=""):
lines = [
"BEGIN:VCALENDAR",
"VERSION:2.0",
"PRODID:-//semif-agent//calendar.create_event//EN",
"PRODID:-//semif-agent//nextcloud.create_event//EN",
"CALSCALE:GREGORIAN",
"BEGIN:VEVENT",
f"UID:{uid}",
@@ -1,4 +1,4 @@
"""Hermetic mechanics test for calendar.create_event.
"""Hermetic mechanics test for nextcloud.create_event.
Run from this folder: `python skill.test.py`. No external network: a loopback
http.server plays a Nextcloud CalDAV endpoint (PROPFIND discovery + PUT create)
@@ -422,7 +422,7 @@ def test_unreachable_server_fails_honestly():
action, request, _engine = run(
None, "http://127.0.0.1:1", "add standup on 2026-11-10 at 9am"
)
assert action.action_log and "calendar.create_event" not in action.action_log, action.action_log
assert action.action_log and "nextcloud.create_event" not in action.action_log, action.action_log
assert action.new_state == request.text
print(action.action_log)
@@ -1,4 +1,4 @@
"""Hermetic mechanics test for productivity_management.create_nextcloud_task.
"""Hermetic mechanics test for nextcloud.create_task.
Run from this folder: `python skill.test.py`. No external network: a loopback
http.server plays the Nextcloud bridge (`GET /tasklists`, `POST /tasks`) and the
@@ -212,7 +212,7 @@ def _default_calendar(ctx, calendars):
def _resolve_calendar(ctx, request, calendars, decisions):
"""Resolve which calendar the request means, mirroring calendar.create_event.
"""Resolve which calendar the request means, mirroring nextcloud.create_event.
A strong SemIf winner is used; a weak winner falls back to the configured
default calendar, and with no configured default the weak winner stands.
@@ -1,4 +1,4 @@
"""Hermetic mechanics test for calendar.next_event.
"""Hermetic mechanics test for nextcloud.next_event.
Run from this folder: `python skill.test.py`. No external network: a loopback
http.server plays the Nextcloud CalDAV endpoint. This proves the body builds
+1 -1
View File
@@ -128,7 +128,7 @@ def _default_sender(ctx, senders):
def _resolve_contact(ctx, request, senders, decisions):
"""Resolve which conversation to read, mirroring calendar.create_event.
"""Resolve which conversation to read, mirroring nextcloud.create_event.
A strong SemIf winner is used; a weak winner falls back to the configured
default contact, and with no configured default the weak winner stands.
+1 -1
View File
@@ -11,7 +11,7 @@ There is no service daemon: Nextcloud is plain HTTPS, so the bridge is stdlib-on
(`urllib` + `xml.etree`) and starts instantly. The connection comes from
`bridges.nextcloud` (url/username/app_password/default_calendar/default_addressbook),
falling back to the top-level `nextcloud_url`/`nextcloud_username`/
`nextcloud_app_password`/`nextcloud_default_calendar` values the calendar seeds
`nextcloud_app_password`/`nextcloud_default_calendar` values the nextcloud seeds
already use, so the same account is configured in one place.
The actual DAV/OCS work lives in `nextcloud_client.py`; the routes here validate
+1 -1
View File
@@ -112,7 +112,7 @@ def build_bridge(
`llm` is the scheduler's configured language-model client, handed to the LLM
bridge so it reuses the top-level `llm` endpoint/model instead of duplicating
that config. The Nextcloud bridge gets the top-level `nextcloud_*` values as a
fallback, so the same account the calendar seeds use is configured once. Other
fallback, so the same account the nextcloud seeds use is configured once. Other
bridges ignore both.
"""
bridge_class = _class_for(name)
+7 -10
View File
@@ -656,9 +656,10 @@ CATEGORY_DESCRIPTIONS: dict[str, str] = {
"Anything that is not a request to perform an action or produce a result: "
"greetings, thanks, acknowledgements, chit-chat, and off-topic statements."
),
"calendar": (
"Calendar and scheduling: reading or changing the user's calendar "
"events and reminders."
"nextcloud": (
"Nextcloud productivity: the user's calendar events and scheduling "
"(reading or changing events and reminders) and the user's to-do tasks "
"and task lists."
),
"simplex": (
"SimpleX messaging: reading incoming messages, sending messages to "
@@ -668,10 +669,6 @@ CATEGORY_DESCRIPTIONS: dict[str, str] = {
"Time and date utilities: telling the current time or date, setting "
"countdown timers, and setting alarms."
),
"productivity_management": (
"Personal productivity: creating and managing the user's to-do tasks "
"and task lists."
),
"housekeeping": (
"Agent self-maintenance: deleting, reconfiguring, regenerating, and "
"cancelling the agent's own skills."
@@ -724,7 +721,7 @@ _TARGET_QUESTION = (
# Explicit housekeeping command forms. They are routed deterministically to the
# housekeeping skill (see parse_meta_command) because the generic SemIf guards
# read a task-like skill name in the request as the task itself (e.g.
# "regen skill calendar.create_event" scores as a calendar task). The skill name
# "regen skill nextcloud.create_event" scores as a nextcloud task). The skill name
# is just a variable the skill resolves — or asks for.
_META_PATTERNS: list[tuple[str, "re.Pattern[str]"]] = [
(
@@ -785,10 +782,10 @@ def parse_meta_command(text: str) -> str | None:
def _resolve_target(admin, request: Request):
"""Resolve the skill a housekeeping request targets.
The target may be named in the request ("delete skill calendar.foo") or
The target may be named in the request ("delete skill nextcloud.foo") or
supplied as an input variable when the request is name-free ("delete
skill") — in which case the skill asks for it. Keeping the name out of the
routed request is deliberate: a skill name like `calendar.create_event`
routed request is deliberate: a skill name like `nextcloud.create_event`
reads as a task and pulls navigation to the wrong category. Returns a
`(category, name)` tuple, or an `ActionResult` (needs_input / not-found /
ambiguous) to return as-is.
+1 -1
View File
@@ -215,7 +215,7 @@ def test_navigation_routes_noise_into_the_response_tree(tmp_path):
scheduler.engine, scheduler.log, scheduler.trace, Request(text), scheduler.tree
)
print(f"[lookup] {text!r} -> {result!r}")
assert getattr(result, "category", None) == "calendar", f"lookup misrouted: {text!r}"
assert getattr(result, "category", None) == "nextcloud", f"lookup misrouted: {text!r}"
for text in noise:
result = navigate(
scheduler.engine, scheduler.log, scheduler.trace, Request(text), scheduler.tree
+63 -63
View File
@@ -110,15 +110,15 @@ def test_build_housekeeping_skills():
def test_parse_meta_command_forms():
assert parse_meta_command("delete skill") == "delete_skill"
assert parse_meta_command("delete skill calendar.foo") == "delete_skill"
assert parse_meta_command("delete skill nextcloud.foo") == "delete_skill"
assert parse_meta_command("remove skill simplex.next_message") == "delete_skill"
assert parse_meta_command("clear config variables") == "clear_config"
assert parse_meta_command("clear the config variables for calendar.foo") == "clear_config"
assert parse_meta_command("clear the config variables for nextcloud.foo") == "clear_config"
assert parse_meta_command("clear the settings for simplex.next_message") == "clear_config"
assert parse_meta_command("reset a skill's settings") == "clear_config"
assert parse_meta_command("regen skill") == "regen_skill"
assert parse_meta_command("regenerate the simplex skill") == "regen_skill"
assert parse_meta_command("rewrite the code for calendar.foo") == "regen_skill"
assert parse_meta_command("rewrite the code for nextcloud.foo") == "regen_skill"
assert parse_meta_command("cancel skill build") == "cancel_build"
assert parse_meta_command("cancel the skill build") == "cancel_build"
assert parse_meta_command("abort the build") == "cancel_build"
@@ -141,19 +141,19 @@ def test_parse_meta_command_leaves_normal_requests_alone():
def test_dispatch_routes_meta_command_deterministically(tmp_path):
scheduler = _scheduler(tmp_path)
_add_skill(scheduler, "calendar", "foo")
_add_skill(scheduler, "nextcloud", "foo")
# clear config runs immediately (no confirmation).
result = scheduler._dispatch(Request("clear config variables for calendar.foo"))
result = scheduler._dispatch(Request("clear config variables for nextcloud.foo"))
assert result.kind == "ran"
assert result.skill == "clear_config"
# delete routes to the meta skill and pauses for confirmation.
delete = scheduler._dispatch(Request("delete skill calendar.foo"))
delete = scheduler._dispatch(Request("delete skill nextcloud.foo"))
assert delete.kind == "needs_input"
assert delete.skill == "delete_skill"
assert any(e["kind"] == "meta_command" for e in scheduler.trace.read())
assert any(s.name == "foo" for s in scheduler.tree["calendar"])
assert any(s.name == "foo" for s in scheduler.tree["nextcloud"])
# ---- name resolution ----
@@ -161,8 +161,8 @@ def test_dispatch_routes_meta_command_deterministically(tmp_path):
def _tree():
return {
"calendar": [
Skill(name="next_event", category="calendar", description="d"),
"nextcloud": [
Skill(name="next_event", category="nextcloud", description="d"),
],
"simplex": [
Skill(name="next_message", category="simplex", description="d"),
@@ -172,8 +172,8 @@ def _tree():
def test_resolve_skill_ref_dotted_and_bare():
tree = _tree()
assert resolve_skill_ref(tree, "delete skill calendar.next_event") == (
"calendar",
assert resolve_skill_ref(tree, "delete skill nextcloud.next_event") == (
"nextcloud",
"next_event",
)
assert resolve_skill_ref(tree, "delete skill next_message") == (
@@ -208,9 +208,9 @@ def test_registry_unregister_skill(tmp_path):
def test_skill_store_delete_and_path_guard(tmp_path):
store = SkillStore(str(tmp_path / "skills"))
store.write_body("calendar", "foo", "x = 1\n")
assert store.delete("calendar", "foo") is True
assert not store.dir("calendar", "foo").exists()
store.write_body("nextcloud", "foo", "x = 1\n")
assert store.delete("nextcloud", "foo") is True
assert not store.dir("nextcloud", "foo").exists()
with pytest.raises(ValueError):
store.delete("..", "escape")
@@ -218,36 +218,36 @@ def test_skill_store_delete_and_path_guard(tmp_path):
def test_deleted_skills_roundtrip(tmp_path):
deleted = DeletedSkills(str(tmp_path / "deleted.json"))
assert deleted.read() == set()
deleted.add("calendar", "foo")
assert deleted.contains("calendar", "foo")
deleted.remove("calendar", "foo")
deleted.add("nextcloud", "foo")
assert deleted.contains("nextcloud", "foo")
deleted.remove("nextcloud", "foo")
assert deleted.read() == set()
def test_apply_tombstones():
tree = {
"calendar": [Skill(name="foo", category="calendar", description="d")],
"nextcloud": [Skill(name="foo", category="nextcloud", description="d")],
"simplex": [Skill(name="bar", category="simplex", description="d")],
}
deleted = DeletedSkills("/nonexistent/deleted.json")
deleted.read = lambda: {"calendar.foo"} # type: ignore[assignment]
deleted.read = lambda: {"nextcloud.foo"} # type: ignore[assignment]
removed = apply_tombstones(tree, deleted)
assert removed == 1
assert tree["calendar"] == []
assert tree["nextcloud"] == []
assert [s.name for s in tree["simplex"]] == ["bar"]
def test_delete_seed_is_durable(tmp_path):
_write_seed(tmp_path / "seeds", "calendar", "probe")
_write_seed(tmp_path / "seeds", "nextcloud", "probe")
scheduler = _scheduler(tmp_path)
assert any(s.name == "probe" for s in scheduler.tree["calendar"])
assert scheduler.tree["calendar"][0].origin == "seed"
assert any(s.name == "probe" for s in scheduler.tree["nextcloud"])
assert scheduler.tree["nextcloud"][0].origin == "seed"
status, _ = scheduler.delete_skill("calendar", "probe")
status, _ = scheduler.delete_skill("nextcloud", "probe")
assert status == "ok"
reloaded = _scheduler(tmp_path)
assert all(s.name != "probe" for s in reloaded.tree.get("calendar", []))
assert all(s.name != "probe" for s in reloaded.tree.get("nextcloud", []))
# ---- locks ----
@@ -304,17 +304,17 @@ def test_restart_skill_blocked_when_locked(tmp_path):
def test_delete_skill_removes_tree_registry_and_folder(tmp_path):
scheduler = _scheduler(tmp_path)
_add_skill(scheduler, "calendar", "foo")
status, detail = scheduler.delete_skill("calendar", "foo")
_add_skill(scheduler, "nextcloud", "foo")
status, detail = scheduler.delete_skill("nextcloud", "foo")
assert status == "ok"
assert all(s.name != "foo" for s in scheduler.tree["calendar"])
assert scheduler.body_store.read_contract("calendar", "foo") == {}
assert not scheduler.body_store.dir("calendar", "foo").exists()
assert all(s.name != "foo" for s in scheduler.tree["nextcloud"])
assert scheduler.body_store.read_contract("nextcloud", "foo") == {}
assert not scheduler.body_store.dir("nextcloud", "foo").exists()
assert all(
s.get("name") != "foo"
for s in scheduler.registry.read()["calendar"]["skills"]
for s in scheduler.registry.read()["nextcloud"]["skills"]
)
assert scheduler.deleted.contains("calendar", "foo")
assert scheduler.deleted.contains("nextcloud", "foo")
assert any(e["kind"] == "skill_deleted" for e in scheduler.trace.read())
@@ -328,14 +328,14 @@ def test_delete_refuses_builtin(tmp_path):
def test_clear_skill_config(tmp_path):
scheduler = _scheduler(tmp_path)
skill = _add_skill(scheduler, "calendar", "foo")
skill = _add_skill(scheduler, "nextcloud", "foo")
skill.config = {"api_key": "x"}
scheduler.body_store.write_config("calendar", "foo", {"api_key": "x"})
scheduler.body_store.write_config("nextcloud", "foo", {"api_key": "x"})
status, detail = scheduler.clear_skill_config("calendar", "foo")
status, detail = scheduler.clear_skill_config("nextcloud", "foo")
assert status == "ok"
assert "api_key" in detail
assert scheduler.body_store.read_config("calendar", "foo") == {}
assert scheduler.body_store.read_config("nextcloud", "foo") == {}
assert skill.config == {}
assert any(e["kind"] == "config_cleared" for e in scheduler.trace.read())
@@ -343,7 +343,7 @@ def test_clear_skill_config(tmp_path):
def test_regen_skill_rewrites_existing_body(tmp_path, monkeypatch):
scheduler = _scheduler(tmp_path)
scheduler.codegen = object()
_add_skill(scheduler, "calendar", "foo")
_add_skill(scheduler, "nextcloud", "foo")
captured = {}
def fake_start(request, category, draft, repair_evidence=None, reason_kind="run_failure"):
@@ -354,7 +354,7 @@ def test_regen_skill_rewrites_existing_body(tmp_path, monkeypatch):
)
monkeypatch.setattr(scheduler, "_start_skill_write", fake_start)
status, _ = scheduler.regen_skill("calendar", "foo", "it crashes")
status, _ = scheduler.regen_skill("nextcloud", "foo", "it crashes")
assert status == "running"
assert captured["reason_kind"] == "manual"
assert captured["repair_evidence"]["guidance"] == "it crashes"
@@ -366,8 +366,8 @@ def test_regen_skill_rewrites_existing_body(tmp_path, monkeypatch):
def test_regen_skill_stub_has_no_evidence(tmp_path, monkeypatch):
scheduler = _scheduler(tmp_path)
scheduler.codegen = object()
scheduler.tree["calendar"] = [
Skill(name="stub", category="calendar", description="d")
scheduler.tree["nextcloud"] = [
Skill(name="stub", category="nextcloud", description="d")
]
captured = {}
@@ -375,30 +375,30 @@ def test_regen_skill_stub_has_no_evidence(tmp_path, monkeypatch):
captured.update(repair_evidence=repair_evidence, reason_kind=reason_kind)
monkeypatch.setattr(scheduler, "_start_skill_write", fake_start)
status, _ = scheduler.regen_skill("calendar", "stub", "make it work")
status, _ = scheduler.regen_skill("nextcloud", "stub", "make it work")
assert status == "running"
assert captured["repair_evidence"] is None
def test_cancel_skill_build_discards_and_deletes(tmp_path):
scheduler = _scheduler(tmp_path)
skill = _add_skill(scheduler, "calendar", "foo")
skill = _add_skill(scheduler, "nextcloud", "foo")
skill.writing = True
scheduler._writes.append(
SkillWrite(
request=Request("build foo"),
category="calendar",
category="nextcloud",
draft=SkillDraft(name="foo", description="d"),
)
)
status, detail = scheduler.cancel_skill_build("calendar", "foo")
status, detail = scheduler.cancel_skill_build("nextcloud", "foo")
assert status == "ok"
assert "cancelled" in detail
assert ("calendar", "foo") in scheduler._cancelled
assert ("nextcloud", "foo") in scheduler._cancelled
assert not any(w.draft.name == "foo" for w in scheduler._writes)
assert all(s.name != "foo" for s in scheduler.tree["calendar"])
assert not scheduler.body_store.dir("calendar", "foo").exists()
assert all(s.name != "foo" for s in scheduler.tree["nextcloud"])
assert not scheduler.body_store.dir("nextcloud", "foo").exists()
assert any(
e["kind"] == "skill_build_cancelled" for e in scheduler.trace.read()
)
@@ -408,12 +408,12 @@ def test_consume_cancelled_discards_queued_write(tmp_path):
scheduler = _scheduler(tmp_path)
job = SkillWrite(
request=Request("build foo"),
category="calendar",
category="nextcloud",
draft=SkillDraft(name="foo", description="d"),
)
scheduler._cancelled.add(("calendar", "foo"))
scheduler._cancelled.add(("nextcloud", "foo"))
assert scheduler._consume_cancelled(job) is True
assert ("calendar", "foo") not in scheduler._cancelled
assert ("nextcloud", "foo") not in scheduler._cancelled
assert any(
e["kind"] == "skill_write_cancelled" for e in scheduler.trace.read()
)
@@ -424,57 +424,57 @@ def test_consume_cancelled_discards_queued_write(tmp_path):
def test_delete_skill_act_confirms_then_deletes(tmp_path):
scheduler = _scheduler(tmp_path)
_add_skill(scheduler, "calendar", "foo")
_add_skill(scheduler, "nextcloud", "foo")
ctx = ActionContext(engine=None, config={}, admin=scheduler)
request = Request("delete skill calendar.foo")
request = Request("delete skill nextcloud.foo")
first = _delete_skill_act(ctx, request)
assert first.needs_input and "confirm" in first.needs_input.lower()
assert any(s.name == "foo" for s in scheduler.tree["calendar"])
assert any(s.name == "foo" for s in scheduler.tree["nextcloud"])
request.user_input = "yes"
second = _delete_skill_act(ctx, request)
assert second.needs_input is None
assert all(s.name != "foo" for s in scheduler.tree["calendar"])
assert all(s.name != "foo" for s in scheduler.tree["nextcloud"])
def test_delete_skill_act_asks_for_target_when_absent(tmp_path):
"""A name-free request ("delete skill") asks for the target as an input
variable, then confirms, then deletes."""
scheduler = _scheduler(tmp_path)
_add_skill(scheduler, "calendar", "foo")
_add_skill(scheduler, "nextcloud", "foo")
ctx = ActionContext(engine=None, config={}, admin=scheduler)
request = Request("delete skill")
first = _delete_skill_act(ctx, request)
assert first.needs_input and "which skill" in first.needs_input.lower()
request.user_input = "calendar.foo"
request.user_input = "nextcloud.foo"
second = _delete_skill_act(ctx, request)
assert second.needs_input and "confirm" in second.needs_input.lower()
request.user_input = "yes"
third = _delete_skill_act(ctx, request)
assert third.needs_input is None
assert all(s.name != "foo" for s in scheduler.tree["calendar"])
assert all(s.name != "foo" for s in scheduler.tree["nextcloud"])
def test_delete_skill_act_declined_keeps_skill(tmp_path):
scheduler = _scheduler(tmp_path)
_add_skill(scheduler, "calendar", "foo")
_add_skill(scheduler, "nextcloud", "foo")
ctx = ActionContext(engine=None, config={}, admin=scheduler)
request = Request("delete skill calendar.foo")
request = Request("delete skill nextcloud.foo")
_delete_skill_act(ctx, request)
request.user_input = "no"
result = _delete_skill_act(ctx, request)
assert result.needs_input is None
assert "cancelled" in result.action_log
assert any(s.name == "foo" for s in scheduler.tree["calendar"])
assert any(s.name == "foo" for s in scheduler.tree["nextcloud"])
def test_cancel_build_act_targets_writing_skill(tmp_path):
scheduler = _scheduler(tmp_path)
skill = _add_skill(scheduler, "calendar", "foo")
skill = _add_skill(scheduler, "nextcloud", "foo")
skill.writing = True
ctx = ActionContext(engine=None, config={}, admin=scheduler)
@@ -484,12 +484,12 @@ def test_cancel_build_act_targets_writing_skill(tmp_path):
request.user_input = "yes"
second = _cancel_build_act(ctx, request)
assert second.needs_input is None
assert all(s.name != "foo" for s in scheduler.tree["calendar"])
assert all(s.name != "foo" for s in scheduler.tree["nextcloud"])
def test_cancel_build_act_reports_when_nothing_writing(tmp_path):
scheduler = _scheduler(tmp_path)
_add_skill(scheduler, "calendar", "foo")
_add_skill(scheduler, "nextcloud", "foo")
ctx = ActionContext(engine=None, config={}, admin=scheduler)
result = _cancel_build_act(ctx, Request("cancel the skill build"))
assert result.needs_input is None
+3 -3
View File
@@ -30,15 +30,15 @@ def seed_id(seed: Path) -> str:
def test_expected_seeds_exist():
ids = {seed_id(seed) for seed in SEED_DIRS}
assert "calendar.next_event" in ids
assert "calendar.create_event" in ids
assert "nextcloud.next_event" in ids
assert "nextcloud.create_event" in ids
assert "simplex.next_message" in ids
assert "simplex.connect_link" in ids
assert "time.now" in ids
assert "time.date" in ids
assert "time.set_timer" in ids
assert "time.set_alarm" in ids
assert "productivity_management.create_nextcloud_task" in ids
assert "nextcloud.create_task" in ids
@pytest.mark.parametrize("seed", SEED_DIRS, ids=[seed_id(s) for s in SEED_DIRS])
+18 -17
View File
@@ -168,7 +168,7 @@ def test_run_summary_is_deterministic_and_surfaces_action_log(tmp_path):
skill = Skill(
name="next_event",
category="calendar",
category="nextcloud",
description="Report the next event.",
act=act,
)
@@ -177,7 +177,7 @@ def test_run_summary_is_deterministic_and_surfaces_action_log(tmp_path):
assert result.kind == "ran"
expected = (
"calendar.next_event: ok — Next event on 'personal': Team sync — 2026-09-27 10:00 CEST"
"nextcloud.next_event: ok — Next event on 'personal': Team sync — 2026-09-27 10:00 CEST"
)
assessed = [e for e in scheduler.trace.read() if e["kind"] == "assessed"]
assert assessed, "the run must be traced"
@@ -433,13 +433,13 @@ def test_merge_seed_store_loads_skill_with_runtime_config(tmp_path):
the runtime store, never in the seed folder."""
seed_store = SkillStore(str(tmp_path / "seeds"))
config_store = SkillStore(str(tmp_path / "skills"))
_write_seed(seed_store, "calendar", "probe", description="Probe a service.")
config_store.write_config("calendar", "probe", {"probe_url": "https://example.test"})
_write_seed(seed_store, "nextcloud", "probe", description="Probe a service.")
config_store.write_config("nextcloud", "probe", {"probe_url": "https://example.test"})
tree = build_tree(build_skills({"skills": {}}))
loaded = merge_seed_store(tree, seed_store, config_store)
assert loaded == 1
skill = tree["calendar"][0]
skill = tree["nextcloud"][0]
assert skill.status == "ready"
assert skill.description == "Probe a service."
assert skill.contract == {"probe_url": "Where to probe."}
@@ -450,16 +450,16 @@ def test_merge_seed_store_loads_skill_with_runtime_config(tmp_path):
def test_merge_seed_store_falls_back_to_name_and_body_store_wins(tmp_path):
seed_store = SkillStore(str(tmp_path / "seeds"))
body_store = SkillStore(str(tmp_path / "skills"))
_write_seed(seed_store, "calendar", "probe")
_write_seed(seed_store, "nextcloud", "probe")
tree = build_tree(build_skills({"skills": {}}))
merge_seed_store(tree, seed_store, body_store)
assert tree["calendar"][0].description == "probe"
assert tree["nextcloud"][0].description == "probe"
body_store.write_body("calendar", "probe", GOOD_BODY)
body_store.write_body("nextcloud", "probe", GOOD_BODY)
merge_skill_store(tree, body_store, {})
assert tree["calendar"][0].description == "probe", "the generated body replaces the seed"
assert len(tree["calendar"]) == 1
assert tree["nextcloud"][0].description == "probe", "the generated body replaces the seed"
assert len(tree["nextcloud"]) == 1
def test_scheduler_loads_committed_seed_skills(tmp_path):
@@ -477,13 +477,13 @@ def test_scheduler_loads_committed_seed_skills(tmp_path):
},
trace=TraceLog(str(tmp_path / "runs.jsonl")),
)
calendar = scheduler.tree["calendar"]
assert [s.name for s in calendar] == ["create_event", "next_event"]
next_event = next(s for s in calendar if s.name == "next_event")
nextcloud = scheduler.tree["nextcloud"]
assert [s.name for s in nextcloud] == ["create_event", "create_task", "next_event"]
next_event = next(s for s in nextcloud if s.name == "next_event")
assert next_event.description.startswith("Report the next")
assert next_event.status == "ready"
assert next_event.integration["transport"] == "caldav"
create_event = next(s for s in calendar if s.name == "create_event")
create_event = next(s for s in nextcloud if s.name == "create_event")
assert create_event.description.startswith("Create a calendar event")
assert create_event.integration["transport"] == "caldav"
@@ -540,8 +540,9 @@ def test_committed_seeds_load_from_a_foreign_cwd(tmp_path, monkeypatch):
"connect_link",
"next_message",
]
assert [s.name for s in scheduler.tree["calendar"]] == [
assert [s.name for s in scheduler.tree["nextcloud"]] == [
"create_event",
"create_task",
"next_event",
]
@@ -828,7 +829,7 @@ def test_confirm_category_fit_threshold(tmp_path):
engine = ScriptedEngine(choices={"Does the scope": "covers"})
assert (
confirm_category_fit(
engine, log, trace, Request("check my calendar"), "calendar", "Calendars.", tau=0.5
engine, log, trace, Request("check my calendar"), "nextcloud", "Nextcloud.", tau=0.5
)
is True
)
@@ -837,7 +838,7 @@ def test_confirm_category_fit_threshold(tmp_path):
engine = ScriptedEngine(choices={"Does the scope": "none"})
assert (
confirm_category_fit(
engine, log, trace, Request("order pizza"), "calendar", "Calendars.", tau=0.5
engine, log, trace, Request("order pizza"), "nextcloud", "Nextcloud.", tau=0.5
)
is False
)