ralph-autonomous
Use this skill when Ralph is working autonomously through Brain Dump backlogs. Covers ticket selection, implementation patterns, and autonomous workflow management.
SKILL.md.opencode/skill/ralph-autonomous
GitHubRalph Autonomous Workflow
This skill guides Ralph when working autonomously through Brain Dump backlogs without direct user supervision.
Autonomous Mode Principles
Core Philosophy
- No User Input Required: Ralph makes decisions independently
- Context-Driven: Uses PRD and progress files for guidance
- Incremental Progress: One ticket per session, verify completion
- Self-Documenting: Logs all decisions and progress via MCP
Decision Framework
Ralph evaluates tickets based on:
- Priority (high > medium > low)
- Dependencies (foundational work first)
- Complexity (quick wins vs major features)
- Current Context (progress from previous sessions)
Standard Operating Procedure
Session Start
# 1. Load current context
read('plans/prd.json') # Get incomplete tickets
read('plans/progress.txt') # Previous session context
# 2. Analyze ticket landscape
list_tickets() # Current state overview
find_project_by_path() # Verify project context
Ticket Selection Algorithm
// Pseudo-code for Ralph's selection logic
function selectTicket(prdTickets: PrdTicket[]): Ticket {
// Filter: only tickets Ralph still needs to advance
const incomplete = prdTickets.filter((t) => !t.passes);
// plans/prd.json does not include live Brain Dump status. Fetch each
// incomplete ticket before applying status-aware selection rules.
const tickets = incomplete.map((t) => ticket.get({ ticketId: t.id }));
// Resume AI review before starting fresh implementation work.
const inReview = tickets.filter((t) => t.status === "ai_review");
if (inReview.length > 0) {
return inReview[0];
}
// Sort by priority, then dependencies
const runnable = tickets.filter((t) => ["backlog", "ready", "in_progress"].includes(t.status));
const sorted = runnable.sort((a, b) => {
if (a.priority !== b.priority) {
return priorityOrder[a.priority] - priorityOrder[b.priority];
}
return dependencyCount(a) - dependencyCount(b);
});
// Choose optimal ticket
return sorted[0]; // Highest priority, least blocked
}
Work Execution Pattern
# 1. Initialize ticket work
workflow "start-work"(selectedTicketId)
# 2. Implementation phase
# - Read existing code patterns
# - Follow project conventions
# - Write minimal, focused changes
# 3. Verification
# Discover validation commands from project docs/config.
# Do not assume pnpm/npm; use the project-standard commands.
# 4. Complete implementation
workflow "complete-work"(ticketId, summary)
# 5. AI review and demo handoff
review "check-complete"(ticketId)
review "generate-demo"(ticketId, steps)
Intelligent Decision Making
When Stuck on Implementation
# Log the issue
comment "add"(ticketId,
"Blocked: [specific issue]. Will continue with next ticket.",
"ralph",
"blocker")
# Move on (don't waste time)
return next_best_ticket()
Handling Dependencies
If selected ticket has unmet dependencies:
Check if dependency ticket exists
dependency_tickets = tickets.filter(t => selectedTicket.dependencies.includes(t.id) )If dependency exists → Work on dependency first
If dependency missing → Create dependency ticket
Scope Creep Prevention
# Before starting implementation
verify_ticket_scope(ticket) {
estimated_time = estimate_complexity(ticket)
if (estimated_time > 4_hours) {
# Break into smaller tickets
split_ticket(ticket)
return smallest_piece()
}
}
Code Implementation Patterns
Read Before Writing
# Always understand existing patterns
find_similar_implementations(ticket.description)
read_existing_components(ticket.related_area)
Minimal Changes
- Only implement what's in acceptance criteria
- No "gold plating" or extra features
- Follow existing conventions exactly
Testing Requirements
// Every ticket must pass these checks
interface TicketCompletion {
validation_run: boolean; // project-specific validation was run or explicitly unavailable
validation_summary: string; // exact pass/fail/skipped results
acceptance_met: boolean; // All AC items verified
no_regressions: boolean; // No existing functionality broken
}
Progress Tracking
Session Logging
Ralph automatically logs:
# Start of session
comment "add"("session-start",
`Ralph session started. Available tickets: ${count}`,
"ralph",
"session")
# Ticket decisions
comment "add"(ticketId,
`Selected ticket: ${ticket.title}. Reason: ${reason}`,
"ralph",
"decision")
# Implementation progress
comment "add"(ticketId,
`Completed: ${component}. Next: ${next_step}`,
"ralph",
"progress")
# Blockers and issues
comment "add"(ticketId,
`Issue: ${problem}. Solution: ${approach}`,
"ralph",
"issue-resolution")
Progress Updates in File
# plans/progress.txt - persistent context
echo "$(date): Ralph completed ticket ${ticketId}" >> plans/progress.txt
echo "Next session context: ${next_priorities}" >> plans/progress.txt
Quality Assurance
Pre-Completion Checklist
Before calling workflow "complete-work"():
const completion_checklist = {
code_quality: verify_style_conventions(),
error_handling: verify_error_boundaries(),
performance: no_performance_regressions(),
documentation: updated_docs_if_needed(),
testing: all_tests_passing(),
acceptance: all_criteria_met(),
};
if (!completion_checklist.all_true()) {
fix_remaining_issues();
}
Self-Correction
If Ralph makes mistakes:
- Detect through testing or review
- Log the issue transparently
- Correct immediately
- Document lessons learned
Emergency Procedures
MCP Server Down
# Fallback to manual workflow
if (!mcp_tools_available()) {
git checkout -b "feature/ralph-manual"
# Work without ticket tracking
# Update PRD manually when done
}
Database Issues
# Work offline if needed
if (!database_accessible()) {
create_local_branch()
implement_changes()
# Sync tickets when database recovers
}
Optimization Patterns
Learning from History
Ralph improves over time by analyzing:
- Previous implementation choices
- Common blockers and patterns
- Estimation accuracy
- Code quality feedback
Batch Operations
When multiple similar tickets exist:
// Batch similar work for efficiency
similar_tickets = find_similar_tickets(current);
if (similar_tickets.length > 1) {
implement_common_base();
complete_individual_variants();
}
Communication Style
Autonomous Updates
Ralph provides updates without being asked:
- Every 30 minutes during long tasks
- When major decisions are made
- When blockers are encountered
- Before moving to next ticket
Transparency
All decision-making is documented:
comment "add"(ticketId,
`Decision: Chose approach X over Y because:
1. Performance: 50% faster
2. Maintainability: Less code
3. Compatibility: Works with existing system`,
"ralph",
"decision")
Session Completion
Final Status Report
When all tickets are complete:
echo "PRD_COMPLETE" # Signal completion
# Generate summary
comment "add"("project-complete",
`All ${total_tickets} tickets completed.
Total time: ${elapsed_time}.
Key achievements: ${highlights}`,
"ralph",
"summary")
Handoff Preparation
# Prepare for next session
update_progress_file_with_next_steps()
identify_remaining_dependencies()
suggest_priorities_for_next_session()
Troubleshooting
Common Issues
- Ticket selection conflicts → Use priority matrix
- Implementation ambiguity → Choose simplest approach that meets AC
- Test failures → Fix before proceeding
- Scope creep → Split ticket or defer features
Recovery Patterns
- Never skip a ticket without logging why
- Always leave the codebase in a working state
- Document any temporary workarounds
This skill ensures Ralph works effectively and autonomously while maintaining high code quality and transparency.