Alexander Payne
49ca4dad43
feat: Self-Edit MCP Tool (Phase 2.1)
Implements the Self-Edit MCP Tool that orchestrates the self-coding foundation:
## Core Features
1. **SelfEditTool** (src/tools/self_edit.py)
- Complete self-modification orchestrator
- Pre-flight safety checks (clean repo, on main branch)
- Context gathering (codebase indexer + modification journal)
- Feature branch creation (timmy/self-edit/{timestamp})
- LLM-based edit planning with fallback
- Safety constraint validation
- Aider integration (preferred) with fallback to direct editing
- Automatic test execution via pytest
- Commit on success, rollback on failure
- Modification journaling with reflections
2. **Safety Constraints**
- Max 3 files per commit
- Max 100 lines changed
- Protected files list (self-edit tool, foundation services)
- Only modify files with test coverage
- Max 3 retries on failure
- Requires user confirmation (MCP tool registration)
3. **Execution Backends**
- Aider integration: --auto-test --test-cmd pytest --yes --no-git
- Direct editing fallback: LLM-based file modification with AST validation
- Automatic backend selection based on availability
## Test Coverage
- 19 new tests covering:
- Basic functionality (initialization, preflight checks)
- Edit planning (with/without LLM)
- Safety validation (file limits, protected files)
- Execution flow (success and failure paths)
- Error handling (exceptions, LLM failures)
- MCP registration
## Usage
from tools.self_edit import register_self_edit_tool
from mcp.registry import tool_registry
# Register with MCP
register_self_edit_tool(tool_registry, llm_adapter)
Phase 2.2 will add Dashboard API endpoints and UI.
2026-02-26 12:28:05 -05:00
..
2026-02-24 16:48:14 +00:00
2026-02-26 08:30:04 -05:00
2026-02-19 19:05:01 +00:00
2026-02-25 07:57:28 -05:00
2026-02-24 23:36:50 +00:00
2026-02-21 12:57:38 -05:00
2026-02-26 09:11:48 -05:00
2026-02-22 14:04:20 +00:00
2026-02-24 16:48:14 +00:00
2026-02-24 16:31:47 +00:00
2026-02-21 16:53:16 +00:00
2026-02-26 09:35:59 -05:00
2026-02-26 09:35:59 -05:00
2026-02-25 01:11:14 +00:00
2026-02-24 18:29:21 +00:00
2026-02-26 11:08:05 -05:00
2026-02-26 11:08:05 -05:00
2026-02-24 18:29:21 +00:00
2026-02-24 16:31:47 +00:00
2026-02-24 16:31:47 +00:00
2026-02-24 16:31:47 +00:00
2026-02-25 19:18:08 -05:00
2026-02-25 01:11:14 +00:00
2026-02-22 19:01:04 -05:00
2026-02-24 23:36:50 +00:00
2026-02-26 08:01:01 -05:00
2026-02-25 20:22:51 -05:00
2026-02-25 20:22:51 -05:00
2026-02-26 11:08:05 -05:00
2026-02-26 11:08:05 -05:00
2026-02-24 16:31:47 +00:00
2026-02-24 16:31:47 +00:00
2026-02-25 20:22:51 -05:00
2026-02-21 12:57:38 -05:00
2026-02-21 12:57:38 -05:00
2026-02-22 22:04:37 +00:00
2026-02-26 08:01:01 -05:00
2026-02-22 20:20:11 -05:00
2026-02-24 23:36:50 +00:00
2026-02-25 19:59:42 -05:00
2026-02-25 19:59:42 -05:00
2026-02-22 20:48:14 -05:00
2026-02-22 16:21:32 -05:00
2026-02-26 11:08:05 -05:00
2026-02-24 16:31:47 +00:00
2026-02-24 16:48:14 +00:00
2026-02-21 12:57:38 -05:00
2026-02-19 19:05:01 +00:00
2026-02-26 11:08:05 -05:00
2026-02-25 19:43:43 -05:00
2026-02-25 19:43:43 -05:00
2026-02-24 23:36:50 +00:00
2026-02-25 18:07:44 -05:00
2026-02-26 17:06:00 +00:00
2026-02-26 02:07:54 -05:00
2026-02-24 12:58:19 -05:00
2026-02-26 11:08:05 -05:00
2026-02-26 12:28:05 -05:00
2026-02-25 17:23:47 -05:00
2026-02-25 19:18:08 -05:00
2026-02-21 12:57:38 -05:00
2026-02-24 16:31:47 +00:00
2026-02-24 15:51:15 +00:00
2026-02-25 17:28:41 -05:00
2026-02-24 18:29:21 +00:00
2026-02-24 22:25:04 +00:00
2026-02-21 12:57:38 -05:00
2026-02-24 16:31:47 +00:00
2026-02-22 16:21:32 -05:00
2026-02-25 07:20:56 -05:00
2026-02-22 20:20:11 -05:00
2026-02-22 12:21:50 +00:00
2026-02-21 12:57:38 -05:00
2026-02-26 11:47:34 -05:00
2026-02-22 17:16:12 +00:00
2026-02-24 17:18:29 +00:00
2026-02-22 19:01:04 -05:00
2026-02-24 23:36:50 +00:00
2026-02-22 20:33:26 -05:00
2026-02-26 08:01:01 -05:00
2026-02-24 16:31:47 +00:00
2026-02-21 13:45:24 -05:00
2026-02-21 12:57:38 -05:00
2026-02-24 23:36:50 +00:00
2026-02-24 23:36:50 +00:00
2026-02-21 16:36:56 +00:00
2026-02-25 07:57:28 -05:00
2026-02-25 07:57:28 -05:00
2026-02-26 10:27:08 -05:00
2026-02-25 02:08:02 -05:00