一键导入
osx-maintain-ai-docs
Update AGENTS.md after implementing an OpenSpec change. Use between sync and archive to document what was built for future OpenCode sessions.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Update AGENTS.md after implementing an OpenSpec change. Use between sync and archive to document what was built for future OpenCode sessions.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
Foundational knowledge for OpenSpec-extended. INVOKE when learning the framework or whenever a phase command says "load osx-concepts". Covers the framework (repo layout, artifacts, resource taxonomy, glossary) and decision guidance. For tool-layer choice and the 7-phase workflow, see `osx-workflow`.
Reference for the 7-phase OpenSpec-extended autonomous workflow. INVOKE when dispatched by the orchestrator, executing any osx-phaseN command, calling the osx state I/O tool, or troubleshooting the 7-phase loop. Covers the 4 tool layers, the phases, state files, the osx state I/O tool, and blocker/resume semantics.
Reference for the 7-phase OpenSpec-extended autonomous workflow. INVOKE when dispatched by the orchestrator, executing any osx-phaseN command, calling the osx state I/O tool, or troubleshooting the 7-phase loop. Covers the 4 tool layers, the phases, state files, the osx state I/O tool, and blocker/resume semantics.
Generate CHANGELOG.md in Keep a Changelog format from archived OpenSpec changes. Use after archiving changes, before publishing releases, or when creating release notes. Reads archived proposals and categorizes changes automatically.
Review OpenSpec artifacts for feasibility, correctness, completeness, and implementation-readiness. Use BEFORE implementation to validate the plan is sound, or during artifact creation to check quality. Part of pre-implementation workflow: review-artifacts → modify-artifacts → apply.
Generate CHANGELOG.md in Keep a Changelog format from archived OpenSpec changes. Use after archiving changes, before publishing releases, or when creating release notes. Reads archived proposals and categorizes changes automatically.
| name | osx-maintain-ai-docs |
| description | Update AGENTS.md after implementing an OpenSpec change. Use between sync and archive to document what was built for future OpenCode sessions. |
| license | MIT |
Update project documentation after implementing an OpenSpec change.
When invoked by openspec-extended orchestrate, OSX_AUTONOMOUS=1 is set. In that mode, skip interactive confirmation and proceed with reasonable defaults. For interactive use, the env var is unset and the skill prompts as documented.
Input: Optionally specify a change name. If omitted, check if it can be inferred from conversation context. If vague or ambiguous you MUST prompt for available changes.
| Principle | Application |
|---|---|
| Ruthless conciseness | Only document what AI can't infer from code |
| Progressive disclosure | Reference details, don't embed them |
| Token efficiency | Tables over verbose lists, front-load essentials |
| Specificity | Concrete commands, not vague instructions |
Target lengths:
Select the change
If a name is provided, use it. Otherwise:
openspec list --json to get available changes.
Mode check: if OSX_AUTONOMOUS=1 is set in the environment, skip this question and use the first candidate. Otherwise, use the AskUserQuestion tool to let the user selectAlways announce: "Using change: " and how to override.
Read change artifacts
Read files from openspec/changes/<name>/:
| File | Extract |
|---|---|
proposal.md | Intent, scope, new features/capabilities |
specs/ | New requirements, modified behaviors |
design.md | Architectural decisions, new patterns, file changes |
tasks.md | Checked items = what was actually built |
Key extraction:
Read recent code changes
Use git to identify what code was actually modified:
# Get recent commits related to the change
git log --oneline -20
# See what files changed in recent commits
git diff HEAD~5..HEAD --stat
# View actual diff content for context
git diff HEAD~5..HEAD --name-only
What to look for:
Cross-reference with artifacts:
Detect or create documentation file
test -f AGENTS.md && echo "AGENTS.md found"
If AGENTS.md doesn't exist, create minimal documentation:
# Project - OpenCode Reference
## Quick Reference
| Command | Purpose |
|---------|---------|
| `npm run dev` | Start development |
| `npm run build` | Production build |
## Architecture
[Brief overview based on codebase structure]
## Conventions
[Key patterns observed from git changes]
Read current documentation
Warn if:
Error if:
Assess documentation needs
For each implemented item, determine if docs need updating:
| Implementation Type | Action |
|---|---|
| New CLI commands/scripts | Add to Quick Reference |
| New components/modules | Add brief entry with purpose |
| New patterns/conventions | Add specific pattern |
| New APIs/endpoints | Add endpoint summary table |
| Architecture changes | Update overview section |
| Bug fixes/refactors | Usually no update needed |
| Internal changes | Skip unless affects conventions |
Filter out:
Generate proposed updates
Apply best practices:
Use tables for lists:
| Command | Purpose |
|---------|---------|
| `npm run dev` | Start dev server |
| `npm run build` | Production build |
Be specific:
✅ "Run `npm run typecheck` after TypeScript changes"
❌ "Run the typechecker"
Progressive disclosure:
✅ "See `src/auth/AGENTS.md` for auth patterns"
❌ [500 lines of auth documentation embedded]
Cut generic advice:
❌ "Follow coding best practices"
❌ "Write clean code"
❌ "Test thoroughly"
Show proposal and confirm
Present changes with impact:
## Documentation Updates: <change-name>
**Current state**:
- AGENTS.md: 180 lines (~720 tokens)
**Proposed changes**:
- Add "Feature X" to Quick Reference (table format)
- Add pattern: "Use `useX()` hook for X state"
**After update**: ~195 lines (within target)
Apply these updates?
Mode check: if OSX_AUTONOMOUS=1 is set in the environment, skip this question and auto-accept. Otherwise, use AskUserQuestion tool to confirm before writing.
Write updates
On new docs created:
## Documentation Created: <change-name>
**File created**:
- AGENTS.md (new, 45 lines)
**Initial content**:
- Quick Reference with detected commands
- Architecture overview from codebase
- Conventions from recent changes
**Next step**: Review and refine, then ready to archive with `/osc-archive-change`.
On updates applied:
## Documentation Updated: <change-name>
**File modified**:
- AGENTS.md: +5 lines (180 → 185)
**Changes applied**:
- Added "Theme System" to Quick Reference
- Added theme hook pattern
- Updated architecture overview
**Next step**: Ready to archive with `/osc-archive-change`.
On no updates needed:
## Documentation Current
Implementation doesn't require documentation updates:
- All changes are internal/refactoring
- Existing documentation covers functionality
- Changes are inferable from code structure
Ready to archive with `/osc-archive-change`.
On length warning:
## Documentation Warning
**AGENTS.md**: 420 lines (exceeds 300 line target)
Recommendations:
1. Move detailed patterns to subdirectory AGENTS.md files
2. Use progressive disclosure (reference, don't embed)
3. Convert verbose lists to tables
Proceed anyway, or address first?
# BAD
- Follow coding best practices
- Write clean, maintainable code
- Test thoroughly
# GOOD (or skip entirely if standard)
- Run `npm run typecheck` after TypeScript changes
- Use `set -euo pipefail` for shell scripts
# BAD
- ThemeContext: This component provides theme state management
using React Context API. It integrates with localStorage for
persistence and supports system preference detection...
# GOOD
- `useTheme()`: Returns `{ theme, setTheme }` - see `src/contexts/ThemeContext.tsx`