Skip to content

feat(agents): markdown agent definitions with unified editor - #310

Open
hyldmo wants to merge 3 commits into
mainfrom
hyldmo/roles-routing-editor-ui
Open

hyldmo wants to merge 3 commits into
mainfrom
hyldmo/roles-routing-editor-ui

Conversation

@hyldmo

@hyldmo hyldmo commented Sep 5, 2026

Copy link
Copy Markdown
Owner

Merges delegated roles and Auto-routing profiles into one canonical store: a directory of Markdown agent-definition files with YAML-style frontmatter (stateDir()/agents/*.md), matching the .claude/agents format, plus one editor for both.

Store (1f77d99)

  • One file per agent: frontmatter description / model / effort / fast / routing, body = delegation preamble. Unknown frontmatter (e.g. tools: from imported Claude definitions) is preserved byte-for-byte through every rewrite; no YAML dependency.
  • routing.json holds the Auto globals (defaultAuto, router, fallback, rules, timeout). Auto profiles are now derived: any agent with a description and routing != false is routable, so a role and its routing profile can no longer drift apart.
  • Copy-only migration from roles.json + auto-model.json (staged dir + single rename, concurrent-safe); legacy files are never rewritten, so an older installed relay sharing the stateDir keeps working.
  • New GET/PATCH /api/agents and GET/PATCH /api/routing; the four legacy routes (/api/roles, /api/auto-model) stay as compat adapters over the new store, so MCP list_roles and cached PWAs keep working.

Unified editor (f4e54fd)

  • One single-scroll Agents sheet replaces RolesSettings and AutoModelSettings: agent cards (model/effort/fast, routing description, preamble disclosure) with the Auto-routing section below.
  • All three entry points open it; the model-picker gear deep-links to the routing section. Fallback agent is protected from removal/un-routing until a replacement is saved; partial saves are reported and retry only the unsaved half.

Import (804bd20)

  • Import from ~/.claude/agents in the sheet: bounded scan (64 files, 256 KiB cap), symlink/TOCTOU/UTF-8 hardening, per-name outcomes, explicit overwrite. Imported files keep their bytes exactly; native model aliases (haiku) surface as picker-validation errors on the card instead of importing blind.

yarn verify: 162 test files, 1336 tests.

🤖 Generated with Claude Code

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.

1 participant