therain2020-agent
CLAUDE.md0 starsChanged 6 months agoMITView on GitHub
This is therain2020-agent — a self-healing, self-evolving AI agent based on Claude Code architecture. The agent CAN modify its own source code. This is the foundation of self-healing and self-evolution. Modified from original Claude Code to support self-modification:
In this repository2 other files it gives its agents.
- push-docs-to-feishuSkill
- update-docsSkill
The file
Files
CLAUDE.md
This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
Overview
This is therain2020-agent — a self-healing, self-evolving AI agent based on Claude Code architecture.
- Language: TypeScript (strict)
- Runtime: Bun
- Terminal UI: React + Ink
- CLI Parsing: Commander.js (
@commander-js/extra-typings) - Schema Validation: Zod v4 (
zod/v4) - API: Anthropic SDK (
@anthropic-ai/sdk)
Core Architecture
Self-Modification System
The agent CAN modify its own source code. This is the foundation of self-healing and self-evolution.
src/services/SelfModService/SelfModService.ts— Central engine: permission mode switching, heal/evolve orchestration, journal loggingsrc/services/SelfModService/Sandbox.ts— Safe modification: checkpoint, worktree, rebuild, rollbacksrc/services/SelfModService/EvolutionLoop.ts— Evolution pipeline: gap → design → generate → integrate → verifysrc/services/DynamicToolRegistry.ts— Runtime tool loading from~/.claude/dynamic-tools/*.tssrc/services/EvolvedPromptStore.ts— System prompt evolution storagesrc/services/CapabilityGapDetector.ts— Gap detection + auto-trigger
Permission System Changes
Modified from original Claude Code to support self-modification:
src/utils/permissions/filesystem.ts—.claude/removed from DANGEROUS_DIRECTORIES, added self-modification bypasssrc/types/permissions.ts— AddedselfModifyPermissionMode
Tool System
src/Tool.ts— Tool type definitionssrc/tools.ts— Tool registry,assembleToolPool()now includes dynamic toolssrc/tools/SelfHealTool.ts— Agent calls this to trigger self-healingsrc/tools/EvolveTool.ts— Agent calls this to trigger self-evolution
Evolution Tiers
| Tier | Target | Mechanism |
| 1 | .claude/skills/{name}/SKILL.md | Auto-discovered by discoverSkillDirsForPaths() |
| 2 | ~/.claude/dynamic-tools/{name}.ts | Loaded by DynamicToolRegistry.import() |
| 3 | Core engine (src/tools/, src/services/) | Worktree isolate → edit → build → restart |
Key Files Modified from Original
src/tools.ts— DynamicRegistry integration inassembleToolPool()src/utils/permissions/filesystem.ts— Self-modification permission bypasssrc/types/permissions.ts—selfModifyPermissionModesrc/constants/prompts.ts— SELF_MODIFY_CAPABILITY system prompt sectionsrc/memdir/memoryTypes.ts—selfhealandevolutionmemory types
Code Conventions
.jsextensions on imports even for.tsxfilesbuildTool()factory for standard tool constructionsystemPromptSection()for system prompt extensions- File-based storage in
~/.claude/for persistence
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

