浏览 MCP与Skills教程与资源

Codex Skill 如何停用和卸载:按路径禁用、移出目录与恢复

区分禁止自动调用、彻底禁用当前本地 Skill 与移出安装目录。给出 Codex 配置、精准归档命令和恢复步骤,避免备份副本仍被扫描或误删会议产物。

先明确要停止哪一种行为

如果只是普通请求会误选 meeting-notes,可以只禁止隐式调用;如果这个版本的正文有问题,应禁用这个具体文件;如果以后不用了,再把安装目录移走。三者效果不同。

本页只处理本地 Codex 文件系统 Skill。插件安装、ChatGPT 工作区分发以及外部连接授权各有自己的控制面;禁用一个本地 SKILL.md 不等于卸载插件或撤销外部账号权限。本文例子没有任何外部账号或后台进程,因此也没有必要编造‘清理 Token、关闭服务’步骤。

三种操作对应三种目的

目的做法还会保留什么
只允许用户明确点名agents/openai.yaml 中 policy.allow_implicit_invocation: false显式 $meeting-notes 仍可调用;文件仍安装着
停用当前这份本地 Skill~/.codex/config.toml 用 [[skills.config]] 指定 SKILL.md 绝对路径,enabled = false,然后重启文件保留以便审查;同名其他路径不会因此自动全部停用
移除安装并保留恢复能力把精确目标文件夹移到 .agents/skills 之外,再重启检查归档、原始会议与历史输出保留

按当前实际路径生成禁用配置

先检查 config.toml 是否已有该 path 的配置:有则修改同一条 enabled,不要不断追加相同路径;没有再加入。保留已有配置内容,不能用这三行覆盖整个文件。脚本生成带正确转义的路径;下面的单引号形状示例只解释字段,实际使用脚本打印的完整行,避免用户名中的引号破坏配置。

配置更改后重启 Codex,再打开新会话确认。若安装在用户级,使用真实的用户级 SKILL.md 绝对路径;不要复制示例 C:/work 路径。要恢复这一份,改同一条 enabled 为 true,或移除这一条专用禁用项,再重启。

教学示例

PowerShell:定位仓库级文件并输出待添加配置

$repoResult = git rev-parse --show-toplevel
if ($LASTEXITCODE -ne 0 -or -not $repoResult) { throw '请进入安装此 Skill 的 Git 仓库' }
$repoRoot = ([string]$repoResult).Trim()
$skillPath = (Resolve-Path -LiteralPath (Join-Path $repoRoot '.agents\skills\meeting-notes\SKILL.md')).Path
Write-Output '[[skills.config]]'
Write-Output ('path = ' + (ConvertTo-Json -InputObject $skillPath -Compress))
Write-Output 'enabled = false'
# 默认配置路径(如使用了自定义 CODEX_HOME,按实际配置位置处理):
$configPath = Join-Path ([Environment]::GetFolderPath('UserProfile')) '.codex\config.toml'
Write-Output ('将以上配置合并到:' + $configPath)
教学示例

配置形状示例:实际应使用上一条打印出的路径

[[skills.config]]
path = 'C:\work\meeting-lab\.agents\skills\meeting-notes\SKILL.md'
enabled = false

需要卸载时,精确移到发现目录之外

脚本检查绝对来源与归档位置,并拒绝来源路径祖先或归档父目录中的链接/junction,再只移动目标文件夹;不删除 .agents/skills,不处理兄弟 Skill。预期最后的 Test-Path 是 False,归档文件的哈希与移动前一致,实际请以终端输出为准。

该命令专用于仓库级普通目录。用户级副本要以自己的具体安装目录单独处理,不能把源路径粗暴改成整个用户 .agents 目录。归档放在普通 _skill-archive 中,不放回任何 .agents/skills 扫描层级。

教学示例

PowerShell:只归档当前仓库的 meeting-notes

