/* * Copyright (c) 2026 Pawan Osman * * This file is part of OpenCursor — AI coding agent chat inside VS Code. * https://github.com/PawanOsman/OpenCursor * * Licensed under the MIT License. See LICENSE file in the project root. */ import * as React from "react"; import { Icon } from "../../shared/icons"; import { vscode } from "../../shared/vscode"; import { ModelSelect } from "../../shared/ModelSelect"; import { FeatureConfig, ModelDef, RuleInfo, SkillInfo, SubagentDef, uid } from "../features"; export function RulesPanel({ features, setFeatures, rules, skills, models, modelList = [], }: { features: FeatureConfig; setFeatures: (f: Partial) => void; rules: RuleInfo[]; skills: SkillInfo[]; models: string[]; modelList?: ModelDef[]; }) { // Prefer the provider-grouped list; fall back to raw ids. const selectModels = modelList.length ? modelList : models.map((id) => ({ id, name: id })); const updateSub = (i: number, patch: Partial) => { const next = features.subagents.map((s, idx) => (idx === i ? { ...s, ...patch } : s)); setFeatures({ subagents: next }); }; const removeSub = (i: number) => setFeatures({ subagents: features.subagents.filter((_, idx) => idx !== i) }); const addSub = () => setFeatures({ subagents: [ ...features.subagents, { id: uid("sub"), name: "explorer", description: "Explores the codebase", prompt: "", readonly: true }, ], }); return ( <>

Rules, Skills, Subagents

Provide domain-specific knowledge and workflows for the agent

Rules ?

Use Rules to guide agent behavior, like enforcing best practices or coding standards. Rules can be applied always, by file path, or manually.

{rules.length === 0 ? (
No Rules Yet
Create rules to guide agent behavior
) : (
{rules.map((r) => (
r.path && vscode.postMessage({ type: "openWorkspaceFile", path: r.path })} >
{r.description || r.file}
{r.description &&
{r.file}{r.globs ? ` · ${r.globs}` : ""}
}
{r.alwaysApply ? "always" : r.globs ? "glob" : "manual"} {r.path && ( )}
))}
)}
Skills ?

Skills are specialized capabilities that help the agent accomplish specific tasks. Skills will be invoked by the agent when relevant.

{skills.length === 0 ? (
No Skills Yet
Create skills for specialized capabilities
) : (
{skills.map((s) => (
vscode.postMessage({ type: "openWorkspaceFile", path: s.path })} >
{s.name}
{s.description}
))}
)}
Subagents ?

Create specialized agents for complex tasks. Subagents can be invoked by the agent to handle focused work in parallel.

Subagent Model
Default model for all subagents. Per-subagent overrides below take precedence; empty = inherit the chat model.
setFeatures({ subagentModel: id })} customItems={[{ value: "", label: "Inherit chat model", desc: "use whatever the chat uses" }]} />
{features.subagents.length === 0 ? (
No Subagents Yet
Create specialized agents to handle focused tasks
) : ( features.subagents.map((sub, i) => (
updateSub(i, { name: e.target.value })} placeholder="name" />