Nexyn Core is a lightweight Python library that adds human-like memory physics to your AI applications. Built specifically to run alongside Cognee, it solves a major problem in AI memory systems: context bloat.
Instead of treating every piece of information equally, Nexyn automatically scores how important a memory is (Valence), applies a decay rate, and forgets irrelevant data over time—just like a human brain.
- Infinite Context Clutter: AI agents quickly drown in their own logs. Nexyn ensures only the most important, reinforced memories survive long-term.
- Flat Memory Structures: Nexyn categorizes data dynamically. A passing thought decays in hours; a core user instruction (like "I am allergic to peanuts") becomes a permanent instinct.
- Sensory Buffer: Intercepts data before it enters your vector database.
- Evaluator: Uses NVIDIA NIM to quickly score the emotional/logical weight (Valence).
- Retrieval & Rehearsal: Every time you search for a memory, Nexyn resets its decay timer (rehearsal), naturally surfacing things you think about often.
- Consolidation: A background process sweeps your database and permanently deletes memories that have decayed to zero.
# Using pip
pip install nexyn-coreNexyn is designed to be completely invisible and is 100% compatible with both Cognee Cloud and Cognee Open Source (Local).
Cloud vs Local Multi-Tenancy: If you are using Cognee Cloud, pass
tenant_idanduser_idtonexyn.inject()to isolate your users' memory graphs. If you are running Cognee Open Source locally, leave these parameters blank in Nexyn, and instead passdataset_name="user_123"directly into yourcognee.add()calls to partition your data natively!
You simply initialize it once, and it automatically intercepts your native Cognee calls to apply biological physics. You don't need to learn a new API.
import asyncio
import cognee
import nexyn
async def main():
# 1. Initialize Nexyn's cognitive layer
# For Cognee Cloud: Pass cognee_url and cognee_api_key
# For Cognee Open Source (Local): Leave cognee_url empty
await nexyn.inject(
nim_api_key="nvapi-your-key-here",
cognee_api_key="your_cognee_api_key", # Leave empty for local open source
cognee_url="https://api.cognee.ai", # Leave empty for local open source
tenant_id="default", # Leave empty for local open source
user_id="user_123" # Leave empty for local open source
)
# 2. Add memories normally (Nexyn automatically scores Valence)
await cognee.add("Doug is the groom. The wedding is Sunday.")
# 3. Compile the Cognee knowledge graph
await cognee.cognify()
# 4. Search triggers decay physics and memory rehearsal
results = await cognee.search("Where is Doug?")
# 5. Fast-forward time to prune dead memories
await nexyn.sweep()
if __name__ == "__main__":
asyncio.run(main())Want to see the biological pipeline in action? 👉 Live Demo
Want to dive deeper into the theory behind Nexyn? Check out our official Medium article: 👉 Nexyn: Teaching AI to forget, so it can actually remember.
Distributed under the MIT License.