Skip to main content

polign-recall

A Python client for Recall's typed, correctable agent memory. Requires Python 3.10+.

pip install polign-recall

That is the whole install. pip also brings the polign_db package, which holds the polign CLI and polign-server binaries for Linux, macOS and Windows, so there is nothing else to download.

from polign_recall import Client

with Client(local_dir="./recall-data") as memory:
    memory.remember("user", "prefers_editor", "vim")
    changed = memory.remember("user", "prefers_editor", "neovim")
    current = memory.recall("user", "prefers_editor")[0]
    print(current.value, current.replaced[0].value)  # neovim vim
    print(memory.history("user", "prefers_editor"))  # both statements
    memory.forget("user", "prefers_editor", "neovim")

local_dir keeps the database on this machine. The first client to open the directory starts a polign-server for it in the background, listening on localhost only and protected by a key stored in the directory. Later clients, including ones in other processes, share that server. It keeps running after your program exits; its process id is in runtime.json and its log in server.log, both inside the directory. Managed local databases work on Linux and macOS.

To use a server you run yourself, leave local_dir out and set POLIGN_URL, POLIGN_API_KEY, and POLIGN_COLLECTION in the environment, or pass env={...} to Client. With neither, the client uses the connection recall setup saved, and without one connects to http://localhost:23000, where polign-server -store fs:./recall-data listens by default.

The client owns a long-lived recall mcp -write subprocess and shares the Go implementation's validation and fold. Use write=False for a read-only connection. It runs the recall binary that this package's platform wheel installs next to python; on a platform without one it runs recall from PATH, and without recall it falls back to polign mcp -memory-only from polign_db 0.13 or earlier. command=[...] overrides all of these.

remember(text=..., statements=[...]) accepts proposals from your agent's model. Every statement must have subject, predicate, typed value, and evidence quoting the text exactly. Read predicates() to build your extractor prompt.

To have the server work out the statements instead, name a model and pass the text alone:

with Client(extract_model="anthropic:claude-opus-5-5") as memory:
    memory.remember(text="I moved to Lisbon and I edit in Zed now.")

The model is provider:model: anthropic:<model>, openai:<model>, or ollama:<model>, with keys from ANTHROPIC_API_KEY or OPENAI_API_KEY. It may name only registered predicates and must quote the text; a proposal that does not is dropped, and the whole text is kept as a note either way. Statements you pass are used as given, and the model is not called.

Text only

With text=True, the client uses the text tools and never sees a predicate:

with Client(text=True, extract_model="anthropic:claude-haiku-4-5-20251001") as memory:
    memory.remember(text="I switched from helix to zed last week.")
    for m in memory.ask("Which editor do I use?"):
        print(m.text, m.since, [e.text for e in m.before])  # user prefers editor: zed ... ['helix']
    memory.forget_text("my editor")

remember(text=...) returns a TextResult listing what was filed and what each statement replaced. ask returns Memory sentences, each with since, days_ago, and what it replaced under before; it accepts as_of. forget_text withdraws the facts a description names and returns them; the texts they came from stay as the record. The server works out the facts with the model; without one, remembered text is kept as written and replaces nothing, and forget_text needs a model. The typed calls (recall, forget, history, predicates) raise ValueError on a text client. Needs recall 0.14 or later.

recall(..., as_of=...) accepts an RFC3339 string or timezone-aware datetime. forget requires a typed value or explicit all=True; false and zero remain values. Forgetting retracts a belief and retains its historical events.

Errors raise RecallError with a code and, for a failed extraction batch, any reported partial results. Calls are serialized, timeout after 120 seconds by default, and never automatically retry writes. A timeout closes the transport; inspect history using a new client before retrying an uncertain write.

Resuming an agent

An agent that crashes or moves to another machine can pick up from its own records instead of a snapshot of its process. Open the client with agent=True and call resume:

from polign_recall import Client

with Client(local_dir="./recall-data", agent=True) as client:
    with client.resume("billing-migrator") as agent:
        print(agent.context.briefing)  # hand this to the model as its starting context
        agent.update_working_state(goal="Move billing to the v2 API",
                                   plan=["find call sites", "migrate them", "run the tests"])
        agent.record_turn("user", "Start with the charge endpoint.")
        agent.set_pointer("wip", "git_ref", {"repo": "github.com/acme/billing", "branch": "agent/wip"})
        agent.milestone("call sites found", progress="12 call sites listed")

