Lians Agent Memory

双时态代理记忆,支持时间点检索、替代、审计追踪和受控记忆管理。

文档

Lians lotus logo

Install · Desktop preview · Docs · Issues

PyPI version npm version MCP Official Registry Apache 2.0 license Star Lians on GitHub

Use less context. Get more AI.

Lians helps Claude, Cursor, Codex, and other AI tools stop rereading the same project context.

Save a useful preference, fact, constraint, or decision once. In a later task, Lians reuses only a small relevant slice and leaves the rest out. You keep your model, editor, and normal workflow.

  • Local by default: encrypted saved context stays on your device.
  • No AI credentials: Lians does not ask for your Claude, Cursor, or Codex password or provider API key.
  • Measured: signed receipts record what was reused, what was excluded, and the estimated repeated memory context avoided.
  • Portable: one local store can support multiple compatible AI tools.

Try Lians in two chats

Choose the AI tool you already use:

ToolFastest current setup
CursorOne-click MCP install
Claude CodeTwo plugin commands
Codex app, CLI, or IDEOne-command MCP setup
Other MCP clientsMinimal local MCP configuration

Then try:

Remember that this project uses Python 3.12 and pytest.

Open a new chat in the same project and ask:

What Python version and test runner does this project use?

Lians can reuse the saved detail without replaying the whole previous chat.

▶ Watch the 33-second remember, reuse, and delete proof

The product

Open Lians → choose your AI apps → keep working normally
                                      ↓
                         relevant saved context only
                                      ↓
                         visible efficiency receipt

The desktop product detects supported AI apps and connects the ones a user selects. Claude, Codex, Gemini CLI, and Antigravity can receive bounded context through prompt hooks. Cursor uses its MCP connection and a generated project rule. The underlying memory, correction, backup, and deletion controls remain available when someone wants them; they are not the main job to be done.

From a source checkout, developers can exercise that flow today:

python -m pip install -e packages/lians-easy
lians optimize --clients detected --plan
lians optimize --clients detected --yes
lians status

Running lians with no subcommand opens guided setup. The Windows and macOS desktop artifacts are tested release candidates, not yet trusted consumer downloads: general promotion remains gated on Windows publisher signing and Apple Developer ID signing/notarization. See the desktop preview boundary.

What is real today

CapabilityStatus
Free local memory through MCP and PythonAvailable
Cursor, Claude Code, Codex, Gemini, Antigravity, Windsurf, Cline, and OpenCode setup pathsAvailable
Guided desktop installer and local control centerRelease candidate; source/CI evaluation only until signing
Bounded context and signed selection receiptsAvailable
Estimated repeated memory tokens avoidedAvailable in receipts, lians status, and the local status API
Managed cross-device continuityTechnical preview; not a general-availability claim

Evidence, not magic

In a balanced Cursor CLI stress test, bounded Lians-style context used 24.72% fewer provider-reported input tokens than a 201-line always-applied rule while preserving all four exact answers. This is one synthetic workload, not a promise of universal token savings.

A separate live test stored one synthetic project fact through Cursor, recalled it in a new Cursor chat and a fresh Claude Code session, then confirmed that it was gone after deletion. Read the methodology and raw aggregate evidence.

Lians does not enlarge a provider context window or guarantee that every plan, quota, or bill lasts longer. It measures the narrower claim it controls: how much active saved memory could have been replayed, how much was selected, and the estimated repeated memory content left out.

Minimal local MCP setup

Install uv, then add this server to an MCP-compatible AI tool:

{
  "mcpServers": {
    "lians": {
      "command": "uvx",
      "args": ["--from", "lians-sdk[mcp]", "lians-mcp"],
      "env": {
        "LIANS_MCP_ENABLED_TOOLS": "remember,recall,list_memories,correct_memory,forget_memory"
      }
    }
  }
}

Restart the AI tool. Local memory is stored in ~/.lians/mcp.db; no Lians account, Docker service, or provider API key is required. The first use may download the local semantic model.

Use Lians inside an application

pip install "lians-sdk[local]"
from datetime import datetime, timezone
from lians import LocalLiansClient

memory = LocalLiansClient(db_path=".lians/memory.db")
memory.add(
    agent_id="my-agent",
    content="The project uses Python 3.12 and pytest.",
    event_time=datetime.now(timezone.utc),
)

result = memory.recall(
    agent_id="my-agent",
    query="Which Python version and test runner should I use?",
)

See the full install guide for TypeScript, Go, Java, C, framework integrations, and self-hosting.

Running a class, club, hackathon, or campus developer group? The student and community kit contains a small workshop and project track. If you cloned the monorepo and are deciding which package is current, start with Supported paths and repository status.

The short product direction defines the customer, default experience, claims boundary, build order, and success metrics.

Advanced memory and governance capabilities

Lians can supersede stale facts, reconstruct point-in-time state, inspect lineage and conflicts, maintain tamper-evident audit history, enforce information barriers, and perform confirmed erasure. These capabilities are available for applications and teams that need them; they are not required to get started.

Repository map

packages/lians-easy/        Desktop runtime, installer, control center, and receipts
agentmem/sdk/python/        Python SDK, local client, and MCP server
agentmem/src/lians/         Core engine and HTTP service
integrations/               AI-client and framework connections
plugins/                    Installable agent plugins
docs/                       Setup, evidence, security, and operations

Development

git clone https://github.com/Lians-ai/Lians.git
cd Lians
python -m pip install -e ".[dev]"
python scripts/test_all.py

Read CONTRIBUTING.md for focused test commands and project conventions. Ask questions or report problems in GitHub Issues.

If Lians helps your workflow, star the repository so other AI-tool users can find it.

License

Apache 2.0 - see LICENSE.