Skip to content

chore(cleanup): remove legacy MCP/CLI entry points + 6 orphaned backfill funcs (Bucket D / Option A)#176

Merged
thebtf merged 2 commits into
mainfrom
chore/remove-legacy-mcp-and-cli
Apr 16, 2026
Merged

chore(cleanup): remove legacy MCP/CLI entry points + 6 orphaned backfill funcs (Bucket D / Option A)#176
thebtf merged 2 commits into
mainfrom
chore/remove-legacy-mcp-and-cli

Conversation

@thebtf
Copy link
Copy Markdown
Owner

@thebtf thebtf commented Apr 16, 2026

What

Phase 1 of the v4.4.0 → revival cleanup. Bucket D, Option A from .agent/reports/cleanup-audit.md. After per-binary triage proved both engram-mcp and engram-cli are pre-v3.7.0 architecture stragglers and the plugin marketplace path uses cmd/engram (stdio proxy) exclusively, the user explicitly chose full snose over deprecation.

Removed source

  • cmd/mcp/ — legacy per-project MCP server (engram-mcp binary). Last touched 2026-03-19 (~4 weeks before this cleanup), not downloaded by plugin/engram/scripts/ensure-binary.js, not spawned by run-engram.js.
  • cmd/engram-cli/ — legacy backfill CLI. Last touched 2026-03-09 (~5 weeks). Not in Makefile / Dockerfile / goreleaser / install.sh. Sole consumer of internal/backfill.Runner.Run.
  • internal/backfill/import_feedback.go — entire file (held ImportFeedbackFiles + supporting types, all orphan after cmd/engram-cli removal).
  • 6 orphaned funcs/methods in internal/backfill/:
    • (*Runner).Run + (*Runner).processFile (CLI batch entry point)
    • extract.BuildUserPrompt + extract.BuildAlreadyExtracted
    • (*Metrics).Snapshot + SnapshotMetrics type

Updated release / build / install configs

File What changed
Dockerfile Removed engram-mcp build step + entire client image stage
Makefile Removed mcp target + 4 cross-compile entries + install cp + help entry
.goreleaser.yaml Removed both engram-mcp and engram-mcp-stdio-proxy build entries (~53 lines)
scripts/install.sh Removed 4 lines: 2 cp + 2 chmod for engram-mcp / engram-mcp-stdio-proxy
scripts/install.ps1 Removed 2 Copy-Item lines for engram-mcp.exe and engram-mcp-stdio-proxy.exe
docs/arch/COMPONENTS.md Removed bin/mcp-server + bin/mcp-stdio-proxy sections + diagram entries

Bonus fix

cmd/mcp-stdio-proxy/ source was already physically deleted at some prior point. The references in .goreleaser.yaml + install.sh + install.ps1 + COMPONENTS.md were broken-link orphans that silently failed during install (scripts/install.sh used 2>/dev/null || true). All four are now consistent — the source is gone and so are the references.

Live code that stays in internal/backfill

  • Runner struct + NewRunner + DefaultConfig
  • (*Runner).ProcessSession (the per-session API used by internal/worker/handlers_backfill.go HTTP route)
  • All extract / metrics / chunk / sanitize sub-packages still feed ProcessSession

So the HTTP backfill path stays fully functional — only the CLI batch entry point and the file-walker helpers were removed.

Verification

  • go build ./... — clean
  • go vet ./... — clean
  • go test ./... -count=1 — all packages green
  • staticcheck -checks=U1000 ./... — verified zero entries in internal/backfill/
  • deadcode -test ./... — entries dropped 69 → 52 (-17, matches what we removed)
  • Symbol-reference audit confirmed zero false positives — no symbol had a caller outside the file being edited

Subagent could not run bash -n install.sh locally due to a pre-existing CRLF line-ending issue on Windows; content correctness was verified via PowerShell instead. Linux CI will exercise the actual script syntax.

⚠️ BREAKING CHANGE

The engram-mcp and engram-mcp-stdio-proxy release artifacts are removed. Anyone using bare-metal install of these binaries must migrate to the plugin marketplace path:

/plugin marketplace add thebtf/engram-marketplace
/plugin install engram

Plugin users are unaffected — ensure-binary.js already downloads only the engram stdio-proxy binary, not engram-mcp.

