new-skill creation: deny by default, refuse silently

A host now leans on the committed packs: `new_skill_creation` defaults to
`deny` (core schema, generated config.example.json, and the scheduler's unset
fallback), so a fresh bootstrap does not author skills at runtime. A host with
the resources opts in with `allow` (or `ask`).

Under deny, an unmatched request no longer exposes the authoring machinery:
`_blocked_create` answers with a plain refusal (`skills.UNABLE_MESSAGE`, "I'm
sorry, I'm not able to help with that.") instead of an error naming
`new_skill_creation`/`config.json`, and a leftover empty/in-progress leaf in a
denied category refuses the same way rather than telling the user to `restart`
the body write. The block is still traced (`category_create_blocked` /
`skill_create_blocked`) for operators. Routing, decision logging, and the
allow/ask paths are unchanged.

Tests: authoring-mechanics helpers opt in explicitly; the default-deny and
silent-refusal cases are asserted.
This commit is contained in:
gabby committed 2026-10-13 15:01:12 +00:00
1 parent 78b4621ba0
commit 711dba2f03
9 files changed
+143 -50

No files matched your search

+30 -16
View File
@@ -10,8 +10,11 @@ basic task in plain language, and it does it:
1. The user asks for a task ("check my email", "message Sam on SimpleX", "put
lunch with Dana on my Nextcloud calendar").
2. If the skill tree already knows how, the agent does it.
3. If it does not, the agent asks the user a few questions about what they want
and how it should connect, generates a new skill, and then does it.
3. If it does not, the agent says it cannot help — unless the host has opted in
to live skill authoring (the default is **deny**; see "New-skill creation
mode" below), in which case it asks a few questions and generates a new skill.
The primary way to extend the agent is the committed **skill packs**
(`packs/`), not runtime authoring.
4. It performs the task for real, against the user's actual service. If the
real attempt fails, it says so and offers to fix/learn. It never pretends a
task succeeded.
@@ -113,7 +116,8 @@ scheduler.py no up-front gate: every input is dispatched
monotonic-progress guard;
housekeeping meta skills (delete/clear-config/regen/cancel-build)
operate on the tree via `ctx.admin`; new-skill creation is gated by
a tri-state mode (`new_skill_creation`: allow/deny/ask) with a
a tri-state mode (`new_skill_creation`: deny/allow/ask, **deny by
default**) with a
per-category override in the category config, with
`housekeeping`/`response` always denied in code; front ends get a
structured `SchedulerReply` (status, text, run_id, skill_ref,
@@ -479,7 +483,10 @@ CLI, unit tests (24) + integration tests (2).
softmax), and the scope guard is deliberately permissive. A request no skill
covers (e.g. "what is 255 * 12?") authors instead of getting a canned reply,
while a stray statement (e.g. "1+1=2") or a vague fragment (e.g. "what") still
gets one. All three taus are
gets one — **unless new-skill creation is denied** (see the tri-state mode
below), in which case an unservable request gets a plain refusal
(`skills.UNABLE_MESSAGE`, "I'm sorry, I'm not able to help with that.") and is
never told that authoring exists. All three taus are
separate from the top-level `tau`, so tuning reuse-vs-create or actionability
does not move assessment/fidelity. The guards are deliberately permissive
(in-scope scores 0.9–1.0): a borderline over-cover routes into a plausible
@@ -497,24 +504,31 @@ CLI, unit tests (24) + integration tests (2).
runs at the top of navigation and sends a request to authoring (this is what
keeps "what is 255 * 12?" out of the tree; the old
`response.unable` canned refusal is gone — an unsupported request authors a
skill, it is not refused). A fragment too vague/incomplete to act on (e.g.
"what") is non-action, so it lands on the catchall `response.clarify` rather
than authoring a redundant clarify skill. `response` is a `CANNED_CATEGORIES` member:
skill, it is not refused, **except under `new_skill_creation: deny`, where it
gets the plain `UNABLE_MESSAGE` refusal**). A fragment too vague/incomplete to
act on (e.g. "what") is non-action, so it lands on the catchall
`response.clarify` rather than authoring a redundant clarify skill. `response`
is a `CANNED_CATEGORIES` member:
`navigate` never offers `create_skill` there (the intent guard is skipped
too), `Scheduler._dispatch_skill`/`restart_skill` refuse to author it, and the
runner skips `assess:outcome`/repair for it — a canned line has no side effect
to assess. The leaf choice logs phase `navigate:response` and traces
`response_selected`. `response.reject` (a stub that never ran) is gone.
- **New-skill creation mode: allow / deny / ask** (Oct 2026; tri-state Oct 2026):
one setting governs whether the agent may author new skills/categories, as a
three-way mode. **Global default** is the top-level `new_skill_creation`
(`"allow"` default, `"deny"`, or `"ask"`); a category overrides it with its
own `new_skill_creation` in `data/skills/<category>/config.json` (absent =
inherit the global). `allow` authors immediately; `deny` blocks authoring
- **New-skill creation mode: deny / allow / ask** (Oct 2026; tri-state Oct 2026;
deny-by-default Oct 2026): one setting governs whether the agent may author new
skills/categories, as a three-way mode. **Global default** is the top-level
`new_skill_creation` — **`"deny"` by default** (the agent leans on the
committed packs, the primary way to extend functionality), with `"allow"` an
explicit opt-in for a host with the resources, or `"ask"`; a category overrides
it with its own `new_skill_creation` in `data/skills/<category>/config.json`
(absent = inherit the global). `allow` authors immediately; `deny` blocks authoring
outright (`Scheduler._blocked_create`, traced `skill_create_blocked` /
`category_create_blocked`); `ask` authors only after the human approves the
proposal. The `ask` path is the old approval gate: the single-slot `llm` draft
worker blocks after it authors a proposal and before anything is registered;
`category_create_blocked`) **and answers the request with a plain refusal**
(`skills.UNABLE_MESSAGE`) that never names a category, skill, or config — a
denied deployment gives no hint that authoring exists; `ask` authors only
after the human approves the proposal. The `ask` path is the old approval
gate: the single-slot `llm` draft worker blocks after it authors a proposal
and before anything is registered;
the human approves/denies via the REPL prompt, the dashboard approvals panel
(`GET/POST /api/approvals`), or a gateway chat reply (`yes`/`no`). One prompt
per creation request — a new category's chained skill is covered by the
+1 -1
View File
@@ -2,7 +2,7 @@
"tau": 0.6,
"max_reentries": 3,
"query_recall_window": 30,
"new_skill_creation": "allow",
"new_skill_creation": "deny",
"verbosity": "result",
"chain": {
"result_chars": 300
+2 -1
View File
@@ -216,6 +216,7 @@ confirm is skipped; the **leaf** intent guard is never bypassed (the leaf softma
has no create option, so a confident winner is only the closest existing skill,
never a match) — it always runs and can reject into create.
New-skill creation is gated deterministically by the tri-state
`new_skill_creation` mode — global default (`allow` / `deny` / `ask`) with a
`new_skill_creation` mode — global default `deny` (opt in with `allow`, or
`ask` for approval-gated authoring) with a
per-category override in `data/skills/<category>/config.json`; the
`housekeeping` and `response` categories are always `deny` in code.
+5 -3
View File
@@ -39,10 +39,12 @@ CORE_SCHEMA: dict[str, Any] = {'tau': {'default': 0.6, 'type': 'float', 'doc': '
'type': 'int',
'doc': "Seconds a completed run's ledger stays recallable for a follow-up "
'in the same chat (0 disables).'},
'new_skill_creation': {'default': 'allow',
'new_skill_creation': {'default': 'deny',
'type': 'str',
'doc': 'Global tri-state new-skill mode: allow | deny | ask (a category '
'config overrides it).'},
'doc': 'Global tri-state new-skill mode: deny (default) | allow | ask (a '
'category config overrides it). Deny by default: the agent leans on '
'the committed packs, and a host opts in to live skill authoring by '
'setting allow.'},
'verbosity': {'default': 'result',
'type': 'str',
'doc': 'REPL reply verbosity: result | query | decision.'},
+29 -22
View File
@@ -47,6 +47,7 @@ from .skills import (
DETERMINISTIC_CATEGORIES,
HARD_LOCKED_CATEGORIES,
HOUSEKEEPING_CATEGORY,
UNABLE_MESSAGE,
ActionContext,
CategoryRegistry,
CreateCategory,
@@ -73,9 +74,10 @@ from .skills import (
from .trace import TraceLog
#: The tri-state governing whether a new skill (or category) may be authored.
#: `allow` authors immediately, `deny` blocks creation outright, and `ask`
#: authors only after the human approves the proposal. Set globally with the
#: top-level `new_skill_creation` config value and overridden per category in
#: `allow` authors immediately, `deny` blocks creation outright (the default —
#: the agent leans on the committed packs), and `ask` authors only after the
#: human approves the proposal. Set globally with the top-level
#: `new_skill_creation` config value and overridden per category in
#: `data/skills/<category>/config.json` (same key).
NEW_SKILL_MODES = ("allow", "deny", "ask")
@@ -365,10 +367,11 @@ class Scheduler:
#: re-run that completes off the gate still reaches the chat instead of
#: being swallowed. Bounded like the request queue.
self._outbox: deque[SchedulerReply] = deque(maxlen=256)
#: Global new-skill creation mode: "allow" (default), "deny", or "ask".
#: A category may override it in its category config.
#: Global new-skill creation mode: "deny" (default), "allow", or "ask".
#: A category may override it in its category config. Deny by default
#: keeps the agent on the committed packs; live authoring is an opt-in.
self.new_skill_mode = (
normalize_new_skill_mode(config.get("new_skill_creation")) or "allow"
normalize_new_skill_mode(config.get("new_skill_creation")) or "deny"
)
fidelity_cfg = codegen_cfg.get("fidelity", {}) or {}
self.fidelity_enabled = bool(fidelity_cfg.get("enabled", True))
@@ -898,28 +901,33 @@ class Scheduler:
def _blocked_create(
self, request: Request, category: str | None
) -> DispatchResult:
"""Report that a denied category (or a denied category creation) will
not author."""
"""A denied create door: the request cannot be served.
The block is a deterministic operator fact (traced), but the user is
never told about authoring: with `new_skill_creation` set to `deny`, a
request no existing skill covers gets the same plain refusal a closed
tree would give — no category, skill, or config detail leaks into the
reply. `category is None` is a denied new top-level category; otherwise
it is a denied new leaf inside `category`.
"""
if category is None:
self.trace.append("category_create_blocked", request.id)
return DispatchResult(
kind="error",
summary=(
"cannot create a new category: new-skill creation is denied "
'(set new_skill_creation to "allow" or "ask" in config.json)'
),
)
else:
self.trace.append("skill_create_blocked", request.id, category=category)
return DispatchResult(
kind="error",
summary=(
f"cannot create a new skill in {category}: new-skill creation "
f'is denied (set new_skill_creation to "allow" or "ask" in '
f"data/skills/{category}/config.json, or globally in config.json)"
),
kind="ran",
summary=UNABLE_MESSAGE,
result=UNABLE_MESSAGE,
)
def _run_skill(self, skill: Skill, request: Request) -> DispatchResult:
if skill.writing or skill.is_noop():
# A leftover in-progress/empty leaf in a denied category has no
# authoring path back to a runnable body, so it gets the same plain
# refusal as any other unservable request — never a "restart it with
# `restart ...`" hint that exposes the authoring machinery.
if self._category_locked(skill.category):
return self._blocked_create(request, skill.category)
if skill.writing:
return DispatchResult(
kind="error",
@@ -929,7 +937,6 @@ class Scheduler:
),
skill=skill.name,
)
if skill.is_noop():
return DispatchResult(
kind="error",
summary=(
+7
View File
@@ -723,6 +723,13 @@ _CANNED_RESPONSES = [
_RESPONSE_MESSAGES = {f"response.{name}": message for name, _, message in _CANNED_RESPONSES}
#: The deterministic reply when new-skill creation is denied and no existing
#: skill can serve the request. Unlike the `response` tree this is never
#: navigable: it is reached only from the scheduler's deny gate. The user is
#: deliberately never told that authoring (or config) exists — the request
#: simply cannot be served.
UNABLE_MESSAGE = "I'm sorry, I'm not able to help with that."
# Built-in category descriptions. Authored categories carry their own
# description from the registry, and pack categories carry theirs from the
# pack manifest (`packs/<name>/pack.json` -> `categories`); this dict is only
+3
View File
@@ -34,6 +34,9 @@ def build_scheduler(tmp_path, engine=None):
log=log,
config={
"skills": {},
# Dashboard mechanics tests exercise the authoring path, an opt-in
# now that new-skill creation is denied by default.
"new_skill_creation": "allow",
"skill_packs": str(tmp_path / "seeds"),
"skill_bodies": str(tmp_path / "skills"),
"category_registry": str(tmp_path / "categories.json"),
+37 -3
View File
@@ -26,6 +26,7 @@ from semif_agent.skills import (
build_housekeeping_skills,
parse_meta_command,
resolve_skill_ref,
UNABLE_MESSAGE,
_cancel_build_act,
_delete_skill_act,
)
@@ -264,7 +265,8 @@ def test_housekeeping_and_response_are_hard_locked(tmp_path):
def test_category_mode_config_roundtrip(tmp_path):
scheduler = _scheduler(tmp_path)
scheduler.tree["notes"] = []
assert scheduler._category_mode("notes") == "allow"
# New-skill creation is denied by default (the global fallback).
assert scheduler._category_mode("notes") == "deny"
status, _ = scheduler.set_category_mode("notes", "ask")
assert status == "ok"
@@ -294,12 +296,44 @@ def test_category_mode_inherits_global_and_overrides(tmp_path):
def test_dispatch_skill_blocked_when_denied(tmp_path):
"""A denied category answers with the plain refusal: the user is never told
that new-skill creation (or its config) exists."""
scheduler = _scheduler(tmp_path)
scheduler.tree["notes"] = []
scheduler.set_category_mode("notes", "deny")
result = scheduler._dispatch_skill(Request("make a note"), "notes")
assert result.kind == "error"
assert "denied" in result.summary
assert result.kind == "ran"
assert result.summary == UNABLE_MESSAGE
for leak in ("denied", "new_skill_creation", "config.json", "category", "skill"):
assert leak not in result.summary
assert any(e["kind"] == "skill_create_blocked" for e in scheduler.trace.read())
def test_dispatch_create_category_denied_is_silent(tmp_path):
"""Global `deny` answers a request that would author a category with the
plain refusal, and still traces the block for operators."""
scheduler = _scheduler(tmp_path)
scheduler.new_skill_mode = "deny"
scheduler.tree = {}
result = scheduler._dispatch(Request("book a trip to japan"))
assert result.kind == "ran"
assert result.summary == UNABLE_MESSAGE
assert result.result == UNABLE_MESSAGE
assert any(
e["kind"] == "category_create_blocked" for e in scheduler.trace.read()
)
def test_run_stub_under_deny_is_silent(tmp_path):
"""A leftover empty leaf in a denied category refuses plainly instead of
telling the user to `restart` the body write."""
scheduler = _scheduler(tmp_path)
scheduler.tree["notes"] = []
scheduler.set_category_mode("notes", "deny")
stub = Skill(name="stub", category="notes", description="d")
result = scheduler._run_skill(stub, Request("make a note"))
assert result.summary == UNABLE_MESSAGE
assert "restart" not in result.summary
assert any(e["kind"] == "skill_create_blocked" for e in scheduler.trace.read())
+29 -4
View File
@@ -141,6 +141,9 @@ def _scheduler(tmp_path, codegen=None, choices=None, default="success", verbosit
SemIf decision now, so a run needs the engine to answer `assess:*`."""
config = {
"skills": {},
# Most mechanics tests exercise the authoring path, which is an opt-in
# now that new-skill creation is denied by default.
"new_skill_creation": "allow",
"category_registry": str(tmp_path / "categories.json"),
"skill_bodies": str(tmp_path / "skills"),
"skill_packs": str(tmp_path / "seeds"),
@@ -1165,6 +1168,7 @@ def test_dispatch_action_tau_controls_catchall_routing(tmp_path):
log=DecisionLog(str(tmp_path / "decisions.jsonl")),
config={
"skills": {},
"new_skill_creation": "allow",
"navigation": {"action_tau": action_tau},
"category_registry": str(tmp_path / "categories.json"),
"skill_bodies": str(tmp_path / "skills"),
@@ -1209,6 +1213,7 @@ def test_dispatch_intent_tau_controls_reuse_vs_create(tmp_path):
log=DecisionLog(str(tmp_path / "decisions.jsonl")),
config={
"skills": {},
"new_skill_creation": "allow",
"navigation": {"intent_tau": intent_tau},
"category_registry": str(tmp_path / "categories.json"),
"skill_bodies": str(tmp_path / "skills"),
@@ -1348,6 +1353,7 @@ def test_dispatch_confident_leaf_winner_still_runs_intent_guard(tmp_path):
log=DecisionLog(str(tmp_path / "decisions.jsonl")),
config={
"skills": {},
"new_skill_creation": "allow",
"category_registry": str(tmp_path / "categories.json"),
"skill_bodies": str(tmp_path / "skills"),
"skill_packs": str(tmp_path / "seeds"),
@@ -1394,6 +1400,7 @@ def test_dispatch_create_category_queues_draft_and_is_not_fatal(tmp_path):
log=log,
config={
"skills": {},
"new_skill_creation": "allow",
"category_registry": str(tmp_path / "categories.json"),
"skill_bodies": str(tmp_path / "skills"),
"skill_packs": str(tmp_path / "seeds"),
@@ -1433,13 +1440,31 @@ def _answer_approval_when_posted(scheduler, approved, timeout=5.0):
return False
def test_creation_mode_allow_proceeds(tmp_path):
"""The default (`new_skill_creation` unset -> allow) leaves creation
unchanged: the gate returns immediately and posts nothing."""
scheduler = _scheduler(tmp_path)
def test_creation_mode_defaults_to_deny_and_allow_opts_in(tmp_path):
"""New-skill creation is denied by default (the agent leans on the committed
packs); a host opts in by setting `new_skill_creation: allow`."""
# Unset -> deny: the gate aborts without prompting.
unset = Scheduler(
engine=ScriptedEngine(),
llm=LLMClient(base_url="http://localhost:1/v1", model="test"),
log=DecisionLog(str(tmp_path / "decisions.jsonl")),
config={
"skills": {},
"category_registry": str(tmp_path / "categories.json"),
"skill_bodies": str(tmp_path / "skills"),
"skill_packs": str(tmp_path / "seeds"),
},
trace=TraceLog(str(tmp_path / "runs.jsonl")),
)
assert unset.new_skill_mode == "deny"
job = DraftAuthor(
request=Request("book a trip"), category=None, kind="category"
)
assert unset._request_approval(job, "category", "travel", "Trips.") is False
# Explicit allow: the gate returns immediately and posts nothing.
scheduler = _scheduler(tmp_path)
assert scheduler.new_skill_mode == "allow"
assert scheduler._request_approval(job, "category", "travel", "Trips.") is True
assert scheduler.pending_approvals() == []