cadabby 0.3.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.
Files changed (44) hide show
  1. cadabby-0.3.0/LICENSE +21 -0
  2. cadabby-0.3.0/PKG-INFO +294 -0
  3. cadabby-0.3.0/README.md +274 -0
  4. cadabby-0.3.0/pyproject.toml +32 -0
  5. cadabby-0.3.0/src/cadabby/__init__.py +3 -0
  6. cadabby-0.3.0/src/cadabby/__main__.py +8 -0
  7. cadabby-0.3.0/src/cadabby/adapters/__init__.py +11 -0
  8. cadabby-0.3.0/src/cadabby/adapters/disk_storage.py +96 -0
  9. cadabby-0.3.0/src/cadabby/adapters/memory_storage.py +81 -0
  10. cadabby-0.3.0/src/cadabby/assets/commands/ingest.md +5 -0
  11. cadabby-0.3.0/src/cadabby/assets/commands/vault-lint.md +5 -0
  12. cadabby-0.3.0/src/cadabby/assets/commands/vault-status.md +5 -0
  13. cadabby-0.3.0/src/cadabby/assets/plugins/cadabby/agents/librarian/agent.md +7 -0
  14. cadabby-0.3.0/src/cadabby/assets/plugins/cadabby/agents/technician/agent.md +7 -0
  15. cadabby-0.3.0/src/cadabby/assets/plugins/cadabby/mcp_config.json +8 -0
  16. cadabby-0.3.0/src/cadabby/assets/plugins/cadabby/plugin.json +16 -0
  17. cadabby-0.3.0/src/cadabby/assets/plugins/cadabby/skills/cadabby-wiki/SKILL.md +15 -0
  18. cadabby-0.3.0/src/cadabby/assets/skills/librarian/SKILL.md +25 -0
  19. cadabby-0.3.0/src/cadabby/assets/skills/technician/SKILL.md +20 -0
  20. cadabby-0.3.0/src/cadabby/assets/vault/.cadabby.json +27 -0
  21. cadabby-0.3.0/src/cadabby/assets/vault/.gitignore +28 -0
  22. cadabby-0.3.0/src/cadabby/assets/vault/.mcp.json +8 -0
  23. cadabby-0.3.0/src/cadabby/assets/vault/AGENTS.md +66 -0
  24. cadabby-0.3.0/src/cadabby/assets/vault/CLAUDE.md +8 -0
  25. cadabby-0.3.0/src/cadabby/assets/vault/GEMINI.md +8 -0
  26. cadabby-0.3.0/src/cadabby/assets/vault/STYLE.md +6 -0
  27. cadabby-0.3.0/src/cadabby/assets/vault/index.md +13 -0
  28. cadabby-0.3.0/src/cadabby/assets/vault/obsidian/app.json +8 -0
  29. cadabby-0.3.0/src/cadabby/audit.py +151 -0
  30. cadabby-0.3.0/src/cadabby/cache.py +776 -0
  31. cadabby-0.3.0/src/cadabby/cli.py +718 -0
  32. cadabby-0.3.0/src/cadabby/constants.py +86 -0
  33. cadabby-0.3.0/src/cadabby/domain.py +227 -0
  34. cadabby-0.3.0/src/cadabby/frontmatter.py +404 -0
  35. cadabby-0.3.0/src/cadabby/fsutil.py +205 -0
  36. cadabby-0.3.0/src/cadabby/graph.py +242 -0
  37. cadabby-0.3.0/src/cadabby/indexer.py +159 -0
  38. cadabby-0.3.0/src/cadabby/installer.py +354 -0
  39. cadabby-0.3.0/src/cadabby/lint.py +360 -0
  40. cadabby-0.3.0/src/cadabby/mcp.py +508 -0
  41. cadabby-0.3.0/src/cadabby/okf.py +111 -0
  42. cadabby-0.3.0/src/cadabby/ops.py +437 -0
  43. cadabby-0.3.0/src/cadabby/ports.py +81 -0
  44. cadabby-0.3.0/src/cadabby/vault.py +441 -0