This will be announced in the v4.5.0 release notes. Bumping to a new MINOR version because removing release artifacts is technically a breaking change for the install scripts, even though the canonical install path is unchanged.

Combined cleanup metrics across Buckets A + B + D

Metric On main (pre-cleanup) Now
deadcode -test ./... entries 80 52 (−28, −35%)
staticcheck -checks=U1000 ./... entries 19 ~11
Source files deleted 6 (3 graph + 2 cmd + 1 backfill)
LOC removed ~2 000+
Release artifacts removed 2 (engram-mcp, engram-mcp-stdio-proxy)

Phase 1 cleanup nearly complete. Bucket B-2 (db/gorm + moduletest + RateLimiter / TokenAuth / sessions/parser triage) remains as a follow-up, lower priority.

Summary by CodeRabbit

Release Notes

  • Chores

    • Удалены дополнительные MCP-ориентированные двоичные компоненты и связанный CLI-инструмент; сборка и инсталляция упрощены, остаётся только основной сервер
    • Обновлены процессы сборки/релиза и скрипты установки в соответствии с удалением этих компонентов
    • Docker-образ упрощён: теперь публикуется только серверный образ
  • Documentation

    • Обновлена архитектурная документация — удалены разделы о MCP-сервере и прокси

…kfill funcs

Phase 1 of the v4.4.0 -> revival cleanup. Bucket D from
.agent/reports/cleanup-audit.md. User chose Option A (full snose) after
triage proved both binaries are pre-v3.7.0 architecture stragglers and
the plugin marketplace path uses cmd/engram (stdio proxy) exclusively.

Deleted:
  - cmd/mcp/                       (legacy per-project MCP server, engram-mcp binary)
  - cmd/engram-cli/                (legacy backfill CLI, no Makefile/Dockerfile/goreleaser refs)
  - internal/backfill/backfill.go::Runner.Run + Runner.processFile
  - internal/backfill/import_feedback.go::ImportFeedbackFiles
  - internal/backfill/extract/extract.go::BuildUserPrompt + BuildAlreadyExtracted
  - internal/backfill/metrics/metrics.go::Metrics.Snapshot

Updated release/build/install configs:
  - Dockerfile             : removed engram-mcp build line + client image stage
  - Makefile               : removed engram-mcp targets (native + 3 cross-compile)
  - .goreleaser.yaml       : removed engram-mcp + engram-mcp-stdio-proxy build entries
  - scripts/install.sh     : removed engram-mcp + engram-mcp-stdio-proxy cp/chmod
  - scripts/install.ps1    : same treatment for the PowerShell installer
  - docs/arch/COMPONENTS.md: removed bin/mcp-server + bin/mcp-stdio-proxy sections

Note: cmd/mcp-stdio-proxy/ source was already physically deleted at some
prior point; these refs were broken-link orphans that silently failed
during install (install.sh used 2>/dev/null || true).

Live code that stays in internal/backfill:
  - Runner struct + NewRunner + DefaultConfig + Runner.ProcessSession
    (all called by internal/worker/handlers_backfill.go HTTP handler)

Verification:
  - go build ./...        clean
  - go vet ./...          clean
  - go test ./...         all packages green
  - staticcheck U1000     entries dropped
  - deadcode -test        entries dropped from 69 to 52
  - bash -n install.sh    pre-existing CRLF on Windows; content verified clean

BREAKING CHANGE: engram-mcp and engram-mcp-stdio-proxy release
artifacts removed. Anyone using bare-metal install of these binaries
must migrate to the plugin marketplace path. Plugin users are unaffected
(plugin downloads only the engram stdio-proxy binary). Will be
announced in v4.5.0 release notes.
@gemini-code-assist
Copy link
Copy Markdown

Warning

You have reached your daily quota limit. Please wait up to 24 hours and I will start processing your requests again!

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Apr 16, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: ef74542b-8b06-4ed0-a634-f4d9151333f7

📥 Commits

Reviewing files that changed from the base of the PR and between 41c6da1 and dac70ef.

📒 Files selected for processing (1)
  • .github/workflows/docker-publish.yml
💤 Files with no reviewable changes (1)
  • .github/workflows/docker-publish.yml

