Skip to content

Commit 12dc398

Browse files
docs(vault): update all docs for v1.0 API (trust_tier, upsert, get_multiple)
- Rename trust= to trust_tier= in all code examples across 9 docs + README - Rename trust_min to min_trust_tier in api-reference search() signature - Add upsert() and get_multiple() to api-reference - Add migration, deployment, troubleshooting to docs/index.md - Fix migration.md before/after examples (were clobbered by sed) - Document get_content() quarantine behavior
1 parent 3f350b7 commit 12dc398

File tree

9 files changed

+64
-39
lines changed

9 files changed

+64
-39
lines changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,7 @@ vault = Vault("./my-knowledge")
165165

166166
# Add with trust tiers
167167
vault.add("Incident response: acknowledge within 15 minutes...",
168-
name="sop-incident.md", trust="canonical")
168+
name="sop-incident.md", trust_tier="canonical")
169169

170170
# Trust-weighted search (deduplicated, with freshness decay)
171171
results = vault.search("incident response")
@@ -205,7 +205,7 @@ vault = Vault("./knowledge", role="admin") # + export, import, config
205205
### Batch Import
206206

207207
```python
208-
resources = vault.add_batch(["doc1.md", "doc2.md", "doc3.md"], trust="working")
208+
resources = vault.add_batch(["doc1.md", "doc2.md", "doc3.md"], trust_tier="working")
209209
```
210210

211211
### Memory Layers

docs/api-reference.md

Lines changed: 33 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ vault.add(
4444
source: str | Path | bytes,
4545
*,
4646
name: str | None = None,
47-
trust: TrustTier | str = "working",
47+
trust_tier: TrustTier | str = "working",
4848
classification: DataClassification | str = "internal",
4949
layer: MemoryLayer | str | None = None,
5050
collection: str | None = None,
@@ -67,7 +67,7 @@ Content is screened by the Membrane pipeline before indexing. Flagged content is
6767
vault.add_batch(
6868
sources: list[str | Path | bytes],
6969
*,
70-
trust: TrustTier | str = "working",
70+
trust_tier: TrustTier | str = "working",
7171
tenant_id: str | None = None,
7272
**kwargs,
7373
) -> list[Resource]
@@ -81,13 +81,23 @@ vault.add_batch(
8181
vault.get(resource_id: str) -> Resource
8282
```
8383

84+
### get_multiple()
85+
86+
```python
87+
vault.get_multiple(resource_ids: list[str]) -> list[Resource]
88+
```
89+
90+
Batch retrieval in a single query. Missing IDs are silently omitted.
91+
92+
<!-- VERIFIED: vault.py:473-485 -->
93+
8494
### get_content()
8595

8696
```python
8797
vault.get_content(resource_id: str) -> str
8898
```
8999

90-
Reassembles chunks in order to return the full text content.
100+
Reassembles chunks in order to return the full text content. Quarantined resources raise `VaultError`.
91101

92102
<!-- VERIFIED: vault.py:406-420 -->
93103

@@ -97,7 +107,7 @@ Reassembles chunks in order to return the full text content.
97107
vault.list(
98108
*,
99109
tenant_id: str | None = None,
100-
trust: TrustTier | str | None = None,
110+
trust_tier: TrustTier | str | None = None,
101111
classification: DataClassification | str | None = None,
102112
layer: MemoryLayer | str | None = None,
103113
collection: str | None = None,
@@ -118,7 +128,7 @@ vault.update(
118128
resource_id: str,
119129
*,
120130
name: str | None = None,
121-
trust: TrustTier | str | None = None,
131+
trust_tier: TrustTier | str | None = None,
122132
classification: DataClassification | str | None = None,
123133
tags: list[str] | None = None,
124134
metadata: dict[str, Any] | None = None,
@@ -146,6 +156,23 @@ Creates a new resource with the new content and supersedes the old one. Returns
146156

147157
<!-- VERIFIED: vault.py:422-464 -->
148158

159+
### upsert()
160+
161+
```python
162+
vault.upsert(
163+
source: str | Path | bytes,
164+
*,
165+
name: str | None = None,
166+
trust_tier: TrustTier | str = "working",
167+
tenant_id: str | None = None,
168+
**kwargs,
169+
) -> Resource
170+
```
171+
172+
Add-or-replace atomically. If a resource with the same name and tenant exists, supersedes it. Otherwise creates new.
173+
174+
<!-- VERIFIED: vault.py:562-611 -->
175+
149176
---
150177

151178
## Search
@@ -160,7 +187,7 @@ vault.search(
160187
top_k: int = 10,
161188
offset: int = 0, # Pagination
162189
threshold: float = 0.0,
163-
trust_min: TrustTier | str | None = None,
190+
min_trust_tier: TrustTier | str | None = None,
164191
layer: MemoryLayer | str | None = None,
165192
collection: str | None = None,
166193
as_of: date | None = None, # Point-in-time

docs/getting-started.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -55,16 +55,16 @@ Creates `./my-knowledge/` with SQLite database and audit log. No configuration r
5555
```python
5656
# From text
5757
vault.add("Incident response: acknowledge within 15 minutes...",
58-
name="sop-incident.md", trust="canonical")
58+
name="sop-incident.md", trust_tier="canonical")
5959

6060
# From a file
61-
vault.add("path/to/report.pdf", trust="working")
61+
vault.add("path/to/report.pdf", trust_tier="working")
6262

6363
# With tenant isolation
6464
vault.add("Tenant-specific content", tenant_id="site-123")
6565

6666
# Batch add
67-
vault.add_batch(["doc1.md", "doc2.md", "doc3.md"], trust="working")
67+
vault.add_batch(["doc1.md", "doc2.md", "doc3.md"], trust_tier="working")
6868
```
6969

7070
Resources are automatically: chunked, hashed (SHA3-256), screened by Membrane, indexed, and audited.

docs/index.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,14 +21,17 @@ Governed knowledge store for autonomous organizations. Every fact has provenance
2121
| [Streaming & Telemetry](streaming-and-telemetry.md) | Real-time events, operation metrics |
2222
| [CLI Reference](cli.md) | All 15 commands |
2323
| [FastAPI Integration](fastapi.md) | 22+ REST endpoints |
24+
| [Migration Guide](migration.md) | Breaking changes from v0.x to v1.0 |
25+
| [Deployment Guide](deployment.md) | PostgreSQL, SSL, encryption, production checklist |
26+
| [Troubleshooting](troubleshooting.md) | Error codes (VAULT_000-700), common issues |
2427

2528
## Quick Start
2629

2730
```python
2831
from qp_vault import Vault
2932

3033
vault = Vault("./my-knowledge")
31-
vault.add("quarterly-report.pdf", trust="canonical")
34+
vault.add("quarterly-report.pdf", trust_tier="canonical")
3235
results = vault.search("Q3 revenue projections")
3336
print(results[0].content, results[0].trust_tier)
3437
```

docs/lifecycle.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ vault = Vault("./knowledge")
4343
policy = vault.add(
4444
"Security policy for remote access...",
4545
name="security-policy-v2.md",
46-
trust="canonical",
46+
trust_tier="canonical",
4747
lifecycle="draft",
4848
)
4949

@@ -69,8 +69,8 @@ except LifecycleError as e:
6969
When a newer version replaces an older one:
7070

7171
```python
72-
v1 = vault.add("Policy v1", name="policy-v1.md", trust="canonical")
73-
v2 = vault.add("Policy v2 with PQ crypto", name="policy-v2.md", trust="canonical")
72+
v1 = vault.add("Policy v1", name="policy-v1.md", trust_tier="canonical")
73+
v2 = vault.add("Policy v2 with PQ crypto", name="policy-v2.md", trust_tier="canonical")
7474

7575
# Supersede: v1 -> SUPERSEDED, linked to v2
7676
old, new = vault.supersede(v1.id, v2.id)
@@ -108,7 +108,7 @@ from datetime import date
108108
vault.add(
109109
"Q4 2025 budget allocation",
110110
name="budget-q4-2025.md",
111-
trust="canonical",
111+
trust_tier="canonical",
112112
valid_from=date(2025, 10, 1),
113113
valid_until=date(2025, 12, 31),
114114
)

docs/memory-layers.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -37,16 +37,16 @@ vault.add("SOC2 Type II audit completed 2025-12-15",
3737
Get a scoped view that auto-applies layer defaults:
3838

3939
```python
40-
# OPERATIONAL: adds with trust=WORKING by default
40+
# OPERATIONAL: adds with trust_tier=WORKING by default
4141
ops = vault.layer(MemoryLayer.OPERATIONAL)
4242
await ops.add("runbook-content", name="runbook.md")
43-
# Equivalent to: vault.add(..., trust="working", layer="operational")
43+
# Equivalent to: vault.add(..., trust_tier="working", layer="operational")
4444

45-
# STRATEGIC: adds with trust=CANONICAL by default
45+
# STRATEGIC: adds with trust_tier=CANONICAL by default
4646
strategic = vault.layer(MemoryLayer.STRATEGIC)
4747
await strategic.add("architecture decision", name="adr.md")
4848

49-
# COMPLIANCE: adds with trust=CANONICAL, and every search is audited
49+
# COMPLIANCE: adds with trust_tier=CANONICAL, and every search is audited
5050
compliance = vault.layer(MemoryLayer.COMPLIANCE)
5151
await compliance.add("audit evidence", name="audit.pdf")
5252
results = await compliance.search("SOC2")
@@ -103,12 +103,12 @@ from qp_vault.config import VaultConfig, LayerDefaults
103103
config = VaultConfig(
104104
layer_defaults={
105105
"operational": LayerDefaults(
106-
trust="working",
106+
trust_tier="working",
107107
half_life_days=60, # Faster freshness decay
108108
search_boost=2.0, # Higher priority in search
109109
),
110110
"compliance": LayerDefaults(
111-
trust="canonical",
111+
trust_tier="canonical",
112112
retention="permanent",
113113
audit_reads=True,
114114
),

docs/migration.md

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,12 @@ qp-vault 1.0 locks the API. Three parameter renames are the only breaking change
99
Affects: `add()`, `list()`, `update()`, `add_batch()`, `replace()`.
1010

1111
```python
12-
# Before (v0.16 and earlier)
12+
# v0.x (old)
1313
vault.add("document.pdf", trust="canonical")
1414
vault.list(trust="working")
1515
vault.update(resource_id, trust="canonical")
1616

17-
# After (v1.0)
17+
# v1.0 (new)
1818
vault.add("document.pdf", trust_tier="canonical")
1919
vault.list(trust_tier="working")
2020
vault.update(resource_id, trust_tier="canonical")
@@ -25,10 +25,10 @@ vault.update(resource_id, trust_tier="canonical")
2525
Affects: `search()`, `search_with_facets()`.
2626

2727
```python
28-
# Before
28+
# v0.x (old)
2929
results = vault.search("query", trust_min="working")
3030

31-
# After
31+
# v1.0 (new)
3232
results = vault.search("query", min_trust_tier="working")
3333
```
3434

@@ -37,14 +37,12 @@ results = vault.search("query", min_trust_tier="working")
3737
Affects: VaultConfig TOML files and programmatic config.
3838

3939
```python
40-
# Before
41-
from qp_vault.config import VaultConfig, LayerDefaults
42-
40+
# v0.x (old)
4341
config = VaultConfig(layer_defaults={
4442
"operational": LayerDefaults(trust="working"),
4543
})
4644

47-
# After
45+
# v1.0 (new)
4846
config = VaultConfig(layer_defaults={
4947
"operational": LayerDefaults(trust_tier="working"),
5048
})
@@ -55,14 +53,11 @@ config = VaultConfig(layer_defaults={
5553
For most codebases, a find-and-replace handles it:
5654

5755
```bash
58-
# Parameter renames
5956
sed -i 's/trust="canonical"/trust_tier="canonical"/g' your_code.py
6057
sed -i 's/trust="working"/trust_tier="working"/g' your_code.py
6158
sed -i 's/trust="ephemeral"/trust_tier="ephemeral"/g' your_code.py
6259
sed -i 's/trust="archived"/trust_tier="archived"/g' your_code.py
6360
sed -i 's/trust_min=/min_trust_tier=/g' your_code.py
64-
65-
# Config field
6661
sed -i 's/LayerDefaults(trust=/LayerDefaults(trust_tier=/g' your_code.py
6762
```
6863

docs/multi-tenancy.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@ qp-vault supports multi-tenant isolation via `tenant_id` on all operations.
88
vault = Vault("./knowledge")
99

1010
# Add with tenant isolation
11-
vault.add("Tenant A document", tenant_id="site-123", trust="canonical")
12-
vault.add("Tenant B document", tenant_id="site-456", trust="working")
11+
vault.add("Tenant A document", tenant_id="site-123", trust_tier="canonical")
12+
vault.add("Tenant B document", tenant_id="site-456", trust_tier="working")
1313

1414
# Search scoped to tenant
1515
results = vault.search("document", tenant_id="site-123")

docs/trust-tiers.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,12 +32,12 @@ This means official SOPs always surface above drafts, even when drafts are sligh
3232

3333
```python
3434
# On creation
35-
vault.add("SOP content", trust="canonical")
36-
vault.add("Draft notes", trust="working")
37-
vault.add("Standup notes", trust="ephemeral")
35+
vault.add("SOP content", trust_tier="canonical")
36+
vault.add("Draft notes", trust_tier="working")
37+
vault.add("Standup notes", trust_tier="ephemeral")
3838

3939
# After creation
40-
vault.update(resource_id, trust="canonical")
40+
vault.update(resource_id, trust_tier="canonical")
4141
```
4242

4343
Trust changes emit a `TRUST_CHANGE` audit event.

0 commit comments

Comments
 (0)