Skip to content

Model policy: Claude skills T3 cannot read, same-name skills, and the instance's alias mapping (#128 follow-up) #987

Open

Description

@scuttletoby

Follow-up from the #978 round-1 review (code lens major: a skill with context: fork starts a sub-agent without the Agent tool).

What #978 covers. While the model policy is on, T3's PreToolUse hook also checks Claude's Skill tool. It finds the skill the way T3 lists Claude's skills (discoverClaudeSkills: managed, the config folder's, the session folder's .claude/skills, and plugin skills; first name wins) and reads its frontmatter:

  • a skill with context: fork, or one that names model or effort, must name a model from the rows (and its effort), read like an Agent call;
  • a skill that runs inline and names neither runs on the session's model and is not checked;
  • a skill T3 cannot find or read is refused in enforce (fail closed) and runs with a note in advise.

What is left.

  1. Usability: skills T3 does not read are refused under enforce. These are skills bundled with Claude Code (for example simplify), MCP servers' skills, legacy .claude/commands/*.md, skills in parent folders of the session folder, skills Claude Code finds in subfolders as it works, and skills under --add-dir / --plugin-dir (the hook does not see the instance's launch args). Reading them needs either Claude Code to expose each skill's frontmatter (the SDK's supportedCommands() gives only name and description), or T3 to read those places as Claude Code does.
  2. Same name in a place T3 does not read. If T3 finds a skill by name in one place but Claude Code runs another skill of the same name from a place T3 does not read (from the list above), the check reads the wrong file. T3's order is managed, then user, then project, then plugins. It has not been checked against Claude Code's own order for commands, nested folders and --add-dir. Fix: read every place Claude Code reads, and refuse when two places hold the name with different verdicts. Or get the resolved skill from Claude Code.
  3. Alias mapping. The hook maps an alias (opus) with T3's Claude model list, which every Claude instance on the machine shares, not the instance's own routed list. The upstream adapter does not pass its catalog to the fork's profile plan. A Claude Code whose own mapping differs runs a model the check did not read. The docs say so (docs/fork/README.md, model policy).

Fails closed in each case above except 2 and 3, which can read a different model than the one that runs.

🤖 Generated with Claude Code

Activity

  1. scuttletoby commented on Nov 22, 2026

    @scuttletoby
    OwnerAuthor

    More left over from the #978 round-2 reviews (state lens and code lens, minors). #978 does not fix these; they belong here.

    1. Older Claude Code with the policy on. While a policy is on (enforce or advise), T3 adds its hook with onFailure: "block". The agent SDK refuses to open a query with that on a Claude Code older than 2.1.295, so every new query fails. The instance's default binary is the claude on the PATH, not the SDK's bundled one, so this depends on what is installed. Threads already open keep running until T3 opens a new process, so the failures start later and at different times. The error asks the person to remove onFailure: "block" from their hooks, which they cannot do. model policy: check Claude's Agent tool; linked-machine and agent-option follow-ups (#802, #128) #978 now says it plainly in docs/fork/README.md (2.1.295 or newer is required while a policy is on, in advise too). Better: use the version T3 already reads (claude --version in ClaudeProvider.ts) to warn in Settings, or to say it in the error.
    2. A same-name skill T3 drops. This adds to point 2. T3's skill list skips a SKILL.md it cannot read, or whose frontmatter is still broken after its repair step, and then takes the next skill of that name (first name wins). The hook then checks that later skill. If Claude Code reads the dropped file (it parses YAML its own way), it runs a file the check never read. So point 2 is not only "a skill in a place T3 does not read", it is also "a same-name skill T3 drops".
    3. The check reads the disk, Claude Code runs what it loaded. The hook reads SKILL.md at the moment of the Skill call. Claude Code runs the skill as it loaded it (at start, or at its last reload of the skill folders). An agent that rewrites a forked skill's model just before the call can make the check read the new file while the old one runs. Not verified live. Getting the resolved skill from Claude Code (the fix in point 2) covers this too.
    4. A $name mention in a turn's text skips the hook. The Claude adapter turns a $name mention of a skill T3 lists into a native /name slash command (ClaudeAdapterV2.ts, planClaudeSkillDispatch). Claude Code expands that as a command, with the skill's context: fork, model and effort, without a Skill tool call, so the PreToolUse hook never runs. An agent can put such a mention in the text it sends with delegate_task, create_threads or t3_thread_send: the target's model is checked, but the skill's model runs. This is older than model policy: check Claude's Agent tool; linked-machine and agent-option follow-ups (#802, #128) #978. Suggested fix: the SDK's UserPromptExpansion hook (expansion_type: "slash_command", command_name) can run the same frontmatter check.
    5. The refusal's way out may not work for bundled skills. A refusal says a person can put a copy of the skill in the project's .claude/skills. That only helps if Claude Code then runs the copy. Claude Code 2.1.326 marks some bundled skills cannotBeShadowed, so for those T3 would read the copy while Claude Code runs the bundled one (point 2, opened by T3's own advice). Fix: suggest a copy under another name, or say that some bundled skills cannot be replaced.

    🤖 Generated with Claude Code

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions