@cairnkeep/cli 2.11.0 → 2.13.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.
- package/CHANGELOG.md +33 -1
- package/README.md +51 -7
- package/docs/building-an-overlay.md +1 -1
- package/docs/harness-compatibility.md +40 -1
- package/docs/learning/CURRICULUM-MAP.md +10 -7
- package/docs/learning/FEATURE-GUIDE.md +14 -5
- package/docs/learning/README.md +4 -3
- package/docs/learning/lessons/L00-why-cairnkeep.md +1 -1
- package/docs/learning/lessons/L01-safe-trial.md +3 -3
- package/docs/learning/lessons/L02-installation.md +16 -9
- package/docs/learning/lessons/L03-first-project.md +34 -15
- package/docs/learning/lessons/L13-session-evidence.md +48 -2
- package/docs/learning/lessons/L19-validated-skill-improvement.md +1 -1
- package/docs/learning/lessons/L20-mcp-tool-profiles.md +1 -1
- package/docs/learning/lessons/L21-context-packs.md +1 -1
- package/docs/learning/lessons/L22-native-windows.md +9 -9
- package/docs/learning/lessons/L23-guided-setup.md +6 -2
- package/docs/learning/tracks/evidence-and-evaluation.md +2 -1
- package/docs/learning/tracks/quickstart.md +5 -4
- package/docs/native-windows.md +23 -0
- package/docs/operating.md +69 -5
- package/docs/privacy-and-data-flow.md +44 -1
- package/docs/quickstart.md +91 -0
- package/docs/storage.md +26 -0
- package/docs/work-evidence.md +80 -0
- package/examples/eval/bundled-fake.json +1 -1
- package/mcp-memory-server/dist/artifact-cli.js +6 -2
- package/mcp-memory-server/dist/index.js +27 -0
- package/mcp-memory-server/dist/mcp-tool-catalog.js +2 -0
- package/mcp-memory-server/dist/trajectory-cli.js +9 -3
- package/mcp-memory-server/dist/work-evidence-cli.js +121 -0
- package/mcp-memory-server/dist/work-evidence-schema.js +121 -0
- package/mcp-memory-server/dist/work-evidence-store.js +516 -0
- package/mcp-memory-server/package.json +2 -1
- package/package.json +2 -1
- package/schemas/cairnkeep-setup-policy.schema.json +3 -3
- package/schemas/cairnkeep-setup.schema.json +2 -2
- package/scripts/bootstrap.sh +7 -15
- package/scripts/cairn-cli.mjs +2 -0
- package/scripts/completion.sh +19 -9
- package/scripts/doctor.sh +35 -5
- package/scripts/harness-registry.mjs +126 -0
- package/scripts/setup-core.mjs +4 -2
- package/scripts/setup-reconcile.mjs +3 -2
- package/scripts/setup.mjs +41 -5
- package/scripts/test-bootstrap-untracked.sh +2 -1
- package/scripts/test-cli-dispatch.sh +3 -1
- package/scripts/test-completion.sh +6 -0
- package/scripts/test-harness-registry.sh +94 -0
- package/scripts/test-package-install.sh +9 -0
- package/scripts/test-phase19-eval-lifecycle.sh +12 -2
- package/scripts/test-setup-compatibility.mjs +5 -4
- package/scripts/test-uninstall.sh +10 -0
- package/scripts/test-windows-native.mjs +27 -1
- package/scripts/test-work-evidence-cli.sh +89 -0
- package/scripts/uninstall.sh +7 -3
- package/scripts/verify-docs-parity.sh +36 -0
- package/scripts/windows-platform.mjs +28 -7
- package/templates/codex-config.toml.template +5 -0
- package/templates/env.example.template +10 -0
- package/templates/start-claude.sh.template +18 -0
- package/templates/start-codex.sh.template +48 -0
- package/templates/start-kimi.sh.template +17 -0
- package/templates/start-opencode.sh.template +17 -0
- package/templates/start-pi.sh.template +17 -0
- package/templates/start-qwen.sh.template +17 -0
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
**Status:** Brief
|
|
4
4
|
**Track:** Practitioner; Evidence and Evaluation
|
|
5
|
-
**Planned time:**
|
|
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,25 +3,25 @@
|
|
|
3
3
|
**Status:** Ready
|
|
4
4
|
**Track:** Operator
|
|
5
5
|
**Time:** 30 minutes
|
|
6
|
-
**Tested with:** Cairnkeep 2.
|
|
6
|
+
**Tested with:** Cairnkeep 2.13.0, Windows x64, and Node.js 22 or newer
|
|
7
7
|
|
|
8
8
|
## Outcome
|
|
9
9
|
|
|
10
|
-
You can prove that Cairnkeep is running natively from PowerShell,
|
|
11
|
-
path containing spaces, inspect its security boundary, and
|
|
12
|
-
uninstall without relying on WSL or Git Bash.
|
|
10
|
+
You can prove that Cairnkeep is running natively from PowerShell, run guided
|
|
11
|
+
setup on an empty path containing spaces, inspect its security boundary, and
|
|
12
|
+
perform a reversible uninstall without relying on WSL or Git Bash.
|
|
13
13
|
|
|
14
14
|
## Exercise
|
|
15
15
|
|
|
16
16
|
From PowerShell:
|
|
17
17
|
|
|
18
18
|
```powershell
|
|
19
|
-
npm install --global @cairnkeep/cli@2.
|
|
19
|
+
npm install --global @cairnkeep/cli@2.13.0
|
|
20
20
|
cairn version
|
|
21
21
|
|
|
22
22
|
$Lab = Join-Path $env:TEMP 'Cairnkeep Windows Lab'
|
|
23
23
|
New-Item -ItemType Directory -Force -Path $Lab | Out-Null
|
|
24
|
-
cairn
|
|
24
|
+
cairn setup $Lab --git init --harness claude --memory local --yes
|
|
25
25
|
cairn sync --apply --live-root (Join-Path $Lab '.claude-test')
|
|
26
26
|
cairn sync --check --live-root (Join-Path $Lab '.claude-test')
|
|
27
27
|
Push-Location $Lab
|
|
@@ -29,9 +29,9 @@ cairn doctor
|
|
|
29
29
|
Pop-Location
|
|
30
30
|
```
|
|
31
31
|
|
|
32
|
-
Verify that `.ai/
|
|
33
|
-
Claude assets exist. `cairn doctor`
|
|
34
|
-
an MCP stdio handshake.
|
|
32
|
+
Verify that `.git`, `.ai/cairnkeep.json`, `.ai/start-claude.cmd`,
|
|
33
|
+
`.ai/start-harness.ps1`, and the managed Claude assets exist. `cairn doctor`
|
|
34
|
+
must identify native Windows x64 and complete an MCP stdio handshake.
|
|
35
35
|
|
|
36
36
|
## Permission check
|
|
37
37
|
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
**Status:** Ready
|
|
4
4
|
**Track:** Quickstart and Operator
|
|
5
5
|
**Time:** 35 minutes
|
|
6
|
-
**Tested with:** Cairnkeep 2.
|
|
6
|
+
**Tested with:** Cairnkeep 2.13.0; Pi 0.84.1; Node.js 22, 24, and 26
|
|
7
7
|
|
|
8
8
|
## Outcome
|
|
9
9
|
|
|
@@ -11,6 +11,10 @@ You can classify a missing or empty target, replay setup without a TTY, explain
|
|
|
11
11
|
the limitations of Git-less mode, verify Pi's local stdio memory bridge, and
|
|
12
12
|
recover or uninstall every managed asset without hidden machine changes.
|
|
13
13
|
|
|
14
|
+
The selected harnesses come from Cairnkeep's declarative registry. Codex is a
|
|
15
|
+
supported selection: it receives `.codex/config.toml` and a launcher, while Pi
|
|
16
|
+
continues to require its separate explicit machine sync.
|
|
17
|
+
|
|
14
18
|
## Prerequisites
|
|
15
19
|
|
|
16
20
|
- Node.js 22 or newer, npm, and Git for the main exercise.
|
|
@@ -130,7 +134,7 @@ prompts, approve skills, create an autonomous loop, or add remote access.
|
|
|
130
134
|
|
|
131
135
|
## Release boundary
|
|
132
136
|
|
|
133
|
-
Ready means this lesson and its deterministic contracts pass against v2.
|
|
137
|
+
Ready means this lesson and its deterministic contracts pass against v2.13.0.
|
|
134
138
|
Release readiness requires a non-skipping acceptance run
|
|
135
139
|
against separate Pi 0.84.1 minimum and explicitly versioned registry-current
|
|
136
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,
|
|
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.
|
|
@@ -7,14 +7,15 @@
|
|
|
7
7
|
1. [L00 - Why Cairnkeep?](../lessons/L00-why-cairnkeep.md)
|
|
8
8
|
2. [L01 - Try it safely](../lessons/L01-safe-trial.md)
|
|
9
9
|
3. [L02 - Install the local workflow](../lessons/L02-installation.md)
|
|
10
|
-
4. [L03 -
|
|
10
|
+
4. [L03 - Set up the first project](../lessons/L03-first-project.md)
|
|
11
11
|
5. [L23 - Guided setup and Pi memory](../lessons/L23-guided-setup.md)
|
|
12
12
|
|
|
13
13
|
The track is complete when a learner can start a new harness session, retrieve
|
|
14
14
|
a previously accepted fact, and explain that default stdio memory is stored on
|
|
15
|
-
the local machine rather than a discovered remote service.
|
|
16
|
-
|
|
17
|
-
|
|
15
|
+
the local machine rather than a discovered remote service. L03 uses the
|
|
16
|
+
recommended guided entry point and offers Codex's project-scoped path without a
|
|
17
|
+
separate machine sync; L23 extends that contract to Pi's maintained local stdio
|
|
18
|
+
bridge while keeping its machine sync explicit.
|
|
18
19
|
|
|
19
20
|
Hands-on spine: `course-00-app` through `course-01-bootstrap`, followed by
|
|
20
21
|
`course-12-guided-setup`, in the public
|
package/docs/native-windows.md
CHANGED
|
@@ -32,6 +32,20 @@ recovery contract as POSIX. It writes a restricted `.ai/cairnkeep.json` setup
|
|
|
32
32
|
record and never syncs machine assets automatically. `cairn bootstrap` remains
|
|
33
33
|
the deterministic compatibility primitive for existing scripts.
|
|
34
34
|
|
|
35
|
+
For Codex memory without a harness-wide sync, select only Codex:
|
|
36
|
+
|
|
37
|
+
```powershell
|
|
38
|
+
cairn setup $Project --git init --harness codex --memory local --yes
|
|
39
|
+
Set-Location $Project
|
|
40
|
+
cairn doctor
|
|
41
|
+
.\.ai\start-codex.cmd
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
Review `.codex\config.toml` and accept Codex's project-trust prompt. Setup does
|
|
45
|
+
not edit the user-wide Codex configuration or grant trust. It preserves a
|
|
46
|
+
different existing project configuration and doctor verifies a manually merged
|
|
47
|
+
`mcp_servers.cairn-memory` table.
|
|
48
|
+
|
|
35
49
|
Setup and bootstrap write both the established Unix launchers and native Windows
|
|
36
50
|
launchers. Each `.cmd` file enters `start-harness.ps1`, loads `.ai/.env`, changes
|
|
37
51
|
to the project root, and forwards arguments without shell interpolation.
|
|
@@ -39,6 +53,15 @@ Optional `.ai/pre-launch.ps1` and `.ai/post-exit.ps1` seams run in the same
|
|
|
39
53
|
PowerShell process, so exported environment changes reach the harness. The post
|
|
40
54
|
hook receives `$env:CAIRN_EXIT_STATUS`.
|
|
41
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
|
+
|
|
42
65
|
## MCP and operating assets
|
|
43
66
|
|
|
44
67
|
Register the stdio server exactly as on other platforms:
|
package/docs/operating.md
CHANGED
|
@@ -70,7 +70,7 @@ cairn setup /path/to/project --git init --harness claude,pi --memory local --yes
|
|
|
70
70
|
```
|
|
71
71
|
|
|
72
72
|
The deterministic form accepts `--git init|existing|none`, a comma-separated
|
|
73
|
-
subset of `claude,opencode,pi,kimi,qwen`, and `--memory local|none`. `--git
|
|
73
|
+
subset of `claude,opencode,pi,kimi,qwen,codex`, and `--memory local|none`. `--git
|
|
74
74
|
existing` requires the target to be in an existing work tree. `--git init`
|
|
75
75
|
requires Git and is the only non-interactive authorization to initialize a
|
|
76
76
|
repository. `--git none` is an explicit limited mode: repository-aware features
|
|
@@ -91,8 +91,10 @@ assets. It contains no credentials, endpoints, or absolute paths.
|
|
|
91
91
|
|
|
92
92
|
Setup never installs or refreshes machine-level harness assets. Its
|
|
93
93
|
`machine_sync.automatic` field is always false, and the human output labels the
|
|
94
|
-
reported command as not run automatically.
|
|
95
|
-
|
|
94
|
+
reported command as not run automatically. For selections such as Codex and
|
|
95
|
+
Qwen that need no machine sync, `machine_sync.command` is `null` and the human
|
|
96
|
+
output says that sync is not required. Apply any reported command explicitly,
|
|
97
|
+
check it, then diagnose and launch:
|
|
96
98
|
|
|
97
99
|
```bash
|
|
98
100
|
cairn sync --apply # Claude Code operating assets
|
|
@@ -105,6 +107,25 @@ cd /path/to/project && cairn doctor
|
|
|
105
107
|
`cairn bootstrap [--untracked] PATH` remains available for scripts that depend
|
|
106
108
|
on its original scaffold and Git-exclusion contract.
|
|
107
109
|
|
|
110
|
+
## Setup order (Codex CLI)
|
|
111
|
+
|
|
112
|
+
Codex uses project-scoped configuration, so setup owns the complete local MCP
|
|
113
|
+
wiring without editing user-wide state:
|
|
114
|
+
|
|
115
|
+
```bash
|
|
116
|
+
npm install -g @cairnkeep/cli
|
|
117
|
+
cairn setup /path/to/project --git init --harness codex --memory local --yes
|
|
118
|
+
cd /path/to/project
|
|
119
|
+
cairn doctor
|
|
120
|
+
./.ai/start-codex.sh # native Windows: .\.ai\start-codex.cmd
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
Review `.codex/config.toml` and accept Codex's project-trust prompt before use.
|
|
124
|
+
An existing different file is preserved and reported as skipped; merge the
|
|
125
|
+
generated `mcp_servers.cairn-memory` table into it, then run `cairn doctor`.
|
|
126
|
+
Uninstall leaves that operator-owned file intact. Selecting
|
|
127
|
+
`--memory none` creates the launcher but deliberately omits the MCP entry.
|
|
128
|
+
|
|
108
129
|
## Setup order (Claude Code)
|
|
109
130
|
|
|
110
131
|
The commands below install the default local topology: `cairn-memory` runs as a
|
|
@@ -445,6 +466,12 @@ vendor or host.
|
|
|
445
466
|
| `CAIRN_TRAJECTORY_RETENTION_DAYS` | Age retention applied on capture/prune (default `30`; `0` removes sessions once they are older than the current instant) |
|
|
446
467
|
| `CAIRN_TRAJECTORY_REDACTION_FILE` | Optional redaction JSON path contained by the project (default `.ai/trajectory-redaction.json` when that file exists) |
|
|
447
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) |
|
|
448
475
|
| `CAIRN_COMPACTION_CAPTURE` | Opt in to supported local compaction capture and automatic structured recovery (off by default; unset means zero new work) |
|
|
449
476
|
| `CAIRN_ARTIFACT_STORE` | Expose the four local stdio artifact tools (off by default; independent of compaction capture) |
|
|
450
477
|
| `CAIRN_ARTIFACT_HTTP` | Separately expose artifact tools over authenticated HTTP (off by default; also requires `CAIRN_ARTIFACT_STORE`) |
|
|
@@ -865,13 +892,13 @@ maintain a running install — without forking the core. All are opt-in.
|
|
|
865
892
|
### Launcher seams
|
|
866
893
|
|
|
867
894
|
The generic launchers (`.ai/start-claude.sh`, `.ai/start-opencode.sh`,
|
|
868
|
-
`.ai/start-kimi.sh`, `.ai/start-qwen.sh`, and `.ai/start-pi.sh`) run optional hooks around the
|
|
895
|
+
`.ai/start-kimi.sh`, `.ai/start-qwen.sh`, `.ai/start-codex.sh`, and `.ai/start-pi.sh`) run optional hooks around the
|
|
869
896
|
harness, each a no-op when absent:
|
|
870
897
|
|
|
871
898
|
| Seam | When | Purpose |
|
|
872
899
|
|---|---|---|
|
|
873
900
|
| `.ai/pre-launch.sh` | sourced after `.env`, before launch | export env (e.g. a provider base URL / auth), refresh credentials, or abort by returning non-zero |
|
|
874
|
-
| `CAIRN_EXTRA_SETTINGS` | read just before launch | path to a settings file layered on Claude Code (`--settings`) or OpenCode (`OPENCODE_CONFIG`); Kimi, Qwen, and Pi leave the variable available to hooks but do not interpret it |
|
|
901
|
+
| `CAIRN_EXTRA_SETTINGS` | read just before launch | path to a settings file layered on Claude Code (`--settings`) or OpenCode (`OPENCODE_CONFIG`); Kimi, Qwen, Codex, and Pi leave the variable available to hooks but do not interpret it |
|
|
875
902
|
| `.ai/post-exit.sh` | sourced after the harness exits | teardown; `CAIRN_EXIT_STATUS` holds the exit code |
|
|
876
903
|
|
|
877
904
|
A wrapper that needs a non-default provider drops a `pre-launch.sh` that renders
|
|
@@ -1021,6 +1048,43 @@ eligible for exact-digest application. See
|
|
|
1021
1048
|
[Validated skill improvement](skill-improvement.md) for the command sequence,
|
|
1022
1049
|
adapter contract, task constraints, and rollback procedure.
|
|
1023
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
|
+
|
|
1024
1088
|
### Structured session trajectories (opt-in)
|
|
1025
1089
|
|
|
1026
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 |
|
|
@@ -37,6 +39,7 @@ request unless the corresponding endpoint and credential are configured.
|
|
|
37
39
|
| Explicit artifact read/show | The redacted body only when HTTP is separately enabled and the operator/client explicitly reads it | Local terminal/stdio, or the explicitly registered authenticated server |
|
|
38
40
|
| Opt-in evaluation coordinator | Adapter-defined inference may leave the machine only according to the explicit operator-owned adapter and inherited environment | Local adapter subprocess; Cairnkeep supplies no provider, endpoint, credential, model, or network default |
|
|
39
41
|
| Guided project setup | None | Selected scaffold assets and private `.ai/cairnkeep.json` state in the target; machine sync is never automatic |
|
|
42
|
+
| Codex project setup and launcher | None | Local `.codex/config.toml` starts `cairn memory-server` over stdio only after the operator trusts the project |
|
|
40
43
|
| Pi memory extension | None | Local `cairn memory-server` stdio child; no HTTP transport is inherited |
|
|
41
44
|
|
|
42
45
|
Model endpoints may be local or remote. Cairnkeep cannot determine a provider's
|
|
@@ -93,7 +96,7 @@ and its generated `revert.sh` restores exact bytes, modes, and layout. Explicit
|
|
|
93
96
|
`cairn eval delete` and `prune` remove selected contained experiment trees with
|
|
94
97
|
no hidden tombstone.
|
|
95
98
|
|
|
96
|
-
## Guided setup and Pi bridge
|
|
99
|
+
## Guided setup, Codex, and Pi bridge
|
|
97
100
|
|
|
98
101
|
Guided setup performs a read-only target and Git preflight before project
|
|
99
102
|
writes. Its schema-v1 `.ai/cairnkeep.json` record contains the package version,
|
|
@@ -103,6 +106,12 @@ endpoints, absolute paths, prompts, or memory values. The file is mode `0600`
|
|
|
103
106
|
on POSIX and receives the private managed-file ACL on native Windows. Setup
|
|
104
107
|
never invokes machine sync, and it does not start a harness or server child.
|
|
105
108
|
|
|
109
|
+
Selecting Codex with local memory adds a non-secret project MCP table that
|
|
110
|
+
invokes `cairn memory-server`. Setup never edits user-wide Codex configuration,
|
|
111
|
+
grants project trust, or overwrites a different `.codex/config.toml`. Doctor can
|
|
112
|
+
validate a manually merged Cairnkeep table without claiming ownership of the
|
|
113
|
+
surrounding operator configuration, and uninstall leaves that file intact.
|
|
114
|
+
|
|
106
115
|
When the explicitly installed Pi memory extension starts a session, it spawns
|
|
107
116
|
`cairn memory-server` as a child in the project directory over local stdio. The
|
|
108
117
|
bridge removes `MCP_HTTP_PORT` from the child environment, retains only the
|
|
@@ -324,6 +333,40 @@ compaction hooks, or a generic filesystem. With HTTP consent absent, remote
|
|
|
324
333
|
clients cannot observe artifact schemas or content. Artifacts have no default egress.
|
|
325
334
|
Artifacts have no telemetry; local capture/recovery never uses the HTTP route.
|
|
326
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
|
+
|
|
327
370
|
## Structured trajectory capture
|
|
328
371
|
|
|
329
372
|
`CAIRN_TRAJECTORY_CAPTURE` is unset and off by default. When explicitly set to
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
# Cairnkeep quickstart
|
|
2
|
+
|
|
3
|
+
This is the shortest supported route from an empty directory or existing Git
|
|
4
|
+
repository to durable, local agent memory. The default transport is stdio and
|
|
5
|
+
the default store stays on this computer.
|
|
6
|
+
|
|
7
|
+
## Codex CLI
|
|
8
|
+
|
|
9
|
+
Install Cairnkeep, then let guided setup initialize an empty project and write
|
|
10
|
+
Codex's project-scoped MCP entry:
|
|
11
|
+
|
|
12
|
+
```bash
|
|
13
|
+
npm install --global @cairnkeep/cli
|
|
14
|
+
cairn setup /path/to/project --git init --harness codex --memory local --yes
|
|
15
|
+
cd /path/to/project
|
|
16
|
+
cairn doctor
|
|
17
|
+
./.ai/start-codex.sh
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
Use `--git existing` instead when the target is already a Git work tree. On
|
|
21
|
+
native Windows, launch with `.\.ai\start-codex.cmd`.
|
|
22
|
+
|
|
23
|
+
Before the first session, review `.codex/config.toml` and accept Codex's project
|
|
24
|
+
trust prompt. The generated entry runs `cairn memory-server` locally. Setup
|
|
25
|
+
does not edit the user-wide Codex configuration and does not enable networking,
|
|
26
|
+
telemetry, embeddings, session capture, or context packs.
|
|
27
|
+
|
|
28
|
+
If `.codex/config.toml` already exists and differs, setup reports it as
|
|
29
|
+
`skipped` and preserves it byte-for-byte. Merge this table into the existing
|
|
30
|
+
file, then run `cairn doctor`:
|
|
31
|
+
|
|
32
|
+
```toml
|
|
33
|
+
[mcp_servers.cairn-memory]
|
|
34
|
+
command = "cairn"
|
|
35
|
+
args = ["memory-server"]
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
## Claude Code
|
|
39
|
+
|
|
40
|
+
Claude Code has the full Cairnkeep operating layer, so it needs one explicit
|
|
41
|
+
machine-level sync in addition to project setup:
|
|
42
|
+
|
|
43
|
+
```bash
|
|
44
|
+
npm install --global @cairnkeep/cli
|
|
45
|
+
claude mcp add cairn-memory -s user -- cairn memory-server
|
|
46
|
+
cairn sync --apply
|
|
47
|
+
cairn setup /path/to/project --git init --harness claude --memory local --yes
|
|
48
|
+
cd /path/to/project
|
|
49
|
+
cairn doctor
|
|
50
|
+
./.ai/start-claude.sh
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
Setup reports machine-level commands but never executes them. This keeps
|
|
54
|
+
project scaffolding separate from harness-wide changes.
|
|
55
|
+
|
|
56
|
+
## First memory cycle
|
|
57
|
+
|
|
58
|
+
In a harness with Cairnkeep commands, remember one durable fact and recall it:
|
|
59
|
+
|
|
60
|
+
```text
|
|
61
|
+
> /remember Use transactional migrations for schema changes
|
|
62
|
+
> /recall transactional migrations
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
In Codex or another MCP client, ask the client to call `memory_write`, then
|
|
66
|
+
`memory_search`. Close the session, start a new one, and repeat the search. The
|
|
67
|
+
result should survive the restart.
|
|
68
|
+
|
|
69
|
+
## What setup owns
|
|
70
|
+
|
|
71
|
+
`cairn setup` creates only the selected harness assets plus the common `.ai`,
|
|
72
|
+
`.planning`, and `.agentfs` scaffold. It initializes Git only with explicit
|
|
73
|
+
`--git init`, preserves unrelated files, does not overwrite modified files it
|
|
74
|
+
does not own, and records managed digests in private `.ai/cairnkeep.json`.
|
|
75
|
+
|
|
76
|
+
Useful follow-ups:
|
|
77
|
+
|
|
78
|
+
```bash
|
|
79
|
+
cairn setup . --git existing --harness codex --memory local --yes # reconcile
|
|
80
|
+
cairn doctor # diagnose
|
|
81
|
+
cairn uninstall --dry-run . # preview removal
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
For all harnesses, remote HTTP, storage, profiles, context packs, overlays, and
|
|
85
|
+
recovery details, continue with [Operating Cairnkeep](operating.md) or the
|
|
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/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
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
# Git-linked work evidence
|
|
2
|
+
|
|
3
|
+
Cairnkeep can record a bounded, local account of the Git state surrounding a
|
|
4
|
+
harness session. The feature is off by default. Enable it in the project's
|
|
5
|
+
`.ai/.env`:
|
|
6
|
+
|
|
7
|
+
```sh
|
|
8
|
+
CAIRN_WORK_EVIDENCE=1
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
Generated Claude Code, OpenCode, Pi, Kimi, Qwen and Codex launchers then start
|
|
12
|
+
an evidence record before the harness and settle it after the harness exits.
|
|
13
|
+
The harness still launches when Git is unavailable, the directory is not a Git
|
|
14
|
+
worktree, or evidence capture fails; Cairnkeep prints a warning instead of
|
|
15
|
+
turning optional evidence into an availability dependency.
|
|
16
|
+
|
|
17
|
+
## Recorded metadata
|
|
18
|
+
|
|
19
|
+
Each completed record contains the harness, start/end timestamps, exit status,
|
|
20
|
+
repository-relative identity, and the start/end commit, branch, detached or
|
|
21
|
+
unborn state, dirty state, status digest and workspace digest. It also contains
|
|
22
|
+
a bounded list of paths whose observed state changed during the session and an
|
|
23
|
+
overall evidence digest.
|
|
24
|
+
|
|
25
|
+
Workspace digests are content-derived, including for observed untracked files.
|
|
26
|
+
They do not retain file bodies, but low-entropy candidate content can sometimes
|
|
27
|
+
be tested against a known digest; do not treat hashing as redaction.
|
|
28
|
+
|
|
29
|
+
Records may link to exact trajectories, artifacts and reviewed-memory writes
|
|
30
|
+
created while that launcher-owned session is active. Links are append-only and
|
|
31
|
+
carry identifiers, not copied content. Cairnkeep does not capture keystrokes,
|
|
32
|
+
prompts, shell history or model reasoning.
|
|
33
|
+
|
|
34
|
+
The record describes a time interval, not authorship. Concurrent processes can
|
|
35
|
+
change the same worktree, and a file changed and restored to its starting state
|
|
36
|
+
will not appear as touched. Treat the evidence as integrity-linked operational
|
|
37
|
+
context, not proof that a particular person or model made a change.
|
|
38
|
+
|
|
39
|
+
## Optional patch artifact
|
|
40
|
+
|
|
41
|
+
Patch capture requires two independent feature flags:
|
|
42
|
+
|
|
43
|
+
```sh
|
|
44
|
+
CAIRN_WORK_EVIDENCE_PATCH=1
|
|
45
|
+
CAIRN_ARTIFACT_STORE=1
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
The patch is produced at session end from the starting commit to the ending
|
|
49
|
+
worktree. It can therefore include tracked changes that already existed when
|
|
50
|
+
the session started. Untracked file names can appear in metadata, but their
|
|
51
|
+
bodies are not included. The patch is redacted, bounded by the lower of the
|
|
52
|
+
work-evidence and artifact limits, and stored in the existing artifact store.
|
|
53
|
+
Cairnkeep provides no patch apply, restore or replay command.
|
|
54
|
+
|
|
55
|
+
## Inspect and maintain
|
|
56
|
+
|
|
57
|
+
```sh
|
|
58
|
+
cairn evidence list [--status pending|complete] [--json]
|
|
59
|
+
cairn evidence show <evidence-id-or-prefix> [--json]
|
|
60
|
+
cairn evidence delete <evidence-id-or-prefix> [--dry-run] [--json]
|
|
61
|
+
cairn evidence prune [--dry-run] [--json]
|
|
62
|
+
cairn evidence doctor [--repair] [--json]
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
Metadata and links live below
|
|
66
|
+
`<repository>/.agentfs/work-evidence/v1/`. Records default to 30-day retention,
|
|
67
|
+
1 MiB per optional patch, 4,096 touched paths and a 64 MiB metadata budget.
|
|
68
|
+
Interrupted sessions remain visibly pending rather than being fabricated as
|
|
69
|
+
complete. `doctor` reports malformed records, broken links, permission drift,
|
|
70
|
+
temporary remnants and stale pending sessions. `--repair` can remove temporary
|
|
71
|
+
remnants, but it does not change records or invent an ending Git state.
|
|
72
|
+
|
|
73
|
+
With the feature enabled, local stdio MCP registers `work_evidence_list` and
|
|
74
|
+
`work_evidence_read`. Both are read-only, non-destructive, idempotent and
|
|
75
|
+
closed-world. They are never exposed by the HTTP transport. MCP profiles can
|
|
76
|
+
further restrict them, but cannot enable the feature.
|
|
77
|
+
|
|
78
|
+
Ordinary uninstall retains the project `.agentfs` boundary. As with other
|
|
79
|
+
project evidence stores, `cairn uninstall --purge-memory` backs up and removes
|
|
80
|
+
it only after explicit confirmation.
|