Skip to content

[ahma_core] Extract agent loop and connection manager to core/mcp daemon#261

Merged
paulirotta merged 1 commit into
mainfrom
control-plane-redesign
Jun 16, 2026
Merged

[ahma_core] Extract agent loop and connection manager to core/mcp daemon#261
paulirotta merged 1 commit into
mainfrom
control-plane-redesign

Conversation

@paulirotta

Copy link
Copy Markdown
Owner

This PR implements Phase 1 and Phase 2 of the Control Plane Redesign plan:

1. Extract Agent Harness to Core (Phase 1)

  • Moved the execute_agent_turn loop and LLM communication out of ahma_tui/src/llm_bridge.rs into ahma_core/src/agent.rs.
  • Moved context trimming and token budget calculations.
  • Moved small-model hint injection (push_tool_message_with_hints, etc.).

2. Move MCP Client Management to Daemon (Phase 2)

  • Moved McpConnectionManager out of ahma_tui/src/mcp_connections.rs into ahma_mcp/src/mcp_client.rs.
  • Moved mcp.json IDE client config discovery to the daemon.
  • Wired background stdio/HTTP MCP client routing directly into ahma serve tool call dispatch (AhmaMcpService).
  • Added integration tests for daemon-level tool routing in ahma_mcp/tests/external_mcp_routing_test.rs.

3. Sandbox Project Auto-Scoping Fallback

  • Added sandbox auto-scoping in ahma_mcp/src/sandbox/core.rs (checking for .git, Cargo.toml, etc.) when no roots/list request is received from the client.

4. Code Quality

  • Cleaned up deprecated docs (harness-epoch.md, plan.md, refactor-ideas.md).
  • Addressed collapsible-if and too-many-arguments Clippy lints to ensure a clean warning-free build.

- Move agent execution loop from ahma_tui to ahma_core::agent (Phase 1)
- Move connection manager and discovery from ahma_tui to ahma_mcp::mcp_client (Phase 2)
- Wire routing of external tool calls (::) directly into AhmaMcpService
- Implement dynamic directory/project auto-scoping in Sandbox when no roots are received
- Clean up deprecated documentation and fix collapsible_if and too_many_arguments clippy lints
@paulirotta paulirotta merged commit 7481dbd into main Jun 16, 2026
12 checks passed
@paulirotta paulirotta deleted the control-plane-redesign branch June 16, 2026 14:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant