Skip to content

Add Agent requirements - #11762

Merged
imanolmzd-svg merged 8 commits into
mainfrom
imanol/agent-requirements
Jun 29, 2026
Merged

Add Agent requirements#11762
imanolmzd-svg merged 8 commits into
mainfrom
imanol/agent-requirements

Conversation

@imanolmzd-svg

@imanolmzd-svg imanolmzd-svg commented Jun 28, 2026

Copy link
Copy Markdown
Contributor

What changed

Add agent requirements to agent declarations so experimental agents can declare the skills, MCP servers, and VS Code extensions they need before they run.

The requirement check now powers both clients:

  • VS Code checks the selected agent before sending, shows grouped requirements, and refreshes the view as the user installs skills or connects/configures MCP servers.
  • The CLI TUI checks the selected agent before sending, and stops with actionable guidance when requirements are unmet.
  • The backend exposes requirement status through the Kilo API while preserving the existing VS Code guard behavior.
  • Requirement declarations stay out of generic agent options and are validated when agents load.

Screenshots

image

Testing

  • bun run script/check-opencode-annotations.ts
  • bun run typecheck from packages/opencode
  • bun test ./test/kilocode/agent-requirements.test.ts from packages/opencode
  • bun test ./test/kilocode/agent-requirements-cli.test.ts from packages/opencode

imanolmzd-svg and others added 3 commits June 28, 2026 19:43
Introduce a Kilo-owned CLI requirements module that preflights agent
declarations before session creation. The helper resolves requirement
status via the SDK, blocks agents with unmet skills, errored MCPs, or
VS Code extension dependencies, and produces grouped actionable
guidance for terminal users.

Includes planning documents and a focused test suite covering all
blocking and allow paths.
Comment thread packages/kilo-vscode/src/kilo-provider/agent-requirements-controller.ts Outdated
Comment thread packages/opencode/src/config/config.ts
Comment thread packages/opencode/src/kilocode/cli/agent-requirements.ts Outdated
@kilo-code-bot

kilo-code-bot Bot commented Jun 28, 2026

Copy link
Copy Markdown
Contributor

Code Review Summary

Status: No Issues Found | Recommendation: Merge

Files Reviewed (1 files)
  • packages/opencode/src/session/prompt.ts
Previous Review Summaries (5 snapshots, latest commit 3209f01)

Current summary above is authoritative. Previous snapshots are kept for context only.

Previous review (commit 3209f01)

Status: No Issues Found | Recommendation: Merge

Files Reviewed (8 files)
  • .opencode/tui.json
  • packages/kilo-vscode/tests/unit/agent-requirements.test.ts
  • packages/kilo-vscode/webview-ui/src/context/agent-requirements-state.ts
  • packages/opencode/src/agent/agent.ts
  • packages/opencode/src/kilocode/agent-requirements.ts
  • packages/opencode/src/session/prompt.ts
  • packages/opencode/test/kilocode/agent-requirements.test.ts
  • packages/sdk/openapi.json

Previous review (commit 6a8b81a)

Status: No Issues Found | Recommendation: Merge

Files Reviewed (2 files)
  • .opencode/tui.json
  • packages/opencode/test/kilocode/server/httpapi-exercise-scenarios.ts

Previous review (commit d524365)

Status: No Issues Found | Recommendation: Merge

Files Reviewed (7 files)
  • packages/kilo-vscode/src/KiloProvider.ts
  • packages/kilo-vscode/src/kilo-provider/agent-requirements-controller.ts
  • packages/kilo-vscode/tests/unit/agent-requirements.test.ts
  • packages/kilo-vscode/webview-ui/src/i18n/de.ts
  • packages/kilo-vscode/webview-ui/src/i18n/es.ts
  • packages/kilo-vscode/webview-ui/src/i18n/it.ts
  • packages/kilo-vscode/webview-ui/src/i18n/nl.ts
  • packages/opencode/src/kilocode/cli/agent-requirements.ts
  • packages/opencode/test/kilocode/agent-requirements-cli.test.ts

Previous review (commit 1a238cf)

Status: 1 Issues Found | Recommendation: Address before merge

Overview

Severity Count
CRITICAL 0
WARNING 1
SUGGESTION 0

Fix these issues in Kilo Cloud

Issue Details (click to expand)

WARNING

File Line Issue
packages/kilo-vscode/src/kilo-provider/agent-requirements-controller.ts 64 generations still retains every historical agent/directory key, so the controller can grow unbounded across worktrees and sessions.
Files Reviewed (3 files)
  • packages/kilo-vscode/src/KiloProvider.ts
  • packages/kilo-vscode/src/kilo-provider/agent-requirements-controller.ts - 1 issue
  • packages/kilo-vscode/tests/unit/agent-requirements.test.ts

Previous review (commit d3a3bff)

Status: 3 Issues Found | Recommendation: Address before merge

Overview

Severity Count
CRITICAL 0
WARNING 2
SUGGESTION 1

Fix these issues in Kilo Cloud

Issue Details (click to expand)

WARNING

File Line Issue
packages/kilo-vscode/src/kilo-provider/agent-requirements-controller.ts 63 generations retains every historical agent/directory key, so the controller can grow unbounded across worktrees and sessions.
packages/opencode/src/kilocode/cli/agent-requirements.ts 103 Extension-only agents still end with retry guidance that points users to skills/MCP setup the CLI can never satisfy.

SUGGESTION

File Line Issue
packages/opencode/src/config/config.ts 393 Mirror experimental.agent_requirements in the cloud config schema extras so $schema: https://app.kilo.ai/config.json recognizes it.
Files Reviewed (67 files)
  • .changeset/agent-requirements.md
  • packages/kilo-docs/public/img/screenshot-tests/kilo-vscode/visual-regression/chat/chat-view-requirements-checking-chromium-linux.png
  • packages/kilo-docs/public/img/screenshot-tests/kilo-vscode/visual-regression/chat/chat-view-requirements-malformed-chromium-linux.png
  • packages/kilo-docs/public/img/screenshot-tests/kilo-vscode/visual-regression/chat/chat-view-requirements-missing-extension-chromium-linux.png
  • packages/kilo-docs/public/img/screenshot-tests/kilo-vscode/visual-regression/chat/chat-view-requirements-missing-tools-chromium-linux.png
  • packages/kilo-docs/public/img/screenshot-tests/kilo-vscode/visual-regression/chat/chat-view-requirements-ready-chromium-linux.png
  • packages/kilo-vscode/src/KiloProvider.ts
  • packages/kilo-vscode/src/kilo-provider/agent-requirements-controller.ts - 1 issue
  • packages/kilo-vscode/src/kilo-provider/agent-requirements.ts
  • packages/kilo-vscode/src/services/marketplace/types.ts
  • packages/kilo-vscode/tests/unit/agent-requirements.test.ts
  • packages/kilo-vscode/tests/unit/marketplace-installer.test.ts
  • packages/kilo-vscode/webview-ui/agent-manager/AgentManagerApp.tsx
  • packages/kilo-vscode/webview-ui/src/App.tsx
  • packages/kilo-vscode/webview-ui/src/components/chat/AgentRequirements.tsx
  • packages/kilo-vscode/webview-ui/src/components/chat/ChatView.tsx
  • packages/kilo-vscode/webview-ui/src/components/chat/PromptInput.tsx
  • packages/kilo-vscode/webview-ui/src/context/agent-requirements-state.ts
  • packages/kilo-vscode/webview-ui/src/context/agent-requirements.tsx
  • packages/kilo-vscode/webview-ui/src/i18n/ar.ts
  • packages/kilo-vscode/webview-ui/src/i18n/br.ts
  • packages/kilo-vscode/webview-ui/src/i18n/bs.ts
  • packages/kilo-vscode/webview-ui/src/i18n/da.ts
  • packages/kilo-vscode/webview-ui/src/i18n/de.ts
  • packages/kilo-vscode/webview-ui/src/i18n/en.ts
  • packages/kilo-vscode/webview-ui/src/i18n/es.ts
  • packages/kilo-vscode/webview-ui/src/i18n/fr.ts
  • packages/kilo-vscode/webview-ui/src/i18n/it.ts
  • packages/kilo-vscode/webview-ui/src/i18n/ja.ts
  • packages/kilo-vscode/webview-ui/src/i18n/ko.ts
  • packages/kilo-vscode/webview-ui/src/i18n/nl.ts
  • packages/kilo-vscode/webview-ui/src/i18n/no.ts
  • packages/kilo-vscode/webview-ui/src/i18n/pl.ts
  • packages/kilo-vscode/webview-ui/src/i18n/ru.ts
  • packages/kilo-vscode/webview-ui/src/i18n/th.ts
  • packages/kilo-vscode/webview-ui/src/i18n/tr.ts
  • packages/kilo-vscode/webview-ui/src/i18n/uk.ts
  • packages/kilo-vscode/webview-ui/src/i18n/zh.ts
  • packages/kilo-vscode/webview-ui/src/i18n/zht.ts
  • packages/kilo-vscode/webview-ui/src/stories/StoryProviders.tsx
  • packages/kilo-vscode/webview-ui/src/stories/chat.stories.tsx
  • packages/kilo-vscode/webview-ui/src/styles/agent-requirements.css
  • packages/kilo-vscode/webview-ui/src/styles/chat.css
  • packages/kilo-vscode/webview-ui/src/styles/prompt-input.css
  • packages/kilo-vscode/webview-ui/src/types/marketplace.ts
  • packages/kilo-vscode/webview-ui/src/types/messages/agents.ts
  • packages/kilo-vscode/webview-ui/src/types/messages/config.ts
  • packages/kilo-vscode/webview-ui/src/types/messages/extension-messages.ts
  • packages/kilo-vscode/webview-ui/src/types/messages/webview-messages.ts
  • packages/opencode/src/agent/agent.ts
  • packages/opencode/src/cli/cmd/tui/component/prompt/index.tsx
  • packages/opencode/src/config/agent.ts
  • packages/opencode/src/config/config.ts - 1 issue
  • packages/opencode/src/kilocode/agent-requirements.ts
  • packages/opencode/src/kilocode/cli/agent-requirements.ts - 1 issue
  • packages/opencode/src/kilocode/server/httpapi/groups/kilocode.ts
  • packages/opencode/src/kilocode/server/httpapi/handlers/kilocode.ts
  • packages/opencode/src/server/routes/instance/httpapi/handlers/session.ts
  • packages/opencode/src/session/prompt.ts
  • packages/opencode/src/session/session.ts
  • packages/opencode/test/agent/agent.test.ts
  • packages/opencode/test/agent/plugin-agent-regression.test.ts
  • packages/opencode/test/kilocode/agent-requirements-cli.test.ts
  • packages/opencode/test/kilocode/agent-requirements.test.ts
  • packages/sdk/js/src/v2/gen/sdk.gen.ts
  • packages/sdk/js/src/v2/gen/types.gen.ts
  • packages/sdk/openapi.json

