highhxpack 0.1.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- highhxpack-0.1.0/.gitignore +28 -0
- highhxpack-0.1.0/CHANGELOG.md +45 -0
- highhxpack-0.1.0/CODE_OF_CONDUCT.md +42 -0
- highhxpack-0.1.0/CONTRIBUTING.md +54 -0
- highhxpack-0.1.0/LICENSE +21 -0
- highhxpack-0.1.0/PKG-INFO +297 -0
- highhxpack-0.1.0/README.md +254 -0
- highhxpack-0.1.0/SECURITY.md +27 -0
- highhxpack-0.1.0/benchmarks/benchmark_memory.py +83 -0
- highhxpack-0.1.0/benchmarks/benchmark_retrieval.py +91 -0
- highhxpack-0.1.0/docs/api/cli.md +47 -0
- highhxpack-0.1.0/docs/api/exceptions.md +21 -0
- highhxpack-0.1.0/docs/api/extending.md +62 -0
- highhxpack-0.1.0/docs/api/memory.md +65 -0
- highhxpack-0.1.0/docs/api/models.md +34 -0
- highhxpack-0.1.0/docs/concepts/architecture.md +49 -0
- highhxpack-0.1.0/docs/concepts/configuration.md +78 -0
- highhxpack-0.1.0/docs/concepts/consolidation.md +22 -0
- highhxpack-0.1.0/docs/concepts/extraction.md +38 -0
- highhxpack-0.1.0/docs/concepts/graph.md +22 -0
- highhxpack-0.1.0/docs/concepts/memories.md +91 -0
- highhxpack-0.1.0/docs/concepts/privacy.md +45 -0
- highhxpack-0.1.0/docs/concepts/providers.md +45 -0
- highhxpack-0.1.0/docs/concepts/retrieval.md +74 -0
- highhxpack-0.1.0/docs/concepts/storage.md +61 -0
- highhxpack-0.1.0/docs/index.md +30 -0
- highhxpack-0.1.0/docs/installation.md +49 -0
- highhxpack-0.1.0/docs/quickstart.md +65 -0
- highhxpack-0.1.0/examples/agent_memory.py +60 -0
- highhxpack-0.1.0/examples/basic.py +42 -0
- highhxpack-0.1.0/examples/chatbot.py +48 -0
- highhxpack-0.1.0/examples/local_llm.py +46 -0
- highhxpack-0.1.0/pyproject.toml +164 -0
- highhxpack-0.1.0/src/highhxpack/__init__.py +106 -0
- highhxpack-0.1.0/src/highhxpack/__main__.py +6 -0
- highhxpack-0.1.0/src/highhxpack/__version__.py +3 -0
- highhxpack-0.1.0/src/highhxpack/cli/__init__.py +1 -0
- highhxpack-0.1.0/src/highhxpack/cli/commands/__init__.py +1 -0
- highhxpack-0.1.0/src/highhxpack/cli/commands/consolidate.py +92 -0
- highhxpack-0.1.0/src/highhxpack/cli/commands/export.py +34 -0
- highhxpack-0.1.0/src/highhxpack/cli/commands/forget.py +75 -0
- highhxpack-0.1.0/src/highhxpack/cli/commands/import_.py +46 -0
- highhxpack-0.1.0/src/highhxpack/cli/commands/init.py +84 -0
- highhxpack-0.1.0/src/highhxpack/cli/commands/inspect.py +99 -0
- highhxpack-0.1.0/src/highhxpack/cli/commands/memories.py +92 -0
- highhxpack-0.1.0/src/highhxpack/cli/commands/recall.py +121 -0
- highhxpack-0.1.0/src/highhxpack/cli/commands/remember.py +122 -0
- highhxpack-0.1.0/src/highhxpack/cli/commands/stats.py +48 -0
- highhxpack-0.1.0/src/highhxpack/cli/context.py +70 -0
- highhxpack-0.1.0/src/highhxpack/cli/display.py +154 -0
- highhxpack-0.1.0/src/highhxpack/cli/main.py +155 -0
- highhxpack-0.1.0/src/highhxpack/consolidation/__init__.py +39 -0
- highhxpack-0.1.0/src/highhxpack/consolidation/conflict.py +178 -0
- highhxpack-0.1.0/src/highhxpack/consolidation/deduplication.py +157 -0
- highhxpack-0.1.0/src/highhxpack/consolidation/importance.py +64 -0
- highhxpack-0.1.0/src/highhxpack/consolidation/summarization.py +109 -0
- highhxpack-0.1.0/src/highhxpack/core/__init__.py +6 -0
- highhxpack-0.1.0/src/highhxpack/core/config.py +352 -0
- highhxpack-0.1.0/src/highhxpack/core/lifecycle.py +42 -0
- highhxpack-0.1.0/src/highhxpack/core/manager.py +643 -0
- highhxpack-0.1.0/src/highhxpack/core/memory.py +766 -0
- highhxpack-0.1.0/src/highhxpack/core/transfer.py +482 -0
- highhxpack-0.1.0/src/highhxpack/embeddings/__init__.py +22 -0
- highhxpack-0.1.0/src/highhxpack/embeddings/base.py +60 -0
- highhxpack-0.1.0/src/highhxpack/embeddings/local.py +125 -0
- highhxpack-0.1.0/src/highhxpack/embeddings/providers.py +177 -0
- highhxpack-0.1.0/src/highhxpack/exceptions.py +115 -0
- highhxpack-0.1.0/src/highhxpack/extraction/__init__.py +24 -0
- highhxpack-0.1.0/src/highhxpack/extraction/entities.py +100 -0
- highhxpack-0.1.0/src/highhxpack/extraction/events.py +42 -0
- highhxpack-0.1.0/src/highhxpack/extraction/extractor.py +287 -0
- highhxpack-0.1.0/src/highhxpack/extraction/facts.py +119 -0
- highhxpack-0.1.0/src/highhxpack/extraction/patterns.py +104 -0
- highhxpack-0.1.0/src/highhxpack/extraction/preferences.py +58 -0
- highhxpack-0.1.0/src/highhxpack/graph/__init__.py +7 -0
- highhxpack-0.1.0/src/highhxpack/graph/edges.py +26 -0
- highhxpack-0.1.0/src/highhxpack/graph/graph.py +151 -0
- highhxpack-0.1.0/src/highhxpack/graph/nodes.py +36 -0
- highhxpack-0.1.0/src/highhxpack/integrations/__init__.py +11 -0
- highhxpack-0.1.0/src/highhxpack/integrations/generic.py +85 -0
- highhxpack-0.1.0/src/highhxpack/integrations/langchain.py +67 -0
- highhxpack-0.1.0/src/highhxpack/integrations/llamaindex.py +56 -0
- highhxpack-0.1.0/src/highhxpack/models/__init__.py +36 -0
- highhxpack-0.1.0/src/highhxpack/models/event.py +55 -0
- highhxpack-0.1.0/src/highhxpack/models/memory.py +144 -0
- highhxpack-0.1.0/src/highhxpack/models/relationship.py +79 -0
- highhxpack-0.1.0/src/highhxpack/models/result.py +227 -0
- highhxpack-0.1.0/src/highhxpack/models/user.py +37 -0
- highhxpack-0.1.0/src/highhxpack/providers/__init__.py +48 -0
- highhxpack-0.1.0/src/highhxpack/providers/base.py +106 -0
- highhxpack-0.1.0/src/highhxpack/providers/custom.py +47 -0
- highhxpack-0.1.0/src/highhxpack/providers/ollama.py +72 -0
- highhxpack-0.1.0/src/highhxpack/providers/openai.py +91 -0
- highhxpack-0.1.0/src/highhxpack/py.typed +0 -0
- highhxpack-0.1.0/src/highhxpack/retrieval/__init__.py +7 -0
- highhxpack-0.1.0/src/highhxpack/retrieval/filters.py +147 -0
- highhxpack-0.1.0/src/highhxpack/retrieval/hybrid.py +24 -0
- highhxpack-0.1.0/src/highhxpack/retrieval/keyword.py +63 -0
- highhxpack-0.1.0/src/highhxpack/retrieval/ranking.py +174 -0
- highhxpack-0.1.0/src/highhxpack/retrieval/retriever.py +143 -0
- highhxpack-0.1.0/src/highhxpack/retrieval/semantic.py +36 -0
- highhxpack-0.1.0/src/highhxpack/storage/__init__.py +6 -0
- highhxpack-0.1.0/src/highhxpack/storage/base.py +210 -0
- highhxpack-0.1.0/src/highhxpack/storage/migrations.py +188 -0
- highhxpack-0.1.0/src/highhxpack/storage/sqlite.py +934 -0
- highhxpack-0.1.0/src/highhxpack/storage/vector.py +87 -0
- highhxpack-0.1.0/src/highhxpack/utils/__init__.py +1 -0
- highhxpack-0.1.0/src/highhxpack/utils/hashing.py +31 -0
- highhxpack-0.1.0/src/highhxpack/utils/logging.py +52 -0
- highhxpack-0.1.0/src/highhxpack/utils/text.py +117 -0
- highhxpack-0.1.0/src/highhxpack/utils/timestamps.py +78 -0
- highhxpack-0.1.0/src/highhxpack/utils/validation.py +179 -0
- highhxpack-0.1.0/tests/conftest.py +44 -0
- highhxpack-0.1.0/tests/integration/test_cli.py +345 -0
- highhxpack-0.1.0/tests/integration/test_system.py +176 -0
- highhxpack-0.1.0/tests/support.py +30 -0
- highhxpack-0.1.0/tests/unit/test_api_stability.py +94 -0
- highhxpack-0.1.0/tests/unit/test_config.py +158 -0
- highhxpack-0.1.0/tests/unit/test_consolidation.py +211 -0
- highhxpack-0.1.0/tests/unit/test_extraction.py +184 -0
- highhxpack-0.1.0/tests/unit/test_graph.py +62 -0
- highhxpack-0.1.0/tests/unit/test_memory_api.py +498 -0
- highhxpack-0.1.0/tests/unit/test_models.py +95 -0
- highhxpack-0.1.0/tests/unit/test_providers.py +277 -0
- highhxpack-0.1.0/tests/unit/test_retrieval.py +212 -0
- highhxpack-0.1.0/tests/unit/test_storage.py +456 -0
- highhxpack-0.1.0/tests/unit/test_transfer.py +203 -0
- highhxpack-0.1.0/tests/unit/test_utils.py +229 -0
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
__pycache__/
|
|
2
|
+
*.py[cod]
|
|
3
|
+
*.egg-info/
|
|
4
|
+
.eggs/
|
|
5
|
+
build/
|
|
6
|
+
dist/
|
|
7
|
+
.venv/
|
|
8
|
+
venv/
|
|
9
|
+
.env
|
|
10
|
+
.env.*
|
|
11
|
+
.coverage
|
|
12
|
+
.coverage.*
|
|
13
|
+
coverage.xml
|
|
14
|
+
htmlcov/
|
|
15
|
+
.pytest_cache/
|
|
16
|
+
.mypy_cache/
|
|
17
|
+
.ruff_cache/
|
|
18
|
+
.DS_Store
|
|
19
|
+
# Local memory databases must never be committed.
|
|
20
|
+
*.db
|
|
21
|
+
*.db-wal
|
|
22
|
+
*.db-shm
|
|
23
|
+
*.sqlite3
|
|
24
|
+
*.log
|
|
25
|
+
.tox/
|
|
26
|
+
.nox/
|
|
27
|
+
.idea/
|
|
28
|
+
.vscode/
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
All notable changes to this project are documented here. The format follows
|
|
4
|
+
[Keep a Changelog](https://keepachangelog.com/en/1.1.0/) and the project uses
|
|
5
|
+
[Semantic Versioning](https://semver.org/). Before 1.0.0, minor releases may contain
|
|
6
|
+
breaking changes; they are always listed under **Changed** or **Removed**.
|
|
7
|
+
|
|
8
|
+
## [Unreleased]
|
|
9
|
+
|
|
10
|
+
## [0.1.0] - 2026-09-26
|
|
11
|
+
|
|
12
|
+
First public release.
|
|
13
|
+
|
|
14
|
+
### Added
|
|
15
|
+
|
|
16
|
+
- `Memory` API: `remember`, `ingest`, `recall`, `search`, `get`, `update`, `forget`,
|
|
17
|
+
`restore`, `delete`, `list`, `count`, `clear`, `stats`, `inspect`, `users`,
|
|
18
|
+
`history`, `conflicts`, `resolve_conflict`, `consolidate`, `reindex`, `export`,
|
|
19
|
+
`import_`, `resolve_id`, and the `graph` property.
|
|
20
|
+
- SQLite storage with WAL mode, transactions, versioned migrations, owner-only file
|
|
21
|
+
permissions and safe concurrent first-time initialization.
|
|
22
|
+
- Keyword (BM25), semantic (cosine) and hybrid retrieval with a transparent,
|
|
23
|
+
centrally configured ranking (`ScoringConfig`) and per-result score breakdowns.
|
|
24
|
+
- Embedding providers: deterministic local hashing embedding (default),
|
|
25
|
+
sentence-transformers, Ollama, OpenAI and callables.
|
|
26
|
+
- LLM providers: Ollama, OpenAI and callables (all optional).
|
|
27
|
+
- Rule-based and LLM-based extraction of facts, preferences, goals, decisions,
|
|
28
|
+
relationships and events; entity recognition.
|
|
29
|
+
- Exact and near-duplicate detection with reinforcement; claim-based conflict
|
|
30
|
+
detection with `supersede`/`keep_both` policies and full history.
|
|
31
|
+
- Consolidation: expiry archiving, duplicate merging, missed-conflict resolution and
|
|
32
|
+
optional summaries.
|
|
33
|
+
- Lightweight per-user knowledge graph.
|
|
34
|
+
- JSON export/import with strict validation.
|
|
35
|
+
- `highhxpack` CLI: `init`, `config`, `remember`, `recall`, `search`, `memories`,
|
|
36
|
+
`inspect`, `history`, `forget`, `restore`, `conflicts`, `resolve`, `consolidate`,
|
|
37
|
+
`stats`, `export`, `import`, with `--json` output and documented exit codes.
|
|
38
|
+
- Integrations: `ChatMemory`/`format_memories`, LangChain and LlamaIndex retrievers.
|
|
39
|
+
- Graceful degradation: hybrid retrieval falls back to keyword relevance if the
|
|
40
|
+
embedding provider fails; LLM providers are created on first use.
|
|
41
|
+
- Configuration via file, environment variables and arguments with documented
|
|
42
|
+
precedence.
|
|
43
|
+
|
|
44
|
+
[Unreleased]: https://github.com/highhxpack/highhxpack/compare/v0.1.0...HEAD
|
|
45
|
+
[0.1.0]: https://github.com/highhxpack/highhxpack/releases/tag/v0.1.0
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
# Code of Conduct
|
|
2
|
+
|
|
3
|
+
## Our pledge
|
|
4
|
+
|
|
5
|
+
We as members, contributors and maintainers pledge to make participation in this
|
|
6
|
+
project a harassment-free experience for everyone, regardless of age, body size,
|
|
7
|
+
visible or invisible disability, ethnicity, sex characteristics, gender identity and
|
|
8
|
+
expression, level of experience, education, socio-economic status, nationality,
|
|
9
|
+
personal appearance, race, religion, or sexual identity and orientation.
|
|
10
|
+
|
|
11
|
+
## Our standards
|
|
12
|
+
|
|
13
|
+
Examples of behavior that contributes to a positive environment:
|
|
14
|
+
|
|
15
|
+
- demonstrating empathy and kindness toward other people;
|
|
16
|
+
- being respectful of differing opinions, viewpoints and experiences;
|
|
17
|
+
- giving and gracefully accepting constructive feedback;
|
|
18
|
+
- taking responsibility for our mistakes and learning from them;
|
|
19
|
+
- focusing on what is best for the community.
|
|
20
|
+
|
|
21
|
+
Examples of unacceptable behavior:
|
|
22
|
+
|
|
23
|
+
- sexualized language or imagery, and unwelcome sexual attention or advances;
|
|
24
|
+
- trolling, insulting or derogatory comments, and personal or political attacks;
|
|
25
|
+
- public or private harassment;
|
|
26
|
+
- publishing others' private information without their explicit permission;
|
|
27
|
+
- other conduct which could reasonably be considered inappropriate in a professional
|
|
28
|
+
setting.
|
|
29
|
+
|
|
30
|
+
## Enforcement
|
|
31
|
+
|
|
32
|
+
Maintainers are responsible for clarifying and enforcing these standards and may
|
|
33
|
+
remove, edit or reject contributions that do not align with this Code of Conduct.
|
|
34
|
+
Report unacceptable behavior privately to the maintainers through the repository's
|
|
35
|
+
security/advisory contact or by direct message to a maintainer. All reports will be
|
|
36
|
+
reviewed and investigated promptly and fairly, and the privacy of reporters will be
|
|
37
|
+
respected.
|
|
38
|
+
|
|
39
|
+
## Attribution
|
|
40
|
+
|
|
41
|
+
This Code of Conduct is adapted from the
|
|
42
|
+
[Contributor Covenant](https://www.contributor-covenant.org), version 2.1.
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
# Contributing to HighHXPack
|
|
2
|
+
|
|
3
|
+
Thanks for your interest! Bug reports, documentation fixes and pull requests are all
|
|
4
|
+
welcome.
|
|
5
|
+
|
|
6
|
+
## Development setup
|
|
7
|
+
|
|
8
|
+
```bash
|
|
9
|
+
git clone https://github.com/highhxpack/highhxpack
|
|
10
|
+
cd highhxpack
|
|
11
|
+
uv sync # or: python -m venv .venv && pip install -e . --group dev
|
|
12
|
+
uv run pre-commit install
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
## Checks
|
|
16
|
+
|
|
17
|
+
Run these before opening a pull request; CI runs the same commands.
|
|
18
|
+
|
|
19
|
+
```bash
|
|
20
|
+
uv run ruff check .
|
|
21
|
+
uv run ruff format --check .
|
|
22
|
+
uv run mypy
|
|
23
|
+
uv run pytest --cov # all tests; fails below 90% coverage
|
|
24
|
+
uv run pytest -m "not slow" # quicker loop
|
|
25
|
+
uv run python -m build && uv run twine check dist/* # packaging (optional)
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
## Guidelines
|
|
29
|
+
|
|
30
|
+
- **Tests first.** Every feature needs tests; every bug fix needs a regression test
|
|
31
|
+
that fails without the fix.
|
|
32
|
+
- **No new required dependencies.** The core must keep working with the standard
|
|
33
|
+
library only. Optional integrations go behind an extra and a lazy import that raises
|
|
34
|
+
`ProviderNotAvailableError` with install instructions.
|
|
35
|
+
- **Public API** is what `highhxpack/__init__.py` exports. Changing it needs a
|
|
36
|
+
CHANGELOG entry; breaking changes need a deprecation path where possible.
|
|
37
|
+
- **Errors** raise a `HighHXPackError` subclass with a message, and ideally a reason
|
|
38
|
+
and a hint.
|
|
39
|
+
- **No magic numbers** in ranking or policies: put tunables in a config dataclass.
|
|
40
|
+
- **Schema changes** are new migrations in `storage/migrations.py`; never edit a
|
|
41
|
+
released migration.
|
|
42
|
+
- **Privacy**: never log memory content or secrets at INFO level or above, and never
|
|
43
|
+
send data to a network service unless the user configured it.
|
|
44
|
+
- Keep documentation in `docs/` and `README.md` in sync with the code.
|
|
45
|
+
|
|
46
|
+
## Releasing (maintainers)
|
|
47
|
+
|
|
48
|
+
1. Update `src/highhxpack/__version__.py` and move `Unreleased` entries in
|
|
49
|
+
`CHANGELOG.md` under the new version.
|
|
50
|
+
2. Merge to `main`, tag `vX.Y.Z` and publish a GitHub release. The `publish` workflow
|
|
51
|
+
builds, checks and uploads to PyPI through trusted publishing.
|
|
52
|
+
|
|
53
|
+
By contributing you agree that your contributions are licensed under the MIT License
|
|
54
|
+
and that you will follow the [Code of Conduct](CODE_OF_CONDUCT.md).
|
highhxpack-0.1.0/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 HighHXPack contributors
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,297 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: highhxpack
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Local-first memory and context engine for AI applications, agents, and developer tools.
|
|
5
|
+
Project-URL: Homepage, https://github.com/highhxpack/highhxpack
|
|
6
|
+
Project-URL: Documentation, https://github.com/highhxpack/highhxpack/tree/main/docs
|
|
7
|
+
Project-URL: Repository, https://github.com/highhxpack/highhxpack
|
|
8
|
+
Project-URL: Issues, https://github.com/highhxpack/highhxpack/issues
|
|
9
|
+
Project-URL: Changelog, https://github.com/highhxpack/highhxpack/blob/main/CHANGELOG.md
|
|
10
|
+
Author: HighHXPack contributors
|
|
11
|
+
License-Expression: MIT
|
|
12
|
+
License-File: LICENSE
|
|
13
|
+
Keywords: agents,ai,context,llm,local-first,memory,retrieval,sqlite
|
|
14
|
+
Classifier: Development Status :: 3 - Alpha
|
|
15
|
+
Classifier: Intended Audience :: Developers
|
|
16
|
+
Classifier: Operating System :: OS Independent
|
|
17
|
+
Classifier: Programming Language :: Python :: 3
|
|
18
|
+
Classifier: Programming Language :: Python :: 3 :: Only
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
20
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
21
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
22
|
+
Classifier: Programming Language :: Python :: 3.14
|
|
23
|
+
Classifier: Topic :: Database
|
|
24
|
+
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
|
|
25
|
+
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
26
|
+
Classifier: Typing :: Typed
|
|
27
|
+
Requires-Python: >=3.11
|
|
28
|
+
Provides-Extra: all
|
|
29
|
+
Requires-Dist: langchain-core>=0.3; extra == 'all'
|
|
30
|
+
Requires-Dist: llama-index-core>=0.11; extra == 'all'
|
|
31
|
+
Requires-Dist: openai>=1.40; extra == 'all'
|
|
32
|
+
Requires-Dist: sentence-transformers>=2.7; extra == 'all'
|
|
33
|
+
Provides-Extra: langchain
|
|
34
|
+
Requires-Dist: langchain-core>=0.3; extra == 'langchain'
|
|
35
|
+
Provides-Extra: llamaindex
|
|
36
|
+
Requires-Dist: llama-index-core>=0.11; extra == 'llamaindex'
|
|
37
|
+
Provides-Extra: ollama
|
|
38
|
+
Provides-Extra: openai
|
|
39
|
+
Requires-Dist: openai>=1.40; extra == 'openai'
|
|
40
|
+
Provides-Extra: sentence-transformers
|
|
41
|
+
Requires-Dist: sentence-transformers>=2.7; extra == 'sentence-transformers'
|
|
42
|
+
Description-Content-Type: text/markdown
|
|
43
|
+
|
|
44
|
+
# HighHXPack
|
|
45
|
+
|
|
46
|
+
**A local-first memory and context engine for AI applications, agents and developer tools.**
|
|
47
|
+
|
|
48
|
+
HighHXPack gives your chatbot, agent or tool a long-term memory: it stores what users
|
|
49
|
+
tell it, recognizes facts and preferences, avoids duplicates, keeps track of
|
|
50
|
+
information that changes over time, and retrieves the most relevant memories for a
|
|
51
|
+
prompt — all on the local machine, in a single SQLite file, with **no required
|
|
52
|
+
dependencies, API keys, or cloud services**.
|
|
53
|
+
|
|
54
|
+
```python
|
|
55
|
+
from highhxpack import Memory
|
|
56
|
+
|
|
57
|
+
memory = Memory()
|
|
58
|
+
memory.remember(user_id="user_123", content="I prefer Python for AI development.")
|
|
59
|
+
|
|
60
|
+
results = memory.recall(user_id="user_123", query="What language do I prefer for AI?")
|
|
61
|
+
print(results[0].content) # I prefer Python for AI development.
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
> Status: **alpha (0.1.0)**. The public API is documented and tested, but may
|
|
65
|
+
> still change before 1.0; changes are recorded in [CHANGELOG.md](CHANGELOG.md).
|
|
66
|
+
|
|
67
|
+
## Why HighHXPack?
|
|
68
|
+
|
|
69
|
+
LLM applications forget everything between sessions. Common fixes send user data to a
|
|
70
|
+
hosted memory service or require a vector database. HighHXPack is a library instead:
|
|
71
|
+
|
|
72
|
+
- **Local and private by default** — data lives in a SQLite file you control.
|
|
73
|
+
Nothing leaves the machine unless you configure a remote provider.
|
|
74
|
+
- **Zero required dependencies** — the core uses only the Python standard library.
|
|
75
|
+
- **More than a vector store** — deduplication, conflict handling with history,
|
|
76
|
+
importance/recency ranking, extraction, consolidation and a small knowledge graph.
|
|
77
|
+
- **Transparent ranking** — every result carries a score breakdown; all weights live
|
|
78
|
+
in one configuration object.
|
|
79
|
+
- **Pluggable** — bring your own embedding model, LLM, or storage backend.
|
|
80
|
+
|
|
81
|
+
## Installation
|
|
82
|
+
|
|
83
|
+
```bash
|
|
84
|
+
pip install highhxpack
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
Requires Python 3.11+. Optional extras add third-party providers:
|
|
88
|
+
|
|
89
|
+
```bash
|
|
90
|
+
pip install "highhxpack[openai]" # OpenAI embeddings / LLM
|
|
91
|
+
pip install "highhxpack[sentence-transformers]" # local neural embeddings
|
|
92
|
+
pip install "highhxpack[langchain]" # LangChain retriever
|
|
93
|
+
pip install "highhxpack[llamaindex]" # LlamaIndex retriever
|
|
94
|
+
pip install "highhxpack[ollama]" # no extra packages; Ollama uses HTTP
|
|
95
|
+
pip install "highhxpack[all]"
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
## Five-minute quickstart
|
|
99
|
+
|
|
100
|
+
```python
|
|
101
|
+
from highhxpack import Memory
|
|
102
|
+
|
|
103
|
+
with Memory() as memory: # ~/.local/share/highhxpack/memory.db on Linux
|
|
104
|
+
memory.remember("alice", "I prefer Python for AI development.")
|
|
105
|
+
memory.remember("alice", "My favorite editor is Neovim.", importance=0.8)
|
|
106
|
+
memory.remember("alice", "Temporary door code is 4321", ttl="1d") # expires
|
|
107
|
+
|
|
108
|
+
# Duplicates reinforce the existing memory instead of piling up.
|
|
109
|
+
result = memory.remember("alice", "User prefers Python for AI development")
|
|
110
|
+
print(result.action) # reinforced
|
|
111
|
+
|
|
112
|
+
# Changing information: the old statement is superseded, not deleted.
|
|
113
|
+
memory.remember("alice", "I live in Paris")
|
|
114
|
+
update = memory.remember("alice", "I live in Berlin")
|
|
115
|
+
print(update.superseded_ids) # ('<id of the Paris memory>',)
|
|
116
|
+
|
|
117
|
+
# Ranked retrieval with an explanation of every score.
|
|
118
|
+
for r in memory.recall("alice", "where do I live?", limit=5):
|
|
119
|
+
print(f"{r.score:.2f} {r.content} relevance={r.breakdown.relevance:.2f}")
|
|
120
|
+
|
|
121
|
+
# Extract memorable statements from free text (offline, rule-based).
|
|
122
|
+
memory.ingest(
|
|
123
|
+
"alice",
|
|
124
|
+
"I've been using Python for ML for years, "
|
|
125
|
+
"but I prefer C++ for competitive programming. How are you?",
|
|
126
|
+
)
|
|
127
|
+
print(memory.graph.neighbors("alice", "user")) # ['C++', 'Python']
|
|
128
|
+
|
|
129
|
+
# Everything else
|
|
130
|
+
memory.search("python", user_id="alice", status="any") # includes history
|
|
131
|
+
memory.list("alice", memory_type="preference")
|
|
132
|
+
memory.history(update.id) # every version/change
|
|
133
|
+
memory.consolidate("alice", dry_run=True) # merge dupes, apply policy
|
|
134
|
+
memory.export("alice.json", user_id="alice")
|
|
135
|
+
memory.stats()
|
|
136
|
+
```
|
|
137
|
+
|
|
138
|
+
The full public API: `remember`, `ingest`, `recall`, `search`, `get`, `update`,
|
|
139
|
+
`forget`, `restore`, `delete`, `list`, `count`, `clear`, `stats`, `inspect`,
|
|
140
|
+
`users`, `history`, `conflicts`, `resolve_conflict`, `consolidate`, `reindex`,
|
|
141
|
+
`export`, `import_`, and the `graph` property. See [docs/api](docs/api/memory.md).
|
|
142
|
+
|
|
143
|
+
## CLI
|
|
144
|
+
|
|
145
|
+
```bash
|
|
146
|
+
highhxpack init # data directory, config file, database
|
|
147
|
+
highhxpack remember "I use Python"
|
|
148
|
+
highhxpack remember --extract "I prefer Rust, but I use Go at work."
|
|
149
|
+
highhxpack recall "programming language" --explain
|
|
150
|
+
highhxpack search "python" --status any --json
|
|
151
|
+
highhxpack memories # list (alias: list)
|
|
152
|
+
highhxpack inspect alice # summary + knowledge graph of a user
|
|
153
|
+
highhxpack history 1a2b3c4d # a memory and its change history
|
|
154
|
+
highhxpack forget 1a2b3c4d # archive (restorable); --permanent to erase
|
|
155
|
+
highhxpack conflicts # contradictions awaiting a decision
|
|
156
|
+
highhxpack consolidate --dry-run
|
|
157
|
+
highhxpack stats
|
|
158
|
+
highhxpack export backup.json
|
|
159
|
+
highhxpack import backup.json
|
|
160
|
+
highhxpack config # effective configuration (secrets masked)
|
|
161
|
+
highhxpack --help / --version
|
|
162
|
+
```
|
|
163
|
+
|
|
164
|
+
Every command accepts `--user`, `--db`, `--config`, `--json` and `--no-color`.
|
|
165
|
+
Memory ids can be abbreviated to a unique prefix. Exit codes: `0` success, `1` error,
|
|
166
|
+
`2` invalid input, `3` not found, `130` interrupted. Errors are printed as a message,
|
|
167
|
+
reason and hint — never as a traceback.
|
|
168
|
+
|
|
169
|
+
## Architecture
|
|
170
|
+
|
|
171
|
+
```text
|
|
172
|
+
Memory (public API)
|
|
173
|
+
├── MemoryManager ─ write path: validation → dedup → conflicts → index → history
|
|
174
|
+
│ ├── consolidation/ deduplication · conflict · importance · summarization
|
|
175
|
+
│ └── extraction/ rule-based or LLM extraction of facts, preferences, …
|
|
176
|
+
├── Retriever ─ keyword (BM25) + semantic (cosine) → hybrid ranking
|
|
177
|
+
├── KnowledgeGraph ─ user --prefers--> C++
|
|
178
|
+
├── EmbeddingProvider ─ hashing (default) · sentence-transformers · Ollama · OpenAI · custom
|
|
179
|
+
├── LLMProvider ─ none (default) · Ollama · OpenAI · custom
|
|
180
|
+
└── StorageBackend ─ SQLiteStorage (default, WAL, migrations) · your own
|
|
181
|
+
```
|
|
182
|
+
|
|
183
|
+
Details: [docs/concepts/architecture.md](docs/concepts/architecture.md).
|
|
184
|
+
|
|
185
|
+
## How it works
|
|
186
|
+
|
|
187
|
+
**Memories** have a type (`fact`, `preference`, `event`, `goal`, `relationship`,
|
|
188
|
+
`knowledge`, `conversation`, `decision`, or any lower-case identifier you choose),
|
|
189
|
+
importance, confidence, source, metadata, optional expiry, a version and a status:
|
|
190
|
+
`active` (current belief), `superseded` (replaced by newer information),
|
|
191
|
+
`merged` (folded into a duplicate), or `archived` (forgotten, restorable).
|
|
192
|
+
|
|
193
|
+
**Deduplication**: identical content (ignoring case/punctuation) and near-duplicates
|
|
194
|
+
(canonical token overlap, e.g. "User likes Python" ≈ "User prefers Python") reinforce
|
|
195
|
+
the existing memory. Statements with opposite polarity are never merged.
|
|
196
|
+
|
|
197
|
+
**Conflicts**: statements that fill the same *slot* with different values
|
|
198
|
+
("I prefer Java" → "I prefer Python", "I live in Paris" → "I live in Berlin") are
|
|
199
|
+
detected. Under the default `supersede` policy the newer statement becomes current
|
|
200
|
+
only if it is at least as confident; the older one is kept with status `superseded`
|
|
201
|
+
and a conflict record explains why. Otherwise both stay active and the conflict is
|
|
202
|
+
left open for you to resolve. HighHXPack never guesses which statement is true.
|
|
203
|
+
|
|
204
|
+
**Ranking** (all constants in `ScoringConfig`):
|
|
205
|
+
|
|
206
|
+
```text
|
|
207
|
+
relevance = weighted mean of keyword (BM25, normalized) and semantic (cosine) scores
|
|
208
|
+
final = relevance × (0.60 + 0.15·importance + 0.10·recency + 0.10·confidence + 0.05·frequency)
|
|
209
|
+
```
|
|
210
|
+
|
|
211
|
+
A memory that does not match the query scores 0 however important it is. See
|
|
212
|
+
[docs/concepts/retrieval.md](docs/concepts/retrieval.md).
|
|
213
|
+
|
|
214
|
+
## Storage behavior
|
|
215
|
+
|
|
216
|
+
- One SQLite file, by default in the platform data directory
|
|
217
|
+
(`~/.local/share/highhxpack/memory.db`, `~/Library/Application Support/highhxpack/`
|
|
218
|
+
on macOS, `%LOCALAPPDATA%\highhxpack\` on Windows), or `Memory("path/to/file.db")`.
|
|
219
|
+
- WAL mode, explicit transactions, versioned migrations, indexes, and a clean
|
|
220
|
+
checkpoint on close. Safe for several threads and several processes.
|
|
221
|
+
- The database directory is created with mode `0700` and the file `0600` (POSIX).
|
|
222
|
+
- `Memory(":memory:")` gives a throw-away in-memory store.
|
|
223
|
+
|
|
224
|
+
## Embeddings and LLM providers
|
|
225
|
+
|
|
226
|
+
Embeddings and LLMs are **optional**.
|
|
227
|
+
|
|
228
|
+
| Setting | Default | Options |
|
|
229
|
+
|---|---|---|
|
|
230
|
+
| `embedding_provider` | `hashing` (local, lexical, no downloads) | `none`, `sentence-transformers`, `ollama`, `openai` |
|
|
231
|
+
| `llm_provider` | `none` | `ollama`, `openai` |
|
|
232
|
+
|
|
233
|
+
The default hashing embedding is deterministic and offline. It captures shared words,
|
|
234
|
+
stems and sub-word fragments, but not synonyms; for meaning-based search use
|
|
235
|
+
`sentence-transformers` or Ollama. LLMs are used only for `extractor = "llm"` and
|
|
236
|
+
LLM-written summaries. Custom providers:
|
|
237
|
+
|
|
238
|
+
```python
|
|
239
|
+
from highhxpack import CallableEmbedding, CallableProvider, Memory
|
|
240
|
+
|
|
241
|
+
memory = Memory(
|
|
242
|
+
embedder=CallableEmbedding(my_embed_fn, name="my-model-v1"), # fn(list[str]) -> vectors
|
|
243
|
+
llm=CallableProvider(my_complete_fn), # fn(prompt) -> str
|
|
244
|
+
)
|
|
245
|
+
```
|
|
246
|
+
|
|
247
|
+
Missing optional packages produce an error that says exactly what to install.
|
|
248
|
+
|
|
249
|
+
## Configuration
|
|
250
|
+
|
|
251
|
+
Precedence (lowest → highest): built-in defaults → config file
|
|
252
|
+
(`<home>/config.toml` or `$HIGHHXPACK_CONFIG`) → `HIGHHXPACK_*` environment variables →
|
|
253
|
+
explicit Python arguments / CLI options. `highhxpack config` prints the result.
|
|
254
|
+
API keys are **never** read from the config file; set `OPENAI_API_KEY` instead.
|
|
255
|
+
See [docs/concepts/configuration.md](docs/concepts/configuration.md).
|
|
256
|
+
|
|
257
|
+
## Privacy and security
|
|
258
|
+
|
|
259
|
+
- All data stays on your machine unless you configure `ollama` on a remote host or
|
|
260
|
+
`openai`; only then is the text being embedded/processed sent to that endpoint.
|
|
261
|
+
- Secrets are never logged or printed; the config file cannot contain API keys.
|
|
262
|
+
- Input is validated; control characters are stripped; SQL uses bound parameters.
|
|
263
|
+
- Imports accept only HighHXPack's JSON format (never pickle), validate every record,
|
|
264
|
+
and enforce a size limit. Exports are written atomically with mode `0600`.
|
|
265
|
+
- `delete()`/`clear()` permanently erase memories including their history.
|
|
266
|
+
|
|
267
|
+
See [SECURITY.md](SECURITY.md) and [docs/concepts/privacy.md](docs/concepts/privacy.md).
|
|
268
|
+
|
|
269
|
+
## Examples
|
|
270
|
+
|
|
271
|
+
- [examples/basic.py](examples/basic.py) — store, recall, update, forget
|
|
272
|
+
- [examples/chatbot.py](examples/chatbot.py) — memory loop for a chatbot
|
|
273
|
+
- [examples/agent_memory.py](examples/agent_memory.py) — metadata, TTL, graph, consolidation, export
|
|
274
|
+
- [examples/local_llm.py](examples/local_llm.py) — Ollama extraction and summaries
|
|
275
|
+
|
|
276
|
+
## Development
|
|
277
|
+
|
|
278
|
+
```bash
|
|
279
|
+
git clone https://github.com/highhxpack/highhxpack
|
|
280
|
+
cd highhxpack
|
|
281
|
+
uv sync # or: python -m venv .venv && pip install -e . --group dev
|
|
282
|
+
uv run pytest --cov # unit + integration tests, 90% coverage floor
|
|
283
|
+
uv run ruff check . && uv run ruff format --check . && uv run mypy
|
|
284
|
+
uv run python benchmarks/benchmark_retrieval.py
|
|
285
|
+
```
|
|
286
|
+
|
|
287
|
+
Benchmarks print measurements for your hardware; no numbers are claimed here.
|
|
288
|
+
|
|
289
|
+
## Contributing
|
|
290
|
+
|
|
291
|
+
Contributions are welcome — see [CONTRIBUTING.md](CONTRIBUTING.md) and the
|
|
292
|
+
[Code of Conduct](CODE_OF_CONDUCT.md). Report security issues privately as described
|
|
293
|
+
in [SECURITY.md](SECURITY.md).
|
|
294
|
+
|
|
295
|
+
## License
|
|
296
|
+
|
|
297
|
+
[MIT](LICENSE)
|