Skip to main content

MemNet

Mission working memory for LLMs. A named session graph (GQL node/vertex, edge/relationship, property) that agents pin and mutate — not a notepad in chat, and not the search library.

MemNet sits between LLM call pipelines and data search (MN-REQ-00). Corpus lookup stays on the host (grep, ingest, optional RAG); it may propose locators. In the session, kinds/tags are overlapping cues; recall is serial — cue, then a bounded pin_map neighbourhood. It is not GraphRAG, not a vector store, and not AgensGraph.

This repo ships the engine + generic MCP only. Product shape: docs/SHAPE.md. Pinned role: working set of a few technical documents (atoms and locators, not PDF bytes) plus live TSK/USR/MOD, re-read fast. Tens of MiB typical; hundreds of MiB still in role; gigabytes = RAG/cabinet.

Package memnet-llm (CLI memnet), version 0.20.2 on PyPI. Python ≥ 3.11. 1.0 is not claimed yet. What the version numbers mean (a.b.c): docs/ROADMAP.md.

What's shipped

  • Product gateway — memnet-mcp --transport gateway routes each product, by credential, to the memnet serve that owns its sessions. GQL and @ERR/@WRN/@STAT replies pass through unchanged. See docs/operations/product-gateway-contract.md.
  • Safe upgrade — memnet admin upgrade-prepare drains the serve (new sessions get @ERR: serve_draining|retry_after_s=…), saves every session, and the new version reloads them on start. See docs/operations/safe-upgrade.md.
  • Checkpoints and backups — memnet admin checkpoint saves every loaded session without stopping the serve; memnet admin checkpoint-verify checks a restored copy. The backup doc runs this hourly to R2 with restic, plus a weekly restore check. See docs/operations/backup.md.
  • Admin usage report — memnet admin usage-report (admin token only, not an agent tool) lists active sessions by alias, with no graph content. See docs/operations/admin-usage-report.md.
  • Request log — optional, off by default: --request-log or MEMNET_REQUEST_LOG writes one JSON line per serve request (timings, op, sizes, outcome; no statement text), rotated by size. See docs/operations/request-log.md.
  • Relation names in camelCase — relation types are stored in lowerCamel form: HAS_FACT is stored as hasFact, and both spellings match the same edge. mutate warns when it renames one.

Install + quick CLI

pip install memnet-llm
# or pin: pip install memnet-llm==0.20.2
# optional extras (drivers only — not an AgensGraph server):
# pip install 'memnet-llm[mcp]'
# pip install 'memnet-llm[agensgraph]'
# contributors: pip install -e ".[dev,mcp]"

CLI needs a serve process. Prefer local IPC; TCP is the fallback.

# Terminal 1
export MEMNET_IPC_SOCKET=/tmp/memnet.sock
memnet serve --ipc

# Terminal 2 (same MEMNET_IPC_SOCKET)
memnet session open --map-file parts/common/memnet/memnet/examples/schema.example.txt
# demo-world map for tests; warehouse GQL below is illustrative (not that world's field list)
# stderr prints MEMNET_SESSION=mn_… — pass it as --session (serve proxies argv, not your shell env)

memnet mutate --session mn_… --stdin <<'EOF'
CREATE (t:TSK {goal:'Clear warehouse', status:'in_progress'})
CREATE (n:NPC {role:'helper', status:'active'})
MATCH (n:NPC {role:'helper'}), (t:TSK {goal:'Clear warehouse'})
CREATE (n)-[:helps {note:'labour'}]->(t)
EOF

memnet query find --session mn_… --kind TSK --limit 8
memnet query pin-map --session mn_… --kind TSK --locator 'goal=Clear warehouse' --depth 2

Shaped pin map (illustrative; nickname id only if set):

(:TSK {goal: 'Clear warehouse', status: 'in_progress'})
(:NPC {role: 'helper', status: 'active'})
(:NPC {role: 'helper'})-[:helps {note: 'labour'}]->(:TSK {goal: 'Clear warehouse'})

Create nodes by labels and properties (CREATE () is legal); you don't mint ids yourself. The old id:'NEW' placeholder and @ID: id map are legacy and not part of the product. Each turn, call pin_map(q) (or skip it) and drop earlier maps from the prompt. The old --anchor flag still works, but only as a nickname cue. Agents speak GQL only (openCypher-shaped); no other input format is accepted. The wire format is defined in docs/grammar/gql-wire-profile.md.

MCP in-process (memnet-mcp) does not need serve — that's the usual single-agent path.

Session pipe

Handoff between modules/agents is the sessionId (treat it as a secret capability). The peer re-pin_maps — don't dump the graph into chat. Keep working/mission memory distinct from other product handles (e.g. a company store id); mixing those is an app concern, not MemNet's job.

Import absorb vs shared session

  • Path A — same sessionId; peers just re-pin_map. No import.
  • Path B — separate member session; lead absorbs a bounded slice via memnet import-slice (pattern match, not MERGE-by-id). The old keep/reject/remint id_policy options are legacy and not part of the product. The slice is merged into the lead session (the single source of truth), not appended. ImportGuard / CheapLlmImportGuard is a user-selectable optional soft LLM (feature stays; not deprecated). Absorb works with the key unset. Set MEMNET_IMPORT_GUARD_API_KEY on serve to activate (optional MEMNET_IMPORT_GUARD_BASE_URL / MEMNET_IMPORT_GUARD_MODEL). --no-guard skips the soft pass for one call. Hard ImportAbsorb always runs. Teach: docs/LLM-GUIDE.md.

ACL + transport

CapsPolicy ACL (shipped; off by default until session acl-enable): who (caller) / pin_map vs mutate / WorkerWriteScope hard reject / optional missionId+lease bind.

RSV neighbourhood reserve exists (memnet reserve / extend / release; llm_id + TTL; pin map may show ## Reserves).

Transport: in-process MCP default (one graph per process). Shared graph: memnet serve --ipc (MEMNET_IPC_SOCKET) or TCP memnet serve (127.0.0.1:18765). Multitask / parallel workers need a shared serve — not default in-process.

Durable: optional client memnet-llm[agensgraph]; the cabinet is external and not vendored. Since 0.7 the adapter and an operator-run round trip exist, but nothing calls the cabinet at runtime yet, so a live cabinet is not claimed. Its CI tests skip unless MEMNET_AGENSGRAPH_URL is set. Neo4j is retired (#187). MEMNET_NEO4J_* is ignored (one log warning); the engine still starts.

Not done yet

  • Hosted AgensGraph as a product service (operator runs the server; this repo does not vendor it)
  • N-server session pipe (#47)
  • Reading SysML files or edited pin maps back in (MN-REQ-11.5 SHOULD / #66) — pin_map GQL can be written out today; matching identities on the way back comes later
  • Host search / RAG as a MemNet tool — application nest only (docs/extras/memnet-host-search-nest.md)
Doc Role
docs/LLM-GUIDE.md Agent playbook (GQL only)
docs/SHAPE.md Product shape from the problem
docs/grammar/gql-wire-profile.md GQL wire SSOT
docs/ROADMAP.md Version map SSOT
sysml-models/ Requirements / verify
docs/operations/multi-agent-sessions.md Multitask ops
docs/operations/safe-upgrade.md Upgrade a serve without losing sessions
docs/operations/backup.md Checkpoints, R2 backup, restore check
docs/operations/admin-usage-report.md Admin view of active sessions
docs/operations/request-log.md Optional per-request serve log
docs/operations/product-gateway-contract.md Product gateway wire contract
docs/README.md Full docs index
docs/cap-contract.md Caps a product gate can hit (refuse vs clip, exact wire)

Layout: LAYOUT.md · AGENTS.md. Novel-writer is out: DROP-NOVEL-WRITER.md.

Licence

MIT

Metadata

Release files for memnet-llm 0.20.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for memnet-llm 0.20.3
File Size Uploaded Provenance Actions
memnet_llm-0.20.3.tar.gz 488.0 kB Without provenance Details for memnet_llm-0.20.3.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for memnet-llm 0.20.3
File Interpreter ABI Platform Actions
memnet_llm-0.20.3-py3-none-any.whl Python 3 none any Details for memnet_llm-0.20.3-py3-none-any.whl

Total release size: 829.7 kB

Release files / memnet_llm-0.20.3.tar.gz

Download URL memnet_llm-0.20.3.tar.gz
Size 488.0 kB
Tags Source
SHA-256 checksum
How to use checksums
63854a40b88e4001f4306cce85782fa4b521b0e9bfb1eda854d8ceb3ff45cfff
BLAKE2b-256 checksum
How to use checksums
36686c5061091c5677f14a84a14e27a66278cf6909cfb9e8589ec8313cdc153a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.5

Release files / memnet_llm-0.20.3-py3-none-any.whl

Download URL memnet_llm-0.20.3-py3-none-any.whl
Size 341.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
d1cd7afee83a65eabcb5d3bd72225db70f03c035eafdae55eeef7ada4702e57a
BLAKE2b-256 checksum
How to use checksums
ac8c4fcfeaa663c078a82f5047383cadf9bbde3eaf867d67309df999027e2eea
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.5

Security for memnet-llm 0.20.3

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.20.3 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page