Skip to content

saranganet/MemoryMesh

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

MemoryMesh

A context and memory management system for business AI agents that stores business memories, assigns dynamic trust scores that decay over time, and surfaces contextually relevant memories for business decisions.

Features

  • Entity Management: Create and manage business entities (suppliers, customers, warehouses, people)
  • Memory Storage: Store business memories with financial impact, volatility classification, and tags
  • Dynamic Trust Scoring: Trust scores decay over time based on volatility class and recency
  • Trajectory Detection: Analyze entity performance trends (IMPROVING, DECLINING, VOLATILE, STABLE)
  • Contextual Decision Support: Get relevant memories based on decision type and context budget

Tech Stack

  • Backend: Node.js, Express, MongoDB Atlas, Mongoose
  • Frontend: React, Tailwind CSS, Axios
  • Trust Engine: Custom mathematical models for trust scoring and trajectory analysis

Getting Started

Prerequisites

  • Node.js (v14 or higher)
  • MongoDB Atlas account
  • Git

Installation

  1. Clone the repository
  2. Navigate to the project directory
  3. Install dependencies for both server and client
# Install root dependencies
npm install

# Install server dependencies
cd server && npm install

# Install client dependencies
cd ../client && npm install

Environment Configuration

  1. Create a .env file in the root directory
  2. Add your MongoDB Atlas connection string:
MONGO_URI=mongodb+srv://username:password@cluster.mongodb.net/memorymesh?retryWrites=true&w=majority
PORT=5001

Database Seeding

Run the seed script to populate the database with sample data:

npm run seed

This will create:

  • XYZ Corporation (supplier) with quality incidents, delivery issues, and recent improvements
  • TechCorp Inc. (customer) with contract renewals, technical issues, and leadership preferences

Running the Application

Start both the server and client concurrently:

npm run dev

Or run them separately:

# Start backend server (port 5001)
npm run server

# Start frontend client (port 3000)
npm run client

API Endpoints

Entities

  • POST /api/entities - Create a new entity
  • GET /api/entities - List all entities

Memories

  • POST /api/memories - Add memory to an entity
  • GET /api/memories/:entityId - Get all memories for an entity

Context Engine

  • POST /api/context - Get contextual memories for decision making
  • GET /api/context/dashboard - Get dashboard statistics

Trust Score Calculation

The trust score is calculated using:

trust_score = base_weight × recency_decay × consistency_factor × source_reliability
  • Base Weight: Normalized financial impact (0-1)
  • Recency Decay: Exponential decay based on volatility class
    • STRUCTURAL: λ = 0.0019 (half-life ~365 days)
    • BEHAVIORAL: λ = 0.0077 (half-life ~90 days)
    • ENVIRONMENTAL: λ = 0.0231 (half-life ~30 days)
  • Consistency Factor: Sentiment analysis against recent memories
  • Source Reliability: Reliability score of the information source

Trajectory Detection

Entity trajectories are determined by comparing average trust scores:

  • IMPROVING: Recent trust > Previous trust + 0.1
  • DECLINING: Recent trust < Previous trust - 0.1
  • VOLATILE: High variance in trust scores
  • STABLE: Neither improving nor declining significantly

Project Structure

memorymesh/
├── server/
│   ├── models/          # Mongoose schemas
│   ├── services/        # Business logic (trust engine)
│   ├── routes/          # API routes
│   ├── seed.js          # Database seeding
│   └── index.js         # Express server
├── client/
│   ├── src/
│   │   ├── components/  # React components
│   │   ├── pages/       # Page components
│   │   └── api/         # API client
│   └── package.json
├── .env                 # Environment variables
└── package.json         # Root package.json

Usage

  1. View Entities: Browse all entities in the left panel
  2. Explore Memories: Click an entity to view its memory timeline
  3. Get Context: Use the decision briefing panel to get relevant memories for specific decisions
  4. Trust Analysis: View trust scores and trajectory indicators for each entity

License

MIT License

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages