# 利用 Codex 会话历史自动化提炼可复用能力

- 来源：meng shao (@shao__meng)
- 发布时间：2026-05-24 20:40
- AIHOT 分数：73
- AIHOT 链接：https://aihot.virxact.com/items/cmpjs0cxg011usl018jgd7dwq
- 原文链接：https://x.com/shao__meng/status/2058528591173046439

## AI 摘要

Codex 团队分享了一项实践：让 Codex 分析你近期的会话历史，识别重复出现的任务模式，并将其沉淀为可复用的产物。具体分为两类：面向固定流程的“技能”和面向单一职责的“子智能体”。通过设计针对性的提示词（聚焦于 CI 失败等七个高频场景），强制进行二分类选择，该方法旨在减少重复的手动描述，节省 token 并提升一致性。

## 正文

让 Codex 回顾你过去的会话历史，识别重复出现的任务模式，并沉淀为可复用的 Skills 或 Subagent，来自 Codex 团队 @reach_vb 的分享

大多数开发者在使用 AI 编程助手时，会反复问同类问题：
· "CI 为什么挂了？"
· "帮我 review 这个 PR"
· "写一下 changelog"
· "追踪这个 bug"
· "清理这个 diff"
这些重复的 prompt 本质上是未被显式抽象的工作流。每次手动重新描述，既浪费 token，也缺乏一致性。

Skills 和 Subagent 的沉淀方式区别是什么？
· Skills：适用于可复用的工作流，多步骤、有固定流程、面向"怎么做"
· Subagent：适用于边界清晰的角色或调查任务，单一职责、可委派、面向"谁来做"

Prompt 设计的工程细节
· 数据源明确--基于 "recent Codex sessions" 而非凭空生成，让建议有真实依据。
· 二分类决策--强制 Codex 在 skill 和 subagent 之间做选择，避免模糊产出。
· 领域聚焦--列出 CI、PR review、changelog、docs、release、debugging、test triage 七个高频场景，收窄搜索空间。
· 质量约束--"Create the useful ones only. Keep them simple." 防止 AI 过度生成低价值产物。

Prompt 原文可以直接复制
Look through my recent Codex sessions and identify repeated workflows or repeated asks.

For anything I keep doing manually， suggest：
1. a skill if it is a reusable workflow
2. a custom subagent if it is a bounded role or investigation task

Focus on practical things like CI failures， PR reviews， changelogs， docs updates， release prep， debugging， and test triage.

Create the useful ones only. Keep them simple.

### 引用推文

> Vaibhav (VB) Srivastav：Copy and paste this into your codex: "Look through my recent Codex sessions and identify repeated workflows or repeated asks. For anything I keep doing manually...
