-
Notifications
You must be signed in to change notification settings - Fork 1
Open
Labels
area/contextContext engine: manager, pipeline, firewallContext engine: manager, pipeline, firewallcomplexity/complexCross-cutting, significant design or riskCross-cutting, significant design or riskenhancementNew feature or requestNew feature or requestmilestone/v0.2.1priority/mediumMedium priority — production readinessMedium priority — production readiness
Description
Context
src/contextweaver/context/manager.py is currently 724 lines (was 642 before #100). The project guideline targets ≤300 lines per module (except __main__.py). This has been a pre-existing issue that grew further with the progressive disclosure feature.
Raised during review of #100 — extracting just the drilldown methods (~37 lines) wouldn't meaningfully address the problem, so a broader decomposition is needed.
Current responsibilities in ContextManager
| Section | Approx lines | Candidate module |
|---|---|---|
Ingestion helpers (ingest_tool_result, ingest_mcp_result, add_context_item) |
~120 | context/ingest.py |
Episodic memory (add_episode, add_episode_sync) |
~40 | context/episodic.py or inline in store |
Drilldown (drilldown, drilldown_sync) |
~65 | context/drilldown.py |
Core pipeline (_build, build, build_sync) |
~200 | stays in manager.py |
Properties + __init__ |
~50 | stays in manager.py |
Acceptance criteria
-
manager.py≤ 300 lines (or as close as practical) - Extracted modules are self-contained with clear interfaces
- No public API changes —
ContextManagerstill exposes all current methods - All existing tests pass without modification (or with minimal import-path updates)
-
make cipasses
Constraints
- Zero runtime dependencies
- Extracted helpers may receive manager internals as parameters (artifact_store, event_log, estimator, etc.)
- Prefer composition over mixins — keep inheritance simple
- Each new module ≤ 300 lines
Related
- feat: progressive disclosure for tool results — view registry + drilldown loop #100 — PR that prompted this discussion
- [context] Progressive disclosure for tool results — view registry + drilldown loop #17 — progressive disclosure feature that added drilldown methods
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
area/contextContext engine: manager, pipeline, firewallContext engine: manager, pipeline, firewallcomplexity/complexCross-cutting, significant design or riskCross-cutting, significant design or riskenhancementNew feature or requestNew feature or requestmilestone/v0.2.1priority/mediumMedium priority — production readinessMedium priority — production readiness