multi-agent-ralph-loop

作者 alfredolopez80已验证

Autonomous orchestration framework for Claude Code with MemPalace-inspired memory (4-layer stack, 818-token wake-up), parallel-first Agent Teams (6 teammates), Aristotle First Principles methodology, and 4-stage quality gates. 925+ tests, 22 active hooks, automatic learning pipeline.

147
Stars
21
Forks
Shell
语言
2026/8/23
添加时间

⚠️ 第三方软件声明

本 Skill 为第三方开源软件,独立托管于 GitHub。SkillTip 仅为信息目录,不控制或维护底层仓库。所显示的安全检查为自动化且范围有限,安装前请自行审查源码。

阅读服务条款

安装

添加到你的 Claude Code skills 目录:

# Add to your Claude Code skills
git clone https://github.com/alfredolopez80/multi-agent-ralph-loop

快速入门

使用 multi-agent-ralph-loop 等 Skills 的指南。

安全报告

已验证

上次扫描:—

{
  "status": "PASSED",
  "issues": []
}

README.md

Multi-Agent Ralph Loop

Autonomous orchestration framework for Claude Code with MemPalace-inspired memory, parallel-first Agent Teams, Aristotle First Principles methodology, and quality gates.

What It Does

Ralph extends Claude Code into a multi-agent development framework with a structured memory system inspired by the Memory Palace technique. Every task is analyzed from first principles, decomposed into parallel subtasks, assigned to specialized teammates, and validated through quality gates before completion.

CapabilityDescription
MemPalace Memory4-layer memory stack (L0-L3) with Obsidian vault knowledge graph and learned rules taxonomy
Parallel-FirstAll independent tasks execute in parallel via Agent Teams (mandatory for complexity >= 3)
6 Teammatesralph-coder, ralph-reviewer, ralph-tester, ralph-researcher, ralph-frontend, ralph-security
Hook SystemLifecycle hooks for validation, quality gates, security guards, and automatic learning
Aristotle Analysis5-phase first principles deconstruction before every non-trivial task
Quality Gates4-stage blocking validation: correctness, quality, security, consistency
Comprehensive TestsFull test suite covering layers, hooks, security, skills, and pipeline

MemPalace Memory System

Inspired by the MemPalace repository (Memory Palace technique for LLM agents), Ralph implements a layered memory architecture with key differences based on our implementation findings.

Layer Stack (Session Wake-up)

LayerFilePurpose
L0~/.ralph/layers/L0_identity.mdAgent identity + principles
L1~/.ralph/layers/L1_essential.mdActionable rules (filtered from corpus)
L2.claude/rules/learned/{halls,rooms,wings}/Project-specific taxonomy (on-demand)
L3Obsidian vault grepFull knowledge base queries (on-demand)

Learned Rules Taxonomy

Rules organized in 3 dimensions for flexible retrieval:

DimensionDirectoryOrganization
Halls (by type).claude/rules/learned/halls/decisions, patterns, anti-patterns, fixes
Rooms (by topic).claude/rules/learned/rooms/hooks, memory, agents, security, testing
Wings (by scope).claude/rules/learned/wings/_global/, multi-agent-ralph-loop/

Key Implementation Findings

These findings emerged during our MemPalace implementation and may be relevant to others building LLM memory systems:

FindingDetail
Encoding doesn't reduce tokensUnicode PUA encoding increased BPE tokens. Word count metrics falsely reported reduction.
Selection beats encodingChoosing fewer rules achieved the target; compressing the same rules did not.
Taxonomy needs noise filtering46% of auto-learned rules were noise (cross-domain repeats, vague bundles). Filtering is essential.

Full analysis: AAAK_LIMITATIONS_ADR

Learning Pipeline (Automatic)

SESSION (any repo)
  |
  +-- Stop      --> continuous-learning.sh --> vault + procedural memory
  +-- PostToolUse --> semantic extractors  --> vault facts & decisions
  +-- SessionStart --> vault-graduation.sh --> promote to local rules
  +-- SessionEnd   --> vault-index-updater  --> update indices

All learning flows project -> global -> vault. Only universal patterns graduate to global scope.

Quick Start

git clone https://github.com/alfredolopez80/multi-agent-ralph-loop.git
cd multi-agent-ralph-loop

# Validate global infrastructure
bash scripts/validate-global-infrastructure.sh

# Run tests
python3 -m pytest tests/ -q

# Use
/orchestrator "Create a REST API endpoint"
/iterate "Fix all lint errors"
/security src/

Agent Teams

6 specialized teammates for parallel execution:

TeammateRoleTools
ralph-coderImplementationRead, Edit, Write, Bash
ralph-reviewerCode review (OWASP)Read, Grep, Glob
ralph-testerTestingRead, Edit, Write, Bash(test)
ralph-researcherResearch (Zai MCP)Read, Grep, Glob, WebSearch
ralph-frontendFrontend (WCAG 2.1 AA)LSP, Read, Edit, Write, Bash
ralph-securitySecurity (6 pillars)LSP, Read, Grep, Glob, Bash

