Skip to content

Show skill MCP scopes per agent in status - #523

Merged
xsh310 merged 2 commits into
xshen/skill-per-agent-addfrom
xshen/skill-per-agent-status
Sep 11, 2026
Merged

Show skill MCP scopes per agent in status#523
xsh310 merged 2 commits into
xshen/skill-per-agent-addfrom
xshen/skill-per-agent-status

Conversation

@xsh310

@xsh310 xsh310 commented Sep 8, 2026

Copy link
Copy Markdown
Collaborator

What

ug status rendered a single Skill MCP Locations line from the flat scope mirror. Once agents carry different skill scopes (which per-agent add now makes possible), that single line hides the divergence. This makes status report each agent's real scope.

How

  • The Skills section reads each configured client's scope with skill_locations_for_client.
  • When every agent shares the same scope, it collapses to the original single Skill MCP Locations + Configured lines.
  • When scopes diverge, it prints a per-agent line (Claude Code skill MCP locations: ..., Codex skill MCP locations: ...), matching how _print_skills_summary already reports scopes.

Tests

  • test_cli.py: a state whose per-client scopes diverge renders one line per agent with that agent's own locations. The existing uniform-scope and no-locations status tests still pass unchanged.

uv run pytest tests/test_mcp.py tests/test_cli.py tests/test_lint.py is green.

Manual verification (installed build)

Using the sandbox from the per-agent add PR (agents scoped to divergent locations: claude shared.skills, claude.only, codex shared.skills), ran ucode status. The Skills section rendered one line per agent:

Skills
  Claude Code skill MCP locations: shared.skills, claude.only
  Codex skill MCP locations: shared.skills

The new ug skill add / ug skill remove --mcp hint also appeared. The uniform-scope collapse path is covered by the existing status tests.

Stacking

Second in the stacked per-agent skills series, based on xshen/skill-per-agent-add (#522). Reviewing the diff against that base shows just this change. It rebuilds behavior originally designed by Arthur Jenoudet on the current per-client-map state model.

This pull request and its description were written by Isaac.

@xsh310
xsh310 force-pushed the xshen/skill-per-agent-status branch from 189150f to a1669b2 Compare September 8, 2026 05:43
@xsh310
xsh310 force-pushed the xshen/skill-per-agent-status branch from a1669b2 to 8176b6a Compare September 8, 2026 18:25
@xsh310
xsh310 force-pushed the xshen/skill-per-agent-status branch from 8176b6a to 71ad887 Compare September 8, 2026 19:09
@xsh310
xsh310 marked this pull request as ready for review September 8, 2026 21:09
@xsh310
xsh310 force-pushed the xshen/skill-per-agent-status branch from 71ad887 to f228ea4 Compare September 8, 2026 22:12
@xsh310
xsh310 force-pushed the xshen/skill-per-agent-status branch from f228ea4 to 8eddff2 Compare September 8, 2026 22:16
@xsh310
xsh310 force-pushed the xshen/skill-per-agent-status branch from 8eddff2 to 4e2ca2f Compare September 8, 2026 23:09
@xsh310
xsh310 removed this pull request from stack #521 September 10, 2026 21:22
@xsh310
xsh310 added this pull request to stack #556 September 10, 2026 21:22
Comment thread src/ucode/cli.py Outdated
@xsh310
xsh310 force-pushed the xshen/skill-per-agent-status branch from 4e2ca2f to 0f8b447 Compare September 11, 2026 03:08
`ug status` rendered a single `Skill MCP Locations` line off the flat mirror,
which hides divergence once agents carry different skill scopes. Read each
configured client's scope with `skill_locations_for_client` and collapse to one
line when every agent shares a scope, splitting into a per-agent line when they
diverge, matching how the skills summary already reports scopes.

Co-authored-by: Arthur Jenoudet <arthur.jenoudet@databricks.com>
Co-authored-by: Isaac <no-reply@databricks.com>
@xsh310
xsh310 force-pushed the xshen/skill-per-agent-status branch from 0f8b447 to 66c1d31 Compare September 11, 2026 04:25
status and _print_skills_summary both decided "one line when every configured
agent shares a scope, else one line per agent." Share that decision through a
single agents_share_one_scope helper and give both the same empty-scope fallback
([]) -- they had drifted, with status falling back to the flat skill_locations
mirror. The per-client scope dict stays inline in each caller.

Co-authored-by: Isaac <no-reply@databricks.com>
@xsh310
xsh310 merged commit 6787136 into main Sep 11, 2026
3 of 4 checks passed
@xsh310
xsh310 deleted the xshen/skill-per-agent-status branch September 11, 2026 16:42
xsh310 added a commit that referenced this pull request Sep 11, 2026
## What

Adds `ucode skill remove --mcp`, the inverse of `ucode skill add --mcp`.
It interactively removes skill schemas from the skills MCP connection
across every configured agent. Removing downloaded skills is not
supported yet, so the command requires `--mcp`.

## How

- `remove_skills_command()` reads each configured client's skills scope,
offers the union of schemas via a picker (each annotated with the
clients that carry it), and removes the selected schemas from every
client that has them.
- It reuses the per-client update path, so dropping the last schema
leaves the schema-less connection registered rather than deleting it. It
never adds or reconfigures anything and needs no Databricks auth.
- `cli.py` gains the `skill remove` command and a `status` hint pointing
at `ug skill add` / `ug skill remove --mcp`.

## Tests

- `test_mcp.py`: a selected schema is removed from every client and each
is re-registered; removing all schemas keeps the schema-less connection;
an empty scope is a no-op that never opens the picker; the picker is
offered each client's real scope.
- `test_cli.py`: `skill remove` without `--mcp` errors; `skill remove
--mcp` dispatches the global removal.

`uv run pytest tests/test_mcp.py tests/test_cli.py tests/test_lint.py`
is green.

### Manual verification (installed build)

Ran against the installed build (`0.1.0+91.g5c0dc1e`) in the isolated
sandbox (temp `HOME`, stub `claude`/`codex` binaries recording
registrations, `DATABRICKS_BEARER` for offline auth), starting from
state `claude=[claude.only]`, `codex=[shared.skills]`. Invoked
`remove_skills_command()` with the interactive picker stubbed to select
`shared.skills` (the picker needs a TTY); all state I/O and per-client
registration ran for real.

| Check | Result |
|---|---|
| Picker input | Offered both clients' scopes: `{claude:[claude.only],
codex:[shared.skills]}` |
| State after | `shared.skills` dropped from codex; result
`{claude:[claude.only]}` with codex's now-empty entry removed |
| Registrations | Only codex re-registered, with the schema-less URL;
claude untouched |
| Guard | `ucode skill remove` (no `--mcp`) exits with `ERROR Removing
downloaded skills is not supported yet ...` |

## Stacking

Third in the stacked per-agent skills series, based on
`xshen/skill-per-agent-status` (#523). Per-agent remove builds on this
next. Reviewing the diff against that base shows just this change. It
rebuilds behavior originally designed by Arthur Jenoudet on the current
per-client-map state model.

This pull request and its description were written by Isaac.

---------

Co-authored-by: Arthur Jenoudet <arthur.jenoudet@databricks.com>
Co-authored-by: Isaac <no-reply@databricks.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants