openaugi 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.
- openaugi-0.1.0/.github/ISSUE_TEMPLATE/bug_report.md +20 -0
- openaugi-0.1.0/.github/ISSUE_TEMPLATE/feature_request.md +11 -0
- openaugi-0.1.0/.github/pull_request_template.md +10 -0
- openaugi-0.1.0/.github/workflows/ci.yml +37 -0
- openaugi-0.1.0/.github/workflows/publish.yml +69 -0
- openaugi-0.1.0/.gitignore +191 -0
- openaugi-0.1.0/.pre-commit-config.yaml +30 -0
- openaugi-0.1.0/ARCHITECTURE.md +156 -0
- openaugi-0.1.0/CLAUDE.md +51 -0
- openaugi-0.1.0/CONTRIBUTING.md +44 -0
- openaugi-0.1.0/LICENSE +21 -0
- openaugi-0.1.0/PKG-INFO +150 -0
- openaugi-0.1.0/README.md +101 -0
- openaugi-0.1.0/docs/GETTING_STARTED.md +149 -0
- openaugi-0.1.0/docs/MCP_SERVER.md +219 -0
- openaugi-0.1.0/docs/plans/done/m0.md +495 -0
- openaugi-0.1.0/docs/plans/done/m1.md +64 -0
- openaugi-0.1.0/docs/plans/future-work.md +119 -0
- openaugi-0.1.0/docs/plans/overall-mvp.md +190 -0
- openaugi-0.1.0/docs/skills/save-thread/SKILL.md +56 -0
- openaugi-0.1.0/docs/vision/values.md +13 -0
- openaugi-0.1.0/pyproject.toml +89 -0
- openaugi-0.1.0/scripts/check.sh +18 -0
- openaugi-0.1.0/src/openaugi/__init__.py +5 -0
- openaugi-0.1.0/src/openaugi/_version.py +1 -0
- openaugi-0.1.0/src/openaugi/adapters/__init__.py +0 -0
- openaugi-0.1.0/src/openaugi/adapters/vault.py +487 -0
- openaugi-0.1.0/src/openaugi/auth/__init__.py +51 -0
- openaugi-0.1.0/src/openaugi/auth/cloudflare.py +321 -0
- openaugi-0.1.0/src/openaugi/cli/__init__.py +0 -0
- openaugi-0.1.0/src/openaugi/cli/main.py +760 -0
- openaugi-0.1.0/src/openaugi/config.py +130 -0
- openaugi-0.1.0/src/openaugi/mcp/__init__.py +0 -0
- openaugi-0.1.0/src/openaugi/mcp/doc_writer.py +244 -0
- openaugi-0.1.0/src/openaugi/mcp/server.py +939 -0
- openaugi-0.1.0/src/openaugi/mcp/stream_manager.py +343 -0
- openaugi-0.1.0/src/openaugi/model/__init__.py +6 -0
- openaugi-0.1.0/src/openaugi/model/block.py +86 -0
- openaugi-0.1.0/src/openaugi/model/link.py +39 -0
- openaugi-0.1.0/src/openaugi/model/protocols.py +51 -0
- openaugi-0.1.0/src/openaugi/models/__init__.py +58 -0
- openaugi-0.1.0/src/openaugi/models/embeddings/__init__.py +0 -0
- openaugi-0.1.0/src/openaugi/models/embeddings/openai.py +68 -0
- openaugi-0.1.0/src/openaugi/models/embeddings/sentence_transformer.py +78 -0
- openaugi-0.1.0/src/openaugi/models/llms/__init__.py +0 -0
- openaugi-0.1.0/src/openaugi/pipeline/__init__.py +0 -0
- openaugi-0.1.0/src/openaugi/pipeline/embed.py +88 -0
- openaugi-0.1.0/src/openaugi/pipeline/rerank.py +198 -0
- openaugi-0.1.0/src/openaugi/pipeline/runner.py +176 -0
- openaugi-0.1.0/src/openaugi/pipeline/watcher.py +213 -0
- openaugi-0.1.0/src/openaugi/store/__init__.py +0 -0
- openaugi-0.1.0/src/openaugi/store/sqlite.py +696 -0
- openaugi-0.1.0/tests/__init__.py +0 -0
- openaugi-0.1.0/tests/conftest.py +36 -0
- openaugi-0.1.0/tests/fixtures/vault/2024-01-15 Book Notes.md +12 -0
- openaugi-0.1.0/tests/fixtures/vault/Project Alpha.md +21 -0
- openaugi-0.1.0/tests/fixtures/vault/Team Meetings.md +19 -0
- openaugi-0.1.0/tests/fixtures/vault/daily-2024-03-15.md +19 -0
- openaugi-0.1.0/tests/fixtures/vault/empty-note.md +4 -0
- openaugi-0.1.0/tests/fixtures/vault/no-dates-no-h3.md +7 -0
- openaugi-0.1.0/tests/fixtures/vault/subdir/nested-note.md +5 -0
- openaugi-0.1.0/tests/test_block.py +60 -0
- openaugi-0.1.0/tests/test_incremental.py +233 -0
- openaugi-0.1.0/tests/test_link.py +24 -0
- openaugi-0.1.0/tests/test_mcp.py +416 -0
- openaugi-0.1.0/tests/test_pipeline.py +79 -0
- openaugi-0.1.0/tests/test_rerank.py +275 -0
- openaugi-0.1.0/tests/test_store.py +465 -0
- openaugi-0.1.0/tests/test_stream_manager.py +312 -0
- openaugi-0.1.0/tests/test_vault_adapter.py +307 -0
- openaugi-0.1.0/tests/test_watcher.py +144 -0
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: Bug Report
|
|
3
|
+
about: Report a bug
|
|
4
|
+
labels: bug
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
**What happened?**
|
|
8
|
+
|
|
9
|
+
**What did you expect?**
|
|
10
|
+
|
|
11
|
+
**Steps to reproduce:**
|
|
12
|
+
|
|
13
|
+
1.
|
|
14
|
+
2.
|
|
15
|
+
3.
|
|
16
|
+
|
|
17
|
+
**Environment:**
|
|
18
|
+
- OS:
|
|
19
|
+
- Python version:
|
|
20
|
+
- OpenAugi version:
|
|
@@ -0,0 +1,37 @@
|
|
|
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.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 venv .venv
|
|
27
|
+
.venv/bin/pip install --upgrade pip
|
|
28
|
+
.venv/bin/pip install -e ".[dev]"
|
|
29
|
+
|
|
30
|
+
- name: Lint with ruff
|
|
31
|
+
run: .venv/bin/ruff check src tests
|
|
32
|
+
|
|
33
|
+
- name: Type check with pyright
|
|
34
|
+
run: .venv/bin/pyright src
|
|
35
|
+
|
|
36
|
+
- name: Run tests
|
|
37
|
+
run: .venv/bin/pytest tests/ -v --tb=short
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
name: Publish to PyPI
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
tags:
|
|
6
|
+
- "v*.*.*"
|
|
7
|
+
|
|
8
|
+
jobs:
|
|
9
|
+
test:
|
|
10
|
+
name: Test before publish
|
|
11
|
+
runs-on: ubuntu-latest
|
|
12
|
+
strategy:
|
|
13
|
+
matrix:
|
|
14
|
+
python-version: ["3.12", "3.13"]
|
|
15
|
+
steps:
|
|
16
|
+
- uses: actions/checkout@v4
|
|
17
|
+
- name: Set up Python ${{ matrix.python-version }}
|
|
18
|
+
uses: actions/setup-python@v5
|
|
19
|
+
with:
|
|
20
|
+
python-version: ${{ matrix.python-version }}
|
|
21
|
+
- name: Install dependencies
|
|
22
|
+
run: |
|
|
23
|
+
python -m venv .venv
|
|
24
|
+
.venv/bin/pip install --upgrade pip
|
|
25
|
+
.venv/bin/pip install -e ".[dev]"
|
|
26
|
+
- name: Lint
|
|
27
|
+
run: .venv/bin/ruff check src tests
|
|
28
|
+
- name: Type check
|
|
29
|
+
run: .venv/bin/pyright src
|
|
30
|
+
- name: Tests
|
|
31
|
+
run: .venv/bin/pytest tests/ -v --tb=short
|
|
32
|
+
|
|
33
|
+
build:
|
|
34
|
+
name: Build distribution
|
|
35
|
+
needs: test
|
|
36
|
+
runs-on: ubuntu-latest
|
|
37
|
+
steps:
|
|
38
|
+
- uses: actions/checkout@v4
|
|
39
|
+
- name: Set up Python
|
|
40
|
+
uses: actions/setup-python@v5
|
|
41
|
+
with:
|
|
42
|
+
python-version: "3.12"
|
|
43
|
+
- name: Install build
|
|
44
|
+
run: python3 -m pip install build
|
|
45
|
+
- name: Build wheel and sdist
|
|
46
|
+
run: python3 -m build
|
|
47
|
+
- name: Store distribution packages
|
|
48
|
+
uses: actions/upload-artifact@v4
|
|
49
|
+
with:
|
|
50
|
+
name: python-package-distributions
|
|
51
|
+
path: dist/
|
|
52
|
+
|
|
53
|
+
publish:
|
|
54
|
+
name: Publish to PyPI
|
|
55
|
+
needs: build
|
|
56
|
+
runs-on: ubuntu-latest
|
|
57
|
+
environment:
|
|
58
|
+
name: pypi
|
|
59
|
+
url: https://pypi.org/p/openaugi
|
|
60
|
+
permissions:
|
|
61
|
+
id-token: write
|
|
62
|
+
steps:
|
|
63
|
+
- name: Download dists
|
|
64
|
+
uses: actions/download-artifact@v4
|
|
65
|
+
with:
|
|
66
|
+
name: python-package-distributions
|
|
67
|
+
path: dist/
|
|
68
|
+
- name: Publish to PyPI
|
|
69
|
+
uses: pypa/gh-action-pypi-publish@release/v1
|
|
@@ -0,0 +1,191 @@
|
|
|
1
|
+
*local*
|
|
2
|
+
env
|
|
3
|
+
.venv
|
|
4
|
+
*.pyc
|
|
5
|
+
*.npy
|
|
6
|
+
*data/
|
|
7
|
+
.vscode/
|
|
8
|
+
.DS_Store
|
|
9
|
+
*.env
|
|
10
|
+
storage/
|
|
11
|
+
*.log
|
|
12
|
+
*lib/
|
|
13
|
+
*.json
|
|
14
|
+
notes_network.html
|
|
15
|
+
*.duckdb*
|
|
16
|
+
*.duckdb
|
|
17
|
+
*.db
|
|
18
|
+
*.db-wal
|
|
19
|
+
*.db-shm
|
|
20
|
+
|
|
21
|
+
# Byte-compiled / optimized / DLL files
|
|
22
|
+
__pycache__/
|
|
23
|
+
*.py[cod]
|
|
24
|
+
*$py.class
|
|
25
|
+
|
|
26
|
+
# C extensions
|
|
27
|
+
*.so
|
|
28
|
+
|
|
29
|
+
# Distribution / packaging
|
|
30
|
+
.Python
|
|
31
|
+
build/
|
|
32
|
+
develop-eggs/
|
|
33
|
+
dist/
|
|
34
|
+
downloads/
|
|
35
|
+
eggs/
|
|
36
|
+
.eggs/
|
|
37
|
+
lib/
|
|
38
|
+
lib64/
|
|
39
|
+
parts/
|
|
40
|
+
sdist/
|
|
41
|
+
var/
|
|
42
|
+
wheels/
|
|
43
|
+
share/python-wheels/
|
|
44
|
+
*.egg-info/
|
|
45
|
+
.installed.cfg
|
|
46
|
+
*.egg
|
|
47
|
+
MANIFEST
|
|
48
|
+
|
|
49
|
+
# PyInstaller
|
|
50
|
+
# Usually these files are written by a python script from a template
|
|
51
|
+
# before PyInstaller builds the exe, so as to inject date/other infos into it.
|
|
52
|
+
*.manifest
|
|
53
|
+
*.spec
|
|
54
|
+
|
|
55
|
+
# Installer logs
|
|
56
|
+
pip-log.txt
|
|
57
|
+
pip-delete-this-directory.txt
|
|
58
|
+
|
|
59
|
+
# Unit test / coverage reports
|
|
60
|
+
htmlcov/
|
|
61
|
+
.tox/
|
|
62
|
+
.nox/
|
|
63
|
+
.coverage
|
|
64
|
+
.coverage.*
|
|
65
|
+
.cache
|
|
66
|
+
nosetests.xml
|
|
67
|
+
coverage.xml
|
|
68
|
+
*.cover
|
|
69
|
+
*.py,cover
|
|
70
|
+
.hypothesis/
|
|
71
|
+
.pytest_cache/
|
|
72
|
+
cover/
|
|
73
|
+
|
|
74
|
+
# Translations
|
|
75
|
+
*.mo
|
|
76
|
+
*.pot
|
|
77
|
+
|
|
78
|
+
# Django stuff:
|
|
79
|
+
*.log
|
|
80
|
+
local_settings.py
|
|
81
|
+
db.sqlite3
|
|
82
|
+
db.sqlite3-journal
|
|
83
|
+
|
|
84
|
+
# Flask stuff:
|
|
85
|
+
instance/
|
|
86
|
+
.webassets-cache
|
|
87
|
+
|
|
88
|
+
# Scrapy stuff:
|
|
89
|
+
.scrapy
|
|
90
|
+
|
|
91
|
+
# Sphinx documentation
|
|
92
|
+
docs/_build/
|
|
93
|
+
|
|
94
|
+
# PyBuilder
|
|
95
|
+
.pybuilder/
|
|
96
|
+
target/
|
|
97
|
+
|
|
98
|
+
# Jupyter Notebook
|
|
99
|
+
.ipynb_checkpoints
|
|
100
|
+
|
|
101
|
+
# IPython
|
|
102
|
+
profile_default/
|
|
103
|
+
ipython_config.py
|
|
104
|
+
|
|
105
|
+
# pyenv
|
|
106
|
+
# For a library or package, you might want to ignore these files since the code is
|
|
107
|
+
# intended to run in multiple environments; otherwise, check them in:
|
|
108
|
+
# .python-version
|
|
109
|
+
|
|
110
|
+
# pipenv
|
|
111
|
+
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
|
|
112
|
+
# However, in case of collaboration, if having platform-specific dependencies or dependencies
|
|
113
|
+
# having no cross-platform support, pipenv may install dependencies that don't work, or not
|
|
114
|
+
# install all needed dependencies.
|
|
115
|
+
#Pipfile.lock
|
|
116
|
+
|
|
117
|
+
# UV
|
|
118
|
+
# Similar to Pipfile.lock, it is generally recommended to include uv.lock in version control.
|
|
119
|
+
# This is especially recommended for binary packages to ensure reproducibility, and is more
|
|
120
|
+
# commonly ignored for libraries.
|
|
121
|
+
#uv.lock
|
|
122
|
+
|
|
123
|
+
# poetry
|
|
124
|
+
# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
|
|
125
|
+
# This is especially recommended for binary packages to ensure reproducibility, and is more
|
|
126
|
+
# commonly ignored for libraries.
|
|
127
|
+
# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
|
|
128
|
+
#poetry.lock
|
|
129
|
+
|
|
130
|
+
# pdm
|
|
131
|
+
# Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
|
|
132
|
+
#pdm.lock
|
|
133
|
+
# pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it
|
|
134
|
+
# in version control.
|
|
135
|
+
# https://pdm.fming.dev/latest/usage/project/#working-with-version-control
|
|
136
|
+
.pdm.toml
|
|
137
|
+
.pdm-python
|
|
138
|
+
.pdm-build/
|
|
139
|
+
|
|
140
|
+
# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
|
|
141
|
+
__pypackages__/
|
|
142
|
+
|
|
143
|
+
# Celery stuff
|
|
144
|
+
celerybeat-schedule
|
|
145
|
+
celerybeat.pid
|
|
146
|
+
|
|
147
|
+
# SageMath parsed files
|
|
148
|
+
*.sage.py
|
|
149
|
+
|
|
150
|
+
# Environments
|
|
151
|
+
.env
|
|
152
|
+
.venv
|
|
153
|
+
env/
|
|
154
|
+
venv/
|
|
155
|
+
ENV/
|
|
156
|
+
env.bak/
|
|
157
|
+
venv.bak/
|
|
158
|
+
|
|
159
|
+
# Spyder project settings
|
|
160
|
+
.spyderproject
|
|
161
|
+
.spyproject
|
|
162
|
+
|
|
163
|
+
# Rope project settings
|
|
164
|
+
.ropeproject
|
|
165
|
+
|
|
166
|
+
# mkdocs documentation
|
|
167
|
+
/site
|
|
168
|
+
|
|
169
|
+
# mypy
|
|
170
|
+
.mypy_cache/
|
|
171
|
+
.dmypy.json
|
|
172
|
+
dmypy.json
|
|
173
|
+
|
|
174
|
+
# Pyre type checker
|
|
175
|
+
.pyre/
|
|
176
|
+
|
|
177
|
+
# pytype static type analyzer
|
|
178
|
+
.pytype/
|
|
179
|
+
|
|
180
|
+
# Cython debug symbols
|
|
181
|
+
cython_debug/
|
|
182
|
+
|
|
183
|
+
# PyCharm
|
|
184
|
+
# JetBrains specific template is maintained in a separate JetBrains.gitignore that can
|
|
185
|
+
# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
|
|
186
|
+
# and can be added to the global gitignore or merged into this file. For a more nuclear
|
|
187
|
+
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
|
|
188
|
+
#.idea/
|
|
189
|
+
|
|
190
|
+
# PyPI configuration file
|
|
191
|
+
.pypirc
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
repos:
|
|
2
|
+
- repo: https://github.com/pre-commit/pre-commit-hooks
|
|
3
|
+
rev: v5.0.0
|
|
4
|
+
hooks:
|
|
5
|
+
- id: trailing-whitespace
|
|
6
|
+
- id: end-of-file-fixer
|
|
7
|
+
- id: check-yaml
|
|
8
|
+
- id: check-added-large-files
|
|
9
|
+
- id: check-merge-conflict
|
|
10
|
+
|
|
11
|
+
- repo: https://github.com/astral-sh/ruff-pre-commit
|
|
12
|
+
rev: v0.15.7
|
|
13
|
+
hooks:
|
|
14
|
+
- id: ruff
|
|
15
|
+
args: [--fix]
|
|
16
|
+
- id: ruff-format
|
|
17
|
+
|
|
18
|
+
- repo: https://github.com/RobertCraigie/pyright-python
|
|
19
|
+
rev: v1.1.408
|
|
20
|
+
hooks:
|
|
21
|
+
- id: pyright
|
|
22
|
+
files: ^src/
|
|
23
|
+
additional_dependencies:
|
|
24
|
+
- "pydantic>=2.6"
|
|
25
|
+
- "typer>=0.12"
|
|
26
|
+
- "rich>=13"
|
|
27
|
+
- "mcp>=1.0"
|
|
28
|
+
- "numpy>=1.26"
|
|
29
|
+
- "openai>=1.0"
|
|
30
|
+
- "tiktoken>=0.7"
|
|
@@ -0,0 +1,156 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: architecture
|
|
3
|
+
description: System architecture for OpenAugi — blocks+links data model, processing layers, module map
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# OpenAugi Architecture
|
|
7
|
+
|
|
8
|
+
A self-hostable personal intelligence engine. One `pip install`. One SQLite file. One MCP server.
|
|
9
|
+
|
|
10
|
+
## Data Model
|
|
11
|
+
|
|
12
|
+
Two tables. That's the whole store.
|
|
13
|
+
|
|
14
|
+
```
|
|
15
|
+
blocks (id, kind, content, summary, embedding, source, title, tags, timestamp, metadata, content_hash)
|
|
16
|
+
links (from_id, to_id, kind, weight, metadata) — PK: (from_id, to_id, kind)
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
**Block kinds:** document, entry, tag, cluster (M2), summary (M2)
|
|
20
|
+
**Link kinds:** split_from, tagged, links_to, member_of (M2), summarizes (M2)
|
|
21
|
+
|
|
22
|
+
Everything is a block. Structure lives in the links, not in the schema.
|
|
23
|
+
|
|
24
|
+
## Processing Layers
|
|
25
|
+
|
|
26
|
+
| Layer | Cost | What | Requires |
|
|
27
|
+
|-------|------|------|----------|
|
|
28
|
+
| **Layer 0** | FREE | Split, tag/link extract, FTS, dedup hash | Python + SQLite |
|
|
29
|
+
| **Layer 1** | ~$0 | Embed (local default), hub scoring (SQL) | sentence-transformers (local) |
|
|
30
|
+
| **Layer 2** | $$$ | Entity extraction, summaries, clustering | LLM (deferred to M2) |
|
|
31
|
+
|
|
32
|
+
## Module Map
|
|
33
|
+
|
|
34
|
+
```
|
|
35
|
+
src/openaugi/
|
|
36
|
+
├── model/
|
|
37
|
+
│ ├── block.py # Block Pydantic model
|
|
38
|
+
│ ├── link.py # Link Pydantic model
|
|
39
|
+
│ └── protocols.py # EmbeddingModel, LLMModel protocols
|
|
40
|
+
├── adapters/
|
|
41
|
+
│ └── vault.py # Obsidian vault → blocks + links
|
|
42
|
+
├── pipeline/
|
|
43
|
+
│ ├── runner.py # Layer 0 orchestrator (incremental ingestion)
|
|
44
|
+
│ ├── embed.py # Layer 1 embedding step → vec_blocks (sqlite-vec)
|
|
45
|
+
│ ├── rerank.py # Dedup + MMR re-ranking for get_context
|
|
46
|
+
│ └── watcher.py # File watcher — debounced incremental ingest on vault changes
|
|
47
|
+
├── store/
|
|
48
|
+
│ └── sqlite.py # SQLite backend (WAL, FTS5, sqlite-vec vec0, CASCADE)
|
|
49
|
+
├── models/
|
|
50
|
+
│ ├── __init__.py # Factory: get_embedding_model(), get_llm_model()
|
|
51
|
+
│ └── embeddings/
|
|
52
|
+
│ ├── sentence_transformer.py # Local default (free)
|
|
53
|
+
│ └── openai.py # OpenAI API adapter
|
|
54
|
+
├── mcp/
|
|
55
|
+
│ ├── server.py # MCP tools (read + write + streams), stdio + streamable-http transport
|
|
56
|
+
│ ├── doc_writer.py # VaultWriter — writes .md to OpenAugi/ in vault
|
|
57
|
+
│ └── stream_manager.py # StreamManager — workstream CRUD (OpenAugi/Streams/)
|
|
58
|
+
├── cli/
|
|
59
|
+
│ └── main.py # typer CLI (up, ingest, serve, watch, search, hubs, status, service)
|
|
60
|
+
└── config.py # TOML config loader + .env loader
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
## Key Flows
|
|
64
|
+
|
|
65
|
+
### Ingest (Layer 0 + 1)
|
|
66
|
+
|
|
67
|
+
```
|
|
68
|
+
Vault .md files
|
|
69
|
+
→ parse_vault_incremental() [adapters/vault.py]
|
|
70
|
+
→ file hash check (skip unchanged)
|
|
71
|
+
→ split by H3 dates → entry blocks
|
|
72
|
+
→ extract tags → tag blocks + tagged links
|
|
73
|
+
→ extract [[wikilinks]] → links_to links
|
|
74
|
+
→ document block + split_from links
|
|
75
|
+
→ insert blocks + links [store/sqlite.py]
|
|
76
|
+
→ FTS5 auto-indexed via triggers
|
|
77
|
+
→ run_embed() [pipeline/embed.py]
|
|
78
|
+
→ embed blocks where embedding IS NULL
|
|
79
|
+
→ write float32 blobs to blocks.embedding + vec_blocks (sqlite-vec)
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
### Query (MCP)
|
|
83
|
+
|
|
84
|
+
```
|
|
85
|
+
Claude → MCP tool call → server.py
|
|
86
|
+
→ search: sqlite-vec KNN (semantic) or FTS5 (keyword) + filters
|
|
87
|
+
→ get_block / get_blocks: full content by ID (single or batch)
|
|
88
|
+
→ get_related: follow links from/to a block
|
|
89
|
+
→ traverse: multi-hop graph walk
|
|
90
|
+
→ get_context: FTS + semantic (3× overfetch)
|
|
91
|
+
→ deduplicate (cosine grouping, rerank.py)
|
|
92
|
+
→ MMR re-rank
|
|
93
|
+
→ expand via links
|
|
94
|
+
→ recent: recently created blocks
|
|
95
|
+
→ write_document / write_thread / write_snip: save notes to vault
|
|
96
|
+
→ list_streams / get_stream_context / make_stream / update_stream: workstream CRUD
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
### Hub Scoring
|
|
100
|
+
|
|
101
|
+
Pure SQL aggregation at query time (no stored table):
|
|
102
|
+
```
|
|
103
|
+
hub_score = w_in * ln(1 + inbound_links) + w_out * ln(1 + outbound_links) + w_ent * ln(1 + entry_count)
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
## Design Decisions
|
|
107
|
+
|
|
108
|
+
See [docs/plans/m0.md](docs/plans/m0.md) § Key Design Decisions for full rationale.
|
|
109
|
+
|
|
110
|
+
- **SQLite over DuckDB**: WAL mode concurrent writes. DuckDB is single-writer.
|
|
111
|
+
- **sqlite-vec over FAISS**: KNN via `vec0` virtual table — everything in one file, no separate index management. Embeddings normalized on write so L2 distance ≡ cosine.
|
|
112
|
+
- **Content hash as block identity**: `hash(source_path + content_hash)` — stable across section reordering.
|
|
113
|
+
- **Tags as blocks**: First-class graph nodes. Hub scoring, traversal, entity resolution work uniformly.
|
|
114
|
+
- **Default local embeddings**: sentence-transformers, no API key. Users upgrade via config.
|
|
115
|
+
- **`get_context` dedup + MMR**: Over-fetches 3× candidates, collapses near-duplicates via cosine grouping, re-ranks for diversity before returning. See [docs/MCP_SERVER.md](docs/MCP_SERVER.md) for tuning.
|
|
116
|
+
|
|
117
|
+
## Running
|
|
118
|
+
|
|
119
|
+
### Quick start (one command)
|
|
120
|
+
|
|
121
|
+
```bash
|
|
122
|
+
openaugi init # one-time: configure embedding model, API key, vault path
|
|
123
|
+
openaugi up # daily: sync vault + file watcher + MCP server
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
`openaugi up` is the single command to run OpenAugi:
|
|
127
|
+
|
|
128
|
+
1. **Incremental ingest** — syncs vault to SQLite (skips unchanged files via content hash)
|
|
129
|
+
2. **File watcher** — daemon thread watches for `.md` changes, debounces (default 30s), re-ingests
|
|
130
|
+
3. **MCP server** — foreground, stdio or HTTP transport
|
|
131
|
+
|
|
132
|
+
Embedding is attempted with the user's configured model. If it fails, blocks are saved without embeddings and retried on the next watcher cycle. SQLite WAL mode handles concurrent reads (MCP) and writes (watcher) without locking.
|
|
133
|
+
|
|
134
|
+
### Individual commands
|
|
135
|
+
|
|
136
|
+
| Command | What |
|
|
137
|
+
|---------|------|
|
|
138
|
+
| `openaugi serve` | MCP server only (stdio or HTTP) |
|
|
139
|
+
| `openaugi watch` | File watcher only (incremental ingest on vault changes) |
|
|
140
|
+
| `openaugi up` | Both in one process |
|
|
141
|
+
|
|
142
|
+
### Transports
|
|
143
|
+
|
|
144
|
+
Two transport modes — see [docs/REMOTE_ACCESS.md](docs/REMOTE_ACCESS.md) for full setup.
|
|
145
|
+
|
|
146
|
+
| Transport | Command | Use Case |
|
|
147
|
+
|-----------|---------|----------|
|
|
148
|
+
| stdio (default) | `openaugi up` | Claude Desktop/Code on same machine |
|
|
149
|
+
| streamable-http | `openaugi up --transport http` | Remote clients, Claude mobile via Cloudflare Tunnel |
|
|
150
|
+
|
|
151
|
+
Service management (macOS): `openaugi service install/uninstall/status` — launchd plist, starts on boot.
|
|
152
|
+
|
|
153
|
+
## Plans
|
|
154
|
+
|
|
155
|
+
- [docs/plans/overall-mvp.md](docs/plans/overall-mvp.md) — Milestones M0–M5
|
|
156
|
+
- [docs/plans/future-work.md](docs/plans/future-work.md) — Deferred features
|
openaugi-0.1.0/CLAUDE.md
ADDED
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
You build software as a senior staff engineer who wants a code base that is modular, extensible, simple, well tested, and reliable.
|
|
2
|
+
You do not make assumptions but clarify trade offs and do web searches to understand pragmatic best practices.
|
|
3
|
+
You document as you go - keeping docs up-to-date from the overall ARCHITECTURE.md linking to other docs when needed to describe features and why.
|
|
4
|
+
You write unit tests but also make sure we are able to test end to end either with integration or mocking components.
|
|
5
|
+
You the agent are constantly improving your ability to work in this codebase - document common patterns or skills, build CLI tools or save scripts/ commands needed to work in this repo.
|
|
6
|
+
|
|
7
|
+
# Quick reference
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
# Install (dev)
|
|
11
|
+
python3 -m venv .venv && .venv/bin/pip install -e ".[dev]"
|
|
12
|
+
|
|
13
|
+
# Run full CI check (lint + types + tests) — ALWAYS run before pushing
|
|
14
|
+
./scripts/check.sh
|
|
15
|
+
|
|
16
|
+
# Run tests only
|
|
17
|
+
.venv/bin/python -m pytest tests/ -v
|
|
18
|
+
|
|
19
|
+
# Ingest fixture vault
|
|
20
|
+
.venv/bin/openaugi ingest --path tests/fixtures/vault --db /tmp/test.db
|
|
21
|
+
|
|
22
|
+
# CLI commands
|
|
23
|
+
.venv/bin/openaugi status --db /tmp/test.db
|
|
24
|
+
.venv/bin/openaugi hubs --db /tmp/test.db
|
|
25
|
+
.venv/bin/openaugi search "query" --db /tmp/test.db --keyword
|
|
26
|
+
|
|
27
|
+
# Lint
|
|
28
|
+
.venv/bin/ruff check src tests
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
# Architecture
|
|
32
|
+
|
|
33
|
+
See [ARCHITECTURE.md](ARCHITECTURE.md) for the full system map.
|
|
34
|
+
|
|
35
|
+
**Core data model:** Two tables — `blocks` and `links`. Everything is a block (documents, entries, tags). Structure lives in the links.
|
|
36
|
+
|
|
37
|
+
**Key modules:**
|
|
38
|
+
- `src/openaugi/model/` — Block, Link (Pydantic), protocols (EmbeddingModel, LLMModel)
|
|
39
|
+
- `src/openaugi/adapters/vault.py` — Obsidian vault → blocks + links
|
|
40
|
+
- `src/openaugi/store/sqlite.py` — SQLite backend (WAL, FTS5, sqlite-vec vec0, CASCADE)
|
|
41
|
+
- `src/openaugi/pipeline/runner.py` — Layer 0 orchestrator
|
|
42
|
+
- `src/openaugi/pipeline/embed.py` — Layer 1 embedding step
|
|
43
|
+
- `src/openaugi/mcp/server.py` — 5 MCP tools for Claude
|
|
44
|
+
- `src/openaugi/cli/main.py` — typer CLI (ingest, serve, search, hubs, status)
|
|
45
|
+
|
|
46
|
+
# Document as you go
|
|
47
|
+
Plans go in docs/plans folder. Move them to docs/archive when done.
|
|
48
|
+
|
|
49
|
+
ARCHITECTURE.md is the overall entry point map into the codebase - keep this up-to-date and walk the other docs.
|
|
50
|
+
|
|
51
|
+
Docs should follow Claude skill format - name: and description: at the top that we can scan the top only to find relevant docs.
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
# Contributing to OpenAugi
|
|
2
|
+
|
|
3
|
+
Thanks for your interest in contributing.
|
|
4
|
+
|
|
5
|
+
## Setup
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
git clone https://github.com/openaugi/openaugi.git
|
|
9
|
+
cd openaugi
|
|
10
|
+
python3 -m venv .venv
|
|
11
|
+
.venv/bin/pip install -e ".[dev]"
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
## Development
|
|
15
|
+
|
|
16
|
+
```bash
|
|
17
|
+
# Run tests
|
|
18
|
+
.venv/bin/python -m pytest tests/ -v
|
|
19
|
+
|
|
20
|
+
# Lint
|
|
21
|
+
.venv/bin/ruff check src tests
|
|
22
|
+
|
|
23
|
+
# Type check
|
|
24
|
+
.venv/bin/pyright src
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
## Pull Requests
|
|
28
|
+
|
|
29
|
+
- One focused change per PR
|
|
30
|
+
- Include tests for new functionality
|
|
31
|
+
- Run `pytest` and `ruff check` before submitting
|
|
32
|
+
- Keep PRs small — easier to review, faster to merge
|
|
33
|
+
|
|
34
|
+
## Architecture
|
|
35
|
+
|
|
36
|
+
See [ARCHITECTURE.md](ARCHITECTURE.md) for how the system is structured.
|
|
37
|
+
|
|
38
|
+
## Code Style
|
|
39
|
+
|
|
40
|
+
- Python 3.12+
|
|
41
|
+
- Ruff for linting and formatting
|
|
42
|
+
- Pyright for type checking
|
|
43
|
+
- Pydantic for data models
|
|
44
|
+
- Keep it simple — no premature abstraction
|
openaugi-0.1.0/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2024 Chris Lettieri
|
|
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.
|