Λογότυπο Moai Workflow Loop

Moai Workflow Loop

ΟργανισμόςΔημοφιλές
modu-ai
moai-workflow-loop

Ralph Engine - Automated feedback loop with LSP diagnostics and AST-grep integration for continuous code quality improvement. Use when implementing error-driven development, automated fixing, or continuous quality validation workflows.

Επισκόπηση

Εκδότηςmodu-ai
Αποθετήριοmoai-adk
Όνομα δεξιότηταςmoai-workflow-loop
Αστέρια
1.2K
Forks
226
Συνοδευτικά αρχεία
2
Άδεια χρήσηςApache-2.0
Σύνδεσμοι
  • Οδηγίες σε Markdown

    Ένα αρχείο SKILL.md που το μοντέλο φορτώνει όταν χρειάζεται, ώστε να καταναλώνει token μόνο όταν ένα αίτημα είναι πράγματι σχετικό.

  • Λειτουργεί με οποιοδήποτε LLM

    Οι δεξιότητες AI είναι απλό Markdown, όχι κώδικας για συγκεκριμένο πάροχο, επομένως αυτή η δεξιότητα λειτουργεί με GPT, Claude, Gemini, Grok ή ένα τοπικό μοντέλο.

  • 2 συνοδευτικά αρχεία

    Σενάρια, πρότυπα και υλικό αναφοράς που μπορεί να διαβάζει το μοντέλο καθώς εργάζεται. Τα αρχεία είναι μόνο για ανάγνωση και δεν εκτελούνται ποτέ.

  • Ανοιχτού κώδικα

    Δημοσιεύτηκε από modu-ai στο GitHub. Διαβάστε το πηγαίο περιεχόμενο πριν εγκαταστήσετε τη δεξιότητα.

Εγκατάσταση

Εγκαταστήστε τη δεξιότητα AI Moai Workflow Loop στο TypingMind για να τη χρησιμοποιείτε με οποιοδήποτε LLM ή προσθέστε τη σε άλλον πράκτορα AI που διαβάζει αρχεία SKILL.md.

1

Εγκατάσταση στο TypingMind

Το TypingMind εγκαθιστά μια δεξιότητα απευθείας από τον φάκελό της στο GitHub — διαβάζει το SKILL.md, συγκεντρώνει τα συνοδευτικά αρχεία σε πακέτο και αποθηκεύει το αποτέλεσμα τοπικά.

  1. Ανοίξτε την εφαρμογή και μεταβείτε στα Πρόσθετα → Δεξιότητες.
  2. Επιλέξτε «Εγκατάσταση από GitHub».
  3. Επικολλήστε το παρακάτω URL του φακέλου της δεξιότητας και επιβεβαιώστε.
    https://github.com/modu-ai/moai-adk/tree/main/.claude/skills/moai-workflow-loop
  4. Ενεργοποιήστε τη δεξιότητα σε κάθε συνομιλία όπου θέλετε να είναι διαθέσιμη.
Πρόσθετα → Δεξιότητες → Νέα δεξιότητα → Από URL του GitHub, έπειτα επικολλήστε το URL του φακέλου και πατήστε «Συνέχεια».
2

Εγκατάσταση σε άλλον πράκτορα AI

Κάθε πράκτορας AI που διαβάζει τη μορφή Agent Skills μπορεί να χρησιμοποιήσει αυτή τη δεξιότητα — αντιγράψτε τον φάκελο στον κατάλογο δεξιοτήτων του.

Claude Code — .claude/skills
git clone --depth 1 https://github.com/modu-ai/moai-adk.git /tmp/moai-adk
mkdir -p .claude/skills
cp -r /tmp/moai-adk/.claude/skills/moai-workflow-loop .claude/skills/moai-workflow-loop
Επανεκκινήστε το Claude Code μετά την αντιγραφή, ώστε να εντοπίσει τη νέα δεξιότητα.

Χρησιμοποιήστε τη στο TypingMind

Ενεργοποιήστε τη δεξιότητα Moai Workflow Loop σε οποιαδήποτε συνομιλία στο TypingMind και το μοντέλο αναλαμβάνει τα υπόλοιπα. Το όνομα και η περιγραφή της περιλαμβάνονται στην προτροπή συστήματος και, μόλις προκύψει ένα σχετικό αίτημα, το μοντέλο φορτώνει μόνο του τις πλήρεις οδηγίες — δεν χρειάζεται ποτέ να την καλείτε χειροκίνητα και δεν καταναλώνει token μέχρι να χρησιμοποιηθεί πραγματικά.

