refactor(core): decompose agent.rs into module directory#276
Merged
Conversation
Split 4695-line agent.rs god object into 5 focused modules: - mod.rs: Agent struct, core loop, builders (~2338 LOC) - context.rs: compaction, pruning, recall, summaries (~1383 LOC) - learning.rs: self-learning, reflection, skill improvement (~681 LOC) - mcp.rs: MCP commands, tool sync (~271 LOC, feature-gated) - index.rs: code RAG retrieval (~71 LOC, feature-gated) All methods remain on Agent<P,C,T> via impl blocks in submodules. No API surface change. Zero test regressions (1347 passed). Closes #269
Codecov Report❌ Patch coverage is ❌ Your patch status has failed because the patch coverage (59.76%) is below the target coverage (60.00%). You can increase the patch coverage or adjust the target coverage. @@ Coverage Diff @@
## main #276 +/- ##
==========================================
- Coverage 81.15% 81.14% -0.01%
==========================================
Files 83 87 +4
Lines 24552 24556 +4
==========================================
+ Hits 19924 19926 +2
- Misses 4628 4630 +2
🚀 New features to boost your workflow:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
agent.rsgod object into 5 focused modules underagent/mod.rs: Agent struct, core loop, builders (~2338 LOC)context.rs: compaction, pruning, recall, summaries (~1383 LOC)learning.rs: self-learning, reflection, skill improvement (~681 LOC)mcp.rs: MCP commands, tool sync (~271 LOC,#[cfg(feature = "mcp")])index.rs: code RAG retrieval (~71 LOC,#[cfg(feature = "index")])Agent<P,C,T>viaimplblocks — zero API surface changeTest plan
cargo nextest run --workspace --lib --bins— 1347 passedcargo clippy --workspace -- -D warnings— zero warningsPhase 1 of #268. Closes #269.