K-Memory – Persistent Memory for AI

kensaiArt1 pts0 comments

GitHub - mackopofa/k-memory: K-Memory — Persistent, self-installing memory for AI agents. Zero dependencies. Pure Python. · GitHub

/" data-turbo-transient="true" />

Skip to content

Search or jump to...

Search code, repositories, users, issues, pull requests...

-->

Search

Clear

Search syntax tips

Provide feedback

--><br>We read every piece of feedback, and take your input very seriously.

Include my email address so I can be contacted

Cancel

Submit feedback

Saved searches

Use saved searches to filter your results more quickly

-->

Name

Query

To see all available qualifiers, see our documentation.

Cancel

Create saved search

Sign in

/;ref_cta:Sign up;ref_loc:header logged out"}"<br>Sign up

Appearance settings

Resetting focus

You signed in with another tab or window. Reload to refresh your session.<br>You signed out in another tab or window. Reload to refresh your session.<br>You switched accounts on another tab or window. Reload to refresh your session.

Dismiss alert

{{ message }}

mackopofa

k-memory

Public

Notifications<br>You must be signed in to change notification settings

Fork

Star

main

BranchesTags

Go to file

CodeOpen more actions menu

Folders and files<br>NameNameLast commit message<br>Last commit date<br>Latest commit

History<br>12 Commits<br>12 Commits

extras

extras

tests

tests

.gitignore

.gitignore

LICENSE

LICENSE

README.md

README.md

install.sh

install.sh

k-core.py

k-core.py

k-detector.py

k-detector.py

View all files

Repository files navigation

K-Memory ⚔️ v2.1

Persistent memory for AI agents. Zero dependencies. Pure Python.

A self-contained memory engine for LLMs and agents. Store, link, summarize and export knowledge using only Python stdlib. No vectors, no cloud, no lock-in.

Installation

bash curl -fsSL https://raw.githubusercontent.com/mackopofa/k-memory/main/install.sh)

Or manually:

git clone https://github.com/mackopofa/k-memory.git ~/k-memory<br>cd ~/k-memory && python3 k-core.py

Quick Start

# Store a fact<br>python3 k-core.py --remember "Recency boost weights recent facts 10x higher" --domain "features"

# Retrieve relevant facts<br>python3 k-core.py --recall "recency boost"

# Summarize a domain<br>python3 k-core.py --summary --domain "features"

# Summarize all domains<br>python3 k-core.py --summarize-all

# Export knowledge graph as Markdown<br>python3 k-core.py --export

# Export as Mermaid diagram (Obsidian-ready)<br>python3 k-core.py --export --mermaid

Features

Feature<br>What it does

Recency boost<br>Recent facts weighted 10x higher. Half-life: 90 days.

Auto-summary<br>Structured domain summaries with TF-IDF + trend detection. No LLM needed.

Deduplication<br>Jaccard + SequenceMatcher fusion. No duplicate facts.

Export Markdown<br>Full knowledge graph as human-readable .md

Export Mermaid<br>Interactive graph diagram for Obsidian/Notion

Portable<br>Single file, zero dependencies, works everywhere

Commands

Command<br>Effect

--remember<br>Store a fact with timestamp, domain, importance

--recall<br>Retrieve relevant facts (sorted by relevance × recency)

--summary [--domain X]<br>Structured summary of a domain

--summarize-all<br>Summary of all domains

--export [--mermaid]<br>Export graph as Markdown or Mermaid

--version<br>Show version

Architecture

~/k-memory/<br>├── k-core.py # Memory engine (v2.1)<br>├── k-detector.py # Environment auto-detector<br>├── install.sh # One-command installer<br>├── LICENSE # MIT<br>├── tests/<br>│ └── test_core.py # 30 tests, pure stdlib<br>├── graph.json # Knowledge graph (nodes + edges)<br>├── index.md # Readable index<br>├── brain/ # Individual .md lobe files<br>├── summaries/ # Auto-generated domain summaries<br>├── extras/ # Optional plugins<br>│ └── k-embeddings.py # Semantic search (Ollama)<br>├── exports/ # Generated exports<br>└── knowledge/ # Detailed knowledge (optional)

Tests

python3 tests/test_core.py # 30 tests, zero external dependencies

Extras

Optional plugins that extend K-Memory with advanced capabilities. They require external dependencies — unlike the core.

Plugin<br>What it does<br>Requires

extras/k-embeddings.py<br>Semantic search by meaning , not keywords<br>Ollama + requests

pip install requests<br>ollama pull nomic-embed-text # 274 MB, local, free<br>python3 extras/k-embeddings.py --recall "concept"

Performance

Zero external dependencies (pure Python stdlib)

Portable: Ubuntu, Debian, macOS, WSL, Termux

Handles 10,000+ nodes without slowdown

Each operation<br>Why K-Memory?

K-Memory was born from a simple observation: current memory systems for AI agents either depend on cloud vector databases or bloat dependencies. K-Memory is the opposite — it refuses to grow. One file, one data format, one commit, one python3 command. It doesn't try to be everything. It tries to be enough.

License

MIT — Copyright (c) 2026 KensaiArt. See LICENSE.

KensaiArt — Architecture & Design ⚔️ Stronger every day.

About

K-Memory — Persistent, self-installing memory for AI agents. Zero dependencies. Pure Python.

Resources

Readme

License

MIT license

Uh oh!

There was an error while loading. Please reload this...

memory core python3 export dependencies domain

Related Articles