brainpick 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.
- brainpick-0.1.0/PKG-INFO +67 -0
- brainpick-0.1.0/README.md +33 -0
- brainpick-0.1.0/pyproject.toml +68 -0
- brainpick-0.1.0/setup.cfg +4 -0
- brainpick-0.1.0/src/brainpick/__init__.py +4 -0
- brainpick-0.1.0/src/brainpick/__main__.py +7 -0
- brainpick-0.1.0/src/brainpick/_skill/SKILL.md +65 -0
- brainpick-0.1.0/src/brainpick/_static/assets/Editor-x4G_0KV0.js +45 -0
- brainpick-0.1.0/src/brainpick/_static/assets/index-CTcBQZsl.js +4324 -0
- brainpick-0.1.0/src/brainpick/_static/assets/index-Dn6TTKMy.css +1 -0
- brainpick-0.1.0/src/brainpick/_static/assets/virtual_pwa-register-Cb81Y-Xh.js +1 -0
- brainpick-0.1.0/src/brainpick/_static/assets/workbox-window.prod.es5-BBnX5xw4.js +2 -0
- brainpick-0.1.0/src/brainpick/_static/assets/worker-CVB4_RMu.js +1 -0
- brainpick-0.1.0/src/brainpick/_static/icons/apple-touch-icon.png +0 -0
- brainpick-0.1.0/src/brainpick/_static/icons/favicon.svg +35 -0
- brainpick-0.1.0/src/brainpick/_static/icons/icon-192.png +0 -0
- brainpick-0.1.0/src/brainpick/_static/icons/icon-512.png +0 -0
- brainpick-0.1.0/src/brainpick/_static/icons/icon-maskable-512.png +0 -0
- brainpick-0.1.0/src/brainpick/_static/index.html +17 -0
- brainpick-0.1.0/src/brainpick/_static/manifest.webmanifest +1 -0
- brainpick-0.1.0/src/brainpick/_static/sw.js +1 -0
- brainpick-0.1.0/src/brainpick/_static/workbox-a3c94b52.js +1 -0
- brainpick-0.1.0/src/brainpick/auth.py +419 -0
- brainpick-0.1.0/src/brainpick/cli.py +435 -0
- brainpick-0.1.0/src/brainpick/compile/__init__.py +0 -0
- brainpick-0.1.0/src/brainpick/compile/pipeline.py +387 -0
- brainpick-0.1.0/src/brainpick/compile/similarity_gaps.py +115 -0
- brainpick-0.1.0/src/brainpick/compile/t1.py +277 -0
- brainpick-0.1.0/src/brainpick/compile/t2.py +280 -0
- brainpick-0.1.0/src/brainpick/compile/t3.py +426 -0
- brainpick-0.1.0/src/brainpick/config.py +309 -0
- brainpick-0.1.0/src/brainpick/core/__init__.py +0 -0
- brainpick-0.1.0/src/brainpick/core/bundle.py +173 -0
- brainpick-0.1.0/src/brainpick/core/canonical.py +18 -0
- brainpick-0.1.0/src/brainpick/core/frontmatter.py +33 -0
- brainpick-0.1.0/src/brainpick/core/fs.py +28 -0
- brainpick-0.1.0/src/brainpick/core/links.py +37 -0
- brainpick-0.1.0/src/brainpick/deltas.py +41 -0
- brainpick-0.1.0/src/brainpick/detect.py +215 -0
- brainpick-0.1.0/src/brainpick/embed.py +147 -0
- brainpick-0.1.0/src/brainpick/integrate.py +180 -0
- brainpick-0.1.0/src/brainpick/kg.py +273 -0
- brainpick-0.1.0/src/brainpick/kgadapt/__init__.py +13 -0
- brainpick-0.1.0/src/brainpick/kgadapt/algorithmic.py +166 -0
- brainpick-0.1.0/src/brainpick/kgadapt/protocol.py +162 -0
- brainpick-0.1.0/src/brainpick/llm.py +133 -0
- brainpick-0.1.0/src/brainpick/mcp_server.py +663 -0
- brainpick-0.1.0/src/brainpick/merge.py +218 -0
- brainpick-0.1.0/src/brainpick/query/__init__.py +0 -0
- brainpick-0.1.0/src/brainpick/query/keyword.py +116 -0
- brainpick-0.1.0/src/brainpick/query/present.py +130 -0
- brainpick-0.1.0/src/brainpick/query/router.py +140 -0
- brainpick-0.1.0/src/brainpick/query/vectors.py +65 -0
- brainpick-0.1.0/src/brainpick/scaffold.py +593 -0
- brainpick-0.1.0/src/brainpick/serve/__init__.py +1 -0
- brainpick-0.1.0/src/brainpick/serve/app.py +210 -0
- brainpick-0.1.0/src/brainpick/serve/live.py +68 -0
- brainpick-0.1.0/src/brainpick/serve/rest.py +515 -0
- brainpick-0.1.0/src/brainpick/serve/state.py +368 -0
- brainpick-0.1.0/src/brainpick/serve/watcher.py +76 -0
- brainpick-0.1.0/src/brainpick/timeline.py +250 -0
- brainpick-0.1.0/src/brainpick/vectorstore.py +155 -0
- brainpick-0.1.0/src/brainpick.egg-info/PKG-INFO +67 -0
- brainpick-0.1.0/src/brainpick.egg-info/SOURCES.txt +101 -0
- brainpick-0.1.0/src/brainpick.egg-info/dependency_links.txt +1 -0
- brainpick-0.1.0/src/brainpick.egg-info/entry_points.txt +2 -0
- brainpick-0.1.0/src/brainpick.egg-info/requires.txt +23 -0
- brainpick-0.1.0/src/brainpick.egg-info/top_level.txt +1 -0
- brainpick-0.1.0/tests/test_auth.py +181 -0
- brainpick-0.1.0/tests/test_bundle.py +62 -0
- brainpick-0.1.0/tests/test_cli.py +204 -0
- brainpick-0.1.0/tests/test_config.py +284 -0
- brainpick-0.1.0/tests/test_conformance.py +251 -0
- brainpick-0.1.0/tests/test_deltas.py +48 -0
- brainpick-0.1.0/tests/test_detect.py +205 -0
- brainpick-0.1.0/tests/test_e2e_mcp.py +233 -0
- brainpick-0.1.0/tests/test_e2e_serve.py +1017 -0
- brainpick-0.1.0/tests/test_frontmatter.py +44 -0
- brainpick-0.1.0/tests/test_integrate.py +122 -0
- brainpick-0.1.0/tests/test_keyword.py +28 -0
- brainpick-0.1.0/tests/test_kg.py +230 -0
- brainpick-0.1.0/tests/test_links.py +37 -0
- brainpick-0.1.0/tests/test_llm.py +127 -0
- brainpick-0.1.0/tests/test_mcp_tools.py +516 -0
- brainpick-0.1.0/tests/test_merge.py +256 -0
- brainpick-0.1.0/tests/test_pipeline.py +85 -0
- brainpick-0.1.0/tests/test_present.py +19 -0
- brainpick-0.1.0/tests/test_report.py +175 -0
- brainpick-0.1.0/tests/test_router.py +245 -0
- brainpick-0.1.0/tests/test_scaffold.py +386 -0
- brainpick-0.1.0/tests/test_serve_state.py +252 -0
- brainpick-0.1.0/tests/test_similarity_gaps.py +130 -0
- brainpick-0.1.0/tests/test_similarity_gaps_stage.py +56 -0
- brainpick-0.1.0/tests/test_t1.py +93 -0
- brainpick-0.1.0/tests/test_t2_chunker.py +189 -0
- brainpick-0.1.0/tests/test_t2_embed.py +145 -0
- brainpick-0.1.0/tests/test_t2_stage.py +262 -0
- brainpick-0.1.0/tests/test_t2_store.py +93 -0
- brainpick-0.1.0/tests/test_t3_algorithmic.py +343 -0
- brainpick-0.1.0/tests/test_t3_backend.py +52 -0
- brainpick-0.1.0/tests/test_t3_export.py +173 -0
- brainpick-0.1.0/tests/test_t3_stage.py +280 -0
- brainpick-0.1.0/tests/test_timeline.py +211 -0
brainpick-0.1.0/PKG-INFO
ADDED
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: brainpick
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: A turn-key brain stack for agents: compile an OKF markdown bundle into a queryable, servable, visualizable brain.
|
|
5
|
+
Author: Benquemax
|
|
6
|
+
License: MIT
|
|
7
|
+
Project-URL: Homepage, https://github.com/benquemax/brainpick
|
|
8
|
+
Project-URL: Repository, https://github.com/benquemax/brainpick
|
|
9
|
+
Project-URL: Issues, https://github.com/benquemax/brainpick/issues
|
|
10
|
+
Keywords: knowledge-graph,okf,mcp,rag,agents,brainpick,llm
|
|
11
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
12
|
+
Classifier: Programming Language :: Python :: 3
|
|
13
|
+
Classifier: Intended Audience :: Developers
|
|
14
|
+
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
|
|
15
|
+
Requires-Python: >=3.10
|
|
16
|
+
Description-Content-Type: text/markdown
|
|
17
|
+
Requires-Dist: PyYAML>=6
|
|
18
|
+
Requires-Dist: tomli>=2; python_version < "3.11"
|
|
19
|
+
Requires-Dist: mcp<2,>=1.9
|
|
20
|
+
Requires-Dist: starlette>=0.40
|
|
21
|
+
Requires-Dist: uvicorn>=0.30
|
|
22
|
+
Requires-Dist: watchfiles>=0.24
|
|
23
|
+
Requires-Dist: httpx>=0.27
|
|
24
|
+
Provides-Extra: dev
|
|
25
|
+
Requires-Dist: pytest>=8; extra == "dev"
|
|
26
|
+
Requires-Dist: pytest-timeout>=2.3; extra == "dev"
|
|
27
|
+
Requires-Dist: ruff>=0.6; extra == "dev"
|
|
28
|
+
Provides-Extra: vectors
|
|
29
|
+
Requires-Dist: lancedb>=0.25; extra == "vectors"
|
|
30
|
+
Provides-Extra: vectors-local
|
|
31
|
+
Requires-Dist: fastembed>=0.7; extra == "vectors-local"
|
|
32
|
+
Provides-Extra: all
|
|
33
|
+
Requires-Dist: brainpick[vectors,vectors-local]; extra == "all"
|
|
34
|
+
|
|
35
|
+
# brainpick (Python engine)
|
|
36
|
+
|
|
37
|
+
**A turn-key brain stack for agents.** Compile a folder of
|
|
38
|
+
[OKF](https://github.com/GoogleCloudPlatform/knowledge-catalog/blob/main/okf/SPEC.md)
|
|
39
|
+
markdown into a queryable, servable, visualizable brain — then serve it to
|
|
40
|
+
agents over MCP + CLI and to humans through a live holographic-brain web UI.
|
|
41
|
+
|
|
42
|
+
This is the Python engine (the reference implementation). A byte-identical
|
|
43
|
+
[native Node engine](https://www.npmjs.com/package/brainpick) ships on npm with
|
|
44
|
+
no Python required — same artifacts, same UI, same MCP tools.
|
|
45
|
+
|
|
46
|
+
```bash
|
|
47
|
+
uvx brainpick init --root ./my-okf-bundle # detect, configure, compile
|
|
48
|
+
uvx brainpick serve --open # the living graph, zero API keys
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
## The tiers
|
|
52
|
+
|
|
53
|
+
| Tier | What | Needs |
|
|
54
|
+
|------|------|-------|
|
|
55
|
+
| T0 | grep/glob over the files | nothing |
|
|
56
|
+
| T1 | generated `index.md`, link graph, backlinks, tags | nothing (deterministic) |
|
|
57
|
+
| T2 | vector search over chunks | an embedding model |
|
|
58
|
+
| T3 | entity/relation graph (LightRAG behind an adapter) | a small LLM |
|
|
59
|
+
|
|
60
|
+
Extras: `brainpick[vectors]` (LanceDB), `brainpick[vectors-local]`
|
|
61
|
+
(fastembed, offline), `brainpick[graph]` (LightRAG extraction), `brainpick[all]`.
|
|
62
|
+
|
|
63
|
+
The markdown is the only source of truth; everything under `.brainpick/` is a
|
|
64
|
+
disposable build artifact. Small local models (qwen3.6-class) are first-class
|
|
65
|
+
citizens. See the [full README, principles, and docs](https://github.com/benquemax/brainpick).
|
|
66
|
+
|
|
67
|
+
MIT.
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
# brainpick (Python engine)
|
|
2
|
+
|
|
3
|
+
**A turn-key brain stack for agents.** Compile a folder of
|
|
4
|
+
[OKF](https://github.com/GoogleCloudPlatform/knowledge-catalog/blob/main/okf/SPEC.md)
|
|
5
|
+
markdown into a queryable, servable, visualizable brain — then serve it to
|
|
6
|
+
agents over MCP + CLI and to humans through a live holographic-brain web UI.
|
|
7
|
+
|
|
8
|
+
This is the Python engine (the reference implementation). A byte-identical
|
|
9
|
+
[native Node engine](https://www.npmjs.com/package/brainpick) ships on npm with
|
|
10
|
+
no Python required — same artifacts, same UI, same MCP tools.
|
|
11
|
+
|
|
12
|
+
```bash
|
|
13
|
+
uvx brainpick init --root ./my-okf-bundle # detect, configure, compile
|
|
14
|
+
uvx brainpick serve --open # the living graph, zero API keys
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
## The tiers
|
|
18
|
+
|
|
19
|
+
| Tier | What | Needs |
|
|
20
|
+
|------|------|-------|
|
|
21
|
+
| T0 | grep/glob over the files | nothing |
|
|
22
|
+
| T1 | generated `index.md`, link graph, backlinks, tags | nothing (deterministic) |
|
|
23
|
+
| T2 | vector search over chunks | an embedding model |
|
|
24
|
+
| T3 | entity/relation graph (LightRAG behind an adapter) | a small LLM |
|
|
25
|
+
|
|
26
|
+
Extras: `brainpick[vectors]` (LanceDB), `brainpick[vectors-local]`
|
|
27
|
+
(fastembed, offline), `brainpick[graph]` (LightRAG extraction), `brainpick[all]`.
|
|
28
|
+
|
|
29
|
+
The markdown is the only source of truth; everything under `.brainpick/` is a
|
|
30
|
+
disposable build artifact. Small local models (qwen3.6-class) are first-class
|
|
31
|
+
citizens. See the [full README, principles, and docs](https://github.com/benquemax/brainpick).
|
|
32
|
+
|
|
33
|
+
MIT.
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["setuptools>=69"]
|
|
3
|
+
build-backend = "setuptools.build_meta"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "brainpick"
|
|
7
|
+
version = "0.1.0"
|
|
8
|
+
description = "A turn-key brain stack for agents: compile an OKF markdown bundle into a queryable, servable, visualizable brain."
|
|
9
|
+
readme = "README.md"
|
|
10
|
+
requires-python = ">=3.10"
|
|
11
|
+
license = { text = "MIT" }
|
|
12
|
+
authors = [{ name = "Benquemax" }]
|
|
13
|
+
keywords = ["knowledge-graph", "okf", "mcp", "rag", "agents", "brainpick", "llm"]
|
|
14
|
+
classifiers = [
|
|
15
|
+
"License :: OSI Approved :: MIT License",
|
|
16
|
+
"Programming Language :: Python :: 3",
|
|
17
|
+
"Intended Audience :: Developers",
|
|
18
|
+
"Topic :: Scientific/Engineering :: Artificial Intelligence",
|
|
19
|
+
]
|
|
20
|
+
dependencies = [
|
|
21
|
+
"PyYAML>=6",
|
|
22
|
+
"tomli>=2; python_version<'3.11'",
|
|
23
|
+
"mcp>=1.9,<2",
|
|
24
|
+
"starlette>=0.40",
|
|
25
|
+
"uvicorn>=0.30",
|
|
26
|
+
"watchfiles>=0.24",
|
|
27
|
+
"httpx>=0.27",
|
|
28
|
+
]
|
|
29
|
+
|
|
30
|
+
[project.urls]
|
|
31
|
+
Homepage = "https://github.com/benquemax/brainpick"
|
|
32
|
+
Repository = "https://github.com/benquemax/brainpick"
|
|
33
|
+
Issues = "https://github.com/benquemax/brainpick/issues"
|
|
34
|
+
|
|
35
|
+
[project.optional-dependencies]
|
|
36
|
+
dev = [
|
|
37
|
+
"pytest>=8",
|
|
38
|
+
"pytest-timeout>=2.3",
|
|
39
|
+
"ruff>=0.6",
|
|
40
|
+
]
|
|
41
|
+
vectors = [
|
|
42
|
+
"lancedb>=0.25",
|
|
43
|
+
]
|
|
44
|
+
vectors-local = [
|
|
45
|
+
"fastembed>=0.7",
|
|
46
|
+
]
|
|
47
|
+
all = [
|
|
48
|
+
"brainpick[vectors,vectors-local]",
|
|
49
|
+
]
|
|
50
|
+
|
|
51
|
+
[project.scripts]
|
|
52
|
+
brainpick = "brainpick.cli:main"
|
|
53
|
+
|
|
54
|
+
[tool.setuptools.packages.find]
|
|
55
|
+
where = ["src"]
|
|
56
|
+
|
|
57
|
+
[tool.setuptools.package-data]
|
|
58
|
+
brainpick = ["_static/**/*", "_skill/SKILL.md"]
|
|
59
|
+
|
|
60
|
+
[tool.ruff]
|
|
61
|
+
line-length = 110
|
|
62
|
+
|
|
63
|
+
[tool.pytest.ini_options]
|
|
64
|
+
testpaths = ["tests"]
|
|
65
|
+
# The fast suite (pre-commit gate, default run) excludes live-LLM integration
|
|
66
|
+
# tests. Run them explicitly: `pytest -m integration` (needs stabilitee + [graph]).
|
|
67
|
+
addopts = "-m 'not integration'"
|
|
68
|
+
markers = ["integration: exercises a live model endpoint (slow, opt-in)"]
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: brainpick
|
|
3
|
+
description: Consult the compiled knowledge brain (a graph of this repo's docs) BEFORE grepping or answering questions about the project. Use whenever a brainpick brain is available — the brain_* MCP tools or the `brainpick` CLI.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# brainpick — pick the brain before you grep
|
|
7
|
+
|
|
8
|
+
This repo (or a folder in it) is compiled into a **brain**: a searchable graph of
|
|
9
|
+
its docs. Reading the brain is faster and truer than grepping raw files — it knows
|
|
10
|
+
titles, descriptions, links, and neighbors.
|
|
11
|
+
|
|
12
|
+
## The rule
|
|
13
|
+
|
|
14
|
+
**Before you grep, glob, or answer a "how does X work?" question, ask the brain.**
|
|
15
|
+
Grep finds strings; the brain finds meaning and the docs around it. Grep only after
|
|
16
|
+
the brain comes up short.
|
|
17
|
+
|
|
18
|
+
Start every session with one call to get oriented, then search.
|
|
19
|
+
|
|
20
|
+
## The five MCP tools
|
|
21
|
+
|
|
22
|
+
Call these if a `brainpick` MCP server is connected (tools are named `brain_*`):
|
|
23
|
+
|
|
24
|
+
- `brain_overview()` — one screen: counts, tiers, every doc grouped by folder. Call first.
|
|
25
|
+
- `brain_search({query})` — find docs by meaning/keyword. Returns paths + descriptions, never full bodies. `mode` is `auto` (default), `keyword`, `semantic`, or `graph`.
|
|
26
|
+
- `brain_read({doc})` — open one doc. `doc` is forgiving: a path (`kuu.md`), a bare stem (`kuu`), or an approximate title. Pass `sections:["Heading"]` to read just parts.
|
|
27
|
+
- `brain_neighbors({doc})` — walk the links around a doc (`depth` 1–3). Find what connects to what.
|
|
28
|
+
- `brain_write({doc, content})` — add a doc, guarded by the repo's contract. See "Writing" below.
|
|
29
|
+
|
|
30
|
+
Every result carries a `hint` naming a sensible next call. Follow it.
|
|
31
|
+
|
|
32
|
+
## The CLI equivalents
|
|
33
|
+
|
|
34
|
+
No MCP server? The same four reads are CLI verbs. Pick the invocation that runs here:
|
|
35
|
+
|
|
36
|
+
- Published (Python): `uvx brainpick search "vuorovesi"` · `read kuu` · `neighbors kuu` · `overview`
|
|
37
|
+
- Dev checkout (Python): `uv run brainpick search "vuorovesi" --root <bundle>`
|
|
38
|
+
- Node engine: `node /path/to/brainpick/dist/cli.js search "vuorovesi"` (or `npx brainpick search …` once published)
|
|
39
|
+
|
|
40
|
+
Add `--json` for machine-readable output, `--root <dir>` to point at the bundle,
|
|
41
|
+
`--mode`/`--limit` on search, `--depth` on neighbors. If the CLI says the brain
|
|
42
|
+
is not compiled, run `brainpick compile --root <bundle>` first.
|
|
43
|
+
|
|
44
|
+
Wire the MCP server into your host with `brainpick mcp` — e.g.
|
|
45
|
+
`claude mcp add brainpick -- uvx brainpick mcp --root <bundle>`.
|
|
46
|
+
|
|
47
|
+
## Writing knowledge back (brain_write)
|
|
48
|
+
|
|
49
|
+
Only write when asked to record knowledge. Follow the wiki's conventions or the
|
|
50
|
+
write is rejected by the contract:
|
|
51
|
+
|
|
52
|
+
- **One concept per page**, filename **kebab-case** `.md` (`kuun-vaiheet.md`).
|
|
53
|
+
- **Frontmatter**: `type` (Concept/Reference/Decision/Playbook), `title`,
|
|
54
|
+
`description`, `timestamp` — the brain bumps `timestamp` for you.
|
|
55
|
+
- **Link generously**; the **link text is the target doc's title** (`[Kuu](kuu.md)`).
|
|
56
|
+
A doc with no links is an orphan.
|
|
57
|
+
- **Optimistic concurrency**: pass `base_sha` = the sha256 of the content you last
|
|
58
|
+
read. On a mismatch nothing is written and you get the current content back —
|
|
59
|
+
re-read, reconcile, retry with the new `base_sha`.
|
|
60
|
+
|
|
61
|
+
## Auth
|
|
62
|
+
|
|
63
|
+
If the brain answers `401`, it wants a bearer token. Send
|
|
64
|
+
`Authorization: Bearer <token>` (mint one with `brainpick token create`). Local
|
|
65
|
+
stdio MCP is never gated.
|