_lib.sh | Shared helpers sourced by other scripts |
mb-context.sh [--deep] | Build context from core files (STATUS + plan + checklist + RESEARCH + codebase summary). --deep shows full codebase docs |
mb-statusline.py [--install] | Claude Code statusline showing context-window fill % (used/limit, 1M-aware) + model · branch · project. Reads the status JSON on stdin; --install wires it into ~/.claude/settings.json (backup, no clobber) |
mb-search.sh <q> [--tag t] | Keyword search across the memory bank. --tag filters via index.json |
mb-note.sh <topic> | Create notes/YYYY-MM-DD_HH-MM_<topic>.md. Collision-safe (_2 / _3) |
mb-plan.sh <type> <topic> | Create plans/YYYY-MM-DD_<type>_<topic>.md with <!-- mb-stage:N --> markers |
mb-plan-sync.sh <plan> | Synchronize a plan ↔ checklist + roadmap + status (idempotent) |
mb-plan-done.sh <plan> | Close a plan: ⬜→✅ + move to plans/done/ |
mb-idea.sh <title> [HIGH|MED|LOW] | Capture a new idea in backlog.md with monotonic I-NNN |
mb-idea-promote.sh <I-NNN> | Promote an idea (I-NNN) into an active plan |
mb-adr.sh <title> | Capture an Architecture Decision Record in backlog.md (ADR-NNN) |
mb-init-bank.sh | Deterministic, locale-aware .memory-bank/ scaffolder |
mb-config.sh | Memory Bank config resolver + locale auto-detector |
mb-metrics.sh [--run] | Language-agnostic metrics (12 stacks). --run captures test_status=pass|fail |
mb-index.sh | Registry of all entries (core + notes/plans/experiments/reports) |
mb-index-json.py | Build index.json (frontmatter notes + lessons headings). Atomic write |
mb-drift.sh | 8 deterministic drift checkers (path, staleness, script coverage, dependency, cross-file, index sync, command, frontmatter) |
mb-progress-chain.sh | --rebuild-tail / --verify the progress.md append-only hash chain (index.json:progress_chain); CRITICAL drift on tamper (handoff-v2) |
mb-rules-check.sh | Deterministic rules enforcement (SRP / Clean Architecture / TDD delta) |
mb_rules_check_lib.sh | Shared helper library for mb-rules-check.sh |
mb_rules_check_profile.sh | Profile resolution and output emitters for mb-rules-check.sh |
mb_rules_check_baseline.sh | Baseline SRP / Clean Architecture / TDD checks for mb-rules-check.sh |
mb_rules_check_stack.sh | Stack-aware and FSD checks for mb-rules-check.sh |
mb-done-gates.sh | Mandatory /mb done gate set (tests + rules + placeholder scan); --force --reason records a NOTE in progress.md (handoff-v2) |
mb-test-run.sh | Structured test runner with per-stack output parsing → strict JSON |
mb-deps-check.sh [--install-hints] | Preflight dependency checker (python3, jq, git + optional tree-sitter, networkx) |
mb-checklist-prune.sh [--apply] | Collapse completed sections in checklist.md to one-liners (≤120-line cap). Rule: checklist.md = open TODO only; commit hashes / test counts / closeouts go to progress.md. Opt-in SessionEnd autoprune when it exceeds the cap via MB_CHECKLIST_AUTOPRUNE=on (hooks/mb-checklist-autoprune.sh) |
mb-compact.sh [--apply] | Status-based compaction decay — archive old done plans + low-importance notes |
mb-handoff.sh | Handoff capsule manager — --actualize / --read / --rotate a ≤1500-byte session capsule under handoff/ (handoff-v2) |
mb-tags-normalize.sh [--apply] | Levenshtein-based tag synonym detection + merge across notes/ |
mb-roadmap-sync.sh | Regenerate roadmap.md autosync block from plans/*.md frontmatter |
mb-traceability-gen.sh | Regenerate traceability.md from specs + plans + tests |
mb-ears-validate.sh <file> | Validate REQ bullets against the 5 EARS patterns |
mb-req-next-id.sh | Emit the next monotonic REQ-NNN identifier |
mb-sdd.sh <topic> | Create a Kiro-style spec triple under specs/<topic>/ (requirements / design / tasks). Scaffolds an optional ## Scenarios (GIVEN/WHEN/THEN) section |
mb-scenario-extract.py <file> | Extract <!-- mb-scenario:N --> GIVEN/WHEN/THEN blocks → normalized test-plan (JSON Lines: covers + steps + stable test_id). --validate checks present scenarios are well-formed. Opt-in layer; absent scenarios → empty/no-op |
mb_work_items.py | Shared parser for plan stages (<!-- mb-stage:N -->) and spec tasks (<!-- mb-task:N -->); CLI emits JSON Lines |
mb_req_id.py | Shared REQ-ID grammar (single source of truth) used by traceability / spec-validate / ears-validate. Supports prefixed schemes (REQ-RS-008), distinguishes a definition from a mid-line mention, expands REQ-RS-002/003 slash-shorthand, and maps pytest identifiers (req_rs_008) onto canonical ids |
mb-spec-validate.sh <topic|spec-dir|spec-file> | Validate spec triple integrity (EARS, parseable tasks, per-task Covers/DoD/Testing, no REQ orphans). Present GIVEN/WHEN/THEN scenarios are structure-checked; --require-scenarios (opt-in) enforces ≥1 scenario per REQ; --require-tests (opt-in) enforces ≥1 covering test per REQ (scans <repo>/tests, <mb>/tests, or MB_TEST_ROOTS). --json mode for structured output |
mb-spec-tasks-migrate.sh <topic|tasks-file> [--apply|--dry-run] | Migrate legacy ## N. ... tasks to <!-- mb-task:N --> format. Dry-run default, --apply writes backup before changes, idempotent |
mb-pipeline.sh | Manage the project's pipeline.yaml (spec §9) |
mb-pipeline-validate.sh | Structural validation for pipeline.yaml (spec §9) |
mb-work-resolve.sh | Resolve <target> arg into a plan/spec path (spec §8.2) |
mb-work-range.sh | Emit per-stage indices (plan mode) or per-sprint paths |
mb-work-plan.sh | Emit per-stage execution plan as JSON Lines (spec §8) |
mb-work-budget.sh | Token budget tracker for /mb work --budget |
mb-work-protected-check.sh | Match files against pipeline.yaml:protected_paths |
mb-work-review-parse.sh | Validate reviewer output for /mb work review-loop |
mb-work-severity-gate.sh | Apply pipeline.yaml:severity_gate to review counts |
mb-work-trend.sh | Review-cycle trend: weighted score (10×blocker + 3×major + 1×minor) vs the previous cycle → improving / stagnant / regressing / null (work-loop-v2 G2) |
mb-work-pivot.sh | Decide refine / pivot_in_role / pivot_via_architect from the trend + cycle count, instead of grinding the same fix (pivot_after_cycles, pivot_escalate_to_architect_on) |
mb-work-contract.sh | Per-stage "what done means" contract under <bank>/contracts/<topic>_stage-<N>.md — create / read / validate / path; the reviewer can judge against it |
mb-workflow.sh | Resolve the active workflow + per-step model/thinking config from pipeline.yaml for /mb work |
mb-drive.sh | Autonomous goal-driven loop: next reads goal-acceptance + the firewall + work-state + budget and emits exactly one action (implement / repair / pivot / stop_*). Stateless, fail-closed — stop_success requires a green firewall AND 100% acceptance (REQ-DR-014) |
mb-work-state.sh | Durable /mb work loop-state + max_cycles enforcement; optional per-run isolation/claim under MB_WORK_PARALLEL |
mb-work-slots.sh | Sourced helper: per-run state/budget slot-path resolution + source→run claim index (gated behind MB_WORK_PARALLEL) |
mb-work-checkbox.sh | Deterministic DoD-checkbox flip, gated on the run's work-state phase (single-writer for checklist.md) |
mb-work-diff.sh | Baseline-scoped diff for a /mb work run — feeds verify/review with the stage's own changes only |
mb-work-progress-append.sh | Locked, atomic, append-only writer for <bank>/progress.md (safe under concurrent runs) |
mb-work-codex-preflight.sh | Fail-safe codex CLI availability/auth health-check before a cross-model review wave |
mb-session-doctor.sh | Diagnose session-memory subsystem health (unsummarized sessions, missing index/adapters, legacy stubs) |
mb-agent-caps.sh | Capability-aware dispatch: resolve CLI transport (pi/opencode/codex/claude-agent) + concrete model per role by probing CLI presence and model availability |
mb-reviewer-resolve.sh | Pick the active reviewer agent name |
mb-review.sh | Review orchestrator entry point: deterministic 5-section payload assembly (diff + calibration examples + test evidence + auto-findings), model-agnostic, --emit-payload/--input |
mb-review-cache.sh | Touched-file test-evidence cache: compute_touched_sha + TTL HIT/MISS resolution under .memory-bank/tmp/ |
mb-review-examples.sh | Layered calibration-example loader: project-over-skill precedence by example_id, fence-aware parser, per-category rotation, path-traversal/symlink-safe; renders the ## Calibration examples payload section |
mb-session-spend.sh | Session token-spend tracker (sprint context guard) |
mb-session-recent-rebuild.sh | Regenerate session/_recent.md from session/*.md (keeps newest MB_RECENT_KEEP; deterministic, idempotent) |
mb-recap.sh <sid> | /mb recap: reconstruct a full progress.md entry from session/<sid>*.md via one Haiku call, replacing that session's auto-capture stub idempotently (recapped frontmatter). Missing session → exit non-zero, no writes; real entry already present → refuse |
mb-conflicts.sh [--judge] [--threshold N] | /mb conflicts: report memory entries with high lexical overlap and opposing/replacement assertions (en+ru markers) as conflict candidates — $0 pass (token-set Jaccard > N, default 0.3) over notes/ + lessons.md + recent progress.md, zero LLM calls. --judge confirms/rejects each pair via one Sonnet call + prints a suggested [SUPERSEDED: YYYY-MM-DD -> <ref>] marker. PRINT-ONLY — never writes to any bank file |
mb-consolidate.sh [--apply] [--days N] | /mb consolidate: fold sessions older than N days (default 30) that cluster by shared files / lexical overlap into 5–15 line notes/ candidates, archive those session files VERBATIM → session/archive/, and move their contiguous auto-capture progress STUBS VERBATIM → progress-archive.md. Zero LLM calls. Dry-run is the DEFAULT (writes nothing — bank byte-identical); --apply performs it. Real progress entries are immutable and never move |
mb-auto-commit.sh | Opt-in auto-commit of .memory-bank/ after /mb done (MB_AUTO_COMMIT=1 or --force) — 4 safety gates, MB-only staging, never pushes |
mb-freshness.sh [--porcelain|--stop-nudge|--banner] | Deterministic MB-vs-code drift alarm (behind/dirty); drift-gated Stop nudge + SessionStart banner (MB_DRIFT_WARN_COMMITS/MB_DRIFT_WARN_DIRTY_LINES, opt-out MB_FRESHNESS_BANNER=off). See docs/concepts/session-memory.md for the auto-commit recipe |
mb-migrate-v2.sh | One-shot v1 → v2 migrator for .memory-bank/ |
mb-migrate-structure.sh | One-shot v3.0 → v3.1 structure migrator for .memory-bank/ |
mb-import.py | Claude Code JSONL → Memory Bank bootstrap importer |
mb-openspec.sh | Thin dispatcher for the OpenSpec import adapter: import|list|status|sync → mb-openspec.py |
mb-openspec.py | One-way OpenSpec changes/<id>/ → MB spec triple specs/<topic>/ import + drift-aware list/status/sync (opt-in --normalize LLM slot layer) |
mb_openspec_model.py | Dataclasses shared by the OpenSpec adapter's parser/converter |
mb_openspec_parse.py | Read-only OpenSpec change parser (parse_change, compute_source_hash) |
mb_openspec_convert.py | Deterministic OpenSpec → MB spec-triple converter (anchors, EARS classify, re-import anchor reuse) |
mb_openspec_normalize.py | Opt-in --normalize LLM slot layer + source-hash cache for the OpenSpec adapter (fail-open) |
mb-agree.sh | Single writer for the running list of agreements (agreements.md): add|defer|reject|question|resolve|list|sync + managed-block sync |
mb-codegraph.py | Code graph orchestrator. Extractors in memory_bank_skill/: codegraph_python (stdlib ast), codegraph_treesitter (multi-language, opt-in), codegraph_analytics (communities/cohesion/betweenness, optional networkx), codegraph_cochange (git co-change edges via opt-in --cochange) |
mb-graph-query.py | Query codebase/graph.json: neighbors, impact, tests, explain, summary with JSON/markdown output |
mb_graph_query_core.py | Core graph loading, matching and payload builders for mb-graph-query.py |
mb_graph_query_render.py | Markdown summary renderers for graph-query output |
mb-code-context.py | GraphRAG-lite evidence pack: optional semantic candidates + graph expansion + text/read fallback |
mb_code_context_core.py | Core evidence-pack orchestration for mb-code-context.py |
mb-semantic-search.py | Semantic code search over graph.json (+ wiki): --backend auto (embeddings when sentence-transformers installed, else pure-Python BM25 — the $0 zero-dep base), --source-only, disk cache in .index/codesearch/. Modules in memory_bank_skill/: semantic_search, semantic_embeddings, codegraph_loader |
mb-wiki.py | /mb wiki engine (deterministic prep): plan/packs/write-article/merge-edges/index. LLM articles + surprising-connection edges via host subagents. Modules: wiki_evidence, wiki_store |
mb-context-slim.py | Slim a full agent prompt on stdin → terse version on stdout |
mb-upgrade.sh [--check|--force] | Self-update the skill from GitHub |
mb-version-check.sh [--force] | Is a newer release out? Compares local VERSION against the latest GitHub Release (PyPI JSON as fallback), cached with a TTL. Prints strict JSON (current/latest/update_available/flavor/upgrade_command/checked_at/source). Always fail-open — exit 0, silent, never blocks a session. Off: MB_UPDATE_CHECK=off |
mb-profile.sh | Rule profile manager: init, show, path, validate, set — user/project scopes |
mb-diff-scope.sh | L5 diff-scope backstop: compare changed files against an allowed glob scope and report out-of-scope changes (exits 0, JSON report; ADR-4) |
mb-fanout.sh | Stateless fan-out helper: run N branch prompts concurrently via background jobs, capture JSON results, and aggregate into one object — exit-code authority for failed branches (REQ-DF-084) |
mb-flow-branch-sink.sh | Per-branch result sinks with write-once discipline for <!-- mb-flow --> fence: each parallel branch writes to its own .mb-flow/branch-<i>.json to prevent races (ADR-9) |
mb-flow-route.sh | Deterministic route resolver: apply route-floor rules (REQ-DF-022) to an LLM-proposed or user-supplied route and write the resolved route: into the <!-- mb-flow --> fence in status.md |
mb-flow-sync.sh | Regenerate the <!-- mb-flow --> runtime fence in status.md: emit route, phase, checks, gate, last-verify-sha, and stall-count fields (REQ-DF-030/031/032) |
mb-flow-verify.sh | THE firewall fan-out: run route-relevant check runners, normalize verdicts via mb-work-severity-gate.sh, and exit 0/1/2 — the sole exit-code authority of the dynamic-flow firewall (ADR-3) |
mb-goal-acceptance.sh | L5 goal-acceptance aggregator: parse ## Acceptance criteria checkboxes in goal.md and report whether every criterion is satisfied (exits 0, JSON report; REQ-DF-042) |
mb-goal-validate.sh | Validate a goal.md before a Dynamic Flow run: enforce required sections, acceptance-criteria items, and field completeness — fail-loud exit 1 on malformed goals (REQ-DF-004) |
mb-lint-run.sh | L5 lint runner: auto-detect project stack via mb-metrics.sh, map to linter (ruff/shellcheck), run it, and report findings (exits 0, JSON report; ADR-3; unknown stack = SKIP) |
mb-no-todo.sh | L5 residual-placeholder runner: scan target files for TODO/FIXME/HACK markers, reusing mb_rules_check_lib.sh::scan_placeholders patterns and exemptions (exits 0, JSON report; REQ-DF-042) |
mb-session-prune.sh | Archive contentless session stubs out of <bank>/session/ into session/archive/stubs/; dry-run is the default, --apply performs the move. Also flags/repairs bloated files (>MB_SESSION_BLOAT_BYTES) with post-## Summary bullets |
mb-session-repair.sh [--apply] <file> | Repair a session file corrupted by the legacy append-after-## Summary bug: move turn-bullets back into ## Live log, reset summarized=false, re-cap over-long bullets, keep a archive/pre-repair/ backup. Dry-run default, idempotent, fail-safe |
mb-settings-ensure-timeout.py | Surgically ensure the SessionEnd mb-session-end.sh hook command carries a per-command timeout so the Haiku summarizer is not SIGKILLed before writing ## Summary |
mb-subinvoke-resolve.sh | Resolve the per-agent shell sub-invoke command template for the active agent (mirrors mb-reviewer-resolve.sh); used by mb-fanout.sh to bake --cmd when the operator does not supply one (REQ-DF-082) |