Skip to content

Comments

refactor(core): decompose agent.rs into module directory#276

Merged
bug-ops merged 2 commits intomainfrom
feat/m20/agent-decomposition
Feb 14, 2026
Merged

refactor(core): decompose agent.rs into module directory#276
bug-ops merged 2 commits intomainfrom
feat/m20/agent-decomposition

Conversation

@bug-ops
Copy link
Owner

@bug-ops bug-ops commented Feb 14, 2026

Summary

  • Split 4695-line agent.rs god object into 5 focused modules under agent/
  • 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")])
  • All methods remain on Agent<P,C,T> via impl blocks — zero API surface change
  • 1347 tests pass, clippy clean

Test plan

  • cargo nextest run --workspace --lib --bins — 1347 passed
  • cargo clippy --workspace -- -D warnings — zero warnings
  • Code review: approved (0 blockers)

Phase 1 of #268. Closes #269.

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
@bug-ops bug-ops enabled auto-merge (squash) February 14, 2026 19:10
@codecov-commenter
Copy link

Codecov Report

❌ Patch coverage is 59.76879% with 696 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
crates/zeph-core/src/agent/learning.rs 23.89% 360 Missing ⚠️
crates/zeph-core/src/agent/mcp.rs 11.79% 187 Missing ⚠️
crates/zeph-core/src/agent/context.rs 87.10% 130 Missing ⚠️
crates/zeph-core/src/agent/index.rs 48.64% 19 Missing ⚠️

❌ 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.

Impacted file tree graph

@@            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     
Files with missing lines Coverage Δ
crates/zeph-core/src/agent/mod.rs 78.97% <ø> (ø)
crates/zeph-core/src/agent/index.rs 48.64% <48.64%> (ø)
crates/zeph-core/src/agent/context.rs 87.10% <87.10%> (ø)
crates/zeph-core/src/agent/mcp.rs 11.79% <11.79%> (ø)
crates/zeph-core/src/agent/learning.rs 23.89% <23.89%> (ø)
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@bug-ops bug-ops merged commit 3bf8587 into main Feb 14, 2026
18 checks passed
@bug-ops bug-ops deleted the feat/m20/agent-decomposition branch February 14, 2026 19:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

R2: decompose agent.rs god object into module directory

2 participants