Reviewed by gpt-5.4-20260305 · Input: 83.5K · Output: 5.5K · Cached: 355.6K

Review guidance: REVIEW.md from base branch main

…tions

Wrap vscode.extensions.onDidChange in a typeof check so the subscribe
callback is undefined in environments where the API is unavailable.
Skip posting agentRequirementsInvalidated when the controller cache is
already empty to avoid spurious messages to the webview.

Update the associated test to seed cache state before asserting on the
clear-triggered invalidation flow.
…-identity tokens

Switch the controller's supersession tracking from incrementing counters
to ephemeral object references, ensuring stale tokens are cleaned up on
both success and failure paths. This eliminates a class of race
conditions where cleared counters could alias with fresh requests.

Conditionally emit the "Install the required skills..." footer in the
CLI formatter only when skills or MCPs are actually present, preventing
misleading guidance for extension-only requirement failures.
Cover the GET /kilocode/agent/requirements route in the HTTP API
exercise harness, asserting that the response echoes the requested
agent, uses the routed workspace directory, and correctly reports
the disabled state with empty skills/mcps/extensions arrays.
@zakimimit

Copy link
Copy Markdown

@imanolmzd-svg
Take a look at this – it looks like you're working on Agent

[Bug] Cannot Remove Installed Agents

@markijbema markijbema left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Had a bot review, and added my own thoughts where it seems up for discussion. I think especially how we work with different platforms requires some thought still

Comment thread .opencode/tui.json Outdated
Comment thread packages/kilo-vscode/webview-ui/src/context/agent-requirements.tsx
Comment thread packages/opencode/src/kilocode/agent-requirements.ts Outdated
Comment thread packages/opencode/src/kilocode/agent-requirements.ts Outdated
Comment thread packages/opencode/src/kilocode/agent-requirements.ts
Comment thread packages/opencode/src/kilocode/agent-requirements.ts
…ID validation

Lift the VS Code–only restriction from the requirements guard so
that blocked skills/MCPs fail for CLI and other clients as well.
VS Code extension requirements remain client-specific. The evaluate
function now accepts pre-decoded requirements as an explicit input
rather than decoding internally, and the schema switches from the
strict alphanumeric ID pattern to a permissive non-whitespace Name
pattern allowing slashes and spaces in skill/MCP identifiers.

Update prompt interfaces to surface RequirementBlockedError in the
typed error channel and preserve "ready" results in the webview
cache alongside blocked/error states.
@imanolmzd-svg
imanolmzd-svg requested a review from markijbema June 29, 2026 09:46
@imanolmzd-svg
imanolmzd-svg enabled auto-merge (squash) June 29, 2026 09:48
@imanolmzd-svg
imanolmzd-svg merged commit d89b1b6 into main Jun 29, 2026
40 of 46 checks passed
@imanolmzd-svg
imanolmzd-svg deleted the imanol/agent-requirements branch June 29, 2026 09:55
TahsinArafat pushed a commit to TahsinArafat/sleepy-vscode that referenced this pull request Jul 5, 2026
* feat(agent-requirements): gate agents on declared requirements

* feat(cli): add agent requirements preflight helpers

Introduce a Kilo-owned CLI requirements module that preflights agent
declarations before session creation. The helper resolves requirement
status via the SDK, blocks agents with unmet skills, errored MCPs, or
VS Code extension dependencies, and produces grouped actionable
guidance for terminal users.

Includes planning documents and a focused test suite covering all
blocking and allow paths.

* chore: update kilo-vscode visual regression baselines

* fix(vscode): guard extension subscription and suppress empty invalidations

Wrap vscode.extensions.onDidChange in a typeof check so the subscribe
callback is undefined in environments where the API is unavailable.
Skip posting agentRequirementsInvalidated when the controller cache is
already empty to avoid spurious messages to the webview.

Update the associated test to seed cache state before asserting on the
clear-triggered invalidation flow.

* refactor(agent-requirements): replace numeric generations with object-identity tokens

Switch the controller's supersession tracking from incrementing counters
to ephemeral object references, ensuring stale tokens are cleaned up on
both success and failure paths. This eliminates a class of race
conditions where cleared counters could alias with fresh requests.

Conditionally emit the "Install the required skills..." footer in the
CLI formatter only when skills or MCPs are actually present, preventing
misleading guidance for extension-only requirement failures.

* test(httpapi): add exercise scenario for agent requirements endpoint

Cover the GET /kilocode/agent/requirements route in the HTTP API
exercise harness, asserting that the response echoes the requested
agent, uses the routed workspace directory, and correctly reports
the disabled state with empty skills/mcps/extensions arrays.

* feat(agent-requirements): enforce guard across all clients and relax ID validation

Lift the VS Code–only restriction from the requirements guard so
that blocked skills/MCPs fail for CLI and other clients as well.
VS Code extension requirements remain client-specific. The evaluate
function now accepts pre-decoded requirements as an explicit input
rather than decoding internally, and the schema switches from the
strict alphanumeric ID pattern to a permissive non-whitespace Name
pattern allowing slashes and spaces in skill/MCP identifiers.

Update prompt interfaces to surface RequirementBlockedError in the
typed error channel and preserve "ready" results in the webview
cache alongside blocked/error states.

* chore(opencode): fix requirement guard annotations

---------

Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
t7tran pushed a commit to t7tran/kilocode that referenced this pull request Aug 14, 2026
* feat(agent-requirements): gate agents on declared requirements

* feat(cli): add agent requirements preflight helpers

Introduce a Kilo-owned CLI requirements module that preflights agent
declarations before session creation. The helper resolves requirement
status via the SDK, blocks agents with unmet skills, errored MCPs, or
VS Code extension dependencies, and produces grouped actionable
guidance for terminal users.

Includes planning documents and a focused test suite covering all
blocking and allow paths.

* chore: update kilo-vscode visual regression baselines

* fix(vscode): guard extension subscription and suppress empty invalidations

Wrap vscode.extensions.onDidChange in a typeof check so the subscribe
callback is undefined in environments where the API is unavailable.
Skip posting agentRequirementsInvalidated when the controller cache is
already empty to avoid spurious messages to the webview.

Update the associated test to seed cache state before asserting on the
clear-triggered invalidation flow.

* refactor(agent-requirements): replace numeric generations with object-identity tokens

Switch the controller's supersession tracking from incrementing counters
to ephemeral object references, ensuring stale tokens are cleaned up on
both success and failure paths. This eliminates a class of race
conditions where cleared counters could alias with fresh requests.

Conditionally emit the "Install the required skills..." footer in the
CLI formatter only when skills or MCPs are actually present, preventing
misleading guidance for extension-only requirement failures.

* test(httpapi): add exercise scenario for agent requirements endpoint

Cover the GET /kilocode/agent/requirements route in the HTTP API
exercise harness, asserting that the response echoes the requested
agent, uses the routed workspace directory, and correctly reports
the disabled state with empty skills/mcps/extensions arrays.

* feat(agent-requirements): enforce guard across all clients and relax ID validation

Lift the VS Code–only restriction from the requirements guard so
that blocked skills/MCPs fail for CLI and other clients as well.
VS Code extension requirements remain client-specific. The evaluate
function now accepts pre-decoded requirements as an explicit input
rather than decoding internally, and the schema switches from the
strict alphanumeric ID pattern to a permissive non-whitespace Name
pattern allowing slashes and spaces in skill/MCP identifiers.

Update prompt interfaces to surface RequirementBlockedError in the
typed error channel and preserve "ready" results in the webview
cache alongside blocked/error states.

* chore(opencode): fix requirement guard annotations

---------

Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.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.

3 participants