hermes-okf 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.
- hermes_okf-0.1.0/.github/workflows/ci.yml +65 -0
- hermes_okf-0.1.0/.gitignore +148 -0
- hermes_okf-0.1.0/.pre-commit-config.yaml +18 -0
- hermes_okf-0.1.0/CHANGELOG.md +22 -0
- hermes_okf-0.1.0/CONTRIBUTING.md +64 -0
- hermes_okf-0.1.0/LICENSE +21 -0
- hermes_okf-0.1.0/PKG-INFO +335 -0
- hermes_okf-0.1.0/README.md +262 -0
- hermes_okf-0.1.0/docs/ARCHITECTURE.md +60 -0
- hermes_okf-0.1.0/examples/basic_usage.py +31 -0
- hermes_okf-0.1.0/examples/hermes_integration.py +36 -0
- hermes_okf-0.1.0/examples/rag_integration.py +43 -0
- hermes_okf-0.1.0/pyproject.toml +98 -0
- hermes_okf-0.1.0/src/hermes_okf/__init__.py +23 -0
- hermes_okf-0.1.0/src/hermes_okf/agent.py +177 -0
- hermes_okf-0.1.0/src/hermes_okf/bundle.py +223 -0
- hermes_okf-0.1.0/src/hermes_okf/cli.py +194 -0
- hermes_okf-0.1.0/src/hermes_okf/concept.py +35 -0
- hermes_okf-0.1.0/src/hermes_okf/graph.py +148 -0
- hermes_okf-0.1.0/src/hermes_okf/memory.py +174 -0
- hermes_okf-0.1.0/src/hermes_okf/search.py +137 -0
- hermes_okf-0.1.0/src/hermes_okf/validators.py +141 -0
- hermes_okf-0.1.0/tests/__init__.py +0 -0
- hermes_okf-0.1.0/tests/test_agent.py +63 -0
- hermes_okf-0.1.0/tests/test_bundle.py +122 -0
- hermes_okf-0.1.0/tests/test_graph.py +55 -0
- hermes_okf-0.1.0/tests/test_memory.py +62 -0
- hermes_okf-0.1.0/tests/test_search.py +50 -0
- hermes_okf-0.1.0/tests/test_validators.py +44 -0
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
name: CI
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches: [main]
|
|
6
|
+
pull_request:
|
|
7
|
+
branches: [main]
|
|
8
|
+
|
|
9
|
+
jobs:
|
|
10
|
+
test:
|
|
11
|
+
runs-on: ubuntu-latest
|
|
12
|
+
strategy:
|
|
13
|
+
matrix:
|
|
14
|
+
python-version: ["3.9", "3.10", "3.11", "3.12", "3.13"]
|
|
15
|
+
|
|
16
|
+
steps:
|
|
17
|
+
- uses: actions/checkout@v4
|
|
18
|
+
|
|
19
|
+
- name: Set up Python ${{ matrix.python-version }}
|
|
20
|
+
uses: actions/setup-python@v5
|
|
21
|
+
with:
|
|
22
|
+
python-version: ${{ matrix.python-version }}
|
|
23
|
+
|
|
24
|
+
- name: Install dependencies
|
|
25
|
+
run: |
|
|
26
|
+
python -m pip install --upgrade pip
|
|
27
|
+
pip install -e ".[dev]"
|
|
28
|
+
|
|
29
|
+
- name: Lint with ruff
|
|
30
|
+
run: ruff check src tests
|
|
31
|
+
|
|
32
|
+
- name: Format check with black
|
|
33
|
+
run: black --check src tests
|
|
34
|
+
|
|
35
|
+
- name: Type check with mypy
|
|
36
|
+
run: mypy src
|
|
37
|
+
|
|
38
|
+
- name: Test with pytest
|
|
39
|
+
run: pytest --cov=hermes_okf --cov-report=xml
|
|
40
|
+
|
|
41
|
+
- name: Upload coverage
|
|
42
|
+
uses: codecov/codecov-action@v4
|
|
43
|
+
if: matrix.python-version == '3.12'
|
|
44
|
+
with:
|
|
45
|
+
files: ./coverage.xml
|
|
46
|
+
fail_ci_if_error: false
|
|
47
|
+
|
|
48
|
+
validate-okf:
|
|
49
|
+
runs-on: ubuntu-latest
|
|
50
|
+
steps:
|
|
51
|
+
- uses: actions/checkout@v4
|
|
52
|
+
- uses: actions/setup-python@v5
|
|
53
|
+
with:
|
|
54
|
+
python-version: '3.12'
|
|
55
|
+
- run: pip install -e ".[dev]"
|
|
56
|
+
- name: Validate example bundle
|
|
57
|
+
run: |
|
|
58
|
+
python -c "
|
|
59
|
+
from hermes_okf.bundle import OKFBundle
|
|
60
|
+
from hermes_okf.validators import OKFValidator
|
|
61
|
+
bundle = OKFBundle('examples/example_bundle')
|
|
62
|
+
validator = OKFValidator(bundle)
|
|
63
|
+
assert validator.is_valid(), 'Example bundle failed validation'
|
|
64
|
+
print('OKF bundle is valid')
|
|
65
|
+
"
|
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
# Byte-compiled / optimized / DLL files
|
|
2
|
+
__pycache__/
|
|
3
|
+
*.py[cod]
|
|
4
|
+
*$py.class
|
|
5
|
+
|
|
6
|
+
# C extensions
|
|
7
|
+
*.so
|
|
8
|
+
|
|
9
|
+
# Distribution / packaging
|
|
10
|
+
.Python
|
|
11
|
+
build/
|
|
12
|
+
develop-eggs/
|
|
13
|
+
dist/
|
|
14
|
+
downloads/
|
|
15
|
+
eggs/
|
|
16
|
+
.eggs/
|
|
17
|
+
lib/
|
|
18
|
+
lib64/
|
|
19
|
+
parts/
|
|
20
|
+
sdist/
|
|
21
|
+
var/
|
|
22
|
+
wheels/
|
|
23
|
+
share/python-wheels/
|
|
24
|
+
*.egg-info/
|
|
25
|
+
.installed.cfg
|
|
26
|
+
*.egg
|
|
27
|
+
MANIFEST
|
|
28
|
+
|
|
29
|
+
# PyInstaller
|
|
30
|
+
*.manifest
|
|
31
|
+
*.spec
|
|
32
|
+
|
|
33
|
+
# Installer logs
|
|
34
|
+
pip-log.txt
|
|
35
|
+
pip-delete-this-directory.txt
|
|
36
|
+
|
|
37
|
+
# Unit test / coverage reports
|
|
38
|
+
htmlcov/
|
|
39
|
+
.tox/
|
|
40
|
+
.nox/
|
|
41
|
+
.coverage
|
|
42
|
+
.coverage.*
|
|
43
|
+
.cache
|
|
44
|
+
nosetests.xml
|
|
45
|
+
coverage.xml
|
|
46
|
+
*.cover
|
|
47
|
+
*.py,cover
|
|
48
|
+
.hypothesis/
|
|
49
|
+
.pytest_cache/
|
|
50
|
+
cover/
|
|
51
|
+
|
|
52
|
+
# Translations
|
|
53
|
+
*.mo
|
|
54
|
+
*.pot
|
|
55
|
+
|
|
56
|
+
# Django stuff:
|
|
57
|
+
*.log
|
|
58
|
+
local_settings.py
|
|
59
|
+
db.sqlite3
|
|
60
|
+
db.sqlite3-journal
|
|
61
|
+
|
|
62
|
+
# Flask stuff:
|
|
63
|
+
instance/
|
|
64
|
+
.webassets-cache
|
|
65
|
+
|
|
66
|
+
# Scrapy stuff:
|
|
67
|
+
.scrapy
|
|
68
|
+
|
|
69
|
+
# Sphinx documentation
|
|
70
|
+
docs/_build/
|
|
71
|
+
|
|
72
|
+
# PyBuilder
|
|
73
|
+
.pybuilder/
|
|
74
|
+
target/
|
|
75
|
+
|
|
76
|
+
# Jupyter Notebook
|
|
77
|
+
.ipynb_checkpoints
|
|
78
|
+
|
|
79
|
+
# IPython
|
|
80
|
+
profile_default/
|
|
81
|
+
ipython_config.py
|
|
82
|
+
|
|
83
|
+
# pyenv
|
|
84
|
+
.python-version
|
|
85
|
+
|
|
86
|
+
# pipenv
|
|
87
|
+
Pipfile.lock
|
|
88
|
+
|
|
89
|
+
# poetry
|
|
90
|
+
poetry.lock
|
|
91
|
+
|
|
92
|
+
# pdm
|
|
93
|
+
.pdm.toml
|
|
94
|
+
|
|
95
|
+
# PEP 582
|
|
96
|
+
__pypackages__/
|
|
97
|
+
|
|
98
|
+
# Celery stuff
|
|
99
|
+
celerybeat-schedule
|
|
100
|
+
celerybeat.pid
|
|
101
|
+
|
|
102
|
+
# SageMath parsed files
|
|
103
|
+
*.sage.py
|
|
104
|
+
|
|
105
|
+
# Environments
|
|
106
|
+
.env
|
|
107
|
+
.venv
|
|
108
|
+
env/
|
|
109
|
+
venv/
|
|
110
|
+
ENV/
|
|
111
|
+
env.bak/
|
|
112
|
+
venv.bak/
|
|
113
|
+
|
|
114
|
+
# Spyder project settings
|
|
115
|
+
.spyderproject
|
|
116
|
+
.spyproject
|
|
117
|
+
|
|
118
|
+
# Rope project settings
|
|
119
|
+
.ropeproject
|
|
120
|
+
|
|
121
|
+
# mkdocs documentation
|
|
122
|
+
/site
|
|
123
|
+
|
|
124
|
+
# mypy
|
|
125
|
+
.mypy_cache/
|
|
126
|
+
.dmypy.json
|
|
127
|
+
dmypy.json
|
|
128
|
+
|
|
129
|
+
# Pyre type checker
|
|
130
|
+
.pyre/
|
|
131
|
+
|
|
132
|
+
# pytype static type analyzer
|
|
133
|
+
.pytype/
|
|
134
|
+
|
|
135
|
+
# Cython debug symbols
|
|
136
|
+
cython_debug/
|
|
137
|
+
|
|
138
|
+
# PyCharm
|
|
139
|
+
.idea/
|
|
140
|
+
|
|
141
|
+
# VS Code
|
|
142
|
+
.vscode/
|
|
143
|
+
|
|
144
|
+
# Local knowledge bundles
|
|
145
|
+
*.okf/
|
|
146
|
+
|
|
147
|
+
# Hermes local state
|
|
148
|
+
.hermes_state/
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
repos:
|
|
2
|
+
- repo: https://github.com/psf/black
|
|
3
|
+
rev: 24.4.2
|
|
4
|
+
hooks:
|
|
5
|
+
- id: black
|
|
6
|
+
language_version: python3
|
|
7
|
+
|
|
8
|
+
- repo: https://github.com/astral-sh/ruff-pre-commit
|
|
9
|
+
rev: v0.4.7
|
|
10
|
+
hooks:
|
|
11
|
+
- id: ruff
|
|
12
|
+
args: [--fix, --exit-non-zero-on-fix]
|
|
13
|
+
|
|
14
|
+
- repo: https://github.com/pre-commit/mirrors-mypy
|
|
15
|
+
rev: v1.10.0
|
|
16
|
+
hooks:
|
|
17
|
+
- id: mypy
|
|
18
|
+
additional_dependencies: [types-PyYAML]
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
All notable changes to this project will be documented in this file.
|
|
4
|
+
|
|
5
|
+
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
|
|
6
|
+
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
|
+
|
|
8
|
+
## [0.1.0] - 2026-06-15
|
|
9
|
+
|
|
10
|
+
### Added
|
|
11
|
+
- Initial release of `hermes-okf`
|
|
12
|
+
- `OKFBundle` — core bundle manager with read/write, logging, graph edge extraction
|
|
13
|
+
- `Concept` — dataclass for OKF concepts
|
|
14
|
+
- `GraphExtractor` — link traversal, directory hierarchy, tag clustering, BFS traversal, NetworkX export
|
|
15
|
+
- `SearchIndex` — inverted-index full-text search, fuzzy search, custom predicate filtering
|
|
16
|
+
- `OKFValidator` — OKF v0.1 conformance validation
|
|
17
|
+
- `HermesMemory` — agent memory layer: sessions, decisions, observations, tool calls, context recall
|
|
18
|
+
- `HermesMemoryMixin` — drop-in decorators for agent classes
|
|
19
|
+
- CLI (`hermes-okf`) — init, validate, show, search, log, graph commands
|
|
20
|
+
- RAG integration example (LangChain + ChromaDB)
|
|
21
|
+
- Full test suite with pytest
|
|
22
|
+
- GitHub Actions CI for Python 3.10–3.13
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
# Contributing
|
|
2
|
+
|
|
3
|
+
Thank you for your interest in contributing to Hermes OKF! This is an early-stage
|
|
4
|
+
open-source project and every contribution helps shape the future of agent memory
|
|
5
|
+
systems.
|
|
6
|
+
|
|
7
|
+
## Getting Started
|
|
8
|
+
|
|
9
|
+
1. Fork the repository
|
|
10
|
+
2. Clone your fork: `git clone https://github.com/YOUR_USERNAME/hermes-okf.git`
|
|
11
|
+
3. Install in development mode: `pip install -e ".[dev]"`
|
|
12
|
+
4. Run tests: `pytest`
|
|
13
|
+
|
|
14
|
+
## Development Workflow
|
|
15
|
+
|
|
16
|
+
- **Main branch**: `main` — always deployable
|
|
17
|
+
- **Feature branches**: `feature/your-feature-name`
|
|
18
|
+
- **Bug fixes**: `fix/issue-description`
|
|
19
|
+
|
|
20
|
+
## Code Quality
|
|
21
|
+
|
|
22
|
+
We use the following tools (all run in CI):
|
|
23
|
+
|
|
24
|
+
- **black** — code formatting (`black src tests`)
|
|
25
|
+
- **ruff** — linting (`ruff check src tests`)
|
|
26
|
+
- **mypy** — static type checking (`mypy src`)
|
|
27
|
+
- **pytest** — unit tests (`pytest`)
|
|
28
|
+
|
|
29
|
+
Pre-commit hooks are encouraged:
|
|
30
|
+
|
|
31
|
+
```bash
|
|
32
|
+
pip install pre-commit
|
|
33
|
+
pre-commit install
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
## Writing Tests
|
|
37
|
+
|
|
38
|
+
- Add tests to the `tests/` directory
|
|
39
|
+
- Name files `test_<module>.py`
|
|
40
|
+
- Use `pytest` fixtures and `tempfile.TemporaryDirectory` for filesystem tests
|
|
41
|
+
- Aim for >80% coverage on new code
|
|
42
|
+
|
|
43
|
+
## Documentation
|
|
44
|
+
|
|
45
|
+
- Update `README.md` for user-facing changes
|
|
46
|
+
- Update `docs/ARCHITECTURE.md` for design changes
|
|
47
|
+
- Add examples to `examples/` for new features
|
|
48
|
+
|
|
49
|
+
## Submitting a PR
|
|
50
|
+
|
|
51
|
+
1. Ensure all tests pass: `pytest`
|
|
52
|
+
2. Ensure linting passes: `ruff check src tests && black --check src tests`
|
|
53
|
+
3. Write a clear PR description explaining the *why* and *what*
|
|
54
|
+
4. Link any related issues
|
|
55
|
+
|
|
56
|
+
## Community
|
|
57
|
+
|
|
58
|
+
- Open an issue for bugs, feature requests, or questions
|
|
59
|
+
- Start a discussion for architectural proposals
|
|
60
|
+
- Be respectful and constructive
|
|
61
|
+
|
|
62
|
+
## License
|
|
63
|
+
|
|
64
|
+
By contributing, you agree that your contributions will be licensed under the MIT License.
|
hermes_okf-0.1.0/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 EliaszDev
|
|
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,335 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: hermes-okf
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Universal OKF-based memory system for Hermes agent — structured, persistent, agent-readable knowledge storage.
|
|
5
|
+
Project-URL: Homepage, https://github.com/EliaszDev/hermes-okf
|
|
6
|
+
Project-URL: Documentation, https://github.com/EliaszDev/hermes-okf#readme
|
|
7
|
+
Project-URL: Repository, https://github.com/EliaszDev/hermes-okf
|
|
8
|
+
Project-URL: Issues, https://github.com/EliaszDev/hermes-okf/issues
|
|
9
|
+
Project-URL: Changelog, https://github.com/EliaszDev/hermes-okf/blob/main/CHANGELOG.md
|
|
10
|
+
Author-email: EliaszDev <eliasz@example.com>
|
|
11
|
+
License: MIT License
|
|
12
|
+
|
|
13
|
+
Copyright (c) 2026 EliaszDev
|
|
14
|
+
|
|
15
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
16
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
17
|
+
in the Software without restriction, including without limitation the rights
|
|
18
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
19
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
20
|
+
furnished to do so, subject to the following conditions:
|
|
21
|
+
|
|
22
|
+
The above copyright notice and this permission notice shall be included in all
|
|
23
|
+
copies or substantial portions of the Software.
|
|
24
|
+
|
|
25
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
26
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
27
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
28
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
29
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
30
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
31
|
+
SOFTWARE.
|
|
32
|
+
License-File: LICENSE
|
|
33
|
+
Keywords: agent-memory,ai-agent,hermes,knowledge-graph,knowledge-management,markdown,memory-system,okf,open-knowledge-format
|
|
34
|
+
Classifier: Development Status :: 3 - Alpha
|
|
35
|
+
Classifier: Intended Audience :: Developers
|
|
36
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
37
|
+
Classifier: Operating System :: OS Independent
|
|
38
|
+
Classifier: Programming Language :: Python :: 3
|
|
39
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
40
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
41
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
42
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
43
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
44
|
+
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
|
|
45
|
+
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
46
|
+
Classifier: Topic :: Text Processing :: Markup
|
|
47
|
+
Requires-Python: >=3.9
|
|
48
|
+
Requires-Dist: pyyaml>=6.0
|
|
49
|
+
Provides-Extra: all
|
|
50
|
+
Requires-Dist: black>=24.0; extra == 'all'
|
|
51
|
+
Requires-Dist: langchain-chroma>=0.1.0; extra == 'all'
|
|
52
|
+
Requires-Dist: langchain-community>=0.2.0; extra == 'all'
|
|
53
|
+
Requires-Dist: langchain-openai>=0.1.0; extra == 'all'
|
|
54
|
+
Requires-Dist: langchain>=0.2.0; extra == 'all'
|
|
55
|
+
Requires-Dist: mypy>=1.9; extra == 'all'
|
|
56
|
+
Requires-Dist: pre-commit>=3.7; extra == 'all'
|
|
57
|
+
Requires-Dist: pytest-cov>=4.0; extra == 'all'
|
|
58
|
+
Requires-Dist: pytest>=8.0; extra == 'all'
|
|
59
|
+
Requires-Dist: ruff>=0.4.0; extra == 'all'
|
|
60
|
+
Provides-Extra: dev
|
|
61
|
+
Requires-Dist: black>=24.0; extra == 'dev'
|
|
62
|
+
Requires-Dist: mypy>=1.9; extra == 'dev'
|
|
63
|
+
Requires-Dist: pre-commit>=3.7; extra == 'dev'
|
|
64
|
+
Requires-Dist: pytest-cov>=4.0; extra == 'dev'
|
|
65
|
+
Requires-Dist: pytest>=8.0; extra == 'dev'
|
|
66
|
+
Requires-Dist: ruff>=0.4.0; extra == 'dev'
|
|
67
|
+
Provides-Extra: rag
|
|
68
|
+
Requires-Dist: langchain-chroma>=0.1.0; extra == 'rag'
|
|
69
|
+
Requires-Dist: langchain-community>=0.2.0; extra == 'rag'
|
|
70
|
+
Requires-Dist: langchain-openai>=0.1.0; extra == 'rag'
|
|
71
|
+
Requires-Dist: langchain>=0.2.0; extra == 'rag'
|
|
72
|
+
Description-Content-Type: text/markdown
|
|
73
|
+
|
|
74
|
+
# Hermes OKF — Universal Memory for AI Agents
|
|
75
|
+
|
|
76
|
+
[](https://github.com/EliaszDev/hermes-okf/actions)
|
|
77
|
+
[](https://www.python.org/)
|
|
78
|
+
[](https://opensource.org/licenses/MIT)
|
|
79
|
+
[](https://cloud.google.com/knowledge-catalog)
|
|
80
|
+
|
|
81
|
+
> **The first open-source memory system built on Google's Open Knowledge Format (OKF) for the Hermes agent ecosystem.**
|
|
82
|
+
|
|
83
|
+
Hermes OKF gives your AI agent a **persistent, structured, version-controlled memory** — no database, no lock-in, just markdown + YAML on your filesystem. Every decision, observation, and project context lives in a human-readable knowledge graph that your agent can read, write, and traverse programmatically.
|
|
84
|
+
|
|
85
|
+
---
|
|
86
|
+
|
|
87
|
+
## Why Hermes OKF?
|
|
88
|
+
|
|
89
|
+
| Feature | What You Get |
|
|
90
|
+
|---------|-------------|
|
|
91
|
+
| 🧠 **Agent Memory** | Persistent decisions, observations, and tool-call history across sessions |
|
|
92
|
+
| 🔗 **Knowledge Graph** | Implicit graph from markdown links — no RDF, no Cypher |
|
|
93
|
+
| 📁 **Filesystem-First** | Plain `.md` + YAML. `cat` it, `grep` it, Git it. |
|
|
94
|
+
| ⚡ **Zero-DB Core** | Single dependency: `pyyaml`. Optional RAG via LangChain/ChromaDB. |
|
|
95
|
+
| 🎁 **Hermes-Ready** | Drop-in decorators: `@memorize_decision`, `@memorize_tool` |
|
|
96
|
+
| 📦 **Portable** | Clone a bundle to another machine — the agent resumes instantly. |
|
|
97
|
+
|
|
98
|
+
---
|
|
99
|
+
|
|
100
|
+
## Quick Start
|
|
101
|
+
|
|
102
|
+
```bash
|
|
103
|
+
pip install hermes-okf
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
```python
|
|
107
|
+
from hermes_okf.bundle import OKFBundle
|
|
108
|
+
|
|
109
|
+
# Create a knowledge bundle
|
|
110
|
+
bundle = OKFBundle("./my_knowledge")
|
|
111
|
+
|
|
112
|
+
# Store a project concept
|
|
113
|
+
bundle.write_concept(
|
|
114
|
+
"projects/my_project",
|
|
115
|
+
body="# My Project\n\nDescribe your project here.",
|
|
116
|
+
type="Project",
|
|
117
|
+
title="My Project",
|
|
118
|
+
tags=["ml", "data", "gpu"],
|
|
119
|
+
resource="https://github.com/YOUR_USERNAME/my-project",
|
|
120
|
+
)
|
|
121
|
+
|
|
122
|
+
# Log a decision
|
|
123
|
+
bundle.append_log("Switched from TensorFlow to PyTorch for better ecosystem support", category="Decision")
|
|
124
|
+
|
|
125
|
+
# Search by tag
|
|
126
|
+
for concept in bundle.search_by_tag("gpu"):
|
|
127
|
+
print(concept.title)
|
|
128
|
+
|
|
129
|
+
# Inspect the graph
|
|
130
|
+
for edge in bundle.get_graph_edges():
|
|
131
|
+
print(f"{edge['source']} -> {edge['target']}")
|
|
132
|
+
```
|
|
133
|
+
|
|
134
|
+
---
|
|
135
|
+
|
|
136
|
+
## Agent Integration (Memory Mixin)
|
|
137
|
+
|
|
138
|
+
```python
|
|
139
|
+
from hermes_okf.agent import HermesMemoryMixin
|
|
140
|
+
|
|
141
|
+
class MyAgent(HermesMemoryMixin):
|
|
142
|
+
def __init__(self):
|
|
143
|
+
super().__init__("./agent_knowledge", agent_id="my-agent-v1")
|
|
144
|
+
self.start_session()
|
|
145
|
+
|
|
146
|
+
@HermesMemoryMixin.memorize_decision
|
|
147
|
+
def choose_model(self, task: str) -> str:
|
|
148
|
+
if "code" in task.lower():
|
|
149
|
+
return "anthropic/claude-3.5-sonnet"
|
|
150
|
+
return "openai/gpt-4o"
|
|
151
|
+
|
|
152
|
+
@HermesMemoryMixin.memorize_tool
|
|
153
|
+
def scrape_data(self, url: str) -> dict:
|
|
154
|
+
return {"url": url, "items": 42}
|
|
155
|
+
|
|
156
|
+
# Run it
|
|
157
|
+
agent = MyAgent()
|
|
158
|
+
agent.choose_model("Write a Python script")
|
|
159
|
+
agent.scrape_data("https://example.com")
|
|
160
|
+
|
|
161
|
+
# Recall relevant context
|
|
162
|
+
context = agent.with_context("python script", top_k=3)
|
|
163
|
+
```
|
|
164
|
+
|
|
165
|
+
---
|
|
166
|
+
|
|
167
|
+
## CLI
|
|
168
|
+
|
|
169
|
+
```bash
|
|
170
|
+
# Initialise a new OKF bundle
|
|
171
|
+
hermes-okf init ./knowledge
|
|
172
|
+
|
|
173
|
+
# Validate conformance
|
|
174
|
+
hermes-okf validate --path ./knowledge
|
|
175
|
+
|
|
176
|
+
# List concepts
|
|
177
|
+
hermes-okf list --path ./knowledge
|
|
178
|
+
|
|
179
|
+
# Show a concept
|
|
180
|
+
hermes-okf show --path ./knowledge projects/my_project
|
|
181
|
+
|
|
182
|
+
# Search
|
|
183
|
+
hermes-okf search --path ./knowledge "ffmpeg GPU"
|
|
184
|
+
|
|
185
|
+
# View log
|
|
186
|
+
hermes-okf log --path ./knowledge
|
|
187
|
+
|
|
188
|
+
# Append to log
|
|
189
|
+
hermes-okf log-append --path ./knowledge "New decision made" --category Decision
|
|
190
|
+
|
|
191
|
+
# Graph inspection
|
|
192
|
+
hermes-okf graph-edges --path ./knowledge
|
|
193
|
+
hermes-okf graph-neighbors --path ./knowledge projects/my_project
|
|
194
|
+
```
|
|
195
|
+
|
|
196
|
+
---
|
|
197
|
+
|
|
198
|
+
## RAG Integration (Optional)
|
|
199
|
+
|
|
200
|
+
```bash
|
|
201
|
+
pip install hermes-okf[rag]
|
|
202
|
+
```
|
|
203
|
+
|
|
204
|
+
Feed your OKF bundle into LangChain + ChromaDB for vector retrieval:
|
|
205
|
+
|
|
206
|
+
```python
|
|
207
|
+
from langchain_community.document_loaders import DirectoryLoader, TextLoader
|
|
208
|
+
from langchain.text_splitter import MarkdownHeaderTextSplitter
|
|
209
|
+
from langchain_chroma import Chroma
|
|
210
|
+
from langchain_openai import OpenAIEmbeddings
|
|
211
|
+
|
|
212
|
+
from hermes_okf.bundle import OKFBundle
|
|
213
|
+
|
|
214
|
+
bundle = OKFBundle("./my_knowledge")
|
|
215
|
+
loader = DirectoryLoader(
|
|
216
|
+
str(bundle.root),
|
|
217
|
+
glob="**/*.md",
|
|
218
|
+
loader_cls=TextLoader,
|
|
219
|
+
loader_kwargs={"encoding": "utf-8"},
|
|
220
|
+
)
|
|
221
|
+
docs = loader.load()
|
|
222
|
+
|
|
223
|
+
splitter = MarkdownHeaderTextSplitter(
|
|
224
|
+
headers_to_split_on=[("#", "Header 1"), ("##", "Header 2")]
|
|
225
|
+
)
|
|
226
|
+
splits = [chunk for doc in docs for chunk in splitter.split_text(doc.page_content)]
|
|
227
|
+
|
|
228
|
+
vectorstore = Chroma.from_documents(
|
|
229
|
+
documents=splits,
|
|
230
|
+
embedding=OpenAIEmbeddings(),
|
|
231
|
+
persist_directory="./chroma_okf_db",
|
|
232
|
+
)
|
|
233
|
+
|
|
234
|
+
# Query
|
|
235
|
+
retriever = vectorstore.as_retriever(search_kwargs={"k": 5})
|
|
236
|
+
results = retriever.invoke("What GPU decisions did we make?")
|
|
237
|
+
```
|
|
238
|
+
|
|
239
|
+
See `examples/rag_integration.py` for a complete example.
|
|
240
|
+
|
|
241
|
+
---
|
|
242
|
+
|
|
243
|
+
## Architecture
|
|
244
|
+
|
|
245
|
+
```
|
|
246
|
+
┌─────────────────────────────────────┐
|
|
247
|
+
│ CLI (hermes-okf) │
|
|
248
|
+
├─────────────────────────────────────┤
|
|
249
|
+
│ HermesMemory / MemoryMixin │ ← Agent integration
|
|
250
|
+
├─────────────────────────────────────┤
|
|
251
|
+
│ OKFBundle │ ← Core read/write API
|
|
252
|
+
│ ├── Concept (dataclass) │
|
|
253
|
+
│ ├── GraphExtractor │
|
|
254
|
+
│ ├── SearchIndex │
|
|
255
|
+
│ └── OKFValidator │
|
|
256
|
+
├─────────────────────────────────────┤
|
|
257
|
+
│ Filesystem (markdown + YAML) │ ← Persistent storage
|
|
258
|
+
└─────────────────────────────────────┘
|
|
259
|
+
```
|
|
260
|
+
|
|
261
|
+
Read the full architecture in [`docs/ARCHITECTURE.md`](docs/ARCHITECTURE.md).
|
|
262
|
+
|
|
263
|
+
---
|
|
264
|
+
|
|
265
|
+
## OKF Format
|
|
266
|
+
|
|
267
|
+
This library implements the **Google Open Knowledge Format (OKF) v0.1** spec:
|
|
268
|
+
|
|
269
|
+
- Every concept is a `.md` file with YAML frontmatter
|
|
270
|
+
- Frontmatter **must** include a `type` field
|
|
271
|
+
- Reserved files: `index.md` (directory), `log.md` (chronology)
|
|
272
|
+
- Markdown links create implicit directed edges
|
|
273
|
+
- Directory structure provides containment hierarchy
|
|
274
|
+
- Tags create cross-cutting clusters
|
|
275
|
+
|
|
276
|
+
> *"If you can `cat` a file, you can read OKF."*
|
|
277
|
+
|
|
278
|
+
---
|
|
279
|
+
|
|
280
|
+
## Project Structure
|
|
281
|
+
|
|
282
|
+
```
|
|
283
|
+
hermes-okf/
|
|
284
|
+
├── src/hermes_okf/ # Core library
|
|
285
|
+
│ ├── bundle.py # OKFBundle read/write
|
|
286
|
+
│ ├── concept.py # Concept dataclass
|
|
287
|
+
│ ├── graph.py # Graph extraction & traversal
|
|
288
|
+
│ ├── search.py # Full-text search & indexing
|
|
289
|
+
│ ├── validators.py # OKF conformance checking
|
|
290
|
+
│ ├── memory.py # Agent memory layer
|
|
291
|
+
│ ├── agent.py # Drop-in decorators
|
|
292
|
+
│ └── cli.py # CLI entry point
|
|
293
|
+
├── tests/ # pytest suite
|
|
294
|
+
├── examples/ # Usage examples
|
|
295
|
+
├── docs/ # Architecture docs
|
|
296
|
+
└── .github/workflows/ # CI/CD
|
|
297
|
+
```
|
|
298
|
+
|
|
299
|
+
---
|
|
300
|
+
|
|
301
|
+
## Development
|
|
302
|
+
|
|
303
|
+
```bash
|
|
304
|
+
git clone https://github.com/EliaszDev/hermes-okf.git
|
|
305
|
+
cd hermes-okf
|
|
306
|
+
pip install -e ".[dev]"
|
|
307
|
+
pytest
|
|
308
|
+
```
|
|
309
|
+
|
|
310
|
+
See [`CONTRIBUTING.md`](CONTRIBUTING.md) for full guidelines.
|
|
311
|
+
|
|
312
|
+
---
|
|
313
|
+
|
|
314
|
+
## Roadmap
|
|
315
|
+
|
|
316
|
+
- [ ] Async I/O support for high-throughput agents
|
|
317
|
+
- [ ] Multi-agent bundle merging and conflict resolution
|
|
318
|
+
- [ ] Git-backed history with automatic diff summaries
|
|
319
|
+
- [ ] Web viewer for knowledge graph exploration
|
|
320
|
+
- [ ] Plugin system for custom concept types and validators
|
|
321
|
+
- [ ] Integration with Hermes agent orchestration layer
|
|
322
|
+
|
|
323
|
+
---
|
|
324
|
+
|
|
325
|
+
## License
|
|
326
|
+
|
|
327
|
+
MIT — see [`LICENSE`](LICENSE).
|
|
328
|
+
|
|
329
|
+
---
|
|
330
|
+
|
|
331
|
+
## Acknowledgements
|
|
332
|
+
|
|
333
|
+
Built for the **Hermes agent ecosystem** and inspired by the Google Cloud Knowledge Catalog team's OKF draft specification. If you use Hermes or OKF, this library is designed to be your memory backbone.
|
|
334
|
+
|
|
335
|
+
**⭐ Star this repo if you're building agent memory systems — let's make Hermes the best agent framework out there.**
|