Το μοντέλο φορτώνει αυτόματα τη δεξιότητα Moai Workflow Loop μόλις λάβει ένα σχετικό αίτημα.

Λειτουργεί με οποιοδήποτε μοντέλο AI

Οι δεξιότητες AI είναι απλές οδηγίες Markdown και όχι κώδικας για συγκεκριμένο πάροχο, οπότε η δεξιότητα Moai Workflow Loop δεν περιορίζεται στο μοντέλο για το οποίο γράφτηκε. Εγκαταστήστε τη μία φορά στο TypingMind και χρησιμοποιήστε τη με GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama ή ένα τοπικό μοντέλο που εκτελείτε εσείς — πάντα με τα δικά σας κλειδιά API.

  • Φόρτωση μόνο όταν χρειάζεται

    Η προτροπή συστήματος περιλαμβάνει μόνο το όνομα και την περιγραφή. Οι οδηγίες ανακτώνται με το πρώτο σχετικό αίτημα, οπότε μια δεξιότητα που δεν χρησιμοποιείται δεν έχει κόστος.

  • Αλλάξτε μοντέλα κατά τη συνομιλία

    Επειδή η δεξιότητα αποτελείται από οδηγίες και όχι από κώδικα, η αλλαγή μοντέλου δεν επηρεάζει τη λειτουργία της — το επόμενο μοντέλο διαβάζει το ίδιο αρχείο SKILL.md.

Οδηγίες δεξιότητας

Αυτό είναι το περιεχόμενο του αρχείου SKILL.md που φορτώνει το μοντέλο. Διαβάστε το πριν από την εγκατάσταση — μια δεξιότητα αποτελείται από οδηγίες που θα ακολουθήσει το μοντέλο σας.

Ralph Engine

Automated feedback loop system integrating LSP diagnostics, AST-grep security scanning, and test validation for continuous code quality improvement.

Preset Architecture — the Ralph Engine as a goal preset

The /moai loop skill (~/.claude/skills/moai/workflows/loop.md) re-expresses this Ralph engine as a goal preset built ON the goal engine: a scan stage builds a finite issue queue, and the iterate-until-done decision is delegated to the goal engine (stop-goal) with the pre-filled condition "queue drained + diagnostics clean". In this preset architecture, this SKILL.md documents the underlying LSP / AST-grep / test / coverage diagnostic machinery that the goal-preset sweep drives; the preset layers the goal-engine composition on top of that machinery WITHOUT changing it. The four loop quadrants (goal-based sweep, turn-based /moai fix, time-based cadence, proactive CI-watch) are presets on the one goal engine, not independent engines.

Quick Reference

Core Capabilities:

  • LSP Integration: Real-time diagnostics from language servers
  • AST-grep Scanning: Structural code analysis and security checks
  • Feedback Loop: Iterative error correction until completion conditions met
  • Hook System: PostToolUse and Stop hooks for seamless Claude Code integration

Key Components:

  • .claude/hooks/moai/handle-post-tool.sh (PostToolUse): LSP diagnostics after Write/Edit operations
  • .claude/hooks/moai/handle-stop.sh (Stop): Loop iteration control
  • ralph.yaml: Configuration settings

Commands:

  • /moai: One-click Plan-Run-Sync automation (default)
  • /moai loop: Start feedback loop
  • /moai fix: One-time auto-fix

When to Use:

  • Implementing features with zero-error goal
  • Automated code quality improvement
  • Continuous integration workflows
  • Error-driven development patterns

Implementation Guide

Architecture Overview

The Ralph Engine follows a layered architecture. User commands such as /moai:loop, /moai:fix, and /moai enter the Command Layer. The Command Layer invokes the Hook System, which contains the PostToolUse Hook for LSP diagnostics and the Stop Hook for loop control. The Hook System connects to Backend Services including the LSP Client (MoAILSPClient), AST-grep Scanner, and Test Runner. Backend Services feed into Completion Check which evaluates whether errors are zero, tests pass, and coverage is met. Based on the Completion Check result, the system either continues the loop or completes.

Configuration

The ralph.yaml configuration file contains the following sections and settings.

Under the ralph section, enabled controls whether Ralph is active (true by default).

Under the lsp section, auto_start controls automatic language server startup (true by default), timeout_seconds sets the connection timeout (30 seconds default), and graceful_degradation enables fallback to linters when LSP unavailable (true by default).

