@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
@@ -52,6 +52,8 @@ expanded only after their labs are executable.
52
52
  | L19 | [Validated skill improvement](lessons/L19-validated-skill-improvement.md) | Ready | 50 min |
53
53
  | L20 | [Least-authority MCP tool profiles](lessons/L20-mcp-tool-profiles.md) | Ready | 25 min |
54
54
  | L21 | [Immutable context packs and skill approval](lessons/L21-context-packs.md) | Ready | 40 min |
55
+ | L22 | [Operate Cairnkeep on native Windows](lessons/L22-native-windows.md) | Ready | 30 min |
56
+ | L23 | [Guided setup and Pi memory](lessons/L23-guided-setup.md) | Ready | 35 min |
55
57
 
56
58
  The [curriculum coverage map](CURRICULUM-MAP.md) records where every public
57
59
  feature is introduced, practised, and operated. It also marks design-only work
@@ -3,7 +3,7 @@
3
3
  **Status:** Ready
4
4
  **Track:** Quickstart
5
5
  **Time:** 10 minutes
6
- **Tested with:** Cairnkeep 2.9.0
6
+ **Tested with:** Cairnkeep 2.11.0
7
7
 
8
8
  ## Outcome
9
9
 
@@ -3,7 +3,7 @@
3
3
  **Status:** Ready
4
4
  **Track:** Quickstart
5
5
  **Time:** 15 minutes
6
- **Tested with:** Cairnkeep 2.9.0
6
+ **Tested with:** Cairnkeep 2.11.0
7
7
 
8
8
  ## Outcome
9
9
 
@@ -26,7 +26,7 @@ ephemeral; the named course volume is persistent.
26
26
  1. Pull the public image:
27
27
 
28
28
  ```bash
29
- podman pull ghcr.io/cairnkeep/cairnkeep:2.9.0
29
+ podman pull ghcr.io/cairnkeep/cairnkeep:2.11.0
30
30
  ```
31
31
 
32
32
  2. Start the stdio server with a read-only root filesystem and no Linux
@@ -38,7 +38,7 @@ ephemeral; the named course volume is persistent.
38
38
  --read-only --cap-drop=all --security-opt=no-new-privileges \
39
39
  --tmpfs=/tmp:rw,noexec,nosuid,size=64m,mode=1777 \
40
40
  --volume cairnkeep-course-data:/data:Z,U \
41
- ghcr.io/cairnkeep/cairnkeep:2.9.0 stdio
41
+ ghcr.io/cairnkeep/cairnkeep:2.11.0 stdio
42
42
  ```
43
43
 
44
44
  3. The process waits quietly for MCP input. Press `Ctrl-C` after confirming it
@@ -3,7 +3,7 @@
3
3
  **Status:** Ready
4
4
  **Track:** Quickstart
5
5
  **Time:** 25 minutes
6
- **Tested with:** Cairnkeep 2.9.0 and Node.js 22 or newer
6
+ **Tested with:** Cairnkeep 2.11.0 and Node.js 22 or newer
7
7
 
8
8
  ## Outcome
9
9
 
@@ -41,7 +41,7 @@ machine-level steps.
41
41
  2. Install Cairnkeep:
42
42
 
43
43
  ```bash
44
- npm install --global @cairnkeep/cli@2.9.0
44
+ npm install --global @cairnkeep/cli@2.11.0
45
45
  cairn --version
