Skip to content
vmore2Public

About

No description, website, or topics provided.

Resources

Stars

3 stars

Watchers

1 watching

Forks

Latest commit

Β 

History

3 Commits

Folders and files

NameName
Last commit message
Last commit date
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

🐝 CogniHive

The World's First Transactive Memory System for Multi-Agent AI

Mem0 gives one agent a brain. CogniHive gives your agent team a collective mind.

PyPI version Python License HuggingFace

Installation β€’ Quick Start β€’ Documentation β€’ Integrations


🧠 What is Transactive Memory?

In human teams, not everyone remembers everything. Instead, teams develop a shared awareness of who knows what:

  • "Sarah handles the legal stuff"
  • "Mike knows all the technical details"
  • "Ask Jennifer about customer history"

This is called a Transactive Memory System (TMS) β€” a concept from cognitive science that has never been implemented for AI agents... until now.

πŸ’‘ Why CogniHive?

Current multi-agent systems fail because:

Problem Without CogniHive With CogniHive
"Which agent knows X?" Manual orchestration hive.who_knows("topic")
Redundant work Multiple agents research same thing Expertise routing prevents duplication
Conflicting info Silent failures Conflict detection + resolution
Token explosion 15x more tokens (Anthropic's research) Smart routing = massive savings

πŸš€ Installation

pip install cognihive

With framework integrations:

pip install cognihive[crewai]      # For CrewAI
pip install cognihive[autogen]     # For AutoGen
pip install cognihive[langchain]   # For LangChain
pip install cognihive[openai]      # For OpenAI Assistants
pip install cognihive[mcp]         # For Anthropic MCP (Claude)
pip install cognihive[all]         # Everything

⚑ Quick Start

from cognihive import Hive

# Create a hive (multi-agent memory system)
hive = Hive()

# Register agents with their specializations
hive.register_agent("coder", expertise=["python", "javascript", "testing"])
hive.register_agent("analyst", expertise=["sql", "data", "metrics"])
hive.register_agent("writer", expertise=["docs", "tutorials", "api"])

# Agents store knowledge
hive.remember(
    "Use connection pooling for better DB performance",
    agent="analyst",
    topics=["database", "performance"]
)

# πŸ” THE KEY INNOVATION: "Who Knows What" queries
experts = hive.who_knows("database optimization")
# Returns: [("analyst", 0.92), ("coder", 0.45)]

# 🎯 Automatic query routing to the right expert
result = hive.ask("How do I optimize my queries?")
# Automatically routes to "analyst" and returns relevant memories

print(f"Expert: {result['expert']}")  # "analyst"
print(f"Answer: {result['memories'][0].content}")

πŸ”— Integrations

CrewAI

from crewai import Agent, Crew
from cognihive.integrations import CrewAIHive

hive = CrewAIHive()

researcher = Agent(
    role="Researcher",
    goal="Find information",
    memory=hive.agent_memory("researcher")  # CogniHive memory!
)

writer = Agent(
    role="Writer",
    goal="Write content",
    memory=hive.agent_memory("writer")  # CogniHive memory!
)

# Now agents automatically:
# βœ“ Know what each other knows
# βœ“ Route questions to the right expert
# βœ“ Share learnings across the team

AutoGen

from autogen import AssistantAgent
from cognihive.integrations import AutoGenHive

hive = AutoGenHive()

# Create agents with shared transactive memory
coder = hive.create_memory_enhanced_agent(
    name="coder",
    system_message="You are an expert coder.",
    expertise=["python", "coding"]
)

reviewer = hive.create_memory_enhanced_agent(
    name="reviewer",
    system_message="You review code for quality.",
    expertise=["review", "testing"]
)

# Agents now have collective intelligence!

LangGraph

from cognihive.integrations import LangGraphHive, create_expert_routing_graph

hive = LangGraphHive()
hive.register_agent("researcher", expertise=["research"])
hive.register_agent("writer", expertise=["writing"])

# Create a graph with automatic expert routing
graph = create_expert_routing_graph(
    hive=hive,
    agent_nodes={
        "researcher": researcher_node,
        "writer": writer_node
    }
)

LangChain

from cognihive.integrations import LangChainHive
from langchain.chains import ConversationChain
from langchain_openai import ChatOpenAI

hive = LangChainHive()
hive.register_agent("assistant", expertise=["general"])

# Use CogniHive as LangChain memory
chain = ConversationChain(
    llm=ChatOpenAI(),
    memory=hive.as_memory("assistant")
)

# Or as a retriever for RAG
retriever = hive.as_retriever(top_k=5)

OpenAI Assistants

from openai import OpenAI
from cognihive.integrations import OpenAIHive, create_tool_outputs

client = OpenAI()
hive = OpenAIHive()

# Create assistant with CogniHive tools
assistant = client.beta.assistants.create(
    name="Team Coordinator",
    tools=hive.get_tools(),  # who_knows, remember, recall, ask_expert
    model="gpt-4-turbo"
)

# Process tool calls
outputs = create_tool_outputs(hive, tool_calls)

Anthropic MCP (Claude)

// claude_desktop_config.json
{
  "mcpServers": {
    "cognihive": {
      "command": "python",
      "args": ["-m", "cognihive.integrations.mcp"]
    }
  }
}

Claude can now use:

  • cognihive_who_knows - Find team experts
  • cognihive_remember - Store knowledge
  • cognihive_recall - Search memories
  • cognihive_ask_expert - Route to expert

πŸ› οΈ CLI

# Initialize a hive
cognihive init --name my_project

# Register agents
cognihive register coder --expertise python javascript

# Store knowledge
cognihive remember "Important info" --agent coder

# Query "who knows what"
cognihive who-knows "python optimization"

# Search memories
cognihive recall "best practices"

# Run interactive demo
cognihive demo

πŸ“š Documentation

Core Concepts

Concept Description
Hive The central coordinator for multi-agent memory
Agent An entity with expertise that stores/retrieves memories
Memory A piece of knowledge with provenance and access control
ExpertiseProfile Tracks "who knows what" for each agent
ExpertiseRouter Routes queries to the best expert

Key Methods

# Agent management
hive.register_agent(name, expertise, role)
hive.get_agent(name)
hive.list_agents()

# Memory operations
hive.remember(content, agent, topics, visibility)
hive.recall(query, top_k=5)

# Transactive memory (THE INNOVATION)
hive.who_knows(topic)          # Find experts
hive.get_expert(topic)         # Get best expert
hive.expertise_matrix()        # Get full expertise map

# Query routing
hive.ask(query)                # Auto-route + retrieve
hive.route(query)              # Get routing decision

Memory Visibility

# Private - only the owner sees it
hive.remember("Secret notes", agent="coder", visibility="private")

# Shared - specific agents can see
hive.remember("For the team lead", agent="coder", visibility="shared")

# Team - all agents in the hive can see
hive.remember("Team announcement", agent="coder", visibility="team")

πŸ—οΈ Architecture

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚                      CogniHive Core                                  β”‚
β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”    β”‚
β”‚  β”‚               TRANSACTIVE MEMORY INDEX                       β”‚    β”‚
β”‚  β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”          β”‚    β”‚
β”‚  β”‚  β”‚ Agent: Coderβ”‚  β”‚ Agent: Docs β”‚  β”‚Agent: Data  β”‚          β”‚    β”‚
β”‚  β”‚  β”‚ Knows:      β”‚  β”‚ Knows:      β”‚  β”‚ Knows:      β”‚          β”‚    β”‚
β”‚  β”‚  β”‚ - Python    β”‚  β”‚ - API specs β”‚  β”‚ - SQL       β”‚          β”‚    β”‚
β”‚  β”‚  β”‚ - FastAPI   β”‚  β”‚ - Tutorials β”‚  β”‚ - Analytics β”‚          β”‚    β”‚
β”‚  β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜          β”‚    β”‚
β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜    β”‚
β”‚                                                                      β”‚
β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”    β”‚
β”‚  β”‚                    EXPERTISE ROUTER                          β”‚    β”‚
β”‚  β”‚  Query: "How do I optimize the database queries?"            β”‚    β”‚
β”‚  β”‚  Routing: Data Agent (0.92) > Coder Agent (0.67)            β”‚    β”‚
β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜    β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

🎯 Use Cases

  • Multi-Agent Software Teams - Coder, reviewer, tester, writer working together
  • Research Workflows - Researcher, analyst, writer with shared findings
  • Customer Support - Specialists routing questions to the right expert
  • Enterprise Knowledge - Departments sharing institutional knowledge

πŸ“Š Comparison

Feature Mem0 Zep Letta CogniHive
Single-agent memory βœ… βœ… βœ… βœ…
"Who Knows What" ❌ ❌ ❌ βœ…
Expert routing ❌ ❌ ❌ βœ…
Conflict resolution ❌ ❌ ❌ βœ…
Access control ❌ ❌ ❌ βœ…
CrewAI integration ❌ ❌ ❌ βœ…
AutoGen integration ❌ ❌ ❌ βœ…

🀝 Contributing

Contributions are welcome! See CONTRIBUTING.md for guidelines.

πŸ“„ License

MIT License - see LICENSE for details.

πŸ™ Acknowledgments

  • Daniel Wegner - Transactive Memory Systems theory (1985)
  • Anthropic - Multi-agent coordination research
  • Stanford - Generative Agents memory architecture

Built with ❀️ for the multi-agent AI community

⭐ Star on GitHub β€’ πŸ“¦ PyPI β€’ πŸ€— HuggingFace Demo

About

No description, website, or topics provided.

Resources

Stars

3 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages