Skip to content

feat(cloud-agent): add profile skills, MCPs, and agents#3018

Merged
eshurakov merged 7 commits intomainfrom
docs/cloud-agent-profile-skills-and-mcps-plan
May 7, 2026
Merged

feat(cloud-agent): add profile skills, MCPs, and agents#3018
eshurakov merged 7 commits intomainfrom
docs/cloud-agent-profile-skills-and-mcps-plan

Conversation

@kilo-code-bot
Copy link
Copy Markdown
Contributor

@kilo-code-bot kilo-code-bot Bot commented May 4, 2026

Summary

Adds first-class skills, MCP servers, and custom agents to Cloud Agent profiles, redesigns the profile editor as a tabbed two-pane dialog, and extracts profile services into a shared @kilocode/cloud-agent-profile package. Plan for the work is in .plans/cloud-agent-profile-skills-and-mcps.md.

Profile model

  • New tables agent_environment_profile_skills, agent_environment_profile_mcp_servers, agent_environment_profile_agents (cascade-delete from agent_environment_profiles).
  • New created_by_user_id column on agent_environment_profiles.
  • MCP env/header secrets reuse the existing AGENT_ENV_VARS_PUBLIC_KEY/PRIVATE_KEY envelope; secrets are masked as •••• on GET responses.
  • Skills, MCPs, and agents merge across profile layers only (repo-bound → user/org default → selected). Env vars and setup commands keep today's four-layer merge including manual session overrides.

Backend / wire format

  • Profile services moved out of apps/web/src/lib/agent into packages/cloud-agent-profile (profile, vars, commands, MCP, skills, agents, session-config, repo-binding, resolution).
  • cloud-agent-next session prepare/update schemas extended with skills, MCP servers, and agent configs; values flow into KILO_CONFIG_CONTENT.
  • Manual session wiring switches from profile name to profileId (with backward compatibility) so personal/org name collisions are unambiguous.
  • Fixes a prepared-session fast-path bug in ExecutionOrchestrator.prepareWorkspace where recreating a sandbox could drop stored MCP config.

Profile editor UI

  • ProfilesListDialog replaces the in-row expand/collapse editor with a two-pane tabbed layout: Overview, Variables, Setup commands, Skills, MCPs, Agents.
  • Skills tab: drag-and-drop zip import, inline edit, frontmatter-driven name/description.
  • MCP tab: full edit with secret round-trip (masked placeholders preserve untouched encrypted values).
  • Agents tab: thinking-effort variant picker that hides for non-variant models, clears stale variants on model change, redesigned advanced section, row-level enable/disable.
  • Overview tab: auto-save name/description on blur with subtle Saving/Saved status; delete moved into a confirm row.
  • New ProfilePickerPopover lists candidate profiles inline so a single click selects one (was a two-step "Pick a profile…" flow).
  • ChatInput, MobileToolbarPopover, and NewSessionPanel resolve and show the human-readable model label on locked toolbars instead of the raw id.

Bug fixes bundled in

  • session-manager: message.updated was writing visibility (primary/subagent/all) into sessionConfig.mode, blowing away the real custom-agent slug on refresh. Now uses event.info.agent and has a regression test.
  • registerSession: carries the resolved profile so a custom agent slug is visible before async prepare completes.
  • ModelCombobox: opt-in modal prop so the popover scrolls inside a Radix Dialog (used by the agents tab).

Storybook

  • apps/storybook/src/mockData/profiles.ts extended with MCP servers, skills, and agents so all three new tabs render in ProfilesListDialog and ProfileSelector stories.

Verification

  • Created/edited a personal profile end-to-end in the redesigned dialog: overview auto-save, var add/edit (plain + secret), setup command reorder, skill import via drag-and-drop and inline edit, MCP server with secret env values (verified •••• masking on reload and that untouched keys round-trip without re-encrypting), custom agent with a thinking-effort variant model and with a non-variant model.
  • Selected the profile on a new Cloud Agent session and confirmed the resolved skills/MCPs/agents land in KILO_CONFIG_CONTENT (checked cloud-agent-next logs and the running CLI).
  • Repo-bound profile + selected profile + default profile combination: confirmed the layered merge order and ProfileConfigIndicator counts for skills and MCPs.
  • Reproduced the old message.updated → custom-agent-slug regression on main, confirmed it's fixed on this branch (see new test in session-manager.test.ts).
  • Verified the GDPR cascade: hard-deleting a user removes their profiles, MCP servers, and skills (apps/web/src/lib/user.test.ts).

