@cairnkeep/cli 2.9.0 → 2.11.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 (78) hide show
  1. package/CHANGELOG.md +46 -1
  2. package/README.md +54 -25
  3. package/bin/cairn +6 -165
  4. package/bin/cairn-container +8 -0
  5. package/docs/building-an-overlay.md +41 -4
  6. package/docs/containers.md +10 -0
  7. package/docs/harness-compatibility.md +30 -2
  8. package/docs/learning/CURRICULUM-MAP.md +9 -3
  9. package/docs/learning/FEATURE-GUIDE.md +9 -3
  10. package/docs/learning/README.md +2 -0
  11. package/docs/learning/lessons/L00-why-cairnkeep.md +1 -1
  12. package/docs/learning/lessons/L01-safe-trial.md +3 -3
  13. package/docs/learning/lessons/L02-installation.md +11 -2
  14. package/docs/learning/lessons/L03-first-project.md +1 -1
  15. package/docs/learning/lessons/L19-validated-skill-improvement.md +1 -1
  16. package/docs/learning/lessons/L20-mcp-tool-profiles.md +1 -1
  17. package/docs/learning/lessons/L21-context-packs.md +1 -1
  18. package/docs/learning/lessons/L22-native-windows.md +83 -0
  19. package/docs/learning/lessons/L23-guided-setup.md +138 -0
  20. package/docs/learning/tracks/operator.md +8 -3
  21. package/docs/learning/tracks/quickstart.md +7 -3
  22. package/docs/native-windows.md +122 -0
  23. package/docs/operating.md +119 -18
  24. package/docs/privacy-and-data-flow.md +34 -1
  25. package/docs/storage.md +14 -2
  26. package/examples/eval/bundled-fake.json +1 -1
  27. package/mcp-memory-server/dist/artifact-store-windows-worker.js +74 -0
  28. package/mcp-memory-server/dist/artifact-store.js +196 -55
  29. package/mcp-memory-server/dist/capability-cli.js +2 -1
  30. package/mcp-memory-server/dist/capability-config.js +4 -3
  31. package/mcp-memory-server/dist/capability-harness.js +34 -7
  32. package/mcp-memory-server/dist/context-pack.js +84 -25
  33. package/mcp-memory-server/dist/eval-cli.js +6 -5
  34. package/mcp-memory-server/dist/eval-plan.js +35 -13
  35. package/mcp-memory-server/dist/eval-process.js +11 -4
  36. package/mcp-memory-server/dist/eval-report.js +7 -5
  37. package/mcp-memory-server/dist/graph-cli.js +7 -1
  38. package/mcp-memory-server/dist/index.js +19 -20
  39. package/mcp-memory-server/dist/mcp-tool-profile.js +6 -4
  40. package/mcp-memory-server/dist/note-store.js +12 -3
  41. package/mcp-memory-server/dist/pi-mcp-bridge.js +185 -0
  42. package/mcp-memory-server/dist/platform-security.js +102 -0
  43. package/mcp-memory-server/dist/skill-store.js +27 -12
  44. package/mcp-memory-server/package.json +2 -1
  45. package/package.json +5 -4
  46. package/pi/extensions/cairnkeep-memory.ts +61 -0
  47. package/schemas/cairnkeep-setup-policy.schema.json +55 -0
  48. package/schemas/cairnkeep-setup.schema.json +36 -0
  49. package/scripts/cairn-cli.mjs +119 -0
  50. package/scripts/cairn-container-cli.mjs +121 -0
  51. package/scripts/cairn-hook.mjs +199 -0
  52. package/scripts/completion.sh +12 -3
  53. package/scripts/doctor.sh +57 -0
  54. package/scripts/fix-permissions.mjs +12 -0
  55. package/scripts/memory-wiki-audit.mjs +95 -0
  56. package/scripts/phase26-test-manifest.mjs +26 -0
  57. package/scripts/run-repository-tests.mjs +76 -0
  58. package/scripts/setup-core.mjs +310 -0
  59. package/scripts/setup-reconcile.mjs +331 -0
  60. package/scripts/setup.mjs +306 -0
  61. package/scripts/sync-pi-assets.sh +19 -4
  62. package/scripts/test-completion.sh +39 -0
  63. package/scripts/test-doctor.sh +66 -0
  64. package/scripts/test-learning-docs.sh +52 -3
  65. package/scripts/test-package-install.sh +64 -0
  66. package/scripts/test-phase17-artifact-lifecycle.sh +1 -1
  67. package/scripts/test-phase18-capability-lifecycle.sh +1 -1
  68. package/scripts/test-pi-lifecycle.mjs +190 -0
  69. package/scripts/test-setup-compatibility.mjs +186 -0
  70. package/scripts/test-setup-output.sh +131 -0
  71. package/scripts/test-setup-overlay.sh +113 -0
  72. package/scripts/test-setup-preflight.mjs +281 -0
  73. package/scripts/test-setup-reconcile.mjs +257 -0
  74. package/scripts/test-uninstall.sh +50 -0
  75. package/scripts/test-windows-native.mjs +136 -0
  76. package/scripts/uninstall.sh +69 -6
  77. package/scripts/verify-pi-mcp-bridge.mjs +588 -0
  78. package/scripts/windows-platform.mjs +725 -0
package/CHANGELOG.md CHANGED
@@ -5,6 +5,50 @@ All notable user-facing changes are documented here. This project follows
5
5
 
6
6
  ## [Unreleased]
7
7
 
