@cairnkeep/cli 2.3.1 → 2.5.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 +85 -0
- package/README.md +232 -6
- package/bin/cairn +43 -2
- package/claude/capability-contract/hooks/capability-command-finish.sh +81 -0
- package/claude/capability-contract/hooks/capability-command-start.sh +76 -0
- package/claude/hooks/compaction-capture.sh +34 -0
- package/claude/hooks/memory-capture.sh +47 -5
- package/claude/hooks/memory-wakeup.sh +55 -2
- package/docs/building-an-overlay.md +4 -3
- package/docs/design/meta-agent.md +439 -0
- package/docs/harness-compatibility.md +117 -0
- package/docs/learning/CURRICULUM-MAP.md +91 -0
- package/docs/learning/FEATURE-GUIDE.md +86 -0
- package/docs/learning/PRODUCTION-PLAN.md +45 -14
- package/docs/learning/README.md +20 -1
- package/docs/learning/instructor-guide.md +6 -0
- package/docs/learning/lessons/L00-why-cairnkeep.md +20 -8
- package/docs/learning/lessons/L01-safe-trial.md +3 -3
- package/docs/learning/lessons/L02-installation.md +23 -5
- package/docs/learning/lessons/L03-first-project.md +7 -2
- package/docs/learning/lessons/L04-memory-fundamentals.md +4 -0
- package/docs/learning/lessons/L05-daily-workflow.md +4 -0
- package/docs/learning/lessons/L07-privacy-and-storage.md +3 -0
- package/docs/learning/lessons/L10-context-exploration.md +4 -2
- package/docs/learning/lessons/L12-managed-overlays.md +2 -0
- package/docs/learning/lessons/L13-session-evidence.md +71 -0
- package/docs/learning/lessons/L14-typed-memory.md +51 -0
- package/docs/learning/lessons/L15-capability-governance.md +56 -0
- package/docs/learning/lessons/L16-evaluation.md +67 -0
- package/docs/learning/lessons/L17-agent-boundary.md +55 -0
- package/docs/learning/templates/lesson-template.md +4 -1
- package/docs/learning/tracks/evidence-and-evaluation.md +20 -0
- package/docs/learning/tracks/operator.md +8 -2
- package/docs/learning/tracks/practitioner.md +6 -1
- package/docs/learning/tracks/quickstart.md +3 -0
- package/docs/learning/video-scripts/L00-why-cairnkeep.md +21 -17
- package/docs/learning/video-scripts/L02-installation.md +9 -2
- package/docs/learning/video-scripts/L03-first-project.md +3 -0
- package/docs/operating.md +567 -7
- package/docs/privacy-and-data-flow.md +417 -0
- package/docs/storage.md +252 -0
- package/examples/eval/README.md +42 -0
- package/examples/eval/adapter.json +12 -0
- package/examples/eval/bundled-fake.json +1 -0
- package/examples/eval/task-set.json +1 -0
- package/mcp-memory-server/dist/artifact-cli.js +184 -0
- package/mcp-memory-server/dist/artifact-schema.js +218 -0
- package/mcp-memory-server/dist/artifact-store.js +812 -0
- package/mcp-memory-server/dist/capability-adapter.js +286 -0
- package/mcp-memory-server/dist/capability-cli.js +361 -0
- package/mcp-memory-server/dist/capability-config.js +310 -0
- package/mcp-memory-server/dist/capability-harness.js +496 -0
- package/mcp-memory-server/dist/capability-registry.js +123 -0
- package/mcp-memory-server/dist/capability-schema.js +65 -0
- package/mcp-memory-server/dist/capability-store.js +431 -0
- package/mcp-memory-server/dist/compaction-normalize.js +267 -0
- package/mcp-memory-server/dist/eval-cli.js +523 -0
- package/mcp-memory-server/dist/eval-plan.js +346 -0
- package/mcp-memory-server/dist/eval-process.js +273 -0
- package/mcp-memory-server/dist/eval-report.js +609 -0
- package/mcp-memory-server/dist/eval-runner.js +827 -0
- package/mcp-memory-server/dist/eval-schema.js +368 -0
- package/mcp-memory-server/dist/eval-statistics.js +161 -0
- package/mcp-memory-server/dist/eval-workspace.js +313 -0
- package/mcp-memory-server/dist/failure-signature.js +141 -0
- package/mcp-memory-server/dist/index.js +600 -55
- package/mcp-memory-server/dist/node-cli.js +84 -0
- package/mcp-memory-server/dist/node-schema.js +170 -0
- package/mcp-memory-server/dist/node-store.js +455 -0
- package/mcp-memory-server/dist/note-cli.js +235 -0
- package/mcp-memory-server/dist/note-distiller.js +177 -0
- package/mcp-memory-server/dist/note-enrichment.js +93 -0
- package/mcp-memory-server/dist/note-schema.js +4 -0
- package/mcp-memory-server/dist/note-store.js +985 -0
- package/mcp-memory-server/dist/trajectory-cli.js +141 -0
- package/mcp-memory-server/dist/trajectory-normalize.js +448 -0
- package/mcp-memory-server/dist/trajectory-redaction.js +155 -0
- package/mcp-memory-server/dist/trajectory-schema.js +73 -0
- package/mcp-memory-server/dist/trajectory-store.js +339 -0
- package/mcp-memory-server/package.json +24 -2
- package/mcp-memory-server/scripts/fixtures/compaction-claude-code-2.1.219.json +9 -0
- package/mcp-memory-server/scripts/fixtures/compaction-claude-code-2.1.220.json +9 -0
- package/mcp-memory-server/scripts/fixtures/compaction-opencode-1.17.20-event.json +6 -0
- package/mcp-memory-server/scripts/fixtures/compaction-opencode-1.17.20-messages.json +119 -0
- package/mcp-memory-server/scripts/fixtures/compaction-unknown-version.json +17 -0
- package/opencode/capability-contract/plugins/capability-command.ts +319 -0
- package/opencode/command/graphify.md +25 -14
- package/opencode/plugins/memory-capture.ts +76 -10
- package/opencode/plugins/memory-wakeup.ts +58 -6
- package/package.json +8 -4
- package/pi/extensions/cairnkeep-trajectory.ts +55 -0
- package/schemas/artifact.schema.json +133 -0
- package/schemas/capability-callback.schema.json +68 -0
- package/schemas/capability-contract.schema.json +126 -0
- package/schemas/eval-adapter.schema.json +43 -0
- package/schemas/eval-protocol.schema.json +114 -0
- package/schemas/eval-report.schema.json +423 -0
- package/schemas/eval-task-set.schema.json +114 -0
- package/schemas/memory-node.schema.json +90 -0
- package/schemas/note.schema.json +112 -0
- package/schemas/trajectory-redaction.schema.json +25 -0
- package/schemas/trajectory.schema.json +82 -0
- package/scripts/bootstrap.sh +6 -0
- package/scripts/completion.sh +119 -5
- package/scripts/doctor.sh +284 -0
- package/scripts/fake-eval-adapter.mjs +120 -0
- package/scripts/fixtures/capability-harness-contracts.json +408 -0
- package/scripts/install-audit-timer.sh +3 -1
- package/scripts/lib/capability-opencode-plugin-harness.mjs +291 -0
- package/scripts/lib/trajectory-opencode-plugin-harness.mjs +25 -0
- package/scripts/lib/trajectory-pi-extension-harness.mjs +42 -0
- package/scripts/memory-wiki-audit.sh +49 -0
- package/scripts/smoke-bash32.sh +9 -0
- package/scripts/sync-claude-assets.sh +99 -6
- package/scripts/sync-opencode-graphify-assets.sh +24 -3
- package/scripts/sync-opencode-plugin-assets.sh +31 -5
- package/scripts/sync-opencode-security-assets.sh +24 -3
- package/scripts/sync-opencode-wiki-assets.sh +24 -3
- package/scripts/sync-pi-assets.sh +72 -0
- package/scripts/test-audit-timer.sh +98 -0
- package/scripts/test-bootstrap-untracked.sh +49 -0
- package/scripts/test-cli-dispatch.sh +41 -2
- package/scripts/test-compaction-hooks.sh +495 -0
- package/scripts/test-completion.sh +77 -0
- package/scripts/test-doctor.sh +348 -1
- package/scripts/test-eval-cli.sh +175 -0
- package/scripts/test-launcher-hooks.sh +630 -3
- package/scripts/test-learning-docs.sh +20 -4
- package/scripts/test-notes-cli.sh +114 -0
- package/scripts/test-package-install.sh +254 -0
- package/scripts/test-phase16-node-lifecycle.sh +50 -0
- package/scripts/test-phase17-artifact-lifecycle.sh +370 -0
- package/scripts/test-phase18-capability-lifecycle.sh +504 -0
- package/scripts/test-phase18-harness-boundary.sh +1060 -0
- package/scripts/test-phase19-eval-lifecycle.sh +1015 -0
- package/scripts/test-trajectory-cli.sh +87 -0
- package/scripts/test-trajectory-hooks.sh +142 -0
- package/scripts/test-uninstall.sh +231 -5
- package/scripts/uninstall.sh +38 -5
- package/scripts/verify-dependency-security.mjs +121 -0
- package/scripts/verify-docs-parity.sh +527 -1
- package/scripts/verify-phase18-runtime-evidence.mjs +895 -0
- package/scripts/verify-phase19-runtime-evidence.mjs +947 -0
- package/templates/capabilities.json.template +7 -0
- package/templates/env.example.template +51 -0
- package/templates/memory-wiki-audit.service.template +1 -1
- package/templates/start-claude.sh.template +36 -0
- package/templates/start-kimi.sh.template +39 -0
- package/templates/start-opencode.sh.template +47 -5
- package/templates/start-pi.sh.template +30 -0
- package/templates/trajectory-redaction.json.template +4 -0
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
|
+
"$id": "https://raw.githubusercontent.com/cairnkeep/cairnkeep/main/schemas/note.schema.json",
|
|
4
|
+
"title": "Cairnkeep note node",
|
|
5
|
+
"type": "object",
|
|
6
|
+
"additionalProperties": false,
|
|
7
|
+
"required": [
|
|
8
|
+
"schema_version",
|
|
9
|
+
"id",
|
|
10
|
+
"title",
|
|
11
|
+
"description",
|
|
12
|
+
"keywords",
|
|
13
|
+
"node_type",
|
|
14
|
+
"tags",
|
|
15
|
+
"occurrences",
|
|
16
|
+
"created_at",
|
|
17
|
+
"updated_at"
|
|
18
|
+
],
|
|
19
|
+
"properties": {
|
|
20
|
+
"schema_version": { "const": 1 },
|
|
21
|
+
"id": { "type": "string", "pattern": "^[a-z0-9][a-z0-9._-]{0,255}$" },
|
|
22
|
+
"title": { "type": "string", "minLength": 1, "maxLength": 512 },
|
|
23
|
+
"description": { "type": "string", "minLength": 1, "maxLength": 4096 },
|
|
24
|
+
"keywords": { "type": "array", "items": { "type": "string", "minLength": 1, "maxLength": 128 }, "uniqueItems": true, "maxItems": 64 },
|
|
25
|
+
"node_type": { "enum": ["hindsight", "knowledge", "shared", "provenance"] },
|
|
26
|
+
"tags": { "type": "array", "items": { "type": "string", "minLength": 1, "maxLength": 128 }, "uniqueItems": true, "maxItems": 64 },
|
|
27
|
+
"project_id": { "type": "string", "pattern": "^[a-z0-9][a-z0-9._-]{0,255}$" },
|
|
28
|
+
"canonical_id": { "type": "string", "pattern": "^[a-z0-9][a-z0-9._-]{0,255}$" },
|
|
29
|
+
"status": { "enum": ["unresolved", "resolved", "abandoned"] },
|
|
30
|
+
"signature": { "$ref": "#/$defs/signature" },
|
|
31
|
+
"enrichment": { "$ref": "#/$defs/enrichment" },
|
|
32
|
+
"occurrences": { "type": "array", "items": { "$ref": "#/$defs/occurrence" }, "maxItems": 1024 },
|
|
33
|
+
"created_at": { "type": "string", "format": "date-time" },
|
|
34
|
+
"updated_at": { "type": "string", "format": "date-time" }
|
|
35
|
+
},
|
|
36
|
+
"allOf": [
|
|
37
|
+
{
|
|
38
|
+
"if": { "properties": { "node_type": { "enum": ["hindsight", "provenance"] } }, "required": ["node_type"] },
|
|
39
|
+
"then": { "required": ["project_id", "status", "signature"] }
|
|
40
|
+
},
|
|
41
|
+
{
|
|
42
|
+
"if": { "properties": { "node_type": { "const": "provenance" } }, "required": ["node_type"] },
|
|
43
|
+
"then": { "required": ["canonical_id"] }
|
|
44
|
+
},
|
|
45
|
+
{
|
|
46
|
+
"if": { "properties": { "node_type": { "const": "shared" } }, "required": ["node_type"] },
|
|
47
|
+
"then": { "required": ["status", "signature"] }
|
|
48
|
+
}
|
|
49
|
+
],
|
|
50
|
+
"$defs": {
|
|
51
|
+
"enrichment": {
|
|
52
|
+
"type": "object",
|
|
53
|
+
"additionalProperties": false,
|
|
54
|
+
"required": ["summary", "lessons", "caveats"],
|
|
55
|
+
"properties": {
|
|
56
|
+
"summary": { "type": "string", "minLength": 1, "maxLength": 4096 },
|
|
57
|
+
"lessons": { "type": "array", "items": { "type": "string", "minLength": 1, "maxLength": 1024 }, "maxItems": 16 },
|
|
58
|
+
"caveats": { "type": "array", "items": { "type": "string", "minLength": 1, "maxLength": 1024 }, "maxItems": 16 }
|
|
59
|
+
}
|
|
60
|
+
},
|
|
61
|
+
"frame": {
|
|
62
|
+
"type": "object",
|
|
63
|
+
"additionalProperties": false,
|
|
64
|
+
"required": ["function", "file"],
|
|
65
|
+
"properties": {
|
|
66
|
+
"function": { "type": "string", "minLength": 1, "maxLength": 512 },
|
|
67
|
+
"file": { "type": "string", "minLength": 1, "maxLength": 1024 }
|
|
68
|
+
}
|
|
69
|
+
},
|
|
70
|
+
"lookupKeys": {
|
|
71
|
+
"type": "object",
|
|
72
|
+
"additionalProperties": false,
|
|
73
|
+
"required": ["full", "message_stack", "message_component", "message"],
|
|
74
|
+
"properties": {
|
|
75
|
+
"full": { "type": "string", "pattern": "^v1:full:[a-f0-9]{64}$" },
|
|
76
|
+
"message_stack": { "type": "string", "pattern": "^v1:message-stack:[a-f0-9]{64}$" },
|
|
77
|
+
"message_component": { "type": "string", "pattern": "^v1:message-component:[a-f0-9]{64}$" },
|
|
78
|
+
"message": { "type": "string", "pattern": "^v1:message:[a-f0-9]{64}$" }
|
|
79
|
+
}
|
|
80
|
+
},
|
|
81
|
+
"signature": {
|
|
82
|
+
"type": "object",
|
|
83
|
+
"additionalProperties": false,
|
|
84
|
+
"required": ["signature_version", "family", "normalized_message", "stack_digest", "component", "frames", "lookup_keys", "fingerprint"],
|
|
85
|
+
"properties": {
|
|
86
|
+
"signature_version": { "const": 1 },
|
|
87
|
+
"family": { "type": "string", "pattern": "^[a-z0-9][a-z0-9-]{0,127}$" },
|
|
88
|
+
"normalized_message": { "type": "string", "minLength": 1, "maxLength": 4096 },
|
|
89
|
+
"stack_digest": { "type": "string", "pattern": "^(?:|[a-f0-9]{64})$" },
|
|
90
|
+
"component": { "type": "string", "maxLength": 1024 },
|
|
91
|
+
"frames": { "type": "array", "items": { "$ref": "#/$defs/frame" }, "maxItems": 16 },
|
|
92
|
+
"lookup_keys": { "$ref": "#/$defs/lookupKeys" },
|
|
93
|
+
"fingerprint": { "type": "string", "pattern": "^[a-f0-9]{64}$" }
|
|
94
|
+
}
|
|
95
|
+
},
|
|
96
|
+
"occurrence": {
|
|
97
|
+
"type": "object",
|
|
98
|
+
"additionalProperties": false,
|
|
99
|
+
"required": ["session_id", "session_digest", "ended_at", "sequence", "outcome", "evidence"],
|
|
100
|
+
"properties": {
|
|
101
|
+
"session_id": { "type": "string", "minLength": 1, "maxLength": 256 },
|
|
102
|
+
"session_digest": { "type": "string", "pattern": "^[a-f0-9]{64}$" },
|
|
103
|
+
"ended_at": { "type": "string", "format": "date-time" },
|
|
104
|
+
"sequence": { "type": "integer", "minimum": 0 },
|
|
105
|
+
"outcome": { "enum": ["failure", "resolution", "abandonment"] },
|
|
106
|
+
"tool_name": { "type": "string", "minLength": 1, "maxLength": 256 },
|
|
107
|
+
"validation_key": { "type": "string", "pattern": "^[a-f0-9]{64}$" },
|
|
108
|
+
"evidence": { "type": "string", "minLength": 1, "maxLength": 4096 }
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
|
+
"$id": "https://raw.githubusercontent.com/cairnkeep/cairnkeep/main/schemas/trajectory-redaction.schema.json",
|
|
4
|
+
"title": "Cairnkeep trajectory redaction configuration",
|
|
5
|
+
"type": "object",
|
|
6
|
+
"additionalProperties": false,
|
|
7
|
+
"required": ["version", "patterns"],
|
|
8
|
+
"properties": {
|
|
9
|
+
"version": { "const": 1 },
|
|
10
|
+
"patterns": {
|
|
11
|
+
"type": "array",
|
|
12
|
+
"maxItems": 32,
|
|
13
|
+
"items": {
|
|
14
|
+
"type": "object",
|
|
15
|
+
"additionalProperties": false,
|
|
16
|
+
"required": ["pattern"],
|
|
17
|
+
"properties": {
|
|
18
|
+
"pattern": { "type": "string", "minLength": 1, "maxLength": 256 },
|
|
19
|
+
"flags": { "type": "string", "pattern": "^[gimsu]*$" },
|
|
20
|
+
"replacement": { "type": "string", "maxLength": 128 }
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
}
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
|
+
"$id": "https://raw.githubusercontent.com/cairnkeep/cairnkeep/main/schemas/trajectory.schema.json",
|
|
4
|
+
"title": "Cairnkeep trajectory session",
|
|
5
|
+
"type": "object",
|
|
6
|
+
"additionalProperties": false,
|
|
7
|
+
"required": [
|
|
8
|
+
"schema_version",
|
|
9
|
+
"session_id",
|
|
10
|
+
"harness",
|
|
11
|
+
"project_root",
|
|
12
|
+
"started_at",
|
|
13
|
+
"ended_at",
|
|
14
|
+
"events",
|
|
15
|
+
"capture"
|
|
16
|
+
],
|
|
17
|
+
"properties": {
|
|
18
|
+
"schema_version": { "const": 1 },
|
|
19
|
+
"session_id": { "type": "string", "pattern": "^[A-Za-z0-9][A-Za-z0-9._:-]{0,255}$" },
|
|
20
|
+
"harness": { "enum": ["claude-code", "opencode", "pi"] },
|
|
21
|
+
"project_root": { "type": "string", "minLength": 1 },
|
|
22
|
+
"started_at": { "type": "string", "format": "date-time" },
|
|
23
|
+
"ended_at": { "type": "string", "format": "date-time" },
|
|
24
|
+
"usage": { "$ref": "#/$defs/usage" },
|
|
25
|
+
"events": {
|
|
26
|
+
"type": "array",
|
|
27
|
+
"items": { "$ref": "#/$defs/event" }
|
|
28
|
+
},
|
|
29
|
+
"capture": {
|
|
30
|
+
"type": "object",
|
|
31
|
+
"additionalProperties": false,
|
|
32
|
+
"required": ["captured_at", "omitted_reasoning_blocks", "omitted_unknown_records", "truncated"],
|
|
33
|
+
"properties": {
|
|
34
|
+
"captured_at": { "type": "string", "format": "date-time" },
|
|
35
|
+
"omitted_reasoning_blocks": { "type": "integer", "minimum": 0 },
|
|
36
|
+
"omitted_unknown_records": { "type": "integer", "minimum": 0 },
|
|
37
|
+
"omitted_size_events": { "type": "integer", "minimum": 0 },
|
|
38
|
+
"truncated": { "type": "boolean" },
|
|
39
|
+
"original_bytes": { "type": "integer", "minimum": 0 },
|
|
40
|
+
"stored_bytes": { "type": "integer", "minimum": 0 }
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
},
|
|
44
|
+
"$defs": {
|
|
45
|
+
"usage": {
|
|
46
|
+
"type": "object",
|
|
47
|
+
"additionalProperties": false,
|
|
48
|
+
"properties": {
|
|
49
|
+
"input_tokens": { "type": "number", "minimum": 0 },
|
|
50
|
+
"output_tokens": { "type": "number", "minimum": 0 },
|
|
51
|
+
"reasoning_tokens": { "type": "number", "minimum": 0 },
|
|
52
|
+
"cache_read_tokens": { "type": "number", "minimum": 0 },
|
|
53
|
+
"cache_write_tokens": { "type": "number", "minimum": 0 },
|
|
54
|
+
"cost": { "type": "number", "minimum": 0 }
|
|
55
|
+
}
|
|
56
|
+
},
|
|
57
|
+
"event": {
|
|
58
|
+
"type": "object",
|
|
59
|
+
"additionalProperties": false,
|
|
60
|
+
"required": ["sequence", "kind", "payload"],
|
|
61
|
+
"properties": {
|
|
62
|
+
"sequence": { "type": "integer", "minimum": 0 },
|
|
63
|
+
"kind": {
|
|
64
|
+
"enum": ["user_message", "model_output", "tool_invocation", "tool_result", "system_event", "usage"]
|
|
65
|
+
},
|
|
66
|
+
"timestamp": { "type": "string", "format": "date-time" },
|
|
67
|
+
"native_id": { "type": "string" },
|
|
68
|
+
"parent_id": { "type": "string" },
|
|
69
|
+
"payload": { "type": "object" },
|
|
70
|
+
"truncation": {
|
|
71
|
+
"type": "object",
|
|
72
|
+
"additionalProperties": false,
|
|
73
|
+
"required": ["original_bytes", "stored_bytes"],
|
|
74
|
+
"properties": {
|
|
75
|
+
"original_bytes": { "type": "integer", "minimum": 0 },
|
|
76
|
+
"stored_bytes": { "type": "integer", "minimum": 0 }
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
}
|
package/scripts/bootstrap.sh
CHANGED
|
@@ -55,7 +55,11 @@ install_file() {
|
|
|
55
55
|
# .ai/ launchers + env
|
|
56
56
|
install_file "$TPL/start-claude.sh.template" "$target/.ai/start-claude.sh" 0755
|
|
57
57
|
install_file "$TPL/start-opencode.sh.template" "$target/.ai/start-opencode.sh" 0755
|
|
58
|
+
install_file "$TPL/start-pi.sh.template" "$target/.ai/start-pi.sh" 0755
|
|
59
|
+
install_file "$TPL/start-kimi.sh.template" "$target/.ai/start-kimi.sh" 0755
|
|
58
60
|
install_file "$TPL/env.example.template" "$target/.ai/env.example" 0644
|
|
61
|
+
install_file "$TPL/trajectory-redaction.json.template" "$target/.ai/trajectory-redaction.json" 0644
|
|
62
|
+
install_file "$TPL/capabilities.json.template" "$target/.ai/capabilities.json" 0600
|
|
59
63
|
|
|
60
64
|
# Project-scope memory is private runtime data. Keep it out of version control
|
|
61
65
|
# even before the first .agentfs/project.db is created.
|
|
@@ -99,5 +103,7 @@ echo "Next steps (full guide: docs/operating.md):"
|
|
|
99
103
|
echo " 1. cp .ai/env.example .ai/.env and edit"
|
|
100
104
|
echo " 2. Register the memory server: claude mcp add cairn-memory -s user -- cairn memory-server"
|
|
101
105
|
echo " 3. Install the operating layer (commands/agents/hooks): cairn sync --apply"
|
|
106
|
+
echo " For Pi trajectory capture, also run: cairn sync-pi --apply"
|
|
102
107
|
echo " From a source clone, use bin/cairn in place of cairn."
|
|
103
108
|
echo " 4. Launch: $target/.ai/start-claude.sh"
|
|
109
|
+
echo " Kimi memory-client launch: $target/.ai/start-kimi.sh"
|
package/scripts/completion.sh
CHANGED
|
@@ -11,7 +11,7 @@ _cairn_complete() {
|
|
|
11
11
|
COMPREPLY=()
|
|
12
12
|
current=${COMP_WORDS[COMP_CWORD]}
|
|
13
13
|
previous=${COMP_WORDS[COMP_CWORD-1]:-}
|
|
14
|
-
commands="bootstrap memory-server sync doctor memory audit-timer uninstall completion version help"
|
|
14
|
+
commands="bootstrap memory-server sync sync-pi doctor trajectory artifact capabilities notes eval memory audit-timer uninstall completion version help"
|
|
15
15
|
if (( COMP_CWORD == 1 )); then
|
|
16
16
|
COMPREPLY=( $(compgen -W "$commands" -- "$current") )
|
|
17
17
|
return
|
|
@@ -19,9 +19,52 @@ _cairn_complete() {
|
|
|
19
19
|
case "${COMP_WORDS[1]}" in
|
|
20
20
|
bootstrap) COMPREPLY=( $(compgen -W "--untracked" -- "$current") ) ;;
|
|
21
21
|
sync) COMPREPLY=( $(compgen -W "--apply --live-root" -- "$current") ) ;;
|
|
22
|
+
sync-pi) COMPREPLY=( $(compgen -W "--apply --live-root" -- "$current") ) ;;
|
|
23
|
+
doctor) COMPREPLY=( $(compgen -W "--repair" -- "$current") ) ;;
|
|
24
|
+
trajectory) COMPREPLY=( $(compgen -W "list show prune --json --dry-run" -- "$current") ) ;;
|
|
25
|
+
artifact) COMPREPLY=( $(compgen -W "list show delete prune --kind --session --json --dry-run --include-protected" -- "$current") ) ;;
|
|
26
|
+
capabilities)
|
|
27
|
+
case "${COMP_WORDS[2]:-}" in
|
|
28
|
+
enable|disable)
|
|
29
|
+
if (( COMP_CWORD == 3 )); then
|
|
30
|
+
COMPREPLY=( $(compgen -W "memory.write memory.search notes.distill wiki graph security.audit route.check context.explore" -- "$current") )
|
|
31
|
+
else
|
|
32
|
+
COMPREPLY=( $(compgen -W "--json" -- "$current") )
|
|
33
|
+
fi
|
|
34
|
+
;;
|
|
35
|
+
reset)
|
|
36
|
+
if (( COMP_CWORD == 3 )); then
|
|
37
|
+
COMPREPLY=( $(compgen -W "memory.write memory.search notes.distill wiki graph security.audit route.check context.explore --all" -- "$current") )
|
|
38
|
+
else
|
|
39
|
+
COMPREPLY=( $(compgen -W "--json" -- "$current") )
|
|
40
|
+
fi
|
|
41
|
+
;;
|
|
42
|
+
logging)
|
|
43
|
+
if (( COMP_CWORD == 3 )); then
|
|
44
|
+
COMPREPLY=( $(compgen -W "enable disable reset" -- "$current") )
|
|
45
|
+
else
|
|
46
|
+
COMPREPLY=( $(compgen -W "--json" -- "$current") )
|
|
47
|
+
fi
|
|
48
|
+
;;
|
|
49
|
+
list|status) COMPREPLY=( $(compgen -W "--json" -- "$current") ) ;;
|
|
50
|
+
*) COMPREPLY=( $(compgen -W "list status enable disable reset logging" -- "$current") ) ;;
|
|
51
|
+
esac
|
|
52
|
+
;;
|
|
53
|
+
notes) COMPREPLY=( $(compgen -W "distill search-error promote doctor --project --session --all-projects --para-root --text --component --with --confirm --repair --json" -- "$current") ) ;;
|
|
54
|
+
eval)
|
|
55
|
+
case "${COMP_WORDS[2]:-}" in
|
|
56
|
+
validate) COMPREPLY=( $(compgen -W "--task-set --adapter --output --repetitions --seed --json" -- "$current") ) ;;
|
|
57
|
+
run) COMPREPLY=( $(compgen -W "--task-set --adapter --output --repetitions --seed --yes --json" -- "$current") ) ;;
|
|
58
|
+
ablate) COMPREPLY=( $(compgen -W "--disable --task-set --adapter --output --repetitions --seed --yes --json memory.write memory.search notes.distill wiki graph security.audit route.check context.explore" -- "$current") ) ;;
|
|
59
|
+
report) COMPREPLY=( $(compgen -W "--experiment --json" -- "$current") ) ;;
|
|
60
|
+
prune) COMPREPLY=( $(compgen -W "--older-than-days --dry-run --json" -- "$current") ) ;;
|
|
61
|
+
delete) COMPREPLY=( $(compgen -W "--experiment --dry-run --json" -- "$current") ) ;;
|
|
62
|
+
*) COMPREPLY=( $(compgen -W "validate run ablate report prune delete" -- "$current") ) ;;
|
|
63
|
+
esac
|
|
64
|
+
;;
|
|
22
65
|
memory) COMPREPLY=( $(compgen -W "path export import" -- "$current") ) ;;
|
|
23
66
|
audit-timer) COMPREPLY=( $(compgen -W "--on-calendar --para-root --render-only" -- "$current") ) ;;
|
|
24
|
-
uninstall) COMPREPLY=( $(compgen -W "--dry-run --yes --purge-memory --live-root" -- "$current") ) ;;
|
|
67
|
+
uninstall) COMPREPLY=( $(compgen -W "--dry-run --yes --purge-memory --live-root --pi-live-root" -- "$current") ) ;;
|
|
25
68
|
completion) COMPREPLY=( $(compgen -W "bash zsh fish" -- "$current") ) ;;
|
|
26
69
|
esac
|
|
27
70
|
}
|
|
@@ -37,7 +80,13 @@ _cairn() {
|
|
|
37
80
|
'bootstrap:scaffold a project'
|
|
38
81
|
'memory-server:run the memory MCP server'
|
|
39
82
|
'sync:install the Claude operating layer'
|
|
83
|
+
'sync-pi:install the Pi trajectory extension'
|
|
40
84
|
'doctor:check runtime dependencies and endpoints'
|
|
85
|
+
'trajectory:inspect and prune local session trajectories'
|
|
86
|
+
'artifact:inspect, delete, and prune local artifacts'
|
|
87
|
+
'capabilities:inspect and manage project capability state'
|
|
88
|
+
'notes:distill and search local hindsight notes'
|
|
89
|
+
'eval:run and inspect default-off local evaluations'
|
|
41
90
|
'memory:manage the durable memory store'
|
|
42
91
|
'audit-timer:install a memory and wiki audit timer'
|
|
43
92
|
'uninstall:remove installed Cairnkeep components safely'
|
|
@@ -52,9 +101,42 @@ _cairn() {
|
|
|
52
101
|
case $words[2] in
|
|
53
102
|
bootstrap) _arguments '--untracked[keep scaffold out of Git]' '*:project directory:_files -/' ;;
|
|
54
103
|
sync) _arguments '--apply[apply changes]' '--live-root[project Claude root]:directory:_files -/' ;;
|
|
104
|
+
sync-pi) _arguments '--apply[apply changes]' '--live-root[Pi agent root]:directory:_files -/' ;;
|
|
105
|
+
doctor) _arguments '--repair[repair trajectory metadata and indexes]' ;;
|
|
106
|
+
trajectory) _values 'trajectory command' list show prune ;;
|
|
107
|
+
artifact)
|
|
108
|
+
case $words[3] in
|
|
109
|
+
list) _arguments '--kind[filter by exact artifact kind]:kind:(compaction_summary diff test_output generated_file)' '--session[filter by exact session reference]:session:' '--json[emit JSON]' ;;
|
|
110
|
+
show) _arguments '1:artifact ID or prefix:' '--json[emit JSON]' ;;
|
|
111
|
+
delete) _arguments '1:artifact ID or prefix:' '--dry-run[report without deleting]' '--json[emit JSON]' ;;
|
|
112
|
+
prune) _arguments '--dry-run[report without pruning]' '--include-protected[allow removal of the newest valid project compaction]' '--json[emit JSON]' ;;
|
|
113
|
+
*) _values 'artifact command' list show delete prune ;;
|
|
114
|
+
esac
|
|
115
|
+
;;
|
|
116
|
+
capabilities)
|
|
117
|
+
case $words[3] in
|
|
118
|
+
list|status) _arguments '--json[emit JSON]' ;;
|
|
119
|
+
enable|disable) _arguments '1:capability ID:(memory.write memory.search notes.distill wiki graph security.audit route.check context.explore)' '--json[emit JSON]' ;;
|
|
120
|
+
reset) _arguments '1:capability ID:(memory.write memory.search notes.distill wiki graph security.audit route.check context.explore)' '--all[reset every override]' '--json[emit JSON]' ;;
|
|
121
|
+
logging) _values 'logging operation' enable disable reset '--json[emit JSON]' ;;
|
|
122
|
+
*) _values 'capability command' list status enable disable reset logging ;;
|
|
123
|
+
esac
|
|
124
|
+
;;
|
|
125
|
+
notes) _values 'notes command' distill search-error promote doctor ;;
|
|
126
|
+
eval)
|
|
127
|
+
case $words[3] in
|
|
128
|
+
validate) _arguments '--task-set[task-set manifest]:file:_files' '--adapter[adapter configuration]:file:_files' '--output[local output root]:directory:_files -/' '--repetitions[repetition count]:count:' '--seed[deterministic seed]:seed:' '--json[emit JSON]' ;;
|
|
129
|
+
run) _arguments '--task-set[task-set manifest]:file:_files' '--adapter[adapter configuration]:file:_files' '--output[local output root]:directory:_files -/' '--repetitions[repetition count]:count:' '--seed[deterministic seed]:seed:' '--yes[confirm execution]' '--json[emit JSON]' ;;
|
|
130
|
+
ablate) _arguments '--disable[capability to disable]:capability ID:(memory.write memory.search notes.distill wiki graph security.audit route.check context.explore)' '--task-set[task-set manifest]:file:_files' '--adapter[adapter configuration]:file:_files' '--output[local output root]:directory:_files -/' '--repetitions[repetition count]:count:' '--seed[deterministic seed]:seed:' '--yes[confirm execution]' '--json[emit JSON]' ;;
|
|
131
|
+
report) _arguments '--experiment[experiment ID]:experiment ID:' '--json[emit JSON]' ;;
|
|
132
|
+
prune) _arguments '--older-than-days[retention age]:days:' '--dry-run[report without pruning]' '--json[emit JSON]' ;;
|
|
133
|
+
delete) _arguments '--experiment[experiment ID]:experiment ID:' '--dry-run[report without deleting]' '--json[emit JSON]' ;;
|
|
134
|
+
*) _values 'eval command' validate run ablate report prune delete ;;
|
|
135
|
+
esac
|
|
136
|
+
;;
|
|
55
137
|
memory) _values 'memory command' path export import ;;
|
|
56
138
|
audit-timer) _arguments '--on-calendar[systemd calendar]:calendar:' '--para-root[PARA root]:directory:_files -/' '--render-only[render directory]:directory:_files -/' ;;
|
|
57
|
-
uninstall) _arguments '--dry-run[show changes]' '--yes[skip confirmation]' '--purge-memory[delete memory]' '--live-root[project Claude root]:directory:_files -/' '*:project directory:_files -/' ;;
|
|
139
|
+
uninstall) _arguments '--dry-run[show changes]' '--yes[skip confirmation]' '--purge-memory[delete memory]' '--live-root[project Claude root]:directory:_files -/' '--pi-live-root[Pi agent root]:directory:_files -/' '*:project directory:_files -/' ;;
|
|
58
140
|
completion) _values 'shell' bash zsh fish ;;
|
|
59
141
|
*) _arguments '*:argument:_files' ;;
|
|
60
142
|
esac
|
|
@@ -65,12 +147,44 @@ EOF
|
|
|
65
147
|
fish)
|
|
66
148
|
cat <<'EOF'
|
|
67
149
|
complete -c cairn -f
|
|
68
|
-
for command in bootstrap memory-server sync doctor memory audit-timer uninstall completion version help
|
|
69
|
-
complete -c cairn -n "not __fish_seen_subcommand_from bootstrap memory-server sync doctor memory audit-timer uninstall completion version help" -a $command
|
|
150
|
+
for command in bootstrap memory-server sync sync-pi doctor trajectory artifact capabilities notes eval memory audit-timer uninstall completion version help
|
|
151
|
+
complete -c cairn -n "not __fish_seen_subcommand_from bootstrap memory-server sync sync-pi doctor trajectory artifact capabilities notes eval memory audit-timer uninstall completion version help" -a $command
|
|
70
152
|
end
|
|
153
|
+
complete -c cairn -n "__fish_seen_subcommand_from sync" -l apply
|
|
154
|
+
complete -c cairn -n "__fish_seen_subcommand_from sync" -l live-root -r
|
|
155
|
+
complete -c cairn -n "__fish_seen_subcommand_from sync-pi" -l apply
|
|
156
|
+
complete -c cairn -n "__fish_seen_subcommand_from sync-pi" -l live-root -r
|
|
71
157
|
complete -c cairn -n "__fish_seen_subcommand_from bootstrap" -l untracked
|
|
72
158
|
complete -c cairn -n "__fish_seen_subcommand_from memory" -a "path export import"
|
|
159
|
+
complete -c cairn -n "__fish_seen_subcommand_from doctor" -l repair
|
|
160
|
+
complete -c cairn -n "__fish_seen_subcommand_from trajectory" -a "list show prune"
|
|
161
|
+
complete -c cairn -n "__fish_seen_subcommand_from artifact" -a "list show delete prune"
|
|
162
|
+
complete -c cairn -n "__fish_seen_subcommand_from artifact; and __fish_seen_subcommand_from list" -l kind -r
|
|
163
|
+
complete -c cairn -n "__fish_seen_subcommand_from artifact; and __fish_seen_subcommand_from list" -l session -r
|
|
164
|
+
complete -c cairn -n "__fish_seen_subcommand_from artifact; and __fish_seen_subcommand_from list show delete prune" -l json
|
|
165
|
+
complete -c cairn -n "__fish_seen_subcommand_from artifact; and __fish_seen_subcommand_from delete prune" -l dry-run
|
|
166
|
+
complete -c cairn -n "__fish_seen_subcommand_from artifact; and __fish_seen_subcommand_from prune" -l include-protected
|
|
167
|
+
complete -c cairn -n "__fish_seen_subcommand_from capabilities; and not __fish_seen_subcommand_from list status enable disable reset logging" -a "list status enable disable reset logging"
|
|
168
|
+
complete -c cairn -n "__fish_seen_subcommand_from capabilities; and __fish_seen_subcommand_from enable disable; and not __fish_seen_subcommand_from memory.write memory.search notes.distill wiki graph security.audit route.check context.explore" -a "memory.write memory.search notes.distill wiki graph security.audit route.check context.explore"
|
|
169
|
+
complete -c cairn -n "__fish_seen_subcommand_from capabilities; and __fish_seen_subcommand_from reset; and not __fish_seen_subcommand_from memory.write memory.search notes.distill wiki graph security.audit route.check context.explore" -a "memory.write memory.search notes.distill wiki graph security.audit route.check context.explore"
|
|
170
|
+
complete -c cairn -n "__fish_seen_subcommand_from capabilities; and __fish_seen_subcommand_from reset" -l all
|
|
171
|
+
complete -c cairn -n "__fish_seen_subcommand_from capabilities; and __fish_seen_subcommand_from logging; and not __fish_seen_subcommand_from enable disable reset" -a "enable disable reset"
|
|
172
|
+
complete -c cairn -n "__fish_seen_subcommand_from capabilities; and __fish_seen_subcommand_from list status enable disable reset logging" -l json
|
|
173
|
+
complete -c cairn -n "__fish_seen_subcommand_from notes" -a "distill search-error promote doctor"
|
|
174
|
+
complete -c cairn -n "__fish_seen_subcommand_from eval; and not __fish_seen_subcommand_from validate run ablate report prune delete" -a "validate run ablate report prune delete"
|
|
175
|
+
complete -c cairn -n "__fish_seen_subcommand_from eval; and __fish_seen_subcommand_from validate run ablate" -l task-set -r
|
|
176
|
+
complete -c cairn -n "__fish_seen_subcommand_from eval; and __fish_seen_subcommand_from validate run ablate" -l adapter -r
|
|
177
|
+
complete -c cairn -n "__fish_seen_subcommand_from eval; and __fish_seen_subcommand_from validate run ablate" -l output -r
|
|
178
|
+
complete -c cairn -n "__fish_seen_subcommand_from eval; and __fish_seen_subcommand_from validate run ablate" -l repetitions -r
|
|
179
|
+
complete -c cairn -n "__fish_seen_subcommand_from eval; and __fish_seen_subcommand_from validate run ablate" -l seed -r
|
|
180
|
+
complete -c cairn -n "__fish_seen_subcommand_from eval; and __fish_seen_subcommand_from run ablate" -l yes
|
|
181
|
+
complete -c cairn -n "__fish_seen_subcommand_from eval; and __fish_seen_subcommand_from ablate" -l disable -r -a "memory.write memory.search notes.distill wiki graph security.audit route.check context.explore"
|
|
182
|
+
complete -c cairn -n "__fish_seen_subcommand_from eval; and __fish_seen_subcommand_from report delete" -l experiment -r
|
|
183
|
+
complete -c cairn -n "__fish_seen_subcommand_from eval; and __fish_seen_subcommand_from prune" -l older-than-days -r
|
|
184
|
+
complete -c cairn -n "__fish_seen_subcommand_from eval; and __fish_seen_subcommand_from prune delete" -l dry-run
|
|
185
|
+
complete -c cairn -n "__fish_seen_subcommand_from eval; and __fish_seen_subcommand_from validate run ablate report prune delete" -l json
|
|
73
186
|
complete -c cairn -n "__fish_seen_subcommand_from completion" -a "bash zsh fish"
|
|
187
|
+
complete -c cairn -n "__fish_seen_subcommand_from uninstall" -l pi-live-root -r
|
|
74
188
|
EOF
|
|
75
189
|
;;
|
|
76
190
|
*)
|