In-memory working-memory graph CLI for LLM agents (goldfish brain scratch space)
Project description
MemNet
MemNet (Net of Memory) is an in-memory NODE | EDGE graph that sits between pipelines of LLM calls and data search. It is working memory for agents — not a chat notepad and not the search corpus.
Aims (MN-REQ-00): save wall-clock time and tokens while keeping factual accuracy when presenting facts. It aids system, programme, software, firmware, hardware, and documentation development.
Version: see project.toml / package memnet-llm (CLI command remains memnet). Python ≥ 3.11.
Doctrine (target)
| Idea | Meaning |
|---|---|
| NODE | EDGE only | Conceptual kinds are nodes and edges; tags realise node kinds |
| One agent dialect | Tier A Write = display — same shapes for live read and mutate |
| Live pin map | Bounded ego/anchor digest for the turn (not a session dump) |
NEW vs locators |
LLM creates use mint token NEW; pin-map ingest uses stable locators (no client NEW for source pins). PCBA schematics use Atopile .ato |
| Transport | In-process first; local IPC next; TCP localhost as migration fallback |
| Persistence | Optional snapshots (session save / session load); sessions are RAM + TTL |
Primary term: pin map. CLI/MCP query warm / query_warm is a legacy alias until call sites rename.
Agent I/O (Tier A)
Target surface (not @TAG pipe). Shared NODE | EDGE field shapes. Mutate uses ops (+ create, ~ update, - drop). Live pin map emits bare present lines — no leading ops (ops are mutate-only; a pin-map + would look like “please add”).
Mutate input (LLM → MemNet) — may use [NEW]; engine mints ids:
## Nodes
+ CLM [NEW] ; type=decision ; code=bitrate cap 2000 bps ; recycle=persistent
+ TSK [T42] ; goal=Clear warehouse ; status=in_progress ; recycle=persistent
## Edges
+ E77 [N03] --(helps)--> [T42] ; note=labour ; recycle=persistent
Live pin map output (MemNet → LLM) — assigned ids, no NEW; copyable for the next mutate:
## Nodes
CLM [C12] ; type=decision ; code=bitrate cap 2000 bps ; recycle=persistent
TSK [T42] ; goal=Clear warehouse ; phase=2 ; status=in_progress ; recycle=persistent
NPC [N03] ; role=helper ; status=active ; recycle=persistent
## Edges
E77 [N03] --(helps)--> [T42] ; note=labour ; recycle=persistent
- Create:
[NEW]/ leadingNEW— engine allocates ids; copy them afterwards. - Update / settle: known ids only;
NEWillegal on patch. - Pin-map ingest (SysML, codebase, PCBA
.ato, skills): deterministic ids from locators (refdes=,path=,qname=, …); reject clientNEWfor those pins.
Design and examples: docs/grammar/memnet-grammar-design.md, docs/grammar/examples/. SysML notes: sysml-models/outputs/system-design-notes.md.
Current vs target (honest)
| Area | Today (as-is) | Target |
|---|---|---|
| Agent wire | Mutate + live pin map prefer Tier A; legacy @TAG pipe still accepted on add/update and used in snapshots / read |
Tier A shared shapes; pin map bare present; mutate keeps ops |
| Tier A | Pure-Python codec in memnet/tier_a.py + golden tests |
SSOT parse/emit; ANTLR optional later |
| Id mint | IdAllocator wired through MutateGate on Tier A batches |
Same |
| MutateGate | mutate_gate.py — Tier A parse → mint → commit; pipe import-once |
Same dialect only |
| Live pin map | PinMapComposer via query warm / query_warm (Tier A emit) |
Rename alias when call sites ready |
| Transport | MCP in-process by default; MEMNET_MCP_TRANSPORT=tcp for serve |
In-process primary; local IPC; TCP fallback |
| MCP | Generic tools; in-process engine | Same |
| Novel-writer | Removed — see DROP-NOVEL-WRITER.md |
Stay out of this repo |
docs/LLM-GUIDE.md is still largely pipe-centric (goldfish loop, query warm). Prefer the grammar design + SysML notes for the forward dialect; treat the GUIDE as operational until it is migrated.
Layout
Part-based tree (LAYOUT.md, AGENTS.md):
| Path | Role |
|---|---|
parts/common/memnet/ |
Core library + CLI (memnet) |
parts/memnet-mcp/ |
Generic MCP server (memnet-mcp) |
docs/ |
LLM-GUIDE, grammar, application notes |
sysml-models/ |
Requirements and deploy/behaviour models |
tests/ |
Engine, MCP, Tier A golden tests |
Do not recreate top-level src/ or applications/. Do not restore parts/novel-writer/.
Installation
pip install memnet-llm
# or from source:
pip install -e ".[dev]"
# optional MCP:
pip install memnet-llm[mcp]
PyPI name is memnet-llm (memnet on PyPI is a different project).
Quick start (as-is CLI)
Until Tier A is universal at every boundary, CLI sessions still use serve; agent mutate prefers Tier A.
Terminal 1:
memnet serve
# MEMNET_SERVE=127.0.0.1:18765
Terminal 2:
memnet session open --map-file parts/common/memnet/memnet/examples/schema.example.txt
$env:MEMNET_SESSION = "mn_xxxxxxxx" # from stderr
memnet add --file parts/common/memnet/memnet/examples/workflow.example.txt
memnet query warm --anchor PLR01 # live pin map (bare present; legacy command name)
memnet session close $env:MEMNET_SESSION
Without memnet serve, stateful commands fail with @ERR: serve_required (unless MEMNET_TEST_INLINE=1 for tests/scripts).
MCP (as-is): run memnet serve, then memnet-mcp. Tools include serve_status, session_open, session_current, session_load, session_save, query_warm, query_walk, add, update, read_get, housekeep_stats. Envelope is JSON; memory payload is still pipe lines today.
Forward reading order for agents:
docs/grammar/memnet-grammar-design.md— Tier A, pin map,NEWvs locatorssysml-models/outputs/system-design-notes.md— target part tree and gapsdocs/LLM-GUIDE.md— current goldfish loop (pipe; migration pending)
What was removed
Novel-writer (parts/novel-writer/, novel MCP extras, novel application notes) is out of scope. This repository hosts the graph engine and generic memnet-mcp only. Record: DROP-NOVEL-WRITER.md.
Licence
MIT
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file memnet_llm-0.3.0.tar.gz.
File metadata
- Download URL: memnet_llm-0.3.0.tar.gz
- Upload date:
- Size: 157.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
be1c2d59904125dfc57ce210b869fa0430c645508b9a24c5c357d2103b32aea7
|
|
| MD5 |
1298f492050e89e9017c5c52efdb4095
|
|
| BLAKE2b-256 |
397bce8a9e76b762c3d0ed7f80ae0118b46826e5281967c7ce53081b052f1ea3
|
File details
Details for the file memnet_llm-0.3.0-py3-none-any.whl.
File metadata
- Download URL: memnet_llm-0.3.0-py3-none-any.whl
- Upload date:
- Size: 165.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5ab16d4972f4a5d45d1d2ace49b377cd84a6878e549f86e1f2995d09abc186a1
|
|
| MD5 |
02697b2853292a83a2af103d10468f06
|
|
| BLAKE2b-256 |
885e55c72195890e45ddbda2b398d77df8b946d6c4bb321558903a0dff4cd9f1
|