Walkthrough

PR удаляет двоичные цели MCP и связанный CLI/backfill код, а также их сборочные, docker- и install-артефакты и сопутствующую документацию; в релизной пайплайне и образах остаётся только engram-server.

Changes

Cohort / File(s) Summary
Сборка и образ
\.goreleaser.yaml, Dockerfile, .github/workflows/docker-publish.yml
Удалены конфигурации и артефакты сборки для engram-mcp и engram-mcp-stdio-proxy, включая cross-compile матрицы, клиентский Docker target и публикацию client образа.
Makefile & скрипты установки
Makefile, scripts/install.ps1, scripts/install.sh
Удалены цели/шаги сборки/установки mcp и связанные копирования бинарников; make-хелп/install больше не включают mcp.
Точки входа (binaries)
cmd/mcp/main.go, cmd/engram-cli/main.go
Полностью удалены entry-point файлы для MCP сервера и CLI (backfill/import CLI) с их логикой инициализации и запуска.
Backfill: логика и вспомогательные части
internal/backfill/backfill.go, internal/backfill/extract/extract.go, internal/backfill/import_feedback.go, internal/backfill/metrics/metrics.go
Удалены методы обработки файлов сессий, вспомогательные функции для сборки промптов и already-extracted блока, импорт feedback-файлов через LLM и экспортируемый снимок метрик (SnapshotMetrics).
Документация
docs/arch/COMPONENTS.md
Удалены описания bin/mcp-server и bin/mcp-stdio-proxy, а также ветвь диаграммы, где mcp-stdio-proxy посылает SSE в MCP.

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~60 minutes

Possibly related PRs

Poem

🐰 Я норку почистил, хвостик виляя,
MCP ушёл — осталось мало балласта,
Сервер один — путь лёгок и ясен,
Пусть код летит вперёд, в обновленья время,
Морковкой отмечаю новый старт! 🥕

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed Заголовок точно отражает основное изменение: удаление устаревших точек входа MCP/CLI и 6 функций обработки backfill.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch chore/remove-legacy-mcp-and-cli

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@Makefile`:
- Line 32: Update README.md and CONTRIBUTING.md to remove or correct statements
that "make build" builds MCP (references around the sections that currently
describe MCP being included), change any commands/examples that say to run `make
build` to obtain MCP, and replace them with the current build instructions or a
note about how MCP is built now (or where to find MCP build steps); search for
mentions of "MCP" and the Makefile target "build" and update the descriptive
text in those sections so docs no longer claim MCP is built by the `build`
target.

In `@scripts/install.ps1`:
- Around line 77-78: В скрипте scripts/install.ps1 операция Copy-Item для
engram-server.exe использует -ErrorAction SilentlyContinue which hides failures;
change it to fail fast (remove -ErrorAction SilentlyContinue or use -ErrorAction
Stop), then after the Copy-Item for "$TempDir\engram-server.exe" ->
"$InstallDir\" verify the file exists (check Test-Path
"$InstallDir\engram-server.exe") and, if missing, log an explicit error and exit
with non-zero code (e.g., write an error via Write-Error or use Exit 1) so the
installer cannot report success when the main binary wasn't copied.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 59480ae1-0653-4ae5-9717-d858bd247866

📥 Commits

Reviewing files that changed from the base of the PR and between 612a9cc and 41c6da1.

📒 Files selected for processing (12)
  • .goreleaser.yaml
  • Dockerfile
  • Makefile
  • cmd/engram-cli/main.go
  • cmd/mcp/main.go
  • docs/arch/COMPONENTS.md
  • internal/backfill/backfill.go
  • internal/backfill/extract/extract.go
  • internal/backfill/import_feedback.go
  • internal/backfill/metrics/metrics.go
  • scripts/install.ps1
  • scripts/install.sh
💤 Files with no reviewable changes (10)
  • internal/backfill/metrics/metrics.go
  • Dockerfile
  • .goreleaser.yaml
  • scripts/install.sh
  • internal/backfill/import_feedback.go
  • internal/backfill/backfill.go
  • docs/arch/COMPONENTS.md
  • cmd/mcp/main.go
  • internal/backfill/extract/extract.go
  • cmd/engram-cli/main.go

Comment thread Makefile

# Build all binaries
build: dashboard worker mcp
build: dashboard worker
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

Обновите документацию после удаления MCP из сборки.

После изменения на Line 32 make build больше не собирает MCP, но в README.md (Line 275-285) и CONTRIBUTING.md (Line 108-116) это всё ещё заявлено. Это будет путать пользователей.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@Makefile` at line 32, Update README.md and CONTRIBUTING.md to remove or
correct statements that "make build" builds MCP (references around the sections
that currently describe MCP being included), change any commands/examples that
say to run `make build` to obtain MCP, and replace them with the current build
instructions or a note about how MCP is built now (or where to find MCP build
steps); search for mentions of "MCP" and the Makefile target "build" and update
the descriptive text in those sections so docs no longer claim MCP is built by
the `build` target.

Comment thread scripts/install.ps1
Comment on lines +77 to 78
# Copy binaries
Copy-Item "$TempDir\engram-server.exe" "$InstallDir\" -Force -ErrorAction SilentlyContinue
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

Не подавляйте ошибку копирования основного бинарника.

На Line 78 используется -ErrorAction SilentlyContinue для engram-server.exe, из-за чего установка может завершиться с ложным успехом (см. Line 102), даже если бинарник не скопирован.

Предлагаемое исправление
-        Copy-Item "$TempDir\engram-server.exe" "$InstallDir\" -Force -ErrorAction SilentlyContinue
+        Copy-Item "$TempDir\engram-server.exe" "$InstallDir\" -Force -ErrorAction Stop
+        if (-not (Test-Path "$InstallDir\engram-server.exe")) {
+            throw "engram-server.exe не найден в $InstallDir после копирования"
+        }
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
# Copy binaries
Copy-Item "$TempDir\engram-server.exe" "$InstallDir\" -Force -ErrorAction SilentlyContinue
# Copy binaries
Copy-Item "$TempDir\engram-server.exe" "$InstallDir\" -Force -ErrorAction Stop
if (-not (Test-Path "$InstallDir\engram-server.exe")) {
throw "engram-server.exe не найден в $InstallDir после копирования"
}
🧰 Tools
🪛 PSScriptAnalyzer (1.25.0)

[warning] Missing BOM encoding for non-ASCII encoded file 'install.ps1'

(PSUseBOMForUnicodeEncodedFile)

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@scripts/install.ps1` around lines 77 - 78, В скрипте scripts/install.ps1
операция Copy-Item для engram-server.exe использует -ErrorAction
SilentlyContinue which hides failures; change it to fail fast (remove
-ErrorAction SilentlyContinue or use -ErrorAction Stop), then after the
Copy-Item for "$TempDir\engram-server.exe" -> "$InstallDir\" verify the file
exists (check Test-Path "$InstallDir\engram-server.exe") and, if missing, log an
explicit error and exit with non-zero code (e.g., write an error via Write-Error
or use Exit 1) so the installer cannot report success when the main binary
wasn't copied.

@thebtf thebtf merged commit 9eaa745 into main Apr 16, 2026
8 checks passed
@thebtf thebtf deleted the chore/remove-legacy-mcp-and-cli branch April 16, 2026 06:56
thebtf added a commit that referenced this pull request Apr 16, 2026
…REAKING)

Consolidates the BREAKING CHANGE from PR #176 (legacy MCP/CLI removal) with
two user-visible plugin tactical fixes into a single coherent v4.5.0 release.

## BREAKING CHANGES (carried over from PR #176)

The 'engram-mcp' and 'engram-mcp-stdio-proxy' release artifacts no longer
ship. Bare-metal users who installed via tarball or scripts/install.sh and
relied on the engram-mcp binary must migrate to the plugin marketplace
install path:

  /plugin marketplace add thebtf/engram-marketplace
  /plugin install engram

Plugin marketplace users are unaffected — ensure-binary.js downloads only
the 'engram' stdio-proxy binary, not engram-mcp. cmd/mcp/, cmd/engram-cli/,
the Dockerfile client image stage, the engram-mcp Makefile + goreleaser +
install.sh entries, and the bin/mcp-server / bin/mcp-stdio-proxy
COMPONENTS.md sections are all gone.

## Fix #1 — MCP startup reliability after CC plugin update

Smoking gun (.agent/reports/plugin-tactical-fix-triage.md): when CC updates
the plugin from v4.3.0 to v4.4.x it does NOT migrate plugin-level
user_config (server_url + api_token). .mcp.json then expands
${user_config.server_url} to an empty string, the binary spawns silently,
and every MCP tool call fails with an opaque gRPC dial error against an
empty target.

Fix:
  - plugin/engram/.mcp.json: env block now also passes
    "ENGRAM_URL_LEGACY": "${ENGRAM_URL}" so users who had ENGRAM_URL in
    their shell from the v4.3.0 setup still get a working MCP server.
  - plugin/engram/scripts/run-engram.js: before spawning, fall back to
    ENGRAM_URL_LEGACY if ENGRAM_URL is empty, AND emit a visible WARN to
    stderr if both are empty so the failure mode is no longer silent.

## Fix #2 — disable noisy context injection

Per .agent/reports/phase-2-synthesis.md fix #16 + the entity audits, the
session-start hook currently injects 100 raw observations unioned with 10
semantic hits, plus project briefing, plus learned guidance. Reported as
noise rather than relevant context.

plugin/engram/hooks/session-start.js now keeps the inject GET (still
needed for result.always_inject) but renders ONLY:
  - result.always_inject     -> <user-behavior-rules>
  - GET /api/issues          -> <engram-issues>
  - GET /api/issues resolved -> <engram-resolved-issues>

Skipped: result.observations / result.full_count / result.project_briefing
/ result.guidance. mark-injected scoped to always_inject IDs only so
citation tracking does not log false positives. Misleading observation-
count log line removed.

Save / recall MCP tools (recall_memory, store_memory, find_by_file,
observations, store, feedback, vault, issues) are completely independent
of this hook — separate gRPC path, unaffected.

This is tactical, NOT a redesign. Phase 2 strategic work continues:
citation session_id="" smoking gun, 100-obs cap policy, hook
curated-render redesign — all in .agent/reports/phase-2-synthesis.md.

## Version bump

Per Constitution §15 the daemon version and plugin version move together:
  - cmd/engram/main.go daemonVersion "v4.4.0" -> "v4.5.0"
  - plugin/engram/.claude-plugin/plugin.json "4.4.0" -> "4.5.0"

## Verification

  - JSON parse on .mcp.json + plugin.json: clean
  - node --check on run-engram.js + session-start.js: clean
  - go build ./... clean
  - 3-OS matrix CI green on the prior 4.4.1 commit (re-runs on amend)

## Files

  4 plugin/daemon files + 1 daemon version constant.
  Net: -76 LOC (mostly removed render blocks in session-start.js).
thebtf added a commit that referenced this pull request Apr 16, 2026
…REAKING) (#177)

Consolidates BREAKING from PR #176 + 2 plugin tactical fixes into v4.5.0.

BREAKING: 'engram-mcp' and 'engram-mcp-stdio-proxy' release artifacts no
longer ship. Bare-metal users migrate to plugin marketplace path.
Plugin marketplace users unaffected (ensure-binary.js downloads only the
'engram' stdio-proxy binary).

Fix #1 — MCP startup reliability after CC plugin update:
  - .mcp.json adds ENGRAM_URL_LEGACY = ${ENGRAM_URL} fallback
  - run-engram.js falls back if user_config-derived ENGRAM_URL is empty,
    + visible WARN to stderr if both empty (no more silent failure)

Fix #2 — Disable noisy context injection:
  - session-start.js keeps inject GET (still needed for always_inject)
    but renders ONLY result.always_inject + 2 issues fetches
  - Skipped: result.observations / result.full_count /
    result.project_briefing / result.guidance
  - mark-injected scoped to always_inject IDs only
  - All MCP save/recall tools unchanged (separate gRPC path)

Version bump per Constitution §15:
  - cmd/engram/main.go daemonVersion v4.4.0 -> v4.5.0
  - plugin/engram/.claude-plugin/plugin.json 4.4.0 -> 4.5.0

Phase 2 strategic redesign continues separately — see
.agent/reports/phase-2-synthesis.md for the 21-item fix priority matrix.
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.

1 participant