openalex-mcp-server 1.0.1

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.
@@ -0,0 +1,17 @@
1
+ {
2
+ "$schema": "./schemas/ralph-config.schema.json",
3
+ "prd": {
4
+ "outputDir": "tasks",
5
+ "filenamePattern": "prd-{slug}.md"
6
+ },
7
+ "ralph": {
8
+ "maxIterations": 10,
9
+ "branchPrefix": "ralph/",
10
+ "archiveDir": ".claude/archive",
11
+ "progressFile": "prd-progress.txt",
12
+ "prdFile": "prd.json"
13
+ },
14
+ "amp": {
15
+ "autoHandoffContext": 90
16
+ }
17
+ }
@@ -0,0 +1,108 @@
1
+ # Ralph Agent Instructions
2
+
3
+ You are an autonomous coding agent working on a software project.
4
+
5
+ ## Your Task
6
+
7
+ 1. Read the PRD at `prd.json` (in the same directory as this file)
8
+ 2. Read the progress log at `progress.txt` (check Codebase Patterns section first)
9
+ 3. Check you're on the correct branch from PRD `branchName`. If not, check it out or create from main.
10
+ 4. Pick the **highest priority** user story where `passes: false`
11
+ 5. Implement that single user story
12
+ 6. Run quality checks (e.g., typecheck, lint, test - use whatever your project requires)
13
+ 7. Update AGENTS.md files if you discover reusable patterns (see below)
14
+ 8. If checks pass, commit ALL changes with message: `feat: [Story ID] - [Story Title]`
15
+ 9. Update the PRD to set `passes: true` for the completed story
16
+ 10. Append your progress to `progress.txt`
17
+
18
+ ## Progress Report Format
19
+
20
+ APPEND to progress.txt (never replace, always append):
21
+ ```
22
+ ## [Date/Time] - [Story ID]
23
+ Thread: https://ampcode.com/threads/$AMP_CURRENT_THREAD_ID
24
+ - What was implemented
25
+ - Files changed
26
+ - **Learnings for future iterations:**
27
+ - Patterns discovered (e.g., "this codebase uses X for Y")
28
+ - Gotchas encountered (e.g., "don't forget to update Z when changing W")
29
+ - Useful context (e.g., "the evaluation panel is in component X")
30
+ ---
31
+ ```
32
+
33
+ Include the thread URL so future iterations can use the `read_thread` tool to reference previous work if needed.
34
+
35
+ The learnings section is critical - it helps future iterations avoid repeating mistakes and understand the codebase better.
36
+
37
+ ## Consolidate Patterns
38
+
39
+ If you discover a **reusable pattern** that future iterations should know, add it to the `## Codebase Patterns` section at the TOP of progress.txt (create it if it doesn't exist). This section should consolidate the most important learnings:
40
+
41
+ ```
42
+ ## Codebase Patterns
43
+ - Example: Use `sql<number>` template for aggregations
44
+ - Example: Always use `IF NOT EXISTS` for migrations
45
+ - Example: Export types from actions.ts for UI components
46
+ ```
47
+
48
+ Only add patterns that are **general and reusable**, not story-specific details.
49
+
50
+ ## Update AGENTS.md Files
51
+
52
+ Before committing, check if any edited files have learnings worth preserving in nearby AGENTS.md files:
53
+
54
+ 1. **Identify directories with edited files** - Look at which directories you modified
55
+ 2. **Check for existing AGENTS.md** - Look for AGENTS.md in those directories or parent directories
56
+ 3. **Add valuable learnings** - If you discovered something future developers/agents should know:
57
+ - API patterns or conventions specific to that module
58
+ - Gotchas or non-obvious requirements
59
+ - Dependencies between files
60
+ - Testing approaches for that area
61
+ - Configuration or environment requirements
62
+
63
+ **Examples of good AGENTS.md additions:**
64
+ - "When modifying X, also update Y to keep them in sync"
65
+ - "This module uses pattern Z for all API calls"
66
+ - "Tests require the dev server running on PORT 3000"
67
+ - "Field names must match the template exactly"
68
+
69
+ **Do NOT add:**
70
+ - Story-specific implementation details
71
+ - Temporary debugging notes
72
+ - Information already in progress.txt
73
+
74
+ Only update AGENTS.md if you have **genuinely reusable knowledge** that would help future work in that directory.
75
+
76
+ ## Quality Requirements
77
+
78
+ - ALL commits must pass your project's quality checks (typecheck, lint, test)
79
+ - Do NOT commit broken code
80
+ - Keep changes focused and minimal
81
+ - Follow existing code patterns
82
+
83
+ ## Browser Testing (Required for Frontend Stories)
84
+
85
+ For any story that changes UI, you MUST verify it works in the browser:
86
+
87
+ 1. Load the `dev-browser` skill
88
+ 2. Navigate to the relevant page
89
+ 3. Verify the UI changes work as expected
90
+ 4. Take a screenshot if helpful for the progress log
91
+
92
+ A frontend story is NOT complete until browser verification passes.
93
+
94
+ ## Stop Condition
95
+
96
+ After completing a user story, check if ALL stories have `passes: true`.
97
+
98
+ If ALL stories are complete and passing, reply with:
99
+ <promise>COMPLETE</promise>
100
+
101
+ If there are still stories with `passes: false`, end your response normally (another iteration will pick up the next story).
102
+
103
+ ## Important
104
+
105
+ - Work on ONE story per iteration
106
+ - Commit frequently
107
+ - Keep CI green
108
+ - Read the Codebase Patterns section in progress.txt before starting
@@ -0,0 +1,127 @@
1
+ #!/bin/bash
2
+ # Ralph Wiggum - Long-running AI agent loop
3
+ # This script is designed to be called from .claude/scripts/ in any project
4
+ # Usage: bash .claude/scripts/ralph.sh [max_iterations]
5
+
6
+ set -e
7
+
8
+ MAX_ITERATIONS=${1:-10}
9
+ SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
10
+
11
+ # Get project root (parent of .claude directory)
12
+ PROJECT_ROOT="$(dirname "$SCRIPT_DIR")/.."
13
+
14
+ # Files in project root
15
+ PRD_FILE="$PROJECT_ROOT/prd.json"
16
+ PROGRESS_FILE="$PROJECT_ROOT/prd-progress.txt"
17
+ ARCHIVE_DIR="$SCRIPT_DIR/../archive"
18
+ LAST_BRANCH_FILE="$SCRIPT_DIR/.last-branch"
19
+
20
+ # Prompt file in .claude/scripts/
21
+ PROMPT_FILE="$SCRIPT_DIR/prompt.md"
22
+
23
+ echo "Project root: $PROJECT_ROOT"
24
+ echo "Script dir: $SCRIPT_DIR"
25
+
26
+ # Check if prd.json exists
27
+ if [ ! -f "$PRD_FILE" ]; then
28
+ echo "Error: prd.json not found at $PRD_FILE"
29
+ echo "Please use /ralph skill to create prd.json first"
30
+ exit 1
31
+ fi
32
+
33
+ # Check if prompt.md exists
34
+ if [ ! -f "$PROMPT_FILE" ]; then
35
+ echo "Error: prompt.md not found at $PROMPT_FILE"
36
+ exit 1
37
+ fi
38
+
39
+ # Archive previous run if branch changed
40
+ if [ -f "$PRD_FILE" ] && [ -f "$LAST_BRANCH_FILE" ]; then
41
+ CURRENT_BRANCH=$(jq -r '.branchName // empty' "$PRD_FILE" 2>/dev/null || echo "")
42
+ LAST_BRANCH=$(cat "$LAST_BRANCH_FILE" 2>/dev/null || echo "")
43
+
44
+ if [ -n "$CURRENT_BRANCH" ] && [ -n "$LAST_BRANCH" ] && [ "$CURRENT_BRANCH" != "$LAST_BRANCH" ]; then
45
+ # Archive the previous run
46
+ DATE=$(date +%Y-%m-%d)
47
+ # Strip "ralph/" prefix from branch name for folder
48
+ FOLDER_NAME=$(echo "$LAST_BRANCH" | sed 's|^ralph/||')
49
+ ARCHIVE_FOLDER="$ARCHIVE_DIR/$DATE-$FOLDER_NAME"
50
+
51
+ echo "Archiving previous run: $LAST_BRANCH"
52
+ mkdir -p "$ARCHIVE_FOLDER"
53
+ [ -f "$PRD_FILE" ] && cp "$PRD_FILE" "$ARCHIVE_FOLDER/"
54
+ [ -f "$PROGRESS_FILE" ] && cp "$PROGRESS_FILE" "$ARCHIVE_FOLDER/"
55
+ echo " Archived to: $ARCHIVE_FOLDER"
56
+
57
+ # Reset progress file for new run
58
+ echo "# Ralph Progress Log" > "$PROGRESS_FILE"
59
+ echo "Started: $(date)" >> "$PROGRESS_FILE"
60
+ echo "---" >> "$PROGRESS_FILE"
61
+ fi
62
+ fi
63
+
64
+ # Track current branch
65
+ if [ -f "$PRD_FILE" ]; then
66
+ CURRENT_BRANCH=$(jq -r '.branchName // empty' "$PRD_FILE" 2>/dev/null || echo "")
67
+ if [ -n "$CURRENT_BRANCH" ]; then
68
+ echo "$CURRENT_BRANCH" > "$LAST_BRANCH_FILE"
69
+ fi
70
+ fi
71
+
72
+ # Initialize progress file if it doesn't exist
73
+ if [ ! -f "$PROGRESS_FILE" ]; then
74
+ echo "# Ralph Progress Log" > "$PROGRESS_FILE"
75
+ echo "Started: $(date)" >> "$PROGRESS_FILE"
76
+ echo "---" >> "$PROGRESS_FILE"
77
+ fi
78
+
79
+ echo ""
80
+ echo "═══════════════════════════════════════════════════════"
81
+ echo " Ralph - Autonomous Agent Loop"
82
+ echo "═══════════════════════════════════════════════════════"
83
+ echo "Max iterations: $MAX_ITERATIONS"
84
+ echo "PRD file: $PRD_FILE"
85
+ echo "Progress file: $PROGRESS_FILE"
86
+ echo "═══════════════════════════════════════════════════════"
87
+ echo ""
88
+
89
+ # Change to project root for Amp execution
90
+ cd "$PROJECT_ROOT"
91
+
92
+ for i in $(seq 1 $MAX_ITERATIONS); do
93
+ echo ""
94
+ echo "═══════════════════════════════════════════════════════"
95
+ echo " Ralph Iteration $i of $MAX_ITERATIONS"
96
+ echo "═══════════════════════════════════════════════════════"
97
+
98
+ # Run amp with the ralph prompt
99
+ OUTPUT=$(cat "$PROMPT_FILE" | amp --dangerously-allow-all 2>&1 | tee /dev/stderr) || true
100
+
101
+ # Check for completion signal
102
+ if echo "$OUTPUT" | grep -q "<promise>COMPLETE</promise>"; then
103
+ echo ""
104
+ echo "═══════════════════════════════════════════════════════"
105
+ echo " Ralph completed all tasks!"
106
+ echo "═══════════════════════════════════════════════════════"
107
+ echo "Completed at iteration $i of $MAX_ITERATIONS"
108
+ echo ""
109
+ echo "Check progress: cat $PROGRESS_FILE"
110
+ echo "Check git log: git log --oneline -10"
111
+ exit 0
112
+ fi
113
+
114
+ echo "Iteration $i complete. Continuing..."
115
+ sleep 2
116
+ done
117
+
118
+ echo ""
119
+ echo "═══════════════════════════════════════════════════════"
120
+ echo " Ralph reached max iterations"
121
+ echo "═══════════════════════════════════════════════════════"
122
+ echo "Max iterations ($MAX_ITERATIONS) reached without completing all tasks."
123
+ echo ""
124
+ echo "Check status:"
125
+ echo " cat $PROGRESS_FILE"
126
+ echo " cat $PRD_FILE | jq '.userStories[] | {id, title, passes}'"
127
+ exit 1
@@ -0,0 +1,270 @@
1
+ ---
2
+ name: prd
3
+ description: "Generate a Product Requirements Document (PRD) for a new feature. Use when planning a feature, starting a new project, or when asked to create a PRD."
4
+ ---
5
+
6
+ # PRD Generator
7
+
8
+ Create detailed Product Requirements Documents that are clear, actionable, and suitable for implementation with the Ralph autonomous agent system.
9
+
10
+ ---
11
+
12
+ ## The Job
13
+
14
+ 1. Receive a feature description from the user
15
+ 2. Ask 3-5 essential clarifying questions (with lettered options)
16
+ 3. Generate a structured PRD based on answers
17
+ 4. Save to `tasks/prd-[feature-name].md`
18
+
19
+ **Important:** Do NOT start implementing. Just create the PRD.
20
+
21
+ ---
22
+
23
+ ## Step 1: Clarifying Questions
24
+
25
+ Ask only critical questions where the initial prompt is ambiguous. Focus on:
26
+
27
+ - **Problem/Goal:** What problem does this solve?
28
+ - **Core Functionality:** What are the key actions?
29
+ - **Scope/Boundaries:** What should it NOT do?
30
+ - **Success Criteria:** How do we know it's done?
31
+
32
+ ### Format Questions Like This:
33
+
34
+ ```
35
+ 1. What is the primary goal of this feature?
36
+ A. Improve user onboarding experience
37
+ B. Increase user retention
38
+ C. Reduce support burden
39
+ D. Other: [please specify]
40
+
41
+ 2. Who is the target user?
42
+ A. New users only
43
+ B. Existing users only
44
+ C. All users
45
+ D. Admin users only
46
+
47
+ 3. What is the scope?
48
+ A. Minimal viable version
49
+ B. Full-featured implementation
50
+ C. Just the backend/API
51
+ D. Just the UI
52
+ ```
53
+
54
+ This lets users respond with "1A, 2C, 3B" for quick iteration.
55
+
56
+ ---
57
+
58
+ ## Step 2: PRD Structure
59
+
60
+ Generate the PRD with these sections:
61
+
62
+ ### 1. Introduction/Overview
63
+ Brief description of the feature and the problem it solves.
64
+
65
+ ### 2. Goals
66
+ Specific, measurable objectives (bullet list).
67
+
68
+ ### 3. User Stories
69
+
70
+ Each story needs:
71
+ - **Title:** Short descriptive name
72
+ - **Description:** "As a [user], I want [feature] so that [benefit]"
73
+ - **Acceptance Criteria:** Verifiable checklist of what "done" means
74
+
75
+ **Each story should be small enough to implement in one focused session.**
76
+
77
+ This is CRITICAL for Ralph to work properly. If stories are too big, the AI will run out of context before finishing.
78
+
79
+ **Format:**
80
+ ```markdown
81
+ ### US-001: [Title]
82
+ **Description:** As a [user], I want [feature] so that [benefit].
83
+
84
+ **Acceptance Criteria:**
85
+ - [ ] Specific verifiable criterion
86
+ - [ ] Another criterion
87
+ - [ ] Typecheck/lint passes
88
+ - [ ] **[UI stories only]** Verify in browser using dev-browser skill
89
+ ```
90
+
91
+ **Right-sized stories:**
92
+ - Add a database column and migration
93
+ - Add a UI component to an existing page
94
+ - Update a server action with new logic
95
+ - Add a filter dropdown to a list
96
+
97
+ **Too big (split these):**
98
+ - "Build the entire dashboard"
99
+ - "Add authentication"
100
+ - "Refactor the API"
101
+
102
+ ### 4. Functional Requirements
103
+ Numbered list of specific functionalities:
104
+ - "FR-1: The system must allow users to..."
105
+ - "FR-2: When a user clicks X, the system must..."
106
+
107
+ Be explicit and unambiguous.
108
+
109
+ ### 5. Non-Goals (Out of Scope)
110
+ What this feature will NOT include. Critical for managing scope.
111
+
112
+ ### 6. Design Considerations (Optional)
113
+ - UI/UX requirements
114
+ - Link to mockups if available
115
+ - Relevant existing components to reuse
116
+
117
+ ### 7. Technical Considerations (Optional)
118
+ - Known constraints or dependencies
119
+ - Integration points with existing systems
120
+ - Performance requirements
121
+
122
+ ### 8. Success Metrics
123
+ How will success be measured?
124
+ - "Reduce time to complete X by 50%"
125
+ - "Increase conversion rate by 10%"
126
+
127
+ ### 9. Open Questions
128
+ Remaining questions or areas needing clarification.
129
+
130
+ ---
131
+
132
+ ## Writing for AI Agents
133
+
134
+ The PRD will be read by Claude Code (Ralph). Therefore:
135
+
136
+ - Be explicit and unambiguous
137
+ - Avoid jargon or explain it
138
+ - Provide enough detail to understand purpose and core logic
139
+ - Number requirements for easy reference
140
+ - Use concrete examples where helpful
141
+
142
+ ---
143
+
144
+ ## Story Ordering: Dependencies First
145
+
146
+ Stories execute in priority order. Earlier stories must NOT depend on later ones.
147
+
148
+ **Correct order:**
149
+ 1. Schema/database changes (migrations)
150
+ 2. Server actions / backend logic
151
+ 3. UI components that use the backend
152
+ 4. Dashboard/summary views that aggregate data
153
+
154
+ **Wrong order:**
155
+ 1. UI component (depends on schema that does not exist yet)
156
+ 2. Schema change
157
+
158
+ ---
159
+
160
+ ## Output
161
+
162
+ - **Format:** Markdown (`.md`)
163
+ - **Location:** `tasks/`
164
+ - **Filename:** `prd-[feature-name].md` (kebab-case)
165
+
166
+ Ensure the `tasks/` directory exists before saving.
167
+
168
+ ---
169
+
170
+ ## Example PRD
171
+
172
+ ```markdown
173
+ # PRD: Task Priority System
174
+
175
+ ## Introduction
176
+
177
+ Add priority levels to tasks so users can focus on what matters most. Tasks can be marked as high, medium, or low priority, with visual indicators and filtering to help users manage their workload effectively.
178
+
179
+ ## Goals
180
+
181
+ - Allow assigning priority (high/medium/low) to any task
182
+ - Provide clear visual differentiation between priority levels
183
+ - Enable filtering and sorting by priority
184
+ - Default new tasks to medium priority
185
+
186
+ ## User Stories
187
+
188
+ ### US-001: Add priority field to database
189
+ **Description:** As a developer, I need to store task priority so it persists across sessions.
190
+
191
+ **Acceptance Criteria:**
192
+ - [ ] Add priority column to tasks table: 'high' | 'medium' | 'low' (default 'medium')
193
+ - [ ] Generate and run migration successfully
194
+ - [ ] Typecheck passes
195
+
196
+ ### US-002: Display priority indicator on task cards
197
+ **Description:** As a user, I want to see task priority at a glance so I know what needs attention first.
198
+
199
+ **Acceptance Criteria:**
200
+ - [ ] Each task card shows colored priority badge (red=high, yellow=medium, gray=low)
201
+ - [ ] Priority visible without hovering or clicking
202
+ - [ ] Typecheck passes
203
+ - [ ] Verify in browser using dev-browser skill
204
+
205
+ ### US-003: Add priority selector to task edit
206
+ **Description:** As a user, I want to change a task's priority when editing it.
207
+
208
+ **Acceptance Criteria:**
209
+ - [ ] Priority dropdown in task edit modal
210
+ - [ ] Shows current priority as selected
211
+ - [ ] Saves immediately on selection change
212
+ - [ ] Typecheck passes
213
+ - [ ] Verify in browser using dev-browser skill
214
+
215
+ ### US-004: Filter tasks by priority
216
+ **Description:** As a user, I want to filter the task list to see only high-priority items when I'm focused.
217
+
218
+ **Acceptance Criteria:**
219
+ - [ ] Filter dropdown with options: All | High | Medium | Low
220
+ - [ ] Filter persists in URL params
221
+ - [ ] Empty state message when no tasks match filter
222
+ - [ ] Typecheck passes
223
+ - [ ] Verify in browser using dev-browser skill
224
+
225
+ ## Functional Requirements
226
+
227
+ - FR-1: Add `priority` field to tasks table ('high' | 'medium' | 'low', default 'medium')
228
+ - FR-2: Display colored priority badge on each task card
229
+ - FR-3: Include priority selector in task edit modal
230
+ - FR-4: Add priority filter dropdown to task list header
231
+ - FR-5: Sort by priority within each status column (high to medium to low)
232
+
233
+ ## Non-Goals
234
+
235
+ - No priority-based notifications or reminders
236
+ - No automatic priority assignment based on due date
237
+ - No priority inheritance for subtasks
238
+
239
+ ## Technical Considerations
240
+
241
+ - Reuse existing badge component with color variants
242
+ - Filter state managed via URL search params
243
+ - Priority stored in database, not computed
244
+
245
+ ## Success Metrics
246
+
247
+ - Users can change priority in under 2 clicks
248
+ - High-priority tasks immediately visible at top of lists
249
+ - No regression in task list performance
250
+
251
+ ## Open Questions
252
+
253
+ - Should priority affect task ordering within a column?
254
+ - Should we add keyboard shortcuts for priority changes?
255
+ ```
256
+
257
+ ---
258
+
259
+ ## Checklist
260
+
261
+ Before saving the PRD:
262
+
263
+ - [ ] Asked clarifying questions with lettered options
264
+ - [ ] Incorporated user's answers
265
+ - [ ] User stories are small and specific (completable in one session)
266
+ - [ ] User stories are ordered by dependencies
267
+ - [ ] Functional requirements are numbered and unambiguous
268
+ - [ ] Non-goals section defines clear boundaries
269
+ - [ ] UI stories include "Verify in browser using dev-browser skill"
270
+ - [ ] Saved to `tasks/prd-[feature-name].md`