Elephant Memory is a permanent, knowledge-graph-powered memory engine implemented in C++ for maximum performance and cross-language support.
This project provides a simple yet powerful way to store and retrieve information in a graph-like structure. It's designed to be a long-term memory for AI agents, applications, and systems.
Elephant Memory is built with performance and flexibility in mind. It allows you to:
- Store entities: Represent any object, person, or concept as an entity with a unique ID, name, and type.
- Create relationships: Connect entities with relationships to build a knowledge graph.
- Cross-language support: Use the library in various programming languages through a C-style API.
Follow these instructions to get a copy of the project up and running on your local machine for development and testing purposes.
- C++ compiler (g++, clang, etc.)
- CMake
- Clone the repository:
git clone https://github.com/your_username/elephant-memory-cpp.git cd elephant-memory-cpp
- Build the project:
mkdir build cd build cmake .. make
Here's how you can use Elephant Memory in your C++ projects.
#include "ElephantMemory.h"
int main() {
ElephantMemory mem;
mem.addEntity("1", "Paul", "Person");
mem.addEntity("2", "RTX 4090", "GPU");
mem.addRelationship("1", "likes", "2");
mem.printGraph();
return 0;
}
The C API allows you to use Elephant Memory in other languages like Python, Go, or Rust. Here's an example of how to use it:
#include "ElephantMemory_c.h"
int main() {
ElephantMemoryHandle mem = em_create();
em_add_entity(mem, "1", "Paul", "Person");
em_add_entity(mem, "2", "RTX 4090", "GPU");
em_add_relationship(mem, "1", "likes", "2");
em_print_graph(mem);
em_free(mem);
return 0;
}
The library exposes two main APIs:
- C++ API: Defined in
include/ElephantMemory.h
. It provides an object-oriented interface for working with the memory engine. - C API: Defined in
include/ElephantMemory_c.h
. It's a C-style wrapper that allows you to use the library from other languages.
For detailed information about the API, please refer to the header files.
Contributions are what make the open-source community such an amazing place to learn, inspire, and create. Any contributions you make are greatly appreciated.
If you have a suggestion that would make this better, please fork the repo and create a pull request. You can also simply open an issue with the tag "enhancement".
- Fork the Project
- Create your Feature Branch (
git checkout -b feature/AmazingFeature
) - Commit your Changes (
git commit -m 'Add some AmazingFeature'
) - Push to the Branch (
git push origin feature/AmazingFeature
) - Open a Pull Request
Distributed under the MIT License. See LICENSE
for more information.