You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Phase 2 of the zeph-core decomposition (#3480). This epic tracks the actual creation of three sibling crates that the original issue proposed. It is blocked until Phase 1 (#3497) completes and the four hard prerequisites below are met.
Architecture plan: .local/plan/decompose-zeph-core.md §5 in branch refactor/3480-decompose-zeph-core-god-crate.
Why Phase 2 cannot happen now
Every targeted module (persistence.rs, tool_execution/native.rs, context/assembly.rs) is implemented as impl<C: Channel> Agent<C> blocks that access 25–98 private sub-state fields. tool_execution/native.rs touches 98 distinctself.X fields. Extracting them into sibling crates requires either:
making all sub-state fields pub (destroys every pub(super) invariant), or
a circular sibling → zeph-core::Agent → sibling dependency.
Neither is acceptable. The prerequisite is the Agent god-object decomposition (see §A1 TODO at crates/zeph-core/src/agent/mod.rs:159-175).
Hard prerequisites (ALL must be met before any Phase 2 PR)
P2-prereq-1: task_supervisor adoption reaches 100% in crates/zeph-core/src/agent/ (currently 2/15 = ~13%; 13 raw tokio::spawn sites remain)
zeph-core LoC drops below 30K (from ~79K post-Phase-1)
Three new sibling crates compile independently (cargo build -p zeph-agent-persistence etc. without zeph-core)
cargo build --timings shows measurable incremental rebuild improvement: edit to persistence.rs does not recompile tool_execution/ or context/assembly.rs
All existing tests pass
CI LoC gate ratcheted from 80K → 30K for zeph-core
Hand-off contract from Phase 1
Phase 1 (#3497) leaves the codebase in a state that makes Phase 2 mechanical:
Pure helpers already in zeph-context — Phase 2 doesn't re-touch them
zeph-agent-feedback already extracted — serves as the template for Phase 2 crate structure
Sub-state structs each in their own file (state/{message,memory,…}.rs) — easier to make pub with clear per-struct boundary
tool_execution/ and persistence/ grouped into per-phase files — easier to move whole files when Agent decomposition lands
CI LoC gate enforced at 80K — no regression possible during Phase 2 prep
SDD requirement
Before any Phase 2 implementation starts, create a spec entry under /specs/ for the Agent decomposition using /sdd. The spec must define:
The Services aggregator contract (what implementors must guarantee)
Context
Phase 2 of the zeph-core decomposition (#3480). This epic tracks the actual creation of three sibling crates that the original issue proposed. It is blocked until Phase 1 (#3497) completes and the four hard prerequisites below are met.
Architecture plan:
.local/plan/decompose-zeph-core.md§5 in branchrefactor/3480-decompose-zeph-core-god-crate.Why Phase 2 cannot happen now
Every targeted module (
persistence.rs,tool_execution/native.rs,context/assembly.rs) is implemented asimpl<C: Channel> Agent<C>blocks that access 25–98 private sub-state fields.tool_execution/native.rstouches 98 distinctself.Xfields. Extracting them into sibling crates requires either:pub(destroys everypub(super)invariant), orsibling → zeph-core::Agent → siblingdependency.Neither is acceptable. The prerequisite is the Agent god-object decomposition (see §A1 TODO at
crates/zeph-core/src/agent/mod.rs:159-175).Hard prerequisites (ALL must be met before any Phase 2 PR)
task_supervisoradoption reaches 100% incrates/zeph-core/src/agent/(currently 2/15 = ~13%; 13 rawtokio::spawnsites remain)msg, context_manager, persistencestays onAgentServicesaggregator —memory, learning, focus, sidequest, compression, mcp, index, security, orchestration, experimentsbehind aServicesstruct thatAgentborrowsAgentRuntimenewtype —runtime, lifecycle, providers, metrics, debug_state, instructionsTurnContextvalue type defined — a value type that survives boundary cuts betweenloop/compose/persistphasestask_supervisor.rsmigrates tozeph-common(deferred from Phase 1 row 14)Target crate map (after Phase 2)
zeph-agent-persistencePersistenceService, sanitize helpers, graph/persona/trajectory task enqueueing as fns taking&MemoryStatezeph-memory,zeph-db,zeph-llm,zeph-contextzeph-agent-toolsToolDispatcher, native dispatch, retry, confirmation, batch result processingzeph-tools,zeph-llm,zeph-mcp,zeph-skills,zeph-contextzeph-agent-contextzeph-contextin Phase 1zeph-context,zeph-memory,zeph-llm,zeph-skills,zeph-indexAcceptance Criteria
zeph-coreLoC drops below 30K (from ~79K post-Phase-1)cargo build -p zeph-agent-persistenceetc. withoutzeph-core)cargo build --timingsshows measurable incremental rebuild improvement: edit topersistence.rsdoes not recompiletool_execution/orcontext/assembly.rszeph-coreHand-off contract from Phase 1
Phase 1 (#3497) leaves the codebase in a state that makes Phase 2 mechanical:
zeph-context— Phase 2 doesn't re-touch themzeph-agent-feedbackalready extracted — serves as the template for Phase 2 crate structurestate/{message,memory,…}.rs) — easier to makepubwith clear per-struct boundarytool_execution/andpersistence/grouped into per-phase files — easier to move whole files when Agent decomposition landsSDD requirement
Before any Phase 2 implementation starts, create a spec entry under
/specs/for the Agent decomposition using/sdd. The spec must define:Servicesaggregator contract (what implementors must guarantee)TurnContextvalue type boundaryAgentRuntimenewtype interfaceBlocked by