46
46
  ```
47
47
 
@@ -72,6 +72,15 @@ machine-level steps.
72
72
  Use `cairn completion zsh` or `cairn completion fish` for those shells.
73
73
  Completion is a convenience and is not another runtime component.
74
74
 
75
+ On native Windows PowerShell, use:
76
+
77
+ ```powershell
78
+ Invoke-Expression (& cairn completion powershell | Out-String)
79
+ ```
80
+
81
+ Bootstrap emits `.cmd` launchers on Windows; use
82
+ `.\.ai\start-claude.cmd` instead of the Unix `.sh` launcher.
83
+
75
84
  ## Verify
76
85
 
77
86
  Run both checks:
@@ -3,7 +3,7 @@
3
3
  **Status:** Ready
4
4
  **Track:** Quickstart
5
5
  **Time:** 25 minutes
6
- **Tested with:** Cairnkeep 2.9.0
6
+ **Tested with:** Cairnkeep 2.11.0
7
7
 
8
8
  ## Outcome
9
9
 
@@ -3,7 +3,7 @@
3
3
  **Status:** Ready
4
4
  **Track:** Evidence and Evaluation
5
5
  **Time:** 50 minutes
6
- **Tested with:** Cairnkeep 2.9.0
6
+ **Tested with:** Cairnkeep 2.11.0
7
7
 
8
8
  ## Outcome
9
9
 
@@ -1,7 +1,7 @@
1
1
  # L20 - Least-authority MCP tool profiles
2
2
 
3
3
  **Status:** Ready
4
- **Tested with:** Cairnkeep 2.9.0 and Node.js 22 or newer
4
+ **Tested with:** Cairnkeep 2.11.0 and Node.js 22 or newer
5
5
  **Time:** 25 minutes
6
6
 
7
7
  ## Outcome
@@ -1,7 +1,7 @@
1
1
  # L21 - Immutable context packs and skill approval
2
2
 
3
3
  **Status:** Ready
4
- **Tested with:** Cairnkeep 2.9.0 and Node.js 22 or newer
4
+ **Tested with:** Cairnkeep 2.11.0 and Node.js 22 or newer
5
5
  **Time:** 40 minutes
6
6
 
7
7
  ## Outcome
@@ -0,0 +1,83 @@
1
+ # L22 - Operate Cairnkeep on native Windows
2
+
3
+ **Status:** Ready
4
+ **Track:** Operator
5
+ **Time:** 30 minutes
6
+ **Tested with:** Cairnkeep 2.11.0, Windows x64, and Node.js 22 or newer
7
+
8
+ ## Outcome
9
+
10
+ You can prove that Cairnkeep is running natively from PowerShell, bootstrap a
11
+ path containing spaces, inspect its security boundary, and perform a reversible
12
+ uninstall without relying on WSL or Git Bash.
13
+
14
+ ## Exercise
15
+
16
+ From PowerShell:
17
+
18
+ ```powershell
19
+ npm install --global @cairnkeep/cli@2.11.0
20
+ cairn version
21
+
22
+ $Lab = Join-Path $env:TEMP 'Cairnkeep Windows Lab'
23
+ New-Item -ItemType Directory -Force -Path $Lab | Out-Null
24
+ cairn bootstrap $Lab
25
+ cairn sync --apply --live-root (Join-Path $Lab '.claude-test')
26
+ cairn sync --check --live-root (Join-Path $Lab '.claude-test')
27
+ Push-Location $Lab
28
+ cairn doctor
29
+ Pop-Location
30
+ ```
31
+
32
+ Verify that `.ai/start-claude.cmd`, `.ai/start-harness.ps1`, and the managed
33
+ Claude assets exist. `cairn doctor` must identify native Windows x64 and complete
34
+ an MCP stdio handshake.
35
+
36
+ ## Permission check
37
+
38
+ ```powershell
39
+ Get-Acl (Join-Path $Lab '.ai\capabilities.json') | Format-List
40
+ ```
41
+
42
+ Managed private files remove inherited broad access and retain only the current
43
+ identity, Local System, and Administrators. Do not replace this with a Unix-mode
44
+ check; Windows authorization is an ACL contract.
45
+
46
+ ## Recovery exercise
47
+
48
+ ```powershell
49
+ cairn uninstall --dry-run --live-root (Join-Path $Lab '.claude-test') $Lab
50
+ cairn uninstall --yes --live-root (Join-Path $Lab '.claude-test') $Lab
51
+ ```
52
+
53
+ The command prints the timestamped backup location. Inspect `manifest.json` and
54
+ `revert.ps1`; run the revert script only if you intentionally want to restore
55
+ the removed managed assets.
56
+
57
+ ## Common failures
58
+
59
+ | Symptom | Cause | Recovery |
60
+ |---|---|---|
61
+ | `cairn.cmd` is not found | npm's global directory is not on `PATH` | Run `npm prefix -g`, add the resulting directory to the user `PATH`, then open a new PowerShell session |
62
+ | Hook registration reports drift | Managed `.cmd` hook or settings entry is absent | Run `cairn sync --apply`, then repeat `cairn sync --check` |
63
+ | Memory export fails | `sqlite3.exe` is absent | Install SQLite and confirm `Get-Command sqlite3.exe`; runtime and import remain available |
64
+ | A private-state check fails | The file inherited a broader ACL | Preserve the file, inspect it with `Get-Acl`, and recreate it through the owning Cairnkeep command |
65
+
66
+ ## Privacy and trust boundary
67
+
68
+ Native support changes process, path, and permission mechanics; it does not
69
+ enable a network, model, capture, artifact, context-pack, or capability flag.
70
+ The Windows ACL is a local-host access boundary, while pack digests establish
71
+ content integrity rather than publisher authenticity. Task Scheduler and purge
72
+ operations remain separate explicit actions.
73
+
74
+ ## Boundaries
75
+
76
+ - Windows x64 is native; Windows ARM64 is currently x64 emulation.
77
+ - `sqlite3.exe` is optional for runtime and import, but required for a WAL-safe
78
+ memory export.
79
+ - WSL is a separate Linux topology. Git Bash is not native-Windows evidence.
80
+ - Task Scheduler changes remain opt-in through `cairn audit-timer`.
81
+
82
+ See [Native Windows operation](../../native-windows.md) for the complete
83
+ platform contract.
@@ -0,0 +1,138 @@
1
+ # L23 - Guided setup and Pi memory
2
+
3
+ **Status:** Ready
4
+ **Track:** Quickstart and Operator
5
+ **Time:** 35 minutes
6
+ **Tested with:** Cairnkeep 2.11.0; Pi 0.84.1; Node.js 22, 24, and 26
7
+
8
+ ## Outcome
9
+
10
+ You can classify a missing or empty target, replay setup without a TTY, explain
11
+ the limitations of Git-less mode, verify Pi's local stdio memory bridge, and
12
+ recover or uninstall every managed asset without hidden machine changes.
13
+
14
+ ## Prerequisites
15
+
16
+ - Node.js 22 or newer, npm, and Git for the main exercise.
17
+ - Pi 0.84.1 or newer.
18
+ - A disposable parent directory containing no credentials, secrets, private
19
+ state, or identifying project data.
20
+
21
+ ## Exercise
22
+
23
+ Start with a missing target. The explicit flags make this deterministic and
24
+ safe to replay from a non-interactive or non-TTY process:
25
+
26
+ ```bash
27
+ lab=/tmp/cairnkeep-guided-setup-lab
28
+ cairn setup "$lab" --git init --harness pi --memory local --yes
29
+ cd "$lab"
30
+ cairn doctor
31
+ ```
32
+
33
+ Setup performs its classification before it creates `.ai`, `.planning`, or
34
+ `.agentfs`. It initializes Git only because `--git init` authorizes that action,
35
+ records the selected Pi harness in private `.ai/cairnkeep.json`, and reports
36
+ created, updated, unchanged, and skipped assets. Repeating the same `cairn
37
+ setup` command should report the managed files as unchanged.
38
+
39
+ Project setup never changes the Pi installation. Apply and check machine assets
40
+ explicitly, then diagnose the project again:
41
+
42
+ ```bash
43
+ cairn sync-pi --apply
44
+ cairn sync-pi --check
45
+ cairn doctor
46
+ ./.ai/start-pi.sh
47
+ ```
48
+
49
+ In the disposable Pi session, list the registered Cairnkeep tools and make one
50
+ harmless read-only memory call. The extension starts `cairn memory-server` as a
51
+ local stdio child in this project; it does not select HTTP or a remote server.
52
+ Cancel one in-flight call and confirm a later read still works. Exit Pi normally
53
+ and confirm shutdown completes rather than leaving a memory-server child
54
+ running. Cancellation is per call and an awaited session shutdown owns child
55
+ termination.
56
+
57
+ The bridge discovers the effective server catalog. Full, read-only, and custom
58
+ MCP profiles therefore expose only the tools allowed by the server. It preserves
59
+ tool names, stable order, input and output schemas, original content,
60
+ `structuredContent`, `_meta`, and the exact Phase 21 annotations in trusted
61
+ bridge metadata and result `details`. Pi 0.84.1 has no native annotations field
62
+ in its public tool API: do not interpret this preservation as native
63
+ model-facing annotation propagation and do not invent such a field.
64
+
65
+ To see the intentional Git-less boundary in another empty disposable target:
66
+
67
+ ```bash
68
+ limited=/tmp/cairnkeep-guided-setup-limited
69
+ cairn setup "$limited" --git none --harness pi --memory local --yes
70
+ cd "$limited"
71
+ cairn doctor
72
+ ```
73
+
74
+ The result is `limited`, not `complete`. Launchers and local stdio memory remain
75
+ available, but repository-identity and Git-dependent features do not. An
76
+ existing non-Git tree is never initialized without explicit `--git init`.
77
+
78
+ ## Recovery exercise
79
+
80
+ Delete one setup-owned launcher only in the disposable project, diagnose it,
81
+ then replay the exact recovery command:
82
+
83
+ ```bash
84
+ cd /tmp/cairnkeep-guided-setup-lab
85
+ rm .ai/start-pi.sh
86
+ cairn doctor
87
+ cairn setup . --git init --harness pi --memory local --yes
88
+ cairn sync-pi --apply
89
+ cairn sync-pi --check
90
+ cairn doctor
91
+ ```
92
+
93
+ Doctor reports project-state drift separately from missing or drifted Pi
94
+ machine assets. Setup repairs only recorded project assets; `cairn sync-pi
95
+ --apply` repairs only the package-owned Pi extension and prompt paths.
96
+
97
+ Preview backup-first removal before confirming it:
98
+
99
+ ```bash
100
+ cairn uninstall --dry-run /tmp/cairnkeep-guided-setup-lab
101
+ cairn uninstall --yes /tmp/cairnkeep-guided-setup-lab
102
+ ```
103
+
104
+ Inspect the printed backup bundle and generated revert script. Durable memory
105
+ and context packs remain unless their separate purge flags are supplied.
106
+
107
+ ## Common failures
108
+
109
+ | Symptom | Cause | Recovery |
110
+ |---|---|---|
111
+ | Setup refuses a missing target | The non-interactive command omitted an explicit choice or `--yes` | Supply the target, `--git`, `--harness`, `--memory`, and `--yes` together |
112
+ | Setup refuses `--git existing` | The target is not inside a Git work tree | Choose an existing repository, or explicitly authorize `--git init`; use `--git none` only when limited mode is intended |
113
+ | Doctor reports missing or drifted Pi assets | Project setup selected Pi but machine sync is incomplete | Run `cairn sync-pi --apply`, then `cairn sync-pi --check` and `cairn doctor` |
114
+ | A cancelled call ends the session | The Pi/bridge version does not satisfy the per-call cancellation contract | Preserve sanitized diagnostics, close the session, and do not claim release readiness |
115
+ | Pi exits but a child process remains | Shutdown did not complete or the tested extension drifted | Preserve process-state evidence, run the sync check, and treat the release gate as failed |
116
+ | A client expects native annotation hints | Pi's public tool API has no annotations field | Inspect trusted bridge metadata/result `details`; never claim native propagation |
117
+
118
+ ## Privacy and trust boundary
119
+
120
+ `.ai/cairnkeep.json` is private setup state. It records selected modes,
121
+ harnesses, and setup-owned asset digests—not credentials, secrets, endpoints, or
122
+ absolute paths. The Pi bridge is a local child-process boundary: it inherits the
123
+ operator environment needed by the local server, retains only bounded stderr
124
+ for failure diagnostics, and does not log tool arguments or results.
125
+
126
+ Use only synthetic values in exercises and evidence. Do not publish executable
127
+ paths, usernames, hostnames, repository names, environment values, child output,
128
+ memory content, or private state. The bridge adds tools only; it does not run
129
+ prompts, approve skills, create an autonomous loop, or add remote access.
130
+
131
+ ## Release boundary
132
+
133
+ Ready means this lesson and its deterministic contracts pass against v2.11.0.
134
+ Release readiness requires a non-skipping acceptance run
135
+ against separate Pi 0.84.1 minimum and explicitly versioned registry-current
136
+ installations, plus the documented Node.js, Bash 3.2, and native Windows matrix.
137
+ Those executable paths must differ, but both may report 0.84.1 while that is the
138
+ current release; a future registry advance requires its new exact version.
@@ -2,7 +2,7 @@
2
2
 
3
3
  **Audience:** advanced users and platform maintainers
4
4
  **Prerequisite:** Practitioner track; L13 before operating captured evidence
5
- **Total time:** about 5 hours
5
+ **Total time:** about 5 hours 35 minutes
6
6
 
7
7
  1. [L09 - Domain knowledge with RAG](../lessons/L09-domain-knowledge.md)
8
8
  2. [L10 - Faster context exploration](../lessons/L10-context-exploration.md)
@@ -12,11 +12,16 @@
12
12
  6. [L16 - Evaluation and ablation](../lessons/L16-evaluation.md)
13
13
  7. [L20 - Least-authority MCP tool profiles](../lessons/L20-mcp-tool-profiles.md)
14
14
  8. [L21 - Immutable context packs and skill approval](../lessons/L21-context-packs.md)
15
+ 9. [L22 - Operate Cairnkeep on native Windows](../lessons/L22-native-windows.md)
16
+ 10. [L23 - Guided setup and Pi memory](../lessons/L23-guided-setup.md)
15
17
 
16
18
  All modules are optional. The track is complete when the operator can add and
17
19
  remove each integration without breaking the standalone local workflow and can
18
- explain its storage, network, credential, and rollback boundaries.
20
+ explain its storage, network, credential, and rollback boundaries. L23 adds the
21
+ v2.11 setup/Pi lifecycle only after the earlier storage, governance, trust, and
22
+ native-platform boundaries.
19
23
 
20
24
  Hands-on spine: `course-04-operation`, `course-06-governance`, and
21
- `course-07-evaluation`, and `course-10-trust-context` in the public
25
+ `course-07-evaluation`, `course-10-trust-context`, and
26
+ `course-12-guided-setup` in the public
22
27
  [course labs](https://github.com/cairnkeep/cairnkeep-course-labs).
@@ -1,17 +1,21 @@
1
1
  # Quickstart Track
2
2
 
3
3
  **Audience:** developers evaluating Cairnkeep
4
- **Total time:** about 75 minutes
4
+ **Total time:** about 110 minutes
5
5
  **Infrastructure:** local machine; Podman is optional
6
6
 
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
10
  4. [L03 - Bootstrap the first project](../lessons/L03-first-project.md)
11
+ 5. [L23 - Guided setup and Pi memory](../lessons/L23-guided-setup.md)
11
12
 
12
13
  The track is complete when a learner can start a new harness session, retrieve
13
14
  a previously accepted fact, and explain that default stdio memory is stored on
14
- the local machine rather than a discovered remote service.
15
+ the local machine rather than a discovered remote service. L23 then shows how
16
+ the recommended guided entry point preserves deterministic automation and keeps
17
+ Pi machine sync explicit. This guided surface ships in v2.11.
15
18
 
16
- Hands-on spine: `course-00-app` through `course-01-bootstrap` in the public
19
+ Hands-on spine: `course-00-app` through `course-01-bootstrap`, followed by
20
+ `course-12-guided-setup`, in the public
17
21
  [course labs](https://github.com/cairnkeep/cairnkeep-course-labs).
@@ -0,0 +1,122 @@
1
+ # Native Windows operation
2
+
3
+ Cairnkeep supports Windows x64 directly from PowerShell and Command Prompt.
4
+ The supported path does not invoke WSL, Git Bash, or a POSIX shell. Windows
5
+ ARM64 may use Windows x64 emulation, but it is not a native ARM64 support claim
6
+ until the database dependency publishes and passes an ARM64 Windows binding.
7
+
8
+ ## Install and guided setup
9
+
10
+ Prerequisites are Node.js 22 or newer, npm, and the harness you intend to use.
11
+ Git is required for `--git init`, `--git existing`, Git-backed context packs,
12
+ and `--untracked` bootstrap. Explicit `--git none` provides the same documented
13
+ limited mode as POSIX setup.
14
+ The optional `sqlite3.exe` command enables WAL-safe `cairn memory export`.
15
+
16
+ ```powershell
17
+ npm install --global @cairnkeep/cli
18
+ cairn version
19
+ $Project = 'C:\src\my-project'
20
+ cairn setup $Project --git init --harness claude,pi --memory local --yes
21
+ cairn sync --apply
22
+ cairn sync-pi --apply
23
+ cairn sync-pi --check
24
+ Set-Location $Project
25
+ cairn doctor
26
+ .\.ai\start-claude.cmd
27
+ ```
28
+
29
+ Guided setup exposes the same target classification, confirmation, Git,
30
+ harness, memory, reconciliation, counts, JSON result, diagnostics, launch, and
31
+ recovery contract as POSIX. It writes a restricted `.ai/cairnkeep.json` setup
32
+ record and never syncs machine assets automatically. `cairn bootstrap` remains
33
+ the deterministic compatibility primitive for existing scripts.
34
+
35
+ Setup and bootstrap write both the established Unix launchers and native Windows
36
+ launchers. Each `.cmd` file enters `start-harness.ps1`, loads `.ai/.env`, changes
37
+ to the project root, and forwards arguments without shell interpolation.
38
+ Optional `.ai/pre-launch.ps1` and `.ai/post-exit.ps1` seams run in the same
39
+ PowerShell process, so exported environment changes reach the harness. The post
40
+ hook receives `$env:CAIRN_EXIT_STATUS`.
41
+
42
+ ## MCP and operating assets
43
+
44
+ Register the stdio server exactly as on other platforms:
45
+
46
+ ```powershell
47
+ claude mcp add cairn-memory -s user -- cairn memory-server
48
+ cairn sync --check
49
+ ```
50
+
51
+ `cairn sync --apply` installs native `.cmd` hook transports and registers them
52
+ in the harness settings. The hook logic itself is Node and remains fail-open
53
+ except for capability admission, which preserves its fail-closed contract.
54
+ `cairn sync-pi` and `cairn sync-kimi` use native filesystem operations. Pi sync
55
+ installs the maintained local stdio memory extension explicitly; setup does not
56
+ start it or add remote access. Pi 0.84.1 is the validated minimum; the v2.11
57
+ release matrix also exercised a separate installation of the exact
58
+ registry-current Pi release. The two executable paths were distinct, while
59
+ both reported 0.84.1 because that was also the current release.
60
+
61
+ ## PowerShell completion
62
+
63
+ Load completion for the current session:
64
+
65
+ ```powershell
66
+ Invoke-Expression (& cairn completion powershell | Out-String)
67
+ ```
68
+
69
+ Place the same expression in `$PROFILE` to load it in future sessions.
70
+
71
+ ## Storage and permissions
72
+
73
+ Cairnkeep retains the same storage paths and formats. `~` resolves to the
74
+ Windows user profile. Sensitive managed JSON files do not rely on meaningless
75
+ Unix mode bits: Cairnkeep removes inherited ACLs and grants access only to the
76
+ current SID, Local System, and built-in Administrators. Context-pack content is
77
+ digest-verified before receiving restricted ACLs and a read-only attribute.
78
+ The guided setup state uses this same private ACL and contains no credentials,
79
+ endpoints, or absolute paths.
80
+
81
+ The embedded AgentFS database driver retains Windows file handles until its
82
+ Node process exits. Cairnkeep therefore runs artifact-store operations in
83
+ short-lived local Node helpers on Windows. Hard deletion and pruning build a
84
+ compacted replacement, release all handles when the helper exits, and only then
85
+ atomically replace the live database. This does not add a daemon, network
86
+ access, or background synchronization.
87
+
88
+ `cairn memory import` uses an internal path-validating tar/gzip reader. Export
89
+ uses `sqlite3.exe` `.backup` for a consistent snapshot of each live WAL database
90
+ and then writes the same portable `.tgz` format used on Unix.
91
+
92
+ ## Scheduling and process cleanup
93
+
94
+ `cairn audit-timer` registers the opt-in `Cairnkeep Memory Audit` task through
95
+ Windows Task Scheduler. `--render-only DIR` writes the command without changing
96
+ the scheduler. Evaluation cancellation targets the exact child PID and its
97
+ descendant tree through `taskkill.exe /T`, then escalates through `/F` after the
98
+ configured grace period.
99
+
100
+ ## Uninstall and recovery
101
+
102
+ Preview first, then confirm explicitly:
103
+
104
+ ```powershell
105
+ cairn uninstall --dry-run C:\src\my-project
106
+ cairn uninstall --yes C:\src\my-project
107
+ ```
108
+
109
+ Uninstall removes only managed assets and their hook registrations. Before
110
+ mutation it creates a timestamped bundle under
111
+ `~/cairnkeep-uninstall-backups/` containing exact files, a strict manifest, and
112
+ `revert.ps1`. Durable memory and context packs remain unless their separate
113
+ purge flags are supplied.
114
+
115
+ ## Verification boundary
116
+
117
+ The release gate runs from `windows-latest` using PowerShell for Node 22, 24,
118
+ and 26. It builds the TypeScript server, runs its Node tests, exercises guided
119
+ setup and bootstrap, sync/check (including Pi), native hooks, safe archive
120
+ import, backup-first uninstall, spaces and Unicode paths, packs the npm artifact,
121
+ installs it globally, invokes `cairn.cmd`, and runs `cairn doctor`. Git Bash is
122
+ never selected as the job shell.