agentleFS
therain2020therain2020/therain2020-agent/CLAUDE.md

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:

The file

Files
CLAUDE.md

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 logging
  • src/services/SelfModService/Sandbox.ts — Safe modification: checkpoint, worktree, rebuild, rollback
  • src/services/SelfModService/EvolutionLoop.ts — Evolution pipeline: gap → design → generate → integrate → verify
  • src/services/DynamicToolRegistry.ts — Runtime tool loading from ~/.claude/dynamic-tools/*.ts
  • src/services/EvolvedPromptStore.ts — System prompt evolution storage
  • src/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 bypass
  • src/types/permissions.ts — Added selfModify PermissionMode

Tool System

  • src/Tool.ts — Tool type definitions
  • src/tools.ts — Tool registry, assembleToolPool() now includes dynamic tools
  • src/tools/SelfHealTool.ts — Agent calls this to trigger self-healing
  • src/tools/EvolveTool.ts — Agent calls this to trigger self-evolution

Evolution Tiers

TierTargetMechanism
1.claude/skills/{name}/SKILL.mdAuto-discovered by discoverSkillDirsForPaths()
2~/.claude/dynamic-tools/{name}.tsLoaded by DynamicToolRegistry.import()
3Core engine (src/tools/, src/services/)Worktree isolate → edit → build → restart

Key Files Modified from Original

  1. src/tools.ts — DynamicRegistry integration in assembleToolPool()
  2. src/utils/permissions/filesystem.ts — Self-modification permission bypass
  3. src/types/permissions.ts — selfModify PermissionMode
  4. src/constants/prompts.ts — SELF_MODIFY_CAPABILITY system prompt section
  5. src/memdir/memoryTypes.ts — selfheal and evolution memory types

Code Conventions

  • .js extensions on imports even for .tsx files
  • buildTool() factory for standard tool construction
  • systemPromptSection() for system prompt extensions
  • File-based storage in ~/.claude/ for persistence

Download now (ZIP)

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
What did you use it for? e.g. Reviewing pull requests in a Rails app

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.