diff --git a/.github/workflows/deploy-docs.yml b/.github/workflows/deploy-docs.yml index dcd75c5..0f49eb9 100644 --- a/.github/workflows/deploy-docs.yml +++ b/.github/workflows/deploy-docs.yml @@ -6,6 +6,9 @@ on: paths: - 'apps/docs/**' - 'src/tools/definitions.ts' + # The docs changelog is generated from the root CHANGELOG.md at build time, + # so a release that only touches the changelog must still redeploy the docs. + - 'CHANGELOG.md' workflow_dispatch: jobs: diff --git a/apps/docs/content/docs/changelog.mdx b/apps/docs/content/docs/changelog.mdx index d093300..9bd3722 100644 --- a/apps/docs/content/docs/changelog.mdx +++ b/apps/docs/content/docs/changelog.mdx @@ -3,48 +3,422 @@ title: Changelog description: GitMem release history. --- +{/* GENERATED FILE — do not edit. Source: CHANGELOG.md at the repo root. */} +{/* Regenerate with: npm run generate:changelog (from apps/docs/) */} + # Changelog -## v1.0.2 (2026-02-15) +## v1.7.0 (2026-08-07) + +**No destructive changes, no data loss, no migration.** But if you start seeing errors after +upgrading, those failures were occurring before and being reported as success. 1.7.0 makes them +visible. + +That is the whole shape of this release. The response contracts changed — new refusal semantics on +dedup, hard errors on sessionless Pro writes, `success: false` closes, a third cache-health status — +so a write that quietly did nothing now says so. Nothing that worked before stops working. + +### Fixed + +- **`create_learning` silently dropped fields for most learning types.** `applies_when` was assigned + only inside the `win` branch, so every scar, pattern and anti-pattern since 2026-02-03 had the + field validated, acknowledged, and discarded. `problem_context` and `solution_approach` had the + identical defect at the identical site, and `anti_pattern` had no branch at all, reaching the row + with no severity. All four are fixed together, guarded by a parameterized test asserting that + every schema-accepted field persists to the stored row for every learning type. Nineteen affected + records were recovered from session transcripts and row-verified. (GIT-76) +- **`session_close` could fail to persist against a correctly-provisioned store.** The upsert payload + was built by spreading the existing session record, which on the Supabase-miss path is the local + file record — a different shape, carrying rendering fields the table does not define. One unknown + key failed the entire close, so a fresh Pro install could not close its first session. The payload + is now filtered to the table's known columns, which fixes the shape-drift class rather than the one + field that surfaced it. (GIT-74) +- **`syncThreadsToSupabase` created duplicate threads at session close.** An unordered 200-row dedup + window silently truncated the candidate set, so a text-matching thread outside the window fell + through to "genuinely new" and was created again. The candidate load is now deterministically + ordered and complete. (GIT-70) +- **Thread scope was resolved four different ways.** `session_start`'s panel, `list_threads`, + `resolve_thread` and dedup candidate selection each implemented their own view, which is how a + `weekend_warrior` thread appeared in a `gitmem` session panel while `list_threads` correctly + excluded it. All four now import one resolver. (GIT-69) +- **Session identity survives an MCP server restart**, instead of the enforcement layer reporting + "No active session" while the process kept serving. (GIT-51) +- **Write tools no longer fabricate IDs for writes that did not land.** With no active session or an + unreachable store, `create_thread` returns an unambiguous failure with no minted ID, rather than a + success payload and an enforcement banner in the same response. (GIT-67, GIT-63) + +### Changed + +- **Scar surfacing is tiered by confidence.** Recall renders a stub below 0.55, a compact body from + 0.55 to 0.75, an extended body at 0.75 or for the top hit, and the full body for + blocking-verification scars regardless of score. Measured against the real corpus: high-yield + recall dropped from 2565 to 487 tokens (81%), low-yield from 246 to 115 (53%). The citation line, + the acknowledge line that drives `confirm_scars`, and one footer were deliberately left in place — + they are load-bearing, and trimming honesty to hit a round number is the metric becoming the + target. (GIT-74, GIT-50) +- **One citation rule, every surface.** `recall`, `search`, `prepare_context` and the compact hook + path had four separately-drifting copies. They now share one constant — and the two surfaces that + instructed agents to cite record IDs while rendering none now render them, because an instruction + ships only where the capability to obey it does. (GIT-74) +- **Compact renderings show honest fields or nothing.** The one-line lesson is drawn from + `why_this_matters` and `applies_when`; when neither exists the tier is the header alone. The + previous first-sentence-of-description heuristic rendered provenance metadata or an echoed title + about as often as a lesson, and a fragment that looks like a judgment is worse than an absent line. + +### Known gaps + +Consumer verification for three fixes (GIT-67, GIT-69, GIT-70) is deferred to 1.7.1 and tracked in +GIT-83. The test environment is provisioned and standing; the deferral is scope discipline, not an +unknown. + + +## v1.6.6 (2026-06-27) + +### Changed +- **`recall` stubs low-confidence scars to cut wasted tokens**: scars scoring below the `0.55` similarity threshold (already flagged `[low confidence]`, ~66% N/A rate in that band) now render as a one-line stub — title, severity, score, short id, and the `[low confidence]` tag — instead of hydrating their full body (description, counter-arguments, applies-when, why-this-matters, action-protocol, self-check, related triples). High-confidence scars (≥ 0.55) are unchanged, and blocking-verification scars always render in full regardless of score. The `0.55` cutoff is now a single named constant (`LOW_CONFIDENCE_THRESHOLD`) shared by the tag and the stub so they can't drift apart. The scar's id stays visible, so an agent can still pull detail on demand. (GIT-49) + +## v1.6.5 (2026-06-27) + +### Fixed +- **`resolve_thread` can now resolve threads created by other sessions**: `list_threads` reads the Supabase source-of-truth, but `resolve_thread` previously matched only the local/session cache — so a thread created by another session showed up in `list_threads` yet returned "Thread not found" when you tried to resolve it. These "visible-but-unresolvable" threads piled up across sessions. `resolve_thread` now falls back to looking the thread up in Supabase (by ID, or by text for `text_match`) before failing, resolves it in the source-of-truth, and syncs the local cache. (GIT-46) + +## v1.6.4 (2026-06-11) + +### Fixed +- **Init wizard upgrades stale configs**: Running `npx gitmem-mcp@latest init` on a project with an existing gitmem config now detects `"gitmem-mcp"` without `@latest` in the args and upgrades it in-place. Previously it skipped with "already configured" and left the stale reference untouched. + +## v1.6.3 (2026-06-11) + +### Fixed +- **Stale npx cache**: All MCP server configs now use `gitmem-mcp@latest` instead of `gitmem-mcp`. Without `@latest`, npx can serve a cached older version indefinitely — the `-y` flag only auto-confirms prompts, it does not force a registry check. Affects: init wizard, configure command, README, docs, and distribution configs. + +## v1.6.2 (2026-06-11) + +### Fixed +- **`archive_learning` short-ID resolution**: Accepts 8-character ID prefixes (e.g., `6edd41e6`) in addition to full UUIDs, matching the short IDs shown by `recall` and `search`. + +### Added +- **Write-path health check**: New startup diagnostic detects two silent failure classes — (1) Supabase credentials present but tier resolved to FREE (writes go to local files instead of Supabase), and (2) pro/dev tier but resolved tables don't exist (prefix mismatch). Logs a loud warning at startup instead of failing silently on the first write. +- **`GITMEM_TABLE_PREFIX` documentation**: Pro setup guide now documents custom table prefix configuration, mismatch symptoms, and troubleshooting steps. + +## v1.6.1 (2026-05-25) + +### Fixed +- **Embeddings not generated on Pro tier**: `embedding.ts`, `variant-generation.ts`, and `transcript-chunker.ts` only checked `process.env.OPENROUTER_API_KEY` — never read the key from `.gitmem/config.json` written by `activate`. Now falls back to `getProConfig()` matching how `supabase-client.ts` already resolves credentials. +- **Lossy free→pro migration**: Migration sent all local JSON fields to PostgREST — unknown columns caused 400 rejections, silently dropping records (only first 3 errors shown). Added `KNOWN_COLUMNS` whitelist per table, type coercion for `action_protocol`/`self_check_criteria` (array→TEXT), and full error visibility (no cap). +- **Migration log file**: `.gitmem/migration.log` now written with per-record outcomes (OK/FAIL/SKIP) for debugging. +- **Mid-migration recovery**: `activate` now detects `.pre-migration` backup files from a previous failed upgrade and re-imports them automatically. No new command — just re-run `activate`. +- **Credential exposure**: `activate` now auto-adds `.gitmem/` to the project's `.gitignore` when inside a git repo. + +### Changed +- **E2E stress test v1.4**: Restructured from 6 to 8 simulated days. Day 0 wipes Supabase to blank slate. Day 1 seeds realistic 3+ month free-tier user data (starter scars, unknown fields, type mismatches, mixed projects) and tests full upgrade journey including mid-failure recovery and real embeddings from config.json (not env var). 178 tests total. + +## v1.6.0 (2026-05-25) + +### Added +- **Free→Pro migration**: Running `activate` with existing local `.gitmem/` data automatically migrates learnings, sessions, decisions, and scar usage to Supabase. Local files are archived with `.pre-migration` suffix. +- **Schema auto-apply via DATABASE_URL**: `activate` now falls back to direct Postgres connection when `SUPABASE_ACCESS_TOKEN` is unavailable, using `DATABASE_URL` from env, config, or interactive prompt. + +### Fixed +- **Idempotent schema SQL**: `setup.sql` now uses `CREATE TABLE IF NOT EXISTS`, `CREATE OR REPLACE`, and `DO $$ ... END $$` guards throughout — safe to re-run for upgrades without errors. + +## v1.5.1 (2026-05-13) + +### Fixed +- **CI smoke test tool count**: Updated `EXPECTED_TOOL_COUNTS` to reflect `index_docs` and `search_docs` additions (+2 per tier). The 1.5.0 release failed to publish because the smoke test expected 23 free-tier tools but found 25. + +## v1.5.0 (2026-05-11) + +### Added +- **`index_docs` tool**: Scan a directory of markdown files, chunk them, and store in a local doc index for semantic search. Supports incremental indexing (only re-processes changed files), force re-index, and project-scoped indexes. Aliases: `gitmem-idx`. +- **`search_docs` tool**: Search indexed repository documentation using semantic similarity (pro tier) or BM25 keyword search (free tier). Returns relevant chunks with file paths for targeted reading. Aliases: `gitmem-sd`. +- **Citation protocol**: `recall`, `search`, and `prepare_context` now include a citation rule instructing agents to cite record IDs when referencing facts from institutional memory. +- **Low confidence tagging**: Recall and search results with similarity below 0.55 are tagged `[low confidence]` — these matches have a 66% N/A rate historically. +- **Session duration on resume**: `session_start` now shows elapsed session time and loaded scar count when resuming or refreshing an existing session. + +### Changed +- **Quick close hard gate**: `session_close` with `close_type: "quick"` now rejects sessions over 30 minutes, requiring standard close instead. +- **Standard close recall gate**: `session_close` with `close_type: "standard"` now requires at least one `recall()` call during the session (exemptions: quick close, autonomous agents, sessions with inline reflection). + +## v1.4.4 (2026-03-31) + +### Fixed +- **Project drift on session resume eliminated**: When resuming an existing session (same hostname+PID), the stored project now overrides whatever the agent passes. Previously, context compaction could cause agents to send the wrong project (e.g., `orchestra_dev` instead of `weekend_warrior`), creating a session under the wrong project with wrong threads and decisions. The active-sessions registry already stored the correct project — it just wasn't used on resume. +- **`closing_reflection` array coercion**: Values passed as arrays in `closing_reflection` are now coerced to strings, preventing schema validation errors on session close. +- **`create_thread` no longer triggers false enforcement warnings**: Removed from `CONSEQUENTIAL_TOOLS` list — creating threads is lightweight and shouldn't require prior recall. + +## v1.4.3 (2026-02-24) + +### Fixed +- **NULL agent values in query metrics eliminated**: `recordMetrics()` now auto-detects agent via `getAgentIdentity()` when callers don't provide it. Previously 15 of 18 tools omitted the agent field, resulting in NULL values in `gitmem_query_metrics`. + +### Performance +- **session_start ~200-300ms faster**: Sessions and threads queries now run in parallel (`Promise.all`) instead of sequentially inside `loadLastSession`. +- **session_close transcript upload no longer blocks**: Transcript save moved from blocking `await` to fire-and-forget via effect tracker. Removes 500-5000ms variable cost from `latency_ms`. Claude session ID extraction remains synchronous. + +## v1.4.2 (2026-02-22) + +### Fixed +- **Scar usage `execution_successful` nulls eliminated**: N_A confirmations now record `true` (was null/undefined). Q6 text matches now include `execution_successful: true` (was omitted). Fixes 80% null rate in scar effectiveness data. +- **Auto-bridge fires on all session closes**: Previously required Q6 `scars_applied` to be non-empty. Now fires whenever no explicit `scars_to_record` is provided, ensuring confirmations from `confirm_scars` always get recorded. +- **Surfaced scars survive MCP restart**: `getSurfacedScars()` now recovers from the active-sessions registry when `currentSession` is null after MCP restart. Scars surfaced early in a session are no longer silently lost. +- **Session close display shows scar titles**: `reference_context` now leads with the scar title instead of boilerplate. Display uses +/! indicators for applied/refuted scars. + +## v1.4.1 (2026-02-22) + +### Added +- **AGENTS.md generation**: Init wizard now creates an IDE-agnostic `AGENTS.md` file alongside the client-specific instructions file. Contains tool table, core workflow, sub-agent patterns (`prepare_context`, `absorb_observations`), and example JSON tool calls. Read by Codex, Copilot, Gemini, Cursor, and other AI coding assistants for automatic project discovery. + +## v1.4.0 (2026-02-22) + +### Changed +- **Starter scar penalty doubled** (0.7x → 0.4x): Earned scars now decisively outrank starter scars in recall and search results. 6 community reports of starter scars drowning out project-specific lessons. +- **Display protocol footer trimmed**: Removed the "Success: You echoed..." line from the display suffix — reduced noise without losing the echo instruction. +- **First-recall message rewritten**: Replaced patronizing welcome text with actionable nudge: "No project-specific lessons yet. Use create_learning to capture your first." +- **Session close description simplified**: Tool descriptions now clearly present two modes (inline params or payload file) instead of demanding the file-first approach. + +### Added +- **Thread positional resolve (`#N`)**: `resolve_thread` now accepts `#3` to resolve the 3rd thread in display order. Matches the `#` column shown by `list_threads`. +- **Thread ID column in list_threads**: Thread table now shows short IDs (e.g., `t-24aefd13`) alongside positional numbers — agents can reference by either. +- **Provenance `[starter]` tag**: Recall and search results now annotate starter scars with a dim `[starter]` tag, so agents can distinguish earned vs bundled lessons. +- **Inline `closing_reflection` parameter**: `session_close` schema now exposes `closing_reflection` and `human_corrections` as direct parameters — no payload file needed for simple closes. + +### Fixed +- **`log` tool missing `anti_pattern` type**: TypeScript type for `learning_type` filter excluded `"anti_pattern"`, causing type errors when filtering by anti-patterns. + +## v1.3.5 (2026-02-22) + +### Fixed +- **Free tier recall→confirm_scars flow broken**: Recall on free tier returned scars to the agent but never tracked them in session state, causing confirm_scars to respond with "No recall-surfaced scars to confirm" even when valid confirmations were submitted. Reported across 3 clean room sessions. -### Features +### Added +- **E2E regression test for recall→confirm_scars**: Verifies the full free tier flow — create scar, recall it, confirm it — catches the session state tracking gap. -- **`npx gitmem-mcp init`** — Interactive setup wizard that detects existing config, prompts, and merges without destroying anything. Replaces the multi-step manual setup. - - 6 steps: memory store, MCP server, CLAUDE.md, permissions, hooks, gitignore - - Flags: `--yes` (non-interactive), `--dry-run` (preview), `--project ` - - Idempotent — re-running safely skips completed steps -- **`npx gitmem-mcp uninstall`** — Clean reversal of everything init did. Memory data (`.gitmem/`) preserved by default, `--all` to also delete. +## v1.3.4 (2026-02-22) + +### Added +- **Expanded starter scar pack** (7 → 12): Five new community-proposed scars covering multi-agent delegation, memory hygiene, and communication patterns. +- **Closing payload pre-seeded during init**: `closing-payload.json` template created at install time, preventing Write permission prompt on first session close. +- **`contribute_feedback` tool**: Agents can submit anonymous feedback (feature requests, bugs, friction) to help improve gitmem. + +### Fixed +- **`is_active` filter for free tier**: `list()` now treats missing `is_active` as `true` instead of filtering out all learnings without the field. +- **`learning_type` in recall results**: Recall now returns `learning_type` in search results so agents can distinguish scars from wins and patterns. +- **Explicit `is_active: true` on learning creation**: New learnings are created with `is_active: true` to prevent filter mismatches. + +## v1.3.1 (2026-02-22) + +### Fixed +- **Archived learnings excluded from free tier search/log**: `keywordSearch` and `log` on the free tier (local JSON storage) now filter out `is_active === false` learnings, matching pro tier behavior. + +### Changed +- **Removed uninstall line from init success footer**: Cleaner post-install output. + +## v1.3.0 (2026-02-22) + +### Added +- **Expanded starter scars** (3 → 7): New scars covering testing, config drift, dependency management, and root-cause debugging. +- **Real UUIDs on starter scars**: Replaced placeholder `00000000-*` IDs with real v4 UUIDs — fixes 8-char prefix matching in `confirm_scars`. +- **First-recall welcome message**: When all recall results are starter scars, shows "This is your first recall — results will get more relevant as you add your own lessons." +- **Starter thread**: Fresh installs get a welcome thread nudging users to add their first project-specific scar. +- **Clean room Dockerfile for local builds**: `testing/clean-room/Dockerfile.local` for testing local tarballs. + +### Fixed +- **Enforcement false positives**: `recall()` returning 0 scars no longer triggers "No recall() was run" warning. Tracks `recallCalled` boolean independently of result count. +- **Init wizard brand styling**: Unified color system and ripple branding in both init and uninstall wizards. + +### Changed +- **Clean room Dockerfiles**: Updated npm to latest to suppress upgrade nag during testing. + +## v1.2.1 (2026-02-21) + +### Added +- **MCP Registry metadata**: Added `mcpName` field to package.json and `server.json` for official MCP Registry listing. + +## v1.2.0 (2026-02-20) + +### Added +- **Telemetry CLI**: `npx gitmem-mcp telemetry` command for viewing scar effectiveness metrics and recall statistics. +- **Confirm-scars prefix matching**: `confirm_scars` now accepts 8-character ID prefixes instead of requiring full UUIDs — faster agent workflows. +- **Session-close timing**: `session_close` now tracks and reports ceremony duration for performance visibility. + +### Fixed +- **Test assertion alignment**: Updated smoke and E2E test assertions to match current CLI output format (branded `((●))` display, lowercase identifiers). +- **No-console-log allowlist**: CLI commands correctly excluded from console.log lint rule. + +## v1.1.4 (2026-02-20) + +### Changed +- **Recall default switched to c-review**: Production nudge header changed from "INSTITUTIONAL MEMORY ACTIVATED" to "N scars to review". Nudge-bench testing (54 runs × 3 models) showed 89% scar reference rate vs 44% — a 2x improvement across Opus, Sonnet, and Haiku. + +### Fixed +- **Thread display cleanup**: Removed internal thread IDs from `list_threads` output. Threads now show `# | Thread | Active` — IDs were implementation detail with no user value. + +## v1.1.3 (2026-02-19) + +### Added +- **Multi-client init wizard**: `npx gitmem-mcp init` now supports VS Code, Windsurf, and generic MCP clients in addition to Claude Code and Cursor. +- **Server-side enforcement layer**: Universal compliance enforcement that works across all MCP clients — recall before consequential actions, scar confirmation gates. +- **Scar framing guidance**: `create_learning` tool now guides agents to frame scars as "what we now know" (factual discovery) rather than "what I did wrong" (self-criticism). +- **Auto-detect agent and session**: Scar usage tracking automatically detects the current agent identity and session context. +- **Closing payload schema**: Session close payload schema now ships with `init` and `session_start` for client reference. +- **npm discoverability keywords**: Added `mcp-server`, `claude-code`, `ai-memory`, `ai-agent` keywords for npm search. +- **Documentation site**: + - Restored Fumadocs source for gitmem.ai/docs with emerald theme. + - Redesigned docs landing page with improved messaging and branding. + - Added FAQ page with 11 questions. + - Added MCP one-liner explainer for new users. + - Added 3 docs examples (scar stories): credential leak, phantom deploy, and first scar. + - Inline mailing list signup form in docs pages. + - Rich installation page with multi-client instructions. + +### Fixed +- **Thread display output**: `list_threads` and `cleanup_threads` replaced ASCII box-drawing tables with markdown tables. Thread text truncation increased from 40-48 to 60 characters. Output now renders cleanly in all MCP clients instead of clipping on narrow terminals. +- **Version reporting**: Server now reads version from `package.json` instead of hardcoded `1.0.3`. +- **Log header clarity**: `gitmem log` header now says "most recent learnings" instead of ambiguous label. +- **Analyze output**: Relabeled misleading "Open Threads" to "Threads Referenced" in analyze output. +- **Stale thread cleanup**: Drop stale local-only threads on `session_start` when Supabase is authoritative source. +- **Package name in docs**: Corrected to `npx gitmem-mcp init` (was `npx gitmem init`). +- **Docs fixes**: Removed duplicate h1 headers, fixed sidebar nav duplicate entry, corrected GitHub URLs after org migration. + +## v1.1.2 (2026-02-17) + +### Changed +- **Repository migration**: Moved from `nTEG-dev/gitmem` to `gitmem-dev/gitmem`. All references updated. + +### Added +- **OpenClaw distribution**: SKILL.md and listing materials for OpenClaw skill directory. + +## v1.1.1 (2026-02-17) + +### Removed +- **Dead dependency `@huggingface/transformers`**: Massive package (ONNX runtime + model files) was declared as a runtime dependency but never imported anywhere. Embedding service uses raw `fetch()` to external APIs. Shipped unused since initial release, bloating every `npx gitmem-mcp` install. + +### Added +- **CI dependency audit**: `depcheck` now runs in CI pipeline. Unused runtime dependencies will fail the build. This gap allowed the dead dependency to ship through 15+ versions undetected. + +## v1.1.0 (2026-02-17) + +### Added +- **Cursor IDE support**: `npx gitmem-mcp init` auto-detects Cursor projects (`.cursor/` directory) and generates Cursor-specific config: `.cursor/mcp.json`, `.cursorrules`, `.cursor/hooks.json` with camelCase event names. Also supports `--client cursor` flag for explicit selection. +- **Cursor uninstall**: `npx gitmem-mcp uninstall` cleanly removes gitmem from Cursor config while preserving user hooks, other MCP servers, and existing `.cursorrules` content. +- **Cursor clean room testing**: Docker container (`Dockerfile.cursor`) with Cursor CLI v2026.02.13 + gitmem for end-to-end validation. Includes comprehensive test plan (16 tests across 3 phases). +- **34 new E2E tests**: Cross-tool Cursor integration tests covering init/uninstall for both clients, idempotency, content isolation, and edge cases. +- **454 new unit tests**: Confirm-scars rejection rate tests, recall threshold tests. + +### Fixed +- **Confirm-scars rejection rate**: Reduced false rejections by improving scar matching tolerance. +- **Recall relevance threshold**: Added minimum relevance floor to reduce noise in recall results. +- **Recall nudge**: Improved guidance when recall returns low-relevance results. + +### Validated +- Independent Cursor AI agent scored gitmem **88% (18.5/21)** across 7 test scenarios run 3 times each. Verdict: "GitMem is a must-have." ([OD-695](https://linear.app/nteg-labs/issue/OD-695), [OD-696](https://linear.app/nteg-labs/issue/OD-696), [OD-697](https://linear.app/nteg-labs/issue/OD-697), [OD-698](https://linear.app/nteg-labs/issue/OD-698) filed from findings.) + +## v1.0.15 (2026-02-16) + +### Fixed +- **Thread dedup without API key**: Dedup silently fell back to exact text match when no embedding API key (OpenAI/OpenRouter/Ollama) was set — which is the default for free tier users. Near-duplicate threads with the same topic but different wording slipped through. Added zero-dependency token overlap coefficient as a middle tier (threshold 0.6, lowered to 0.4 when threads share an issue prefix like `OD-692:`). Also upgraded `deduplicateThreadList` with the same logic. +18 unit tests. + +## v1.0.12 (2026-02-16) + +### Fixed +- **Table prefix for pro tier**: `getTableName()` was resolving to `gitmem_*` tables for pro tier, but those tables don't exist yet. All tiers now default to `orchestra_` prefix until schema migration is complete. + +### Changed +- **Dynamic table names**: Replaced all hardcoded `orchestra_*` table name strings across 22 source files with `getTableName()` calls, making table prefixes configurable via `GITMEM_TABLE_PREFIX` env var. +- **Release status script**: Added `npm run release-status` to check unpublished commits vs npm. + +## v1.0.11 (2026-02-16) + +### Changed +- **CI pipeline cleanup**: `build` script is now just `tsc` (was `tsc && npm run test:unit`). Tests ran 8x per CI run due to `build`, `test`, and `prepublishOnly` all triggering the same 764-test suite. Now each step does one thing: typecheck, compile, test, smoke, publish. + +## v1.0.10 (2026-02-16) + +### Fixed +- **CI smoke test**: `session_close` test looked for `active-sessions.json` at `process.cwd()` instead of `GITMEM_DIR`, failing in CI where they differ. +- **CI peer dependencies**: Added `--legacy-peer-deps` to `npm ci` for `zod@4` conflict with `claude-agent-sdk`. +- **CI unit test**: `quick-retrieve.test.ts` now sets `GITMEM_DIR` so disk cache tests resolve correctly in CI. + +## v1.0.9 (2026-02-16) + +### Fixed +- **Closing payload field name mismatch**: `CLAUDE.md.template` documented wrong field names (`institutional_memory` instead of `institutional_memory_items`, bogus `started_at`/`completed_at` in task_completion) causing agents to write payloads that `session_close` couldn't parse. Fixed template and added `institutional_memory` as normalizer alias. +- **Missing Q8/Q9 in closing template**: Added `collaborative_dynamic` and `rapport_notes` fields to payload example. + +## v1.0.6 (2026-02-16) + +### Fixed +- **Session close crash on malformed scars_to_record**: Agents writing `{title, description, severity}` (create_learning shape) instead of `{scar_identifier, reference_type, reference_context}` (ScarUsageEntry shape) in closing payload caused `Cannot read properties of undefined (reading 'length')` crash in `formatCloseDisplay`. Now auto-coerces salvageable entries and drops invalid ones with warnings. +- **Defensive property access in formatCloseDisplay**: Guard against undefined `scar_identifier`, `reference_type`, and `reference_context` as belt-and-suspenders protection. + +## v1.0.3 (2026-02-15) + +### Changed +- **Tool alias consolidation**: Reduced advertised tools from 55 to 20 (free tier). Aliases still work when called directly. Set `GITMEM_FULL_ALIASES=1` to restore all. +- **Starter scars reduced**: Ship with 3 high-quality starter scars instead of 12. Starter scars deprioritized with 0.7x score multiplier so earned scars outrank them. +- **Recall similarity threshold**: Weak matches below threshold (0.4 BM25, 0.35 embeddings) are suppressed. Empty results show helpful guidance instead of noise. +- **Adaptive session closing**: Auto-detects ceremony level (micro/standard/full) based on session activity. Removed hard rejection gate that blocked standard closes on short sessions. +- **Scar relevance feedback**: Optional `relevance` field (high/low/noise) on `confirm_scars` for recall quality improvement. Defaults derived from decision type. +- **Pro tier messaging**: Rewritten from agent's perspective with concrete value propositions. + +### Added +- **Agent briefing**: Generates `.gitmem/agent-briefing.md` at session close with memory state summary for MEMORY.md bridge. +- **PMEM/GitMem boundary docs**: README section documenting how GitMem complements MEMORY.md/cursorrules. + +## v1.0.2 (2026-02-15) -### Docs +### Fixed +- **Free tier crash**: `markSessionSuperseded` called Supabase without `hasSupabase()` guard +- **Session close UX**: Write health block only shown when failures exist (was always visible) +- **E2E test suite**: Updated for display protocol changes (session_id extraction, display format assertions, recall display text, CLAUDE.md template wording) -- Updated README to feature one-command setup, added gitmem.ai link -- Updated docs site installation and getting-started pages +## v1.0.0 (2026-02-10) -## v1.0.1 (2026-02-14) +### Added +- **Hooks plugin bundled**: `gitmem install-hooks` / `uninstall-hooks` CLI commands +- **CLI `check` command wired**: `gitmem check` now reachable from CLI (was defined but unreachable) +- **Fresh-install E2E tests**: 16 integration tests covering CLI commands, hooks, and MCP server lifecycle +- **README rewrite**: External-developer-facing docs with no internal jargon +- **CONTRIBUTING.md**: Dev setup, testing tiers, and PR guidelines +- **First public npm release** -### Bug Fixes +### Changed +- Package name standardized to `gitmem-mcp` for npm +- `gitmem configure` output uses `gitmem-mcp` (matching npm package name) +- Removed internal project defaults from CLI commands -- Fixed stdout corruption — 22 `console.log` calls replaced with `console.error` in check.ts -- Error messages now surface in `create_learning` and `record_scar_usage` responses via `errors[]` array -- Session ID validation added to `session_close` — returns clear error with UUID format example instead of confusing DB lookup failure -- Removed hardcoded project enum — project names are now free-form strings +## v0.2.0 (2026-02-08) -### Tests +### Added +- **Full monorepo sync**: Standalone repo is now source of truth +- **Zod schemas**: 14 schema files for all tool parameter validation (`src/schemas/`) +- **Diagnostics suite**: Health checks, channel instrumentation, anonymization (`src/diagnostics/`) +- **Single source of truth constants**: Closing questions defined once (`src/constants/closing-questions.ts`) +- **Multi-agent tools**: `prepare_context` and `absorb_observations` +- **Tool definitions module**: Centralized tool registration (`src/tools/definitions.ts`) +- **Commands module**: `gitmem check` CLI health diagnostics (`src/commands/check.ts`) +- **Full test suite**: 354+ unit tests across 20 test files, plus integration, e2e, and performance benchmarks +- **Vitest configs**: Separate configs for unit, integration, e2e, and performance tests +- **Compliance validator warnings**: Q3/Q5 substantive answers warn if no learnings created -- +2 regression tests for stdout purity -- +8 tests for error message surfacing -- +10 tests for session ID validation +### Fixed +- **Critical**: GitMem now loads ALL learning types (scars, patterns, wins, anti-patterns) instead of just scars +- Closing reflection schema now includes Q7 (`institutional_memory_items`) field -## v1.0.0 (2026-02-15) +### Changed +- `build` script now runs unit tests after compilation (`tsc && npm run test:unit`) +- Version bumped to 0.2.0 to reflect full feature parity with monorepo -### Initial Release +## v0.1.0 (2026-02-03) -- 23 core tools (free tier) / 29 tools (pro tier) -- Session management with closing ceremony -- Scar recall with semantic search -- Thread tracking across sessions -- Multi-agent context injection -- Knowledge graph traversal -- Local `.gitmem/` storage (free) or Supabase (pro) -- Claude Code hooks for automatic session management -- 660+ automated tests across 6 tiers +### Added +- Initial MCP server implementation +- Predict tool (scar search with temporal decay) +- Session lifecycle (session_start, session_close) +- Learning capture (scars, wins, patterns) +- Decision logging +- Scar usage tracking +- Local vector search with OpenRouter embeddings +- Cache management (status, flush, health) +- Agent identity detection diff --git a/apps/docs/package.json b/apps/docs/package.json index db87743..6ca1003 100644 --- a/apps/docs/package.json +++ b/apps/docs/package.json @@ -4,9 +4,10 @@ "private": true, "scripts": { "dev": "next dev", - "build": "npm run generate:tools && npm run generate:llms && next build", + "build": "npm run generate:tools && npm run generate:changelog && npm run generate:llms && next build", "start": "next start", "generate:tools": "tsx scripts/generate-tool-docs.ts", + "generate:changelog": "tsx scripts/generate-changelog.ts", "generate:llms": "tsx scripts/generate-llms-txt.ts" }, "dependencies": { diff --git a/apps/docs/scripts/generate-changelog.ts b/apps/docs/scripts/generate-changelog.ts new file mode 100644 index 0000000..0cd2c41 --- /dev/null +++ b/apps/docs/scripts/generate-changelog.ts @@ -0,0 +1,118 @@ +#!/usr/bin/env tsx +/** + * Generate the docs changelog page from the root CHANGELOG.md + * + * The root CHANGELOG.md is the single source of truth — it is updated as part of + * every release. This script derives content/docs/changelog.mdx from it so the + * published changelog can never drift from the released one. + * + * Transforms applied: + * - Drops the Keep a Changelog preamble (everything before the first version) + * - Drops the [Unreleased] section (not yet shipped, so not public history) + * - Rewrites `## [1.7.0] - 2026-08-07` headings to `## v1.7.0 (2026-08-07)` + * - Strips trailing link-reference definitions (`[1.0.0]: https://...`) + * - Escapes MDX-hazardous characters outside code spans and fences + * + * Run: npm run generate:changelog (from apps/docs/) + */ + +import { readFileSync, writeFileSync } from "node:fs"; +import { join, dirname } from "node:path"; +import { fileURLToPath } from "node:url"; + +const __dirname = dirname(fileURLToPath(import.meta.url)); +const CHANGELOG_PATH = join(__dirname, "../../../CHANGELOG.md"); +const OUTPUT_PATH = join(__dirname, "../content/docs/changelog.mdx"); + +const FRONTMATTER = `--- +title: Changelog +description: GitMem release history. +---`; + +const GENERATED_NOTICE = + "{/* GENERATED FILE — do not edit. Source: CHANGELOG.md at the repo root. */}\n" + + "{/* Regenerate with: npm run generate:changelog (from apps/docs/) */}"; + +/** `## [1.7.0] - 2026-08-07` (the date is optional in older entries) */ +const VERSION_HEADING = /^##\s+\[([^\]]+)\](?:\s+-\s+(\S+))?\s*$/; +/** `[1.0.0]: https://github.com/...` */ +const LINK_DEFINITION = /^\[[^\]]+\]:\s+\S+\s*$/; + +/** + * MDX parses `{` as an expression and `<` as JSX, so a changelog entry containing + * either outside of code would fail the docs build. Escape them, but leave fenced + * blocks and inline code spans untouched — they are already inert in MDX. + */ +function escapeForMdx(body: string): string { + const lines = body.split("\n"); + let inFence = false; + + return lines + .map((line) => { + if (/^\s*(```|~~~)/.test(line)) { + inFence = !inFence; + return line; + } + if (inFence) return line; + + // Split on inline code spans so only the prose between them is escaped. + return line + .split(/(`[^`]*`)/g) + .map((segment) => + segment.startsWith("`") && segment.endsWith("`") && segment.length > 1 + ? segment + : segment.replace(/[{}<]/g, (char) => `\\${char}`) + ) + .join(""); + }) + .join("\n"); +} + +function generate(): void { + const raw = readFileSync(CHANGELOG_PATH, "utf8"); + const lines = raw.split("\n"); + + const out: string[] = []; + let started = false; + let skippingUnreleased = false; + let versionCount = 0; + + for (const line of lines) { + const heading = line.match(VERSION_HEADING); + + if (heading) { + const [, version, date] = heading; + + if (version.toLowerCase() === "unreleased") { + skippingUnreleased = true; + continue; + } + + started = true; + skippingUnreleased = false; + versionCount += 1; + out.push(date ? `## v${version} (${date})` : `## v${version}`); + continue; + } + + // Everything before the first version heading is Keep a Changelog boilerplate. + if (!started || skippingUnreleased) continue; + if (LINK_DEFINITION.test(line)) continue; + + out.push(line); + } + + if (versionCount === 0) { + throw new Error( + `No version headings found in ${CHANGELOG_PATH}. Expected entries like "## [1.7.0] - 2026-08-07".` + ); + } + + const body = escapeForMdx(out.join("\n").trim()); + const contents = `${FRONTMATTER}\n\n${GENERATED_NOTICE}\n\n# Changelog\n\n${body}\n`; + + writeFileSync(OUTPUT_PATH, contents, "utf8"); + console.log(`✅ changelog.mdx generated — ${versionCount} versions from CHANGELOG.md`); +} + +generate();