memory-bank-skill 3.0.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (82) hide show
  1. memory_bank_skill-3.0.0/.gitignore +39 -0
  2. memory_bank_skill-3.0.0/CHANGELOG.md +278 -0
  3. memory_bank_skill-3.0.0/LICENSE +21 -0
  4. memory_bank_skill-3.0.0/PKG-INFO +458 -0
  5. memory_bank_skill-3.0.0/README.md +419 -0
  6. memory_bank_skill-3.0.0/SKILL.md +231 -0
  7. memory_bank_skill-3.0.0/VERSION +1 -0
  8. memory_bank_skill-3.0.0/adapters/_lib_agents_md.sh +220 -0
  9. memory_bank_skill-3.0.0/adapters/cline.sh +229 -0
  10. memory_bank_skill-3.0.0/adapters/codex.sh +161 -0
  11. memory_bank_skill-3.0.0/adapters/cursor.sh +209 -0
  12. memory_bank_skill-3.0.0/adapters/git-hooks-fallback.sh +235 -0
  13. memory_bank_skill-3.0.0/adapters/kilo.sh +121 -0
  14. memory_bank_skill-3.0.0/adapters/opencode.sh +220 -0
  15. memory_bank_skill-3.0.0/adapters/pi.sh +171 -0
  16. memory_bank_skill-3.0.0/adapters/windsurf.sh +242 -0
  17. memory_bank_skill-3.0.0/agents/mb-codebase-mapper.md +316 -0
  18. memory_bank_skill-3.0.0/agents/mb-doctor.md +184 -0
  19. memory_bank_skill-3.0.0/agents/mb-manager.md +367 -0
  20. memory_bank_skill-3.0.0/agents/plan-verifier.md +127 -0
  21. memory_bank_skill-3.0.0/commands/adr.md +47 -0
  22. memory_bank_skill-3.0.0/commands/api-contract.md +64 -0
  23. memory_bank_skill-3.0.0/commands/catchup.md +12 -0
  24. memory_bank_skill-3.0.0/commands/changelog.md +12 -0
  25. memory_bank_skill-3.0.0/commands/commit.md +21 -0
  26. memory_bank_skill-3.0.0/commands/contract.md +43 -0
  27. memory_bank_skill-3.0.0/commands/db-migration.md +66 -0
  28. memory_bank_skill-3.0.0/commands/doc.md +19 -0
  29. memory_bank_skill-3.0.0/commands/done.md +6 -0
  30. memory_bank_skill-3.0.0/commands/mb.md +846 -0
  31. memory_bank_skill-3.0.0/commands/observability.md +75 -0
  32. memory_bank_skill-3.0.0/commands/plan.md +135 -0
  33. memory_bank_skill-3.0.0/commands/pr.md +14 -0
  34. memory_bank_skill-3.0.0/commands/refactor.md +17 -0
  35. memory_bank_skill-3.0.0/commands/review.md +131 -0
  36. memory_bank_skill-3.0.0/commands/security-review.md +91 -0
  37. memory_bank_skill-3.0.0/commands/start.md +7 -0
  38. memory_bank_skill-3.0.0/commands/test.md +17 -0
  39. memory_bank_skill-3.0.0/docs/MIGRATION-v1-v2.md +161 -0
  40. memory_bank_skill-3.0.0/docs/cross-agent-setup.md +302 -0
  41. memory_bank_skill-3.0.0/docs/install.md +124 -0
  42. memory_bank_skill-3.0.0/docs/release-process.md +122 -0
  43. memory_bank_skill-3.0.0/docs/repo-migration.md +125 -0
  44. memory_bank_skill-3.0.0/hooks/block-dangerous.sh +109 -0
  45. memory_bank_skill-3.0.0/hooks/file-change-log.sh +108 -0
  46. memory_bank_skill-3.0.0/hooks/mb-compact-reminder.sh +72 -0
  47. memory_bank_skill-3.0.0/hooks/session-end-autosave.sh +95 -0
  48. memory_bank_skill-3.0.0/install.sh +947 -0
  49. memory_bank_skill-3.0.0/memory_bank_skill/__init__.py +3 -0
  50. memory_bank_skill-3.0.0/memory_bank_skill/__main__.py +6 -0
  51. memory_bank_skill-3.0.0/memory_bank_skill/_bundle.py +48 -0
  52. memory_bank_skill-3.0.0/memory_bank_skill/cli.py +272 -0
  53. memory_bank_skill-3.0.0/pyproject.toml +124 -0
  54. memory_bank_skill-3.0.0/references/claude-md-template.md +112 -0
  55. memory_bank_skill-3.0.0/references/metadata.md +102 -0
  56. memory_bank_skill-3.0.0/references/planning-and-verification.md +89 -0
  57. memory_bank_skill-3.0.0/references/structure.md +147 -0
  58. memory_bank_skill-3.0.0/references/tags-vocabulary.md +50 -0
  59. memory_bank_skill-3.0.0/references/templates.md +286 -0
  60. memory_bank_skill-3.0.0/references/workflow.md +125 -0
  61. memory_bank_skill-3.0.0/rules/CLAUDE-GLOBAL.md +132 -0
  62. memory_bank_skill-3.0.0/rules/RULES.md +535 -0
  63. memory_bank_skill-3.0.0/scripts/_lib.sh +224 -0
  64. memory_bank_skill-3.0.0/scripts/mb-codegraph.py +634 -0
  65. memory_bank_skill-3.0.0/scripts/mb-compact.sh +299 -0
  66. memory_bank_skill-3.0.0/scripts/mb-context.sh +91 -0
  67. memory_bank_skill-3.0.0/scripts/mb-deps-check.sh +204 -0
  68. memory_bank_skill-3.0.0/scripts/mb-drift.sh +213 -0
  69. memory_bank_skill-3.0.0/scripts/mb-import.py +327 -0
  70. memory_bank_skill-3.0.0/scripts/mb-index-json.py +215 -0
  71. memory_bank_skill-3.0.0/scripts/mb-index.sh +87 -0
  72. memory_bank_skill-3.0.0/scripts/mb-metrics.sh +165 -0
  73. memory_bank_skill-3.0.0/scripts/mb-note.sh +40 -0
  74. memory_bank_skill-3.0.0/scripts/mb-plan-done.sh +161 -0
  75. memory_bank_skill-3.0.0/scripts/mb-plan-sync.sh +191 -0
  76. memory_bank_skill-3.0.0/scripts/mb-plan.sh +103 -0
  77. memory_bank_skill-3.0.0/scripts/mb-search.sh +218 -0
  78. memory_bank_skill-3.0.0/scripts/mb-tags-normalize.sh +247 -0
  79. memory_bank_skill-3.0.0/scripts/mb-upgrade.sh +189 -0
  80. memory_bank_skill-3.0.0/settings/hooks.json +96 -0
  81. memory_bank_skill-3.0.0/settings/merge-hooks.py +120 -0
  82. memory_bank_skill-3.0.0/uninstall.sh +267 -0
@@ -0,0 +1,39 @@
1
+ .installed-manifest.json
2
+ *.backup.*
3
+ *.pre-mb-backup.*
4
+ .DS_Store
5
+ .env
6
+ *.env
7
+ *.pem
8
+ *.key
9
+ *.secret
10
+ __pycache__/
11
+ *.pyc
12
+ .coverage
13
+ htmlcov/
14
+ .pytest_cache/
15
+ .ruff_cache/
16
+
17
+ # Project-local memory bank (dogfood). Contains session-specific status, plans,
18
+ # and progress logs that are not part of the distributed skill — they live in
19
+ # /.memory-bank/ of every consumer project. Never ship them in the public skill repo.
20
+ /.memory-bank/
21
+
22
+ # Build artifacts
23
+ /dist/
24
+ /build/
25
+ *.egg-info/
26
+
27
+ # Cross-agent adapter output from dogfood / test installs in this repo
28
+ # (the skill writes these into any project where `/install` runs — when we
29
+ # dogfood, they end up at the repo root and shouldn't be tracked).
30
+ /.cursor/
31
+ /.windsurf/
32
+ /.clinerules/
33
+ /.kilocode/
34
+ /.codex/
35
+ /.opencode/
36
+ /.mb-agents-owners.json
37
+ /.mb-pi-manifest.json
38
+ /opencode.json
39
+ /AGENTS.md
@@ -0,0 +1,278 @@
1
+ # Changelog
2
+
3
+ All notable changes to this project are documented here. The format follows [Keep a Changelog](https://keepachangelog.com/en/1.1.0/), and versioning follows [SemVer](https://semver.org/spec/v2.0.0.html).
4
+
5
+ ## [Unreleased]
6
+
7
+ ---
8
+
9
+ ## [3.0.0] — 2026-04-20
10
+
11
+ First stable 3.x release. Combines the work from the `3.0.0-rc1` / `rc2` / `rc3`
12
+ candidates: native cross-agent install (Claude Code, Codex, Cursor, OpenCode),
13
+ five-artifact global parity for Cursor, byte-level idempotent `install.sh`,
14
+ and the `memory-bank install` / `memory-bank uninstall` / `memory-bank doctor`
15
+ CLI. Install via `pipx install memory-bank-skill` or `brew install fockus/tap/memory-bank`.
16
+
17
+ ### Fixed (idempotency, promoted from `3.0.0-rc3`)
18
+
19
+ - **`install.sh` is now byte-level idempotent** — repeat runs on an up-to-date tree create **zero** `.pre-mb-backup.*` files.
20
+ - Root cause: `backup_if_exists()` did an unconditional `mv` on any existing target, and `install_file()` called it without comparing `src` / `dst` content. For localized files (`RULES.md`, Cursor paste-file) a raw `cmp -s src dst` never matched because `dst` had been language-substituted.
21
+ - Observed damage before the fix: 14 historic installs → 1628 accumulated `.pre-mb-backup.*` files; a single "clean" reinstall generated 48 backups, 37 of them byte-identical to the active file.
22
+ - **New helpers** in `install.sh`:
23
+ - `install_file()` short-circuits via `cmp -s "$src" "$dst"` when content is already identical.
24
+ - `backup_if_exists()` accepts an optional 2nd arg `expected_content_path` and returns `2` (skip marker) on content match.
25
+ - `install_file_localized()` — composes expected post-install content in a temp file (`cp src` + `localize_path_inplace`), compares to `dst` via `cmp -s`, skips backup+write on match. Used for `RULES.md` in Step 1.
26
+ - `localize_path_inplace()` — substitution helper without the existence shortcut.
27
+ - `install_cursor_user_rules_paste()` rewritten with a compose-to-tmp + `cmp -s` skip instead of unconditional overwrite.
28
+ - **Manifest `.backups[]`** is now filtered via `os.path.exists` — stale refs from user-cleaned `.pre-mb-backup.*` files are dropped instead of accumulating across installs.
29
+ - **`tests/e2e/test_install_idempotent.bats`** — 5 bats scenarios: zero backups on repeat install, exactly-one backup per real content diff, zero backups after external delete, language-swap backs up only localize-target files, manifest lists only existing backup paths.
30
+
31
+ **Result**: repeat install on an up-to-date tree → 0 backups. Language swap (`--language en` → `--language ru`) → exactly 2 backups (`RULES.md` + `memory-bank-user-rules.md`) and nothing else.
32
+
33
+ ### Added
34
+
35
+ - **Cursor global parity — five artifacts under `~/.cursor/` are now installed unconditionally** (without `--clients cursor`):
36
+ - `~/.cursor/skills/memory-bank/` — symlink to the canonical skill bundle (Cursor auto-discovers personal skills).
37
+ - `~/.cursor/hooks.json` + `~/.cursor/hooks/*.sh` — three global hooks (`sessionEnd` / `preCompact` / `beforeShellExecution`); each entry is marked `_mb_owned: true`, while user hooks on the same events are preserved.
38
+ - `~/.cursor/commands/*.md` — user-level slash commands mirroring the skill `commands/` directory.
39
+ - `~/.cursor/AGENTS.md` — managed section with unique `memory-bank-cursor:start/end` markers, preserving user content above and below.
40
+ - `~/.cursor/memory-bank-user-rules.md` — paste-ready bundle for **Settings → Rules → User Rules** (Cursor has no file API for global User Rules; this is a one-time manual step per machine). The post-install hint prints `pbcopy`/`xclip` commands.
41
+ - **`install.sh` helpers**: `cursor_agents_section()`, `install_cursor_global_agents()`, `install_cursor_user_rules_paste()`, `install_cursor_global_hooks()` (with jq-based `hooks.json` merge similar to Codex). `ensure_skill_aliases()` now creates the `~/.cursor/skills/memory-bank` alias.
42
+ - **`uninstall.sh` Cursor branches**: preserve `~/.cursor/AGENTS.md` and `~/.cursor/hooks.json` from manifest-removal (managed merged files), remove only the memory-bank section and `_mb_owned` entries, delete `memory-bank-user-rules.md` and the `skills/memory-bank` alias, and `rmdir` empty `~/.cursor/{skills,hooks,commands}` directories.
43
+ - **`tests/e2e/test_cursor_global.bats`** — 17 bats scenarios: install creates all five artifacts, idempotency, preserve-user-content in `AGENTS.md` + `hooks.json`, clean uninstall.
44
+ - **`tests/pytest/test_cli.py::test_cli_install_uninstall_smoke_with_cursor_global`** — pytest smoke: real `install.sh` / `uninstall.sh` run in sandboxed `$HOME` with Cursor steps.
45
+ - **Docs**:
46
+ - `SKILL.md` — Cursor promoted to the "native full support" tier, plus a new **Host-specific notes → Cursor** subsection with the five-artifact table and paste flow.
47
+ - `docs/cross-agent-setup.md` — supported clients table, **Cursor (full global parity + project adapter)** section, resource availability matrix with a Cursor column and a "Global rules" row, troubleshooting Q&A for User Rules.
48
+ - `README.md` — global install hint updated (Cursor included in baseline `memory-bank install`), new "Cursor-only quick start" section, adapter table extended with global artifacts.
49
+
50
+ ### Fixed
51
+
52
+ - **`adapters/cursor.sh` — removed duplicate `# Global Rules` heading** in `.cursor/rules/memory-bank.mdc`. Previously the script wrote its own `# Global Rules` and then concatenated `rules/RULES.md`, which starts with the same heading, so the MDC file ended up with two identical H1s.
53
+
54
+ ### Changed
55
+
56
+ - `install.sh` / `uninstall.sh` — added constants `CURSOR_DIR`, `CURSOR_SKILL_ALIAS`, `CURSOR_USER_RULES_FILE`, `CURSOR_START_MARKER` / `CURSOR_END_MARKER` (independent from Codex markers — allowing coexistence without conflicts in `~/.codex/AGENTS.md` vs `~/.cursor/AGENTS.md`).
57
+
58
+ ### Added (rolled up from prior Unreleased)
59
+
60
+ - **Interactive client picker in `install.sh`** — when `--clients` is not set and stdin is a TTY, a multi-select menu is shown for 8 clients (`claude-code`, `cursor`, `windsurf`, `cline`, `kilo`, `opencode`, `pi`, `codex`). Accepts numbers, names, `all`, or empty input (`claude-code`). Suppressed by `--non-interactive` or non-TTY stdin.
61
+ - **`install.sh --non-interactive`** — explicit interactive bypass for CI / scripted installs.
62
+ - **Env `MB_CLIENTS`** — alternate way to set clients (same semantics as `--clients`), useful in Docker / pipx wrappers.
63
+ - **`memory-bank install --non-interactive`** — forwards the flag from the Python CLI.
64
+ - **`/mb install` subcommand** (section in `commands/mb.md`) — installs adapters from inside Claude Code / OpenCode / Codex. Uses `AskUserQuestion` for multi-select in CC and inline prompt in other agents. The `/mb` namespace protects against collisions with other skills.
65
+ - **Windows compromise — Git Bash / WSL support**:
66
+ - `cli.py` no longer hard-fails on Windows. Added `find_bash()` with priority order: `MB_BASH` env override → `bash.exe` on PATH → `C:\Program Files\Git\bin\bash.exe` → WSL fallback.
67
+ - `system32\bash.exe` (WSL launcher shim) is ignored in favor of Git Bash / explicit WSL.
68
+ - `memory-bank doctor` now prints the resolved bash path on any platform.
69
+ - Missing bash on Windows now yields an actionable install hint (`winget` / WSL).
70
+ - **README: full command reference** — two tables (18 top-level slash commands + 20 `/mb` subcommands), replacing the previous partial list of 23 lines.
71
+ - **README: 3 ways to install cross-agent adapters** — interactive menu, CLI flags, `/mb install` from inside the agent.
72
+
73
+ ### Changed (rolled up from prior Unreleased)
74
+
75
+ - `memory-bank install / uninstall / init / doctor` — removed `require_posix()` calls; now work on Windows when bash is available.
76
+ - `tests/pytest/test_cli.py` — updated for the new platform model (29 tests, including 9 new `find_bash()` discovery tests + WSL wrapper mode).
77
+ - `tests/bats/test_install_interactive.bats` — new file with 13 tests for CLI flags, validation, env overrides.
78
+
79
+ ### Docs (rolled up from prior Unreleased)
80
+
81
+ - README: Platform matrix expanded (macOS native / Linux native / Windows Git Bash / Windows WSL / Windows without bash — the last one with a hint).
82
+ - README: command tables numbered as "18 top-level + 20 `/mb` subcommands".
83
+
84
+ ---
85
+
86
+ ## [3.0.0-rc1] — 2026-04-20
87
+
88
+ ### Repository moved
89
+
90
+ This skill moved to a new public repository: **[`fockus/skill-memory-bank`](https://github.com/fockus/skill-memory-bank)**. The old name `claude-skill-memory-bank` described only one of the 8 supported clients and had become misleading.
91
+
92
+ **Migration guide:** [docs/repo-migration.md](docs/repo-migration.md).
93
+
94
+ Historical releases (`v1.x`, `v2.0.0`, `v2.1.0`, `v2.2.0`) remain available in the old repository. `v3.0.0` and later are published in the new one.
95
+
96
+ ### Added
97
+
98
+ - **Stage 8 — Cross-agent adapters** (7 clients beyond Claude Code): Cursor (CC-compat hooks), Windsurf (Cascade), Cline (`.clinerules/hooks/`), Kilo (+ git-hooks fallback), OpenCode (TS plugin with `experimental.session.compacting`), Codex (experimental hooks), Pi Code (dual-mode). See `docs/cross-agent-setup.md`.
99
+ - **`adapters/_lib_agents_md.sh`** — refcount-based shared `AGENTS.md` ownership via `.mb-agents-owners.json`. Enables safe coexistence of OpenCode / Codex / Pi installs.
100
+ - **`adapters/git-hooks-fallback.sh`** — universal `.git/hooks/` installer (post-commit auto-capture, pre-commit `<private>` warnings, chain pattern preserving user hooks).
101
+ - **`install.sh --clients <list>`** — non-interactive multi-client install. Valid: `claude-code, cursor, windsurf, cline, kilo, opencode, pi, codex`.
102
+ - **`docs/cross-agent-setup.md`** — complete per-client cheatsheet + hook capability matrix + troubleshooting FAQ.
103
+ - **`docs/repo-migration.md`** — upgrade instructions for existing users.
104
+
105
+ ### Changed
106
+
107
+ - Repository name: `claude-skill-memory-bank` → `skill-memory-bank`.
108
+ - Install target directory: `~/.claude/skills/skill-memory-bank/` (previously `claude-skill-memory-bank/`).
109
+ - `mb-upgrade.sh` now tracks the new origin URL.
110
+
111
+ ### Tests
112
+
113
+ - **340+/340+ bats + e2e green** (+90 adapter bats, +10 install-clients e2e over v2.2.0).
114
+
115
+ ---
116
+
117
+ ## [2.2.0] — 2026-04-20
118
+
119
+ Knowledge-reach release: cold-start through JSONL import, code graph for 6 languages, tags normalization through a controlled vocabulary.
120
+
121
+ ### Added
122
+
123
+ - **`/mb import --project <path> [--since] [--apply]`** (`scripts/mb-import.py`) — bootstrap Memory Bank from Claude Code transcripts (`~/.claude/projects/<slug>/*.jsonl`). Extracts daily-grouped `progress.md` sections and arch-discussion notes (≥3 consecutive assistant messages >1K chars). Dedup via SHA256(timestamp + first 500 chars), resume through `.import-state.json`. PII auto-wrap (email + API-key → `<private>`) integrated with v2.1 Stage 3. `--dry-run` by default.
124
+ - **`/mb graph [--apply] [src_root]`** (`scripts/mb-codegraph.py`) — code graph for Python (stdlib `ast`, always-on) + Go / JavaScript / TypeScript / Rust / Java (through tree-sitter, opt-in). Nodes = module/function/class, edges = import/call/inherit. Output: `codebase/graph.json` (JSON Lines, grep/jq friendly) + `codebase/god-nodes.md` (top-20 by degree). SHA256 incremental cache per file. `HAS_TREE_SITTER` flag provides graceful degradation without grammars. Skipped dirs: `.venv`, `node_modules`, `__pycache__`, `.git`, `target`, `dist`, `build`.
125
+ - **`/mb tags [--apply] [--auto-merge]`** (`scripts/mb-tags-normalize.sh`) — Levenshtein-based synonym detection + merge through a controlled vocabulary. Distance ≤2 detection, ≤1 for `--auto-merge`. Vocabulary in `.memory-bank/tags-vocabulary.md` (user-editable) → fallback to `references/tags-vocabulary.md` (35 default tags). Exit 2 when unknown tags are found (drift signal).
126
+ - **`references/tags-vocabulary.md`** — template with 35 default tags (Core: arch/auth/bug/perf/refactor/test/...; Process: debug/review/post-mortem/adr/spike; Workflow: blocked/todo/wip/imported/discussion).
127
+ - **`mb-index-json.py`** — auto-kebab-case for tags: `FooBar → foo-bar`, `AUTH → auth`, `someThing → some-thing`. Dedup while preserving order. Source files remain untouched — only the index changes.
128
+
129
+ ### Changed
130
+
131
+ - **`mb-codegraph.py`** — the Python-only v1 path was extended with a tree-sitter adapter for 5 new languages. Same node/edge schema. Lazy parser loading per language through `_TS_PARSERS` cache.
132
+ - **`commands/mb.md`** — `/mb import`, `/mb graph`, `/mb tags` sections with full examples, dogfood outputs, and limitations.
133
+ - **`install.sh`** — now prints a hint for tree-sitter extras.
134
+
135
+ ### Tests
136
+
137
+ - pytest: **96** (was 44 after v2.1) — +17 `test_import`, +21 `test_codegraph` (Python), +14 `test_codegraph_ts` (tree-sitter).
138
+ - bats: **208** (was 194) — +14 `test_tags_normalize`.
139
+ - shellcheck: 0 warnings. ruff: all passed.
140
+
141
+ ### Gate v2.2 — passed ✅
142
+
143
+ 1. ✅ `/mb import` on real JSONL (2573 events) — **0.127s** (target ≤30s).
144
+ 2. ✅ `mb-codegraph.py` on `scripts/` — **0.068s** for 60 nodes + 487 edges (target ≤30s).
145
+ 3. ✅ Tags normalization: `sqlite_vec → sqlite-vec` auto-merged at distance=1, 2 notes rewritten. Unknown tag → exit 2 drift signal works.
146
+ 4. ✅ Full regression: 96 pytest + 208 bats + ruff + shellcheck clean.
147
+ 5. ✅ VERSION 2.2.0, CHANGELOG updated.
148
+
149
+ ### ADR pivots
150
+
151
+ - **ADR-006 updated (Stage 6.5):** tree-sitter originally started as deferred opt-in. After user feedback ("I often work with Node/Go") it was implemented in v2.2, with graceful degradation when grammars are absent. The Python path remained zero-dependency. See BACKLOG (Stage 6.5 shipped entry).
152
+
153
+ ### Deferred to v3.x backlog
154
+
155
+ - Haiku-powered compression for `/mb import` summaries (currently deterministic first+last chars).
156
+ - Debug-session detection in `/mb import` for `lessons.md`.
157
+ - Type inference in `/mb graph` (edges are currently name-based and do not distinguish modules with same-named functions).
158
+ - tree-sitter grammars for C/C++/Ruby/PHP/Kotlin/Swift (add on demand via `_TS_LANG_CONFIG`).
159
+
160
+ ## [2.1.0] — 2026-04-20
161
+
162
+ Hardening release: auto-capture when `/mb done` is forgotten, drift detection without AI, PII protection in notes, status-based decay for old plans and notes.
163
+
164
+ ### Added
165
+
166
+ - **Auto-capture SessionEnd hook** (`hooks/session-end-autosave.sh`) — if a session closes without `/mb done`, the hook appends a placeholder entry to `progress.md`. Lock file `.memory-bank/.session-lock` is written by `/mb done` → the hook sees a fresh lock (<1h) and skips auto-capture. `MB_AUTO_CAPTURE` env: `auto` (default) / `strict` / `off`. Concurrent-safe through `.auto-lock` (30s TTL). Idempotent per `session_id`.
167
+ - **Drift checkers without AI** (`scripts/mb-drift.sh`) — 8 deterministic checkers (path, staleness, script_coverage, dependency, cross_file, index_sync, command, frontmatter). Output: `drift_check_<name>=ok|warn|skip` + `drift_warnings=N`. Exit 0 when 0 warnings, otherwise 1. `agents/mb-doctor.md` Step 0 = `mb-drift.sh` → LLM call only if `drift_warnings > 0`. Saves AI tokens.
168
+ - **PII markers `<private>...</private>`** in notes — block contents do not enter `index.json` (summary + tags filtered), and `mb-search` replaces them with `[REDACTED]` (inline) or `[REDACTED match in private block]` (multi-line). Unclosed `<private>` is fail-safe: tail to EOF is treated as private. Entries get `has_private: bool`. `--show-private` requires `MB_SHOW_PRIVATE=1` env (double confirmation). `hooks/file-change-log.sh` warns when a `.md` file with a `<private>` block is Write/Edit-ed.
169
+ - **Compaction decay `/mb compact`** (`scripts/mb-compact.sh`) — status-based archival: requires **age > threshold AND done-signal**. Active plans (not done) are **NOT archived** even if >180d — warning only. Done-signal (OR): file physically under `plans/done/`, OR a `✅`/`[x]` marker in `checklist.md`, OR mentioned as "done|closed|shipped" in `progress.md`/`STATUS.md`. Notes — `importance: low` + mtime >90d + no references in core files. `--dry-run` (default) reasons only; `--apply` executes and touches `.last-compact`. Entries under `notes/archive/` get `archived: bool`. `mb-search --include-archived` is opt-in for archive search.
170
+
171
+ ### Changed
172
+
173
+ - **`agents/mb-doctor.md`** — Step 0 is now `mb-drift.sh`; LLM steps (1-4) run only when `drift_warnings > 0` or `doctor-full`.
174
+ - **`scripts/mb-index-json.py`** — parser for `<private>` blocks, `has_private: bool` + `archived: bool` fields in the entry schema.
175
+ - **`scripts/mb-search.sh`** — span-aware Python filter for REDACTED replacement. Added `--show-private` + `--include-archived`.
176
+ - **`settings/hooks.json`** — SessionEnd event added for auto-capture.
177
+ - **`commands/mb.md`** — `/mb done` writes `.session-lock`. Added `/mb compact` section with full status-based logic and examples.
178
+ - **`SKILL.md`** — "Private content" and "Auto-capture" sections.
179
+ - **`references/metadata.md`** — schema extended with `has_private` + `archived` fields.
180
+
181
+ ### Tests
182
+
183
+ - bats: **194** (20 `test_compact` + 4 `test_search_archived` + 5 `test_search_private` + 20 `test_drift` + 12 `test_auto_capture` + regressions).
184
+ - pytest: **44** (7 PII + 2 archived + regressions).
185
+ - e2e: 18 install/uninstall (including SessionEnd hook roundtrip).
186
+ - shellcheck: 0 warnings (SC1091 info expected for `source _lib.sh`).
187
+ - ruff: all passed.
188
+
189
+ ### Gate v2.1 — passed ✅
190
+
191
+ 1. ✅ Auto-capture end-to-end: simulated SessionEnd → `progress.md` updated without `/mb done`.
192
+ 2. ✅ `mb-drift.sh` on broken fixture: 7 warnings across 8 categories (≥5 target).
193
+ 3. ✅ PII security smoke: `TOP-SECRET-LEAK-CHECK-GATE21` inside `<private>` → **0 matches** in `index.json`.
194
+ 4. ✅ `/mb compact` dogfood: live bank is clean (0 candidates), artificial 150d done-plan → archived, 150d active-plan → not archived (safety works).
195
+ 5. ✅ CI matrix `[macos, ubuntu]` × (bats + e2e + pytest) green.
196
+
197
+ ### Deferred to backlog
198
+
199
+ - LLM upgrade for auto-capture (currently append-only; details are reloaded by `/mb start` from JSONL).
200
+ - `/mb done` weekly prompt for compaction checks.
201
+ - Pre-commit drift hook as a separate file (YAGNI; documented in `references/templates.md`).
202
+
203
+ ## [2.0.0] — 2026-04-19
204
+
205
+ Large refactor: the skill becomes language-agnostic, tested, CI-covered, and integrated with the Claude Code ecosystem. Three concepts under one roof: **Memory Bank + RULES + dev toolkit**.
206
+
207
+ ### Added
208
+
209
+ - **Language detection (12 stacks)**: Python, Go, Rust, Node/TypeScript, Java, Kotlin, Swift, C/C++, Ruby, PHP, C#, Elixir. `scripts/mb-metrics.sh` emits key=value metrics for any of them.
210
+ - **Override for project metrics**: `.memory-bank/metrics.sh` (priority 1 over auto-detect).
211
+ - **`scripts/_lib.sh`** — shared utilities (workspace resolver, slug, collision-safe filename, detect_stack/test/lint/src_glob). 7 functions, 36 bats tests.
212
+ - **`scripts/mb-plan-sync.sh`** and **`scripts/mb-plan-done.sh`** — automate plan↔checklist↔plan.md consistency through `<!-- mb-stage:N -->` markers.
213
+ - **`scripts/mb-upgrade.sh`** — `/mb upgrade` self-update for the skill from GitHub (git fetch → prompt → ff-only pull + reinstall).
214
+ - **`scripts/mb-index-json.py`** — pragmatic index for `notes/` (frontmatter) + `lessons.md` (H3 markers). Atomic write. PyYAML opt-in with fallback.
215
+ - **`mb-search --tag <tag>`** — tag filtering via `index.json`.
216
+ - **`/mb init [--minimal|--full]`** — unified initialization. `--full` (default) = `.memory-bank/` + `RULES.md` copy + stack auto-detect + `CLAUDE.md` + optional `.planning/` symlink.
217
+ - **`/mb map [focus]`** — scan the codebase and generate `.memory-bank/codebase/{STACK,ARCHITECTURE,CONVENTIONS,CONCERNS}.md`.
218
+ - **`/mb context --deep`** — full codebase content (default = 1-line summary).
219
+ - **Frontend rules (FSD)** and **Mobile (iOS + Android)** in `rules/RULES.md` and `rules/CLAUDE-GLOBAL.md`.
220
+ - **`MB_ALLOW_NO_VERIFY=1`** — bypass for `--no-verify` in `block-dangerous.sh`.
221
+ - **Log rotation** for `file-change-log.sh`: >10 MB → `.log.1 → .log.2 → .log.3`.
222
+ - **GitHub Actions** `.github/workflows/test.yml`: matrix `[ubuntu-latest, macos-latest]` × (bats + e2e + pytest) + lint job (shellcheck + ruff).
223
+ - **148 bats tests** (unit + e2e + hooks + search-tag), **35 pytest tests**, **94% total coverage**.
224
+
225
+ ### Changed
226
+
227
+ - **`codebase-mapper` → `mb-codebase-mapper`** (MB-native): output path `.planning/codebase/` → `.memory-bank/codebase/`; 770 lines → 316 (−59%); 6 templates → 4 (STACK, ARCHITECTURE, CONVENTIONS, CONCERNS), each ≤70 lines.
228
+ - **`/mb update` and `mb-doctor`** no longer hardcode `pytest`/`ruff`/`src/taskloom/` — they use `mb-metrics.sh`.
229
+ - **`SKILL.md` frontmatter** — invalid `user-invocable: false` replaced by `name: memory-bank` with a three-in-one concept description.
230
+ - **`Task(...)` → `Agent(subagent_type=...)`** in all skill files. Grep check: 0 occurrences of `Task(`.
231
+ - **`mb-doctor`** fixes desynchronization primarily through `mb-plan-sync.sh`/`mb-plan-done.sh`; Edit is reserved for semantic issues.
232
+ - **`install.sh`** — always writes the `[MEMORY-BANK-SKILL]` marker when creating a new `CLAUDE.md` (previously only when merging into an existing one).
233
+ - **`mb-manager actualize`** — now calls `mb-index-json.py` instead of manually writing `index.json`.
234
+ - **`file-change-log.sh`** — removed `pass\s*$` from the placeholder regex (false positive); placeholder search now ignores Python docstrings.
235
+ - **`install.sh` banner**: `19 dev commands` → `18 dev commands` (after init-command consolidation).
236
+
237
+ ### Deprecated
238
+
239
+ - (none — all deprecations in this release are full removals; see Removed)
240
+
241
+ ### Removed
242
+
243
+ - **`/mb:setup-project`** — merged into `/mb init --full`. `commands/setup-project.md` removed.
244
+ - **Orphan agent `codebase-mapper`** — replaced with `mb-codebase-mapper`.
245
+ - **Hardcoded `pytest -q` / `ruff check src/`** in `commands/mb.md` and `agents/mb-doctor.md`.
246
+ - **All `Task(...)` invocations** in skill files (0 left).
247
+
248
+ ### Fixed
249
+
250
+ - **E2E-found bug #1**: `install.sh` did not add the `[MEMORY-BANK-SKILL]` marker when creating a **new** `CLAUDE.md`. Result: `uninstall.sh` could not find the section to clean.
251
+ - **E2E-found bug #2**: `uninstall.sh` used the GNU-only `realpath -m` flag. BSD `realpath` on macOS failed. Fix: the manifest already stores absolute paths, so `realpath` is unnecessary.
252
+ - **Node `src_glob`**: brace-pattern `*.{ts,tsx,js,jsx}` replaced by space-separated globs for portable grep.
253
+ - **`mb-note.sh`**: name collision (two notes in one minute) now yields `_2/_3` suffixes (previously `exit 1`).
254
+ - **`file-change-log` false positives**: bare `pass` in Python, TODO inside docstrings.
255
+ - **shellcheck SC1003** in the awk hook block — rewritten through `index()` without nested single-quote escapes.
256
+
257
+ ### Security
258
+
259
+ - **`block-dangerous.sh`** updated with `MB_ALLOW_NO_VERIFY=1` explicit opt-in override — previously `--no-verify` was blocked with no safe escape.
260
+ - **Secrets detection** in `file-change-log.sh` continues to work (`password|secret|api_key|token|private_key` in source code).
261
+
262
+ ### Infrastructure
263
+
264
+ - **Dogfooding**: the skill now uses `.memory-bank/` in its own repository. The v2 refactor plan lives in `.memory-bank/plans/`, and sessions are closed through `/mb done`.
265
+ - **VERSION marker**: `2.0.0-dev` → `2.0.0` written by `install.sh` into `~/.claude/skills/memory-bank/VERSION`.
266
+ - **CI green** on macOS + Ubuntu, 0 shellcheck warnings, ruff all passed.
267
+
268
+ ---
269
+
270
+ ## [1.0.0] — 2025-10-XX (pre-refactor baseline)
271
+
272
+ - Initial Memory Bank skill: `.memory-bank/` structure, `/mb` roadmap command, 4 agents, 2 hooks, 19 commands.
273
+ - Python-first: hardcoded `pytest`, `ruff`, `src/taskloom/`.
274
+ - Orphan artifacts from GSD: `codebase-mapper`, `.planning/`.
275
+ - 0 automated tests.
276
+
277
+ [2.0.0]: https://github.com/fockus/claude-skill-memory-bank/releases/tag/v2.0.0
278
+ [1.0.0]: https://github.com/fockus/claude-skill-memory-bank/releases/tag/v1.0.0
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Anton Ivanov
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.