$repoResult = git rev-parse --show-toplevel
if ($LASTEXITCODE -ne 0 -or -not $repoResult) { throw '请先进入目标仓库' }
$repoRoot = ([string]$repoResult).Trim()
$repoRoot = [IO.Path]::GetFullPath($repoRoot)
$skillsRoot = [IO.Path]::GetFullPath((Join-Path $repoRoot '.agents\skills'))
$source = [IO.Path]::GetFullPath((Join-Path $skillsRoot 'meeting-notes'))
$separator = [IO.Path]::DirectorySeparatorChar
if (-not $source.StartsWith($skillsRoot + $separator, [StringComparison]::OrdinalIgnoreCase)) {
  throw '来源越出预期 skills 目录'
}
for ($item = Get-Item -LiteralPath $source -Force; $null -ne $item; $item = $item.Parent) {
  if ($item.Attributes -band [IO.FileAttributes]::ReparsePoint) {
    throw '来源或父目录含链接/junction,先核对真实位置,不按普通目录归档'
  }
}
$archiveBase = Join-Path $repoRoot '_skill-archive'
if (Test-Path -LiteralPath $archiveBase) {
  $archiveItem = Get-Item -LiteralPath $archiveBase -Force
  if ($archiveItem.Attributes -band [IO.FileAttributes]::ReparsePoint) {
    throw '归档父目录是链接/junction,停止'
  }
}
$archiveParent = [IO.Path]::GetFullPath((Join-Path $archiveBase (Get-Date -Format 'yyyyMMdd-HHmmss-fff')))
if (-not $archiveParent.StartsWith($repoRoot + $separator, [StringComparison]::OrdinalIgnoreCase)) {
  throw '归档位置越出当前仓库'
}
$destination = Join-Path $archiveParent 'meeting-notes'
if (Test-Path -LiteralPath $archiveParent) { throw '归档位置已存在,停止' }
Get-FileHash -LiteralPath (Join-Path $source 'SKILL.md') -Algorithm SHA256
Write-Output ('来源:' + $source)
Write-Output ('归档:' + $destination)
New-Item -ItemType Directory -Path $archiveParent -Force | Out-Null
Move-Item -LiteralPath $source -Destination $destination
Test-Path -LiteralPath $source
Get-FileHash -LiteralPath (Join-Path $destination 'SKILL.md') -Algorithm SHA256

重启后仍看到旧行为,按证据查残留

卸载验证至少区分:文件已移出、当前发现列表不再提供该路径、显式请求不能加载该路径。没有可见加载证据时,写‘无法确认本次是否使用’,不要仅凭模型自述判成功。

现象要查的对象正确判断
选择器还出现同名项该项显示路径,用户级/仓库级副本,插件提供的同名能力这是另一份安装时,只禁用原路径不够;先确认来源再处理
旧会话继续按旧规则回答会话里是否已经加载过完整正文旧上下文可能保留指令;用重启后的新会话验证发现
新会话输出仍像会议表格任务本身是否明确要求该格式;AGENTS.md 或用户请求是否写了相同规则普通模型也会排表格;相似输出不能证明 Skill 仍被调用
目录过一阵又回来仓库 checkout、同步脚本、安装器或插件更新是否重新放回文件找实际重新安装来源;不要反复删除所有 Skill 目录
原始会议或历史输出还在它们是否本来就在 Skill 安装目录之外这是应保留的数据,卸载 Skill 无需顺带删除

回滚时恢复精确文件夹,并检查禁用项

复制恢复后,把对应绝对路径的 enabled 改回 true 或删除该专用禁用项;如果曾设置 allow_implicit_invocation: false,它也仍会限制自动选择。重启后先用显式调用和完整会议原文检查,再决定是否恢复隐式调用。

整个过程保留归档与旧产物,不需要删除整个配置目录或清除所有会话。确认恢复的文件哈希、发现路径和实际任务行为后,才能说此次恢复完成。

教学示例

PowerShell:从你记录的归档恢复到原仓库

# 将上一节实际打印的归档目录输入给脚本,避免猜测时间戳。
$archiveFolder = Read-Host '输入归档中的 meeting-notes 完整目录'
$archiveFolder = (Resolve-Path -LiteralPath $archiveFolder).Path
$repoResult = git rev-parse --show-toplevel
if ($LASTEXITCODE -ne 0 -or -not $repoResult) { throw '请进入原目标仓库' }
$repoRoot = ([string]$repoResult).Trim()
$destination = Join-Path $repoRoot '.agents\skills\meeting-notes'
if (Test-Path -LiteralPath $destination) { throw '目标已存在,先比较,不覆盖' }
if (-not (Test-Path -LiteralPath (Join-Path $archiveFolder 'SKILL.md') -PathType Leaf)) {
  throw '归档没有 SKILL.md'
}
New-Item -ItemType Directory -Path (Split-Path -Parent $destination) -Force | Out-Null
Copy-Item -LiteralPath $archiveFolder -Destination $destination -Recurse
Get-FileHash -LiteralPath (Join-Path $destination 'SKILL.md') -Algorithm SHA256
关联教程

继续处理当前问题

一手资料

资料与核验范围

产品行为按 2026-10-10 阅读的官方文档编写;本文会议、文件和版本均为教学构造。页面不声称在你的客户端完成过安装或模型运行。