Skip to content

v0.12.1 — Safety / Memory / Platform-cap / Termux-notify patch

Choose a tag to compare

@pineapple-ooo pineapple-ooo released this 20 Jun 16:58
Immutable release. Only release title and notes can be modified.

v0.12.1 — Safety / Memory / Platform-cap / Termux-notify patch

A backwards-compatible patch over v0.12.0. No public-API removals; all CLI
imports from multiligua_cli.*, multiling.*, and minxg.* still work. The
test count goes 161 → 196 (+35) and four new surfaces are now backed by
real implementations instead of silent fallbacks.

Anti-loop guard (src.ai.safety.guard)

Real module replacing the previous from src.ai... import AntiLoopGuard
path that swallowed ImportError and let the LLM spend user money on a
100-call loop. Three independent ceilings fire, in order, before the call
is dispatched:

  • DepthGuard — hard cap on tool calls per turn (~5 mobile, ~8 desktop)
  • DupDetector — same (name, args) within a window of K
  • CostGuard — wall-clock budget (12 s mobile / 30 s desktop)

A short context injection is surfaced to the model the moment a loop
pattern emerges ("deep into tool-call budget (4/5); repeated the same tool 4× in this turn. Stop calling tools and answer the user.") — see
AntiLoopGuard.get_context_injection().

Multi-tier memory (src.ai.memory.*)

Implementation: entropic_evolution.py + working_memory.py.

  • L0 hot — last 32 turns verbatim, deque + JSONL append log.
  • L1 warm — bag-of-hashes quantised vectors (256-D, 8-bit per dim),
    cosine-sim retrieval, capped to 10 000 items (~ 640 KB).
  • L2 cold — sqlite-backed compressed storage at ~/.minxg/memory.db
    (path overridable via MINXG_L2_DB). Re-hydrated on cold-start so a
    fresh chat session can resume without re-priming.

The engine never throws on input — bad args degrade silently so a chat
never dies on a malformed payload.

Per-platform tool cap (multiling/platform_cap.py)

Platform Cap
android 600
linux 1000
macos 1000
windows 1000
unknown 500

Override at runtime via MINXG_TOOL_CAP. The cap is applied as a prefix
to tools.registry insertion order; first N tools are visible, the rest
are filtered out of get_all_tool_names, get_available_toolsets, and
handle_function_call. The registry keeps all definitions so dropping
is non-destructive and a later opt-in extension can re-expose them.

Termux-API notify (src.ai.notify.termux)

Real Android notifications via termux-notification — only on Termux /
ZeroTermux. Every other platform returns False from the helpers without
ever raising. install.sh grew a final block that hits
notify_task_completed() when MINXG_NOTIFY=1 is set; outside Termux
the block is silent.

MINXG_NOTIFY=1 bash install.sh   # on Termux: real notification
                                 # elsewhere: log line then exit

CLI chat rewrite (multiligua_cli/tui_chat.py)

Three visible regions now: a top status bar (provider / model / host /
depth / cost), the conversation area, and the prompt. Newer banner with
a blocky wordmark that survives weird terminal metric ratios.

New slash commands added:

/memory   memory-tier snapshot (L0/L1/L2 counts)
/doctor   self-check inline
/forget   reset anti-loop counter (escape a wedge)
/reset    reset memory engine

install.sh

  • Step labels re-numbered 1..6 — the previous "8-step" ladder was
    misleading because the two ADB/ROOT auto-detect blocks were dropped
    in 0.11 without re-numbering.
  • cpp_core CMake wiring added in [4/6] so libminxg_core.so and
    libminxg_cpp_json.so are actually built at install time. Before this
    patch, minxg doctor reported native lib WARN native library 'libminxg_core.so' not found on a fresh install.
  • Termux notify integration guarded by MINXG_NOTIFY=1.

Doctor (multiligua_cli/doctor.py)

Adds a "Tool cap" section so the user can see the platform budget at a
glance:

                                    Tool cap
    platform                        OK        android
    tool cap                        OK        600
    active tools                    OK        26 / 26

C/C++ memory safety

  • cpp_wrapper.c:560strcpy(table[...].word, word) replaced with
    memcpy + explicit NUL. Stays in bounds under all current inputs;
    defensive against future bound-slip regressions.
  • tests/asan_harness.c (still in the tree from 0.12.0) verifies
    rc=0 — zero leaks, zero use-after-free, zero OOB — across the
    full C API surface (arena, slab, ring buffer, sha256, url paths,
    tokenize, NCD pair/matrix).

Verification

$ python3 -m pytest tests/ -q
196 passed, 1 skipped in 3.97s

$ bash install.sh --help                # exits 0
[1/6] checking python...                # no longer skips
[2/6] installing python dependencies...
[3/6] registering global command...
[4/6] building native library...        # now actually builds
[5/6] checking python source compiles...
[6/6] extension self-check...

$ minxg doctor
 0 failure(s), 0 warning(s) out of 26 check(s)

See CHANGELOG.md for the full release notes
(entry [0.12.1] - 2026-06-21).