Skip to main content

Code-first agent memory SDK for AideMemo (aidememo)

Project description

aidememo-agent-sdk

Agent-friendly memory SDK for code-executing agents, including Codex, Claude Code, Hermes, CI jobs, and local scripts.

The SDK uses aidememo-python when available and otherwise falls back to the aidememo CLI. This keeps the first-use path portable while still taking the fast in-process route in environments that install the native binding.

Use it when memory needs to be a programmable working set: fan out searches, dedupe rows, check coverage, aggregate exact counts/timelines, and batch-write facts without spending model-visible tool calls on every intermediate step.

Install

# From a checkout, until the PyPI release lands:
python -m pip install -e packages/aidememo-agent-sdk

# After the PyPI release:
python -m pip install aidememo-agent-sdk

The fallback path needs the aidememo CLI on $PATH. After aidememo-python is published, python -m pip install "aidememo-agent-sdk[binding]" enables the optional in-process binding fast path.

Quick Start

from aidememo_agent import Memory

mem = Memory.open(
    source_id="project:aidememo",
    actor_id="codex:account-a",
    storage_backend="libsqlite",
)

rows = mem.search_rows([
    "release preflight decisions",
    {"query": "Hermes source_id lock retry lessons", "topic": "Hermes"},
])
coverage = mem.coverage_by(rows, ["fact_type"])
timeline = mem.aggregate_many([
    {"query": "release preflight", "op": "timeline"},
])

mem.remember([
    {
        "content": "Lesson: use source-scoped SDK fanout for multi-agent memory checks.",
        "fact_type": "lesson",
        "entities": ["aidememo", "Codex"],
    }
])

pack = mem.client.workflow_start(
    "Fix Redis timeout in worker",
    source="github:org/app#123",
    source_id="project:aidememo",
    actor_id="codex:account-a",
)
canvas = mem.session_canvas(pack["session_id"], limit=20)
profile = mem.project_profile(limit=80)

mem.remember(
    [
        {
            "content": "Decision: Redis timeout follow-ups stay attached to the workflow session.",
            "fact_type": "decision",
            "entities": ["Redis"],
        }
    ],
    source_id="project:aidememo",
    actor_id="codex:account-a",
    session_id=pack["session_id"],
)

branch = mem.branch_push(
    "candidate-b",
    "./shared",
    base="./shared/backup-01...",
)
print(branch["records_exported"])

main = Memory.open(store_path="./main.sqlite", storage_backend="libsqlite")
main.branch_merge("./shared", branch="candidate-b")

Use MCP/tools for one-off model-visible calls. Use this SDK when the agent needs memory as code: fanout retrieval, dedupe, coverage checks, aggregation, artifact hydration, branch-log experiments, or session-aware batch writes without spending model turns on intermediate state. session_canvas(...) and project_profile(...) return read-only Markdown strings suitable for direct prompt injection before resuming long work.

source_id can be passed to Memory.open(...) or inherited from AIDEMEMO_SOURCE_ID, matching the MCP aidememo mcp-install --source-id <namespace> path. Use it for the project/upstream namespace. actor_id, inherited from AIDEMEMO_ACTOR_ID, records which account or agent wrote each fact without splitting shared project retrieval.

storage_backend is optional and matches the CLI/native binding selector: omit it or pass an empty string for the compiled default, pass "sqlite" or "libsqlite" for the default local SQLite backend, or pass "redb" when the installed native binding / CLI was built with the Cargo redb feature. The SDK passes the selector to both the aidememo-python fast path and the CLI fallback (aidememo --backend ...).

branch_push(...) and branch_merge(...) use the native binding for local paths when available. S3 branch URIs fall back to the CLI so the installed aidememo --features s3 binary owns AWS credentials and compression behavior.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

aidememo_agent_sdk-0.1.0.tar.gz (18.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

aidememo_agent_sdk-0.1.0-py3-none-any.whl (15.9 kB view details)

Uploaded Python 3

File details

Details for the file aidememo_agent_sdk-0.1.0.tar.gz.

File metadata

  • Download URL: aidememo_agent_sdk-0.1.0.tar.gz
  • Upload date:
  • Size: 18.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.13

File hashes

Hashes for aidememo_agent_sdk-0.1.0.tar.gz
Algorithm Hash digest
SHA256 21d1cfbb8782253dfa7781860f0aa1684b6b5fa7feac213ae1284f5f4226dc61
MD5 a8495bdf2e3ee905849b6341497a0e31
BLAKE2b-256 48264f645270f0b69f693b8acbb400e32374744ab71e27a78f7c077735c202e8

See more details on using hashes here.

Provenance

The following attestation bundles were made for aidememo_agent_sdk-0.1.0.tar.gz:

Publisher: aidememo-agent-sdk-publish.yml on taeyun16/aidememo

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file aidememo_agent_sdk-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for aidememo_agent_sdk-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 f14ef61a46b83ef0c7031b89ca9254d2cb5103f6310a4ce2bc6f344eceefb472
MD5 5bedd3daec8676707ac3d9b3f72ee0e6
BLAKE2b-256 c3ba3d620c5c0bb985f4483c38ed2b48889b8b1934bb20a5118213d2a1b7dd28

See more details on using hashes here.

Provenance

The following attestation bundles were made for aidememo_agent_sdk-0.1.0-py3-none-any.whl:

Publisher: aidememo-agent-sdk-publish.yml on taeyun16/aidememo

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page