@cairnkeep/cli 2.15.4 → 2.17.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +44 -0
- package/CONTRIBUTING.md +12 -0
- package/README.md +85 -590
- package/docs/README.md +87 -0
- package/docs/agents.md +193 -0
- package/docs/context-intelligence.md +143 -0
- package/docs/context-packs.md +33 -0
- package/docs/domain-knowledge.md +29 -0
- package/docs/ecosystem.md +23 -0
- package/docs/learning/CURRICULUM-MAP.md +3 -1
- package/docs/learning/FEATURE-GUIDE.md +23 -4
- package/docs/learning/README.md +4 -0
- package/docs/learning/lessons/L00-why-cairnkeep.md +3 -1
- package/docs/learning/lessons/L01-safe-trial.md +3 -3
- package/docs/learning/lessons/L02-installation.md +2 -2
- package/docs/learning/lessons/L03-first-project.md +9 -10
- package/docs/learning/lessons/L19-validated-skill-improvement.md +1 -1
- package/docs/learning/lessons/L20-mcp-tool-profiles.md +1 -1
- package/docs/learning/lessons/L21-context-packs.md +1 -1
- package/docs/learning/lessons/L22-native-windows.md +2 -2
- package/docs/learning/lessons/L23-guided-setup.md +18 -5
- package/docs/learning/lessons/L24-okf-exchange.md +1 -1
- package/docs/learning/lessons/L25-playbooks.md +1 -1
- package/docs/learning/lessons/L26-context-intelligence.md +180 -0
- package/docs/learning/tracks/evidence-and-evaluation.md +1 -0
- package/docs/learning/tracks/operator.md +1 -0
- package/docs/learning/tracks/practitioner.md +1 -0
- package/docs/learning/video-scripts/V26-context-intelligence.md +144 -0
- package/docs/native-windows.md +5 -0
- package/docs/operating.md +65 -3
- package/docs/privacy-and-data-flow.md +22 -0
- package/docs/quickstart.md +12 -4
- package/docs/releasing.md +27 -19
- package/docs/storage.md +21 -0
- package/docs/work-evidence.md +14 -0
- package/examples/eval/bundled-fake.json +1 -1
- package/mcp-memory-server/dist/context-pack-cli.js +3 -1
- package/mcp-memory-server/dist/context-pack-retrieval.js +413 -0
- package/mcp-memory-server/dist/context-pack.js +171 -3
- package/mcp-memory-server/dist/domain-retrieval-provider.js +257 -0
- package/mcp-memory-server/dist/index.js +73 -387
- package/mcp-memory-server/dist/mcp-tool-catalog.js +2 -0
- package/mcp-memory-server/dist/memory-extraction.js +87 -0
- package/mcp-memory-server/dist/memory-proposal-cli.js +110 -0
- package/mcp-memory-server/dist/memory-proposal-schema.js +78 -0
- package/mcp-memory-server/dist/memory-proposal-store.js +273 -0
- package/mcp-memory-server/dist/platform-security.js +32 -26
- package/mcp-memory-server/dist/retrieval-benchmark.js +199 -0
- package/mcp-memory-server/dist/reviewed-memory-store.js +281 -0
- package/mcp-memory-server/dist/work-evidence-schema.js +17 -0
- package/mcp-memory-server/dist/work-evidence-store.js +57 -1
- package/mcp-memory-server/package.json +8 -1
- package/package.json +1 -1
- package/schemas/context-usage-receipt.schema.json +41 -0
- package/schemas/memory-proposal.schema.json +65 -0
- package/schemas/retrieval-benchmark.schema.json +64 -0
- package/scripts/cairn-cli.mjs +3 -0
- package/scripts/completion.sh +17 -6
- package/scripts/doctor.sh +4 -2
- package/scripts/setup.mjs +92 -13
- package/scripts/terminal-prompts.mjs +172 -0
- package/scripts/test-completion.sh +8 -1
- package/scripts/test-docs-navigation.sh +63 -0
- package/scripts/test-doctor.sh +21 -0
- package/scripts/test-phase17-artifact-lifecycle.sh +1 -1
- package/scripts/test-release-sbom.sh +44 -16
- package/scripts/test-setup-preflight.mjs +130 -0
- package/scripts/test-windows-native.mjs +30 -0
- package/scripts/verify-docs-parity.sh +28 -28
- package/scripts/windows-platform.mjs +8 -5
package/docs/README.md
ADDED
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
# Cairnkeep documentation
|
|
2
|
+
|
|
3
|
+
This is the versioned documentation index for Cairnkeep. Start with the path
|
|
4
|
+
that matches what you are trying to do; detailed configuration belongs in the
|
|
5
|
+
linked guides rather than the project landing page.
|
|
6
|
+
|
|
7
|
+
## Start here
|
|
8
|
+
|
|
9
|
+
| Goal | Guide |
|
|
10
|
+
|---|---|
|
|
11
|
+
| Install Cairnkeep and configure a first project | [Quickstart](quickstart.md) |
|
|
12
|
+
| Understand how coding agents should use Cairnkeep | [Cairnkeep for coding agents](agents.md) |
|
|
13
|
+
| Compare Claude Code, OpenCode, Codex, Kimi, Qwen, Pi, and generic MCP support | [Harness compatibility](harness-compatibility.md) |
|
|
14
|
+
| Follow the complete operator reference | [Operating Cairnkeep](operating.md) |
|
|
15
|
+
| Learn Cairnkeep progressively or produce the video series | [Learning paths and video scripts](learning/README.md) |
|
|
16
|
+
|
|
17
|
+
## Agents and harnesses
|
|
18
|
+
|
|
19
|
+
- [Cairnkeep for coding agents](agents.md) explains retrieval-first behavior,
|
|
20
|
+
memory authority, playbooks, approvals, and graceful fallback.
|
|
21
|
+
- [Harness compatibility](harness-compatibility.md) records the exact commands,
|
|
22
|
+
hooks, plugins, launchers, skills, and MCP surfaces available in each client.
|
|
23
|
+
- [MCP tool annotations and least-authority profiles](mcp-tool-profiles.md)
|
|
24
|
+
explains observation/action metadata and project tool allowlists.
|
|
25
|
+
- [Immutable context packs](context-packs.md) covers approved external documents
|
|
26
|
+
and skills that remain read-only context rather than executable harness assets.
|
|
27
|
+
- [Validated skill improvement](skill-improvement.md) describes the reviewed,
|
|
28
|
+
measured, reversible path for changing a live skill.
|
|
29
|
+
|
|
30
|
+
## Context intelligence
|
|
31
|
+
|
|
32
|
+
- [Context intelligence](context-intelligence.md) connects progressive context-pack
|
|
33
|
+
retrieval, the frozen benchmark, usage receipts, review-gated proposals, and
|
|
34
|
+
the optional read-only OpenViking provider.
|
|
35
|
+
- [Immutable context packs](context-packs.md), [domain knowledge](domain-knowledge.md),
|
|
36
|
+
and [work evidence](work-evidence.md) document each boundary in depth.
|
|
37
|
+
|
|
38
|
+
## Operations, storage, and privacy
|
|
39
|
+
|
|
40
|
+
- [Operating Cairnkeep](operating.md) is the full CLI and configuration
|
|
41
|
+
reference.
|
|
42
|
+
- [Memory storage and deployment](storage.md) documents local and remote stores,
|
|
43
|
+
retention, backup, migration, and uninstall behavior.
|
|
44
|
+
- [Privacy and data flow](privacy-and-data-flow.md) maps what each opt-in feature
|
|
45
|
+
reads, stores, and may send over the network.
|
|
46
|
+
- [Git-linked work evidence](work-evidence.md) covers bounded local session-to-Git
|
|
47
|
+
provenance without prompt or reasoning capture.
|
|
48
|
+
- [Optional document knowledge](domain-knowledge.md) covers the separately
|
|
49
|
+
configured document-RAG integration.
|
|
50
|
+
|
|
51
|
+
## Deployment and platforms
|
|
52
|
+
|
|
53
|
+
- [Containers](containers.md) covers rootless Podman, OCI images, authenticated
|
|
54
|
+
HTTP, and persistent storage.
|
|
55
|
+
- [Native Windows](native-windows.md) covers x64 setup, launchers, ACLs,
|
|
56
|
+
scheduling, process cleanup, and recovery.
|
|
57
|
+
- [Git providers](git-providers.md) describes provider-neutral Git-linked
|
|
58
|
+
workflows.
|
|
59
|
+
|
|
60
|
+
## Exchange and ecosystem
|
|
61
|
+
|
|
62
|
+
- [Open Knowledge Format exchange](open-knowledge-format.md) covers importing
|
|
63
|
+
and exporting portable knowledge bundles.
|
|
64
|
+
- [Companion tools and related projects](ecosystem.md) lists optional tools that
|
|
65
|
+
complement Cairnkeep without becoming runtime dependencies.
|
|
66
|
+
|
|
67
|
+
## Overlays and teams
|
|
68
|
+
|
|
69
|
+
- [Building an overlay](building-an-overlay.md) explains how to add private
|
|
70
|
+
provider or organization policy without forking the core.
|
|
71
|
+
- [Managed overlay distributions](overlay-distributions.md) covers wrapper CLIs,
|
|
72
|
+
policy locks, private registries, and rollback.
|
|
73
|
+
- [Team-mode design](design/team-mode.md) records the current team workflow
|
|
74
|
+
boundary and deferred multi-user concerns.
|
|
75
|
+
- [Meta-agent design](design/meta-agent.md) records the bounded workflow design
|
|
76
|
+
behind Cairnkeep playbooks.
|
|
77
|
+
|
|
78
|
+
## Contributing and releases
|
|
79
|
+
|
|
80
|
+
- [Contributing](../CONTRIBUTING.md)
|
|
81
|
+
- [Release process](releasing.md)
|
|
82
|
+
- [Support](../SUPPORT.md)
|
|
83
|
+
- [Security policy](../SECURITY.md)
|
|
84
|
+
|
|
85
|
+
These files ship with the repository and npm package, so documentation stays
|
|
86
|
+
reviewable and version-aligned with the code. A website or GitHub Wiki may
|
|
87
|
+
mirror them later, but should not become a second source of truth.
|
package/docs/agents.md
ADDED
|
@@ -0,0 +1,193 @@
|
|
|
1
|
+
# Cairnkeep for coding agents
|
|
2
|
+
|
|
3
|
+
Cairnkeep gives a coding agent durable project context and bounded workflow
|
|
4
|
+
guidance. It does not replace repository inspection, decide what is true, or
|
|
5
|
+
turn a harness into an autonomous Cairnkeep runtime.
|
|
6
|
+
|
|
7
|
+
This guide is for both agents and the people configuring them.
|
|
8
|
+
|
|
9
|
+
## The agent contract
|
|
10
|
+
|
|
11
|
+
For a nontrivial task that may depend on previous decisions, conventions,
|
|
12
|
+
constraints, recurring failures, or prior work:
|
|
13
|
+
|
|
14
|
+
1. Derive one short query directly from the user's task.
|
|
15
|
+
2. If `memory_search` is available, make that project-scoped search the first
|
|
16
|
+
tool or command. Do not inspect the repository first merely to formulate the
|
|
17
|
+
query.
|
|
18
|
+
3. Treat every result as a locator. Read and verify the maintained repository
|
|
19
|
+
sources it references before using it to make a change.
|
|
20
|
+
4. If the tool is unavailable or the result is irrelevant, continue with
|
|
21
|
+
ordinary repository inspection. Do not repeat or broaden searches simply to
|
|
22
|
+
force a memory hit.
|
|
23
|
+
5. Do not call `memory_write`, supersede a record, approve content, or promote
|
|
24
|
+
durable knowledge unless the user or an applicable reviewed workflow
|
|
25
|
+
explicitly requests capture.
|
|
26
|
+
|
|
27
|
+
This protocol improves continuity without allowing stale memory to outrank
|
|
28
|
+
code, tests, current documentation, or the user's request.
|
|
29
|
+
|
|
30
|
+
## What setup installs
|
|
31
|
+
|
|
32
|
+
`cairn setup` reconciles a delimited Cairnkeep block in the project's
|
|
33
|
+
`AGENTS.md` while preserving surrounding user content and file mode. The block
|
|
34
|
+
contains the durable-context contract above and bounded playbook instructions.
|
|
35
|
+
It can be removed independently with:
|
|
36
|
+
|
|
37
|
+
```bash
|
|
38
|
+
cairn playbook instructions remove
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
The selected harness determines which project assets setup creates. Setup
|
|
42
|
+
reports but never performs machine-level sync. Claude Code and OpenCode receive
|
|
43
|
+
the complete operating layer only after the operator runs the reported
|
|
44
|
+
`cairn sync --apply` command; Codex, Qwen, Kimi, and Pi have narrower
|
|
45
|
+
integrations. See [Harness compatibility](harness-compatibility.md) for the
|
|
46
|
+
exact tested surface. Instruction presence is not evidence that an agent
|
|
47
|
+
actually invoked a tool.
|
|
48
|
+
|
|
49
|
+
## Memory scopes and authority
|
|
50
|
+
|
|
51
|
+
Use `scope: project` for task-specific decisions and conventions. Broader
|
|
52
|
+
scopes may be configured, but an agent should not widen a search merely to find
|
|
53
|
+
an answer. The read-only virtual `all` scope is useful only when the task truly
|
|
54
|
+
crosses configured scopes.
|
|
55
|
+
|
|
56
|
+
Memory remains a secondary source:
|
|
57
|
+
|
|
58
|
+
```text
|
|
59
|
+
user request + maintained repository sources
|
|
60
|
+
↓ verify
|
|
61
|
+
durable memory locator
|
|
62
|
+
↓ apply
|
|
63
|
+
implementation decision
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
If a memory record conflicts with current code, tests, policy, or explicit user
|
|
67
|
+
direction, follow the current authoritative source and report the conflict.
|
|
68
|
+
Correct or supersede the durable record only through an explicitly approved
|
|
69
|
+
workflow.
|
|
70
|
+
|
|
71
|
+
## Bounded playbooks
|
|
72
|
+
|
|
73
|
+
The project policy in `.ai/playbooks.json` helps an agent decide which existing
|
|
74
|
+
recall, planning, verification, review, security, documentation, and learning
|
|
75
|
+
steps apply. Check it at task boundaries:
|
|
76
|
+
|
|
77
|
+
```bash
|
|
78
|
+
cairn playbook check start \
|
|
79
|
+
--session SESSION \
|
|
80
|
+
--complexity standard \
|
|
81
|
+
--familiarity mixed
|
|
82
|
+
|
|
83
|
+
cairn playbook check check
|
|
84
|
+
|
|
85
|
+
cairn playbook check finish \
|
|
86
|
+
--session SESSION \
|
|
87
|
+
--changed PATH... \
|
|
88
|
+
--risk normal \
|
|
89
|
+
--completed ACTION... \
|
|
90
|
+
--skipped ACTION=REASON... \
|
|
91
|
+
--enforce
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
Complexity accepts `trivial`, `standard`, or `complex`; familiarity accepts
|
|
95
|
+
`known`, `mixed`, or `unfamiliar`; risk accepts `low`, `normal`, `high`, or
|
|
96
|
+
`security`. Follow every applicable `must` action, apply `should` actions unless
|
|
97
|
+
there is a concrete reason to skip them, and use judgment for `may` actions.
|
|
98
|
+
Re-check when scope, familiarity, complexity, or risk changes materially. Exit
|
|
99
|
+
3 means enforced `must` evidence is missing; exit 2 means invalid input or a
|
|
100
|
+
policy diagnostic. Neither is permission to relabel failed work as complete.
|
|
101
|
+
|
|
102
|
+
A playbook result selects existing actions only. It cannot:
|
|
103
|
+
|
|
104
|
+
- execute a command or workflow;
|
|
105
|
+
- enable a disabled feature or capability;
|
|
106
|
+
- activate a context-pack skill;
|
|
107
|
+
- grant approval or authorize destructive work;
|
|
108
|
+
- write or promote durable memory automatically; or
|
|
109
|
+
- prove that an agent followed the recommendation.
|
|
110
|
+
|
|
111
|
+
After a successful finish check, material outcomes can be recorded with the
|
|
112
|
+
exact policy and decision digests returned by the check. Run
|
|
113
|
+
`cairn playbook record --help` for the bounded values. Actor identity is a
|
|
114
|
+
caller-supplied local label, not authenticated identity.
|
|
115
|
+
|
|
116
|
+
## Tool authority
|
|
117
|
+
|
|
118
|
+
Every Cairnkeep MCP tool has explicit read-only, destructive, idempotent, and
|
|
119
|
+
open-world annotations. Operators can restrict discovery with a `read-only` or
|
|
120
|
+
exact custom profile:
|
|
121
|
+
|
|
122
|
+
```bash
|
|
123
|
+
cairn mcp-tools status
|
|
124
|
+
cairn mcp-tools set read-only
|
|
125
|
+
cairn mcp-tools set custom --tool memory_read --tool memory_search
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
Effective discovery is the intersection of available feature gates, the
|
|
129
|
+
capability contract, and the MCP tool profile. A profile can remove tools but
|
|
130
|
+
cannot enable a disabled feature. An annotation describes a tool; it does not
|
|
131
|
+
grant permission or replace the harness's approval policy. See
|
|
132
|
+
[MCP tool profiles](mcp-tool-profiles.md).
|
|
133
|
+
|
|
134
|
+
## Documents and skills from context packs
|
|
135
|
+
|
|
136
|
+
Enabled context-pack documents are read-only external context. Skill files are
|
|
137
|
+
invisible until an operator approves their exact project, pack digest, path,
|
|
138
|
+
and file digest. Even then, they are discoverable text through MCP—not copied
|
|
139
|
+
into a harness, automatically activated, or executed. A pack update invalidates
|
|
140
|
+
the old approval. See [Immutable context packs](context-packs.md).
|
|
141
|
+
|
|
142
|
+
## Progressive retrieval and reviewed-memory proposals
|
|
143
|
+
|
|
144
|
+
When `context_pack_tree` is available, inspect abstracts before requesting full
|
|
145
|
+
content. Use hierarchical search for broad questions, exact path/title retrieval
|
|
146
|
+
for known leaves, and `explain: true` only when the bounded selection trace helps
|
|
147
|
+
debug retrieval. Default flat search remains valid and compatible.
|
|
148
|
+
|
|
149
|
+
Stable result references are opt-in (`include_refs: true`). If the operator also
|
|
150
|
+
enables `context_usage_record`, record only whether the cited result was used;
|
|
151
|
+
never put prompts or content into digest fields. Treat recording as a mutation.
|
|
152
|
+
|
|
153
|
+
`cairn proposals create` may suggest reviewed-memory candidates from a stored,
|
|
154
|
+
redacted trajectory, but an agent must inspect the proposal and use
|
|
155
|
+
`cairn proposals apply DIGEST` explicitly. Never treat extraction output as
|
|
156
|
+
reviewed truth, auto-apply it, or work around a stale-source/base-memory failure.
|
|
157
|
+
|
|
158
|
+
The optional OpenViking provider changes only how `domain_knowledge_query`
|
|
159
|
+
retrieves external context. It does not replace Cairnkeep's memory, evidence,
|
|
160
|
+
pack, or authority model.
|
|
161
|
+
|
|
162
|
+
## Graceful fallback
|
|
163
|
+
|
|
164
|
+
Cairnkeep should never block ordinary engineering merely because optional
|
|
165
|
+
context is unavailable:
|
|
166
|
+
|
|
167
|
+
- No memory tool: inspect the repository and state the limitation.
|
|
168
|
+
- No relevant memory: continue after the single bounded search.
|
|
169
|
+
- No playbook CLI or capability: follow the documented policy intent manually;
|
|
170
|
+
never invent a successful check or receipt.
|
|
171
|
+
- Embedding endpoint failure: supported searches fall back to deterministic
|
|
172
|
+
local substring matching.
|
|
173
|
+
- Disabled tool or feature: do not work around the operator's authority
|
|
174
|
+
boundary.
|
|
175
|
+
|
|
176
|
+
Run `cairn doctor` when the project is expected to have Cairnkeep wiring but a
|
|
177
|
+
tool, launcher, or managed asset is missing.
|
|
178
|
+
|
|
179
|
+
## Operator checklist
|
|
180
|
+
|
|
181
|
+
Before expecting an agent to use Cairnkeep:
|
|
182
|
+
|
|
183
|
+
1. Configure the project with `cairn setup` for the intended harness.
|
|
184
|
+
2. Run `cairn doctor` and review any operator-owned files reported as skipped.
|
|
185
|
+
3. Inspect the managed `AGENTS.md` block and `.ai/playbooks.json` policy.
|
|
186
|
+
4. Review the effective catalog with `cairn mcp-tools status`.
|
|
187
|
+
5. Keep durable memory concise and point it at maintained sources whenever
|
|
188
|
+
possible.
|
|
189
|
+
6. Treat runtime evidence—not instruction presence—as proof of tool use.
|
|
190
|
+
|
|
191
|
+
Continue with the [quickstart](quickstart.md), the
|
|
192
|
+
[operating guide](operating.md), and the
|
|
193
|
+
[privacy and data-flow reference](privacy-and-data-flow.md).
|
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
# Context intelligence
|
|
2
|
+
|
|
3
|
+
Cairnkeep can retrieve immutable project context progressively, measure retrieval
|
|
4
|
+
quality, record privacy-preserving usage evidence, and propose reviewed-memory
|
|
5
|
+
changes. These features keep the existing authority model: retrieval is an
|
|
6
|
+
observation; durable-memory changes require an explicit review and apply step.
|
|
7
|
+
|
|
8
|
+
## Progressive context-pack retrieval
|
|
9
|
+
|
|
10
|
+
Enable context packs for the process with `CAIRN_CONTEXT_PACKS=1`. The existing
|
|
11
|
+
`context_pack_list`, `context_pack_search`, and `context_pack_read` tools remain
|
|
12
|
+
available, and the default search remains the compatible flat, content-level
|
|
13
|
+
search. Two optional surfaces add progressive disclosure:
|
|
14
|
+
|
|
15
|
+
- `context_pack_tree` returns only enabled documents and approved skills, using
|
|
16
|
+
`abstract` or `overview` detail.
|
|
17
|
+
- `context_pack_search` accepts `strategy: "hierarchical"`,
|
|
18
|
+
`detail: "abstract" | "overview" | "content"`, and `explain: true`.
|
|
19
|
+
|
|
20
|
+
For example:
|
|
21
|
+
|
|
22
|
+
```json
|
|
23
|
+
{
|
|
24
|
+
"query": "release validation",
|
|
25
|
+
"strategy": "hierarchical",
|
|
26
|
+
"detail": "overview",
|
|
27
|
+
"explain": true,
|
|
28
|
+
"include_refs": true
|
|
29
|
+
}
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
Hierarchical search ranks pack, directory, and file summaries before reading
|
|
33
|
+
content. An exact path or title can bypass the hierarchy and select the matching
|
|
34
|
+
leaf directly. `explain` adds a bounded, sanitized decision trace. It never adds
|
|
35
|
+
hidden file content to the trace.
|
|
36
|
+
|
|
37
|
+
Abstracts and overviews are deterministic derived data. They are cached below
|
|
38
|
+
the pack base directory in `cache/context/`, outside immutable pack objects, and
|
|
39
|
+
are bound to the pack digest and exact visible-file set. `cairn doctor` validates
|
|
40
|
+
this cache and can remove invalid derived entries; it does not enable a pack or
|
|
41
|
+
approve a skill.
|
|
42
|
+
|
|
43
|
+
Visibility is unchanged: a document must belong to an enabled pack, while a
|
|
44
|
+
skill must also have a current project approval matching the pack digest, path,
|
|
45
|
+
and file digest. Updating a pack therefore invalidates its old skill approvals.
|
|
46
|
+
Pack SHA-256 digests establish integrity, not publisher authenticity.
|
|
47
|
+
|
|
48
|
+
## Retrieval benchmark
|
|
49
|
+
|
|
50
|
+
The repository includes a frozen synthetic benchmark with hierarchical files,
|
|
51
|
+
multiple versions, and a hidden skill. Positive retrieval cases report Hit@1,
|
|
52
|
+
Recall@5, and MRR; negative-only isolation cases report their count, pass rate,
|
|
53
|
+
and leaks separately. The report also covers relevant/irrelevant bytes, an
|
|
54
|
+
estimated token count, latency, network and filesystem mutations, and leakage
|
|
55
|
+
from disabled packs, unapproved skills, case-specific exclusions, or undeclared
|
|
56
|
+
result identities. Frozen substring and deterministic mock-embedding goldens
|
|
57
|
+
make regression checks offline and reproducible.
|
|
58
|
+
|
|
59
|
+
From a source checkout:
|
|
60
|
+
|
|
61
|
+
```sh
|
|
62
|
+
npm --prefix mcp-memory-server run build
|
|
63
|
+
npm --prefix mcp-memory-server run check:retrieval-benchmark
|
|
64
|
+
npm --prefix mcp-memory-server run benchmark:retrieval
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
The first command compiles the TypeScript sources. The second runs the contract
|
|
68
|
+
smoke test and checks the frozen golden. The third rebuilds and emits a current
|
|
69
|
+
report.
|
|
70
|
+
The benchmark is an engineering baseline, not a claim about every real project.
|
|
71
|
+
|
|
72
|
+
## Context-usage receipts
|
|
73
|
+
|
|
74
|
+
Search results can include stable references by setting `include_refs: true`.
|
|
75
|
+
Each result then has a `chunk_digest`, and the response has a `result_digest`.
|
|
76
|
+
With work evidence enabled, set `CAIRN_CONTEXT_USAGE=1` as the second consent
|
|
77
|
+
gate to expose the local-only `context_usage_record` MCP mutation, then record
|
|
78
|
+
whether a referenced result was used. The tool is not registered unless both
|
|
79
|
+
`CAIRN_WORK_EVIDENCE=1` and `CAIRN_CONTEXT_USAGE=1` are active:
|
|
80
|
+
|
|
81
|
+
```json
|
|
82
|
+
{
|
|
83
|
+
"task_digest": "<64-lowercase-hex-digest>",
|
|
84
|
+
"result_digest": "<64-lowercase-hex-digest>",
|
|
85
|
+
"outcome": "used"
|
|
86
|
+
}
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
`outcome` is `used`, `unused`, or `unknown`. The receipt links to the active work
|
|
90
|
+
evidence unless `evidence_id` is supplied explicitly. It stores digests and the
|
|
91
|
+
outcome, not the query, prompt, retrieved content, or model response. The tool is
|
|
92
|
+
a mutation, so the read-only MCP profile does not expose it. Receipts are strict,
|
|
93
|
+
idempotent links in the existing work-evidence store and follow its retention.
|
|
94
|
+
|
|
95
|
+
## Review-gated memory proposals
|
|
96
|
+
|
|
97
|
+
`cairn proposals` turns a stored, redacted trajectory into candidates for
|
|
98
|
+
reviewed durable memory. It never applies candidates during extraction:
|
|
99
|
+
|
|
100
|
+
```sh
|
|
101
|
+
cairn proposals create --session SESSION_ID --scope project --json
|
|
102
|
+
cairn proposals list --json
|
|
103
|
+
cairn proposals show PROPOSAL_DIGEST --json
|
|
104
|
+
cairn proposals apply PROPOSAL_DIGEST --json
|
|
105
|
+
cairn proposals doctor --json
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
`create` loads the named local trajectory, redacts it again before any configured
|
|
109
|
+
model call, and writes an immutable, digest-addressed proposal under
|
|
110
|
+
`.agentfs/memory-proposals/`. The digest binds the source, extraction, base memory,
|
|
111
|
+
and candidates. `apply` accepts that exact digest, rechecks source and base-memory
|
|
112
|
+
freshness, and then performs the reviewed-memory write atomically. A stale or
|
|
113
|
+
tampered proposal fails instead of being rebased or silently accepted.
|
|
114
|
+
|
|
115
|
+
Model extraction uses the existing `CAIRN_LLM_API_URL`, `CAIRN_LLM_API_KEY`, and
|
|
116
|
+
`CAIRN_LLM_EXTRACTION_MODEL` settings. No background hook creates or applies
|
|
117
|
+
proposals.
|
|
118
|
+
|
|
119
|
+
## Optional OpenViking retrieval provider
|
|
120
|
+
|
|
121
|
+
AnythingLLM remains the default domain-retrieval provider. OpenViking is an
|
|
122
|
+
optional, read-only adapter behind two explicit settings:
|
|
123
|
+
|
|
124
|
+
```sh
|
|
125
|
+
CAIRN_DOMAIN_RETRIEVAL_PROVIDER=openviking
|
|
126
|
+
CAIRN_OPENVIKING=1
|
|
127
|
+
CAIRN_OPENVIKING_BASE_URL=http://127.0.0.1:1933
|
|
128
|
+
# Optional:
|
|
129
|
+
CAIRN_OPENVIKING_API_KEY=...
|
|
130
|
+
CAIRN_OPENVIKING_TIMEOUT_MS=5000
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
The existing `domain_knowledge_query` tool keeps its schema. The adapter calls
|
|
134
|
+
only OpenViking's search endpoint; Cairnkeep does not import, sync, watch, delete,
|
|
135
|
+
or commit OpenViking data. Plain HTTP is accepted only for loopback hosts; other
|
|
136
|
+
hosts require HTTPS. Embedded URL credentials, redirects, oversized responses,
|
|
137
|
+
and invalid response shapes are rejected. Authenticated remote MCP deployment
|
|
138
|
+
also requires the separate `CAIRN_OPENVIKING_MCP_HTTP=1` consent flag.
|
|
139
|
+
|
|
140
|
+
OpenViking does not replace Cairnkeep. It can supply an external retrieval index;
|
|
141
|
+
Cairnkeep still owns project identity, reviewed memory, immutable context-pack
|
|
142
|
+
pins, tool authority, evidence, and approval boundaries. No OpenViking package or
|
|
143
|
+
service is required for the default Cairnkeep installation.
|
package/docs/context-packs.md
CHANGED
|
@@ -95,6 +95,39 @@ Authenticated HTTP deployments need the separate
|
|
|
95
95
|
project header. Pack digests prove integrity, not publisher authenticity.
|
|
96
96
|
Publisher signatures remain future work.
|
|
97
97
|
|
|
98
|
+
## Progressive hierarchy and stable result references
|
|
99
|
+
|
|
100
|
+
The default `context_pack_search` request remains flat content search, preserving
|
|
101
|
+
the established schema and response shape. Agents can opt into progressive
|
|
102
|
+
disclosure without changing pack contents:
|
|
103
|
+
|
|
104
|
+
```json
|
|
105
|
+
{
|
|
106
|
+
"query": "deployment rollback",
|
|
107
|
+
"strategy": "hierarchical",
|
|
108
|
+
"detail": "overview",
|
|
109
|
+
"explain": true,
|
|
110
|
+
"include_refs": true
|
|
111
|
+
}
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
`strategy` is `flat` or `hierarchical`; `detail` is `abstract`, `overview`, or
|
|
115
|
+
`content`. The optional trace is bounded and sanitized. `context_pack_tree`
|
|
116
|
+
returns the visible hierarchy at `abstract` or `overview` detail, optionally
|
|
117
|
+
limited by pack ID, `id@version`, or digest.
|
|
118
|
+
|
|
119
|
+
Summaries are deterministic derived cache entries below
|
|
120
|
+
`${CAIRN_PACK_BASE_DIR:-~/.cairnkeep/packs}/cache/context/`. They are bound to the
|
|
121
|
+
pack digest and visible-file-set digest, not stored in immutable objects, and can
|
|
122
|
+
be rebuilt without choosing an enabled version or granting approval. Search with
|
|
123
|
+
`include_refs: true` adds per-result `chunk_digest` values and a response-level
|
|
124
|
+
`result_digest` for optional usage receipts.
|
|
125
|
+
|
|
126
|
+
Only enabled documents and explicitly approved skills contribute to the tree,
|
|
127
|
+
summary cache, search results, or explanation trace. A skill approval remains
|
|
128
|
+
bound to project identity, pack digest, path, and file digest; a changed pack
|
|
129
|
+
digest cannot inherit it.
|
|
130
|
+
|
|
98
131
|
## Open Knowledge Format exchange
|
|
99
132
|
|
|
100
133
|
Use `cairn pack validate-okf` and `cairn pack import-okf` to consume OKF 0.1 or
|
package/docs/domain-knowledge.md
CHANGED
|
@@ -96,6 +96,35 @@ copy of the example JSON at the default user config path, or set
|
|
|
96
96
|
and state beside the script retain that legacy behavior. To customize the
|
|
97
97
|
implementation itself, set `CAIRN_ANYTHINGLLM_SYNC_SCRIPT` to the adapted copy.
|
|
98
98
|
|
|
99
|
+
## Retrieval providers
|
|
100
|
+
|
|
101
|
+
AnythingLLM remains the default. Selecting it explicitly is optional:
|
|
102
|
+
|
|
103
|
+
```sh
|
|
104
|
+
CAIRN_DOMAIN_RETRIEVAL_PROVIDER=anythingllm
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
OpenViking can instead back the existing read-only `domain_knowledge_query`
|
|
108
|
+
tool. It is deliberately double-gated and has no sync or write path:
|
|
109
|
+
|
|
110
|
+
```sh
|
|
111
|
+
CAIRN_DOMAIN_RETRIEVAL_PROVIDER=openviking
|
|
112
|
+
CAIRN_OPENVIKING=1
|
|
113
|
+
CAIRN_OPENVIKING_BASE_URL=http://127.0.0.1:1933
|
|
114
|
+
# CAIRN_OPENVIKING_API_KEY=...
|
|
115
|
+
# CAIRN_OPENVIKING_TIMEOUT_MS=5000
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
Plain HTTP is limited to loopback. Use HTTPS for any other host. Credentials in
|
|
119
|
+
the URL, redirects, invalid response shapes, and oversized bodies are rejected.
|
|
120
|
+
Authenticated remote MCP use requires the additional explicit consent setting
|
|
121
|
+
`CAIRN_OPENVIKING_MCP_HTTP=1`.
|
|
122
|
+
|
|
123
|
+
This adapter queries `/api/v1/search/find` only. Cairnkeep does not synchronize
|
|
124
|
+
documents into OpenViking, start its service, or adopt its session and memory
|
|
125
|
+
model. OpenViking is optional external retrieval; Cairnkeep remains the authority
|
|
126
|
+
for reviewed memory, pack pins, approvals, evidence, and MCP profiles.
|
|
127
|
+
|
|
99
128
|
## Not using RAG?
|
|
100
129
|
|
|
101
130
|
Do nothing. The tools stay inert, cost nothing, and the rest of cairnkeep is
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
# Companion tools and related projects
|
|
2
|
+
|
|
3
|
+
Cairnkeep's core memory server, project setup, wiki, and review assets run
|
|
4
|
+
without any of the tools below. Optional delegated exploration, routing, and
|
|
5
|
+
graph workflows have their own explicit companion requirements.
|
|
6
|
+
|
|
7
|
+
## Related project
|
|
8
|
+
|
|
9
|
+
- [token-miser](https://github.com/cairnkeep/token-miser) owns context
|
|
10
|
+
exploration and request routing. Cairnkeep's optional `context_explore` and
|
|
11
|
+
`route_check` MCP tools are thin, environment-gated delegates to it.
|
|
12
|
+
|
|
13
|
+
## Optional companion tools
|
|
14
|
+
|
|
15
|
+
| Tool | What it adds | Integration |
|
|
16
|
+
|---|---|---|
|
|
17
|
+
| [lean-ctx](https://github.com/yvgude/lean-ctx) | Compressed file reads, searches, shell output, and directory maps | Register it as an MCP server in the chosen harness |
|
|
18
|
+
| [token-miser](https://github.com/cairnkeep/token-miser) | Model routing and compact codebase exploration | Configure `CAIRN_ROUTE_ENDPOINT` and/or `CAIRN_EXPLORE_BINARY` |
|
|
19
|
+
| [rtk](https://github.com/rtk-ai/rtk) | Token-reduced output for common Git, npm, and Cargo commands | Install as a shell-level proxy; Cairnkeep wiring is not required |
|
|
20
|
+
|
|
21
|
+
These integrations are accelerators, not part of Cairnkeep's trust boundary or
|
|
22
|
+
runtime dependency set. Review each project's installation and data-flow
|
|
23
|
+
documentation independently before enabling it.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Curriculum Coverage Map
|
|
2
2
|
|
|
3
|
-
**Baseline:** Cairnkeep 2.
|
|
3
|
+
**Baseline:** Cairnkeep 2.17.0
|
|
4
4
|
**Last reviewed:** 2026-08-19
|
|
5
5
|
|
|
6
6
|
This map prevents the course from drifting behind the product. It assigns each
|
|
@@ -41,6 +41,7 @@ been rehearsed.
|
|
|
41
41
|
| Pi local stdio memory bridge, trusted annotation details, and explicit lifecycle | L23 | L23 | Ready; Pi 0.84.1 validated minimum |
|
|
42
42
|
| OKF 0.1/0.2 validation/import, provenance, links, regressions, and reviewed 0.2 export | L24 | L24 | Ready; local/offline by default |
|
|
43
43
|
| Bounded project playbooks, generic memory retrieval guidance, enforcement, and private receipts | L25 | L25 | Ready; balanced/local by default; invocation requires runtime evidence; actor identity unverified |
|
|
44
|
+
| Progressive pack retrieval, frozen benchmark, context-usage receipts, review-gated memory proposals, optional provider adapter | L26 | V26 | Ready; default flat search and AnythingLLM remain compatible; OpenViking and receipt mutation are explicitly gated |
|
|
44
45
|
|
|
45
46
|
## Release Review
|
|
46
47
|
|
|
@@ -85,6 +86,7 @@ against `cairn help` so a new command cannot bypass a curriculum decision.
|
|
|
85
86
|
|---|---|
|
|
86
87
|
| `cairn bootstrap` | L03 compatibility challenge |
|
|
87
88
|
| `cairn setup` | L03 for Claude/Codex; advanced Pi lifecycle in L23 |
|
|
89
|
+
| `cairn proposals` | L26 |
|
|
88
90
|
| `cairn memory-server` | L02 |
|
|
89
91
|
| `cairn sync` | L02 |
|
|
90
92
|
| `cairn sync-pi` | L13 and L23 |
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Cairnkeep feature guide
|
|
2
2
|
|
|
3
|
-
**Baseline:** Cairnkeep 2.
|
|
3
|
+
**Baseline:** Cairnkeep 2.17.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
|
|
@@ -67,7 +67,7 @@ prerequisites for ordinary memory.
|
|
|
67
67
|
| 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` |
|
|
68
68
|
| 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` |
|
|
69
69
|
| Repository quality | `/repo-review`, `/security-audit` | On-demand workflow; findings are hypotheses until reproduced | Require file/line evidence and regression tests | `course-03-quality` |
|
|
70
|
-
| Guided project setup | `cairn setup PATH
|
|
70
|
+
| Guided project setup | `cairn setup [PATH]` selectors; deterministic `--git`, `--harness`, `--memory`, and `--yes` flags | Arrow-key Git/memory choices and harness checkboxes in capable terminals; text fallback otherwise; reconciles only selected 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` |
|
|
71
71
|
| Codex project memory | Select `--harness codex --memory local` | Writes `.codex/config.toml` plus POSIX/native Windows launchers; local stdio; user-wide configuration and trust remain untouched | Review the MCP table, accept Codex project trust, run doctor, and relaunch; uninstall is backup-first | `course-01-bootstrap` |
|
|
72
72
|
| Workflow playbooks and durable-context guidance | `cairn playbook check start|check|finish`; project `minimal`, `balanced`, or `strict` policy; managed `AGENTS.md` retrieval protocol | Balanced by default; private `.ai/playbooks.json`; one task-derived project search when applicable; optional receipts in `.agentfs/playbooks/`; checks are offline and execute nothing | Verify the actual memory tool event and maintained source, inspect status/digests, enforce truthful `must` evidence, inspect receipts, reset overrides, remove only the managed `AGENTS.md` block | `course-13-playbooks` |
|
|
73
73
|
|
|
@@ -117,5 +117,24 @@ prerequisites for ordinary memory.
|
|
|
117
117
|
- Use `cairn uninstall --dry-run` before uninstall; durable memory is retained
|
|
118
118
|
unless purge is explicitly requested.
|
|
119
119
|
- Revisit the [storage guide](../storage.md) and
|
|
120
|
-
|
|
121
|
-
|
|
120
|
+
[privacy/data-flow guide](../privacy-and-data-flow.md) before enabling a new
|
|
121
|
+
network or retention path.
|
|
122
|
+
|
|
123
|
+
## Context intelligence
|
|
124
|
+
|
|
125
|
+
L26 joins five related surfaces without collapsing their authority boundaries:
|
|
126
|
+
|
|
127
|
+
- the frozen retrieval benchmark measures relevance, context cost, latency,
|
|
128
|
+
mutations, and forbidden leakage offline;
|
|
129
|
+
- context-pack trees and hierarchical summaries support progressive disclosure,
|
|
130
|
+
while omitted options retain compatible flat content search;
|
|
131
|
+
- opt-in result digests can produce content-free usage receipts linked to work
|
|
132
|
+
evidence;
|
|
133
|
+
- trajectory extraction creates an immutable proposal that must be reviewed and
|
|
134
|
+
applied by exact digest before it becomes durable memory;
|
|
135
|
+
- the OpenViking adapter is optional read-only domain retrieval, with
|
|
136
|
+
AnythingLLM still the default and Cairnkeep still owning memory and evidence.
|
|
137
|
+
|
|
138
|
+
See [L26](lessons/L26-context-intelligence.md), its
|
|
139
|
+
[video script](video-scripts/V26-context-intelligence.md), and the
|
|
140
|
+
[context-intelligence reference](../context-intelligence.md).
|
package/docs/learning/README.md
CHANGED
|
@@ -19,6 +19,9 @@ Choose the shortest track that matches your goal:
|
|
|
19
19
|
|
|
20
20
|
For a single view of every released surface, its default, storage boundary,
|
|
21
21
|
restart requirement, and rollback path, use the [feature guide](FEATURE-GUIDE.md).
|
|
22
|
+
The public [coding-agent guide](../agents.md) is the concise normative reference
|
|
23
|
+
for retrieval-first behavior, memory authority, playbooks, and graceful
|
|
24
|
+
fallback used throughout the lessons.
|
|
22
25
|
The public [course labs](https://github.com/cairnkeep/cairnkeep-course-labs)
|
|
23
26
|
provide one synthetic project with tagged checkpoints shared by lessons,
|
|
24
27
|
articles, workshops, and videos.
|
|
@@ -57,6 +60,7 @@ expanded only after their labs are executable.
|
|
|
57
60
|
| L23 | [Guided setup and Pi memory](lessons/L23-guided-setup.md) | Ready | 35 min |
|
|
58
61
|
| L24 | [Reviewed knowledge exchange](lessons/L24-okf-exchange.md) | Ready | 35 min |
|
|
59
62
|
| L25 | [Bounded workflow playbooks](lessons/L25-playbooks.md) | Ready | 35 min |
|
|
63
|
+
| L26 | [Context intelligence with explicit authority](lessons/L26-context-intelligence.md) | Ready | 45 min |
|
|
60
64
|
|
|
61
65
|
The [curriculum coverage map](CURRICULUM-MAP.md) records where every public
|
|
62
66
|
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.
|
|
6
|
+
**Tested with:** Cairnkeep 2.17.0
|
|
7
7
|
|
|
8
8
|
## Outcome
|
|
9
9
|
|
|
@@ -92,4 +92,6 @@ configuration and are taught later.
|
|
|
92
92
|
- Derived knowledge remains subordinate to canonical sources.
|
|
93
93
|
- Optional services are not prerequisites.
|
|
94
94
|
|
|
95
|
+
Reference: [Cairnkeep for coding agents](../../agents.md).
|
|
96
|
+
|
|
95
97
|
Next: [L01 - Try it safely](L01-safe-trial.md).
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
**Status:** Ready
|
|
4
4
|
**Track:** Quickstart
|
|
5
5
|
**Time:** 15 minutes
|
|
6
|
-
**Tested with:** Cairnkeep 2.
|
|
6
|
+
**Tested with:** Cairnkeep 2.17.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.
|
|
29
|
+
podman pull ghcr.io/cairnkeep/cairnkeep:2.17.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.
|
|
41
|
+
ghcr.io/cairnkeep/cairnkeep:2.17.0 stdio
|
|
42
42
|
```
|
|
43
43
|
|
|
44
44
|
3. The process waits quietly for MCP input. Press `Ctrl-C` after confirming it
|