Skip to main content

Import Knowledge and Memory Portability (import-kb)

A utility package for importing distilled knowledge into a ChromaDB-based Long-Term Memory (LTM) system and backing up or restoring Omega user memory.

Purpose

The import-kb package is designed to bridge the gap between static knowledge files (JSONL, MeTTa) and an active agent's memory. It processes structured knowledge, generates vector embeddings, and upserts them into a ChromaDB collection, enabling semantic search and retrieval for AI agents.

The package also provides memory_portability, a programmatic interface for exporting and restoring Omega conversation history and user LTM records. Omega Core remains responsible for its CLI, container lifecycle, transfer-directory mount, and user-facing decisions.

Supported Embedding Models

This package supports the following embedding modes:

  • OpenAI (Cloud):
    • Default model: text-embedding-3-large
    • High accuracy but requires an internet connection and an API key.
  • ASI Cloud:
    • Default model: WhereIsAI/UAE-Large-V1
    • Uses an OpenAI-compatible endpoint hosted by ASI Cloud, requires an API key.
  • SentenceTransformers (Local):
    • Default model: intfloat/e5-large-v2
    • Runs fully offline on your local machine.
    • Can be configured to use any model compatible with the sentence-transformers library (e.g., all-MiniLM-L6-v2).

Installation

You can install the package directly from PyPI:

pip install import-kb

Or install it locally in editable mode:

git clone <repository-url>
cd import-knowledge-package
pip install -e .

Setup

Create a .env file in your project root or set the following environment variables:

  • OPENAI_API_KEY: Required if using OpenAI embeddings.
  • ASI_API_KEY: Required if using ASI Cloud embeddings (--provider asicloud).
  • CHROMA_DB_PATH: (Optional) Custom path to your Chroma database. Defaults to looking for /PeTTa/chroma_db or a local chroma_db folder.

How to Run

Command Line Interface (CLI)

After installation, you can run the import via the provided entry point:

# Use OpenAI embeddings (default)
import-knowledge

# Same as above, made explicit
import-knowledge --provider openai

# Override OpenAI model
import-knowledge --provider openai --model "text-embedding-3-small"

# Use ASI Cloud embeddings
import-knowledge --provider asicloud

# Override the ASI Cloud model
import-knowledge --provider asicloud --model "<model-name>"

# Use Local embeddings
import-knowledge --local

# Use a specific local model
import-knowledge --local --model "all-MiniLM-L6-v2"

Alternatively, run it as a module:

python3 -m import_knowledge.import_knowledge --local

Programmatic Usage

You can initialize the embedding system and trigger the import programmatically from your Python scripts:

from import_knowledge import initLocalEmbedding, main

# Initialize for local use
initLocalEmbedding(model_name="intfloat/e5-large-v2")

# Run the import process
main()

Memory portability

The host application owns memory configuration and must pass the resolved paths to the package explicitly:

from pathlib import Path

from memory_portability import MemoryStore, MemoryTransfer

store = MemoryStore(
    memory_dir=Path("/path/to/omega/memory"),
    chroma_path=Path("/path/to/chroma_db"),
    collection_name="memories",
)
transfer = MemoryTransfer(
    transfer_dir=Path("/path/to/memory-transfer"),
    store=store,
)

exported = transfer.export(component="both")
transfer.import_archive(exported["filename"])
transfer.recover()

MemoryStore does not infer Omega paths or read them from environment variables. Resolve these values in the host application's configuration layer.

Default exports use omega-memory-<UTC timestamp>-<ID>.tar.gz, where the ID is the first eight hexadecimal characters of a UUIDv4.

Dependencies

  • openai: For cloud-based embeddings.
  • sentence-transformers: For local, offline embeddings.
  • chromadb: Vector database for storage.
  • python-dotenv: Management of environment variables.
  • tqdm: Progress bars for batch processing.

Publishing to PyPI

The publishing workflow builds and validates a source distribution and wheel when a GitHub Release is published, then uploads them to PyPI using Trusted Publishing. No PyPI API token or GitHub secret is needed.

One-time setup:

  1. Create a GitHub environment named pypi in the repository settings. Configure required reviewers if releases should require approval before uploading.
  2. In the PyPI import-kb project's Publishing settings, add a GitHub trusted publisher with the following values:
    • Owner: the GitHub user or organization that will publish releases (blackhammer116 for this fork, or singnet for the upstream repository).
    • Repository: import-knowledge-package.
    • Workflow filename: publish.yml.
    • Environment: pypi.

To release, update project.version in pyproject.toml to an unused version, commit the change, and publish a GitHub Release tagged with that version (for example, v0.2.5 or 0.2.5). The tag must point to the commit containing the version update and this workflow. Draft releases and tag pushes alone do not publish; publishing a GitHub prerelease also triggers the workflow, so use a corresponding Python prerelease version such as 0.3.0rc1.

The workflow rejects tags that do not match project.version. PyPI does not allow an existing release file to be overwritten; use a new version for each release.

License

This project is licensed under the Apache License 2.0. See LICENSE file for details.

Metadata

Release files for import-kb 0.2.5

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

Source distribution (sdist)

Source distribution for import-kb 0.2.5
File Size Uploaded Provenance
import_kb-0.2.5.tar.gz 2.6 MB With provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for import-kb 0.2.5
File Interpreter ABI Platform
import_kb-0.2.5-py3-none-any.whl Python 3 none any Details

Total release size: 5.3 MB

Release files / import_kb-0.2.5.tar.gz

Download URL import_kb-0.2.5.tar.gz
Size 2.6 MB
Tags Source
SHA-256 checksum
How to use checksums
f32b0aa6929c73397b2d13203f068b5368f3d72233c8deb783bd7d1fa4e65d35
BLAKE2b-256 checksum
How to use checksums
f935e9a0c3f548baa393a21b91af2f2db608d04b06ecccff47815f5b42ca32dc
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 19, 2026.

Transparency log

Release files / import_kb-0.2.5-py3-none-any.whl

Download URL import_kb-0.2.5-py3-none-any.whl
Size 2.7 MB
Tags Python 3
SHA-256 checksum
How to use checksums
5b6c56a74714fb000ceb410d1e1054626ee57337dc6192baf56f5cb09031b9b1
BLAKE2b-256 checksum
How to use checksums
149b84aa53809ec0b0060a7dd94332954cba9ef77c90aba3ee2728810a906856
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 19, 2026.

Transparency log

Security for import-kb 0.2.5

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.

Full provenance

All 2 files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for import_kb-0.2.5.tar.gz

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 19, 2026.

Transparency log

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