Visual Changes

The profile editor changed substantially. New tabs and panes:

  • Two-pane tabbed editor inside ProfilesListDialog (Overview / Variables / Setup commands / Skills / MCPs / Agents).
  • Inline profile picker in ProfilePickerPopover.
  • Locked-mode toolbars now show the human-readable model label.

Storybook stories under cloud-agent/ cover all states; screenshots can be reproduced from there.

Reviewer Notes

  • The package extraction (packages/cloud-agent-profile) is mechanical move + re-export but touches many import sites; worth a quick scan for missed references.
  • Migration 0110_colossal_black_knight.sql was generated via pnpm drizzle generate (not hand-edited). Cascade FKs are intentional.
  • MCP secrets: please double-check the round-trip path in profile-mcp-service.ts — masked placeholders on input mean "keep the existing ciphertext"; non-placeholder values are re-encrypted.
  • ExecutionOrchestrator.prepareWorkspace fast-path fix is included here because the new MCP plumbing made it observable. It can be split out if desired.
  • Title still reads docs(...) from when this branch was plan-only; happy to retitle to feat(cloud-agent): add profile skills, MCPs, and agents before merge.

@kilo-code-bot
Copy link
Copy Markdown
Contributor Author

kilo-code-bot Bot commented May 4, 2026

Code Review Summary

Status: 1 Issue Found | Recommendation: Address before merge

Overview

Severity Count
CRITICAL 0
WARNING 1
SUGGESTION 0
Issue Details (click to expand)

WARNING

File Line Issue
services/cloud-agent-next/src/router/handlers/session-prepare.ts 68 Self-hosted GitLab clone URLs no longer produce a repo full name for profile binding lookup.
Files Reviewed (5 files)
  • apps/web/src/tests/cloud-agent-profile/profile-session-config.test.ts - 0 new issues
  • packages/cloud-agent-profile/src/index.ts - 0 new issues
  • packages/cloud-agent-profile/src/profile-session-config.ts - 0 new issues
  • services/cloud-agent-next/src/router/handlers/session-prepare.ts - 1 carried-forward issue
  • services/cloud-agent-next/src/router/schemas.ts - 0 new issues

Fix these issues in Kilo Cloud


Reviewed by gpt-5.5-20260423 · 3,434,216 tokens

@eshurakov eshurakov force-pushed the docs/cloud-agent-profile-skills-and-mcps-plan branch from 011409b to 58541ac Compare May 5, 2026 12:24
Comment thread services/cloud-agent-next/src/router/schemas.ts Outdated
Comment thread services/cloud-agent-next/src/router/handlers/session-prepare.ts
Comment thread services/cloud-agent-next/src/persistence/schemas.ts Outdated
@eshurakov eshurakov force-pushed the docs/cloud-agent-profile-skills-and-mcps-plan branch from 47db62c to f3fe309 Compare May 5, 2026 13:56
Comment thread apps/web/src/components/cloud-agent/ProfilesListDialog.tsx Outdated
Comment thread apps/web/src/components/cloud-agent/ProfilesListDialog.tsx Outdated
@eshurakov eshurakov changed the title docs(cloud-agent): plan for profile skills and MCPs feat(cloud-agent): add profile skills, MCPs, and agents May 6, 2026
Comment thread apps/web/src/components/cloud-agent-next/NewSessionPanel.tsx
@eshurakov eshurakov force-pushed the docs/cloud-agent-profile-skills-and-mcps-plan branch 3 times, most recently from 0062965 to 82ecfa1 Compare May 6, 2026 12:13
eshurakov added 2 commits May 6, 2026 14:14
…cleanup

- MCP env values and remote header values now mix plain strings and
  encrypted envelopes per key. Non-sensitive config (locale, paths,
  public IDs) skips the envelope round-trip while secrets stay encrypted.
- Profile resolution returns a base (repo-bound) + top (explicit pick or
  effective default) pair, replacing the previous automatic/explicit
  shape. The explicit pick replaces the default in the top slot but
  never replaces the repo base; duplicates are dropped.
