Skip to content

Release packaging: Windows installer, Linux tarball, release workflow; engine=auto; legacy/ cleanup - #3

Merged
FMXExpress merged 1 commit into
mainfrom
claude/optimistic-allen-i3bd3d
Oct 29, 2026
Merged

FMXExpress merged 1 commit into
mainfrom
claude/optimistic-allen-i3bd3d

Conversation

@FMXExpress

Copy link
Copy Markdown
Owner

What this adds

memagent is a console app. After this PR you download a release, run it, and it works: on first start it downloads its own models, and it runs on the in-process llama.cpp engine by default.

Repo cleanup

  • The earlier Python prototypes (CragChat variants, MemOS/MemCube, v2/, memos_stable_4bit.zip, the old root requirements.txt and install.sh) moved to legacy/, with their README. The repo root is now memagent only.

Defaults: llama.cpp when it works

  • engine=auto is the new default. It runs llama.cpp in-process when the library and the GGUF model load, and otherwise falls back to the Python worker with a one-line notice. engine=llama / engine=python still force one or the other.

First start downloads what's missing (Mem.Setup)

  • GGUF model: downloaded from the profile's new "gguf": {"url": ...} entry in models.json. These are published GGUFs of the same checkpoints, all URLs verified: tiny f16 271 MB, small q8_0 1.9 GB, medium q8_0 4.3 GB, large Q4_K_M 14 GB.
  • Retrieval models: ONNX Runtime, the embedder, the reranker and the guard model are provisioned once (a marker file in cache/).
  • Control: --offline or auto_provision=0 skips the downloads; --provision downloads everything and exits.
  • Config: if there is no ./memagent.ini, it uses the one next to the binary. The llama.cpp libraries are looked for in cache/llama, then lib/, then the exe folder.

Without Python

  • At startup, memagent prints training: off (no python3 found) ... and turns auto-consolidation off. Chat and short-term memory keep working.
  • A failed consolidation now gives its reason instead of exit -1:.

Windows readiness

  • Certificates: Mem.Https also loads a cacert.pem next to the binary when there is one, because OpenSSL on Windows has no CA store.
  • Console: set to UTF-8 on Windows.

Packaging

  • Linux: scripts/package.sh (make package VERSION=x.y.z) builds a self-contained folder plus tarball (3.9 MB): the binary, the llama.cpp libraries in lib/ (RUNPATH $ORIGIN), the release memagent.ini (auto engine, CPU), models.json, priors, the trainer, and llama.cpp's GGUF converters (MIT, about 5 MB) so training works from an install.
  • Windows: packaging/memagent.iss is an Inno Setup installer.
    • Install: per user with no admin rights, so data\ and cache\ can live next to the exe.
    • Options: add to PATH (optional), download the models during setup (optional).
    • Upgrades and uninstall: an edited memagent.ini is kept on upgrade, and uninstall removes cache\ but keeps the user's memory in data\.
  • .github/workflows/release.yml:
    • Linux: built on ubuntu-22.04 with llama.cpp built portable (no -march=native).
    • Windows: FPC from Lazarus; llama.cpp built with the static MSVC runtime; sqlite3.dll, the OpenSSL 3 DLLs, the VC++ runtime and cacert.pem bundled.
    • Smoke test: each package is unpacked into a fresh folder and run from another directory. It must download its models and answer a memory question on the llama engine.
    • Publish: a v* tag publishes the tarball, the setup exe and a portable zip as a GitHub release. Pull requests build and test only.
  • llama_setup.sh: gains LLAMA_PORTABLE=1 and LLAMA_LIBS_ONLY=1.

Testing (Linux, in the build container)

  • make test: extraction parity 458/458, retrieval, TLS checks (also with a cacert.pem next to the binary), and 22 Python tests.
  • scripts/e2e_demo.sh with engine=auto passes. It resolves to llama.cpp and covers two consolidations, a correction, /forget, /rollback and non-ASCII facts.
  • Release tarball, unpacked into an empty folder and run from a different directory:
    • First start: it downloaded the GGUF and retrieval models through Mem.Https, chatted on llama.cpp, and stored and recalled a fact.
    • Training: with Python, /sleep trained, converted with the bundled converter and hot-swapped. /ab answered "You live in Oslo." from the LoRA alone.
    • Without Python: the "training: off" notice appears, and /sleep gives a readable error.
    • Without lib/: auto falls back to the Python worker and still answers from memory.

Not tested

  • The Windows build: it runs in CI for the first time with this PR. I could not cross-compile memagent.exe here, because building FPC's win64 runtime from the upstream source was blocked in this environment.
  • macOS: no package yet.

Generated by Claude Code

…low; engine=auto

- legacy/: the earlier Python prototypes (CragChat, MemOS, v2) moved out of the root
- engine=auto (default): llama.cpp in-process when it loads, else the Python worker
- first start downloads the GGUF base model (models.json gguf url) and the retrieval
  models; --offline / auto_provision=0 to skip, --provision fetches everything
- config next to the binary when ./memagent.ini is missing; llama libraries found in
  cache/llama, lib/ or the exe folder
- no Python: clear 'training: off' notice, auto consolidation off, and a readable
  consolidation error instead of 'exit -1'
- Mem.Https loads cacert.pem next to the binary (Windows has no OpenSSL CA store);
  Windows console in UTF-8
- scripts/package.sh (make package), packaging/memagent.iss,
  .github/workflows/release.yml (Linux + Windows builds, smoke tests, release on v* tags)
- llama_setup.sh: LLAMA_PORTABLE (no -march=native), LLAMA_LIBS_ONLY

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01NPVFJHeBeotAKkU7EPbTgn
@FMXExpress
FMXExpress merged commit cf5268a into main Oct 29, 2026
1 of 2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants