# jeffrey-0617/self-evolving-agent-for-refactoring architecture

> Architecture diagram of the GitHub repository jeffrey-0617/self-evolving-agent-for-refactoring, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-09-29). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/jeffrey-0617/self-evolving-agent-for-refactoring
- Repository: https://github.com/jeffrey-0617/self-evolving-agent-for-refactoring

## Overview

The product is a self-evolving agent for refactoring Wright# architecture designs from natural-language requirements. Its central workflow is requirement intake, assertion preparation, ADL refactoring, property verification, and repair; post-task reflection adds reusable skills, tools, and memory. The README documents this workflow and the knowledge lifecycle. Some orchestration is unsampled, so links between the agent, skills, and individual tools are shown only where documented; the verifier’s PAT-service call is supported by the sampled source.

Main entry points: [`agents/refactoring_agent_claude_cli.py`](https://github.com/jeffrey-0617/self-evolving-agent-for-refactoring/blob/main/agents/refactoring_agent_claude_cli.py) (Refactoring agent), [`agents/run_clustered_requirements_batch_claude.py`](https://github.com/jeffrey-0617/self-evolving-agent-for-refactoring/blob/main/agents/run_clustered_requirements_batch_claude.py) (Batch runner), [`agents/verification/verify_wrighthash_all_properties.py`](https://github.com/jeffrey-0617/self-evolving-agent-for-refactoring/blob/main/agents/verification/verify_wrighthash_all_properties.py) (Property verifier), [`agents/refactoring_agent_subscription.py`](https://github.com/jeffrey-0617/self-evolving-agent-for-refactoring/blob/main/agents/refactoring_agent_subscription.py) (Subscription agent)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_workflow["Refactoring workflow"]
  node_agent["Refactoring agent"]
  node_subscription_agent["Subscription agent"]
  node_adl_inputs["Wright&#35; designs"]
  node_assertions["Assertions<br/>[assertions.md]"]
  node_refactored_adl["Refactored ADL<br/>[refactored.adl]"]
end

subgraph group_knowledge["Agent knowledge"]
  node_cold_skills["Cold-start skills<br/>[skills]"]
  node_memory_skills["Evolved skills"]
  node_memory_patterns["Memory patterns"]
  node_static_tools["Static analysis tools"]
end

subgraph group_verification["Verification"]
  node_verifier["Property verifier"]
end

subgraph group_batch["Batch execution"]
  node_requirements["Requirements workbook"]
  node_batch_runner["Batch runner"]
  node_results["Batch results"]
end

node_user(("Engineer"))
node_claude["Claude Code CLI"]
node_pat["PAT verifier service"]

node_user -->|"starts batch"| node_batch_runner
node_requirements -->|"supplies tasks"| node_batch_runner
node_batch_runner -->|"dispatches task"| node_agent
node_user -->|"provides requirement"| node_agent
node_user -->|"provides task"| node_subscription_agent
node_agent -->|"runs agent loop"| node_claude
node_subscription_agent -->|"runs agent loop"| node_claude
node_adl_inputs -->|"provides design"| node_agent
node_assertions -->|"provides properties"| node_agent
node_agent -->|"writes design"| node_refactored_adl
node_cold_skills -->|"guides workflow"| node_agent
node_agent -->|"verifies design"| node_verifier
node_verifier -->|"posts verification"| node_pat
node_verifier -->|"reads design"| node_refactored_adl
node_agent -.->|"applies tools"| node_static_tools
node_agent -.->|"updates skills"| node_memory_skills
node_agent -.->|"records patterns"| node_memory_patterns
node_batch_runner -->|"records outcomes"| node_results

click node_requirements "https://github.com/jeffrey-0617/self-evolving-agent-for-refactoring/blob/main/wrighthashADL/new_clustered_requirements.xlsx"
click node_batch_runner "https://github.com/jeffrey-0617/self-evolving-agent-for-refactoring/blob/main/agents/run_clustered_requirements_batch_claude.py"
click node_agent "https://github.com/jeffrey-0617/self-evolving-agent-for-refactoring/blob/main/agents/refactoring_agent_claude_cli.py"
click node_subscription_agent "https://github.com/jeffrey-0617/self-evolving-agent-for-refactoring/blob/main/agents/refactoring_agent_subscription.py"
click node_adl_inputs "https://github.com/jeffrey-0617/self-evolving-agent-for-refactoring/tree/main/wrighthashADL"
click node_assertions "https://github.com/jeffrey-0617/self-evolving-agent-for-refactoring/blob/main/tmp/assertions.md"
click node_refactored_adl "https://github.com/jeffrey-0617/self-evolving-agent-for-refactoring/blob/main/tmp/refactored.adl"
click node_cold_skills "https://github.com/jeffrey-0617/self-evolving-agent-for-refactoring/tree/main/.claude/skills"
click node_memory_skills "https://github.com/jeffrey-0617/self-evolving-agent-for-refactoring/tree/main/Evolved_skills_memory/skills"
click node_memory_patterns "https://github.com/jeffrey-0617/self-evolving-agent-for-refactoring/tree/main/Evolved_skills_memory/Memory/patterns"
click node_static_tools "https://github.com/jeffrey-0617/self-evolving-agent-for-refactoring/tree/main/Evolved_skills_memory/tools"
click node_verifier "https://github.com/jeffrey-0617/self-evolving-agent-for-refactoring/blob/main/agents/verification/verify_wrighthash_all_properties.py"
click node_results "https://github.com/jeffrey-0617/self-evolving-agent-for-refactoring/tree/main/batch_results"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_agent,node_subscription_agent,node_adl_inputs,node_assertions,node_refactored_adl toneBlue
class node_cold_skills,node_memory_skills,node_memory_patterns,node_static_tools toneAmber
class node_verifier toneMint
class node_requirements,node_batch_runner,node_results toneRose
class node_user,node_claude,node_pat toneIndigo
```

## Components

### Refactoring workflow

- [Refactoring agent](https://github.com/jeffrey-0617/self-evolving-agent-for-refactoring/blob/main/agents/refactoring_agent_claude_cli.py): `agents/refactoring_agent_claude_cli.py`
- [Subscription agent](https://github.com/jeffrey-0617/self-evolving-agent-for-refactoring/blob/main/agents/refactoring_agent_subscription.py): `agents/refactoring_agent_subscription.py`
- [Wright# designs](https://github.com/jeffrey-0617/self-evolving-agent-for-refactoring/tree/main/wrighthashADL): `wrighthashADL`
- [Assertions](https://github.com/jeffrey-0617/self-evolving-agent-for-refactoring/blob/main/tmp/assertions.md): `tmp/assertions.md`
- [Refactored ADL](https://github.com/jeffrey-0617/self-evolving-agent-for-refactoring/blob/main/tmp/refactored.adl): `tmp/refactored.adl`

### Agent knowledge

- [Cold-start skills](https://github.com/jeffrey-0617/self-evolving-agent-for-refactoring/tree/main/.claude/skills): `.claude/skills`
- [Evolved skills](https://github.com/jeffrey-0617/self-evolving-agent-for-refactoring/tree/main/Evolved_skills_memory/skills): `Evolved_skills_memory/skills`
- [Memory patterns](https://github.com/jeffrey-0617/self-evolving-agent-for-refactoring/tree/main/Evolved_skills_memory/Memory/patterns): `Evolved_skills_memory/Memory/patterns`
- [Static analysis tools](https://github.com/jeffrey-0617/self-evolving-agent-for-refactoring/tree/main/Evolved_skills_memory/tools): `Evolved_skills_memory/tools`

### Verification

- [Property verifier](https://github.com/jeffrey-0617/self-evolving-agent-for-refactoring/blob/main/agents/verification/verify_wrighthash_all_properties.py): `agents/verification/verify_wrighthash_all_properties.py`

### Batch execution

- [Requirements workbook](https://github.com/jeffrey-0617/self-evolving-agent-for-refactoring/blob/main/wrighthashADL/new_clustered_requirements.xlsx): `wrighthashADL/new_clustered_requirements.xlsx`
- [Batch runner](https://github.com/jeffrey-0617/self-evolving-agent-for-refactoring/blob/main/agents/run_clustered_requirements_batch_claude.py): `agents/run_clustered_requirements_batch_claude.py`
- [Batch results](https://github.com/jeffrey-0617/self-evolving-agent-for-refactoring/tree/main/batch_results): `batch_results`

### Other components

- **Engineer**
- **Claude Code CLI**
- **PAT verifier service**

## Connections

- Engineer → Batch runner: starts batch
- Requirements workbook → Batch runner: supplies tasks
- Batch runner → Refactoring agent: dispatches task
- Engineer → Refactoring agent: provides requirement
- Engineer → Subscription agent: provides task
- Refactoring agent → Claude Code CLI: runs agent loop
- Subscription agent → Claude Code CLI: runs agent loop
- Wright# designs → Refactoring agent: provides design
- Assertions → Refactoring agent: provides properties
- Refactoring agent → Refactored ADL: writes design
- Cold-start skills → Refactoring agent: guides workflow
- Refactoring agent → Property verifier: verifies design
- Property verifier → PAT verifier service: posts verification
- Property verifier → Refactored ADL: reads design
- Refactoring agent → Static analysis tools: applies tools
- Refactoring agent → Evolved skills: updates skills
- Refactoring agent → Memory patterns: records patterns
- Batch runner → Batch results: records outcomes