- Drop count-only session metadata fields (envVarCount, setupCommandCount,
  mcpServerCount, skillCount) from session GET output — no callers were
  consuming them.
- Remove dead createSkillFromMarketplace / createMcpFromMarketplace tRPC
  procedures along with the supporting marketplace input schemas, types,
  and normalizeMarketplaceMcp helper.
- Rename getCanPgDb to getPgDb in cloud-agent-next.
@eshurakov eshurakov force-pushed the docs/cloud-agent-profile-skills-and-mcps-plan branch from 82ecfa1 to eaa9aab Compare May 6, 2026 13:14
eshurakov added 2 commits May 6, 2026 15:28
InitializeContext, InitContext, and ExistingSessionMetadata now carry a
single profile?: SessionProfileBundle instead of six flat fields
(envVars, encryptedSecrets, setupCommands, mcpServers, runtimeSkills,
runtimeAgents). Construction sites pass readProfileBundle(metadata)
directly and consumers in the orchestrator forward initContext.profile
to session-service without the buildProfileBundle re-pack shim, which
is removed. Adding a profile field is now a single-line change in
SessionProfileBundle.
Promotes the most thorough parseGitUrl (gastown's, with GitLab subgroup
+ SSH support) into @kilocode/worker-utils/git-url alongside isValidGitUrl,
sanitizeGitUrl, and a new repoFullNameFromGitUrl helper. Removes four
near-duplicate implementations across cloud-agent-next, session-ingest,
app-builder, and apps/web; gastown's platform-pr.util now re-exports the
shared symbols so existing call sites stay put.
Comment thread services/cloud-agent-next/src/router/handlers/session-prepare.ts
eshurakov added 2 commits May 6, 2026 15:52
The integration test still asserted the pre-eaa9aab41 contract where a repo
binding suppressed the default. Resolution now layers the effective default
on top of the repo binding when no explicit pick is supplied, so update the
expectation to match: both layers apply with the default winning on key
collisions and its setup command appended.
tsgo intermittently fails to emit packages/encryption/src/{encryption,timing-safe-equal}.d.ts
into dist/tsc, causing rollup to fail with 'Could not resolve ./encryption'.
Encryption types are never exposed in router I/O, so externalizing them lets
rollup's tree-shaker drop the unused imports — bundle output is unchanged.
… layer

`mergeProfileConfiguration` previously took only envVars and setupCommands
as inline parameters — mcpServers, encryptedSecrets, runtimeSkills, and
runtimeAgents had to be merged at the call site (or were silently dropped
by the cloud-agent-next handler when profile resolution ran). The merge
logic was duplicated across parallel "process base / process top" blocks
per collection.

Restructure around a single `Layer` type and a reduce over
`[base, top, inline].filter(Boolean)`. The inline layer is built from the
same args object the function already accepts; callers pass all six
inline fields and get one final bundle out. `applyProfileResolution` in
the cloud-agent-next handler shrinks to a shape conversion for mcpServers.

Contract change: inline encryptedSecrets / runtimeSkills / runtimeAgents
now merge with the resolved profile (inline wins on collision) instead of
being silently dropped. No live caller exercises this path today — the
web frontend sends only profileId, the public v1 API does not route
through cloud-agent-next, and bot tools resolve profiles themselves and
forward values inline without a profileId — so behavior is unchanged in
practice. The contract is now symmetric across all six collections.

Disabled MCP servers in any layer (including inline) are skipped in the
merge — they do not delete-key an enabled entry from a lower layer.
Pinned by test.

Drop the misleading comment claiming `getAgentsForSession` filters
disabled agents — agents have no `enabled` column (only skills and MCP
servers do). Surfaced by reviewer feedback on the parent PR.

Tests: five new integration tests under "inline layer" cover MCP merge,
disabled inline MCP, runtimeSkills merge, runtimeAgents merge, and
encryptedSecrets merge alongside the existing per-profile suite.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@eshurakov eshurakov merged commit 201349d into main May 7, 2026
42 checks passed
@eshurakov eshurakov deleted the docs/cloud-agent-profile-skills-and-mcps-plan branch May 7, 2026 07:20
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