@cairnkeep/cli 2.24.0 → 2.26.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 (60) hide show
  1. package/CHANGELOG.md +65 -0
  2. package/docs/README.md +6 -0
  3. package/docs/agents.md +18 -0
  4. package/docs/design/team-mode.md +17 -9
  5. package/docs/harness-compatibility.md +20 -0
  6. package/docs/learning/CURRICULUM-MAP.md +4 -2
  7. package/docs/learning/FEATURE-GUIDE.md +35 -3
  8. package/docs/learning/README.md +5 -3
  9. package/docs/learning/lessons/L00-why-cairnkeep.md +1 -1
  10. package/docs/learning/lessons/L01-safe-trial.md +3 -3
  11. package/docs/learning/lessons/L02-installation.md +2 -2
  12. package/docs/learning/lessons/L03-first-project.md +1 -1
  13. package/docs/learning/lessons/L19-validated-skill-improvement.md +1 -1
  14. package/docs/learning/lessons/L20-mcp-tool-profiles.md +1 -1
  15. package/docs/learning/lessons/L21-context-packs.md +1 -1
  16. package/docs/learning/lessons/L22-native-windows.md +2 -2
  17. package/docs/learning/lessons/L23-guided-setup.md +1 -1
  18. package/docs/learning/lessons/L24-okf-exchange.md +1 -1
  19. package/docs/learning/lessons/L25-playbooks.md +1 -1
  20. package/docs/learning/lessons/L26-context-intelligence.md +1 -1
  21. package/docs/learning/lessons/L27-ecosystem-evidence.md +1 -1
  22. package/docs/learning/lessons/L28-security-assurance.md +6 -2
  23. package/docs/learning/lessons/L29-team-continuity.md +127 -0
  24. package/docs/learning/tracks/operator.md +4 -0
  25. package/docs/learning/video-scripts/V28-security-assurance.md +4 -0
  26. package/docs/learning/video-scripts/V29-team-continuity.md +84 -0
  27. package/docs/operating.md +23 -3
  28. package/docs/privacy-and-data-flow.md +45 -6
  29. package/docs/provider-data-flow-review.md +48 -0
  30. package/docs/security-assurance.md +39 -0
  31. package/docs/storage.md +32 -0
  32. package/docs/team-onboarding.md +226 -0
  33. package/docs/team-pilot.md +134 -0
  34. package/docs/team.md +245 -0
  35. package/examples/eval/bundled-fake.json +1 -1
  36. package/mcp-memory-server/dist/capability-config.js +12 -1
  37. package/mcp-memory-server/dist/team-cli.js +228 -0
  38. package/mcp-memory-server/dist/team-client.js +71 -0
  39. package/mcp-memory-server/dist/team-http.js +193 -0
  40. package/mcp-memory-server/dist/team-mcp.js +89 -0
  41. package/mcp-memory-server/dist/team-store.js +669 -0
  42. package/mcp-memory-server/package.json +2 -2
  43. package/package.json +1 -1
  44. package/scripts/cairn-cli.mjs +7 -0
  45. package/scripts/completion.sh +31 -3
  46. package/scripts/lib/team-retention.mjs +29 -0
  47. package/scripts/team-connect.mjs +366 -0
  48. package/scripts/test-ci-sharding.sh +4 -0
  49. package/scripts/test-codeql-cohort.mjs +35 -0
  50. package/scripts/test-completion.sh +11 -0
  51. package/scripts/test-package-install.sh +10 -0
  52. package/scripts/test-phase18-capability-lifecycle.sh +2 -2
  53. package/scripts/test-security-baseline.sh +1 -0
  54. package/scripts/test-team-docs.sh +61 -0
  55. package/scripts/test-team-installed.mjs +51 -0
  56. package/scripts/test-team-pilot.mjs +101 -0
  57. package/scripts/uninstall.sh +13 -0
  58. package/scripts/verify-security-baseline.mjs +20 -0
  59. package/scripts/verify-team-retention.mjs +3 -0
  60. package/scripts/windows-platform.mjs +6 -2
@@ -0,0 +1,84 @@
1
+ # V29 - Remember together without sharing everything
2
+
3
+ Status: technical rehearsal brief for Cairnkeep 2.26.0 guided onboarding to the
4
+ opt-in preview introduced in 2.25.0. Not a recorded or independently rehearsed lesson.
5
+ Target: 10–12 minutes, experienced-developer audience. Describe a released
6
+ experimental preview, not a generally production-admitted team service.
7
+ Use the [isolated pilot guide](../../team-pilot.md) for a separately authorized
8
+ native-harness trial, not as authorization to record private review or credentials.
9
+
10
+ ## 0:00–1:30 — Continuity is the goal
11
+
12
+ “The useful part is not winning a one-shot puzzle. It is continuing tomorrow,
13
+ in another harness, without explaining the same project decision again.”
14
+ Pause, then introduce the new boundary: your private memory is not a team bucket.
15
+ Show the proposal/review/revision lifecycle, one stage at a time.
16
+
17
+ ## 1:30–3:30 — Deliberately separate identities
18
+
19
+ Use a disposable source checkout and only synthetic fixtures. Show
20
+ `bin/cairn team --help` and the default-off failure. Read the roles in
21
+ `docs/team.md`; highlight that a reviewer token is human-only and is never
22
+ handed to the agent. Briefly show initialization/membership command forms,
23
+ with no token contents on screen. The server is loopback-only.
24
+ Use the [role-based handoff](../../team-onboarding.md) connection card to show
25
+ which steps belong to the operator, reader and human reviewer. Run its actual
26
+ reader check in the disposable lab; never film a credential or replace the
27
+ personal memory entry. Keep a pause on the pending deployment decisions.
28
+
29
+ ## 3:30–6:00 — Make the boundary visible
30
+
31
+ Type the six L29 control commands at human speed; use completion where useful.
32
+ Split the terminal: immutable selected proposal on one side, human review and
33
+ approved retrieval on the other. Use the actual fixture results rather than
34
+ fabricating a transcript. Pause on denied workload/self-review and the stale
35
+ digest/base controls. Explain that confirming a hash does not prove human consent.
36
+
37
+ ## 6:00–8:00 — Change clients, not authority
38
+
39
+ Run `smoke-team-mcp.mjs` separately and inspect its maintained fixture: two
40
+ actual stdio clients, different cwd, same approved project decision. Zoom into
41
+ project provenance, then contrast an unrelated project denial and live token
42
+ revocation. Do not claim the test launched every named commercial harness.
43
+ Show `cairn team member remove SUBJECT --project ID --data DIR` as the explicit
44
+ project-offboarding command. Pause on the connected client's denial; explain
45
+ that removing one project membership does not revoke all of that person's tokens.
46
+ An additional MCP entry is opt-in; existing memory servers are not replaced.
47
+
48
+ ## 8:00–10:00 — Recovery with a catch
49
+
50
+ Run `smoke-team-restore.mjs` and `smoke-team-cli.mjs`. Leave a two-second pause
51
+ on “restored credentials revoked”: copying a backup must not silently restore
52
+ access. Show fresh-only restore, no-overwrite and uninstall-retention controls.
53
+ Explain that logical deletion is not secure disk erasure or backup deletion.
54
+
55
+ With a matching 2.26.0-or-newer client and team API, insert a short dynamic client segment:
56
+ open the harness checkboxes in `team connect`, pause on the no-write plan and
57
+ read-only default, then explicitly apply in a disposable project. Keep the
58
+ personal MCP entry visible beside the new team entry. Run `team doctor --client`
59
+ and zoom into expiry/project/roles, never the token file or original-config
60
+ backup. Switch folders, show the pinned project, then plan/apply disconnect.
61
+ Explain that disconnect is not revocation and running sessions need a restart.
62
+ Use the maintained `smoke-team-onboarding.mjs` results for interruption/drift
63
+ controls, not a fabricated typing transcript. The automated human-class policy
64
+ fixture is not actual human consent; no independent-human trial is claimed.
65
+ Do not record this addition against a 2.25-only client/API; follow the version
66
+ note in the onboarding guide and verify the published package before recording.
67
+
68
+ ## 10:00–11:30 — Honest closing
69
+
70
+ End on the admission checklist in `docs/team.md`, not a production deployment.
71
+ Distinguish completed regression controls, the internal governed review and
72
+ the approved isolated native pilot from independent production review and a
73
+ deployment-specific real-data pilot. Do not imply two independent human testers.
74
+ Explain that personal-memory embeddings/reranking never process team search.
75
+ Distinguish the JSON API/local stdio bridge from OAuth
76
+ remote MCP. Call out OIDC, team packs and multi-organization tenancy as deferred.
77
+
78
+ ## Recording contract
79
+
80
+ Use legible real terminals, short scene changes, natural pauses and emphasis
81
+ around each changed authority boundary. Keep credentials, personal memory,
82
+ source excerpts from private projects and raw snapshot text off screen.
83
+ Do not enroll a real user, deploy, purchase services or mutate live MCP config
84
+ to produce the video. This brief does not imply a video has been recorded.
package/docs/operating.md CHANGED
@@ -962,9 +962,10 @@ cairn playbook record --help
962
962
  ```
963
963
 
964
964
  Inspect receipts with `cairn playbook receipts list|show`; validate state with
965
- `cairn playbook doctor`. Actor and session options are provenance labels only:
966
- v2.15 does not authenticate them and does not provide team ACLs. See
967
- [team mode](design/team-mode.md) for the future admission contract.
965
+ `cairn playbook doctor`. Actor and session options remain unverified provenance
966
+ labels, not team ACLs. The separate [team preview](team.md) authenticates its own
967
+ credentials and project memberships; it never trusts local playbook labels.
968
+ See [team mode](design/team-mode.md) for the broader admission contract.
968
969
 
969
970
  The corresponding process overrides are optional:
970
971
 
@@ -1541,3 +1542,22 @@ cairn proposals apply PROPOSAL_DIGEST --project /path/to/project --json
1541
1542
 
1542
1543
  No background process synchronizes OpenViking, creates proposals, applies
1543
1544
  memory, enables packs, or approves skills.
1545
+
1546
+ ## Team continuity (opt-in 2.25 preview)
1547
+
1548
+ The separate `cairn team` command implements explicitly selected and reviewed
1549
+ project memory. It is default off (`CAIRN_TEAM=1` required); serving also needs
1550
+ `CAIRN_TEAM_HTTP=1`. It does not change ordinary setup or existing MCP entries.
1551
+ Use [the team reference](team.md) for roles, private credentials, additional
1552
+ local stdio registration, human review, backup/restore and incident handling.
1553
+ The 2.26.0 guided client workflow is documented in
1554
+ [team onboarding](team-onboarding.md#guided-connection-next-release--matching-source-checkout):
1555
+ `team connect` plans before explicit apply, `team doctor --client` checks only
1556
+ authenticated project/credential metadata, and `team disconnect` preserves
1557
+ personal memory and credentials. Both client and team API must support 2.26's
1558
+ connection check. No ordinary setup or production sharing is enabled implicitly.
1559
+ The internal governed review and approved isolated native pilot are complete;
1560
+ independent production review and a deployment-specific approved real-data pilot
1561
+ are still required before using real organization data.
1562
+ Existing personal HTTP remains a trusted single storage domain; token-first
1563
+ team JSON HTTP is a different service, not OAuth remote MCP HTTP.
@@ -14,7 +14,7 @@ below (some operator-owned endpoints do not require a credential).
14
14
  | Embedding-ranked search | Stored memory values that are not cached, plus the search query | `CAIRN_MEMORY_EMBEDDING_URL` or `CAIRN_LLM_API_URL` |
15
15
  | Separately opted-in memory reranking | Query and at most 50 scope/current/filter-admitted key/value excerpts, each at most 4 KiB | Only the explicit `CAIRN_MEMORY_RERANK_URL`; separate optional credential, no retries/redirects/alternate hosts |
16
16
  | `memory_extract` | The transcript supplied to the tool | `CAIRN_LLM_API_URL` |
17
- | `domain_knowledge_query` | Workspace slug and query | `ANYTHINGLLM_BASE_URL` |
17
+ | `domain_knowledge_query` | Workspace identifier and query | Configured domain provider: `ANYTHINGLLM_BASE_URL`, or separately enabled `CAIRN_OPENVIKING_BASE_URL` |
18
18
  | `domain_knowledge_sync` | Files selected by the sync configuration | `ANYTHINGLLM_BASE_URL` |
19
19
  | `route_check` | A health request, with no memory or prompt content | `CAIRN_ROUTE_ENDPOINT` |
20
20
  | `context_explore` | Repository path and query are passed to the configured local executable | `CAIRN_EXPLORE_BINARY`; any further data flow is controlled by that tool |
@@ -57,6 +57,14 @@ it does not require or inherit `CAIRN_LLM_API_KEY`. A local provider is still a
57
57
  separate process that receives these excerpts. Neither a chat agent nor a
58
58
  research assistant is part of reranking or authorization.
59
59
 
60
+ ## Domain retrieval configuration
61
+
62
+ Domain queries may derive a workspace identifier from local configuration;
63
+ that identifier is intentionally disclosed to the chosen provider. This does
64
+ not upload the configuration file or other local documents. See the
65
+ [provider data-flow review](provider-data-flow-review.md) for the exact tested
66
+ boundary and its limitations.
67
+
60
68
  ## Playbook decision and receipt flow
61
69
 
62
70
  Playbooks are local workflow policy, not model inference. A check reads the
@@ -71,12 +79,12 @@ timestamp, and the supplied actor/session labels. It excludes prompt content,
71
79
  file content, patches, command output, secrets, endpoint values, and environment
72
80
  snapshots. Changed paths influence a decision but are not copied into receipts.
73
81
 
74
- In v2.15, actor identity is an unauthenticated local assertion even when a
82
+ Local playbook actor identity remains an unauthenticated assertion even when a
75
83
  harness supplies it. Do not use receipts for employee monitoring,
76
- authorization, non-repudiation, or team access decisions. The future
77
- [team-mode contract](design/team-mode.md) requires authenticated subjects,
78
- deny-by-default ACLs, tenant isolation, retention, and append-only auditing
79
- before shared operation can ship.
84
+ authorization, non-repudiation, or team access decisions. The separate
85
+ [team preview](team.md) uses verified credentials and server-side memberships,
86
+ never these labels. The broader [team-mode contract](design/team-mode.md)
87
+ retains independent production-admission, isolation and retention requirements.
80
88
 
81
89
  ## Data at rest
82
90
 
@@ -701,3 +709,34 @@ skill readable; Cairnkeep never copies it into a harness or executes it.
701
709
 
702
710
  Pack digests and proposal digests protect integrity and stale-state detection;
703
711
  they do not authenticate a publisher or make extracted statements true.
712
+
713
+ ## Team preview flow and isolation
714
+
715
+ The default-off [team preview](team.md) reads no personal memory automatically.
716
+ Only explicitly supplied, inspected text becomes an immutable project proposal;
717
+ only review by a different human credential publishes a shared revision.
718
+ Workload tokens cannot review. The agent's local stdio bridge sends explicit
719
+ organization/project requests and bearer authorization to the separately
720
+ configured JSON API. Search uses substring matching, never an embedding/model
721
+ provider. There is no background ingestion or sync.
722
+
723
+ Membership and credentials, not cwd or local playbook actor labels, select
724
+ authority. Server checks happen on every operation. Profile/capability
725
+ restrictions only narrow MCP tools. Shared values, source digests and identities
726
+ are stored privately; audit includes operation/outcome/digests without text or
727
+ tokens. Backups include shared proposals and memberships and need separate
728
+ encryption and access control. No unapproved personal content is discoverable.
729
+ A hash confirmation does not establish human consent or content truth.
730
+ Review and production admission remain separate operator responsibilities.
731
+
732
+ The opt-in guided connection workflow stores endpoint/org/project IDs and a
733
+ credential **file path**, never the credential bytes, in private client state.
734
+ Its project-local MCP entry references that connection file; personal/global
735
+ MCP configuration is not replaced. Private recovery snapshots copy the original
736
+ harness configuration and may therefore contain preexisting operator secrets;
737
+ keep them out of source control and protect/encrypt backups separately.
738
+ Client doctor's authenticated metadata probe discloses the chosen project ID
739
+ to the configured service and returns only subject, roles and credential
740
+ ID/class/expiry. It neither reads memory text nor sends data to model providers.
741
+ It appends a normal value-free service audit event. Disconnect retains backups
742
+ and tokens and is not server-side revocation. See [onboarding](team-onboarding.md).
@@ -0,0 +1,48 @@
1
+ # Domain retrieval data-flow review
2
+
3
+ The `js/file-access-to-http` findings in `domain-retrieval-provider.ts` trace
4
+ the default workspace from the local memory configuration through
5
+ `domain_knowledge_query` to the configured provider. The source is the
6
+ `anythingllm_workspaces` field, not arbitrary document contents or stored memory.
7
+
8
+ This is an intentional disclosure boundary, not evidence of no disclosure:
9
+ the configured workspace identifier and the selected query leave the process.
10
+ Only configure a provider trusted to receive both. A read-only MCP annotation
11
+ means the tool does not mutate Cairnkeep state; it does **not** mean no network
12
+ traffic. The tool's open-world annotation reflects this boundary.
13
+
14
+ ## Boundaries checked
15
+
16
+ - Provider origin and authentication come from operator environment settings,
17
+ not workspace values or unrelated keys in a memory configuration file.
18
+ - The default provider percent-encodes the workspace as one path segment. A
19
+ workspace that resembles a URL cannot select another origin or add headers.
20
+ - The optional resource provider uses its fixed read-only endpoint, scopes
21
+ target identifiers below resources and rejects decoded traversal segments.
22
+ It requires explicit feature consent and separate remote-HTTP consent.
23
+ - Neither request path reads, enumerates or uploads local documents. The
24
+ query tool is separate from explicitly approved document synchronization.
25
+ - Both providers refuse redirects, bound responses and sanitize failures.
26
+ Do not weaken these controls to make a static-analysis finding disappear.
27
+
28
+ `smoke-provider-config-flow.mjs` exercises the actual stdio MCP configuration
29
+ path for both providers, including a URL-shaped workspace, unrelated file
30
+ sentinels and forged endpoint/credential fields. It asserts the exact selected
31
+ request body, fixed mock origin and operator-supplied authentication. All
32
+ fixtures are synthetic and run against loopback only. Existing outbound tests
33
+ cover redirect denial, consent, response bounds and payload-free failures.
34
+
35
+ ## Review disposition and limits
36
+
37
+ The reviewed flows are expected provider-routing disclosures, not a discovered
38
+ arbitrary-file-upload or file-selected-origin vulnerability. The alerts are
39
+ not dismissed or suppressed by this change: retain the finding and this
40
+ rationale for review, and reassess when source fields, destination selection,
41
+ workspace handling or provider behavior changes.
42
+
43
+ This is not a sandbox or a provider-side workspace ACL. A trusted local caller
44
+ can explicitly choose another workspace served by its provider credential;
45
+ the existing shared-token HTTP service is one trusted storage domain. Team
46
+ authorization remains separate, and team retrieval does not use these providers.
47
+ Same-account processes can change operator configuration. Tests establish the
48
+ documented application boundary, not the trustworthiness of a configured host.
@@ -138,6 +138,10 @@ prove a future privileged publish run succeeds.
138
138
 
139
139
  ## Verification evidence
140
140
 
141
+ The [domain retrieval data-flow review](provider-data-flow-review.md) records
142
+ the intentional file-derived workspace disclosure and its tested destination,
143
+ credential and content boundaries. Static-analysis alerts are not suppressed.
144
+
141
145
  The maintained gates are `npm run security:baseline`, both production
142
146
  `npm audit` checks, `scripts/test-security-baseline.sh`, the memory-server
143
147
  security-assurance and HTTP-guard smoke tests, native-Windows tests, and the
@@ -161,6 +165,7 @@ node mcp-memory-server/scripts/smoke-runtime-file-reads.mjs
161
165
  node mcp-memory-server/scripts/smoke-bounded-input-reads.mjs
162
166
  node mcp-memory-server/scripts/smoke-workspace-file-security.mjs
163
167
  node mcp-memory-server/scripts/smoke-outbound-security.mjs
168
+ node mcp-memory-server/scripts/smoke-security-fixture-order.mjs
164
169
  node scripts/test-runtime-file-security.mjs
165
170
  node scripts/test-omp-staged-security.mjs
166
171
  node scripts/test-container-health.mjs
@@ -173,6 +178,12 @@ assert that every historical CodeQL/Scorecard alert is fixed. Triage findings
173
178
  individually and use a fresh default-branch analysis to confirm alert status;
174
179
  never dismiss an uninvestigated finding merely to improve the score.
175
180
 
181
+ The aggregate imports filesystem-hook fixtures sequentially. Top-level-await
182
+ siblings are not a serial test runner: overlapping imports can restore another
183
+ fixture's hooks and create a false failure before growth injection. The
184
+ aggregate ownership/restoration observer covers this test-isolation contract;
185
+ runtime reader checks and injection assertions remain unchanged.
186
+
176
187
  The developer-evidence follow-up also hardens the shared runtime note pre-image
177
188
  hasher: it reads from an inspected descriptor under a 64 MiB cap and rejects
178
189
  replacement or growth before accepting a hash. Missing targets remain valid
@@ -222,3 +233,31 @@ fallback; its response cap is 8 MiB. OpenViking retains its 1 MiB cap, explicit
222
233
  consents and HTTPS-or-loopback rule. Both reject malformed UTF-8 and suppress
223
234
  network/stream diagnostics. Health probes use only `127.0.0.1` with a validated
224
235
  port and the existing private token resolver, and never follow redirects.
236
+
237
+ ## Team preview assurance boundary
238
+
239
+ The [team preview](team.md) adds a separate authenticated organization/project
240
+ boundary; it does not retrofit ACLs onto the existing personal HTTP server.
241
+ Expiring/revocable credentials, independent project roles, workload-review
242
+ denial, self-review denial, policy/base conflicts, immutable proposals and
243
+ transactional publication/audit have maintained synthetic controls.
244
+ The local MCP bridge has no review/admin tools, no scope fallback and a
245
+ restrictive profile/capability intersection. The loopback JSON API rejects
246
+ browser origins and unexpected Host headers, bounds requests/responses and
247
+ rechecks authority after body receipt.
248
+
249
+ `smoke-team*.mjs` additionally covers concurrent/cross-process state changes,
250
+ audit failure rollback, oversized chunked bodies, restore integrity, revoked
251
+ restored credentials, CLI exit and uninstall retention. Built-in SQLite needs
252
+ Node 22.13+ only when opted in. Linux fixture execution is not native Windows
253
+ evidence, and same-account processes remain trusted. Hash-linked local audit
254
+ cannot detect an OS owner rewriting the entire chain; backups are unencrypted.
255
+ Capacity exhaustion fails closed rather than removing audit history.
256
+
257
+ The governed internal separate-context review and approved isolated native
258
+ pilot are complete; this is not an external professional assessment or a study
259
+ with two independent human participants. The released preview remains default
260
+ off. Independent production security review, platform/package/container
261
+ verification and a deployment-specific approved real-data pilot remain
262
+ mandatory production gates. Inline review alone is not independent review.
263
+ The service is token-first JSON HTTP plus local stdio MCP, not OAuth remote MCP.
package/docs/storage.md CHANGED
@@ -602,3 +602,35 @@ store; it does not turn the proposal directory into a second memory authority.
602
602
  Context-usage receipts are strict links in the existing work-evidence store.
603
603
  They inherit work-evidence inspection, retention, and doctor behavior; there is
604
604
  no separate prompt or retrieved-content log.
605
+
606
+ ## Separate team store (opt-in 2.25 preview)
607
+
608
+ [Team continuity](team.md) keeps organization/project records in a separate
609
+ `team.db` under `CAIRN_TEAM_BASE_DIR` (default `~/.cairnkeep/team`). Built-in
610
+ SQLite transactions serialize state and audit across processes; personal
611
+ AgentFS stores and layouts are unchanged. No migration or automatic copying
612
+ of personal memory occurs. The OS owner is trusted; stored text is unencrypted.
613
+
614
+ Use `cairn team backup`, not a live directory copy, for a verified consistent
615
+ snapshot. Restore publishes only a new directory, requires its exact digest,
616
+ and revokes all copied credentials. Doctor verifies references, object hashes,
617
+ audit links and temporary remnants without choosing a recovery state.
618
+ Manual logical key deletion retains audit metadata and does not erase free
619
+ pages, WAL or backup copies. Uninstall retains team data and refuses purge
620
+ targets overlapping its configured directory. Independently selected
621
+ `--data` stores must be outside purge targets or also configured through
622
+ `CAIRN_TEAM_BASE_DIR`. Keep encrypted backups separately protected.
623
+
624
+ Guided client connection state is separate from the organization database:
625
+ `~/.cairnkeep/team-clients/<sha256-of-canonical-project-path>/` holds a strict
626
+ versioned connection, private recovery receipt/original config snapshots and
627
+ an exclusive sibling `<project-path-hash>.operation.lock`. Keeping the open lock
628
+ outside the archived directory preserves native Windows rename semantics and
629
+ continuous writer exclusion. Records contain token-file paths, not raw tokens.
630
+ Original MCP configs can contain other secrets, so protect these backups.
631
+ Activation is committed only after all selected entries are written. An
632
+ interrupted connect stays inactive; interrupted disconnect can resume without
633
+ overwriting unrelated edits. There is no automatic stale-lock cleanup.
634
+ Disconnect archives state in a unique `.disconnected-*` sibling and retains
635
+ credentials; uninstall/purge refuses to delete team client state/backups.
636
+ See [client diagnostics/recovery](team-onboarding.md#client-diagnosis-and-recovery).
@@ -0,0 +1,226 @@
1
+ # Team preview: a small, explicit handoff
2
+
3
+ For Cairnkeep 2.25.0 or newer. This is **not production admission**;
4
+ no real-data deployment is authorized by following this guide.
5
+
6
+ ## Choose the right workflow
7
+
8
+ For your own context across sessions, folders and harnesses, keep ordinary
9
+ `cairn-memory`. You already have that continuity; you do not need a team store.
10
+ Use the team preview when another person should retrieve **selected, reviewed
11
+ project decisions**. Personal memory stays separate. An overlay upgrade does
12
+ not enroll anyone, start a team service or enable sharing.
13
+
14
+ | Person | Responsibility | Keep separate |
15
+ |---|---|---|
16
+ | Operator | Private service, memberships, credentials and recovery | Deployment consent |
17
+ | Reader / coding client | Own workload token and explicit project | Human-review token |
18
+ | Contributor | Select/redact and propose exact text with consent | Publication authority |
19
+ | Human reviewer | Inspect actual proposal, approve/reject its digest | Agent workspace |
20
+
21
+ ## Operator handoff
22
+
23
+ For an explicitly approved **synthetic** rehearsal, follow the
24
+ [isolated pilot setup](team-pilot.md#1-prepare-a-private-lab), then start its
25
+ foreground loopback service. The tested recipe refuses an existing lab and
26
+ preserves personal MCP settings. Do not use production paths.
27
+
28
+ Give each participant a connection card: verified CLI version/path; loopback
29
+ or authenticated-tunnel URL; organization/project IDs; their individual private
30
+ workload-token file and expiry; disposable workspace; revocation contact.
31
+ For this lab the IDs are `trial-org` and `trial-project`.
32
+
33
+ Transfer tokens privately, never through chat, Git, arguments or recordings.
34
+ Keep the reviewer token outside agent workspaces. Same-OS-owner processes are
35
+ not mutually isolated; use separate accounts/machines when that is required.
36
+
37
+ ## Reader quick-check
38
+
39
+ In a separate Bash terminal on Linux/macOS, set the operator's paths and URL:
40
+
41
+ ```sh
42
+ TEAM_CAIRN=/absolute/path/to/verified-checkout/bin/cairn
43
+ TEAM_PILOT_DIR=/absolute/private/new-team-pilot
44
+ TEAM_PILOT_URL=http://127.0.0.1:17955
45
+ ```
46
+
47
+ This block makes one read request. It does not create storage, issue credentials,
48
+ start a service or edit a harness. Expect `[]` before any human publication.
49
+ Stop on connection/authorization failure; never fall back to personal memory.
50
+
51
+ <!-- team-reader-check:start -->
52
+ ```sh
53
+ set -e
54
+ : "${TEAM_CAIRN:?Set the verified CLI path}"
55
+ : "${TEAM_PILOT_DIR:?Set the private lab directory}"
56
+ : "${TEAM_PILOT_URL:?Set the loopback or authenticated-tunnel URL}"
57
+ team_pilot_reader() {
58
+ env -i PATH="$PATH" CAIRN_TEAM=1 \
59
+ CAIRN_TEAM_URL="$TEAM_PILOT_URL" CAIRN_TEAM_ORGANIZATION=trial-org \
60
+ CAIRN_TEAM_TOKEN_FILE="$TEAM_PILOT_DIR/reader.token" \
61
+ "$TEAM_CAIRN" team "$@" --project trial-project
62
+ }
63
+ team_pilot_reader list
64
+ ```
65
+ <!-- team-reader-check:end -->
66
+
67
+ On native Windows, use equivalent explicit environment settings and
68
+ `cairn team list --project trial-project` from [the reference](team.md).
69
+
70
+ Add **only an additional**, disposable `cairn-team-memory` stdio entry:
71
+ the verified command, arguments `team mcp --project-root WORKSPACE`, and the
72
+ same four `CAIRN_TEAM*` settings above. For a reader, also set
73
+ `CAIRN_TEAM_MCP_TOOL_PROFILE=read-only`. Merge into the isolated harness profile;
74
+ never replace `cairn-memory` or its entire configuration. See
75
+ [connection semantics](team.md#harness-connection).
76
+ Each tool call names `trial-project`; cwd and display names grant no access.
77
+ The MCP profile restricts tools; server membership independently restricts data.
78
+
79
+ <a id="guided-connection-next-release--matching-source-checkout"></a>
80
+
81
+ ## Guided connection (2.26 or newer)
82
+
83
+ The original preview and reader card above work on 2.25.0. The guided commands
84
+ below require both the client **and team API** at 2.26.0 or newer. They do not
85
+ change ordinary `cairn setup`, personal memory or the preview's
86
+ production-admission boundary.
87
+
88
+ After the operator supplies a **workload reader** credential, opt in explicitly:
89
+
90
+ ```sh
91
+ CAIRN_TEAM=1 cairn team connect --project-root /absolute/project
92
+ ```
93
+
94
+ The wizard asks for URL, organization/project IDs, a private credential-file
95
+ path and harness checkboxes. Its default tool profile is read-only. It displays
96
+ the planned files and asks before applying. Cancellation returns to the shell.
97
+ For automation, supply every choice; without `--apply` this only plans:
98
+
99
+ ```sh
100
+ CAIRN_TEAM=1 cairn team connect --project-root /absolute/project \
101
+ --url http://127.0.0.1:17955 --organization trial-org --project trial-project \
102
+ --token-file /absolute/private/reader.token --harness claude,opencode
103
+ # Repeat the same command with --apply --yes to connect.
104
+ CAIRN_TEAM=1 cairn team doctor --client --project-root /absolute/project
105
+ ```
106
+
107
+ Never pass a token value. Keep the credential file outside this project's
108
+ source tree and owner-only (POSIX 0600; native Windows private ACL). URLs must
109
+ be loopback HTTP or HTTPS, without credentials, query, fragment or path prefix.
110
+ Use the operator's encrypted authenticated tunnel, not a public unauthenticated
111
+ listener. The command authenticates reader access before changing a harness.
112
+ It refuses human-class credentials: the operator must issue a workload token
113
+ for the agent, keeping human review credentials in the separate human terminal.
114
+
115
+ | Harness choice | Project-local file | Additional entry |
116
+ |----------------|--------------------|------------------|
117
+ | `claude` | `.mcp.json` | `mcpServers.cairn-team-memory` |
118
+ | `opencode` | `opencode.json` | `mcp.cairn-team-memory` |
119
+ | `qwen` | `.qwen/settings.json` | `mcpServers.cairn-team-memory` |
120
+ | `codex` | `.codex/config.toml` | marked `mcp_servers.cairn-team-memory` block |
121
+
122
+ No global harness file is written. Existing unrelated entries are preserved;
123
+ an existing team entry, duplicate JSON keys, JSONC or unsupported inline TOML
124
+ causes refusal rather than replacement. OpenCode `opencode.jsonc` is not edited.
125
+ Pi/OMP/Kimi use the manual bridge recipe; this wizard does not claim automated
126
+ configuration for them. Harness-native trust/enablement prompts still apply.
127
+ Adapter regression uses real SDK stdio calls, not live model/harness UI sessions.
128
+
129
+ The generated entry invokes the verified Node/CLI paths with a private
130
+ `--connection` file. It pins the server project even if the harness starts in
131
+ another folder; each tool call still names that ID. It does not grant server
132
+ membership. Contributors can explicitly select `--access full` to expose
133
+ proposal creation, still subject to existing profile/capability restrictions
134
+ and server authorization. Human review/admin tools never become available.
135
+ Changing connection settings requires disconnect/reconnect; credentials may be
136
+ rotated in place without a harness restart because the bridge rereads the file.
137
+
138
+ ### Client diagnosis and recovery
139
+
140
+ Client doctor verifies the active managed entries and private credential file,
141
+ then makes one authenticated `connection-check` request. It reports the current
142
+ subject, credential ID/class/expiry, project and roles, **not** memory text,
143
+ proposals, token values or environment snapshots. The service appends its normal
144
+ value-free audit event. It opens no local administrator store and cannot issue
145
+ credentials, grant membership or repair permissions. Wrong org/project, missing
146
+ reader membership and expired/revoked credentials require the operator; failed
147
+ team access never falls back to personal memory. Check the tunnel/TLS and API
148
+ version on connection failure. Store doctor remains `team doctor --data DIR`.
149
+
150
+ ```sh
151
+ CAIRN_TEAM=1 cairn team disconnect --project-root /absolute/project
152
+ # Inspect the no-write plan, then:
153
+ CAIRN_TEAM=1 cairn team disconnect --project-root /absolute/project --apply --yes
154
+ ```
155
+
156
+ Disconnect removes only unchanged owned entries. It restores exact original
157
+ bytes when nothing else changed; otherwise it preserves unrelated edits and
158
+ refuses an altered team entry. It keeps the token and private backups. Restart
159
+ existing harness sessions; disconnect is **not revocation**. The operator must
160
+ revoke a credential/remove membership for immediate denial in running sessions.
161
+
162
+ Connection records and original configuration snapshots are private under
163
+ `~/.cairnkeep/team-clients/<canonical-project-path-sha256>/`. Backups may include
164
+ secrets already present in your original MCP config: never commit or publish
165
+ them; use separately encrypted backups as appropriate. No token content is
166
+ copied from its file. Disconnected records are retained in uniquely named
167
+ `.disconnected-*` siblings. Uninstall/purge refuses to delete this retained state.
168
+
169
+ A per-project exclusive `<project-path-hash>.operation.lock` beside the state
170
+ directory serializes Cairnkeep writers and stays held while state is archived,
171
+ including on native Windows. A failed
172
+ multi-file connect keeps its recovery record in `preparing`; the bridge refuses
173
+ startup until **all** entries are written and activation is committed. Run
174
+ disconnect to undo an interrupted operation after checking for configuration
175
+ drift. An interrupted disconnect is likewise resumable. Do not restore a whole
176
+ backup over newer unrelated edits. If the process crashed holding its lock,
177
+ first verify no connection/disconnection process is running, preserve the state
178
+ directory, then manually remove **only that project's** sibling `.operation.lock` and
179
+ retry disconnect. The tool never guesses that a live lock is stale.
180
+
181
+ Configuration directories must be owned/trusted and not writable by other users.
182
+ Each configuration is bounded to 1 MiB and the four-file recovery record to
183
+ 16 MiB, including both original/new bytes and base64 overhead.
184
+ Links and unsafe files are rejected. Writers use bounded descriptor-first reads,
185
+ exclusive creation and atomic replacement with a final drift check. This is not
186
+ an OS compare-and-swap against a hostile process running as your own identity;
187
+ stop concurrent editor writes before applying. No root-directory or global
188
+ configuration target, automatic permission changes to existing directories,
189
+ automatic enrollment or background synchronization is introduced.
190
+
191
+ ## Contributor and reviewer
192
+
193
+ Contributors get their **own** workload credential and explicit contributor
194
+ membership. Start with one synthetic decision; select/redact exact text and
195
+ confirm its value digest using the [proposal reference](team.md#harness-connection).
196
+ There is no automatic personal-memory import.
197
+
198
+ In the separate human terminal, inspect `proposal-show`, then approve/reject
199
+ the actual stored bytes with their proposal digest. Never hand a human token
200
+ to a model. Automated tests of human-class tokens are not human consent.
201
+ Restart a reader in another folder: the approved decision/provenance must match;
202
+ unrelated-project access and revoked credentials must fail. Follow the
203
+ [pilot checks and cleanup](team-pilot.md#4-exercise-the-actual-review-boundary).
204
+ Native trials require separately authorized providers; no model purchase or
205
+ subscription use is authorized by this guide.
206
+
207
+ ## Deployment readiness
208
+
209
+ Before requesting a real-data pilot, record an owner and evidence for:
210
+
211
+ - **Purpose:** project IDs, participants, data classes, one continuity use case,
212
+ explicit exclusions and a stop date.
213
+ - **Consent:** selected-data approval, independent production security review
214
+ and deployment authorization. Mark absent decisions pending; tests supply none.
215
+ - **Access:** least-privilege roles, individual expiring tokens, separate human
216
+ review, authenticated tunnel/TLS, private storage and trusted host ownership.
217
+ - **Operation:** named operator, revocation/offboarding contact, storage/audit
218
+ capacity, encrypted backup retention and a rehearsed fresh-only restore.
219
+ Restored credentials are revoked; reissue and activation remain explicit.
220
+ - **Acceptance/rollback:** continuity across clients/folders, denied/unapproved
221
+ content hidden, immediate revocation and unchanged personal config hashes.
222
+ Stop the separate service and remove only its additional client entry to
223
+ withdraw access; preserve agreed private evidence.
224
+
225
+ Until these decisions are explicitly approved, stay in the disposable synthetic
226
+ lab. No automatic production transition follows the rehearsal.