v3.1.2
Review findings hardening + installer boundary refactor. Seven stages
closing three classes of problems surfaced by the full-repo review and
security audit: P0 security risks around path traversal and manifest
poisoning, architectural debt in install.sh / adapter layer, and
contract / maintainability drift in CLI, manifests, and shared helpers.
All 3 High findings from SECURITY_AUDIT_REPORT.md closed; 601/601 bats
- 246/246 pytest green.
Added
- Safe path helpers in
scripts/_lib.sh— canonicalization and subtree
validation reused byinstall.sh/uninstall.sh/ adapters. Traversal
payloads in.claude-workspace, uninstall manifest paths, andadapters/pi.sh
pi_skill_dirall fail closed. MB_ALLOW_METRICS_OVERRIDE=1opt-in gate for.memory-bank/metrics.sh
execution. Default blocks user-supplied overrides with an actionable hint.-y/--non-interactiveflags onuninstall.shand the Python
memory-bank uninstallCLI. Both skip the prompt for CI/automation usage.schema_version+ deterministic file/backup ordering in the global
install manifest. Unblocks safe tooling that reasons over manifests.memory_bank_skill/_io.py— shared atomic-write helper; replaces four
duplicated_atomic_write()implementations in Python scripts.memory_bank_skill/_texttools.py— sharedstrip_marked_section/
localize_language_rule/ etc.; replaces four near-identical Python
heredoc blocks inuninstall.shwith one shared call path.adapters/_framework.sh+adapters/_contract.sh— shared adapter
entrypoints (install/uninstall), manifest writing, hook JSON merge, and
contract invariants. Sourced by all 7 adapters.references/adapter-manifest-schema.md— documented manifest schema
(schema_version,adapter,installed_at,files, optional keys).- Direct bats coverage for
mb-note.sh,mb-plan.sh,_lib_agents_md.sh
refcount/atomic-write behavior, 10 MB hook-log rotation boundary, and
run_shell()subprocess failure path — closes review-cited test gaps. test_texttools.pypytest coverage for atomic write rollback,
marker-strip, and language-rule localization.
Changed
install.shno longer contains client-specific Cursor global helpers —
hooks / AGENTS / user-rules logic moved intoadapters/cursor.sh. The
universal installer is now orchestration only (argument parsing + shared
install + adapter invocation).install.sh: 1reference vs
adapters/cursor.sh: 8references post-refactor.uninstall.shdelegates adapter cleanup instead of relying solely on
the global manifest. Adapter artifacts round-trip cleanly; user content
preserved.adapters/_lib_agents_md.shwrites owner state atomically with an
explicitjqpreflight that fails clearly when the binary is missing.- All 7 adapters migrated to the shared framework without changing their
public CLI. OpenCode/Codex/Pi sharedAGENTS.mdcoexistence preserved. mb-compact.shis narrowed back to archival decay. Structural migration
ofchecklist.mddone-sections andplan.mddeferred/declined bullets now
lives inmb-migrate-structure.sh, which keeps compaction and migration on
separate boundaries again.settings/merge-hooks.pynow strips only Memory Bank-owned hook items
within mixed entries, preserving unrelated user commands in the same event.- Pi's native
MB_PI_MODE=skillpath is no longer part of the supported
default surface. Normal installs stay onagents-md; native-skill probing
requires the explicitMB_EXPERIMENTAL_PI_SKILL=1gate.
Fixed
- Traversal payloads in
.claude-workspace, uninstall manifest paths, and
adapters/pi.shpi_skill_dirnow reject external targets before any
destructive operation. install.sh::backup_if_exists()refuses symlink targets that escape
managed directories; safe regular-file idempotency preserved.memory-bank installfails early on unknown--clientsvalues with a
clear error beforeinstall.shruns.settings/merge-hooks.pyno longer drops mixed user/MB hook entries when
the first hook item happens to be MB-owned.
Docs
README.md,docs/install.md,docs/release-process.md,SECURITY.md
now documentmemory-bank uninstall -y,MB_ALLOW_METRICS_OVERRIDE=1
opt-in, and Pi's experimental native skill gate.