Agent Teams is enabled via CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS=1 in settings.json. Teammates are spawned in parallel by the orchestrator, iterate, parallel, security, and task-batch skills.

Core Skills

SkillPurpose
/orchestratorFull 10-step workflow: evaluate, clarify, classify, plan, execute, validate, retrospect
/iterateIterative execution until VERIFIED_DONE
/parallelRun multiple independent tasks concurrently
/task-batchAutonomous batch execution from PRD files
/gatesMulti-language quality gate validation
/securityMulti-agent security audit (OWASP, semgrep, gitleaks)
/autoresearchAutonomous experimentation loop with Smart Setup
/adversarialSpec refinement with multi-model cross-validation
/bugsSystematic bug hunting
/shipPre-launch checklist (gates + security + review)
/specVerifiable technical specification before coding

Quality Gates

4-stage validation, all blocking except consistency:

  1. CORRECTNESS -- Syntax valid, logic sound
  2. QUALITY -- Types, no debug artifacts
  3. SECURITY -- semgrep + gitleaks + OWASP validation
  4. CONSISTENCY -- Linting and style (advisory)

Hook enforcement via TeammateIdle and TaskCompleted events ensures no agent completes without passing gates.

Parallel-First Rule

All independent tasks MUST execute in parallel. Sequential execution requires documented dependency.

Complexity 1-2: Direct execution (no team required)
Complexity 3+:  Agent Teams with parallel teammates (MANDATORY)

See: .claude/rules/parallel-first.md

Architecture

User Request --> Claude Code
                    |
            Aristotle Analysis (5 phases)
                    |
            Task Classification (1-10)
                    |
        +-----------+-----------+
        |                       |
    Agent Teams            Quality Gates
    (parallel)             (blocking)
        |                       |
    ralph-coder ---+     CORRECTNESS ok
    ralph-tester --+     QUALITY ok
    ralph-reviewer-+     SECURITY ok
    ralph-security-+     CONSISTENCY ok
        |                       |
        +-----------+-----------+
                    |
              VERIFIED_DONE
                    |
            MemPalace Learning
            (session -> vault -> global)

Security

The framework includes multiple layers of security enforcement:

LayerTriggerPurpose
git-safety-guard.pyPreToolUse (Bash)Blocks destructive git operations and command chaining
repo-boundary-guard.shPreToolUse (Bash)Prevents operations outside current repo
audit-secrets.jsPostToolUseAudit logging for 20+ secret patterns
teammate-idle-quality-gate.shTeammateIdleQuality gates before teammate goes idle
task-completed-quality-gate.shTaskCompletedMulti-gate validation before task completion
task-plan-sync.shTaskCreatedSyncs task creation to plan-state.json

Context Optimization

Ralph uses symlinks (not copies) for all global rules, skills, and agents. This eliminates content duplication and reduces context overhead by ~29% (~10K tokens saved per session).

# Sync rules from repo to global (creates symlinks)
bash scripts/sync-rules.sh

# Preview changes without executing
bash scripts/sync-rules.sh --dry-run

Distribution policy: See docs/architecture/DISTRIBUTION_POLICY.md for the symlink vs copy strategy per component type (Rules=COPY, Hooks=COPY, Agents=SYMLINK, Skills=MIXED).

Requirements

ToolVersionRequired
Claude Codev2.1.42+Yes
Bash4.0+Yes
jq1.6+Yes
git2.0+Yes
python33.8+Yes (for tests)
ObsidianAnyOptional (for vault KG)
GitHub CLIAnyOptional
semgrepAnyOptional (security)
gitleaksAnyOptional (secrets)

Testing

python3 -m pytest tests/ -q                    # Full test suite
bash scripts/validate-global-infrastructure.sh  # Infrastructure checks

Configuration

The system is model-agnostic -- all skills and agents inherit the configured model from settings, no per-command flags required.

{
  "env": {
    "ANTHROPIC_DEFAULT_SONNET_MODEL": "your-model",
    "CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS": "1"
  }
}

Skills are symlinked to multiple platform directories. Source of truth: .claude/skills/ in this repo.

Global Infrastructure

All Ralph advantages (Plan Mode, Aristotle, Parallel-First, Agent Teams) work in any project -- rules, skills, and agents are symlinked globally.

# Validate global infrastructure
bash scripts/validate-global-infrastructure.sh

# Auto-fix broken symlinks
bash scripts/validate-global-infrastructure.sh --fix

Autoresearch

Autonomous experimentation loop inspired by karpathy/autoresearch. Continuously modifies code, measures metrics, and keeps only improvements.

Smart Setup reduces configuration from 14+ manual parameters to 2-3 guided questions:

PhaseNameWhat it does
0SCOUTSilent auto-detection of project type, scripts, metrics
1WIZARD2-3 AskUserQuestion with pre-filled options and previews
2VALIDATEDry-run verification (eval works, metric extracts, git clean)

9 domain templates: ML Training, Node.js Tests, Bundle Size, Python Tests, Prompt Engineering, SQL, Rust, Lighthouse, Custom.

/autoresearch "optimize my tests"     # Smart mode (auto-detect)
/autoresearch --manual                # Classic setup

Documentation

