mirror of
https://github.com/Fission-AI/OpenSpec.git
synced 2026-09-14 20:16:53 +08:00
1a3bfae784
Based on OPENSPEC_COMPREHENSIVE_RETROSPECTIVE.md analysis: Added critical missing documentation: - Scenario formatting requirements (#### Scenario: headers) - #1 pain point - Complete spec file structure examples with ADDED/MODIFIED sections - Delta file location and extraction explanation - Debugging commands (show --json --deltas-only) - Troubleshooting section with common errors and solutions Expanded implementation: - Added 2 new task sections (Spec File Documentation, Troubleshooting) - Increased from 41 to 52 total implementation tasks - Added critical items to CLAUDE.md template tasks This directly addresses the retrospective's top issues: 1. Scenario format documentation (marked "COMPLETELY MISSING") 2. Complete spec file examples 3. Delta detection debugging 4. Silent parsing failure explanations
5.7 KiB
5.7 KiB
Update OpenSpec Agent Instructions
Why
The current OpenSpec agent instructions need updates to follow best practices for AI assistant instructions (brevity, clarity, removing ambiguity), ensure CLI commands are current with the actual implementation, and properly document the three-stage workflow pattern that agents should follow.
What Changes
Core Structure Improvements
- Front-load the 3-stage workflow as the primary mental model:
- Creating a change proposal (proposal.md, spec deltas, design.md, tasks.md)
- Implementing a change proposal:
- First read proposal.md to understand the change
- Read design.md if it exists for technical context
- Read tasks.md for the implementation checklist
- Complete tasks one by one
- Mark each task complete immediately after finishing
- Archiving the change proposal (using archive command after deployment)
- Reduce instruction length by 50% while maintaining all critical information
- Restructure with clear hierarchy: Core Workflow → Quick Start → Commands → Details → Edge Cases
Decision Clarity Enhancements
- Add clear decision trees for common scenarios (bug vs feature, proposal needed vs not)
- Remove ambiguous conditions that confuse agent decision-making
- Add "Before Any Task" checklist for context gathering
- Add "Before Creating Specs" rule - Always check existing specs first to avoid duplicates
CLI Documentation Updates
- Complete command documentation with all current functionality:
openspec init [path]- Initialize OpenSpec in a projectopenspec list- List all active changes (default)openspec list --specs- List all specificationsopenspec show [item]- Display change or spec with auto-detectionopenspec show- Interactive mode for selectionopenspec diff [change]- Show spec differences for a changeopenspec validate [item]- Validate changes or specsopenspec archive [change]- Archive completed change after deploymentopenspec update [path]- Update OpenSpec instruction files
- Document all flags and options:
--jsonoutput format for programmatic use--type change|specfor disambiguation--skip-specsfor tooling-only archives--strictfor strict validation mode--no-interactiveto disable prompts
- Remove deprecated command references (noun-first patterns like
openspec change show) - Add concrete examples for each command variation
- Document debugging commands:
openspec show [change] --json --deltas-onlyfor inspecting deltasopenspec validate [change] --strictfor comprehensive validation
Spec File Structure Documentation
- Complete spec file examples showing proper structure:
## ADDED Requirements ### Requirement: Clear requirement statement The system SHALL provide the functionality... #### Scenario: Descriptive scenario name - **WHEN** condition occurs - **THEN** expected outcome - **AND** additional outcomes - Scenario formatting requirements (critical - most common error):
- MUST use
#### Scenario:headers (4 hashtags) - NOT bullet lists or bold text
- Each requirement MUST have at least one scenario
- MUST use
- Delta file location - Clear explanation:
- Spec files go in
changes/{name}/specs/directory - Deltas are automatically extracted from these files
- Use operation prefixes: ADDED, MODIFIED, REMOVED, RENAMED
- Spec files go in
Troubleshooting Section
- Common errors and solutions:
- "Change must have at least one delta" → Check specs/ directory exists with .md files
- "Requirement must have at least one scenario" → Check scenario uses
#### Scenario:format - Silent scenario parsing failures → Verify exact header format
- Delta detection debugging:
- Use
openspec show [change] --json --deltas-onlyto inspect parsed deltas - Check that spec files have operation prefixes (## ADDED Requirements)
- Verify specs/ subdirectory structure
- Use
- Validation best practices:
- Always use
--strictflag for comprehensive checks - Use JSON output for debugging:
--json | jq '.deltas'
- Always use
Agent-Specific Improvements
- Implementation workflow - Clear step-by-step process:
- Read proposal.md to understand what's being built
- Read design.md (if exists) for technical decisions
- Read tasks.md for the implementation checklist
- Implement tasks one by one in order
- Mark each task complete immediately:
- [x] Task completed - Never skip ahead or batch task completion
- Spec discovery workflow - Always check existing specs before creating new ones:
- Use
openspec list --specsto see all current specs - Check if capability already exists before creating
- Prefer modifying existing specs over creating duplicates
- Use
- Tool selection matrix - When to use Grep vs Glob vs Read
- Error recovery patterns - How to handle common failures
- Context management guide - What to read before starting tasks
- Verification workflows - How to confirm changes are correct
Best Practices Section
- Be concise - One-line answers when appropriate
- Be specific - Use exact file paths and line numbers (file.ts:42)
- Start simple - Default to <100 lines, single-file implementations
- Justify complexity - Require data/metrics for any optimization
Impact
- Affected specs: None (this is a tooling/documentation change)
- Affected code:
src/core/templates/claude-template.ts- Update CLAUDE.md template
- Affected documentation:
openspec/README.md- Main OpenSpec instructions- CLAUDE.md files generated by
openspec initcommand
Note: This is a tooling/infrastructure change that doesn't require spec updates. When archiving, use openspec archive update-agent-instructions --skip-specs.