Repository navigation
fix(session): keep disable-model-invocation skills out of model context - #200
Open
fchengyan (fcy222fcy) wants to merge 1 commit into
Open
fchengyan (fcy222fcy) wants to merge 1 commit into
fchengyan (fcy222fcy) wants to merge 1 commit into
Conversation
A SKILL.md that sets `disable-model-invocation: true` is still offered to the person as a slash command, but is no longer listed in the <skills> block sent to the model, matching Claude Code / Pi semantics. Fixes microsoft#190. Added regression tests covering true/yes/TRUE values and confirming the skill stays invokable by the person.
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Linked issue
Fixes #190 — "The harness doesn't honor
disable-model-invocation: true".What changed (Before / After)
Before: every skill directory with a
SKILL.mdwas listed in the<skills>block thatcontext_block()sends to the model, regardless of its frontmatter. A skill authored withdisable-model-invocation: true— the Agent Skills convention used by Claude Code and Pi to mean "the person invokes this by hand, do not offer it to the model" — was still injected into the model's context, spending tokens on a skill the author explicitly opted out of.After:
skills()reads thedisable-model-invocationfrontmatter field into amodel_invocationflag, andcontext_block()lists only skills whose flag allows model invocation. The skill stays in the slash-command menu (usercommands.available()uses the sameskills()list unfiltered), so the person can still invoke it exactly as before. This is a frontmatter-contract fix, not a behavioural/benchmark tuning of the prompt, tools or status line: it removes a skill the author marked as hand-only, and the description text and formatting of remaining skills are untouched.Accepted values for "disabled" are
true,yesand1(case-insensitive); anything else — including an absent field — keeps the current behaviour (offered to the model).Visual proof (UI / TUI / Web / Desktop / export changes)
N/A — this changes the context string built for the model; proof is the before/after test output below.
How you verified it
Reproduced first against unmodified
main, then confirmed green after the fix:git checkoutofsession.py): both new tests failed —AssertionError: disable-model-invocation: true skill leaked into the model context, with the skill line- manual-skill: only run by hand (.../SKILL.md)visible inside the emitted<skills>block.pytest -q tests/test_skill_disable_model_invocation.py→ 2 passed.30 failed, 26 passed, 3 skipped30 failed, 28 passed, 3 skippedThe 30 failures are identical in both runs and are pre-existing Windows-only failures
("Freehand does not run natively on Windows yet (it requires POSIX bash)"); the +2 passes are the new tests.
No new failures.
pyflakes src/freehand/session.py tests/test_skill_disable_model_invocation.pyprints nothing.Changed files:
src/freehand/session.py(+7/−2),tests/test_skill_disable_model_invocation.py(+36, new).AI disclosure & checklist
uv run pyflakes src tests .github/scriptsprints nothing and relevant tests pass locally (full suite runs in CI)CHANGELOG.mduntouched (maintainers update it at release time)src/freehand/runtime/still uses only the standard library and imports on Python 3.9