@cairnkeep/cli 2.13.1 → 2.14.0

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 (35) hide show
  1. package/CHANGELOG.md +16 -1
  2. package/README.md +7 -4
  3. package/docs/context-packs.md +13 -3
  4. package/docs/harness-compatibility.md +1 -1
  5. package/docs/learning/CURRICULUM-MAP.md +5 -4
  6. package/docs/learning/FEATURE-GUIDE.md +6 -2
  7. package/docs/learning/README.md +2 -1
  8. package/docs/learning/lessons/L00-why-cairnkeep.md +1 -1
  9. package/docs/learning/lessons/L01-safe-trial.md +3 -3
  10. package/docs/learning/lessons/L02-installation.md +2 -2
  11. package/docs/learning/lessons/L03-first-project.md +1 -1
  12. package/docs/learning/lessons/L19-validated-skill-improvement.md +1 -1
  13. package/docs/learning/lessons/L20-mcp-tool-profiles.md +1 -1
  14. package/docs/learning/lessons/L21-context-packs.md +5 -1
  15. package/docs/learning/lessons/L22-native-windows.md +2 -2
  16. package/docs/learning/lessons/L23-guided-setup.md +2 -2
  17. package/docs/learning/lessons/L24-okf-exchange.md +111 -0
  18. package/docs/learning/tracks/operator.md +4 -1
  19. package/docs/learning/video-scripts/V24-okf-exchange.md +31 -0
  20. package/docs/open-knowledge-format.md +100 -0
  21. package/docs/operating.md +14 -0
  22. package/docs/privacy-and-data-flow.md +2 -0
  23. package/docs/storage.md +6 -0
  24. package/examples/eval/bundled-fake.json +1 -1
  25. package/mcp-memory-server/dist/context-pack-cli.js +54 -1
  26. package/mcp-memory-server/dist/context-pack.js +243 -47
  27. package/mcp-memory-server/dist/index.js +13 -1
  28. package/mcp-memory-server/dist/mcp-tool-catalog.js +1 -0
  29. package/mcp-memory-server/dist/note-store.js +44 -2
  30. package/mcp-memory-server/dist/okf.js +432 -0
  31. package/mcp-memory-server/package.json +3 -1
  32. package/package.json +2 -1
  33. package/schemas/context-pack.schema.json +9 -0
  34. package/scripts/completion.sh +3 -3
  35. package/scripts/test-learning-docs.sh +2 -2
package/CHANGELOG.md CHANGED
@@ -5,6 +5,20 @@ All notable user-facing changes are documented here. This project follows
5
5
 
6
6
  ## [Unreleased]
7
7
 
8
+ ## [2.14.0] - 2026-08-17
9
+
10
+ ### Added
11
+
12
+ - Add validation and immutable context-pack import for Open Knowledge Format
13
+ 0.1/0.2 bundles, preserving structured source, trust, freshness, and gap
14
+ diagnostics without activating computations or instructions.
15
+ - Add deterministic digest-keyed document links and the read-only,
16
+ closed-world `context_pack_related` MCP observation.
17
+ - Add allowlist-only, redacted OKF 0.2 export for named project Markdown and
18
+ promoted shared notes, with a no-write preview and exact-digest atomic apply.
19
+ - Add offline retrieval/freshness/gap regression fixtures and an explicit
20
+ decision gate for any future external knowledge-system adapter.
21
+
8
22
  ## [2.13.1] - 2026-08-17
9
23
 
10
24
  ### Fixed
@@ -356,7 +370,8 @@ stored memories.
356
370
  - Preserve executable permissions and Bash 3.2 portability on macOS.
357
371
  - Add backup-first uninstall and SQLite-safe memory export/import guidance.
358
372
 
359
- [Unreleased]: https://github.com/cairnkeep/cairnkeep/compare/v2.13.1...HEAD
373
+ [Unreleased]: https://github.com/cairnkeep/cairnkeep/compare/v2.14.0...HEAD
374
+ [2.14.0]: https://github.com/cairnkeep/cairnkeep/compare/v2.13.1...v2.14.0
360
375
  [2.13.1]: https://github.com/cairnkeep/cairnkeep/compare/v2.13.0...v2.13.1
361
376
  [2.13.0]: https://github.com/cairnkeep/cairnkeep/compare/v2.12.0...v2.13.0
362
377
  [2.12.0]: https://github.com/cairnkeep/cairnkeep/compare/v2.11.0...v2.12.0
package/README.md CHANGED
@@ -322,7 +322,7 @@ search):
322
322
  | `CAIRN_AGENTFS_BASE_DIR` | Base dir for global memory scopes (default `~/.cairnkeep`) |
323
323
  | `CAIRN_MCP_TOOL_PROFILE` | Process override for MCP exposure: `full`, `read-only`, or `custom` |
324
324
  | `CAIRN_MCP_ALLOWED_TOOLS` | Comma-separated exact allowlist required by a custom process profile |
325
- | `CAIRN_CONTEXT_PACKS` | Opt in to local context-pack list/search/read tools (default off) |
325
+ | `CAIRN_CONTEXT_PACKS` | Opt in to local context-pack list/search/read/related tools (default off) |
326
326
  | `CAIRN_CONTEXT_PACK_HTTP` | Separately consent to context-pack tools over authenticated HTTP (default off) |
327
327
  | `CAIRN_PACK_BASE_DIR` | Immutable pack objects, source records, pointers, and retrieval cache (default `~/.cairnkeep/packs`) |
328
328
  | `CAIRN_TRAJECTORY_CAPTURE` | Opt in to local structured session capture (`1`, `true`, `yes`, or `on`; default off) |
@@ -389,10 +389,12 @@ cannot bypass capability or feature gates. See
389
389
 
390
390
  Context packs are immutable, digest-addressed local document/skill bundles.
391
391
  They are installed and project-pinned manually; no background Git sync occurs.
392
- With `CAIRN_CONTEXT_PACKS=1`, enabled documents are searchable through three
393
- read-only MCP tools. Skills remain invisible until their exact file digest is
392
+ With `CAIRN_CONTEXT_PACKS=1`, enabled documents are searchable and their local
393
+ links traversable through four read-only MCP tools. Skills remain invisible until their exact file digest is
394
394
  approved, and are never copied or executed. See
395
- [Immutable context packs](docs/context-packs.md).
395
+ [Immutable context packs](docs/context-packs.md). OKF 0.1/0.2 import and
396
+ privacy-reviewed OKF 0.2 export are documented in
397
+ [Open Knowledge Format exchange](docs/open-knowledge-format.md).
396
398
 
397
399
  ### Managed capability contract (opt-in)
398
400
 
@@ -581,6 +583,7 @@ exposes trajectory data. See the [operating guide](docs/operating.md#compaction-
581
583
  - **Privacy and data flow** — [docs/privacy-and-data-flow.md](docs/privacy-and-data-flow.md)
582
584
  - **MCP tool profiles** — [docs/mcp-tool-profiles.md](docs/mcp-tool-profiles.md)
583
585
  - **Immutable context packs** — [docs/context-packs.md](docs/context-packs.md)
586
+ - **Open Knowledge Format exchange** — [docs/open-knowledge-format.md](docs/open-knowledge-format.md)
584
587
  - **Validated skill improvement** — [docs/skill-improvement.md](docs/skill-improvement.md)
585
588
  - **Git providers** — [docs/git-providers.md](docs/git-providers.md)
586
589
  - **Support** — [SUPPORT.md](SUPPORT.md)
@@ -61,9 +61,11 @@ switches only the named project.
61
61
 
62
62
  ## Retrieval and skill approval
63
63
 
64
- Set `CAIRN_CONTEXT_PACKS=1` and restart the memory server to register the three
65
- read-only, closed-world tools: `context_pack_list`, `context_pack_search`, and
66
- `context_pack_read`. Every file or search result includes pack ID, version,
64
+ Set `CAIRN_CONTEXT_PACKS=1` and restart the memory server to register the
65
+ read-only, closed-world tools: `context_pack_list`, `context_pack_search`,
66
+ `context_pack_read`, and `context_pack_related`. The related tool is available
67
+ for imported OKF bundles and traverses only deterministic local document links.
68
+ Every file or search result includes pack ID, version,
67
69
  pack digest, path, kind, and file digest. Search uses the existing optional
68
70
  embedding configuration and falls back to deterministic substring matching if
69
71
  configuration or the endpoint is unavailable. Embedding cache data is stored
@@ -92,3 +94,11 @@ Authenticated HTTP deployments need the separate
92
94
  `CAIRN_CONTEXT_PACKS=1`, the existing bearer token, Host/CORS guards, and a
93
95
  project header. Pack digests prove integrity, not publisher authenticity.
94
96
  Publisher signatures remain future work.
97
+
98
+ ## Open Knowledge Format exchange
99
+
100
+ Use `cairn pack validate-okf` and `cairn pack import-okf` to consume OKF 0.1 or
101
+ 0.2 as an immutable pack. Use the preview-and-confirm `cairn pack export-okf`
102
+ workflow to export only named project Markdown and promoted shared notes. See
103
+ [Open Knowledge Format exchange](open-knowledge-format.md) for the provenance,
104
+ graph, privacy, regression, and external-adapter decision contracts.
@@ -31,7 +31,7 @@ commands, hooks, agents, or automatic skill activation.
31
31
 
32
32
  Every MCP client receives complete tool annotations and may use a Cairnkeep
33
33
  least-authority profile independent of harness assets. Context-pack tools are
34
- ordinary read-only MCP tools and require the pack feature gate; authenticated
34
+ ordinary read-only MCP tools (including imported-OKF link traversal) and require the pack feature gate; authenticated
35
35
  HTTP additionally requires separate pack-HTTP consent. Approved pack skills
36
36
  remain context documents, not native harness Skills or automatic instructions.
37
37
 
@@ -1,7 +1,7 @@
1
1
  # Curriculum Coverage Map
2
2
 
3
- **Baseline:** Cairnkeep 2.13.1
4
- **Last reviewed:** 2026-08-13
3
+ **Baseline:** Cairnkeep 2.14.0
4
+ **Last reviewed:** 2026-08-17
5
5
 
6
6
  This map prevents the course from drifting behind the product. It assigns each
7
7
  user-facing surface to a lesson and records whether the lesson is complete or
@@ -39,6 +39,7 @@ been rehearsed.
39
39
  | Native Windows x64 CLI, hooks, ACLs, scheduling, and recovery | L22 | L22 | Ready; PowerShell-native |
40
40
  | Guided project setup, selected harness state, and Git-less limitations | L03 | L03 and L23 | Ready |
41
41
  | Pi local stdio memory bridge, trusted annotation details, and explicit lifecycle | L23 | L23 | Ready; Pi 0.84.1 validated minimum |
42
+ | OKF 0.1/0.2 validation/import, provenance, links, regressions, and reviewed 0.2 export | L24 | L24 | Ready; local/offline by default |
42
43
 
43
44
  ## Release Review
44
45
 
@@ -69,7 +70,7 @@ repository remains the canonical source for explanations and scripts.
69
70
  | `course-07-evaluation` | L16-L17 | Package-owned offline fixture and design boundary |
70
71
  | `course-08-graph` | L18 | Optional local structural graph workflow |
71
72
  | `course-09-skill` | L19 | Validated skill improvement in a disposable project |
72
- | `course-10-trust-context` | L20-L21 | MCP authority profiles and offline context-pack lifecycle |
73
+ | `course-10-trust-context` | L20-L21 and L24 | MCP authority profiles, offline context-pack lifecycle, and reviewed OKF exchange |
73
74
  | `course-11-windows` | L22 | Native PowerShell lifecycle, ACL inspection, and reversible uninstall |
74
75
  | `course-12-guided-setup` | L23 | Deterministic setup, Pi local stdio, recovery, and backup-first uninstall |
75
76
 
@@ -92,7 +93,7 @@ against `cairn help` so a new command cannot bypass a curriculum decision.
92
93
  | `cairn evidence` | L13 |
93
94
  | `cairn capabilities` | L15 |
94
95
  | `cairn mcp-tools` | L20 |
95
- | `cairn pack` | L21 |
96
+ | `cairn pack` | L21 and L24 |
96
97
  | `cairn notes` | L13 |
97
98
  | `cairn eval` | L16 |
98
99
  | `cairn skill` | L19 |
@@ -1,6 +1,6 @@
1
1
  # Cairnkeep feature guide
2
2
 
3
- **Baseline:** Cairnkeep 2.13.1
3
+ **Baseline:** Cairnkeep 2.14.0
4
4
 
5
5
  This is the step-back map for choosing and operating Cairnkeep features. The
6
6
  [course labs](https://github.com/cairnkeep/cairnkeep-course-labs) provide one
@@ -15,6 +15,9 @@ trust. See [L03](lessons/L03-first-project.md) and
15
15
  Version 2.13 adds local Git-linked work evidence around all generated harness
16
16
  launchers; [L13](lessons/L13-session-evidence.md) covers its privacy and
17
17
  retention contract.
18
+ Version 2.14 adds OKF 0.1/0.2 import, structured provenance,
19
+ deterministic links, and reviewed OKF 0.2 export; see
20
+ [L24](lessons/L24-okf-exchange.md).
18
21
 
19
22
  ## The three-layer model
20
23
 
@@ -43,7 +46,7 @@ Run setup in that order, then confirm `cairn doctor`, `cairn sync --check`, and
43
46
  | 7 | Evaluation and ablation | A concrete change needs bounded measurement |
44
47
  | 8 | Validated skill improvement | Repeated resolved hindsight warrants a measured skill change |
45
48
  | 9 | Least-authority MCP profiles | A client should receive fewer tools than the default catalog |
46
- | 10 | Immutable context packs | Reviewed external context should be pinned without becoming memory |
49
+ | 10 | Immutable context packs and OKF exchange | Reviewed external context should be pinned or exchanged without becoming memory |
47
50
 
48
51
  Every stage is independently useful. Stages 4-8 are opt-in and are not
49
52
  prerequisites for ordinary memory.
@@ -73,6 +76,7 @@ prerequisites for ordinary memory.
73
76
  | Managed overlays | Separate distribution manifest, wrapper, profile lock, fleet and rollback gates | Policy and secrets belong in the private distribution/machine config, never core | `overlay info`, doctor, fleet dry run/current state, rollback | `course-04-operation` |
74
77
  | MCP tool profiles | `cairn mcp-tools set full|read-only|custom` | Strict mode-`0600` project config; process overrides take precedence; profile only removes tools | Inspect catalog/status digest; reset and restart MCP | `course-10-trust-context` |
75
78
  | Context packs | Manual local or commit-pinned Git install plus project enablement | Immutable objects and atomic pointers under `CAIRN_PACK_BASE_DIR`; no background sync | Validate, inspect digest, check/apply update, disable/remove | `course-10-trust-context` |
79
+ | OKF exchange | `cairn pack validate-okf`, `import-okf`, and preview-confirm `export-okf` | Local import/export by default; explicit file/shared-note allowlist; redacted output | Inspect diagnostics/provenance/output list; exact-digest apply; disable/remove imported pack | `course-10-trust-context` |
76
80
  | Pi local stdio memory | Select Pi during setup, then explicitly run `cairn sync-pi --apply` | Local memory-server child; dynamic effective tool catalog; annotations retained in trusted details, not a native Pi field | `cairn sync-pi --check`, `cairn doctor`, cancel one call, then observe awaited shutdown with no orphan | `course-12-guided-setup` |
77
81
 
78
82
  ## Evidence, governance, and measurement
@@ -55,6 +55,7 @@ expanded only after their labs are executable.
55
55
  | L21 | [Immutable context packs and skill approval](lessons/L21-context-packs.md) | Ready | 40 min |
56
56
  | L22 | [Operate Cairnkeep on native Windows](lessons/L22-native-windows.md) | Ready | 30 min |
57
57
  | L23 | [Guided setup and Pi memory](lessons/L23-guided-setup.md) | Ready | 35 min |
58
+ | L24 | [Reviewed knowledge exchange](lessons/L24-okf-exchange.md) | Ready | 35 min |
58
59
 
59
60
  The [curriculum coverage map](CURRICULUM-MAP.md) records where every public
60
61
  feature is introduced, practised, and operated. It also marks design-only work
@@ -73,7 +74,7 @@ Every complete lesson contains:
73
74
 
74
75
  The learner should never need optional infrastructure to complete L00-L06.
75
76
  Remote memory, RAG, routing, containers, graph indexing, structured capture,
76
- typed nodes, capability governance, evaluation, and context packs are separate
77
+ typed nodes, capability governance, evaluation, context packs, and OKF exchange are separate
77
78
  opt-in modules. MCP profiles are restrictive and never activate an optional
78
79
  feature.
79
80
 
@@ -3,7 +3,7 @@
3
3
  **Status:** Ready
4
4
  **Track:** Quickstart
5
5
  **Time:** 10 minutes
6
- **Tested with:** Cairnkeep 2.13.1
6
+ **Tested with:** Cairnkeep 2.14.0
7
7
 
8
8
  ## Outcome
9
9
 
@@ -3,7 +3,7 @@
3
3
  **Status:** Ready
4
4
  **Track:** Quickstart
5
5
  **Time:** 15 minutes
6
- **Tested with:** Cairnkeep 2.13.1
6
+ **Tested with:** Cairnkeep 2.14.0
7
7
 
8
8
  ## Outcome
9
9
 
@@ -26,7 +26,7 @@ ephemeral; the named course volume is persistent.
26
26
  1. Pull the public image:
27
27
 
28
28
  ```bash
29
- podman pull ghcr.io/cairnkeep/cairnkeep:2.13.1
29
+ podman pull ghcr.io/cairnkeep/cairnkeep:2.14.0
30
30
  ```
31
31
 
32
32
  2. Start the stdio server with a read-only root filesystem and no Linux
@@ -38,7 +38,7 @@ ephemeral; the named course volume is persistent.
38
38
  --read-only --cap-drop=all --security-opt=no-new-privileges \
39
39
  --tmpfs=/tmp:rw,noexec,nosuid,size=64m,mode=1777 \
40
40
  --volume cairnkeep-course-data:/data:Z,U \
41
- ghcr.io/cairnkeep/cairnkeep:2.13.1 stdio
41
+ ghcr.io/cairnkeep/cairnkeep:2.14.0 stdio
42
42
  ```
43
43
 
44
44
  3. The process waits quietly for MCP input. Press `Ctrl-C` after confirming it
@@ -3,7 +3,7 @@
3
3
  **Status:** Ready
4
4
  **Track:** Quickstart
5
5
  **Time:** 25 minutes
6
- **Tested with:** Cairnkeep 2.13.1 and Node.js 22 or newer
6
+ **Tested with:** Cairnkeep 2.14.0 and Node.js 22 or newer
7
7
 
8
8
  ## Outcome
9
9
 
@@ -47,7 +47,7 @@ sync. Codex project trust remains an explicit operator decision.
47
47
  2. Install Cairnkeep:
48
48
 
49
49
  ```bash
50
- npm install --global @cairnkeep/cli@2.13.1
50
+ npm install --global @cairnkeep/cli@2.14.0
51
51
  cairn --version
52
52
  ```
53
53
 
@@ -3,7 +3,7 @@
3
3
  **Status:** Ready
4
4
  **Track:** Quickstart
5
5
  **Time:** 25 minutes
6
- **Tested with:** Cairnkeep 2.13.1
6
+ **Tested with:** Cairnkeep 2.14.0
7
7
 
8
8
  ## Outcome
9
9
 
@@ -3,7 +3,7 @@
3
3
  **Status:** Ready
4
4
  **Track:** Evidence and Evaluation
5
5
  **Time:** 50 minutes
6
- **Tested with:** Cairnkeep 2.13.1
6
+ **Tested with:** Cairnkeep 2.14.0
7
7
 
8
8
  ## Outcome
9
9
 
@@ -1,7 +1,7 @@
1
1
  # L20 - Least-authority MCP tool profiles
2
2
 
3
3
  **Status:** Ready
4
- **Tested with:** Cairnkeep 2.13.1 and Node.js 22 or newer
4
+ **Tested with:** Cairnkeep 2.14.0 and Node.js 22 or newer
5
5
  **Time:** 25 minutes
6
6
 
7
7
  ## Outcome
@@ -1,7 +1,7 @@
1
1
  # L21 - Immutable context packs and skill approval
2
2
 
3
3
  **Status:** Ready
4
- **Tested with:** Cairnkeep 2.13.1 and Node.js 22 or newer
4
+ **Tested with:** Cairnkeep 2.14.0 and Node.js 22 or newer
5
5
  **Time:** 40 minutes
6
6
 
7
7
  ## Outcome
@@ -77,3 +77,7 @@ rm -rf "$lab"
77
77
  - `CAIRN_CONTEXT_PACKS=1` enables local read-only tools only after restart.
78
78
  - HTTP additionally requires `CAIRN_CONTEXT_PACK_HTTP=1` and existing auth.
79
79
  - A digest proves integrity, not publisher authenticity.
80
+
81
+ Continue with [L24](L24-okf-exchange.md) for structured OKF provenance,
82
+ deterministic related-document retrieval, regression diagnostics, and the
83
+ privacy-reviewed export workflow.
@@ -3,7 +3,7 @@
3
3
  **Status:** Ready
4
4
  **Track:** Operator
5
5
  **Time:** 30 minutes
6
- **Tested with:** Cairnkeep 2.13.1, Windows x64, and Node.js 22 or newer
6
+ **Tested with:** Cairnkeep 2.14.0, Windows x64, and Node.js 22 or newer
7
7
 
8
8
  ## Outcome
9
9
 
@@ -16,7 +16,7 @@ perform a reversible uninstall without relying on WSL or Git Bash.
16
16
  From PowerShell:
17
17
 
18
18
  ```powershell
19
- npm install --global @cairnkeep/cli@2.13.1
19
+ npm install --global @cairnkeep/cli@2.14.0
20
20
  cairn version
21
21
 
22
22
  $Lab = Join-Path $env:TEMP 'Cairnkeep Windows Lab'
@@ -3,7 +3,7 @@
3
3
  **Status:** Ready
4
4
  **Track:** Quickstart and Operator
5
5
  **Time:** 35 minutes
6
- **Tested with:** Cairnkeep 2.13.1; Pi 0.84.1; Node.js 22, 24, and 26
6
+ **Tested with:** Cairnkeep 2.14.0; Pi 0.84.1; Node.js 22, 24, and 26
7
7
 
8
8
  ## Outcome
9
9
 
@@ -134,7 +134,7 @@ prompts, approve skills, create an autonomous loop, or add remote access.
134
134
 
135
135
  ## Release boundary
136
136
 
137
- Ready means this lesson and its deterministic contracts pass against v2.13.1.
137
+ Ready means this lesson and its deterministic contracts pass against v2.14.0.
138
138
  Release readiness requires a non-skipping acceptance run
139
139
  against separate Pi 0.84.1 minimum and explicitly versioned registry-current
140
140
  installations, plus the documented Node.js, Bash 3.2, and native Windows matrix.
@@ -0,0 +1,111 @@
1
+ # L24 - Reviewed knowledge exchange
2
+
3
+ **Status:** Ready
4
+ **Tested with:** Cairnkeep 2.14.0 and Node.js 22 or newer
5
+ **Time:** 35 minutes
6
+
7
+ ## Outcome
8
+
9
+ Validate and import an OKF bundle as immutable project context, inspect its
10
+ structured provenance and deterministic links, then export an explicitly
11
+ selected, redacted OKF 0.2 bundle without confusing exchange with durable
12
+ memory or publisher trust.
13
+
14
+ ## Exercise
15
+
16
+ Create a disposable OKF 0.2 bundle:
17
+
18
+ ```bash
19
+ lab=$(mktemp -d)
20
+ mkdir -p "$lab/source/concepts" "$lab/project"
21
+ cat >"$lab/source/index.md" <<'EOF'
22
+ ---
23
+ okf_version: "0.2"
24
+ ---
25
+ # Local catalog
26
+
27
+ * Policy
28
+ EOF
29
+ printf '%s%s\n' '* [Policy]' '(concepts/policy.md)' >>"$lab/source/index.md"
30
+ cat >"$lab/source/concepts/policy.md" <<'EOF'
31
+ ---
32
+ type: Policy
33
+ title: Synthetic policy
34
+ description: Offline course fixture.
35
+ sources:
36
+ - resource: urn:course:fixture
37
+ verified: { by: human:course-reviewer }
38
+ ---
39
+ # Synthetic policy
40
+
41
+ This content is deliberately non-sensitive.
42
+ EOF
43
+ export CAIRN_PACK_BASE_DIR="$lab/store"
44
+ cairn pack validate-okf "$lab/source"
45
+ cairn pack import-okf "$lab/source" --id course-okf \
46
+ --version 1.0.0 --license CC0-1.0 --json >"$lab/import.json"
47
+ digest=$(node -e 'process.stdout.write(require(process.argv[1]).digest)' "$lab/import.json")
48
+ cairn pack enable "$digest" --project "$lab/project"
49
+ ```
50
+
51
+ Start the project memory server with `CAIRN_CONTEXT_PACKS=1`. Through an MCP
52
+ client, confirm that list/search/read results contain `okf.version`, concept
53
+ type, source, trust tier, freshness state, links, and diagnostics. Call
54
+ `context_pack_related` for `concepts/policy.md`; it performs no URL fetch and
55
+ returns only enabled files from the same digest-pinned pack.
56
+
57
+ Now preview and apply an allowlist-only export:
58
+
59
+ ```bash
60
+ mkdir -p "$lab/project/docs"
61
+ printf '# Reviewed decision\n\nSynthetic approved text.\n' \
62
+ >"$lab/project/docs/decision.md"
63
+ cairn pack export-okf --project "$lab/project" --output "$lab/export" \
64
+ --file docs/decision.md --check
65
+ # Copy the printed preview digest only after inspecting the file list.
66
+ cairn pack export-okf --project "$lab/project" --output "$lab/export" \
67
+ --file docs/decision.md --apply --confirm PREVIEW-DIGEST
68
+ cairn pack validate-okf "$lab/export"
69
+ ```
70
+
71
+ ## Common failures
72
+
73
+ - A concept without YAML `type`, a YAML alias, a symlink, invalid UTF-8, or an
74
+ unsafe path fails validation.
75
+ - Git input needs an explicit `--ref`; local validation/import does not use the
76
+ network.
77
+ - Export rejects broad private/runtime paths and accepts only named Markdown or
78
+ promoted shared notes.
79
+ - Any selected-byte or redaction change invalidates the preview digest. An
80
+ existing output directory is never replaced.
81
+
82
+ ## Privacy and trust boundary
83
+
84
+ Import metadata is reported, not vouched for. A pack digest proves byte
85
+ integrity but not publisher authenticity, and OKF computation/attestation
86
+ metadata is never executed. Optional embedding search can send chunks to the
87
+ configured endpoint; substring search and link traversal stay local. Export
88
+ applies redaction, but explicit review of both preview and output is still
89
+ required before publication.
90
+
91
+ An external knowledge adapter remains deferred unless a representative task
92
+ demonstrates a necessary capability that memory, promoted notes, context packs,
93
+ links, embeddings, and OKF exchange cannot provide with lower operational and
94
+ privacy cost.
95
+
96
+ ## Recovery and acceptance
97
+
98
+ ```bash
99
+ cairn pack disable course-okf --project "$lab/project"
100
+ cairn pack remove "$digest"
101
+ unset CAIRN_PACK_BASE_DIR
102
+ rm -rf "$lab"
103
+ ```
104
+
105
+ - Validation and import preserve OKF 0.1/0.2 provenance without modifying the
106
+ source.
107
+ - Related-document retrieval is deterministic, closed-world, and read-only.
108
+ - The regression fixture detects wrong top results, stale metadata, missing
109
+ provenance, and broken links.
110
+ - Export check performs no writes; apply requires the exact recomputed digest
111
+ and creates only the reviewed destination.
@@ -2,7 +2,7 @@
2
2
 
3
3
  **Audience:** advanced users and platform maintainers
4
4
  **Prerequisite:** Practitioner track; L13 before operating captured evidence
5
- **Total time:** about 5 hours 35 minutes
5
+ **Total time:** about 6 hours 10 minutes
6
6
 
7
7
  1. [L09 - Domain knowledge with RAG](../lessons/L09-domain-knowledge.md)
8
8
  2. [L10 - Faster context exploration](../lessons/L10-context-exploration.md)
@@ -14,12 +14,15 @@
14
14
  8. [L21 - Immutable context packs and skill approval](../lessons/L21-context-packs.md)
15
15
  9. [L22 - Operate Cairnkeep on native Windows](../lessons/L22-native-windows.md)
16
16
  10. [L23 - Guided setup and Pi memory](../lessons/L23-guided-setup.md)
17
+ 11. [L24 - Reviewed knowledge exchange](../lessons/L24-okf-exchange.md)
17
18
 
18
19
  All modules are optional. The track is complete when the operator can add and
19
20
  remove each integration without breaking the standalone local workflow and can
20
21
  explain its storage, network, credential, and rollback boundaries. L23 adds the
21
22
  v2.11 setup/Pi lifecycle only after the earlier storage, governance, trust, and
22
23
  native-platform boundaries.
24
+ L24 adds portable exchange only after the immutable-pack and privacy boundaries
25
+ are understood.
23
26
 
24
27
  Hands-on spine: `course-04-operation`, `course-06-governance`, and
25
28
  `course-07-evaluation`, `course-10-trust-context`, and
@@ -0,0 +1,31 @@
1
+ # V24 - Reviewed knowledge exchange
2
+
3
+ **Companion lesson:** [L24](../lessons/L24-okf-exchange.md)
4
+ **Target length:** 9 minutes
5
+
6
+ ## Recording outline
7
+
8
+ 1. State the boundary: OKF is portable context exchange, not a second memory
9
+ owner, agent loop, trust authority, or background sync service.
10
+ 2. Show a two-concept synthetic OKF 0.2 directory and run
11
+ `cairn pack validate-okf`.
12
+ 3. Import it with an ID, semantic version, and license; point out that the
13
+ source directory remains unchanged and the pack digest is authoritative.
14
+ 4. Enable the digest for one disposable project. Show structured `okf`
15
+ provenance in list/search/read and traverse one local link with
16
+ `context_pack_related`.
17
+ 5. Break a link and make a concept stale in a second fixture. Show diagnostics
18
+ without implying that Cairnkeep verified the source claims.
19
+ 6. Select one project Markdown file, run `export-okf --check`, and emphasize
20
+ that no output exists. Inspect the allowlist, redaction count, and digests.
21
+ 7. Apply with the exact preview digest and validate the result. Demonstrate one
22
+ rejected private path and one mismatched confirmation.
23
+ 8. Close with the external-adapter gate: demand a measured, otherwise
24
+ impossible workflow before accepting another network and data owner.
25
+
26
+ ## Recording cautions
27
+
28
+ - Use only synthetic paths, content, sources, and credentials.
29
+ - Keep embeddings disabled so the recording proves the offline fallback.
30
+ - Do not claim publisher authenticity, semantic correctness, or quality gains.
31
+ - Remove the disposable pack object and project pointer on camera.
@@ -0,0 +1,100 @@
1
+ # Open Knowledge Format exchange
2
+
3
+ Cairnkeep can ingest Open Knowledge Format (OKF) 0.1 and 0.2 bundles as
4
+ immutable context packs and can export an explicitly reviewed subset of local
5
+ knowledge as OKF 0.2. This is an exchange boundary, not a second memory store,
6
+ an agent runtime, or a synchronization service.
7
+
8
+ ## Validate and import
9
+
10
+ ```bash
11
+ cairn pack validate-okf ./knowledge
12
+ cairn pack import-okf ./knowledge \
13
+ --id reviewed-knowledge --version 1.0.0 --license CC-BY-4.0
14
+ cairn pack enable reviewed-knowledge --project ./project
15
+ ```
16
+
17
+ The importer accepts a local directory without network access. A Git source
18
+ requires `--ref`; Cairnkeep resolves and records the exact commit using the
19
+ system `git` executable. Repository metadata is excluded. Import copies only
20
+ validated UTF-8 bundle files into a new immutable object and never modifies the
21
+ source.
22
+
23
+ Validation rejects symlinks, devices, unsafe paths, invalid UTF-8, YAML aliases,
24
+ missing concept `type`, duplicate YAML keys, and the normal context-pack size
25
+ limits. Unknown concept metadata remains available for forward-compatible
26
+ reading. A future OKF version produces a diagnostic and is consumed on a
27
+ best-effort basis rather than being treated as fully supported.
28
+
29
+ OKF 0.2 provenance is preserved in the `okf` field returned by
30
+ `context_pack_list`, `context_pack_search`, and `context_pack_read`. It includes
31
+ the format version, file role, concept identity and type, declared sources,
32
+ generation and verification events, trust tier, status, staleness, links, and
33
+ diagnostics. These are source assertions: Cairnkeep reports them but does not
34
+ turn them into publisher authenticity or executable authority.
35
+
36
+ ## Deterministic links and retrieval
37
+
38
+ With `CAIRN_CONTEXT_PACKS=1`, imported packs also expose the read-only,
39
+ closed-world `context_pack_related` MCP tool. It traverses local Markdown links
40
+ in `outbound`, `inbound`, or `both` directions. External URLs are never fetched.
41
+ Broken and unsafe local links remain diagnostics. The derived graph cache lives
42
+ outside immutable objects and is keyed by the authoritative pack digest; it can
43
+ always be rebuilt from the object.
44
+
45
+ Search still follows the context-pack retrieval contract: deterministic
46
+ substring matching is always available, while configured embeddings are an
47
+ optional enhancement with a clean lexical fallback. Regression fixtures cover
48
+ the expected top result, source/trust preservation, stale-content warnings,
49
+ missing-metadata diagnostics, broken links, and embedding-independent graph
50
+ results.
51
+
52
+ ## Privacy-reviewed export
53
+
54
+ Export is allowlist-only and uses a two-step confirmation:
55
+
56
+ ```bash
57
+ cairn pack export-okf --project ./project --output ./reviewed-okf \
58
+ --file docs/decision.md --note shared-example --check
59
+
60
+ cairn pack export-okf --project ./project --output ./reviewed-okf \
61
+ --file docs/decision.md --note shared-example \
62
+ --apply --confirm PREVIEW-DIGEST
63
+ ```
64
+
65
+ `--check` writes nothing. It reads only the named Markdown files and promoted
66
+ shared notes, applies the local redaction policy, and returns the exact output
67
+ list, output digests, redaction count, and confirmation digest. `--apply`
68
+ recomputes that plan and writes atomically only when the digest matches. It
69
+ refuses an existing output directory.
70
+
71
+ Private runtime directories, Git metadata, dependencies, and most planning
72
+ state cannot be selected. The reviewed wiki subtree is the sole planning-state
73
+ exception and is mapped to `wiki/`. Project hindsight and provenance notes are
74
+ not exportable: only already-corroborated `shared` notes pass the note reader.
75
+ The resulting bundle can still contain sensitive domain content, so review the
76
+ preview and the output before publishing it.
77
+
78
+ ## External adapter decision gate
79
+
80
+ No live external knowledge-system adapter is included. Native memory, promoted
81
+ notes, immutable packs, deterministic links, optional embeddings, and OKF
82
+ import/export already cover local capture, reviewed sharing, retrieval, and
83
+ portable exchange.
84
+
85
+ An adapter should be added only when a concrete workflow demonstrates all of
86
+ the following:
87
+
88
+ 1. It needs a capability Cairnkeep cannot express through those native
89
+ surfaces, not merely another UI or duplicate graph.
90
+ 2. The benefit is measured on a representative task set and exceeds the added
91
+ privacy, availability, migration, and operational cost.
92
+ 3. Cairnkeep remains the sole owner of durable-memory mutations; the adapter is
93
+ read-only or has an explicit, reversible write boundary.
94
+ 4. Authentication, data egress, deletion, backup, and failure behavior are
95
+ testable without weakening local/offline defaults.
96
+ 5. A provider-neutral interface and fixture can be maintained without adding a
97
+ background agent loop or automatic activation.
98
+
99
+ Until a use case passes that gate, OKF exchange is the smaller and safer
100
+ integration seam.
package/docs/operating.md CHANGED
@@ -1302,3 +1302,17 @@ an `--apply --confirm CANDIDATE-DIGEST`. Use `cairn pack skills` and exact-diges
1302
1302
  approval before a bundled skill can be read through MCP. HTTP needs the separate
1303
1303
  `CAIRN_CONTEXT_PACK_HTTP=1` flag and all existing authentication/Host/CORS
1304
1304
  controls. See [Immutable context packs](context-packs.md).
1305
+
1306
+ Validate and import an OKF bundle without converting it by hand:
1307
+
1308
+ ```bash
1309
+ cairn pack validate-okf ./knowledge
1310
+ cairn pack import-okf ./knowledge --id reviewed-knowledge \
1311
+ --version 1.0.0 --license CC-BY-4.0
1312
+ ```
1313
+
1314
+ Imported OKF packs preserve structured source/trust/freshness metadata and add
1315
+ read-only related-document traversal. Privacy-reviewed export is an explicit
1316
+ `export-okf --check` followed by `--apply --confirm PREVIEW-DIGEST`; only named
1317
+ Markdown files and promoted shared notes are eligible. See
1318
+ [Open Knowledge Format exchange](open-knowledge-format.md).
@@ -19,6 +19,8 @@ request unless the corresponding endpoint and credential are configured.
19
19
  | Local context-pack install/list/read/substring search | None | Verified immutable files and project pointers under `CAIRN_PACK_BASE_DIR` |
20
20
  | Embedding-ranked context-pack search | Enabled file chunks not already cached, plus the query | The explicitly configured embedding endpoint; failure falls back locally |
21
21
  | Authenticated HTTP context-pack retrieval | MCP requests and enabled document/approved-skill content | The explicit Cairnkeep HTTP server; requires separate pack HTTP consent |
22
+ | Local OKF validation/import/link traversal | None | Source files are read locally; immutable object and digest-keyed graph cache remain under `CAIRN_PACK_BASE_DIR` |
23
+ | Privacy-reviewed OKF export | None | Only explicitly named Markdown/promoted shared notes are redacted into the operator-selected local output directory after exact preview confirmation |
22
24
  | Optional Graphify workflow | The repository path, exact query/symbol names, root `graphify-out/` work directory, and local `.planning/graphs/` publication are passed to or produced by the operator-installed `graphify` executable | Local Graphify subprocess with a minimal environment and no provider credentials; managed build uses code-only `update`, never semantic document extraction |
23
25
  | Remote HTTP memory | MCP requests and responses, including memory content | The explicitly registered Cairnkeep HTTP server |
24
26
  | Opt-in trajectory capture | None | Local `<project>/.agentfs/trajectory.db` only; no model or HTTP path exists |
package/docs/storage.md CHANGED
@@ -548,3 +548,9 @@ and switch only the named project after exact-digest confirmation.
548
548
  It never chooses a pack version or grants a skill approval. `cairn pack remove`
549
549
  refuses any referenced digest. Ordinary uninstall retains this directory even
550
550
  when memory is removed; `--purge-packs` is the separate backup-first consent.
551
+
552
+ Imported OKF files live inside the same immutable object. The deterministic
553
+ link index is derived data under `cache/graphs/<pack-digest>.json`; corruption
554
+ or deletion does not affect identity and causes a rebuild from the object. OKF
555
+ exports are not stored automatically: `export-okf --apply` creates a new
556
+ operator-selected directory only after its preview digest is confirmed.
@@ -1 +1 @@
1
- {"identifier":"cairn-offline-fake-v1","package_version":"2.13.1","schema_version":1,"task_set_digest":"13e95379f35839593047ec34521a65a8fa3ab92bd3993bca9dc8bf5c4a9ff36f"}
1
+ {"identifier":"cairn-offline-fake-v1","package_version":"2.14.0","schema_version":1,"task_set_digest":"13e95379f35839593047ec34521a65a8fa3ab92bd3993bca9dc8bf5c4a9ff36f"}