8
+ ## [2.11.0] - 2026-08-12
9
+
10
+ ### Added
11
+
12
+ - Replace the Bash npm entry point with a cross-platform Node CLI while keeping
13
+ the established Unix scripts as compatibility implementations.
14
+ - Add native Windows x64 bootstrap and `.cmd`/PowerShell launchers, Claude/Pi/
15
+ Kimi asset synchronization, Node hook transports, diagnostics, PowerShell
16
+ completion, Task Scheduler registration, memory import/export plumbing, and
17
+ backup-first uninstall with a `revert.ps1` manifest.
18
+ - Enforce private Windows ACLs for least-authority MCP profiles and context-pack
19
+ state, make pack objects read-only, retry Windows atomic replacements, and
20
+ terminate evaluation adapter descendant trees through `taskkill.exe /T`.
21
+ - Add a PowerShell-only Windows CI matrix for Node 22/24/26, including native
22
+ lifecycle tests and a packed global npm installation under paths containing
23
+ spaces and Unicode.
24
+
25
+ ### Changed
26
+
27
+ - Add PowerShell to shell completion and document Windows x64 as a supported
28
+ native platform. Windows ARM64 remains an x64-emulation target until the
29
+ storage dependency ships a native ARM64 binding.
30
+
31
+ ### Added
32
+
33
+ - Add `cairn setup` as the recommended guided project entry point, with a fully
34
+ deterministic non-interactive form, explicit Git/harness/memory choices,
35
+ versioned private project state, selected-asset reconciliation, structured
36
+ output, doctor diagnostics, and recovery commands.
37
+ - Add a strict provider-neutral setup-policy schema for private overlays, with
38
+ command-line choices taking precedence over policy defaults and constraints
39
+ enforced on every resolved plan.
40
+ - Add the maintained Pi local stdio memory extension, dynamic MCP catalog
41
+ discovery, bounded child lifecycle, cancellation, exact response preservation,
42
+ and trusted annotation metadata. Pi 0.84.1 is the validated minimum.
43
+
44
+ ### Changed
45
+
46
+ - Make project setup report machine sync without running it automatically;
47
+ `cairn sync-pi --apply|--check`, `cairn doctor`, and backup-first uninstall
48
+ remain explicit lifecycle operations.
49
+ - Preserve `cairn bootstrap` and `--untracked` as backward-compatible scripted
50
+ primitives while recommending guided setup for new onboarding.
51
+
8
52
  ## [2.9.0] - 2026-08-06
9
53
 
10
54
  ### Added
@@ -273,7 +317,8 @@ stored memories.
273
317
  - Preserve executable permissions and Bash 3.2 portability on macOS.
274
318
  - Add backup-first uninstall and SQLite-safe memory export/import guidance.
275
319
 
276
- [Unreleased]: https://github.com/cairnkeep/cairnkeep/compare/v2.9.0...HEAD
320
+ [Unreleased]: https://github.com/cairnkeep/cairnkeep/compare/v2.11.0...HEAD
321
+ [2.11.0]: https://github.com/cairnkeep/cairnkeep/compare/v2.9.0...v2.11.0
277
322
  [2.9.0]: https://github.com/cairnkeep/cairnkeep/compare/v2.8.0...v2.9.0
278
323
  [2.8.0]: https://github.com/cairnkeep/cairnkeep/compare/v2.7.0...v2.8.0
279
324
  [2.7.0]: https://github.com/cairnkeep/cairnkeep/compare/v2.6.0...v2.7.0
package/README.md CHANGED
@@ -14,19 +14,22 @@ Qwen Code, Pi, and other MCP clients).
14
14
 
15
15
  ## Status
16
16
 
17
- Shipped: the memory server, the `cairn` CLI (`bootstrap`, `memory-server`, `sync`, `sync-pi`, `sync-kimi`,
17
+ Shipped: the memory server, the `cairn` CLI (`setup`, `bootstrap`, `memory-server`, `sync`, `sync-pi`, `sync-kimi`,
18
18
  `doctor`, `trajectory`, `artifact`, `mcp-tools`, `pack`, `notes`, `memory`, `eval`, `audit-timer`, `completion`, `uninstall`) installable via
19
19
  `npm i -g @cairnkeep/cli`, and the
20
20
  operating layer (commands,
21
- agents, hooks) installed on Claude Code and OpenCode, plus a native Pi
21
+ agents, hooks) installed on Claude Code and OpenCode, plus the native Pi
22
22
  trajectory extension and thin Pi/Kimi graph adapters. The generic launchers
23
- expose wrapper seams (`.ai/pre-launch.sh`, `CAIRN_EXTRA_SETTINGS`,
24
- `.ai/post-exit.sh`) so an enterprise wrapper can add provider/credential setup
23
+ expose wrapper seams (`.ai/pre-launch.sh`/`.ai/pre-launch.ps1`,
24
+ `CAIRN_EXTRA_SETTINGS`, `.ai/post-exit.sh`/`.ai/post-exit.ps1`) so an enterprise wrapper can add provider/credential setup
25
25
  without forking them. Also shipped: context exploration (`/context-explore`) and
26
26
  a thin routing seam (`route_check`), both of which delegate to
