[Architecture] Thin CLI memory surface over shared memory application services
Labels: enhancement, architecture, cli, memory
Priority: P2 (architecture triage)
Subject: codeclone/surfaces/cli/memory.py
Signal: responsibility_overload
Triage run: e28867ed (health 91/A)
Summary
codeclone/surfaces/cli/memory.py is a large CLI orchestration stack (argparse, observability, governance, trajectory, semantic, jobs) parallel to MCP’s _session_memory_mixin over the same codeclone.memory.* backends.
Environment
- Product/Service: CodeClone
- Version: 2.1.0a1 (run
e28867ed)
- Area: CLI memory commands + Engineering Memory
Current State
- Overloaded score 0.954, fan-out 29, unwind bottleneck candidate.
- Impact blast: high (via
workflow.py dispatch and extensive CLI memory test suite).
- Module owns:
memory_main, _dispatch_memory_command, trajectory/semantic/governance runners, store open helpers, observability wrapping.
- MCP counterpart:
codeclone/surfaces/mcp/_session_memory_mixin.py orchestrates the same memory backends via tools.
Expected Behavior
CLI memory commands should be thin adapters: parse argv → call shared memory application services → render via memory_render / trajectory/cli_render. Policy stays in codeclone.memory.governance, ide_governance, retrieval, ingest — not duplicated in the CLI surface.
Actual Behavior
One CLI module concentrates transport parsing and multi-lane command orchestration (records, trajectories, semantic rebuild, governance break-glass, jobs). New codeclone memory … subcommands expand the same overloaded surface rather than shared services.
Impact
Medium — No functional regression identified; risk is contract drift between CLI memory commands and MCP memory tools as both surfaces grow.
Proposed Direction
- Identify orchestration duplicated with
_session_memory_mixin (search, init, trajectory status, semantic rebuild) and extract shared application functions under codeclone.memory or codeclone.memory.cli_service (name TBD).
- Keep CLI-specific concerns (argparse, console output, break-glass flags) in
surfaces/cli/memory.py.
- Pattern reference:
surfaces/cli/blast_radius.py delegates computation to codeclone.analysis.blast_radius.
Additional Context
- Architecture triage score: C+D → 25 (P2).
- Governance paths intentionally differ (CLI break-glass vs MCP IDE governance channel) — do not collapse those policies; reduce orchestration duplication only.
- Tests:
tests/test_memory_cli*.py, tests/test_cli_memory_*.py.
[Architecture] Thin CLI memory surface over shared memory application services
Labels:
enhancement,architecture,cli,memoryPriority: P2 (architecture triage)
Subject:
codeclone/surfaces/cli/memory.pySignal:
responsibility_overloadTriage run:
e28867ed(health 91/A)Summary
codeclone/surfaces/cli/memory.pyis a large CLI orchestration stack (argparse, observability, governance, trajectory, semantic, jobs) parallel to MCP’s_session_memory_mixinover the samecodeclone.memory.*backends.Environment
e28867ed)Current State
workflow.pydispatch and extensive CLI memory test suite).memory_main,_dispatch_memory_command, trajectory/semantic/governance runners, store open helpers, observability wrapping.codeclone/surfaces/mcp/_session_memory_mixin.pyorchestrates the same memory backends via tools.Expected Behavior
CLI memory commands should be thin adapters: parse argv → call shared memory application services → render via
memory_render/trajectory/cli_render. Policy stays incodeclone.memory.governance,ide_governance, retrieval, ingest — not duplicated in the CLI surface.Actual Behavior
One CLI module concentrates transport parsing and multi-lane command orchestration (records, trajectories, semantic rebuild, governance break-glass, jobs). New
codeclone memory …subcommands expand the same overloaded surface rather than shared services.Impact
Medium — No functional regression identified; risk is contract drift between CLI memory commands and MCP memory tools as both surfaces grow.
Proposed Direction
_session_memory_mixin(search, init, trajectory status, semantic rebuild) and extract shared application functions undercodeclone.memoryorcodeclone.memory.cli_service(name TBD).surfaces/cli/memory.py.surfaces/cli/blast_radius.pydelegates computation tocodeclone.analysis.blast_radius.Additional Context
tests/test_memory_cli*.py,tests/test_cli_memory_*.py.