Metadata-Version: 2.5
Name: gethaki
Version: 0.1.2
Summary: Python SDK for Haki — long-term memory for AI agents, with proof
Project-URL: Homepage, https://gethaki.space
Project-URL: Documentation, https://docs.gethaki.space
Project-URL: Repository, https://github.com/GetHaki/Haki
Project-URL: Issues, https://github.com/GetHaki/Haki/issues
Author: Dicken AI
License-Expression: Apache-2.0
Keywords: agents,ai,context,llm,memory,rag
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: Apache Software License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.12
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Requires-Python: >=3.12
Requires-Dist: httpx>=0.28
Description-Content-Type: text/markdown

# gethaki

Python SDK for [Haki](https://gethaki.space) — a long-term memory layer for
AI agents. Every fact carries a date, a source and a status, so your agent
uses what's true today and can prove it.

- **Docs**: https://docs.gethaki.space
- **Source / self-hosting**: https://github.com/GetHaki/Haki
- **License**: Apache-2.0

## Install

```bash
pip install gethaki
```

## Usage

```python
from haki import HakiClient
from haki.runtime import build_prompt_context, capture_turn

client = HakiClient("http://localhost:8100")

# Before the LLM call: memory becomes an instruction block
packet = client.context(subject_id="usr_42", query=user_msg, project_id="prj")
prompt = build_prompt_context(packet) + "\n" + system_prompt

answer = my_llm(prompt, user_msg)  # your LLM call and app code stay unchanged

# After the LLM call: the conversation turn goes back into memory
capture_turn(client, "usr_42", "prj", user_msg, answer)
```

`AsyncHakiClient` is available for async codebases. Typed errors
(`HakiApiError`, `HakiConnectionError`) instead of bare exceptions.

## CLI

The `haki` command ships with this package:

```bash
haki connect --api-url http://localhost:8100
haki verify      # memorizes a preference, then a correction to it, then proves
                 # a new conversation serves the current value and can show
                 # the one it replaced
haki status
haki mcp          # package this SDK for Cursor's MCP integration
```

## Requires

A running Haki API (self-hosted via `docker compose up -d` from the
[main repo](https://github.com/GetHaki/Haki), or a Haki Cloud project).
This package is the client only — see the repo for the server.