27
27
  [token-miser](https://github.com/cairnkeep/token-miser), a public
28
28
  cairnkeep-org sibling project.
29
29
 
30
+ Version 2.11 adds guided `cairn setup`, the maintained Pi local stdio memory
31
+ extension, and the native Windows operating layer.
32
+
30
33
  ## Compatibility
31
34
 
32
35
  Node.js 22, 24, and 26 are supported. Cairnkeep 2.x requires Node.js 22 or
@@ -39,18 +42,22 @@ and 20 are end-of-life upstream.
39
42
  | OpenCode on Linux/macOS | Memory server plus commands, plugins, hooks, and launchers |
40
43
  | Kimi Code on Linux/macOS | Memory MCP server, project launcher, and opt-in `/graphify` Skill |
41
44
  | Qwen Code on Linux/macOS | Memory MCP server plus project launcher; no Cairnkeep operating-layer assets yet |
42
- | Pi on Linux/macOS | Native opt-in trajectory extension, launcher, and `/graphify` prompt; no bundled MCP bridge |
45
+ | Pi on Linux/macOS | Memory MCP through a maintained local stdio extension; native opt-in trajectory extension, launcher, and `/graphify` prompt; Pi 0.84.1 minimum for the bridge |
43
46
  | Codex CLI | Memory MCP server; no Cairnkeep operating-layer assets |
44
47
  | Other MCP clients | Memory plus optional domain-knowledge and context-pack MCP tools |
45
- | Native Windows | Not supported by the Bash-based installer; use WSL (not yet CI-verified) |
48
+ | Native Windows x64 | Node-native CLI, guided setup, memory server, bootstrap compatibility, PowerShell/Command Prompt launchers, sync, hooks, doctor, storage lifecycle, Task Scheduler, completion, and uninstall |
49
+ | Windows ARM64 | Supported through Windows x64 emulation only; a native database binding is not currently shipped |
50
+ | WSL | Uses the normal Linux workflow; distinct from native Windows and Git Bash |
46
51
 
47
52
  The `cairn graph` CLI is harness-independent and can be run from a project
48
53
  shell used by Kimi Code, Pi, Qwen Code, Codex, or another client. Claude Code,
49
54
  OpenCode, Pi, and Kimi can receive thin `/graphify` adapters; those adapters do
50
55
  not imply equivalent hooks, agents, or MCP support.
51
56
 
52
- Linux, macOS, Bash 3.2 portability, and clean Node 22/24/26 runtime checks
53
- are exercised in CI.
57
+ Linux, macOS, Bash 3.2 portability, native PowerShell on Windows x64, global npm
58
+ installation, and clean Node 22/24/26 runtime checks are exercised in CI. See
59
+ [Native Windows operation](docs/native-windows.md) for platform-specific setup,
60
+ ACL, scheduling, process-tree, and recovery details.
54
61
 
55
62
  See [Harness compatibility](docs/harness-compatibility.md) for exact support
56
63
  levels, Kimi and Qwen configuration, and candidates that are not yet runtime-tested.
@@ -78,8 +85,9 @@ storage paths, secrets, and private derived images, see
78
85
  - **`mcp-memory-server/`** — an MCP server exposing durable, scoped memory
79
86
  (`memory_write`, `memory_search`, …) backed by AgentFS, with optional
80
87
  embedding-ranked search against any OpenAI-compatible endpoint.
81
- - **`bin/cairn`** — the CLI. `cairn bootstrap [path]` scaffolds a project's
82
- `.ai/` launchers + env; `cairn doctor` health-checks the configured pieces;
88
+ - **`bin/cairn`** — the CLI. `cairn setup [path]` guides or deterministically
89
+ reconciles selected project assets; `cairn bootstrap [path]` preserves the
90
+ established scripted scaffold contract; `cairn doctor` health-checks the configured pieces;
83
91
  `cairn trajectory list|show|prune` manages opt-in local session trajectories;
84
92
  `cairn artifact list|show|delete|prune` manages opt-in local artifacts;
85
93
  `cairn mcp-tools list|status|set|reset` applies least-authority discovery
@@ -99,7 +107,7 @@ storage paths, secrets, and private derived images, see
99
107
  (`export` requires the optional `sqlite3` CLI);
100
108
  `cairn audit-timer` installs the scheduled memory+wiki audit;
101
109
  `cairn completion bash|zsh|fish` generates shell completion definitions; and
102
- `cairn sync-pi` installs the native Pi trajectory extension and graph prompt;
110
+ `cairn sync-pi` installs the native Pi memory and trajectory extensions plus graph prompt;
103
111
  `cairn sync-kimi` installs the Kimi graph Skill;
104
112
  `cairn uninstall` reverses the install (backup-first, revertible).
105
113
  - **`templates/`** — project scaffolding (generic launchers, env) plus the
@@ -128,9 +136,11 @@ them. These are the accelerators the author pairs cairnkeep with; each is opt-in
128
136
  ## Setup
129
137
 
130
138
  A working workflow needs three things: the memory server registered, the
131
- operating layer (commands, agents, hooks) installed into your harness, and a
132
- bootstrapped project. `cairn bootstrap` does only the last of these — the full
133
- ordered walkthrough is in **[docs/operating.md](docs/operating.md)**.
139
+ operating layer installed into your harness, and a configured project. `cairn
140
+ setup` is the recommended guided entry point; `cairn bootstrap` remains the
141
+ deterministic compatibility primitive for established scripts. Project setup
142
+ reports but never performs machine-level sync. The full ordered walkthrough is
143
+ in **[docs/operating.md](docs/operating.md)**.
134
144
 
135
145
  This setup is local by default: the registered stdio server stores memory on
136
146
  the user's computer. Cairnkeep never discovers or selects a remote host.
@@ -147,8 +157,8 @@ claude mcp add cairn-memory -s user -- cairn memory-server
147
157
  # 2. Install the operating layer (commands, agents, hooks, scaffold templates)
148
158
  cairn sync --apply # add --live-root <proj>/.claude to scope it
149
159
 
150
- # 3. Scaffold a project and configure it
151
- cairn bootstrap /path/to/project
160
+ # 3. Configure a project deterministically
161
+ cairn setup /path/to/project --git init --harness claude --memory local --yes
152
162
  cp /path/to/project/.ai/env.example /path/to/project/.ai/.env # then edit
153
163
 
154
164
  # 4. Launch (and, optionally, check the wiring first)
@@ -185,18 +195,36 @@ headers. Review and approve project MCP configuration with
185
195
  `qwen mcp approve cairn-memory`, then launch with `./.ai/start-qwen.sh`. See
186
196
  [Harness compatibility](docs/harness-compatibility.md#qwen-code).
187
197
 
188
- For Pi, install the local trajectory adapter and use the scaffolded launcher:
198
+ For Pi, select Pi during project setup, explicitly install/check its machine
199
+ assets, run doctor, and use the generated launcher:
189
200
 
190
201
  ```bash
191
202
  cairn sync-pi --apply
192
- cairn bootstrap /path/to/project
193
- cd /path/to/project && ./.ai/start-pi.sh
203
+ cairn sync-pi --check
204
+ cairn setup /path/to/project --git init --harness pi --memory local --yes
205
+ cd /path/to/project && cairn doctor && ./.ai/start-pi.sh
206
+ ```
207
+
208
+ This installs the maintained local stdio memory extension, trajectory capture,
209
+ and the thin `/graphify` prompt. The memory extension discovers the effective
210
+ server tool catalog and preserves annotations in trusted result details; Pi's
211
+ public API has no native annotations field. It adds tools only—no prompt runs,
212
+ skill activation, autonomous loop, or remote access. Pi 0.84.1 is the minimum
213
+ validated version; v2.11 also passed the registry-current Pi release and the
214
+ documented Node, Bash, and native Windows matrix.
215
+
216
+ Preview removal before confirming it. Uninstall backs up every managed file it
217
+ will change and prints the generated revert command; durable memory and context
218
+ packs remain unless their explicit purge flags are supplied:
219
+
220
+ ```bash
221
+ cairn uninstall --dry-run /path/to/project
222
+ cairn uninstall --yes /path/to/project
194
223
  ```
195
224
 
196
- This installs trajectory capture plus the thin `/graphify` prompt. The prompt
197
- delegates exclusively to `cairn graph`. Cairnkeep does not bundle or select a
198
- Pi MCP bridge; configure a user-chosen bridge separately if you also want the
199
- MCP memory tools inside Pi.
225
+ If setup-owned project assets drift, rerun the exact `cairn setup ... --yes`
226
+ recovery command reported by `cairn doctor`. For Pi machine-asset drift, run
227
+ `cairn sync-pi --apply`, then `cairn sync-pi --check` and `cairn doctor`.
200
228
 
201
229
  Closed trajectories can be compiled into local hindsight notes without a model
202
230
  or embedding service. Capture and distillation are separate opt-ins:
@@ -303,6 +331,7 @@ search):
303
331
  | `CAIRN_EVAL` | Opt in to the local evaluation coordinator (default off; does not select a harness, model, endpoint, credential, or network) |
304
332
  | `CAIRN_GIT_PROVIDER` | Git host for collaboration commands: `github`\|`gitlab`\|`codeberg`\|`forgejo`\|`none` ([docs/git-providers.md](docs/git-providers.md)) |
305
333
  | `CAIRN_ROUTE_ENDPOINT` | Base URL of an already-running token-miser routing/tiering proxy (unset → `route_check` is inert) |
334
+ | `CAIRN_GRAPHIFY_BINARY` | Optional Graphify command/path override (default `graphify` from `PATH`; JavaScript helpers run through Node) |
306
335
  | `CAIRN_EXPLORE_BINARY` | Absolute path to the `token_miser` binary used by `context_explore` (unset → the tool throws) |
307
336
  | `CAIRN_EXPLORE_REPO_ROOT` | Default repo root for `context_explore` when no per-call `repo_root` is given |
308
337
  | `CAIRN_EXTRA_SETTINGS` | Optional settings/config file the launcher layers onto the harness (wrapper seam) |
@@ -412,8 +441,8 @@ is neither a Cairnkeep result nor an acceptance target.
412
441
  Reports and note snapshots stay under
413
442
  `.agentfs/eval/experiments/<experiment-id>/`; default uninstall retains them,
414
443
  while explicit purge is backup-first and revertible. Cancellation retains an
415
- inspectable partial report. POSIX process-group cleanup is tested; Windows
416
- descendant-process-tree termination is not guaranteed. See the
444
+ inspectable partial report. POSIX process-group cleanup and Windows descendant-
445
+ tree cleanup through `taskkill.exe /T` are tested by their platform contracts. See the
417
446
  [operating guide](docs/operating.md#evaluation-harness-opt-in),
418
447
  [storage contract](docs/storage.md#evaluation-report-and-note-snapshot-storage),
419
448
  and [privacy flow](docs/privacy-and-data-flow.md#evaluation-adapter-and-report-flow).
package/bin/cairn CHANGED
@@ -1,167 +1,8 @@
1
- #!/usr/bin/env bash
2
- # cairn — Cairnkeep CLI. Thin dispatcher over the core scripts.
3
- set -euo pipefail
1
+ #!/usr/bin/env node
4
2
 
5
- # Resolve through symlinks so this works when installed as an npm global bin
6
- # (which symlinks <prefix>/bin/cairn -> the packaged bin/cairn).
7
- SOURCE="${BASH_SOURCE[0]}"
8
- while [ -L "$SOURCE" ]; do
9
- DIR=$(cd -P "$(dirname "$SOURCE")" && pwd)
10
- SOURCE=$(readlink "$SOURCE")
11
- [[ "$SOURCE" != /* ]] && SOURCE="$DIR/$SOURCE"
12
- done
13
- CAIRN_ROOT=$(cd -P "$(dirname "$SOURCE")/.." && pwd)
3
+ import { main } from "../scripts/cairn-cli.mjs";
14
4
 
15
- cmd="${1:-help}"
16
- [[ $# -gt 0 ]] && shift
17
-
18
- usage() {
19
- cat <<'USAGE'
20
- cairn — Cairnkeep CLI
21
-
22
- Usage:
23
- cairn bootstrap [--untracked] [path]
24
- Scaffold launchers, planning files, and the private
25
- project-memory ignore guard (default path: .).
26
- --untracked keeps the scaffold out of git via the repo's
27
- .git/info/exclude (contributor mode: nothing to commit,
28
- invisible to other contributors, local-only).
29
- cairn memory-server Run the memory MCP server (stdio). Register it with your
30
- harness, e.g. claude mcp add cairn-memory -s user -- cairn memory-server.
31
- cairn sync [--apply] [--live-root DIR]
32
- Install/update the Claude Code operating layer (commands,
33
- agents, hooks) into ~/.claude, or into DIR for a single
34
- project (--live-root <project>/.claude).
35
- cairn sync-pi [--apply] [--live-root DIR]
36
- Install/update the Pi trajectory extension and thin
37
- /graphify prompt into ~/.pi/agent or isolated DIR.
38
- cairn sync-kimi [--apply] [--live-root DIR]
39
- Install/update the thin Kimi /graphify Skill into
40
- $KIMI_CODE_HOME, ~/.kimi-code, or isolated DIR.
41
- cairn doctor Health-check the memory server and configured LLM /
42
- embedding endpoints, git provider, and stores.
43
- Use --repair for derived trajectory/typed metadata,
44
- indexes, and interrupted note transactions.
45
- cairn trajectory <list|show|prune>
46
- Inspect and prune opt-in local session trajectories.
47
- cairn artifact <list|show|delete|prune>
48
- Inspect and delete opt-in local artifacts. List/show
49
- support --json; delete supports --dry-run; prune
50
- supports --dry-run and --include-protected.
51
- cairn capabilities <list|status|enable|disable|reset|logging>
52
- Inspect and manage project capability state. MCP changes
53
- require a memory-server restart; operating changes apply
54
- on the next invocation.
55
- cairn mcp-tools <list|status|set|reset>
56
- Inspect and restrict MCP tool exposure with full,
57
- read-only, or exact custom project profiles.
58
- cairn pack <init|lock|validate|install|list|show|remove|enable|disable|update|skills|approve-skill|revoke-skill>
59
- Build, verify, install, pin, and retrieve immutable
60
- context packs. Packs stay local and disabled by default.
61
- cairn notes <distill|search-error|promote|doctor>
62
- Compile closed trajectories into local hindsight notes,
63
- search exact failure signatures, promote corroborated
64
- notes, or validate the note store.
65
- cairn eval <validate|run|ablate|report|prune|delete>
66
- Validate or run default-off local evaluations, inspect
67
- reports, and manage retained experiment results.
68
- cairn skill <harvest|list|show|review|propose|evaluate|apply|rollback>
69
- Turn recurring hindsight evidence into reviewed,
70
- evaluated, reversible skill-file improvements.
71
- cairn graph <build|query|status|diff|explain|path>
72
- Build the local code graph, inspect freshness and
73
- changes, or query exact symbols and paths.
74
- cairn memory <path|export|import>
75
- Relocate global-scope memory. `path` prints its location;
76
- `export <file.tgz>` takes a WAL-safe snapshot (requires
77
- sqlite3); `import <file.tgz>` restores it.
78
- cairn audit-timer [--on-calendar SPEC] [--para-root PATH] [--render-only DIR]
79
- Install (opt-in) a systemd user timer that runs the
80
- memory+wiki audit on a schedule; prints a cron alternative.
81
- cairn uninstall [--dry-run] [--yes] [--purge-memory] [--purge-packs] [--live-root DIR]
82
- [--pi-live-root DIR] [--kimi-live-root DIR] [PROJECT ...]
83
- Reverse what cairnkeep installed/modified (operating
84
- layer, hook registrations, MCP registration, audit
85
- timer, and any given projects' bootstrap scaffold).
86
- Backs everything up first with a revert.sh; keeps the
87
- durable memory store unless --purge-memory is given.
88
- cairn completion bash|zsh|fish
89
- Generate completion definitions for a major shell.
90
- cairn version Print version
91
- cairn help Show this help
92
- USAGE
93
- }
94
-
95
- case "$cmd" in
96
- bootstrap)
97
- exec "$CAIRN_ROOT/scripts/bootstrap.sh" "$@"
98
- ;;
99
- doctor)
100
- exec "$CAIRN_ROOT/scripts/doctor.sh" "$@"
101
- ;;
102
- uninstall)
103
- exec "$CAIRN_ROOT/scripts/uninstall.sh" "$@"
104
- ;;
105
- memory)
106
- exec "$CAIRN_ROOT/scripts/memory-store.sh" "$@"
107
- ;;
108
- memory-server)
109
- # Run the memory MCP server (stdio by default). Use with your harness, e.g.
110
- # claude mcp add cairn-memory -s user -- cairn memory-server
111
- exec node "$CAIRN_ROOT/mcp-memory-server/dist/index.js" "$@"
112
- ;;
113
- trajectory)
114
- exec node "$CAIRN_ROOT/mcp-memory-server/dist/trajectory-cli.js" "$@"
115
- ;;
116
- artifact)
117
- exec node "$CAIRN_ROOT/mcp-memory-server/dist/artifact-cli.js" "$@"
118
- ;;
119
- capabilities)
120
- exec node "$CAIRN_ROOT/mcp-memory-server/dist/capability-cli.js" "$@"
121
- ;;
122
- mcp-tools)
123
- exec node "$CAIRN_ROOT/mcp-memory-server/dist/mcp-tool-cli.js" "$@"
124
- ;;
125
- pack)
126
- exec node "$CAIRN_ROOT/mcp-memory-server/dist/context-pack-cli.js" "$@"
127
- ;;
128
- notes)
129
- exec node "$CAIRN_ROOT/mcp-memory-server/dist/note-cli.js" "$@"
130
- ;;
131
- eval)
132
- exec node "$CAIRN_ROOT/mcp-memory-server/dist/eval-cli.js" "$@"
133
- ;;
134
- skill)
135
- exec node "$CAIRN_ROOT/mcp-memory-server/dist/skill-cli.js" "$@"
136
- ;;
137
- graph)
138
- exec node "$CAIRN_ROOT/mcp-memory-server/dist/graph-cli.js" "$@"
139
- ;;
140
- sync)
141
- exec "$CAIRN_ROOT/scripts/sync-claude-assets.sh" "$@"
142
- ;;
143
- sync-pi)
144
- exec "$CAIRN_ROOT/scripts/sync-pi-assets.sh" "$@"
145
- ;;
146
- sync-kimi)
147
- exec "$CAIRN_ROOT/scripts/sync-kimi-assets.sh" "$@"
148
- ;;
149
- audit-timer)
150
- exec "$CAIRN_ROOT/scripts/install-audit-timer.sh" "$@"
151
- ;;
152
- completion)
153
- exec "$CAIRN_ROOT/scripts/completion.sh" "$@"
154
- ;;
155
- version | --version | -v)
156
- v=$(sed -n 's/.*"version"[[:space:]]*:[[:space:]]*"\([^"]*\)".*/\1/p' "$CAIRN_ROOT/package.json" 2>/dev/null | head -1)
157
- echo "cairnkeep ${v:-unknown}"
158
- ;;
159
- help | --help | -h)
160
- usage
161
- ;;
162
- *)
163
- echo "Unknown command: $cmd" >&2
164
- usage >&2
165
- exit 2
166
- ;;
167
- esac
5
+ main(process.argv.slice(2)).catch((error) => {
6
+ console.error(`cairn: ${error instanceof Error ? error.message : String(error)}`);
7
+ process.exitCode = 1;
8
+ });
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env node
2
+
3
+ import { main } from "../scripts/cairn-container-cli.mjs";
4
+
5
+ main(process.argv.slice(2)).catch((error) => {
6
+ console.error(`cairn-container: ${error instanceof Error ? error.message : String(error)}`);
7
+ process.exitCode = 2;
8
+ });
@@ -54,19 +54,54 @@ export ANTHROPIC_BASE_URL="$MY_INTERNAL_GATEWAY"
54
54
  The user still runs the standard `./.ai/start-claude.sh`; the overlay's behaviour
55
55
  is injected by the file's presence.
56
56
 
57
+ ## Guided setup policy seam
58
+
59
+ An overlay may provide a data-only JSON policy to `cairn setup --policy PATH`.
60
+ The public schema is
61
+ [`schemas/cairnkeep-setup-policy.schema.json`](../schemas/cairnkeep-setup-policy.schema.json).
62
+ It is strict and provider-neutral: `schema_version` is `1`; `defaults` may set
63
+ `git`, `harnesses`, and `memory`; and `constraints` may restrict those values
64
+ and require selected harnesses. Unknown properties are rejected.
65
+
66
+ Precedence is explicit command-line choices, then policy defaults, then
67
+ interactive input. Constraints validate the resolved plan regardless of which
68
+ source supplied a choice. Non-interactive use still requires an explicit
69
+ target and `--yes`, and every unresolved Git, harness, or memory choice is an
70
+ error. A policy is a regular non-symlink JSON file no larger than 1 MiB; on
71
+ POSIX it must not be executable. Keep organization-specific endpoints,
72
+ credentials, and launcher logic outside this file.
73
+
74
+ For deterministic onboarding, pin a reviewed policy beside the overlay and
75
+ invoke:
76
+
77
+ ```bash
78
+ cairn setup /path/to/project --policy /path/to/setup-policy.json \
79
+ --git existing --harness claude,pi --memory local --yes
80
+ cairn sync-pi --apply
81
+ cairn sync-pi --check
82
+ ```
83
+
84
+ Setup reconciles only the selected project assets and reports machine sync
85
+ without running it. The overlay remains responsible for applying and checking
86
+ machine assets explicitly. Preserve `.ai/cairnkeep.json`: it is the private,
87
+ versioned project ownership record used by status, doctor, recovery, and
88
+ backup-first uninstall.
89
+
57
90
  ## An overlay install script
58
91
 
59
92
  Make it one idempotent command from a fresh machine:
60
93
 
61
94
  ```bash
62
- # 1. Get cairnkeep at a pinned version (npm or a pinned clone)
63
- npm i -g @cairnkeep/cli@1.0.2 # or: git clone … && git checkout v1.0.2
95
+ # 1. Get cairnkeep at a reviewed, pinned version (npm or a pinned clone)
96
+ npm i -g @cairnkeep/cli@<version>
64
97
 
65
98
  # 2. Register the memory server with your harness
66
99
  claude mcp add cairn-memory -s user -- cairn memory-server
67
100
 
68
- # 3. Scaffold the target project (contributor mode if you don't own the repo)
69
- cairn bootstrap --untracked /path/to/project
101
+ # 3. Reconcile the target project deterministically
102
+ cairn setup /path/to/project --git existing --harness claude --memory local --yes
103
+ # Existing bootstrap automation remains supported:
104
+ # cairn bootstrap --untracked /path/to/project
70
105
 
71
106
  # 4. Install the operating layer — GLOBAL or PROJECT-SCOPED (below)
72
107
  sync-claude-assets.sh --apply # global ~/.claude
@@ -128,6 +163,8 @@ secret storage, not generated project files.
128
163
  - [ ] Operating layer scoped as intended (global vs `--live-root`)
129
164
  - [ ] Optional integrations wired only where wanted
130
165
  - [ ] A single documented command takes a fresh machine to a working setup
166
+ - [ ] Setup policy is data-only, schema-valid, and contains no secrets or endpoints
167
+ - [ ] Machine sync/check is explicit; project setup never runs it automatically
131
168
  - [ ] Managed machines resolve `cairn` to the overlay distribution, not raw core
132
169
  - [ ] `cairn config explain` reports memory and RAG destinations without secrets
133
170
  - [ ] A project profile lock prevents silent cross-overlay reconfiguration
@@ -38,6 +38,13 @@ podman run --rm -i \
38
38
 
39
39
  Pin a version instead of `latest` for managed installations.
40
40
 
41
+ On native Windows, the installed `cairn-container.cmd` invokes the same
42
+ argument-safe Node launcher and defaults to `podman.exe`; set
43
+ `CONTAINER_ENGINE` to an explicit compatible engine path if needed. Podman
44
+ Desktop must be configured for Linux containers. Named-volume modes preserve
45
+ the container-side contract, while host paths are passed as single arguments
46
+ so drive letters and spaces are not split by a shell.
47
+
41
48
  ## Authenticated HTTP
42
49
 
43
50
  Generate the bearer token into a private file and start a loopback-only
@@ -57,6 +64,9 @@ The launcher refuses token files that are symlinks or have a mode other than
57
64
  `0400` or `0600`. It mounts the token read-only instead of putting it in the
58
65
  container environment or image.
59
66
 
67
+ On Windows, the equivalent check rejects symlinks and any token ACL granting
68
+ access beyond the current SID, Local System, or built-in Administrators.
69
+
60
70
  The listener is deliberately published only on `127.0.0.1`. For access from
61
71
  other machines, keep it on loopback behind a TLS reverse proxy or encrypted
62
72
  private network. Add the externally visible `Host` header to the DNS-rebinding
@@ -12,7 +12,7 @@ commands, hooks, plugins, or trajectory adapters.
12
12
  | OpenCode | Memory MCP, commands, workflows, plugins, launcher | Exercised by Cairnkeep tests |
13
13
  | Kimi Code | Memory MCP, `AGENTS.md`, launcher, opt-in graph Skill | Launcher tested; remote MCP tested with Kimi Code 0.30.0; graph Skill contract-tested |
14
14
  | Qwen Code | Memory MCP, launcher | Launcher tested; stdio and remote MCP tested with Qwen Code 0.21.1 |
15
- | Pi | Native opt-in trajectory extension, launcher, and graph prompt | Exercised by Cairnkeep tests; no bundled MCP bridge |
15
+ | Pi | Memory MCP through maintained local stdio extension, native opt-in trajectory extension, launcher, and graph prompt | Pi 0.84.1 validated minimum; deterministic and real bridge/lifecycle tests |
16
16
  | Codex CLI | Memory MCP | Configuration supported; no Cairnkeep operating-layer assets or launcher |
17
17
  | Other MCP clients | Memory plus optional domain-knowledge and context-pack tools | Protocol-compatible; not automatically runtime-tested |
18
18
 
@@ -33,7 +33,35 @@ Pi, Qwen Code, Codex, and other shell-capable clients can invoke
33
33
  `graphify` executable are on `PATH`. `cairn sync-kimi --apply` registers a Kimi
34
34
  Skill as `/graphify` (or `/skill:graphify`), and `cairn sync-pi --apply`
35
35
  registers a Pi prompt template as `/graphify`; both delegate exclusively to
36
- that CLI. Neither adds an MCP bridge to Pi or expands the other support levels.
36
+ that CLI. Pi sync separately installs the Cairnkeep-owned local stdio memory
37
+ extension; it does not expand the other support levels.
38
+
39
+ ## Pi
40
+
41
+ Run `cairn sync-pi --apply` explicitly to install
42
+ `extensions/cairnkeep-memory.ts`, `extensions/cairnkeep-trajectory.ts`, and
43
+ `prompts/graphify.md` under the Pi agent root. Use `--check` for drift and
44
+ `cairn doctor` from a project that selected Pi for setup-aware diagnosis. Setup
45
+ reports this machine command but never runs it automatically. Uninstall removes
46
+ only those owned paths, backup-first.
47
+
48
+ The memory extension supervises `cairn memory-server` as a local stdio child.
49
+ It discovers the effective MCP catalog dynamically and preserves names,
50
+ descriptions, input/output schemas, original content, `structuredContent`,
51
+ `_meta`, failure behavior, and the exact tool annotations in trusted result
52
+ `details`. Pi 0.84.1 exposes no native annotations field in its public tool API,
53
+ so those annotations are not claimed as native model-facing metadata. Server
54
+ feature gates, capability state, and least-authority profiles continue to
55
+ decide which tools exist.
56
+
57
+ Startup, calls, results, stderr retention, cancellation, and shutdown are
58
+ bounded. The extension adds tools only: it does not run prompts, activate
59
+ context-pack skills, create an autonomous loop, or add a remote transport.
60
+ Pi 0.84.1 is the validated minimum. The v2.11 release matrix passed separate
61
+ installations for that minimum and the explicitly versioned registry-current Pi
62
+ release, together with Node.js 22/24/26, Bash 3.2, and native Windows. The
63
+ executable paths were distinct; both reported 0.84.1 because that was also the
64
+ registry-current release.
37
65
 
38
66
  ## Kimi Code
39
67
 
@@ -1,7 +1,7 @@
1
1
  # Curriculum Coverage Map
2
2
 
3
- **Baseline:** Cairnkeep 2.9.0
4
- **Last reviewed:** 2026-08-06
3
+ **Baseline:** Cairnkeep 2.11.0
4
+ **Last reviewed:** 2026-08-12
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
@@ -34,6 +34,9 @@ been rehearsed.
34
34
  | Reviewed, evaluated, reversible skill-file improvement | L19 | L19 | Ready; explicit and default off |
35
35
  | Complete MCP annotations and least-authority tool profiles | L20 | L20 | Ready; default profile remains full |
36
36
  | Immutable context packs and exact-digest skill approval | L21 | L21 | Ready; default off |
37
+ | Native Windows x64 CLI, hooks, ACLs, scheduling, and recovery | L22 | L22 | Ready; PowerShell-native |
38
+ | Guided project setup, selected harness state, and Git-less limitations | L23 | L23 | Ready |
39
+ | Pi local stdio memory bridge, trusted annotation details, and explicit lifecycle | L23 | L23 | Ready; Pi 0.84.1 validated minimum |
37
40
 
38
41
  ## Release Review
39
42
 
@@ -65,6 +68,8 @@ repository remains the canonical source for explanations and scripts.
65
68
  | `course-08-graph` | L18 | Optional local structural graph workflow |
66
69
  | `course-09-skill` | L19 | Validated skill improvement in a disposable project |
67
70
  | `course-10-trust-context` | L20-L21 | MCP authority profiles and offline context-pack lifecycle |
71
+ | `course-11-windows` | L22 | Native PowerShell lifecycle, ACL inspection, and reversible uninstall |
72
+ | `course-12-guided-setup` | L23 | Deterministic setup, Pi local stdio, recovery, and backup-first uninstall |
68
73
 
69
74
  ## Command Ownership
70
75
 
@@ -74,9 +79,10 @@ against `cairn help` so a new command cannot bypass a curriculum decision.
74
79
  | Command | Primary lesson |
75
80
  |---|---|
76
81
  | `cairn bootstrap` | L03 |
82
+ | `cairn setup` | L23 |
77
83
  | `cairn memory-server` | L02 |
78
84
  | `cairn sync` | L02 |
79
- | `cairn sync-pi` | L13 |
85
+ | `cairn sync-pi` | L13 and L23 |
80
86
  | `cairn sync-kimi` | L02 |
81
87
  | `cairn doctor` | L03; advanced repair in L13-L14 |
82
88
  | `cairn trajectory` | L13 |
@@ -1,6 +1,6 @@
1
1
  # Cairnkeep feature guide
2
2
 
3
- **Baseline:** Cairnkeep 2.9.0
3
+ **Baseline:** Cairnkeep 2.11.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
@@ -8,13 +8,17 @@ synthetic Trail Ledger project with tagged states from a plain application to
8
8
  offline evaluation. Detailed contracts remain in the linked operating,
9
9
  storage, privacy, and lesson documents.
10
10
 
11
+ Guided setup and the maintained Pi memory extension ship in v2.11. See
12
+ [L23](lessons/L23-guided-setup.md) for the tested boundary.
13
+
11
14
  ## The three-layer model
12
15
 
13
16
  1. **Memory server:** an MCP process that owns scoped durable storage. The
14
17
  default stdio setup runs on the current machine; installation never
15
18
  discovers or selects a remote host.
16
19
  2. **Project scaffold:** launchers, private environment, and `.planning/`
17
- policy/derived-knowledge files created by `cairn bootstrap`.
20
+ policy/derived-knowledge files reconciled by `cairn setup`; `cairn bootstrap`
21
+ remains the deterministic compatibility primitive.
18
22
  3. **Operating layer:** harness commands, agents, and hooks installed by
19
23
  `cairn sync --apply` or the harness-specific equivalent.
20
24
 
@@ -48,6 +52,7 @@ prerequisites for ordinary memory.
48
52
  | Wiki and alignment | `/wiki-ingest`, `/wiki-query`, `/wiki-lint`, alignment files | Written only when invoked; reviewable `.planning/` artifacts | Re-run lint, inspect source citations, revert tracked changes normally | `course-02-memory` |
49
53
  | Local code graph | `cairn graph build|query|status|diff|explain|path`; `/graphify` delegates | Default off; optional isolated `graphify` executable; incremental work under `graphify-out/`, published view under `.planning/graphs/` | Ignore both derived locations; check status and source before trusting a result; use `--force` only after intentional deletion; uninstall adapters separately | `course-08-graph` |
50
54
  | Repository quality | `/repo-review`, `/security-audit` | On-demand workflow; findings are hypotheses until reproduced | Require file/line evidence and regression tests | `course-03-quality` |
55
+ | Guided project setup | `cairn setup PATH --git init\|existing\|none --harness LIST --memory local\|none --yes` | Reconciles only selected project assets; private `.ai/cairnkeep.json`; machine sync is never automatic | Repeat deterministically, run doctor, or replay its recovery command; Git-less mode remains limited | `course-12-guided-setup` |
51
56
 
52
57
  ## Storage and optional topology
53
58
 
@@ -62,6 +67,7 @@ prerequisites for ordinary memory.
62
67
  | 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` |
63
68
  | 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` |
64
69
  | 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` |
70
+ | 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` |
65
71
 
66
72
  ## Evidence, governance, and measurement
67
73
 
@@ -83,7 +89,7 @@ prerequisites for ordinary memory.
83
89
 
84
90
  - Use a generated launcher so project environment and hooks are repeatable.
85
91
  - Run `cairn sync --check` after every core upgrade; apply only reported drift.
86
- - Run `cairn sync-pi --check` when the optional Pi capture/graph adapter is installed.
92
+ - Run `cairn sync-pi --check` when the Pi memory/trajectory/graph assets are installed.
87
93
  - Run `cairn sync-kimi --check` when the optional Kimi graph Skill is installed.
88
94
  - Use `cairn doctor --repair` only after preserving the affected store and only
89
95
  for repairable derived indexes/metadata.