@cairnkeep/cli 2.12.0 → 2.13.1

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 (53) hide show
  1. package/CHANGELOG.md +23 -1
  2. package/README.md +20 -1
  3. package/docs/harness-compatibility.md +6 -0
  4. package/docs/learning/CURRICULUM-MAP.md +3 -1
  5. package/docs/learning/FEATURE-GUIDE.md +6 -2
  6. package/docs/learning/README.md +1 -1
  7. package/docs/learning/lessons/L00-why-cairnkeep.md +1 -1
  8. package/docs/learning/lessons/L01-safe-trial.md +3 -3
  9. package/docs/learning/lessons/L02-installation.md +2 -2
  10. package/docs/learning/lessons/L03-first-project.md +1 -1
  11. package/docs/learning/lessons/L13-session-evidence.md +48 -2
  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 +1 -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/tracks/evidence-and-evaluation.md +2 -1
  18. package/docs/native-windows.md +9 -0
  19. package/docs/operating.md +43 -0
  20. package/docs/privacy-and-data-flow.md +36 -0
  21. package/docs/quickstart.md +5 -0
  22. package/docs/releasing.md +6 -2
  23. package/docs/storage.md +26 -0
  24. package/docs/work-evidence.md +80 -0
  25. package/examples/eval/bundled-fake.json +1 -1
  26. package/mcp-memory-server/dist/artifact-cli.js +6 -2
  27. package/mcp-memory-server/dist/index.js +27 -0
  28. package/mcp-memory-server/dist/mcp-tool-catalog.js +2 -0
  29. package/mcp-memory-server/dist/trajectory-cli.js +9 -3
  30. package/mcp-memory-server/dist/work-evidence-cli.js +121 -0
  31. package/mcp-memory-server/dist/work-evidence-schema.js +121 -0
  32. package/mcp-memory-server/dist/work-evidence-store.js +516 -0
  33. package/mcp-memory-server/package.json +2 -1
  34. package/package.json +5 -2
  35. package/scripts/cairn-cli.mjs +2 -0
  36. package/scripts/completion.sh +11 -3
  37. package/scripts/doctor.sh +30 -1
  38. package/scripts/test-cli-dispatch.sh +3 -1
  39. package/scripts/test-completion.sh +4 -0
  40. package/scripts/test-package-install.sh +4 -0
  41. package/scripts/test-release-sbom.sh +91 -0
  42. package/scripts/test-uninstall.sh +10 -0
  43. package/scripts/test-windows-native.mjs +3 -0
  44. package/scripts/test-work-evidence-cli.sh +89 -0
  45. package/scripts/verify-docs-parity.sh +36 -0
  46. package/scripts/windows-platform.mjs +15 -2
  47. package/templates/env.example.template +10 -0
  48. package/templates/start-claude.sh.template +18 -0
  49. package/templates/start-codex.sh.template +18 -0
  50. package/templates/start-kimi.sh.template +17 -0
  51. package/templates/start-opencode.sh.template +17 -0
  52. package/templates/start-pi.sh.template +17 -0
  53. package/templates/start-qwen.sh.template +17 -0
package/CHANGELOG.md CHANGED
@@ -5,6 +5,26 @@ All notable user-facing changes are documented here. This project follows
5
5
 
6
6
  ## [Unreleased]
7
7
 
8
+ ## [2.13.1] - 2026-08-17
9
+
10
+ ### Fixed
11
+
12
+ - Generate release SBOMs directly as reproducible, schema-validated CycloneDX
13
+ 1.6 documents with the pinned official npm generator. This replaces npm's
14
+ invalid CycloneDX 1.5 output and fails publication before attaching a broken
15
+ SBOM.
16
+
17
+ ## [2.13.0] - 2026-08-17
18
+
19
+ ### Added
20
+
21
+ - Add opt-in, local Git-linked work evidence for all six generated harness
22
+ launchers and native Windows, with bounded start/end state, touched paths,
23
+ append-only trajectory/artifact/reviewed-memory links, lifecycle CLI and two
24
+ local read-only MCP observations.
25
+ - Add separately consented, redacted patch artifacts and document their
26
+ start-commit scope, pre-existing-dirty limitation and omitted untracked bodies.
27
+
8
28
  ## [2.12.0] - 2026-08-13
9
29
 
10
30
  ### Added
@@ -336,7 +356,9 @@ stored memories.
336
356
  - Preserve executable permissions and Bash 3.2 portability on macOS.
337
357
  - Add backup-first uninstall and SQLite-safe memory export/import guidance.
338
358
 
