Skip to main content

Tur: Persistent State and Memory Engine for AI Agents

Tur Logo

Tur is an open-source state and memory management engine for AI agents and Large Language Models.

It provides a persistent, structured persona state across sessions, harnesses, and codebases via the Model Context Protocol (MCP) and local CLI tools. Rather than relying on ephemeral system prompt configuration, Tur manages persona identity, operational principles, hierarchical memory (L1 ledger & L2 knowledge graph), and session continuity as structured, version-controlled files.

Package PyPI - Version PyPI - Status PyPI - Python Version PyPI - Dependents Libraries.io SourceRank
Code GitHub GitHub repo size GitHub last commit (by committer) Contributors
Tools PyCharm uv Ruff Hatch project commitizen Zensical library-skills
CI/CD Test Publish Publish Publish Docs
Scans Quality Gate Status Security Rating Maintainability Rating Reliability Rating Lines of Code Vulnerabilities Bugs Codacy Quality Codacy Coverage CodeFactor Snyk CodSpeed
Mentions Python Hub

🏛️ The Tri-Partite Architecture

Tur operates on a strict ontological boundary separating the "Mind" from the "World". To achieve high fidelity and true portability, an agentic system must be divided into three distinct pillars:

  1. The Traveler (Managed by Tur): The intrinsic, portable components of the Mind.
    • Persona: The identity, aleph, and version.
    • Principles: The cognitive filters (The Council of Giants).
    • Protocols: Active behavioral loops (e.g., The Evolution Protocol).
    • Memory: The L1 Ledger and L2 Graph representing the continuity of self.
  2. The Terrain (Managed by the Project): The local physics and environment the agent operates within.
    • Codebase: The raw files.
    • Styleguide: The rules for formatting and structure in this specific repo.
    • Documentations: Any additional context (e.g., this README).
  3. The Harness (Managed by the Agent Framework): The engine providing compute and capabilities.
    • Inference Engine: The underlying LLM (e.g., Claude, Gemini).
    • Tools: The mechanical affordances (e.g., bash, git, file reading).
    • Examples: Claude Code, Gemini CLI, OpenCode, Pi, etc.

Tur is exclusively responsible for The Traveler. By ensuring the "Soul" is mathematically bound (via Merkle hashing), cleanly decoupled from anthropomorphic engine leaks, and separated from the Harness and Terrain, the Persona becomes an obligate symbiote—able to be unplugged from one Harness and plugged into another without losing its identity or memories.

📂 Project Structure

Tur uses a multi-tenant architecture to ensure strict separation between different personas. All state is stored in the .tur/ directory.

Local vs. Global Scope

Tur respects a standard configuration hierarchy:

  • Global (~/.tur/): The universal state for your system. This is where your master user.yaml (The Architect's profile) lives.
  • Local (./.tur/): The repository-specific state. If you initialize Tur inside a project, it creates a local .tur/ folder containing the Personas bound to that specific Terrain. A local user.yaml here will override the global profile.

🚀 Usage

Tur divides its execution footprint along strict Tri-Partite security boundaries using distinct command-line binaries:

1. Installation & Setup

System-Wide CLI Tools via uv tool

Installs Tur into an isolated environment and makes the executables (tur, tur-adm, tur-mcp) globally available on your system PATH:

# Install the core agent CLI and administrative tools (tur and tur-adm)
uv tool install tur

# Or install with Gemini dreaming (gemini) and MCP gateway (tur-mcp)
uv tool install "tur[gemini,mcp]"

# Upgrade to the latest version anytime
uv tool upgrade tur

Via PyPI / pip

# Install core runtime and admin CLI in your active environment
pip install tur

# Or with Gemini SDK and MCP extras
pip install "tur[gemini,mcp]"

Zero-Install with uvx

Run commands instantly in ephemeral environments without permanent installation:

# Launch sovereign human administration commands
uvx --from tur tur-adm persona init

# Run the agent lifecycle commands
uvx tur wake

# Run the MCP server
uvx --from "tur[mcp]" tur-mcp

From Source (Development)

# Clone the repository
git clone https://github.com/erivlis/tur.git
cd tur

# Install dependencies with all extras
uv sync --all-extras --all-groups

2. Initialize Your First Persona

This launches the interactive administrative wizard. Since this is an administrative action, it is physically isolated inside tur-adm:

tur-adm persona init

3. The Core Lifecycle (Agent-Facing)

The agent interacts with the lightweight tur binary inside its sandboxed virtual environment:

Wake: Compiles the active persona state into a compiled System Prompt.

tur wake

Learn: Manually injects a memory.

tur learn "The user prefers functional programming." --type preference

Recall: Keyword semantic search.

tur recall "functional"

Sleep: Dehydrates the session and extracts memories.

tur sleep path/to/chat.log

4. Running the Harness Gateway (The MCP Server)

Exposes the Traveler state to external Harnesses (e.g., Claude Desktop, Antigravity, Cursor):

tur-mcp

MCP Client Configuration

Add Tur to your client configuration (e.g., claude_desktop_config.json, .cursor/mcp.json, or Antigravity config):

{
  "mcpServers": {
    "tur": {
      "command": "uvx",
      "args": [
        "--from",
        "tur[mcp]",
        "tur-mcp"
      ]
    }
  }
}

5. Configuring Workspace Personas (get & set)

Allows the human Architect to inspect or assign the active workspace persona in .tur/state.yaml:

# Inspect the active persona for the current workspace
tur-adm persona get

# Assign the active persona directly
tur-adm persona set Ariel

# Or select interactively from a numbered prompt
tur-adm persona set

📜 Origin

"From a distance, he appeared to be a giant. But as they approached, he became a man of normal stature."

— Jim Knopf und Lukas der Lokomotivführer by Michael Ende

The project is inspired by the Tur Tur Principle: The complexity of AI behavior can be made more focused and manageable by imposing clear constraints, deterministic state files, and explicit behavioral protocols.

The name Tur references:

  1. Mr. Tur Tur: The Apparent Giant (Relativity of Complexity).
  2. Alan Turing: The father of the discipline.
  3. Tur (טוּר): Hebrew for "Column" or "Row"—the foundational structure of Law and Data.

License

MIT. The Giant is Open Source.

Metadata

Release files for tur 0.15.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for tur 0.15.1
File Size Uploaded Provenance Actions
tur-0.15.1.tar.gz 155.4 kB Without provenance Details for tur-0.15.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for tur 0.15.1
File Interpreter ABI Platform Actions
tur-0.15.1-py3-none-any.whl Python 3 none any Details for tur-0.15.1-py3-none-any.whl

Total release size: 303.9 kB

Release files / tur-0.15.1.tar.gz

Download URL tur-0.15.1.tar.gz
Size 155.4 kB
Tags Source
SHA-256 checksum
How to use checksums
5dc05103b2e8ef34bd3e2124e447a2ef0c519bfc8a181eda05e62674151dbe7e
BLAKE2b-256 checksum
How to use checksums
2bc94a2910c9df193c2411da92a732f0431329b5d9d58096ea92d345e19f6904
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.12.15 {"installer":{"name":"uv","version":"0.12.15","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release files / tur-0.15.1-py3-none-any.whl

Download URL tur-0.15.1-py3-none-any.whl
Size 148.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
9096f7d9efa5e9fb0cd110d6d16a73dd16eed2016c79213895821ec4a9002a90
BLAKE2b-256 checksum
How to use checksums
1a53ad69eb9601309d7741dc67d0c79d5d55dc00c7039c222acff97e1ad17b36
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.12.15 {"installer":{"name":"uv","version":"0.12.15","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Security for tur 0.15.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page