The first resume of an id starts the agent fresh (context.fresh is true). Every later one rebuilds context from what the agent wrote: its working state, pointers to its work, relevant memories, and its most recent turns, trimmed to token_budget. context.briefing is all of that as one text for the model; the same parts are also there as fields.

resume takes a lease on the agent id, so only one process acts for it at a time. While another process holds it, resume raises RecallError with code "lease_held". The lease is renewed in the background and handed over when you call release(), leave the with block, or close the client.

If the process before crashed without releasing, resume has to wait for its lease to expire. When you cannot wait, as on a live call, pass defer_lease=True: resume returns the context at once without the lease, because reading cannot conflict with anyone. Writes then raise RecallError with code "lease_not_held", so keep them in a buffer and call agent.acquire() until it returns True:

agent = client.resume("call-42", defer_lease=True, lease_ttl=6)
greet_with(agent.context.briefing)  # no waiting
while not agent.acquire():          # False while the crashed process's lease is live
    time.sleep(1)
agent.record_turn("assistant", "Sorry, we got cut off.")

Once it holds the lease, anything the crashed process wrote after the resume is picked up, and new turns continue after it.

The other methods write what the next resume reads: update_working_state (fields you leave out are kept), milestone, record_turn (a turn longer than the output threshold is stored whole and the turn keeps a reference), store_output and fetch_output for large tool results, set_pointer, remove_pointer and pointers, and recent_turns and working_state_history to read back.

Metadata

Release files for polign-recall 0.14.0

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

Source distribution (sdist)

Source distribution for polign-recall 0.14.0
File Size Uploaded
polign_recall-0.14.0.tar.gz 28.3 kB Details

Built distributions (wheels)

Table of built distributions (wheels) for polign-recall 0.14.0
File
polign_recall-0.14.0-py3-none-win_arm64.whl Python 3 none Windows ARM64 Details
polign_recall-0.14.0-py3-none-win_amd64.whl Python 3 none Windows x86-64 Details
polign_recall-0.14.0-py3-none-manylinux2014_x86_64.manylinux_2_17_x86_64.musllinux_1_1_x86_64.whl Python 3 none Linux glibc 2.17+ x86-64, Linux musl 1.1+ x86-64 Details
polign_recall-0.14.0-py3-none-manylinux2014_aarch64.manylinux_2_17_aarch64.musllinux_1_1_aarch64.whl Python 3 none Linux glibc 2.17+ ARM64, Linux musl 1.1+ ARM64 Details
polign_recall-0.14.0-py3-none-macosx_12_0_x86_64.whl Python 3 none macOS 12.0+ x86-64 Details
polign_recall-0.14.0-py3-none-macosx_12_0_arm64.whl Python 3 none macOS 12.0+ ARM64 Details
polign_recall-0.14.0-py3-none-any.whl Python 3 none any Details

Total release size: 23.0 MB

Release files / polign_recall-0.14.0.tar.gz

Download URL polign_recall-0.14.0.tar.gz
Size 28.3 kB
Tags Source
SHA-256 checksum
How to use checksums
274c006b4b6f40dc2addeecedc21cf5d213c20f5a743df448ff7e599a9ae688d
BLAKE2b-256 checksum
How to use checksums
8283c9a2e5d5d5b6a4221b0ae5ad66d15422378430d3871aba4a8ace3a243e91
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 10, 2026.

Transparency log

Release files / polign_recall-0.14.0-py3-none-win_arm64.whl

Download URL polign_recall-0.14.0-py3-none-win_arm64.whl
Size 3.6 MB
Tags Python 3 Windows ARM64
SHA-256 checksum
How to use checksums
824736825c814fe8831364fb992688f1a00bc9ac0d76e1002ac15c1480a2abc0
BLAKE2b-256 checksum
How to use checksums
073ada717d15f5afc737191d15ebb4dc7d07a9730f3340887f311402d3b799aa
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 10, 2026.

Transparency log

Release files / polign_recall-0.14.0-py3-none-win_amd64.whl