339
- [Unreleased]: https://github.com/cairnkeep/cairnkeep/compare/v2.12.0...HEAD
359
+ [Unreleased]: https://github.com/cairnkeep/cairnkeep/compare/v2.13.1...HEAD
360
+ [2.13.1]: https://github.com/cairnkeep/cairnkeep/compare/v2.13.0...v2.13.1
361
+ [2.13.0]: https://github.com/cairnkeep/cairnkeep/compare/v2.12.0...v2.13.0
340
362
  [2.12.0]: https://github.com/cairnkeep/cairnkeep/compare/v2.11.0...v2.12.0
341
363
  [2.11.0]: https://github.com/cairnkeep/cairnkeep/compare/v2.9.0...v2.11.0
342
364
  [2.9.0]: https://github.com/cairnkeep/cairnkeep/compare/v2.8.0...v2.9.0
package/README.md CHANGED
@@ -32,7 +32,7 @@ verification, and the first remember/recall cycle.
32
32
  ## Status
33
33
 
34
34
  Shipped: the memory server, the `cairn` CLI (`setup`, `bootstrap`, `memory-server`, `sync`, `sync-pi`, `sync-kimi`,
35
- `doctor`, `trajectory`, `artifact`, `mcp-tools`, `pack`, `notes`, `memory`, `eval`, `audit-timer`, `completion`, `uninstall`) installable via
35
+ `doctor`, `trajectory`, `artifact`, `evidence`, `mcp-tools`, `pack`, `notes`, `memory`, `eval`, `audit-timer`, `completion`, `uninstall`) installable via
36
36
  `npm i -g @cairnkeep/cli`, and the
37
37
  operating layer (commands,
38
38
  agents, hooks) installed on Claude Code and OpenCode, plus the native Pi
@@ -46,6 +46,8 @@ cairnkeep-org sibling project.
46
46
 
47
47
  Version 2.12 adds a declarative harness registry, first-class Codex project
48
48
  setup, and a shorter path from installation to verified recall.
49
+ Version 2.13 adds opt-in local Git-linked work evidence around generated harness
50
+ launchers, including native Windows, without capturing prompts or replacing Git.
49
51
 
50
52
  ## Compatibility
51
53
 
@@ -329,6 +331,12 @@ search):
329
331
  | `CAIRN_TRAJECTORY_RETENTION_DAYS` | Retain captured sessions for this many days (default `30`) |
330
332
  | `CAIRN_TRAJECTORY_REDACTION_FILE` | Optional project-contained redaction config (default `.ai/trajectory-redaction.json` when present) |
331
333
  | `CAIRN_REDACTION_FILE` | Optional project-contained redaction config shared by trajectories and artifacts (falls back to `CAIRN_TRAJECTORY_REDACTION_FILE`) |
334
+ | `CAIRN_WORK_EVIDENCE` | Capture bounded Git state around generated harness launches (off by default) |
335
+ | `CAIRN_WORK_EVIDENCE_PATCH` | Request an optional redacted patch artifact (off by default; also requires `CAIRN_ARTIFACT_STORE`) |
336
+ | `CAIRN_WORK_EVIDENCE_RETENTION_DAYS` | Work-evidence retention (default `30`; `0` disables age pruning) |
337
+ | `CAIRN_WORK_EVIDENCE_STORE_MAX_BYTES` | Project-local work-evidence metadata budget (default `67108864`, 64 MiB) |
338
+ | `CAIRN_WORK_EVIDENCE_MAX_TOUCHED_PATHS` | Maximum touched-path labels per record (default and hard maximum `4096`) |
339
+ | `CAIRN_WORK_EVIDENCE_PATCH_MAX_BYTES` | Maximum optional patch bytes (default `1048576`, 1 MiB; the artifact cap can lower it) |
332
340
  | `CAIRN_COMPACTION_CAPTURE` | Opt in to local harness-produced compaction capture and fresh-session recovery (off by default) |
333
341
  | `CAIRN_ARTIFACT_STORE` | Expose four local stdio artifact tools (off by default; independent of compaction capture) |
334
342
  | `CAIRN_ARTIFACT_HTTP` | Separately consent to artifact tools over authenticated HTTP (off by default; also requires `CAIRN_ARTIFACT_STORE`) |
@@ -517,6 +525,17 @@ reject policy cannot overwrite; explicit supersede preserves typed history.
517
525
  Note addresses require `scope: project` and logical keys, never filesystem
518
526
  paths. See the [operating guide](docs/operating.md#typed-memory-nodes-and-note-address-spaces-opt-in).
519
527
 
528
+ ### Git-linked work evidence (opt-in)
529
+
530
+ `CAIRN_WORK_EVIDENCE=1` makes generated Claude Code, OpenCode, Pi, Kimi, Qwen
531
+ and Codex launchers record bounded start/end Git state and links to exact local
532
+ trajectories, artifacts and reviewed-memory writes. It records no prompts,
533
+ keystrokes or reasoning, and harness launch remains fail-open when Git or
534
+ capture is unavailable. Inspect it with `cairn evidence list|show|delete|prune|doctor`.
535
+ Optional patch capture requires both `CAIRN_WORK_EVIDENCE_PATCH=1` and
536
+ `CAIRN_ARTIFACT_STORE=1`; Cairnkeep never applies or restores a patch. See the
537
+ [work-evidence guide](docs/work-evidence.md).
538
+
520
539
  ### Compaction continuity and artifacts (opt-in)
521
540
 
522
541
  `CAIRN_COMPACTION_CAPTURE=1` captures only harness-produced compaction summaries
@@ -4,6 +4,12 @@ Cairnkeep separates memory transport from harness-specific operating assets.
4
4
  An MCP client can use the memory tools without also supporting Cairnkeep's
5
5
  commands, hooks, plugins, or trajectory adapters.
6
6
 
7
+ All six generated launchers—Claude Code, OpenCode, Kimi, Qwen, Pi and Codex—
8
+ support the same opt-in Git-linked work-evidence wrapper. The wrapper is local,
9
+ requires `CAIRN_WORK_EVIDENCE=1`, and fails open so optional capture cannot
10
+ prevent a harness from launching. It does not imply that the harness supports
11
+ Cairnkeep commands, hooks or native trajectory capture.
12
+
7
13
  ## Support levels
8
14
 
9
15
  | Harness | Supported surface | Runtime status |
@@ -1,6 +1,6 @@
1
1
  # Curriculum Coverage Map
2
2
 
3
- **Baseline:** Cairnkeep 2.12.0
3
+ **Baseline:** Cairnkeep 2.13.1
4
4
  **Last reviewed:** 2026-08-13
5
5
 
6
6
  This map prevents the course from drifting behind the product. It assigns each
@@ -27,6 +27,7 @@ been rehearsed.
27
27
  | Structured trajectories and Pi capture adapter | L13 | L13 | Brief; default off |
28
28
  | Hindsight-note distillation, lookup, enrichment, and promotion | L13 | L13-L14 | Brief; default off |
29
29
  | Compaction continuity and immutable artifacts | L13 | L13 | Brief; default off |
30
+ | Git-linked work evidence | L13 | L13 | Lab + recording outline; default off |
30
31
  | Typed memory nodes, filters, address spaces, and structured import | L14 | L14 | Brief; default off |
31
32
  | Managed eight-capability contract and payload-free callbacks | L15 | L15-L16 | Brief; default off |
32
33
  | Deterministic two-pass evaluation and one-capability ablation | L16 | L16 | Brief; default off |
@@ -88,6 +89,7 @@ against `cairn help` so a new command cannot bypass a curriculum decision.
88
89
  | `cairn doctor` | L03; advanced repair in L13-L14 |
89
90
  | `cairn trajectory` | L13 |
90
91
  | `cairn artifact` | L13 |
92
+ | `cairn evidence` | L13 |
91
93
  | `cairn capabilities` | L15 |
92
94
  | `cairn mcp-tools` | L20 |
93
95
  | `cairn pack` | L21 |
@@ -1,6 +1,6 @@
1
1
  # Cairnkeep feature guide
2
2
 
3
- **Baseline:** Cairnkeep 2.12.0
3
+ **Baseline:** Cairnkeep 2.13.1
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
@@ -12,6 +12,9 @@ Guided setup and the maintained Pi memory extension shipped in v2.11. The v2.12
12
12
  harness registry adds first-class Codex project setup without granting project
13
13
  trust. See [L03](lessons/L03-first-project.md) and
14
14
  [L23](lessons/L23-guided-setup.md) for the tested boundaries.
15
+ Version 2.13 adds local Git-linked work evidence around all generated harness
16
+ launchers; [L13](lessons/L13-session-evidence.md) covers its privacy and
17
+ retention contract.
15
18
 
16
19
  ## The three-layer model
17
20
 
@@ -35,7 +38,7 @@ Run setup in that order, then confirm `cairn doctor`, `cairn sync --check`, and
35
38
  | 2 | Wiki, alignment, graph, repository/security review | Tracked derived knowledge and quality workflows are sufficient |
36
39
  | 3 | Backup, migration, multiple-machine routing | Storage placement and recovery are predictable |
37
40
  | 4 | Document RAG or context exploration | An optional external corpus or faster repository exploration is justified |
38
- | 5 | Trajectories, notes, compaction, artifacts | Local session evidence has an explicit retention purpose |
41
+ | 5 | Trajectories, notes, compaction, artifacts, Git work evidence | Local session evidence has an explicit retention purpose |
39
42
  | 6 | Typed nodes and capability governance | Filtering and centrally inspectable feature state are needed |
40
43
  | 7 | Evaluation and ablation | A concrete change needs bounded measurement |
41
44
  | 8 | Validated skill improvement | Repeated resolved hindsight warrants a measured skill change |
@@ -81,6 +84,7 @@ prerequisites for ordinary memory.
81
84
  | Note enrichment | Distillation plus separate enrichment flag, endpoint, key, and model | No server restart for the offline job | Failure leaves deterministic note usable; unset enrichment flag | `course-05-evidence` |
82
85
  | Compaction continuity | `CAIRN_COMPACTION_CAPTURE=1` | Sync assets and relaunch harness | Inspect provenance/age; remove retained local artifacts explicitly | `course-05-evidence` |
83
86
  | Artifact tools | `CAIRN_ARTIFACT_STORE=1`; HTTP needs a second flag and existing HTTP auth | Restart MCP server when tool exposure changes | `cairn artifact list|show|delete|prune` with dry runs | `course-05-evidence` |
87
+ | Git-linked work evidence | `CAIRN_WORK_EVIDENCE=1`; optional patch also needs `CAIRN_WORK_EVIDENCE_PATCH=1` and the artifact store | Relaunch through a generated harness launcher | `cairn evidence list|show|delete|prune|doctor`; local only, no restore/apply | `course-05-evidence` |
84
88
  | Typed nodes/import | `CAIRN_TYPED_MEMORY_NODES=1` | Restart MCP server; tool schema changes | Hard-filter search; dry-run, replay-safe import; `cairn doctor --repair` only for derived state | `course-05-evidence` |
85
89
  | Capability contract | `CAIRN_CAPABILITY_CONTRACT=1` | MCP changes require restart; operating changes apply next invocation | `cairn capabilities list|status|enable|disable|reset|logging`; digest identifies state only | `course-06-governance` |
86
90
  | Evaluation | `CAIRN_EVAL=1` for the coordinator process | No harness chosen by Cairnkeep | `validate` before `run`; inspect report, missingness and evidence scope; dry-run prune/delete | `course-07-evaluation` |
@@ -44,7 +44,7 @@ expanded only after their labs are executable.
44
44
  | L10 | [Faster context exploration](lessons/L10-context-exploration.md) | Brief | 30 min |
45
45
  | L11 | [Containers and isolation](lessons/L11-containers.md) | Brief | 40 min |
46
46
  | L12 | [Managed overlays](lessons/L12-managed-overlays.md) | Brief | 45 min |
47
- | L13 | [Session evidence and hindsight](lessons/L13-session-evidence.md) | Brief | 45 min |
47
+ | L13 | [Session evidence and hindsight](lessons/L13-session-evidence.md) | Brief | 60 min |
48
48
  | L14 | [Typed memory and controlled import](lessons/L14-typed-memory.md) | Brief | 40 min |
49
49
  | L15 | [Capability governance](lessons/L15-capability-governance.md) | Brief | 35 min |
50
50
  | L16 | [Evaluation and ablation](lessons/L16-evaluation.md) | Brief | 50 min |
@@ -3,7 +3,7 @@
3
3
  **Status:** Ready
4
4
  **Track:** Quickstart
5
5
  **Time:** 10 minutes
6
- **Tested with:** Cairnkeep 2.12.0
6
+ **Tested with:** Cairnkeep 2.13.1
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.12.0
6
+ **Tested with:** Cairnkeep 2.13.1
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.12.0
29
+ podman pull ghcr.io/cairnkeep/cairnkeep:2.13.1
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.12.0 stdio
41
+ ghcr.io/cairnkeep/cairnkeep:2.13.1 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.12.0 and Node.js 22 or newer
6
+ **Tested with:** Cairnkeep 2.13.1 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.12.0
50
+ npm install --global @cairnkeep/cli@2.13.1
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.12.0
6
+ **Tested with:** Cairnkeep 2.13.1
7
7
 
8
8
  ## Outcome
9
9
 
@@ -2,7 +2,7 @@
2
2
 
3
3
  **Status:** Brief
4
4
  **Track:** Practitioner; Evidence and Evaluation
5
- **Planned time:** 45 minutes
5
+ **Planned time:** 60 minutes
6
6
 
7
7
  ## Outcome
8
8
 
@@ -16,12 +16,14 @@ confusing it with reviewed durable memory.
16
16
  hindsight note, explicit shared promotion, and reviewed memory.
17
17
  - Independent consent flags for trajectory capture, note distillation, note
18
18
  enrichment, compaction capture, artifact tools, and artifact HTTP access.
19
+ - Launcher-owned Git work evidence, its local-only read surface, its separate
20
+ patch consent boundary, and why interval evidence is not authorship proof.
19
21
  - Claude Code and OpenCode hooks versus Pi's native `session_shutdown` adapter.
20
22
  - Pre-write redaction, reasoning omission, size limits, 30-day defaults, and
21
23
  fail-open capture behavior.
22
24
  - Compaction summaries as harness-produced continuity evidence, never trusted
23
25
  instructions and never automatic fresh-session context.
24
- - `cairn trajectory`, `cairn notes`, `cairn artifact`, and `cairn doctor
26
+ - `cairn trajectory`, `cairn notes`, `cairn artifact`, `cairn evidence`, and `cairn doctor
25
27
  --repair` inspection and recovery paths.
26
28
 
27
29
  ## Hands-on lab
@@ -62,4 +64,48 @@ cairn artifact list --json
62
64
  - [Operating guide: structured trajectories](../../operating.md#structured-session-trajectories-opt-in)
63
65
  - [Operating guide: hindsight notes](../../operating.md#hindsight-notes-opt-in)
64
66
  - [Privacy and data flow](../../privacy-and-data-flow.md#structured-trajectory-capture)
67
+ - [Git-linked work evidence](../../work-evidence.md)
65
68
  - [Storage and deployment](../../storage.md)
69
+
70
+ ## Git-linked work evidence lab
71
+
72
+ Use a disposable Git repository and a generated launcher. Add this to
73
+ `.ai/.env` without enabling patch capture:
74
+
75
+ ```sh
76
+ CAIRN_WORK_EVIDENCE=1
77
+ ```
78
+
79
+ Launch the selected harness, edit one tracked file and create one untracked
80
+ file, then exit normally. Inspect the result:
81
+
82
+ ```sh
83
+ cairn evidence list --json
84
+ cairn evidence show EVIDENCE-ID --json
85
+ cairn evidence doctor --json
86
+ cairn evidence prune --dry-run --json
87
+ ```
88
+
89
+ The learner should be able to identify the start/end Git state, touched path
90
+ labels, exit status and overall digest; explain why the record does not prove
91
+ authorship; and confirm that no prompt, keystroke, command history or reasoning
92
+ was retained. Repeat with the feature unset and verify that no work-evidence
93
+ directory is created.
94
+
95
+ For the optional patch exercise, use only synthetic content and set both
96
+ `CAIRN_WORK_EVIDENCE_PATCH=1` and `CAIRN_ARTIFACT_STORE=1`. Begin with an
97
+ already-dirty tracked file, make another edit, then verify that the artifact can
98
+ include both because its scope is the start commit to the end worktree. Confirm
99
+ that an untracked file body is absent and that Cairnkeep exposes no apply or
100
+ restore command.
101
+
102
+ ## Recording outline
103
+
104
+ 1. Show the default-off launcher and empty evidence list.
105
+ 2. Enable metadata-only capture, run a short session and inspect its digests.
106
+ 3. Follow one exact trajectory or artifact link without copying its body.
107
+ 4. Demonstrate missing-Git fail-open behavior and the preserved harness exit.
108
+ 5. Enable the two patch prerequisites with synthetic data and explain the
109
+ pre-existing-dirty and untracked-body boundaries.
110
+ 6. Finish with dry-run deletion/pruning, local-only MCP exposure and uninstall
111
+ retention.
@@ -3,7 +3,7 @@
3
3
  **Status:** Ready
4
4
  **Track:** Evidence and Evaluation
5
5
  **Time:** 50 minutes
6
- **Tested with:** Cairnkeep 2.12.0
6
+ **Tested with:** Cairnkeep 2.13.1
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.12.0 and Node.js 22 or newer
4
+ **Tested with:** Cairnkeep 2.13.1 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.12.0 and Node.js 22 or newer
4
+ **Tested with:** Cairnkeep 2.13.1 and Node.js 22 or newer
5
5
  **Time:** 40 minutes
6
6
 
7
7
  ## Outcome
@@ -3,7 +3,7 @@
3
3
  **Status:** Ready
4
4
  **Track:** Operator
5
5
  **Time:** 30 minutes
6
- **Tested with:** Cairnkeep 2.12.0, Windows x64, and Node.js 22 or newer
6
+ **Tested with:** Cairnkeep 2.13.1, 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.12.0
19
+ npm install --global @cairnkeep/cli@2.13.1
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.12.0; Pi 0.84.1; Node.js 22, 24, and 26
6
+ **Tested with:** Cairnkeep 2.13.1; 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.12.0.
137
+ Ready means this lesson and its deterministic contracts pass against v2.13.1.
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.
@@ -13,7 +13,8 @@
13
13
  6. [L19 - Validated skill improvement](../lessons/L19-validated-skill-improvement.md)
14
14
 
15
15
  The track is complete when the learner can explain each consent boundary,
16
- inspect and manage every local evidence store, compare baseline and ablation
16
+ inspect and manage every local evidence store, including Git-linked work
17
+ evidence, compare baseline and ablation
17
18
  reports without making unsupported claims, apply or roll back an exact eligible
18
19
  skill proposal, and distinguish that narrow runtime from the design-only
19
20
  general meta-agent contract.
@@ -53,6 +53,15 @@ Optional `.ai/pre-launch.ps1` and `.ai/post-exit.ps1` seams run in the same
53
53
  PowerShell process, so exported environment changes reach the harness. The post
54
54
  hook receives `$env:CAIRN_EXIT_STATUS`.
55
55
 
56
+ With `CAIRN_WORK_EVIDENCE=1`, the native PowerShell launcher routes all selected
57
+ harnesses through `cairn evidence run`. It uses the system `git.exe`, writes the
58
+ same private project-local format as POSIX systems, and preserves the harness
59
+ exit status. Missing Git, a non-repository directory or capture failure warns
60
+ and launches the harness directly. Optional patch capture additionally requires
61
+ `CAIRN_WORK_EVIDENCE_PATCH=1` and `CAIRN_ARTIFACT_STORE=1`; Windows atomic
62
+ replacement uses the platform file-replace primitive rather than POSIX rename
63
+ semantics.
64
+
56
65
  ## MCP and operating assets
57
66
 
58
67
  Register the stdio server exactly as on other platforms:
package/docs/operating.md CHANGED
@@ -466,6 +466,12 @@ vendor or host.
466
466
  | `CAIRN_TRAJECTORY_RETENTION_DAYS` | Age retention applied on capture/prune (default `30`; `0` removes sessions once they are older than the current instant) |
467
467
  | `CAIRN_TRAJECTORY_REDACTION_FILE` | Optional redaction JSON path contained by the project (default `.ai/trajectory-redaction.json` when that file exists) |
468
468
  | `CAIRN_REDACTION_FILE` | Optional project-contained redaction JSON shared by trajectories and artifacts; takes precedence over `CAIRN_TRAJECTORY_REDACTION_FILE` |
469
+ | `CAIRN_WORK_EVIDENCE` | Capture bounded Git state around generated harness launches (off by default) |
470
+ | `CAIRN_WORK_EVIDENCE_PATCH` | Request an optional redacted patch artifact (off by default; requires `CAIRN_ARTIFACT_STORE`) |
471
+ | `CAIRN_WORK_EVIDENCE_RETENTION_DAYS` | Work-evidence retention (default `30`; `0` disables age pruning) |
472
+ | `CAIRN_WORK_EVIDENCE_STORE_MAX_BYTES` | Project-local metadata budget (default `67108864`, 64 MiB) |
473
+ | `CAIRN_WORK_EVIDENCE_MAX_TOUCHED_PATHS` | Maximum touched-path labels per record (default and hard maximum `4096`) |
474
+ | `CAIRN_WORK_EVIDENCE_PATCH_MAX_BYTES` | Optional patch cap (default `1048576`, 1 MiB; the artifact cap can lower it) |
469
475
  | `CAIRN_COMPACTION_CAPTURE` | Opt in to supported local compaction capture and automatic structured recovery (off by default; unset means zero new work) |
470
476
  | `CAIRN_ARTIFACT_STORE` | Expose the four local stdio artifact tools (off by default; independent of compaction capture) |
471
477
  | `CAIRN_ARTIFACT_HTTP` | Separately expose artifact tools over authenticated HTTP (off by default; also requires `CAIRN_ARTIFACT_STORE`) |
@@ -1042,6 +1048,43 @@ eligible for exact-digest application. See
1042
1048
  [Validated skill improvement](skill-improvement.md) for the command sequence,
1043
1049
  adapter contract, task constraints, and rollback procedure.
1044
1050
 
1051
+ ### Git-linked work evidence (opt-in)
1052
+
1053
+ Set `CAIRN_WORK_EVIDENCE=1` in `.ai/.env` and use a generated harness launcher.
1054
+ The launcher opens a local evidence interval before Claude Code, OpenCode, Pi,
1055
+ Kimi, Qwen or Codex and settles it after exit. A missing Git executable, a
1056
+ non-repository directory or a capture error produces a warning and never blocks
1057
+ the harness. Direct harness launches do not create launcher-owned evidence.
1058
+ The launcher reserves `CAIRN_WORK_EVIDENCE_ID` and `CAIRN_WORK_EVIDENCE_ROOT`
1059
+ for child-process correlation; operators must not set either variable directly.
1060
+
1061
+ ```bash
1062
+ cairn evidence list --json
1063
+ cairn evidence show EVIDENCE-ID --json
1064
+ cairn evidence delete EVIDENCE-ID --dry-run --json
1065
+ cairn evidence prune --dry-run --json
1066
+ cairn evidence doctor --json
1067
+ ```
1068
+
1069
+ The start/end record includes commits, branch/detached/unborn state, dirty
1070
+ state, canonical status/workspace digests, touched path labels, timestamps and
1071
+ exit status. It can append exact trajectory, artifact and reviewed-memory
1072
+ identifiers produced by descendant processes. It captures no prompts,
1073
+ keystrokes, command history or reasoning. Concurrent writers are not
1074
+ attributed, and a path changed then restored to its starting state is invisible.
1075
+
1076
+ Patch capture is a separate consent boundary: both
1077
+ `CAIRN_WORK_EVIDENCE_PATCH=1` and `CAIRN_ARTIFACT_STORE=1` are required. The
1078
+ redacted, bounded diff is computed from the starting commit to the ending
1079
+ worktree, so it can include tracked changes that predated the session; untracked
1080
+ bodies are omitted. Cairnkeep has no apply, restore or replay operation.
1081
+
1082
+ When enabled, local stdio exposes only `work_evidence_list` and
1083
+ `work_evidence_read`; they are read-only, non-destructive, idempotent and
1084
+ closed-world. HTTP never exposes them. See [Git-linked work evidence](work-evidence.md),
1085
+ [storage](storage.md#git-linked-work-evidence) and
1086
+ [privacy](privacy-and-data-flow.md#git-linked-work-evidence).
1087
+
1045
1088
  ### Structured session trajectories (opt-in)
1046
1089
 
1047
1090
  Trajectory capture is disabled by default. To enable it for a launched Claude
@@ -23,6 +23,8 @@ request unless the corresponding endpoint and credential are configured.
23
23
  | Remote HTTP memory | MCP requests and responses, including memory content | The explicitly registered Cairnkeep HTTP server |
24
24
  | Opt-in trajectory capture | None | Local `<project>/.agentfs/trajectory.db` only; no model or HTTP path exists |
25
25
  | Opt-in capability callback records | None | Payload-free final metadata in local `<project>/.agentfs/trajectory.db`; HTTP transport is always skipped |
26
+ | Opt-in Git-linked work evidence | Repository-relative Git state and exact local object identifiers | Local `<Git root>/.agentfs/work-evidence/v1/`; HTTP transport is always skipped |
27
+ | Separately enabled work-evidence patch | Redacted tracked diff from the starting commit to the ending worktree | Local artifact store only; requires both work-evidence patch and artifact-store consent |
26
28
  | Opt-in deterministic note distillation | None | Reads redacted closed trajectories; writes local Markdown + manifest under `${CAIRN_AGENTFS_BASE_DIR:-~/.cairnkeep}/notes/` |
27
29
  | Separately opted-in note enrichment | `CAIRN_LLM_API_KEY` | Sends bounded redacted note evidence to the explicit `CAIRN_LLM_API_URL` chat endpoint |
28
30
  | Typed lifecycle and inline `memory_import` over local stdio | None | Values, metadata, digests, replay bindings, and history remain in the selected local store |
@@ -331,6 +333,40 @@ compaction hooks, or a generic filesystem. With HTTP consent absent, remote
331
333
  clients cannot observe artifact schemas or content. Artifacts have no default egress.
332
334
  Artifacts have no telemetry; local capture/recovery never uses the HTTP route.
333
335
 
336
+ ## Git-linked work evidence
337
+
338
+ Work evidence is disabled unless `CAIRN_WORK_EVIDENCE=1` is present in the
339
+ launcher environment. Generated launchers observe Git immediately before and
340
+ after the harness process and store commit, branch/detached/unborn and dirty
341
+ state, canonical status/workspace digests, bounded touched-path labels,
342
+ timestamps and exit status. Descendant processes may append exact identifiers
343
+ for trajectories, artifacts and reviewed-memory writes. They do not copy those
344
+ bodies into the evidence record.
345
+
346
+ Workspace digests are derived from Git object state and can include the hashes
347
+ of observed untracked content. Bodies are not retained, but hashing is not
348
+ redaction: an observer can test guesses for low-entropy content. Keep secrets
349
+ out of project worktrees and do not enable this feature when path labels or
350
+ content-derived digests exceed the project's retention policy.
351
+
352
+ No prompt, keystroke, shell history, environment value or model reasoning is
353
+ captured. Repository-relative path labels are retained because they are needed
354
+ to explain the observed worktree transition. Concurrent processes are not
355
+ distinguishable, and a path restored to its starting state is not reported as
356
+ touched. The record is evidence of an interval and integrity relationships, not
357
+ proof of authorship.
358
+
359
+ Optional patch capture requires both `CAIRN_WORK_EVIDENCE_PATCH=1` and
360
+ `CAIRN_ARTIFACT_STORE=1`. The diff is computed from the start commit to the end
361
+ worktree, so it can contain tracked edits that existed before launch. Untracked
362
+ bodies are omitted. Existing recursive redaction and the lower configured byte
363
+ cap apply before the artifact is persisted. Cairnkeep never applies, restores
364
+ or sends the patch.
365
+
366
+ `work_evidence_list` and `work_evidence_read` are local-stdio-only observation
367
+ tools. They are absent when the feature is off and absent from authenticated
368
+ HTTP even when it is on. No work-evidence path performs a network request.
369
+
334
370
  ## Structured trajectory capture
335
371
 
336
372
  `CAIRN_TRAJECTORY_CAPTURE` is unset and off by default. When explicitly set to
@@ -84,3 +84,8 @@ cairn uninstall --dry-run . # preview remo
84
84
  For all harnesses, remote HTTP, storage, profiles, context packs, overlays, and
85
85
  recovery details, continue with [Operating Cairnkeep](operating.md) or the
86
86
  [learning path](learning/README.md).
87
+
88
+ To add bounded Git state around future generated-launcher sessions, set
89
+ `CAIRN_WORK_EVIDENCE=1` in `.ai/.env`; inspect it with `cairn evidence list`.
90
+ It is local and off by default. Patch capture remains a separate double-consent
91
+ feature. See [Git-linked work evidence](work-evidence.md).
package/docs/releasing.md CHANGED
@@ -12,8 +12,12 @@ from a workstation.
12
12
  4. Publish a GitHub Release whose tag is exactly `v<package.json version>`.
13
13
  5. The `Publish release` workflow checks out that immutable tag, repeats the
14
14
  tests, and publishes `@cairnkeep/cli` with npm provenance.
15
- 6. The workflow attaches the npm tarball, a CycloneDX SBOM, and SHA-256 checksums
16
- to the GitHub Release.
15
+ 6. The workflow uses the exact locked `@cyclonedx/cyclonedx-npm` development
16
+ dependency to generate a reproducible CycloneDX 1.6 SBOM from
17
+ `package-lock.json`. Generation includes schema validation and runs before
18
+ npm publication, so an invalid document blocks both publication and
19
+ attachment. The workflow attaches that SBOM, the npm tarball, and SHA-256
20
+ checksums to the GitHub Release.
17
21
  7. The workflow publishes versioned `linux/amd64` and `linux/arm64`
18
22
  memory-server and workspace images to GHCR. It also updates `latest` for a
19
23
  stable release or `next` for a prerelease.
package/docs/storage.md CHANGED
@@ -20,6 +20,7 @@ registration, memory remains on that computer.
20
20
  | `project` | `<server working directory>/.agentfs/project.db` |
21
21
  | Opt-in session trajectories and capability callback state | `<harness project root>/.agentfs/trajectory.db` |
22
22
  | Opt-in local artifacts and compaction revisions | `<project root>/.agentfs/artifacts.db` |
23
+ | Opt-in Git-linked work evidence | `<Git root>/.agentfs/work-evidence/v1/` |
23
24
  | Opt-in evaluation reports and note snapshots | `<project root>/.agentfs/eval/experiments/<experiment-id>/` |
24
25
  | Immutable context-pack objects and source records | `${CAIRN_PACK_BASE_DIR:-~/.cairnkeep/packs}/objects/` and `sources/` |
25
26
  | Digest-pinned context-pack project pointers and approvals | `${CAIRN_PACK_BASE_DIR:-~/.cairnkeep/packs}/projects/` |
@@ -128,6 +129,31 @@ the processed-session ledger at 4096 digests per project. Note bodies do not
128
129
  expire automatically: inspect/delete them according to your own retention
129
130
  policy. Trajectory pruning does not delete already-derived notes.
130
131
 
132
+ ## Git-linked work evidence
133
+
134
+ `CAIRN_WORK_EVIDENCE=1` stores private, atomic JSON records below
135
+ `<Git root>/.agentfs/work-evidence/v1/records/` and append-only link sets below
136
+ `links/`. The root is resolved with the system Git executable; ancestor
137
+ symlinks, non-regular records and malformed data fail closed. Files and
138
+ directories are hardened with the same platform-specific private-permission
139
+ boundary used by other local stores.
140
+
141
+ Each record is immutable after it moves from pending to complete. Completion
142
+ captures the final Git observation and an overall digest; it never rewrites the
143
+ start observation. A crash can leave a pending record, which `cairn evidence
144
+ doctor` reports. Doctor may report permissions, corruption and temporary
145
+ remnants, but does not infer or manufacture a missing end state.
146
+
147
+ Defaults are 30 days, 64 MiB of local metadata, 4,096 touched path labels and a
148
+ 1 MiB optional patch cap. Capture and `cairn evidence prune` apply the age and
149
+ budget policy. `delete` and `prune` support dry runs. Patch bodies, when doubly
150
+ enabled, are ordinary redacted artifacts in `.agentfs/artifacts.db`; the
151
+ evidence record keeps only the artifact identifier and digest relationship.
152
+
153
+ Default uninstall retains the project `.agentfs` tree. Explicit
154
+ `--purge-memory` follows the existing backup-first project-store boundary and
155
+ therefore includes work evidence. Memory export does not include it.
156
+
131
157
  ## Artifact storage
132
158
 
133
159
  Artifacts are deliberately separate from memory and trajectories. Local