cadabby-0.3.0/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Cadabby 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.
cadabby-0.3.0/PKG-INFO ADDED
@@ -0,0 +1,294 @@
1
+ Metadata-Version: 2.4
2
+ Name: cadabby
3
+ Version: 0.3.0
4
+ Summary: Zero-dependency engine for Karpathy-style LLM Wiki vaults with OKF trust tiers
5
+ Keywords: llm-wiki,knowledge-base,mcp,okf,obsidian,sqlite
6
+ Author: Cadabby Contributors
7
+ Requires-Python: >=3.11
8
+ Description-Content-Type: text/markdown
9
+ Classifier: Programming Language :: Python :: 3
10
+ Classifier: Programming Language :: Python :: 3.11
11
+ Classifier: Programming Language :: Python :: 3.12
12
+ Classifier: Programming Language :: Python :: 3.13
13
+ Classifier: Topic :: Text Processing :: Markup :: Markdown
14
+ Classifier: Topic :: Database
15
+ License-File: LICENSE
16
+ Project-URL: Documentation, https://github.com/bookian/cadabby#readme
17
+ Project-URL: Issues, https://github.com/bookian/cadabby/issues
18
+ Project-URL: Source, https://github.com/bookian/cadabby
19
+
20
+ # Cadabby
21
+
22
+ > **Epistemically Auditable LLM Wiki Engine for Humans & AI Agents**
23
+
24
+ Cadabby is a zero-dependency, local-first engine and Model Context Protocol (MCP) server for maintaining living, high-density knowledge vaults. It enables AI agents (Claude Code, Google Antigravity, OpenHands, etc.) and humans (via Obsidian or CLI) to collaboratively build, cross-reference, and audit knowledge graphs anchored by Open Knowledge Foundation (OKF) epistemic trust tiers.
25
+
26
+ ---
27
+
28
+ ## Key Highlights
29
+
30
+ - **Zero Runtime Dependencies**: Built with 100% pure Python standard library (`CPython >= 3.11`). No pip dependencies.
31
+ - **Multi-Domain Cognitive Architecture**: Partition knowledge into independent cognitive domains (e.g., `customers/`, `projects/`, `wiki/`) governed by localized `AGENTS.md` manifests and schemas.
32
+ - **Disposable SQLite FTS5 Cache**: Ephemeral, high-performance full-text search and 1-hop graph traversals. Delete `.cadabby/cache.db` at any time with zero data loss.
33
+ - **Epistemic Trust Tiers**: Every note carries cryptographically bound attestation (`human-reviewed`, `machine-confirmed`, `stale-verified`, or `unverified`).
34
+ - **Drift-Induced Downgrade**: If an agent or user alters note prose without re-verification, its trust tier automatically downgrades to `stale-verified` (verification debt).
35
+ - **Normative Six-Gate Linting**: Automated validation for schema, layout, link consistency, provenance, graph connectivity, and verification integrity.
36
+ - **Universal Harness Portability**: Works out-of-the-box with Claude Code (`.mcp.json`), Antigravity (native plugin & subagents), and Obsidian.
37
+
38
+ ---
39
+
40
+ ## 1. Installation
41
+
42
+ Cadabby is a command-line application, so install it as a tool rather than as a
43
+ library. Either of these puts `cadabby` on your `PATH` in its own isolated
44
+ environment, leaving your system Python untouched:
45
+
46
+ ```bash
47
+ uv tool install cadabby # recommended
48
+ pipx install cadabby # equivalent
49
+ ```
50
+
51
+ Verify:
52
+
53
+ ```bash
54
+ cadabby --help
55
+ ```
56
+
57
+ > **Why not `pip install`?** It works, but it drops Cadabby into whichever
58
+ > environment happens to be active, which makes the install easy to lose track of
59
+ > and easy to break with an unrelated upgrade. Nothing imports `cadabby` as a
60
+ > library, so there is no reason to put it on an interpreter's import path.
61
+
62
+ Cadabby has **zero runtime dependencies** (pure CPython >= 3.11 standard
63
+ library), so installation never pulls in a transitive dependency tree.
64
+
65
+ ### Contributing
66
+
67
+ Working on Cadabby itself:
68
+
69
+ ```bash
70
+ git clone https://github.com/your-org/cadabby.git
71
+ cd cadabby
72
+ uv sync # or: pip install -e .
73
+ uv run python -m unittest discover -s tests
74
+ ```
75
+
76
+ ---
77
+
78
+ ## 2. Initializing a Vault
79
+
80
+ To scaffold a complete, production-ready knowledge vault:
81
+
82
+ ```bash
83
+ # Initialize a new vault with Obsidian integration:
84
+ cadabby init --vault my-vault --name my-vault --obsidian
85
+ cd my-vault
86
+ ```
87
+
88
+ This creates a standardized 3-layer vault layout:
89
+
90
+ ```
91
+ my-vault/
92
+ ├── .cadabby.json # Vault configuration, trust multipliers & identities
93
+ ├── .mcp.json # Universal MCP server config (for Claude Code, Cursor, etc.)
94
+ ├── AGENTS.md # Canonical constitution / operational rules for all AI agents
95
+ ├── CLAUDE.md # Thin pointer delegating to AGENTS.md
96
+ ├── GEMINI.md # Thin pointer delegating to AGENTS.md
97
+ ├── STYLE.md # Vault-specific prose and citation guidelines
98
+ ├── index.md # Deterministic catalog auto-generated by cadabby
99
+ ├── log.md # Append-only activity ledger
100
+ │
101
+ ├── raw/ # Ground truth sources (PDFs, raw text, research papers)
102
+ │
103
+ ├── wiki/ # Canonical knowledge domain (5 typed subdirectories)
104
+ │ ├── entities/ # Concrete objects, tools, datasets, libraries
105
+ │ ├── concepts/ # Abstract ideas, algorithms, techniques
106
+ │ ├── syntheses/ # Cross-domain integrations and summaries
107
+ │ ├── comparisons/ # Trade-off evaluations (e.g. SQLite-vs-DuckDB)
108
+ │ └── guides/ # Actionable procedures and runbooks
109
+ │
110
+ ├── customers/ # (Optional) Custom cognitive domain
111
+ │ ├── AGENTS.md # Domain constitution & schema rules
112
+ │ └── acme-corp/ # Flexible, unconstrained subdirectory layout
113
+ │
114
+ ├── .agents/skills/ # Reusable skills: librarian and technician
115
+ ├── .claude/commands/ # Claude Code slash commands (/ingest, /vault-status, /vault-lint)
116
+ └── .obsidian/ # (Optional) Pre-tuned Obsidian desktop settings
117
+ ```
118
+
119
+ ---
120
+
121
+ ## 3. How to Use Cadabby
122
+
123
+ ### Workflow A: Using AI Agents (Claude Code, Cursor, Windsurf)
124
+
125
+ 1. **Drop a ground truth document** into `raw/`:
126
+ ```bash
127
+ cp ~/Downloads/attention-paper.pdf raw/attention-paper.pdf
128
+ ```
129
+
130
+ 2. **Start your agent inside the vault directory**:
131
+ ```bash
132
+ claude
133
+ ```
134
+ *Claude Code automatically reads `.mcp.json`, launches `cadabby mcp`, and reads `CLAUDE.md` $\rightarrow$ `AGENTS.md`.*
135
+
136
+ 3. **Interact naturally using slash commands or chat**:
137
+ ```
138
+ > /ingest raw/attention-paper.pdf
139
+ ```
140
+ The agent will:
141
+ - Call `vault_search` to check if related concepts already exist.
142
+ - Call `vault_ground` to inspect existing notes and their 1-hop links.
143
+ - Call `vault_scaffold_note` to draft `wiki/concepts/Flash-Attention.md` citing `raw/attention-paper.pdf`.
144
+ - Add `[[wikilinks]]` to existing notes.
145
+ - Call `vault_verify_note` stamping the note with `agent:claude-code`.
146
+ *(Catalog `index.md` and activity `log.md` are kept up to date implicitly; no manual sync needed).*
147
+
148
+ ### Workflow B: Using Google Antigravity
149
+
150
+ 1. **Install the Antigravity plugin**:
151
+ ```bash
152
+ cadabby install --antigravity
153
+ ```
154
+ 2. Open the vault in Antigravity. The plugin provides:
155
+ - An MCP sidecar running `cadabby mcp`.
156
+ - Two specialized personas:
157
+ - **`@librarian`**: Researches raw sources, checks prior knowledge, scaffolds notes, and resolves links.
158
+ - **`@technician`**: Runs `vault_lint`, verifies cache health, and tracks verification debt.
159
+
160
+ ### Workflow C: Human Reading & Editing (Obsidian & CLI)
161
+
162
+ 1. Open `my-vault/` in **Obsidian**:
163
+ - Wikilinks `[[Note-Stem]]` resolve automatically across subdirectories.
164
+ - `index.md` acts as your curated table of contents.
165
+ 2. **Review and certify notes**:
166
+ When a human inspects a note and certifies its accuracy:
167
+ ```bash
168
+ cadabby verify wiki/concepts/Flash-Attention --human
169
+ ```
170
+ *This binds the attestation to the exact `sha256` of the note body and upgrades its trust tier to `human-reviewed` ($2.0\times$ search boost).*
171
+ 3. **If anyone edits the note body**:
172
+ Cadabby automatically detects the SHA-256 mismatch and demotes the note to `stale-verified` (verification debt), prompting re-review.
173
+
174
+ ---
175
+
176
+ ## 4. Cognitive Domains & Domain Manifests
177
+
178
+ Cadabby supports modular, multi-domain knowledge architectures. While `wiki/` serves as the canonical knowledge base with strictly enforced 5-type directory structures, you can partition knowledge into independent **Cognitive Domains** simply by creating top-level directories (e.g. `customers/`, `projects/`, `research/`, `team/`).
179
+
180
+ ### Creating a Cognitive Domain with `AGENTS.md`
181
+
182
+ Drop an `AGENTS.md` file into the root of any top-level domain folder to configure validation schemas and define agent directives:
183
+
184
+ ```markdown
185
+ ---
186
+ description: Customer accounts, CRM dossiers, and stakeholders
187
+ searchable: true
188
+ schema:
189
+ allowed_types:
190
+ - account
191
+ - stakeholder
192
+ - interaction
193
+ require_sources: false
194
+ enforce_layout: false
195
+ ---
196
+
197
+ # Customers Domain Directives
198
+
199
+ 1. Every customer note must include account tier and primary contact.
200
+ 2. Link stakeholder profiles using `[[Stakeholder-Name]]`.
201
+ 3. Do not store sensitive secrets or credentials in dossiers.
202
+ ```
203
+
204
+ ### Manifest Configuration Options
205
+
206
+ | Field | Type | Default | Purpose |
207
+ | :--- | :---: | :---: | :--- |
208
+ | `description` | string | `"<Domain> domain"` | Human-readable domain description. |
209
+ | `searchable` | bool | `true` | Whether notes in this domain are indexed and returned in `vault_search`. |
210
+ | `schema.allowed_types` | list[str] | `null` (unrestricted) | Allowed `type:` values in frontmatter. Violations trigger `ENUM_INVALID` in `cadabby lint`. |
211
+ | `schema.require_sources`| bool | `false` | When `true`, notes in this domain must specify non-empty `sources: [...]`. |
212
+ | `schema.enforce_layout` | bool | `false` | When `true`, notes must live in a subfolder matching their `type` (like in `wiki/`). When `false`, arbitrary directory nesting is permitted. |
213
+
214
+ ### Permissive vs. Strict Domains
215
+ - **Permissive Domains** (no `AGENTS.md` or `allowed_types: null`): Any non-empty note type and any folder hierarchy are allowed without triggering lint errors.
216
+ - **Strict Domains** (`allowed_types` specified): Linter enforces valid types, while allowing cross-domain wikilinks (`[[Note-Stem]]`) to resolve smoothly across all domains.
217
+
218
+ ### How AI Agents Consume Domain Directives
219
+ - **MCP Resources**: Cadabby exposes `vault://domains` (inventory of all discovered domains) and `domain://{name}/directives` (the markdown body of `{domain}/AGENTS.md`).
220
+ - **Grounding Enrichment**: When an agent calls `vault_ground` on a note, Cadabby automatically embeds the note's domain definition and localized directives into the response payload.
221
+
222
+ ---
223
+
224
+ ## 5. MCP Architecture (7 Tools & 2 Resources)
225
+
226
+ Conforming to §5.1-§5.2 of the Technical Specification, Cadabby exposes exactly **7 atomic tools** and **2 dynamic resources** to AI agents:
227
+
228
+ ### Atomic Tools
229
+
230
+ | Tool | Purpose |
231
+ | :--- | :--- |
232
+ | **`vault_search`** | Epistemic BM25 full-text search with trust tier boosts, domain filters, and status multipliers. |
233
+ | **`vault_ground`** | Retrieves full content, localized domain directives, and 1-hop graph neighborhood (links, backlinks, sources). |
234
+ | **`vault_status`** | Epistemic health snapshot: tier counts, domain breakdown, verification debt, and unprocessed `raw/` files. |
235
+ | **`vault_scaffold_note`** | Scaffolds a new typed note in any domain with valid OKF frontmatter and generated attribution. |
236
+ | **`vault_update_note`** | Non-destructive frontmatter patch, section append, or section replace with optimistic lock. |
237
+ | **`vault_verify_note`** | Cryptographically binds an `agent:<client_id>` attestation to the body SHA-256 (refuses `human:*`). |
238
+ | **`vault_lint`** | Runs the six normative epistemic lint gates and returns typed diagnostics for self-healing. |
239
+
240
+ ### Dynamic Resources
241
+
242
+ | Resource URI | MIME Type | Description |
243
+ | :--- | :--- | :--- |
244
+ | **`vault://domains`** | `application/json` | Real-time inventory of all discovered cognitive domains, descriptions, and schema flags. |
245
+ | **`domain://{domain}/directives`** | `text/markdown` | Localized operational instructions and guidelines from `{domain}/AGENTS.md`. |
246
+
247
+ ---
248
+
249
+ ## 6. CLI Command Reference
250
+
251
+ | Command | Description | Example |
252
+ | :--- | :--- | :--- |
253
+ | `cadabby init` | Scaffold a new vault with all config & skills | `cadabby init --vault my-vault --obsidian` |
254
+ | `cadabby sync` | Scan files, update SQLite cache & rebuild `index.md` | `cadabby sync` |
255
+ | `cadabby status` | Report note counts, trust tiers, and verification debt | `cadabby status` |
256
+ | `cadabby search` | Epistemic BM25 search with trust boosts & domain filters | `cadabby search "attention mechanism" --domain wiki` |
257
+ | `cadabby ground` | Retrieve note content and 1-hop neighborhood | `cadabby ground wiki/concepts/Attention` |
258
+ | `cadabby scaffold` | Scaffold a new typed note in any domain | `cadabby scaffold "Transformer" --type concept --domain wiki --desc "Attention model"` |
259
+ | `cadabby update` | Patch frontmatter or append/replace sections | `cadabby update wiki/concepts/Transformer --replace-section "Overview:New text"` |
260
+ | `cadabby verify` | Stamp cryptographic attestation on note | `cadabby verify wiki/concepts/Transformer --human` |
261
+ | `cadabby lint` | Run the six normative epistemic linting gates across all domains | `cadabby lint` |
262
+ | `cadabby audit` | Check Git blame provenance of human attestations | `cadabby audit --require-signed` |
263
+ | `cadabby mcp` | Launch the JSON-RPC 2.0 stdio MCP server | `cadabby mcp` |
264
+ | `cadabby install` | Register MCP configs in Antigravity or Claude Code | `cadabby install --antigravity` |
265
+
266
+ ---
267
+
268
+ ## 7. Epistemic Trust Tiers
269
+
270
+ | Tier | Multiplier | Description |
271
+ | :--- | :---: | :--- |
272
+ | `human-reviewed` | **$2.0\times$** | Certified by a validated human reviewer. Body matches `sha256`. |
273
+ | `machine-confirmed` | **$1.0\times$** | Synthesized and verified by an automated AI agent. |
274
+ | `stale-verified` | **$0.8\times$** | Previously verified, but note prose drifted without re-review (verification debt). |
275
+ | `unverified` | **$0.5\times$** | Newly drafted or imported without verification. |
276
+
277
+ Status multipliers apply on top of trust tiers:
278
+ - `evergreen`: **$1.1\times$**
279
+ - `active`: **$1.0\times$**
280
+ - `draft`: **$0.7\times$**
281
+ - `deprecated`: **$0.3\times$**
282
+ - `stub`: **$0.2\times$**
283
+
284
+ ---
285
+
286
+ ## 8. Development & Testing
287
+
288
+ ```bash
289
+ # Run all unit and integration tests (105 tests):
290
+ PYTHONPATH=src python3 -m unittest discover -s tests -v
291
+ ```
292
+
293
+ All 12 falsifiable acceptance criteria from §10 are validated in `tests/test_acceptance.py`.
294
+
@@ -0,0 +1,274 @@
1
+ # Cadabby
2
+
3
+ > **Epistemically Auditable LLM Wiki Engine for Humans & AI Agents**
4
+
5
+ Cadabby is a zero-dependency, local-first engine and Model Context Protocol (MCP) server for maintaining living, high-density knowledge vaults. It enables AI agents (Claude Code, Google Antigravity, OpenHands, etc.) and humans (via Obsidian or CLI) to collaboratively build, cross-reference, and audit knowledge graphs anchored by Open Knowledge Foundation (OKF) epistemic trust tiers.
6
+
7
+ ---
8
+
9
+ ## Key Highlights
10
+
11
+ - **Zero Runtime Dependencies**: Built with 100% pure Python standard library (`CPython >= 3.11`). No pip dependencies.
12
+ - **Multi-Domain Cognitive Architecture**: Partition knowledge into independent cognitive domains (e.g., `customers/`, `projects/`, `wiki/`) governed by localized `AGENTS.md` manifests and schemas.
13
+ - **Disposable SQLite FTS5 Cache**: Ephemeral, high-performance full-text search and 1-hop graph traversals. Delete `.cadabby/cache.db` at any time with zero data loss.
14
+ - **Epistemic Trust Tiers**: Every note carries cryptographically bound attestation (`human-reviewed`, `machine-confirmed`, `stale-verified`, or `unverified`).
15
+ - **Drift-Induced Downgrade**: If an agent or user alters note prose without re-verification, its trust tier automatically downgrades to `stale-verified` (verification debt).
16
+ - **Normative Six-Gate Linting**: Automated validation for schema, layout, link consistency, provenance, graph connectivity, and verification integrity.
17
+ - **Universal Harness Portability**: Works out-of-the-box with Claude Code (`.mcp.json`), Antigravity (native plugin & subagents), and Obsidian.
18
+
19
+ ---
20
+
21
+ ## 1. Installation
22
+
23
+ Cadabby is a command-line application, so install it as a tool rather than as a
24
+ library. Either of these puts `cadabby` on your `PATH` in its own isolated
25
+ environment, leaving your system Python untouched:
26
+
27
+ ```bash
28
+ uv tool install cadabby # recommended
29
+ pipx install cadabby # equivalent
30
+ ```
31
+
32
+ Verify:
33
+
34
+ ```bash
35
+ cadabby --help
36
+ ```
37
+
38
+ > **Why not `pip install`?** It works, but it drops Cadabby into whichever
39
+ > environment happens to be active, which makes the install easy to lose track of
40
+ > and easy to break with an unrelated upgrade. Nothing imports `cadabby` as a
41
+ > library, so there is no reason to put it on an interpreter's import path.
42
+
43
+ Cadabby has **zero runtime dependencies** (pure CPython >= 3.11 standard
44
+ library), so installation never pulls in a transitive dependency tree.
45
+
46
+ ### Contributing
47
+
48
+ Working on Cadabby itself:
49
+
50
+ ```bash
51
+ git clone https://github.com/your-org/cadabby.git
52
+ cd cadabby
53
+ uv sync # or: pip install -e .
54
+ uv run python -m unittest discover -s tests
55
+ ```
56
+
57
+ ---
58
+
59
+ ## 2. Initializing a Vault
60
+
61
+ To scaffold a complete, production-ready knowledge vault:
62
+
63
+ ```bash
64
+ # Initialize a new vault with Obsidian integration:
65
+ cadabby init --vault my-vault --name my-vault --obsidian
66
+ cd my-vault
67
+ ```
68
+
69
+ This creates a standardized 3-layer vault layout:
70
+
71
+ ```
72
+ my-vault/
73
+ ├── .cadabby.json # Vault configuration, trust multipliers & identities
74
+ ├── .mcp.json # Universal MCP server config (for Claude Code, Cursor, etc.)
75
+ ├── AGENTS.md # Canonical constitution / operational rules for all AI agents
76
+ ├── CLAUDE.md # Thin pointer delegating to AGENTS.md
77
+ ├── GEMINI.md # Thin pointer delegating to AGENTS.md
78
+ ├── STYLE.md # Vault-specific prose and citation guidelines
79
+ ├── index.md # Deterministic catalog auto-generated by cadabby
80
+ ├── log.md # Append-only activity ledger
81
+ │
82
+ ├── raw/ # Ground truth sources (PDFs, raw text, research papers)
83
+ │
84
+ ├── wiki/ # Canonical knowledge domain (5 typed subdirectories)
85
+ │ ├── entities/ # Concrete objects, tools, datasets, libraries
86
+ │ ├── concepts/ # Abstract ideas, algorithms, techniques
87
+ │ ├── syntheses/ # Cross-domain integrations and summaries
88
+ │ ├── comparisons/ # Trade-off evaluations (e.g. SQLite-vs-DuckDB)
89
+ │ └── guides/ # Actionable procedures and runbooks
90
+ │
91
+ ├── customers/ # (Optional) Custom cognitive domain
92
+ │ ├── AGENTS.md # Domain constitution & schema rules
93
+ │ └── acme-corp/ # Flexible, unconstrained subdirectory layout
94
+ │
95
+ ├── .agents/skills/ # Reusable skills: librarian and technician
96
+ ├── .claude/commands/ # Claude Code slash commands (/ingest, /vault-status, /vault-lint)
97
+ └── .obsidian/ # (Optional) Pre-tuned Obsidian desktop settings
98
+ ```
99
+
100
+ ---
101
+
102
+ ## 3. How to Use Cadabby
103
+
104
+ ### Workflow A: Using AI Agents (Claude Code, Cursor, Windsurf)
105
+
106
+ 1. **Drop a ground truth document** into `raw/`:
107
+ ```bash
108
+ cp ~/Downloads/attention-paper.pdf raw/attention-paper.pdf
109
+ ```
110
+
111
+ 2. **Start your agent inside the vault directory**:
112
+ ```bash
113
+ claude
114
+ ```
115
+ *Claude Code automatically reads `.mcp.json`, launches `cadabby mcp`, and reads `CLAUDE.md` $\rightarrow$ `AGENTS.md`.*
116
+
117
+ 3. **Interact naturally using slash commands or chat**:
118
+ ```
119
+ > /ingest raw/attention-paper.pdf
120
+ ```
121
+ The agent will:
122
+ - Call `vault_search` to check if related concepts already exist.
123
+ - Call `vault_ground` to inspect existing notes and their 1-hop links.
124
+ - Call `vault_scaffold_note` to draft `wiki/concepts/Flash-Attention.md` citing `raw/attention-paper.pdf`.
125
+ - Add `[[wikilinks]]` to existing notes.
126
+ - Call `vault_verify_note` stamping the note with `agent:claude-code`.
127
+ *(Catalog `index.md` and activity `log.md` are kept up to date implicitly; no manual sync needed).*
128
+
129
+ ### Workflow B: Using Google Antigravity
130
+
131
+ 1. **Install the Antigravity plugin**:
132
+ ```bash
133
+ cadabby install --antigravity
134
+ ```
135
+ 2. Open the vault in Antigravity. The plugin provides:
136
+ - An MCP sidecar running `cadabby mcp`.
137
+ - Two specialized personas:
138
+ - **`@librarian`**: Researches raw sources, checks prior knowledge, scaffolds notes, and resolves links.
139
+ - **`@technician`**: Runs `vault_lint`, verifies cache health, and tracks verification debt.
140
+
141
+ ### Workflow C: Human Reading & Editing (Obsidian & CLI)
142
+
143
+ 1. Open `my-vault/` in **Obsidian**:
144
+ - Wikilinks `[[Note-Stem]]` resolve automatically across subdirectories.
145
+ - `index.md` acts as your curated table of contents.
146
+ 2. **Review and certify notes**:
147
+ When a human inspects a note and certifies its accuracy:
148
+ ```bash
149
+ cadabby verify wiki/concepts/Flash-Attention --human
150
+ ```
151
+ *This binds the attestation to the exact `sha256` of the note body and upgrades its trust tier to `human-reviewed` ($2.0\times$ search boost).*
152
+ 3. **If anyone edits the note body**:
153
+ Cadabby automatically detects the SHA-256 mismatch and demotes the note to `stale-verified` (verification debt), prompting re-review.
154
+
155
+ ---
156
+
157
+ ## 4. Cognitive Domains & Domain Manifests
158
+
159
+ Cadabby supports modular, multi-domain knowledge architectures. While `wiki/` serves as the canonical knowledge base with strictly enforced 5-type directory structures, you can partition knowledge into independent **Cognitive Domains** simply by creating top-level directories (e.g. `customers/`, `projects/`, `research/`, `team/`).
160
+
161
+ ### Creating a Cognitive Domain with `AGENTS.md`
162
+
163
+ Drop an `AGENTS.md` file into the root of any top-level domain folder to configure validation schemas and define agent directives:
164
+
165
+ ```markdown
166
+ ---
167
+ description: Customer accounts, CRM dossiers, and stakeholders
168
+ searchable: true
169
+ schema:
170
+ allowed_types:
171
+ - account
172
+ - stakeholder
173
+ - interaction
174
+ require_sources: false
175
+ enforce_layout: false
176
+ ---
177
+
178
+ # Customers Domain Directives
179
+
180
+ 1. Every customer note must include account tier and primary contact.
181
+ 2. Link stakeholder profiles using `[[Stakeholder-Name]]`.
182
+ 3. Do not store sensitive secrets or credentials in dossiers.
183
+ ```
184
+
185
+ ### Manifest Configuration Options
186
+
187
+ | Field | Type | Default | Purpose |
188
+ | :--- | :---: | :---: | :--- |
189
+ | `description` | string | `"<Domain> domain"` | Human-readable domain description. |
190
+ | `searchable` | bool | `true` | Whether notes in this domain are indexed and returned in `vault_search`. |
191
+ | `schema.allowed_types` | list[str] | `null` (unrestricted) | Allowed `type:` values in frontmatter. Violations trigger `ENUM_INVALID` in `cadabby lint`. |
192
+ | `schema.require_sources`| bool | `false` | When `true`, notes in this domain must specify non-empty `sources: [...]`. |
193
+ | `schema.enforce_layout` | bool | `false` | When `true`, notes must live in a subfolder matching their `type` (like in `wiki/`). When `false`, arbitrary directory nesting is permitted. |
194
+
195
+ ### Permissive vs. Strict Domains
196
+ - **Permissive Domains** (no `AGENTS.md` or `allowed_types: null`): Any non-empty note type and any folder hierarchy are allowed without triggering lint errors.
197
+ - **Strict Domains** (`allowed_types` specified): Linter enforces valid types, while allowing cross-domain wikilinks (`[[Note-Stem]]`) to resolve smoothly across all domains.
198
+
199
+ ### How AI Agents Consume Domain Directives
200
+ - **MCP Resources**: Cadabby exposes `vault://domains` (inventory of all discovered domains) and `domain://{name}/directives` (the markdown body of `{domain}/AGENTS.md`).
201
+ - **Grounding Enrichment**: When an agent calls `vault_ground` on a note, Cadabby automatically embeds the note's domain definition and localized directives into the response payload.
202
+
203
+ ---
204
+
205
+ ## 5. MCP Architecture (7 Tools & 2 Resources)
206
+
207
+ Conforming to §5.1-§5.2 of the Technical Specification, Cadabby exposes exactly **7 atomic tools** and **2 dynamic resources** to AI agents:
208
+
209
+ ### Atomic Tools
210
+
211
+ | Tool | Purpose |
212
+ | :--- | :--- |
213
+ | **`vault_search`** | Epistemic BM25 full-text search with trust tier boosts, domain filters, and status multipliers. |
214
+ | **`vault_ground`** | Retrieves full content, localized domain directives, and 1-hop graph neighborhood (links, backlinks, sources). |
215
+ | **`vault_status`** | Epistemic health snapshot: tier counts, domain breakdown, verification debt, and unprocessed `raw/` files. |
216
+ | **`vault_scaffold_note`** | Scaffolds a new typed note in any domain with valid OKF frontmatter and generated attribution. |
217
+ | **`vault_update_note`** | Non-destructive frontmatter patch, section append, or section replace with optimistic lock. |
218
+ | **`vault_verify_note`** | Cryptographically binds an `agent:<client_id>` attestation to the body SHA-256 (refuses `human:*`). |
219
+ | **`vault_lint`** | Runs the six normative epistemic lint gates and returns typed diagnostics for self-healing. |
220
+
221
+ ### Dynamic Resources
222
+
223
+ | Resource URI | MIME Type | Description |
224
+ | :--- | :--- | :--- |
225
+ | **`vault://domains`** | `application/json` | Real-time inventory of all discovered cognitive domains, descriptions, and schema flags. |
226
+ | **`domain://{domain}/directives`** | `text/markdown` | Localized operational instructions and guidelines from `{domain}/AGENTS.md`. |
227
+
228
+ ---
229
+
230
+ ## 6. CLI Command Reference
231
+
232
+ | Command | Description | Example |
233
+ | :--- | :--- | :--- |
234
+ | `cadabby init` | Scaffold a new vault with all config & skills | `cadabby init --vault my-vault --obsidian` |
235
+ | `cadabby sync` | Scan files, update SQLite cache & rebuild `index.md` | `cadabby sync` |
236
+ | `cadabby status` | Report note counts, trust tiers, and verification debt | `cadabby status` |
237
+ | `cadabby search` | Epistemic BM25 search with trust boosts & domain filters | `cadabby search "attention mechanism" --domain wiki` |
238
+ | `cadabby ground` | Retrieve note content and 1-hop neighborhood | `cadabby ground wiki/concepts/Attention` |
239
+ | `cadabby scaffold` | Scaffold a new typed note in any domain | `cadabby scaffold "Transformer" --type concept --domain wiki --desc "Attention model"` |
240
+ | `cadabby update` | Patch frontmatter or append/replace sections | `cadabby update wiki/concepts/Transformer --replace-section "Overview:New text"` |
241
+ | `cadabby verify` | Stamp cryptographic attestation on note | `cadabby verify wiki/concepts/Transformer --human` |
242
+ | `cadabby lint` | Run the six normative epistemic linting gates across all domains | `cadabby lint` |
243
+ | `cadabby audit` | Check Git blame provenance of human attestations | `cadabby audit --require-signed` |
244
+ | `cadabby mcp` | Launch the JSON-RPC 2.0 stdio MCP server | `cadabby mcp` |
245
+ | `cadabby install` | Register MCP configs in Antigravity or Claude Code | `cadabby install --antigravity` |
246
+
247
+ ---
248
+
249
+ ## 7. Epistemic Trust Tiers
250
+
251
+ | Tier | Multiplier | Description |
252
+ | :--- | :---: | :--- |
253
+ | `human-reviewed` | **$2.0\times$** | Certified by a validated human reviewer. Body matches `sha256`. |
254
+ | `machine-confirmed` | **$1.0\times$** | Synthesized and verified by an automated AI agent. |
255
+ | `stale-verified` | **$0.8\times$** | Previously verified, but note prose drifted without re-review (verification debt). |
256
+ | `unverified` | **$0.5\times$** | Newly drafted or imported without verification. |
257
+
258
+ Status multipliers apply on top of trust tiers:
259
+ - `evergreen`: **$1.1\times$**
260
+ - `active`: **$1.0\times$**
261
+ - `draft`: **$0.7\times$**
262
+ - `deprecated`: **$0.3\times$**
263
+ - `stub`: **$0.2\times$**
264
+
265
+ ---
266
+
267
+ ## 8. Development & Testing
268
+
269
+ ```bash
270
+ # Run all unit and integration tests (105 tests):
271
+ PYTHONPATH=src python3 -m unittest discover -s tests -v
272
+ ```
273
+
274
+ All 12 falsifiable acceptance criteria from §10 are validated in `tests/test_acceptance.py`.
@@ -0,0 +1,32 @@
1
+ [build-system]
2
+ requires = ["flit_core >=3.2,<4"]
3
+ build-backend = "flit_core.buildapi"
4
+
5
+ [project]
6
+ name = "cadabby"
7
+ version = "0.3.0"
8
+ description = "Zero-dependency engine for Karpathy-style LLM Wiki vaults with OKF trust tiers"
9
+ readme = "README.md"
10
+ requires-python = ">=3.11"
11
+ license = {file = "LICENSE"}
12
+ authors = [
13
+ {name = "Cadabby Contributors"}
14
+ ]
15
+ keywords = ["llm-wiki", "knowledge-base", "mcp", "okf", "obsidian", "sqlite"]
16
+ classifiers = [
17
+ "Programming Language :: Python :: 3",
18
+ "Programming Language :: Python :: 3.11",
19
+ "Programming Language :: Python :: 3.12",
20
+ "Programming Language :: Python :: 3.13",
21
+ "Topic :: Text Processing :: Markup :: Markdown",
22
+ "Topic :: Database",
23
+ ]
24
+ dependencies = []
25
+
26
+ [project.scripts]
27
+ cadabby = "cadabby.cli:main"
28
+
29
+ [project.urls]
30
+ Documentation = "https://github.com/bookian/cadabby#readme"
31
+ Issues = "https://github.com/bookian/cadabby/issues"
32
+ Source = "https://github.com/bookian/cadabby"
@@ -0,0 +1,3 @@
1
+ """Cadabby: Zero-dependency engine for Karpathy-style LLM Wiki vaults with OKF trust tiers."""
2
+
3
+ __version__ = "0.3.0"
@@ -0,0 +1,8 @@
1
+ """Package entry point for python -m cadabby."""
2
+
3
+ from __future__ import annotations
4
+
5
+ from cadabby.cli import main
6
+
7
+ if __name__ == "__main__":
8
+ main()
@@ -0,0 +1,11 @@
1
+ """Adapters implementing Cadabby driven and driving ports."""
2
+
3
+ from cadabby.adapters.disk_storage import DiskNoteStorage, FileLedger
4
+ from cadabby.adapters.memory_storage import InMemoryLedger, InMemoryNoteStorage
5
+
6
+ __all__ = [
7
+ "DiskNoteStorage",
8
+ "FileLedger",
9
+ "InMemoryLedger",
10
+ "InMemoryNoteStorage",
11
+ ]