Download URL polign_recall-0.14.0-py3-none-win_amd64.whl
Size 4.0 MB
Tags Python 3 Windows x86-64
SHA-256 checksum
How to use checksums
8f544fe05c8a5f3ee166b73a9929b0191b093e3ab6389036e334f049b3f76f89
BLAKE2b-256 checksum
How to use checksums
f78ba92c2ba30ffea620537512fd9950efffa8e8d6b6fdfafb269a9021313a40
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 10, 2026.

Transparency log

Release files / polign_recall-0.14.0-py3-none-manylinux2014_x86_64.manylinux_2_17_x86_64.musllinux_1_1_x86_64.whl

Download URL polign_recall-0.14.0-py3-none-manylinux2014_x86_64.manylinux_2_17_x86_64.musllinux_1_1_x86_64.whl
Size 4.0 MB
Tags Linux glibc 2.17+ x86-64 Linux musl 1.1+ x86-64 Python 3
SHA-256 checksum
How to use checksums
05d7678e51a3fcf7d64bb5ebfd31e3f75c8ea2333e6bc2deba7ca13c08f9af54
BLAKE2b-256 checksum
How to use checksums
b1c307689ce0a629d57a89627b9b78a9b504f1821855e2ae5b99a531814b77c9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 10, 2026.

Transparency log

Release files / polign_recall-0.14.0-py3-none-manylinux2014_aarch64.manylinux_2_17_aarch64.musllinux_1_1_aarch64.whl

Download URL polign_recall-0.14.0-py3-none-manylinux2014_aarch64.manylinux_2_17_aarch64.musllinux_1_1_aarch64.whl
Size 3.6 MB
Tags Linux glibc 2.17+ ARM64 Linux musl 1.1+ ARM64 Python 3
SHA-256 checksum
How to use checksums
0c54a54ffd68f6b6f8be1e244678e4f9c009d7819ce114b7ea21bf94bcbbe2ab
BLAKE2b-256 checksum
How to use checksums
1f4ec80edaa1d4dc12c63d30437a72e3c3a8cb98ed55c800e6ad7be259c99799
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 10, 2026.

Transparency log

Release files / polign_recall-0.14.0-py3-none-macosx_12_0_x86_64.whl

Download URL polign_recall-0.14.0-py3-none-macosx_12_0_x86_64.whl
Size 4.0 MB
Tags Python 3 macOS 12.0+ x86-64
SHA-256 checksum
How to use checksums
0e9b20d1ddaea2173de7c1e64fe32603128c4b259ff1f640e8c49276cb3a3450
BLAKE2b-256 checksum
How to use checksums
4ce1a702ee2b38802bc7c3bc9e4c52a70e1179f480309c12d53cffb7e209e2a5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 10, 2026.

Transparency log

Release files / polign_recall-0.14.0-py3-none-macosx_12_0_arm64.whl

Download URL polign_recall-0.14.0-py3-none-macosx_12_0_arm64.whl
Size 3.8 MB
Tags Python 3 macOS 12.0+ ARM64
SHA-256 checksum
How to use checksums
34efe07990738ba3d471e23a03d2e4c6d299dbc1f9dad251e620da3eeadb1454
BLAKE2b-256 checksum
How to use checksums
8c1db2416a302816ab3c36e12e1f263ebba6e7e22e9a18d174c51a280eb86dc2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 10, 2026.

Transparency log

Release files / polign_recall-0.14.0-py3-none-any.whl

Download URL polign_recall-0.14.0-py3-none-any.whl
Size 20.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
299c6faf15bd5d49b666e7388a665a2fa7ecd1d64d0f18dccfa8a1363418819b
BLAKE2b-256 checksum
How to use checksums
efd3a6cab892d51d52d7d44d4f673a1cdf4590517b88b13ef48770351e18f610
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 10, 2026.

Transparency log

Release history Release notifications | RSS feed

0.20.2

8 release files

0.20.1

8 release files

0.20.0

8 release files

0.19.0

8 release files

0.18.0

8 release files

0.17.0

8 release files

0.16.0

8 release files

0.15.0

8 release files

This release

0.14.0 This release

8 release files

0.9.0

2 release files

0.6.0

2 release files

0.5.0

2 release files

0.4.1

2 release files

0.4.0

2 release files

0.3.1

2 release files

0.3.0

2 release files

0.2.0

2 release files

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