-
Notifications
You must be signed in to change notification settings - Fork 5.8k
feat: add retrospective command for spec drift analysis #1533
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,220 @@ | ||||||||||||||
| --- | ||||||||||||||
| description: Perform a post-implementation retrospective analysis measuring spec drift, implementation deviations, and generating lessons learned for future features. | ||||||||||||||
|
||||||||||||||
| handoffs: | ||||||||||||||
| - label: Update Constitution | ||||||||||||||
| agent: speckit.constitution | ||||||||||||||
| prompt: Update constitution based on retrospective learnings | ||||||||||||||
| send: true | ||||||||||||||
| - label: Create New Feature | ||||||||||||||
| agent: speckit.specify | ||||||||||||||
| prompt: Create a new feature incorporating learnings from retrospective | ||||||||||||||
| send: true | ||||||||||||||
| scripts: | ||||||||||||||
| sh: scripts/bash/check-prerequisites.sh --json --require-tasks --include-tasks | ||||||||||||||
| ps: scripts/powershell/check-prerequisites.ps1 -Json -RequireTasks -IncludeTasks | ||||||||||||||
| --- | ||||||||||||||
|
|
||||||||||||||
| ## User Input | ||||||||||||||
|
|
||||||||||||||
| ```text | ||||||||||||||
| $ARGUMENTS | ||||||||||||||
| ``` | ||||||||||||||
|
|
||||||||||||||
| Consider user input before proceeding (if not empty). | ||||||||||||||
|
||||||||||||||
|
|
||||||||||||||
| ## Goal | ||||||||||||||
|
|
||||||||||||||
| Analyze completed implementation against spec.md, plan.md, and tasks.md to measure **spec drift**. Generate actionable insights for future SDD cycles. | ||||||||||||||
|
|
||||||||||||||
| ## Constraints | ||||||||||||||
|
|
||||||||||||||
| - **READ-ONLY**: Output report only, no file modifications | ||||||||||||||
| - **Post-Implementation**: Run after implementation complete; warn if <80% tasks done, abort if <50% | ||||||||||||||
|
|
||||||||||||||
| ## Execution Steps | ||||||||||||||
|
|
||||||||||||||
| ### 1. Initialize Context | ||||||||||||||
|
|
||||||||||||||
| Run `{SCRIPT}` from repo root. Parse JSON for FEATURE_DIR. Derive paths: SPEC, PLAN, TASKS = FEATURE_DIR/{spec,plan,tasks}.md. Abort if missing. | ||||||||||||||
|
|
||||||||||||||
| For single quotes in args like "I'm Groot", use escape syntax: e.g 'I'\''m Groot' (or double-quote if possible: "I'm Groot"). | ||||||||||||||
|
|
||||||||||||||
| ### 2. Validate Completeness | ||||||||||||||
|
|
||||||||||||||
| ```bash | ||||||||||||||
| total_tasks=$(grep -c '^\- \[[ Xx]\]' "$TASKS") | ||||||||||||||
|
||||||||||||||
| total_tasks=$(grep -c '^\- \[[ Xx]\]' "$TASKS") | |
| total_tasks=$(grep -c '^- \[[ Xx]\]' "$TASKS") |
Copilot
AI
Feb 2, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Similarly, the pattern '^\- \[[Xx]\]' for completed tasks should be '^- \[[Xx]\]' without escaping the hyphen.
| total_tasks=$(grep -c '^\- \[[ Xx]\]' "$TASKS") | |
| completed_tasks=$(grep -c '^\- \[[Xx]\]' "$TASKS") | |
| total_tasks=$(grep -c '^- \[[ Xx]\]' "$TASKS") | |
| completed_tasks=$(grep -c '^- \[[Xx]\]' "$TASKS") |
Copilot
AI
Feb 2, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The division operation $((completed_tasks * 100 / total_tasks)) will fail with a "division by zero" error if there are no tasks in the file. While this is unlikely in normal usage (since tasks.md should have tasks), it's a potential edge case that should be handled. Consider adding a check or using a safer calculation approach.
| completion_rate=$((completed_tasks * 100 / total_tasks)) | |
| if [ "$total_tasks" -eq 0 ]; then | |
| completion_rate=0 | |
| else | |
| completion_rate=$((completed_tasks * 100 / total_tasks)) | |
| fi |
Copilot
AI
Feb 2, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The command states "abort if <50%" in line 32, but the detailed instruction in line 50 says "Confirm before proceeding" for <50% completion. These instructions are inconsistent. Based on the context and safer design (allowing users to proceed if they explicitly confirm), the "Confirm before proceeding" approach is more appropriate than an absolute abort, but the instructions should be consistent.
Copilot
AI
Feb 2, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The git log command git log --name-only HEAD~50..HEAD assumes there are at least 50 commits in the repository history. In a new or small repository, this will fail with an error like "fatal: ambiguous argument 'HEAD~50': unknown revision or path not in the working tree." Consider using a safer approach like git log --name-only --since="1 month ago" or wrapping the command with error handling.
| - Extract file paths from completed tasks + `git log --name-only HEAD~50..HEAD` | |
| - Extract file paths from completed tasks + `git log --name-only --since="1 month ago"` (or another safe range that works even in small repositories) |
Copilot
AI
Feb 2, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The table format appears incorrect. Line 127 shows "Total/Implemented/Modified/Not Implemented/Unspecified | X" which suggests multiple metrics crammed into a single row. This should likely be a multi-row table where each metric (Total, Implemented, Modified, Not Implemented, Unspecified) has its own row with a corresponding value, or it should be a multi-column table with separate columns for each metric type. The current format is unclear and won't render properly as a meaningful table.
| | Metric | Value | | |
| |--------|-------| | |
| | Total/Implemented/Modified/Not Implemented/Unspecified | X | | |
| | Metric | Total | Implemented | Modified | Not Implemented | Unspecified | | |
| |--------|-------|-------------|----------|------------------|-------------| | |
| | Count | X | X | X | X | X | |
Copilot
AI
Feb 2, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Multiple tables in the report template are missing the required separator row between the header and content rows. According to Markdown table syntax, each table must have a separator row with dashes. The following tables are incomplete:
- Line 130: "Requirement Coverage Matrix" (missing separator like
|--------|-------------|--------|-------|) - Line 133: "Success Criteria Assessment" (missing separator)
- Line 136: "Architecture Drift" (missing separator)
- Line 150: "Innovations & Best Practices" (missing separator)
- Line 156: "Constitution Compliance" (missing separator)
- Line 160: "Analysis Effectiveness" (missing separator)
- Line 163: "Unspecified Implementations" (missing separator)
- Line 166: "Task Execution Analysis" (missing separator)
- Line 175: "Appendix: File Traceability" (missing separator)
Without these separator rows, the tables won't render correctly in most Markdown parsers.
Copilot
AI
Feb 2, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The commit message format uses a dash separator "Spec adherence: X% | Completion: X%" but most of the codebase and conventional commit messages would use a colon after "Add retrospective analysis". Consider using "Add retrospective analysis: Spec adherence X%, Completion X%" or following conventional commit format like "feat(retrospective): add analysis report (adherence X%, completion X%)" for better git log readability and consistency.
| 2. Commit: `Add retrospective analysis - Spec adherence: X% | Completion: X%` | |
| 2. Commit: `Add retrospective analysis: Spec adherence X%, Completion X%` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The new
/speckit.retrospectivecommand is not documented in README.md's "Available Slash Commands" section (around lines 247-270). Since this is a new command being added to the Spec-Driven Development workflow, it should be documented there. Based on its purpose (post-implementation analysis), it would fit best in the "Optional Commands" section alongside analyze and checklist, with a description like "Post-implementation retrospective analysis measuring spec drift and generating lessons learned".