v5.0.0
First PyPI release since 3.1.2. Supersedes the tagged-but-never-published
4.0.0 (its CI publish failed on a__version__drift, since fixed by reading
the canonicalVERSIONat runtime). 5.0.0 bundles all 4.0.0 content plus
everything below. Seedocs/MIGRATION-v4-v5.mdfor the breaking changes.
Changed — BREAKING
- Review is now OFF by default. The default
/mb workpath isexecution
(implement → verify → done) with no reviewer. The shipped
references/pipeline.default.yamlstage_pipelineno longer contains a
reviewstep; the review policy moved to an opt-in top-levelreview:block
(enabled: false). Restore review per-run with/mb work --review, persist it
withreview.enabled: true, or use a governed preset
(--workflow governed-execution). Migration:docs/MIGRATION-v4-v5.md. mb-work-severity-gate.shPASSes as a no-op when no review is configured
(previouslyexit 2 "no 'review' step in stage_pipeline"). The gate now reads
thereview:block ▸ legacystage_pipeline[review]▸ active workflow
loop.severity_gate, on both the PyYAML and no-PyYAML paths.fullis now a first-class preset, not an alias.workflow.aliases.full
(→full-cycle) is removed;--workflow fullnow resolves to the complete
8-stage chaindiscuss → sdd → plan → implement → verify → review → judge → done.
The old 6-stage interactive flow is still available as--workflow full-cycle.
A neweverythingalias points atfull.
Added — composable /mb work pipeline
- 3-layer stage composition (precedence: launch flags >
pipeline.yaml>
built-in default), resolved inscripts/mb-workflow.shinto one canonically
ordered stage list (discuss → sdd → plan → implement → verify → review → judge → done;fixstays an internal loop mechanic). - Per-stage launch flags —
--review/--no-review,--judge/--no-judge,
--brainstorm/--no-brainstorm(alias ofdiscuss),--sdd/--no-sdd,
--plan/--no-plan;--stages a,b,cis an escape hatch that overrides the
preset and every flag. Launch flags win overpipeline.yaml;pipeline.yaml
per-stage<stage>.enabled: trueadds a stage on top of the resolved preset. - Deterministic merge — the composed set is re-sorted into canonical order
only when composition changes it; an un-modified preset (or a legacy
stage_pipeline-only project) keeps its own order verbatim (back-compat). fullpreset (workflows.full) spans the whole chain; per-stage opt-in
enabledblocks forreview/judge/discuss/sdd/planship in the
defaultpipeline.yaml(allfalse).- Fail-fast on invalid chains —
scripts/mb-pipeline-validate.shgains a
--stages <csv> [--input …]mode and rejectsjudgewithoutreviewand
sdd/planwith no upstream input; the composer (mb-workflow.sh) enforces
the judge⟹review rule before execution.commands/work.mddocuments the flags,
the three-layer precedence, and thefullpreset. --reviewis the single-reviewer path (resolved via
mb-reviewer-resolve.sh, gated bymb-work-severity-gate.sh); the heavyweight
5-reviewer ensemble stays behind--workflow governed-execution.- SDD-specified via the skill's own engine (dogfooding):
.memory-bank/specs/composable-work-pipeline/. +29 tests (default-no-review
contract, gate no-op, composer matrix,--stagesvalidation, doc contract).
Added — code-graph intelligence layer (opt-in: wiki, surprising connections, semantic search, suggested questions)
- Module decomposition (behaviour-preserving):
scripts/mb-codegraph.py660 → 344 lines; extractors split intomemory_bank_skill/codegraph_{common,python,treesitter}.py; sharedcodegraph_loader.py(onegraph.jsonloader, both query/context cores delegate). Default output byte-identical. - Git co-change edges —
mb-codegraph.py --apply --cochangeadds deterministicco_changefile edges from git history (memory_bank_skill/codegraph_cochange.py). - Suggested questions —
mb-codegraph.py --apply --questionsappends deterministic exploration questions togod-nodes.md(codegraph_questions.py), from god-nodes/bridges/communities/co-change. $0, no LLM. - Semantic search —
scripts/mb-semantic-search.py: pluggableRetrieverport, pure-Python BM25 default ($0, zero deps), opt-in local embeddings (sentence-transformers, graceful fallback). Modulessemantic_search.py+semantic_embeddings.py. - LLM wiki + surprising connections —
/mb wiki(commands/mb.md§ wiki +scripts/mb-wiki.py): per-community articles via Haiku subagents, cross-cuttingsemanticedges via Sonnet — host subagents, no API key. Deterministic prep inwiki_evidence.py+wiki_store.py(validated, idempotent edge merge). Agentsmb-wiki-author/mb-wiki-synthesizer. - Optional dep
sentence_transformersregistered inmb-deps-check.sh. Default graph/search behaviour unchanged; all new capabilities opt-in with graceful degradation. Realizes backlogI-063.
Added — global-rules provisioning of the intelligence layer + session-memory packaging
- Installer source-of-truth now ships the intelligence layer.
rules/RULES.md(→~/.claude/RULES.md),rules/CLAUDE-GLOBAL.md(→~/.claude/CLAUDE.mdblock) andreferences/claude-md-template.md(→ projectCLAUDE.md) gained the opt-in graph layer (suggested questions / co-change / semantic search //mb wiki), theco_change+semanticedge kinds in the jq schema, the code-agent routing one-liner, and cross-chat session-memory (/mb recall) guidance. Previously these lived only in hand-edited~/.claude/*and were lost on everyinstall/upgrade (Step 1 overwrites RULES.md). New contract testtest_rules_cover_intelligence_layer.pykeeps rules from drifting behind features. - Session-memory subsystem now installs out of the box. The four hooks (
mb-session-turn.sh,mb-session-end.sh,mb-session-start.sh,mb-recall.sh) +hooks/lib/{session-common,extract-tools-files}.share now git-tracked;install.shcopieshooks/lib/beside the hooks;settings/hooks.jsonregisters them (new SessionStart event + Stop/SessionEnd entries, all marker-tagged). Documented inSKILL.md## Hooks. New contract testtest_session_memory_packaging.py. A fresh clone/install now gets cross-chat memory; previously all five files were untracked WIP and never registered.
Changed — compact rules/CLAUDE-GLOBAL.md (always-in-context block)
rules/CLAUDE-GLOBAL.md(injected into~/.claude/CLAUDE.mdon every install) trimmed 145 → 81 lines: the always-on core is kept intact (Mandatory first-response guard, theCRITICAL RULEScompaction block, Session Pipeline, Codebase Map + opt-in layers +/mb recall), while the verbose Coding/Testing/Reasoning/Planning bullets and the full/mbcommand table are condensed to pointers into~/.claude/RULES.md(read on demand). Cuts per-message context cost without losing any rule. All guard/contract tests stay green (test_global_prompt_guard,test_rules_cover_intelligence_layer,test_runtime_contract); the localizableLanguageline is preserved verbatim.
Changed — rules/RULES.md context economy (Code Graph + MB reference → on-demand)
rules/RULES.mdtrimmed 1073 → 801 lines (−25%) without losing any rule. The full Code Graph cookbook (jq query library,graph.jsonschema incl. theco_change/semanticedge kinds, the opt-in intelligence layer, benchmark-grounded semantic-search routing,/mb recallsession memory) moved to a new on-demand referencereferences/code-graph.md(installed via thereferences/dir copy; linked fromSKILL.md## References). The Subagents roster, the full/mbcommand reference, and the.memory-bank/structure tables — verbatim duplicates ofSKILL.md§Agents/§Tools,/mb help(commands/mb.md), andreferences/structure.md— were compressed to pointer sections (heading anchors preserved). Genuine rules kept inline: verify-before-done, no-delegate-plan/architecture/ML, checklist-update-immediately,progress.mdappend-only. The intelligence-layer contract test (test_rules_cover_intelligence_layer.py) re-points toreferences/code-graph.md;CLAUDE-GLOBAL.mdpointers follow. All guard / doc-count / graph-rag / install contract tests stay green (pytest 1135, bats 669 / 0 fail). Plan:.memory-bank/plans/2026-06-07_refactor_rules-context-economy.md.
Changed — dev-agent strengthening via engineering-core composition
- New shared partial
agents/mb-engineering-core.md— role-neutral, stack-agnostic engineering
discipline lifted to a single source of truth: TDD (Red→Green→Refactor), Contract-First (+ contract-drift),
Clean Architecture direction table, SOLID/DRY/KISS/YAGNI thresholds, production-wiring awareness,
evidence-before-claims Iron Law (no "tests pass" without the command output), escalation rules
(3 attempts → STOP, no thrashing), STATUS contract (DONE / DONE_WITH_CONCERNS / BLOCKED /
NEEDS_CONTEXT, evidence-backed), and an anti-rationalization table. Markedpartial: true—
excluded from the~/.claude/agents/registry byinstall.sh, delivered via the skill symlink. /mb workcomposition — the implement-step now inlinesmb-engineering-coreahead of the
resolved role agent (prompt = core + "\n---\n" + role + body). Previously the specialist files said
"Inherit allmb-developerprinciples" but the orchestrator inlined only the role file, so that
discipline never reached the subagent. The prepend fixes the broken inheritance.- 9 dev-role agents refactored to thin deltas —
mb-developer(down to a generic-fallback delta)
and the 8 specialists (mb-backend,mb-frontend,mb-ios,mb-android,mb-devops,mb-qa,
mb-analyst,mb-architect): removed the non-functional "Inherit…" reference, kept the domain
principles, replaced thin "same shape as mb-developer" outputs with explicit STATUS-led contracts
that require the test-run output. - Controllers hardened —
mb-reviewerandplan-verifiergained an adversarial default
("assume the diff is wrong until the rubric is demonstrably upheld; an invariant with no test that
forces the failure mode is unproven = a finding");plan-verifierreports now include a
"Verified positively" section (positive proof, not just absence of findings).mb-reviewer's
strict-JSON contract is unchanged (parser verified intact). - Validation — before/after behavioural test on the same trap task (
sonnet, sandboxed): both
mb-backendandmb-developerwent from claiming "tests pass" with no command output to leading
withSTATUS: DONEand pasting the actual pytest output; rubric ~3.0 → ~4.6. See
.memory-bank/reports/2026-06-02_subagent-baseline.md.
Added — rule profiles & stack presets (Sprint 3)
- Configurable rule profiles with immutable safety baseline. Profiles personalize Memory Bank rules across local / global / rules-only modes without weakening protected-files / no-placeholders / verification-before-completion / DRY/KISS/YAGNI guarantees.
memory_bank_skill/rules_profile.py— stdlib-only Python module withparse_profile,parse_profile_safe,validate_profile,resolve_profile. Frozen dataclassesProfile,ResolvedProfile,ValidationError. Built-in defaults plus layered precedence:built-in → user → project → task(task can only tighten, never weaken).scripts/mb-profile.sh— shell CLI with subcommandsinit / show / path / validate / set.--scope=user|project,--role,--stack,--architecture,--delivery,--strictness,--agent,--mb. JSON-only persistence. User-scope profile path resolves through Sprint 1mb_agent_config_dir; project-scope throughmb_resolve_path.- 22 built-in presets under
references/rules-presets/:- Roles:
backend,frontend,mobile. - Stacks:
go,python,javascript,typescript,java,generic. - Architectures:
clean,hexagonal,modular-monolith,microservices,ddd,fsd,mobile-udf,event-driven. - Delivery:
tdd,contract-first,api-first,sdd,legacy-safe,exploratory. - Each preset is declarative JSON (
rule_id,severity,guidance,see_also) with unique globalrule_idand ≤200-char guidance.
- Roles:
- Rules-check integration —
scripts/mb-rules-check.shnow reads the resolved profile, emits aprofileblock in JSON output (role/stack/architecture/delivery/strictness/sources/prompt_summary), tags violations withrule_id+profile_source, and honoursstrictness:blockexits non-zero on CRITICAL,warnis backward-compatible,advisorynever blocks. - Stack-aware deterministic checks (added to
mb-rules-check.sh):stack.go.context-propagation(warn),stack.go.goroutine-context(advisory)stack.python.type-hints(advisory),stack.python.no-business-mocks(warn)stack.typescript.no-any(warn),stack.javascript.strict-equality(advisory)stack.java.repository-interface(advisory)architecture.fsd.import-direction(warn) fires only when architecture=fsd.
/mb profilecommand surface — newcommands/profile.md(init/show/path/validate/set with copy-paste recipes), routed fromcommands/mb.md(now 25 commands)./mb initflow documents optional profile setup after storage choice.- Docs — new
docs/rule-profiles.md(precedence model, schema, all 22 presets listed, 5 copy-paste recipes, immutable baseline table, JSON canonical / YAML docs-only). README adds "Rule profiles & stack presets" section; SKILL.md## Toolstable gainsmb-profile.shand## Referenceslinksreferences/rules-profile.schema.md. - Contract coverage —
tests/pytest/test_rules_profile_schema.py(26 cases: parser/validator/resolver/precedence/4 KB cap),tests/pytest/test_rules_presets.py(12 cases: schema validation across all 22 presets + composition snapshots + immutable-baseline guards),tests/bats/test_mb_profile.bats(10 CLI cases),tests/bats/test_rules_check_profile.bats(8 integration cases incl. fsd/strictness).
Added — global-storage agent support (Sprint 2)
- Resolver-aware hooks —
hooks/session-end-autosave.sh,hooks/mb-compact-reminder.sh,hooks/mb-session-start-context.shnow honour anMB_PATHenv override for global-storage mode. Tiering:MB_PATHenv → local<cwd>/.memory-bank/→ registry lookup viascripts/_lib.shwhenMB_AGENTis set._lib.shis sourced in a subshell so itsset -euo pipefaildoes not bleed into the hook. - Git-hooks fallback —
adapters/git-hooks-fallback.shpost-commit body honoursMB_PATHenv so commits in global-storage projects append to the external bank. - OpenCode plugin —
adapters/opencode.shJS plugin readsprocess.env.MB_PATHinstead of hard-codingpath.join(app.path.cwd, '.memory-bank'). - Cursor / Codex / Pi / Windsurf / Cline / Kilo adapters — generated runtime hooks and inline scripts honour
MB_PATH; AGENTS/rules snippets mention the resolver so users discover global mode. - Codex global AGENTS.md —
install.sh codex_agents_sectionnow embeds the full engineering baseline (TDD / SOLID / Clean Architecture / DRY / KISS / YAGNI /[MEMORY BANK: ABSENT]) via sed-merge fromrules/CLAUDE-GLOBAL.md, matching the Pi pattern. Codex global installs get the same rules-only surface as Claude and Pi. - Storage-modes docs —
SKILL.md,README.md,docs/install.md,docs/cross-agent-setup.mddescribe three modes:- Local (default):
/mb initor/mb init --storage=local— bank in the repo (team-shared). - Global (opt-in personal storage):
/mb init --storage=global --agent=<agent>— bank under~/.<agent>/memory-bank/projects/<id>/.memory-bank/, never committed. - Rules-only: no
/mb init— global engineering rules still apply; Memory Bank commands remain inactive.
- Local (default):
- Contract & E2E coverage —
tests/pytest/test_global_storage_contract.py(11 cases) locks hook resolver-aware contract, OpenCode plugin contract, git-hooks fallback contract, and Codex global rules-only surface;tests/e2e/test_global_storage.bats(4 cases) covers cross-cutting story (context without local bank, uninstall preserves external bank, local mode default, install never creates a bank). - Adapter uninstall safety — adapter manifests never list the resolved Memory Bank path; uninstall removes only adapter-owned files. Verified by E2E "uninstall preserves external bank data" case.
Added — Cursor adapter remediation
adapters/cursor.shregisters the full 10-hook Cursor contract (matcher-awarePreToolUse/PostToolUse, project + global installs, idempotent append builder).hooks/mb-session-start-context.sh—sessionStarthook injects capped.memory-bank/context (MB_AUTOLOAD_CONTEXT=offto disable).memory_bank_skill.__version__reads canonicalVERSION(wheel metadata fallback);pyproject.tomluses Hatchversionsource.- Cursor User Rules paste file uses
<!-- memory-bank:start vX.Y.Z -->markers; TTY installs offer clipboard helper.
Added — Pi Code first-class global support
memory-bank installnow registers Pi globally under~/.pi/agent/: managedAGENTS.md,skills/memory-bankalias, and prompt templates inprompts/*.md(/mb,/start,/done,/plan, etc.).memory-bank uninstallremoves Pi managed sections, prompts, and skill alias while preserving user content.adapters/pi.shnow uses the native~/.pi/agent/skillspath;MB_PI_MODE=skillno longer needsMB_EXPERIMENTAL_PI_SKILL, and defaultagents-mdmode works outside git repos.memory-bank initCLI help is client-neutral and reminds Pi users to run/reloadafter installing into an already-open session.
Fixed
memory_bank_skill.__version__reads the canonicalVERSIONat runtime, so the
tag == VERSION ==__version__publish gate no longer drifts (the failure that
blocked the 4.0.0 PyPI publish). This is what unblocks the 5.0.0 release.- CI green —
.shellcheckrc(disable=SC1091, since shellcheck won't follow
sourced libs without-x);adapters/pi.shSRP split →adapters/_lib_pi_global.sh
(351 → 236 lines); ruff import-sort normalization acrosshooks/;SKILL.md
reviewer/tooling table refresh. - Reinstalling refreshes the managed Claude/Pi Memory Bank sections instead of repeatedly localizing every quoted critical rule as a language rule.
- Installer symlink replacement now safely replaces symlink aliases without following or backing up external symlink targets, preserving the symlink-attack guard for file targets.
- Existing Pi skill directory backups are stored under
~/.pi/agent/.memory-bank-backups/instead of~/.pi/agent/skills/, avoiding duplicatememory-bankskill discovery conflicts. MB_PI_MODE=skillleaves an existing global Pi skill symlink unchanged, preventing accidental overwrite of the canonical bundledSKILL.md.
Added — I-004 (auto-commit hook for /mb done)
scripts/mb-auto-commit.sh— opt-in (MB_AUTO_COMMIT=1env or--forceflag) auto-commit of.memory-bank/changes after/mb done. 4 safety gates: bank clean → no-op; dirty source outside bank → skip with warning; rebase/merge/cherry-pick in progress → skip; detached HEAD → skip. Commit subject derives from the last###heading inprogress.md(truncated to 60 chars); fallbackchore(mb): session-end YYYY-MM-DD. Never pushes — push remains an explicit user action.- Wired into
commands/done.mdstep 7 (betweenindex.jsonregen and final report). - 13 new tests (
test_mb_auto_commit.py10 +test_i004_registration.py3). pytest 615 → 628.