Under the ast_grep section, enabled controls AST-grep integration (true by default), security_scan enables security rule checking (true by default), and quality_scan enables code quality rule checking (true by default).

Under the loop section, max_iterations sets the maximum loop iterations (10 by default), auto_fix controls automatic fix application (false by default requiring confirmation), and require_confirmation requires user approval before fixes (true by default).

Under the completion subsection of loop, zero_errors requires no LSP or compiler errors (true by default), zero_warnings requires no warnings (false by default as optional), tests_pass requires all tests to pass (true by default), and coverage_threshold sets minimum coverage percentage (85 by default).

Under the hooks section, post_tool_lsp has enabled (true by default) and severity_threshold (error by default). The stop_loop_controller has enabled set to true by default.

Hook Integration

PostToolUse Hook

The PostToolUse hook is triggered after Write and Edit operations. When invoked, Claude Code provides hook input containing the tool_name (such as Write) and tool_input containing the file_path and content.

The hook processes diagnostics and returns hook output with hookSpecificOutput containing the hookEventName (PostToolUse) and additionalContext describing the diagnostic results. For example, the context might report LSP found 2 errors and 3 warnings in file.py, with specific error messages including line numbers.

Exit code 0 indicates no action needed. Exit code 2 indicates attention needed due to errors found.

Stop Hook for Loop Controller

The Stop hook is triggered after each Claude response. The hook reads the loop state file located at .moai/cache/.moai_loop_state.json. This state contains active status (true or false), current iteration number, max_iterations limit, last_error_count from previous iteration, and completion_reason when finished.

The hook returns output with hookSpecificOutput containing hookEventName (Stop) and additionalContext reporting loop status. For example, it might report Ralph Loop CONTINUE at Iteration 3 of 10 with 2 Errors, and next actions to fix the remaining errors.

Exit code 0 indicates loop complete or inactive. Exit code 1 indicates continue loop with more work needed.

LSP Client Usage

The Go LSP client is integrated into the hook system. LSP diagnostics are automatically collected via the post-tool hook (moai hook post-tool-use).

To get diagnostics for a file, call the get_diagnostics method asynchronously with the file path.

Process the returned diagnostics by iterating through each diagnostic object. Check the severity property against DiagnosticSeverity.ERROR to identify errors. Access the line number from diag.range.start.line and the message from diag.message.

Completion Conditions

The loop completes when all enabled conditions are met.

The zero_errors condition (default true) requires no LSP or compiler errors.

The zero_warnings condition (default false) optionally requires no warnings.

The tests_pass condition (default true) requires all tests to pass.

The coverage_threshold condition (default 85) requires minimum coverage percentage.

Advanced Patterns

Custom Completion Conditions

Extend the loop controller with custom conditions by implementing a check function. For example, create a function to count TODO comments in the codebase and return true only when the count reaches zero.

Integration with CI/CD

For GitHub Actions integration, create a workflow step that runs Claude with the /moai:loop command and max-iterations flag. Set the MOAI_LOOP_ACTIVE environment variable to true to enable loop mode.

Graceful Degradation

When LSP is unavailable, the system falls back to linter-based diagnostics using tools like ruff or eslint, then to compiler error detection, and finally to test failure detection.

Troubleshooting

Loop Not Starting

Check that ralph.enabled is set to true in configuration. Verify MOAI_DISABLE_LOOP_CONTROLLER environment variable is not set. Ensure the state file location is writable.

LSP Diagnostics Missing

Check LSP server configuration in .moai/config/sections/lsp.yaml. Verify the language server is installed for your language. Check that MOAI_DISABLE_LSP_DIAGNOSTIC environment variable is not set.

Loop Stuck

Review the max_iterations setting to ensure it allows sufficient iterations. Review completion conditions to verify they are achievable. Send any message to interrupt the loop, or delete the state file (.moai/cache/.moai_loop_state.json) to reset.

Works Well With

Skills:

  • moai-foundation-quality: TRUST 5 validation
  • moai ast-grep / moai ast-edit: security scanning patterns and rewrites
  • moai-workflow-testing: DDD integration
  • .claude/rules/moai/languages/python.md: Python-specific patterns (auto-loaded via paths frontmatter)
  • .claude/rules/moai/languages/typescript.md: TypeScript patterns (auto-loaded via paths frontmatter)

Agents:

  • manager-develop: DDD implementation
  • manager-develop (cycle_type=autofix): complex debugging and fix proposal (former manager-quality debug role)
  • /moai gate skill or sync-phase-quality-gate.sh Stop hook: quality validation (former manager-quality gate role)

Commands:

  • /moai:run: DDD implementation
  • /moai:sync: Documentation sync

Reference

Environment Variables

MOAI_DISABLE_LSP_DIAGNOSTIC disables the LSP hook when set.

MOAI_DISABLE_LOOP_CONTROLLER disables the loop hook when set.

MOAI_LOOP_ACTIVE indicates whether the loop is currently active.

MOAI_LOOP_ITERATION contains the current iteration number.

CLAUDE_PROJECT_DIR contains the project root path.

File Locations

Configuration is stored at .moai/config/sections/ralph.yaml.

Loop state is stored at .moai/cache/.moai_loop_state.json.

The LSP hook is located at .claude/hooks/moai/handle-post-tool.sh.

The loop hook is located at .claude/hooks/moai/handle-stop.sh.

Supported Languages

LSP diagnostics are available for all 16 MoAI-supported languages: C++, C#, Elixir, Flutter, Go, Java, JavaScript, Kotlin, PHP, Python, R, Ruby, Rust, Scala, Swift, and TypeScript. Ralph detects the project language via marker files (for example go.mod for Go, pyproject.toml for Python, tsconfig.json for TypeScript, Cargo.toml for Rust, pubspec.yaml for Flutter) and spawns the matching language server on demand. Users install only the servers their projects actually need; missing servers trigger a warn-and-skip with an install hint, never a hard failure. See references/reference.md for the complete language-server-to-binary mapping table. Per .claude/rules/moai/development/coding-standards.md § Language Policy (16-language neutrality contract), no language receives priority over another.


Version: 1.2.0 Status: Active Integration: Claude Code Hooks, LSP Protocol, AST-grep Skill Name: moai-workflow-loop (formerly moai-ralph)

Common Rationalizations

RationalizationReality
"I will fix the remaining errors manually after the loop"Manual follow-up means the loop did not finish its job. Errors left are errors shipped.
"The loop hit max iterations, the remaining issues are minor"Iteration limits exist for cost control, not as a quality seal. Report the unresolved list.
"LSP warnings are not real errors"Warnings that persist across iterations indicate ignored structural issues. Address or explicitly suppress.
"I fixed the root cause, the other diagnostics will clear themselves"Cascading fixes are not guaranteed. Run the diagnostic pass again and verify each resolution.
"ast-grep rules are too strict for this codebase"Rules reflect project conventions. Disable the specific rule with justification, do not skip the entire scan.
"This iteration made no progress, I should stop"Stagnation after 2 iterations triggers escalation, not silent exit. Follow the escalation protocol.

Rule of 500: Changes touching more than 500 lines deserve their own loop iteration with focused diagnostics. Large changes mask individual regressions.

Red Flags

  • Loop exits with unresolved errors and no stagnation report
  • Same diagnostic appears in consecutive iterations without being addressed
  • ast-grep scan disabled entirely instead of disabling specific rules
  • Loop runs without LSP baseline captured at iteration start
  • Manual code changes made between loop iterations without re-running diagnostics

Verification

  • Every iteration recorded in progress log with error count delta
  • Final iteration shows zero errors or an explicit stagnation report
  • LSP baseline captured at loop start (show diagnostic count)
  • ast-grep scan ran at least once during the loop (show output)
  • Unresolved items documented with reasons they could not be fixed
  • No diagnostic count increased between consecutive iterations

Συνοδευτικά αρχεία

Το μοντέλο τα διαβάζει όποτε χρειάζεται, όσο η δεξιότητα είναι φορτωμένη. Διατίθενται ως αρχεία για ανάγνωση και δεν εκτελούνται ποτέ.

Συχνές ερωτήσεις

Τι κάνει η δεξιότητα AI Moai Workflow Loop;

Ralph Engine - Automated feedback loop with LSP diagnostics and AST-grep integration for continuous code quality improvement. Use when implementing error-driven development, automated fixing, or continuous quality validation workflows.

Γιατί να χρησιμοποιήσετε τη δεξιότητα Moai Workflow Loop στο TypingMind;

