Skip to content

[Architecture] Thin CLI memory surface over shared memory application services #40

Description

@orenlab

[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

  1. Overloaded score 0.954, fan-out 29, unwind bottleneck candidate.
  2. Impact blast: high (via workflow.py dispatch and extensive CLI memory test suite).
  3. Module owns: memory_main, _dispatch_memory_command, trajectory/semantic/governance runners, store open helpers, observability wrapping.
  4. 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.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions