Skip to content

chore(plugin): v4.5.0 — restore MCP + disable noisy context inject (BREAKING)#177

Merged
thebtf merged 1 commit into
mainfrom
chore/plugin-tactical-fix-v4.4.1
Apr 16, 2026
Merged

chore(plugin): v4.5.0 — restore MCP + disable noisy context inject (BREAKING)#177
thebtf merged 1 commit into
mainfrom
chore/plugin-tactical-fix-v4.4.1

Conversation

@thebtf
Copy link
Copy Markdown
Owner

@thebtf thebtf commented Apr 16, 2026

v4.5.0 release

Consolidates the BREAKING CHANGE from PR #176 (legacy MCP/CLI removal) with two user-visible plugin tactical fixes into one coherent release. Single marketplace-sync cycle, single tag, single set of release notes.

⚠️ 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 unaffectedensure-binary.js downloads only the engram stdio-proxy binary, not engram-mcp.

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 userConfig (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.

Changes:

  • 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.

Field-level classification (kept verbatim from plugin-tactical-fix-triage.md):

Response field Was rendered as Now
result.observations / results <engram-context> DISABLED
result.full_count <engram-context> cutoff DISABLED
result.project_briefing <project-briefing> DISABLED
result.guidance <engram-guidance> DISABLED
result.always_inject <user-behavior-rules> KEPT
GET /api/issues (open) <engram-issues> KEPT
GET /api/issues (resolved) <engram-resolved-issues> KEPT

Changes in plugin/engram/hooks/session-start.js:

  • Removed render of <engram-context> (~lines 209-243), <project-briefing> (~245-248), <engram-guidance> (~251-273)
  • Kept the inject GET — result.always_inject lives in that response and we still render it
  • Scoped mark-injected API call to alwaysInject IDs only so citation tracking does not log false positives
  • Removed misleading log line that counted observations no longer rendered

Net diff in this hook: −91 lines.

What stays working (safety guarantees)

  • All MCP save/recall toolsrecall, recall_memory, store, store_memory, find_by_file, observations, feedback, vault, issues, etc. Separate gRPC path (internal/mcp/tools_*.go), zero coupling to inject hook.
  • Issues injection — separate /api/issues HTTP calls, untouched.
  • Behavioral rulesalways_inject tier still rendered.
  • Server-side code — only the plugin layer changed. No engram-server redeploy required.

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 version "4.4.0" → "4.5.0"

Verification

  • JSON syntax check on .mcp.json + plugin.json — clean
  • node --check on run-engram.js + session-start.js — clean
  • go build ./... — clean
  • 3-OS matrix CI re-runs on this amended commit

Out of scope (Phase 2 strategic work continues)

This is tactical only. Phase 2 redesign continues in parallel:

This PR keeps the user productive while that redesign happens.

Files in this PR

5 changed:

  • plugin/engram/.mcp.json
  • plugin/engram/scripts/run-engram.js
  • plugin/engram/hooks/session-start.js
  • plugin/engram/.claude-plugin/plugin.json
  • cmd/engram/main.go (daemonVersion bump)

Net −76 LOC (mostly removed render blocks).

Summary by CodeRabbit

Примечания к выпуску

  • New Features

    • Появляютcя диагностические предупреждения при отсутствии URL-конфигурации.
    • Добавлена поддержка резервного значения URL для обратной совместимости (ENGRAM_URL_LEGACY).
  • Chores

    • Обновлена версия плагина/демона с 4.4.0 до 4.5.0.
    • Упрощена логика формирования контекста сеанса: убраны разделы проектной памяти, брифинга и рекомендаций; сохраняются только правила поведения и блоки с проблемами.

@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

Walkthrough

Версия плагина engram обновлена с 4.4.0 до 4.5.0; добавлена переменная окружения ENGRAM_URL_LEGACY в MCP-конфигурацию; в session-start.js убрана логика сборки/рендеринга памяти проекта, брифинга и guidance; запуск run-engram.js теперь подтягивает ENGRAM_URL из ENGRAM_URL_LEGACY при необходимости.

Changes

Cohort / File(s) Summary
Манифест плагина
plugin/engram/.claude-plugin/plugin.json
Обновлён version с 4.4.0 на 4.5.0; удалён завершающий перевод строки.
MCP конфигурация
plugin/engram/.mcp.json
Добавлена переменная окружения ENGRAM_URL_LEGACY со значением ${ENGRAM_URL}; EOF-форматирование скорректировано.
Инициализация сессии
plugin/engram/hooks/session-start.js
Удалена трансформация/рендеринг project memory, project_briefing и guidance; теперь только логирование стратегии, рендер always_inject и отправка отметок об injected только для alwaysInject IDs.
Оболочка запуска engram
plugin/engram/scripts/run-engram.js
Добавлена логика fallback: при пустом ENGRAM_URL используется ENGRAM_URL_LEGACY; если по-прежнему пусто — выводится предупреждение в stderr; EOF-форматирование скорректировано.
Демон / версия
cmd/engram/main.go
Константа daemonVersion обновлена с v4.4.0 на v4.5.0, что влияет на логирование и snapshot-метаданные.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

Poem

🐰 Скачет версия, в путь — v4.5.0,
Наследный URL спрячу в карман.
Память уж короче, правила — в свет,
Запуск найдёт путь — не страшен дождь и мрак.
Плагин поёт: вперёд, ведь новый план!

🚥 Pre-merge checks | ✅ 1 | ❌ 2

❌ Failed checks (2 warnings)

Check name Status Explanation Resolution
Title check ⚠️ Warning The title references v4.5.0 but PR objectives document v4.4.1; version mismatch suggests title may not accurately reflect the actual changeset. Align the title version number with the actual version bump in the changeset (v4.4.1 vs v4.5.0) or clarify the intended release version.
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (1 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.

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

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch chore/plugin-tactical-fix-v4.4.1

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: 1

🧹 Nitpick comments (1)
plugin/engram/hooks/session-start.js (1)

196-199: Следующий шаг: урезать payload на уровне API, а не только рендер.

Сейчас ненужные поля всё ещё тянутся по сети. Имеет смысл добавить server-side фильтрацию секций (например, only always_inject) для снижения latency/нагрузки.

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

In `@plugin/engram/hooks/session-start.js` around lines 196 - 199, В коде плагина
(plugin/engram/hooks/session-start.js) нужно не только отключить рендеринг
<engram-context>, <project-briefing> и <engram-guidance>, но и отфильтровать их
на стороне API при формировании payload: измените логику, которая собирает ответ
для "inject GET" (использует result.always_inject) чтобы исключать ненужные
секции из исходящего JSON, оставляя только элементы с result.always_inject ===
true; обновите соответствующую сборку ответа/функцию формирования payload в том
же файле чтобы эти поля не передавались по сети и добавьте/обновите тесты или
контракт ответа, подтверждающие что отключённые теги полностью удаляются из
API-ответа.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@plugin/engram/scripts/run-engram.js`:
- Around line 27-34: The current check uses !process.env.ENGRAM_URL which treats
strings of only whitespace as truthy; update the logic where
process.env.ENGRAM_URL/ENGRAM_URL_LEGACY are handled so you normalize and test
for non-empty trimmed values (use process.env.ENGRAM_URL &&
process.env.ENGRAM_URL.trim().length or equivalent) before assigning or deciding
the warning path; specifically change the assignment/fallback and the subsequent
emptiness check that writes to process.stderr to use trimmed checks on
process.env.ENGRAM_URL and process.env.ENGRAM_URL_LEGACY so whitespace-only
values trigger the fallback and WARNING correctly.

---

Nitpick comments:
In `@plugin/engram/hooks/session-start.js`:
- Around line 196-199: В коде плагина (plugin/engram/hooks/session-start.js)
нужно не только отключить рендеринг <engram-context>, <project-briefing> и
<engram-guidance>, но и отфильтровать их на стороне API при формировании
payload: измените логику, которая собирает ответ для "inject GET" (использует
result.always_inject) чтобы исключать ненужные секции из исходящего JSON,
оставляя только элементы с result.always_inject === true; обновите
соответствующую сборку ответа/функцию формирования payload в том же файле чтобы
эти поля не передавались по сети и добавьте/обновите тесты или контракт ответа,
подтверждающие что отключённые теги полностью удаляются из API-ответа.
🪄 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: c190796d-a6df-40a1-ab6b-79987b5deea2

📥 Commits

Reviewing files that changed from the base of the PR and between 612a9cc and 73f95a0.

📒 Files selected for processing (4)
  • plugin/engram/.claude-plugin/plugin.json
  • plugin/engram/.mcp.json
  • plugin/engram/hooks/session-start.js
  • plugin/engram/scripts/run-engram.js

Comment on lines +27 to +34
if (!process.env.ENGRAM_URL && process.env.ENGRAM_URL_LEGACY) {
process.env.ENGRAM_URL = process.env.ENGRAM_URL_LEGACY;
}

// Visible diagnostic: warn to stderr if both ended up empty so the user has a signal,
// not a silent gRPC dial failure on every tool call.
if (!process.env.ENGRAM_URL) {
process.stderr.write(
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

Усилите проверку “пустого” URL (пробелы сейчас проходят).

Сейчас !process.env.ENGRAM_URL не ловит значения вида " ", из-за чего fallback и WARN могут быть пропущены.

Предлагаемый патч
-if (!process.env.ENGRAM_URL && process.env.ENGRAM_URL_LEGACY) {
-  process.env.ENGRAM_URL = process.env.ENGRAM_URL_LEGACY;
+const currentUrl = (process.env.ENGRAM_URL || "").trim();
+const legacyUrl = (process.env.ENGRAM_URL_LEGACY || "").trim();
+
+if (!currentUrl && legacyUrl) {
+  process.env.ENGRAM_URL = legacyUrl;
 }
 
 // Visible diagnostic: warn to stderr if both ended up empty so the user has a signal,
 // not a silent gRPC dial failure on every tool call.
-if (!process.env.ENGRAM_URL) {
+if (!(process.env.ENGRAM_URL || "").trim()) {
   process.stderr.write(
📝 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
if (!process.env.ENGRAM_URL && process.env.ENGRAM_URL_LEGACY) {
process.env.ENGRAM_URL = process.env.ENGRAM_URL_LEGACY;
}
// Visible diagnostic: warn to stderr if both ended up empty so the user has a signal,
// not a silent gRPC dial failure on every tool call.
if (!process.env.ENGRAM_URL) {
process.stderr.write(
const currentUrl = (process.env.ENGRAM_URL || "").trim();
const legacyUrl = (process.env.ENGRAM_URL_LEGACY || "").trim();
if (!currentUrl && legacyUrl) {
process.env.ENGRAM_URL = legacyUrl;
}
// Visible diagnostic: warn to stderr if both ended up empty so the user has a signal,
// not a silent gRPC dial failure on every tool call.
if (!(process.env.ENGRAM_URL || "").trim()) {
process.stderr.write(
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@plugin/engram/scripts/run-engram.js` around lines 27 - 34, The current check
uses !process.env.ENGRAM_URL which treats strings of only whitespace as truthy;
update the logic where process.env.ENGRAM_URL/ENGRAM_URL_LEGACY are handled so
you normalize and test for non-empty trimmed values (use process.env.ENGRAM_URL
&& process.env.ENGRAM_URL.trim().length or equivalent) before assigning or
deciding the warning path; specifically change the assignment/fallback and the
subsequent emptiness check that writes to process.stderr to use trimmed checks
on process.env.ENGRAM_URL and process.env.ENGRAM_URL_LEGACY so whitespace-only
values trigger the fallback and WARNING correctly.

…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 thebtf force-pushed the chore/plugin-tactical-fix-v4.4.1 branch from 73f95a0 to d14ddd1 Compare April 16, 2026 07:02
@thebtf thebtf changed the title chore(plugin): tactical fix v4.4.1 — restore MCP + disable noisy context inject chore(plugin): v4.5.0 — restore MCP + disable noisy context inject (BREAKING) Apr 16, 2026
@thebtf thebtf merged commit 648ae09 into main Apr 16, 2026
7 of 8 checks passed
@thebtf thebtf deleted the chore/plugin-tactical-fix-v4.4.1 branch April 16, 2026 07:06
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