moai-workflow-loop

Automates iterative code fixing using LSP diagnostics and AST-grep security scanning.

2|Updated May 27, 2026
One-click install
npx skills add https://github.com/yekinya/moai-novel --skill moai-workflow-loop-yekinya
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: moai-workflow-loop
Source: https://github.com/yekinya/moai-novel/tree/main/moai-novel/.claude/skills/moai-workflow-loop
Command: npx skills add https://github.com/yekinya/moai-novel --skill moai-workflow-loop-yekinya

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve? Manually chasing compiler errors, type mismatches, and security issues after every code change is slow and error-prone. This Skill runs an automated feedback loop that collects LSP diagnostics and AST-grep scan results after each edit, then iterates until errors reach zero or a defined completion condition is met. ## Core Features & Use Cases - LSP Diagnostic Feedback Loop: A PostToolUse hook captures language server errors and warnings after every Write/Edit operation across 16 supported languages. - AST-grep Security Scanning: Detects SQL injection, XSS, and hardcoded secrets using structural pattern rules during the loop. - Configurable Completion Conditions: Define zero-errors, zero-warnings, tests-passing, and coverage thresholds in ralph.yaml, with graceful degradation to linters when LSP servers are unavailable. - Use Case: While implementing a new authentication module, run the loop so every edit is checked by pyright or tsserver, errors are fixed iteratively, and the loop stops only when diagnostics are clean and tests pass. ## Quick Start Ask the AI to start the Ralph feedback loop with /moai:loop so it automatically fixes LSP errors until the code is clean.

Frequently Asked Questions about moai-workflow-loop

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I set up an automated LSP error-fixing loop in Claude Code?

Enable the loop by setting ralph.enabled to true in .moai/config/sections/ralph.yaml, then run /moai:loop. The PostToolUse hook collects LSP diagnostics after each Write or Edit, and the Stop hook iterates until completion conditions are met.

What languages does LSP-based diagnostic checking support?

The loop supports 16 languages including Python, TypeScript, Go, Rust, Java, C++, C#, Kotlin, Swift, Ruby, PHP, Scala, Elixir, R, JavaScript, and Flutter. It detects the project language via marker files like go.mod or pyproject.toml and spawns the matching language server.

Can I use AST-grep security scanning with the feedback loop?

Yes, AST-grep scanning is enabled by default in ralph.yaml with security_scan and quality_scan options. It detects patterns like SQL injection, XSS, and hardcoded secrets using rules defined in sgconfig.yml during loop iterations.

Why is the feedback loop not starting after running the loop command?

Check that ralph.enabled is true in the configuration, the MOAI_DISABLE_LOOP_CONTROLLER environment variable is not set, and the .moai/cache directory is writable. Deleting the .moai_loop_state.json file resets a stuck loop state.

What happens when the LSP server is unavailable during the loop?

When graceful_degradation is enabled, the system falls back to linter-based diagnostics such as ruff or eslint, then to compiler error detection, and finally to test failure detection. Missing language servers trigger a warn-and-skip with an install hint rather than a hard failure.

How do I control when the automated fixing loop stops?

Configure completion conditions in ralph.yaml under loop.completion: zero_errors, zero_warnings, tests_pass, and coverage_threshold. The loop also stops at max_iterations (default 10) or when you send any message to interrupt it.