Skip to content

Latest commit

 

History

History
106 lines (77 loc) · 2.23 KB

getting-started.md

File metadata and controls

106 lines (77 loc) · 2.23 KB

Getting Started with Persistent Cognition

Welcome! This guide will get you up and running in 10 minutes.

Installation

pip install persistent-cognition

Quick Start

from persistent_cognition import DynamicSegmentedMemory

# Create memory
memory = DynamicSegmentedMemory(".memory/my-project.json")

# Store information
memory.write(
    "Our API uses FastAPI with PostgreSQL. Auth is JWT-based.",
    category_path="Project/Architecture"
)

# Query anytime
context = memory.active_context("How does our auth work?")
print(context.context_text)

Using with Claude Desktop (MCP)

Add to claude_desktop_config.json:

{
  "mcpServers": {
    "persistent-cognition": {
      "command": "persistent-cognition-mcp",
      "args": ["--store", "/path/to/.memory/project.json"]
    }
  }
}

Restart Claude Desktop. Done!

Core Features

1. Skill Crystallization

kernel = memory.crystallize_skill(
    goal="Fix Redis timeout",
    trajectory=["Increased connections", "Added health checks"],
    outcome="Timeouts eliminated"
)

2. Version History

history = memory.get_segment_history(segment_id)
memory.rollback_segment(segment_id, version=2)

3. UI-to-Code Mapping

from persistent_cognition.ux_mapping import UXMapping

mapper = UXMapping(memory)
mapper.register_component(
    file_path="src/components/LoginButton.tsx",
    component_name="LoginButton",
    user_description_en="Blue login button in top right"
)

results = mapper.find_component("login button")

4. Visualization

stats = memory.visualize(format="stats")
tree = memory.visualize(format="tree")
mermaid = memory.visualize(format="mermaid")
html = memory.visualize(format="html")

Best Practices

  1. Organize with categories - Use clear hierarchical paths
  2. Set importance - Critical info gets 0.9+, normal 0.5
  3. Crystallize solutions - After solving problems
  4. Register UI components - Keep mappings updated
  5. Regular maintenance - Check duplicates, prune old data

Next Steps


Built with love by Narelabs - https://narelabs.com