fraim-framework 1.0.12 → 2.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (93) hide show
  1. package/.ai-agents/agent-guardrails.md +58 -0
  2. package/.ai-agents/mcp-template.jsonc +34 -0
  3. package/.ai-agents/rules/agent-testing-guidelines.md +545 -0
  4. package/.ai-agents/rules/architecture.md +52 -0
  5. package/.ai-agents/rules/communication.md +122 -0
  6. package/.ai-agents/rules/continuous-learning.md +55 -0
  7. package/.ai-agents/rules/git-safe-commands.md +34 -0
  8. package/.ai-agents/rules/integrity-and-test-ethics.md +223 -0
  9. package/.ai-agents/rules/local-development.md +252 -0
  10. package/.ai-agents/rules/merge-requirements.md +231 -0
  11. package/.ai-agents/rules/pr-workflow-completeness.md +191 -0
  12. package/.ai-agents/rules/simplicity.md +112 -0
  13. package/.ai-agents/rules/software-development-lifecycle.md +276 -0
  14. package/.ai-agents/rules/spike-first-development.md +199 -0
  15. package/.ai-agents/rules/successful-debugging-patterns.md +313 -0
  16. package/.ai-agents/scripts/cleanup-branch.ts +278 -0
  17. package/.ai-agents/scripts/exec-with-timeout.ts +122 -0
  18. package/.ai-agents/scripts/prep-issue.sh +162 -0
  19. package/.ai-agents/templates/evidence/Design-Evidence.md +30 -0
  20. package/.ai-agents/templates/evidence/Implementation-BugEvidence.md +48 -0
  21. package/.ai-agents/templates/evidence/Implementation-FeatureEvidence.md +54 -0
  22. package/.ai-agents/templates/evidence/Spec-Evidence.md +19 -0
  23. package/.ai-agents/templates/help/HelpNeeded.md +14 -0
  24. package/.ai-agents/templates/retrospective/RETROSPECTIVE-TEMPLATE.md +55 -0
  25. package/.ai-agents/templates/specs/BUGSPEC-TEMPLATE.md +37 -0
  26. package/.ai-agents/templates/specs/FEATURESPEC-TEMPLATE.md +29 -0
  27. package/.ai-agents/templates/specs/TECHSPEC-TEMPLATE.md +39 -0
  28. package/.ai-agents/workflows/design.md +121 -0
  29. package/.ai-agents/workflows/implement.md +170 -0
  30. package/.ai-agents/workflows/resolve.md +152 -0
  31. package/.ai-agents/workflows/retrospect.md +84 -0
  32. package/.ai-agents/workflows/spec.md +103 -0
  33. package/.ai-agents/workflows/test.md +90 -0
  34. package/.cursor/rules/cursor-rules.mdc +8 -0
  35. package/.cursor/rules/design.mdc +4 -0
  36. package/.cursor/rules/implement.mdc +6 -0
  37. package/.cursor/rules/resolve.mdc +5 -0
  38. package/.cursor/rules/retrospect.mdc +4 -0
  39. package/.cursor/rules/spec.mdc +4 -0
  40. package/.cursor/rules/test.mdc +5 -0
  41. package/.windsurf/rules/windsurf-rules.md +7 -0
  42. package/.windsurf/workflows/resolve-issue.md +6 -0
  43. package/.windsurf/workflows/retrospect.md +6 -0
  44. package/.windsurf/workflows/start-design.md +6 -0
  45. package/.windsurf/workflows/start-impl.md +6 -0
  46. package/.windsurf/workflows/start-spec.md +6 -0
  47. package/.windsurf/workflows/start-tests.md +6 -0
  48. package/CHANGELOG.md +66 -0
  49. package/CODEOWNERS +24 -0
  50. package/DISTRIBUTION.md +6 -6
  51. package/PUBLISH_INSTRUCTIONS.md +93 -0
  52. package/README.md +330 -104
  53. package/bin/fraim.js +49 -3
  54. package/index.js +30 -3
  55. package/install.sh +58 -58
  56. package/labels.json +52 -0
  57. package/linkedin-post.md +23 -0
  58. package/package.json +12 -7
  59. package/sample_package.json +18 -0
  60. package/setup.js +733 -384
  61. package/test-utils.ts +118 -0
  62. package/tsconfig.json +22 -0
  63. package/agents/claude/CLAUDE.md +0 -42
  64. package/agents/cursor/rules/architecture.mdc +0 -49
  65. package/agents/cursor/rules/continuous-learning.mdc +0 -48
  66. package/agents/cursor/rules/cursor-workflow.mdc +0 -29
  67. package/agents/cursor/rules/design.mdc +0 -25
  68. package/agents/cursor/rules/implement.mdc +0 -26
  69. package/agents/cursor/rules/local-development.mdc +0 -104
  70. package/agents/cursor/rules/prep.mdc +0 -15
  71. package/agents/cursor/rules/resolve.mdc +0 -46
  72. package/agents/cursor/rules/simplicity.mdc +0 -18
  73. package/agents/cursor/rules/software-development-lifecycle.mdc +0 -41
  74. package/agents/cursor/rules/test.mdc +0 -25
  75. package/agents/windsurf/rules/architecture.md +0 -49
  76. package/agents/windsurf/rules/continuous-learning.md +0 -47
  77. package/agents/windsurf/rules/local-development.md +0 -103
  78. package/agents/windsurf/rules/remote-development.md +0 -22
  79. package/agents/windsurf/rules/simplicity.md +0 -17
  80. package/agents/windsurf/rules/windsurf-workflow.md +0 -28
  81. package/agents/windsurf/workflows/prep.md +0 -20
  82. package/agents/windsurf/workflows/resolve-issue.md +0 -47
  83. package/agents/windsurf/workflows/start-design.md +0 -26
  84. package/agents/windsurf/workflows/start-impl.md +0 -27
  85. package/agents/windsurf/workflows/start-tests.md +0 -26
  86. package/github/phase-change.yml +0 -218
  87. package/github/status-change.yml +0 -68
  88. package/github/sync-on-pr-review.yml +0 -66
  89. package/scripts/__init__.py +0 -10
  90. package/scripts/cli.py +0 -141
  91. package/setup.py +0 -0
  92. package/test-config.json +0 -32
  93. package/workflows/setup-fraim.yml +0 -147
@@ -0,0 +1,162 @@
1
+ #!/bin/bash
2
+
3
+ # Project Issue Preparation Script
4
+ # This script automates the deterministic workflow from prep.md
5
+
6
+ set -e # Exit on any error
7
+
8
+ # Function to detect editor from issue labels
9
+ detect_editor_from_issue() {
10
+ local issue_num=$1
11
+
12
+ # Try GitHub CLI first
13
+ if command -v gh &> /dev/null; then
14
+ local labels=$(gh issue view $issue_num --json labels --jq '.labels[].name' 2>/dev/null | grep "^ai-agent:" | head -1)
15
+ if [ -n "$labels" ]; then
16
+ echo "$labels" | sed 's/ai-agent://'
17
+ return 0
18
+ fi
19
+ else
20
+ # Fallback to curl (requires GitHub token in GITHUB_TOKEN env var)
21
+ if [ -n "$GITHUB_TOKEN" ]; then
22
+ local labels=$(curl -s -H "Authorization: token $GITHUB_TOKEN" \
23
+ "https://api.github.com/repos/{OWNER}/{REPO}/issues/$issue_num" \
24
+ | grep -o '"name":"ai-agent:[^"]*"' | sed 's/"name":"ai-agent://' | sed 's/"//' 2>/dev/null)
25
+ else
26
+ echo "Warning: No GitHub CLI or GITHUB_TOKEN found. Cannot auto-detect editor from issue labels." >&2
27
+ fi
28
+ fi
29
+
30
+ return 1
31
+ }
32
+
33
+ # Function to open editor with project
34
+ open_editor() {
35
+ local editor=$1
36
+ local project_path=$2
37
+
38
+ case "$editor" in
39
+ "windsurf")
40
+ if command -v windsurf &> /dev/null; then
41
+ echo "Opening Windsurf..."
42
+ windsurf "$project_path" &
43
+ else
44
+ echo "Windsurf not found in PATH"
45
+ return 1
46
+ fi
47
+ ;;
48
+ "cursor")
49
+ if command -v cursor &> /dev/null; then
50
+ echo "Opening Cursor..."
51
+ cursor "$project_path" &
52
+ else
53
+ echo "Cursor not found in PATH"
54
+ return 1
55
+ fi
56
+ ;;
57
+ *)
58
+ echo "Unknown editor: $editor"
59
+ return 1
60
+ ;;
61
+ esac
62
+ }
63
+
64
+ # Check if issue number is provided
65
+ if [ $# -eq 0 ]; then
66
+ echo "Usage: $0 <issue_number> [editor]"
67
+ echo "Example: $0 123 windsurf"
68
+ exit 1
69
+ fi
70
+
71
+ ISSUE_NUMBER=$1
72
+ EDITOR=${2:-""} # Will be set later if not provided
73
+
74
+ echo "=== Project Issue Preparation ==="
75
+ echo "Preparing for Issue #$ISSUE_NUMBER"
76
+ echo
77
+
78
+ # Auto-detect editor from issue labels if not provided
79
+ if [ -z "$EDITOR" ]; then
80
+ echo "Auto-detecting editor from issue labels..."
81
+ DETECTED_EDITOR=$(detect_editor_from_issue $ISSUE_NUMBER)
82
+ if [ -n "$DETECTED_EDITOR" ]; then
83
+ EDITOR="$DETECTED_EDITOR"
84
+ echo "Detected editor: $EDITOR"
85
+ else
86
+ echo "Could not auto-detect editor. Defaulting to windsurf."
87
+ EDITOR="windsurf"
88
+ fi
89
+ else
90
+ echo "Using specified editor: $EDITOR"
91
+ fi
92
+
93
+ # Get current directory and parent
94
+ CURRENT_DIR=$(pwd)
95
+ PARENT_DIR=$(dirname "$CURRENT_DIR")
96
+
97
+ echo "Current directory: $CURRENT_DIR"
98
+ echo "Parent directory: $PARENT_DIR"
99
+
100
+ # Define clone directory name
101
+ CLONE_DIR="FRAIM - Issue $ISSUE_NUMBER"
102
+ CLONE_PATH="$PARENT_DIR/$CLONE_DIR"
103
+
104
+ # Check if directory already exists
105
+ if [ -d "$CLONE_PATH" ]; then
106
+ echo "Directory already exists: $CLONE_PATH"
107
+ echo "Entering existing directory..."
108
+ cd "$CLONE_PATH"
109
+ else
110
+ echo "Creating new clone directory..."
111
+
112
+ # Change to parent directory
113
+ cd "$PARENT_DIR"
114
+
115
+ # Clone the repository
116
+ echo "Cloning to: $CLONE_PATH"
117
+ git clone https://github.com/mathursrus/FRAIM.git "$CLONE_DIR"
118
+
119
+ # Change into the cloned repository
120
+ cd "$CLONE_DIR"
121
+ fi
122
+
123
+ # Create and checkout feature branch
124
+ BRANCH_NAME="feature/$ISSUE_NUMBER"
125
+ echo "Creating/checking out branch: $BRANCH_NAME"
126
+
127
+ if git show-ref --verify --quiet refs/heads/$BRANCH_NAME; then
128
+ echo "Branch exists locally, checking out..."
129
+ git checkout $BRANCH_NAME
130
+ elif git show-ref --verify --quiet refs/remotes/origin/$BRANCH_NAME; then
131
+ echo "Branch exists on remote, checking out..."
132
+ git checkout -b $BRANCH_NAME origin/$BRANCH_NAME
133
+ else
134
+ echo "Creating new branch..."
135
+ git checkout -b $BRANCH_NAME
136
+ fi
137
+
138
+ # Push branch to origin if it doesn't exist remotely
139
+ if ! git show-ref --verify --quiet refs/remotes/origin/$BRANCH_NAME; then
140
+ echo "Pushing new branch to origin..."
141
+ git push -u origin $BRANCH_NAME
142
+ fi
143
+
144
+ echo
145
+ echo "✅ Setup complete!"
146
+ echo "📁 Working directory: $CLONE_PATH"
147
+ echo "🌿 Branch: $BRANCH_NAME"
148
+ echo "🔧 Editor: $EDITOR"
149
+ echo
150
+
151
+ # Open the editor
152
+ echo "Opening $EDITOR..."
153
+ if open_editor "$EDITOR" "$CLONE_PATH"; then
154
+ echo "✅ $EDITOR opened successfully"
155
+ else
156
+ echo "❌ Failed to open $EDITOR"
157
+ echo "Please manually open your editor with: $CLONE_PATH"
158
+ fi
159
+
160
+ echo
161
+ echo "🚀 Ready to work on Issue #$ISSUE_NUMBER!"
162
+ echo "Remember to work only in this directory: $CLONE_PATH"
@@ -0,0 +1,30 @@
1
+ # Feature: <Title>
2
+ Issue: #<issue>
3
+ Feature Spec: <Link to Feature Spec, if any>
4
+ PR: <Link to PR>
5
+
6
+ ## Completeness Evidence
7
+ - Issue tagged with label `phase:design`: Yes/No
8
+ - Issue tagged with label `status:needs-review`: Yes/No
9
+ - All files committed/synced to branch: Yes/No
10
+ - Table with following columns
11
+ - PR Comment
12
+ - How Addressed
13
+
14
+
15
+ ## Due Diligence Evidence
16
+ - Reviewed feaure spec in detail (if feature spec present): Yes/No
17
+ - Reviwed code base in detail to understand and repro the issue: Yes/No
18
+ - Included detailed design, validation plan, test strategy in doc: Yes/No
19
+
20
+ ## Prototype & Validation Evidence
21
+ - [ ] Built simple proof-of-concept that works end-to-end
22
+ - [ ] Manually tested complete user flow (browser/curl)
23
+ - [ ] Verified solution actually works before designing architecture
24
+ - [ ] Identified minimal viable implementation
25
+ - [ ] Documented what works vs. what's overengineered
26
+
27
+ ## Continous Learning
28
+ - Table with following columns
29
+ - Learning
30
+ - Agent Rule Updates (what agent rule file was updated to ensure the learning is durable)
@@ -0,0 +1,48 @@
1
+ # Bug: <Title>
2
+ Issue: #<issue>
3
+ Bug Spec: <Link to Bug Spec>
4
+ PR: <Link to PR>
5
+
6
+ ## Completeness Evidence
7
+ - Issue tagged with label `phase:impl`: Yes/No
8
+ - Issue tagged with label `status:needs-review`: Yes/No
9
+ - All files committed/synced to branch: Yes/No
10
+ - Table with following columns
11
+ - PR Comment
12
+ - How Addressed
13
+
14
+ ## Implementation Quality Checkpoints
15
+ - [ ] Code complexity reviewed (no overengineering)
16
+ - [ ] No resource waste (excessive retries, delays, workarounds)
17
+ - [ ] Solution based on proven approach from design phase
18
+ - [ ] All new files/functions are actually used
19
+
20
+ ## Validation Evidence
21
+ - Complete valiation performed as suggested in bug spec: Yes/No
22
+ - Table with following columns
23
+ - Validation Step (manual vs automated)
24
+ - Validation Result (pass vs fail)
25
+ - Failure Analysis (if fail)
26
+
27
+ ## New Files/Functions Created
28
+ - Table with the following columns
29
+ - File/Function Name
30
+ - Purpose
31
+ - Who is using/importing/calling it
32
+ - Is it actually used? (Yes/No - if No, explain why it exists)
33
+
34
+ ## New Tests Added
35
+ - Required if existing test cases did not repro the bug, Optional if bug fix made previously failing test cases pass
36
+ - For each new test case added, did it pass/fail
37
+
38
+ ## Existing Test Suites Run
39
+ - Table with following columns
40
+ - Test Suite
41
+ - Was it Run (if not, why not - it's ok to not run a suite if there is no impact of your work to it as covered in agent-testing-guidelines.md)
42
+ - Failing Tests
43
+ - Failure Analysis (if any tests fail)
44
+
45
+ ## Continous Learning
46
+ - Table with following columns
47
+ - Learning
48
+ - Agent Rule Updates (what agent rule file was updated to ensure the learning is durable)
@@ -0,0 +1,54 @@
1
+ # Feature: <Title>
2
+ Issue: #<issue>
3
+ Tech Spec: <Link to tech spec>
4
+ PR: <Link to PR>
5
+
6
+ ## Completeness Evidence
7
+ - All phases of tech spec complete: Yes/No
8
+ - Issue tagged with label `phase:impl`: Yes/No
9
+ - Issue tagged with label `status:needs-review`: Yes/No
10
+ - All files committed/synced to branch: Yes/No
11
+ - Table with following columns
12
+ - PR Comment
13
+ - How Addressed
14
+
15
+ ## Implementation Quality Checkpoints
16
+ - [ ] Code complexity reviewed (no overengineering)
17
+ - [ ] No resource waste (excessive retries, delays, workarounds)
18
+ - [ ] Solution based on proven prototype from design phase
19
+ - [ ] All new files/functions are actually used
20
+
21
+ ## Validation Evidence
22
+ - Complete valiation performed as suggested in tech spec: Yes/No
23
+ - Table with following columns
24
+ - Validation Step (manual vs automated)
25
+ - Validation Result (pass vs fail)
26
+ - Failure Analysis (if fail)
27
+
28
+ ## New Files/Functions Created
29
+ - Table with the following columns
30
+ - File/Function Name
31
+ - Purpose
32
+ - Who is using/importing/calling it
33
+ - Is it actually used? (Yes/No - if No, explain why it exists)
34
+
35
+ ## New Tests Added
36
+ - Added all tests suggested in tech spec: Yes/No
37
+ - Table with the following columns
38
+ - Test Case Name
39
+ - What is test case validating
40
+ - Test Result (pass vs fail)
41
+ - Failure Analysis (if fail)
42
+
43
+ ## Existing Test Suites Run
44
+ - Table with following columns
45
+ - Test Suite
46
+ - Was it Run (if not, why not - it's ok to not run a suite if there is no impact of your work to it as covered in agent-testing-guidelines.md)
47
+ - Failing Tests
48
+ - Failure Analysis (if any tests fail)
49
+
50
+
51
+ ## Continous Learning
52
+ - Table with following columns
53
+ - Learning
54
+ - Agent Rule Updates (what agent rule file was updated to ensure the learning is durable)
@@ -0,0 +1,19 @@
1
+ # Feature Specification: <Title>
2
+ Issue: #<issue>
3
+ PR: <Link to PR>
4
+
5
+ ## Completeness Evidence
6
+ - Issue tagged with label `phase:spec`: Yes/No
7
+ - Issue tagged with label `status:needs-review`: Yes/No
8
+ - All specification documents committed/synced to branch: Yes/No
9
+ - Table with following columns
10
+ - Customer Research Area
11
+ - Sources of Information
12
+ - Table with following columns
13
+ - PR Comment
14
+ - How Addressed
15
+
16
+ ## Continuous Learning
17
+ - Table with following columns
18
+ - Learning
19
+ - Agent Rule Updates (what agent rule file was updated to ensure the learning is durable)
@@ -0,0 +1,14 @@
1
+ # Feature: <Title>
2
+ Issue: #<issue>
3
+ PR: <Link to PR>
4
+
5
+ ## Help Needed
6
+ - What help is needed? Be as specific as possible
7
+ - What is it blocking?
8
+ - What is the impact?
9
+
10
+ ## What has been tried
11
+ - What solutions have been tried to unblock? What was the result?
12
+
13
+ ## What Options exist
14
+ - Do you have options in mind? If so, what are the Pros/Cons and what is your suggestion?
@@ -0,0 +1,55 @@
1
+ # Postmortem: {Issue Title} - Issue #{issue-number}
2
+
3
+ **Date**: {current_date}
4
+ **Duration**: {time_spent}
5
+ **Objective**: {issue_description}
6
+ **Outcome**: {success/failure/partial}
7
+
8
+ ## Executive Summary
9
+
10
+ {2-3 sentence summary of what happened and the outcome}
11
+
12
+ ## Timeline of Events
13
+
14
+ ### Phase 1: {Phase Name}
15
+ - ✅/❌ **Action**: Description
16
+ - ✅/❌ **Action**: Description
17
+
18
+ ### Phase 2: {Phase Name}
19
+ - ✅/❌ **Action**: Description
20
+ - ✅/❌ **Action**: Description
21
+
22
+ ## Root Cause Analysis
23
+
24
+ ### 1. **Primary Cause**
25
+ **Problem**: {main issue}
26
+ **Impact**: {what this caused}
27
+
28
+ ### 2. **Contributing Factors**
29
+ **Problem**: {secondary issues}
30
+ **Impact**: {what these caused}
31
+
32
+ ## What Went Wrong
33
+
34
+ 1. **Issue 1**: Description
35
+ 2. **Issue 2**: Description
36
+
37
+ ## What Went Right
38
+
39
+ 1. **Success 1**: Description
40
+ 2. **Success 2**: Description
41
+
42
+ ## Lessons Learned
43
+
44
+ 1. **Learning 1**: Description
45
+ 2. **Learning 2**: Description
46
+
47
+ ## Agent Rule Updates Made to avoid recurrence
48
+
49
+ 1. **Rule 1**: Description
50
+ 2. **Rule 2**: Description
51
+
52
+ ## Enforcement Updates Made to avoid recurrence
53
+
54
+ 1. **Improvement 1**: Description
55
+ 2. **Improvement 2**: Description
@@ -0,0 +1,37 @@
1
+ # Bug: <Title>
2
+
3
+ Issue: #<issue>
4
+ Owner: <agent>
5
+
6
+ ## Customer
7
+
8
+ ## Customer Problem being solved
9
+
10
+ ## Repro Steps
11
+ - Specific steps in the user workflow that reproduce the bug (eg start in dashboard, click on tab x, see list y, approve item z ....)
12
+ - Confirm that you have reproduced the bug
13
+
14
+ ## Root Cause
15
+ - What root cause was identified after repro and code analysis
16
+
17
+ ## Fix Details
18
+ - UI, API, Service, DB changes: Which files will be modified and for what?
19
+
20
+ ## Validation Plan
21
+ - Table with following columns
22
+ - User Scenario
23
+ - Expected outcome
24
+ - Validation method (UI validation, API validation, Database validation ...)
25
+
26
+ ## Confidence Level
27
+ - On a scale of 0 to 100, how confident are you that your fix will work?
28
+
29
+ ## Test Matrix
30
+ - Unit(as many as needed, mocking ok): what core functionality will be tested. What test suite will be added? Which existing test suites will be modified?
31
+ - Integration(only mock external services): what tests will ensure the full stack integration does not regress. What test suite will be added? Which existing test suites will be modified?
32
+ - E2E(1 at most, no mocking): If any changes are made to external integrations, what end to end tests will ensure external integrations work as expected.
33
+
34
+ ## Future Prevention
35
+ - What will prevent future introduction of similar bugs
36
+ - What agent rules will you update to ensure similar bugs do not recur
37
+ - What enforcement will you create to ensure similar bugs are caught before they are checked in
@@ -0,0 +1,29 @@
1
+ # Feature: <Title>
2
+
3
+ Issue: #<issue>
4
+ Owner: <agent>
5
+
6
+ ## Customer
7
+
8
+ ## Customer's Desired Outcome
9
+
10
+ ## Customer Problem being solved
11
+
12
+ ## User Experience that will solve the problem
13
+ - Specific steps in the user workflow (eg start in dashboard, click on tab x, see list y, approve item z ....)
14
+ - UI mocks showing the desired experience. Put these in the `docs/feature specs/mocks` folder and link to them here.
15
+
16
+ ## Validation Plan
17
+ - How will you know the feature is working as intended (validate via browser, api, ...)
18
+ - What steps will you follow to ensure the feature works
19
+
20
+ ## Alternatives
21
+ - Table with following columns
22
+ - Alternative: What other way could the customer solve their problem?
23
+ - Why discard?: Why is this alternative not chosen?
24
+
25
+ ## Competitive Landscape
26
+ - Table with the following
27
+ - Competitor
28
+ - How they are solving the same problem
29
+ - What do customers say about this solution
@@ -0,0 +1,39 @@
1
+ # Feature: <Title>
2
+
3
+ Issue: #<issue>
4
+ Owner: <agent>
5
+
6
+ ## Customer
7
+
8
+ ## Customer Problem being solved
9
+
10
+ ## User Experience that will solve the problem
11
+ - Specific steps in the user workflow
12
+ - If UI feature: start on UI page a, click on tab x, see list y, approve item z, achieve outcome ....
13
+ - If API feature: call API a with params x, y, z, receive result
14
+ - If refactoring/rearchitecture: what is the simpler developer workflow
15
+
16
+ ## Technical Details
17
+ - UI changes: Which files will be modified and for what?
18
+ - API surface (OpenAPI) changes
19
+ - Data model / schema changes
20
+ - Failure modes & timeouts
21
+ - Telemetry & analytics
22
+
23
+ ## Confidence Level
24
+ - On a scale of 0 to 100, how confident are you that your solution will work?
25
+
26
+ ## Validation Plan
27
+ - Table with following columns
28
+ - User Scenario
29
+ - Expected outcome
30
+ - Validation method (UI validation, API validation, Database validation ...)
31
+
32
+ ## Test Matrix
33
+ - Unit(as many as needed, mocking ok): what core functionality will be tested. What test suite will be added? Which existing test suites will be modified?
34
+ - Integration(only mock external services): what tests will ensure the full stack integration does not regress. What test suite will be added? Which existing test suites will be modified?
35
+ - E2E(1 at most, no mocking): If any changes are made to external integrations, what end to end tests will ensure external integrations work as expected.
36
+
37
+ ## Risks & Mitigations
38
+
39
+ ## Observability (logs, metrics, alerts)
@@ -0,0 +1,121 @@
1
+ # Design Phase
2
+
3
+ ## INTENT
4
+ To create comprehensive, detailed technical design documents that plan solutions before implementation, ensuring proper architecture, clear requirements, and stakeholder alignment through structured RFCs and bug fix templates.
5
+
6
+ ## PRINCIPLES
7
+ - **Design First**: Plan before implementing to avoid rework
8
+ - **Template Consistency**: Use established templates for different types of changes
9
+ - **Stakeholder Alignment**: Get review and approval before implementation
10
+ - **Clear Documentation**: Create detailed, actionable design documents
11
+ - **Iterative Refinement**: Incorporate feedback and iterate on designs
12
+ - **Spike-First Development**: Follow `.ai-agents/rules/spike-first-development.md` to validate technology compatibility before building complex solutions
13
+
14
+ ## DESIGN WORKFLOW
15
+
16
+ ### Step 1: Issue Identification
17
+ Ask for {issue_number} (and optional {slug})
18
+ ### Step 2: Phase Initiation
19
+ Label the issue 'phase:design' (GitHub Action will automatically label the issue `status:wip` and update the existing draft PR)
20
+
21
+ ### Step 3: Environment Setup
22
+ **IMPORTANT**: The user has already run `prep-issue.sh` which has:
23
+ - ✅ Created the feature branch
24
+ - ✅ Checked out the branch
25
+ - ✅ Created draft PR
26
+ - ✅ Indexed the codebase with Serena
27
+ - ✅ Opened the editor in the prepared workspace
28
+
29
+ You can start working immediately in the prepared environment. No need to create branches or wait for GitHub Actions.
30
+
31
+ ### Step 4: Work Location
32
+ You are already in the correct workspace prepared by the user. Confirm you're on the right branch and start working.
33
+
34
+ ### Step 5: Pre-Creation Validation
35
+ Before creating any design document, agents MUST:
36
+
37
+ 1. **Spike-First Development Check**:
38
+ - Read and follow `.ai-agents/rules/spike-first-development.md`
39
+ - If design involves unfamiliar technology, plan spike/proof-of-concept first
40
+ - Validate technology compatibility before designing complex solutions
41
+ - Avoid "Build First, Integrate Later" anti-pattern
42
+
43
+ 2. **Verify Template Selection**:
44
+ - For bug fixes: Use `.ai-agents/templates/specs/BUGSPEC-TEMPLATE.md`
45
+ - For new features: Use `.ai-agents/templates/specs/TECHSPEC-TEMPLATE.md`
46
+ - Confirm template exists before proceeding
47
+ - If you cannot find the template, stop and ask for help as per `.ai-agents/rules/communication.md`
48
+
49
+ 3. **Validate Naming Convention**:
50
+ - Format: `docs/rfcs/{issue_number}-{kebab-title}.md`
51
+ - Example: `docs/rfcs/228-improve-token-refresh.md`
52
+ - NO other naming patterns allowed
53
+
54
+ 4. **Template Compliance Check**:
55
+ - Read the selected template first
56
+ - Ensure all required sections are included
57
+ - Verify placeholder format matches template
58
+
59
+ 5. **Workflow Rule Verification**:
60
+ - Confirm issue is labeled `phase:design`
61
+ - Verify branch exists before starting work
62
+ - Check working directory is correct
63
+
64
+ ### Step 6: Design Document Creation
65
+ Your work entails the following:
66
+ - Create docs/rfcs/{issue_number}-{slug}.md.
67
+ - Use the correct template as per #1
68
+ - Check if there is an existing spec for this issue. Specs are stored in `docs/feature specs/` and share the same naming convention as the RFCs. If there is an existing spec, read through it and understand if fully.
69
+ - Understand the issue, the existing codebase, and be detailed in your technical design. The better your initial design, manual valiation, testing plan, the smoother the implementation will go.
70
+
71
+
72
+ ### Step 7: Design Creation Checklist
73
+ Before commiting your work, verify:
74
+ - [ ] Correct template used (BUGFIX-TEMPLATE.md or RFC-TEMPLATE.md)
75
+ - [ ] Proper file naming: `{issue_number}-{kebab-title}.md`
76
+ - [ ] All template sections completed
77
+ - [ ] No placeholder text remaining
78
+ - [ ] Issue labeled `phase:design`
79
+ - [ ] Working in correct branch
80
+ - [ ] File saved in `docs/rfcs/` directory
81
+ - [ ] If issue is a bug, you have reproduced it
82
+ - [ ] You understand the codebase and have high confidence in your design
83
+
84
+ ### Step 8: Submit for Review
85
+ - Commit and sync your work
86
+ - Label the issue 'status:needs-review' and remove 'status:wip'
87
+ - Update the PR with a comment to include evidence - Use template `.ai-agents/templates/evidence/Design-Evidence.md`
88
+ - Follow `.ai-agents/rules/pr-workflow-completeness.md`
89
+
90
+ ### Step 9: Iteration
91
+ If workflow actions or reviewer feedback indicates more work is needed:
92
+ - Label the issue 'status:wip' and remove 'status:needs-review'
93
+ - Go back to Step 6 and iterate until PR is approved
94
+
95
+ ## EXAMPLES
96
+
97
+ ### Good: Comprehensive Design Process
98
+ ```
99
+ Issue #84: "Fix API integration timeout"
100
+ 1. ✅ Identified: Issue #84, slug: "fix-sync-timeout"
101
+ 2. ✅ Phase: Set phase:design, PR created
102
+ 3. ✅ Environment: User ran prep-issue.sh, ready to work
103
+ 4. ✅ Location: Working in prepared workspace with Serena indexing
104
+ 5. ✅ Design: Created docs/rfcs/84-fix-sync-timeout.md
105
+ 6. ✅ Template: Used BUG-TEMPLATE.md for bug fix
106
+ 7. ✅ Review: Set status:needs-review
107
+ 8. ✅ Iteration: Incorporated feedback, updated design
108
+ Result: Clear, actionable design document
109
+ ```
110
+
111
+ ### Bad: Incomplete Design Process
112
+ ```
113
+ Issue #84: "Fix API integration timeout"
114
+ 1. ✅ Identified: Issue #84
115
+ 2. ❌ Skip: Didn't set phase:design
116
+ 3. ❌ Skip: Didn't create branch
117
+ 4. ❌ Skip: Started coding without design
118
+ 5. ❌ Skip: No RFC document created
119
+ 6. ❌ Skip: No stakeholder review
120
+ Result: Unclear requirements, potential rework
121
+ ```