Επειδή την εγκαθιστάτε μία φορά και τη χρησιμοποιείτε με οποιοδήποτε μοντέλο. Η Moai Workflow Loop είναι απλό Markdown και όχι κώδικας ειδικά για κάποιον πάροχο, επομένως η ίδια δεξιότητα λειτουργεί με GPT-5, Claude, Gemini, Grok ή ένα τοπικό μοντέλο — και μπορείτε να αλλάξετε μοντέλο κατά τη διάρκεια της συνομιλίας χωρίς να διακοπεί η λειτουργία της. Το TypingMind λειτουργεί με τα δικά σας κλειδιά API, οπότε πληρώνετε απευθείας τους παρόχους αντί για συνδρομή ανά θέση χρήστη, ενώ οι δεξιότητες και οι συνομιλίες σας παραμένουν στον δικό σας χώρο αποθήκευσης.

Πώς εγκαθιστώ τη Moai Workflow Loop στο TypingMind;

Στο TypingMind, ανοίξτε Πρόσθετα → Δεξιότητες → Εγκατάσταση από το GitHub και επικολλήστε το https://github.com/modu-ai/moai-adk/tree/main/.claude/skills/moai-workflow-loop. Το TypingMind διαβάζει το αρχείο SKILL.md, συγκεντρώνει τα συνοδευτικά αρχεία και εγκαθιστά τη δεξιότητα, την οποία μπορείτε να ενεργοποιείτε ανά συνομιλία.

Ποια μοντέλα AI μπορούν να χρησιμοποιήσουν τη δεξιότητα Moai Workflow Loop;

Οποιοδήποτε μοντέλο συνδέετε στο TypingMind. Οι δεξιότητες AI είναι απλές οδηγίες Markdown και όχι κώδικας ειδικά για κάποιον πάροχο, επομένως τα GPT, Claude, Gemini, Grok και τα τοπικά μοντέλα μπορούν όλα να φορτώσουν αυτή τη δεξιότητα όταν ένα αίτημα αντιστοιχεί σε αυτή.

Με πόσα μοντέλα AI μπορώ να χρησιμοποιήσω τη Moai Workflow Loop;

Με όσα θέλετε. Εφόσον ένα μοντέλο υποστηρίζει δεξιότητες, μπορείτε να χρησιμοποιήσετε τη Moai Workflow Loop με αυτό — GPT, Claude, Gemini, Grok, DeepSeek, Mistral, Llama και άλλα — όλα στο TypingMind με τα δικά σας κλειδιά API.

Είναι δωρεάν η δεξιότητα AI Moai Workflow Loop;

Ναι. Δημοσιεύεται στο GitHub από τον χρήστη modu-ai με την άδεια χρήσης Apache-2.0. Πληρώνετε μόνο τον δικό σας πάροχο AI για τα token που χρησιμοποιείτε.

Τι είναι οι δεξιότητες AI;

Μια δεξιότητα AI είναι ένα επαναχρησιμοποιήσιμο πακέτο οδηγιών που διδάσκει σε ένα μοντέλο AI πώς να εκτελεί μια συγκεκριμένη εργασία. Ακολουθεί την ανοιχτή μορφή Agent Skills: ένα αρχείο SKILL.md με όνομα και περιγραφή, μαζί με τυχόν σενάρια κώδικα, πρότυπα ή αρχεία αναφοράς που μπορεί να χρειαστεί το μοντέλο. Το μοντέλο διαβάζει τις οδηγίες μόνο όταν το αίτημά σας αντιστοιχεί στη δεξιότητα, οπότε μια εγκατεστημένη δεξιότητα δεν κοστίζει τίποτα μέχρι να χρησιμοποιηθεί.

Σε τι διαφέρουν οι δεξιότητες AI από τα πρόσθετα ή τους συνδέσμους MCP;

Ένα πρόσθετο ή ένας σύνδεσμος MCP παρέχει στο μοντέλο νέα εργαλεία που μπορεί να καλέσει — κώδικα που εκτελείται κάπου και επιστρέφει ένα αποτέλεσμα. Μια δεξιότητα AI παρέχει αντί γι’ αυτό γνώσεις και διαδικασίες στο μοντέλο: πώς να προσεγγίσει μια εργασία, ποια βήματα να ακολουθήσει και ποια χαρακτηριστικά έχει ένα καλό αποτέλεσμα. Οι δεξιότητες είναι απλό Markdown, επομένως δεν χρειάζονται διακομιστή, κλειδί API ή περιβάλλον εκτέλεσης και λειτουργούν με οποιοδήποτε μοντέλο.

Προβολή όλων

Στήστε δικό σας χώρο εργασίας AI τώρα

Εγγραφείτε στο ενημερωτικό μας δελτίο για να ενημερώνεστε για νέες λειτουργίες και μελλοντικές κληρώσεις δώρων 👇