TopicLocation
Architecturedocs/architecture/
AAAK Limitations ADRdocs/architecture/AAAK_LIMITATIONS_ADR_2026-04-07.md
Anti-Rationalizationdocs/reference/anti-rationalization.md
Aristotle Methodologydocs/reference/aristotle-first-principles.md
Securitydocs/security/
Hooks Referencedocs/hooks/
Benchmarksdocs/benchmark/
Batch Executiondocs/batch-execution/

Acknowledgments

  • MemPalace -- Original Memory Palace technique research for LLM agents that inspired our layered memory architecture. Our implementation diverges in key areas documented in AAAK_LIMITATIONS_ADR.
  • Claude Code -- Base orchestration platform with hooks, skills, and Agent Teams APIs.
  • karpathy/autoresearch -- Inspiration for the autonomous experimentation loop.

License

MIT License - see LICENSE file.

References

常见问题

What is multi-agent-ralph-loop?

multi-agent-ralph-loop is an open-source ai agents skill for AI coding assistants such as Claude Code, Codex CLI, and ChatGPT, built by alfredolopez80. Autonomous orchestration framework for Claude Code with MemPalace-inspired memory (4-layer stack, 818-token wake-up), parallel-first Agent Teams (6 teammates), Aristotle First Principles methodology, and 4-stage quality gates. 925+ tests, 22 active hooks, automatic learning pipeline. It has 147 GitHub stars.

Is multi-agent-ralph-loop safe to use?

Yes. multi-agent-ralph-loop passed SkillsLLM's automated security scan — a dependency vulnerability audit plus prompt-injection heuristics — with no high-severity issues. You can read the full report in the Security Report section on this page.

How do I install multi-agent-ralph-loop?

Clone the repository with "git clone https://github.com/alfredolopez80/multi-agent-ralph-loop" and add it to your Claude Code skills directory (see the Installation section above).

What programming language is multi-agent-ralph-loop written in?

multi-agent-ralph-loop is primarily written in Shell. It is open-source under alfredolopez80 on GitHub, so you can review or fork the full source.

Are there alternatives to multi-agent-ralph-loop?

Yes. SkillsLLM lists many other AI Agents skills you can browse and compare side by side. Open the AI Agents category from the badge at the top of this page, or use the Related Skills and comparison links further down to weigh multi-agent-ralph-loop against similar tools.

评论 (0)

暂无评论,成为第一个分享想法的人!

ECC

by affaan-m

10

The agent harness performance optimization system. Skills, instincts, memory, security, and research-first development for Claude Code, Codex, Opencode, Cursor and beyond.

242,21936,702JavaScript
AI 智能体ai-agentsanthropicclaude-code
查看详情
15

An agentic skills framework & software development methodology that works.

234,96620,863Shell
AI 智能体ai-agentsbrainstorming
查看详情

hermes-agent

by NousResearch

10

The agent that grows with you

234,43747,175Python
AI 智能体ai-agentsagent-orchestration
查看详情

The agent harness performance optimization system. Skills, instincts, memory, security, and research-first development for Claude Code, Codex, Opencode, Cursor and beyond.

185,94028,768JavaScript
AI 智能体ai-agentsanthropicclaude-code
查看详情

cc-switch

by farion1231

3

A cross-platform desktop All-in-One assistant for Claude Code, Codex, OpenCode, OpenClaw, Grok Build & Hermes Agent. Only official website: ccswitch.io

128,8688,826Rust
AI 智能体claude-codeai-tools
查看详情

claude-code

by anthropics

Claude Code is an agentic coding tool that lives in your terminal, understands your codebase, and helps you code faster by executing routine tasks, explaining complex code, and handling git workflows - all through natural language commands.

120,03119,897Shell
AI 智能体
查看详情

开发者还喜欢

基于喜欢此 Skill 的开发者投票和收藏

ECC

by affaan-m

10

The agent harness performance optimization system. Skills, instincts, memory, security, and research-first development for Claude Code, Codex, Opencode, Cursor and beyond.

242,21936,702JavaScript
AI 智能体ai-agentsanthropicclaude-code
查看详情
15

An agentic skills framework & software development methodology that works.

234,96620,863Shell
AI 智能体ai-agentsbrainstorming
查看详情

hermes-agent

by NousResearch

10

The agent that grows with you

234,43747,175Python
AI 智能体ai-agentsagent-orchestration
查看详情

n8n

by n8n-io

12

Fair-code workflow automation platform with native AI capabilities. Combine visual building with custom code, self-host or cloud, 400+ integrations.

201,88160,308TypeScript
MCP 服务器apisai-tools
查看详情

The agent harness performance optimization system. Skills, instincts, memory, security, and research-first development for Claude Code, Codex, Opencode, Cursor and beyond.

185,94028,768JavaScript
AI 智能体ai-agentsanthropicclaude-code
查看详情

cc-switch

by farion1231

3

A cross-platform desktop All-in-One assistant for Claude Code, Codex, OpenCode, OpenClaw, Grok Build & Hermes Agent. Only official website: ccswitch.io

128,8688,826Rust
AI 智能体claude-codeai-tools
查看详情