@cairnkeep/cli 1.0.2
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/AGENTS.md +45 -0
- package/CONTRIBUTING.md +49 -0
- package/LICENSE +201 -0
- package/README.md +149 -0
- package/SECURITY.md +37 -0
- package/bin/cairn +73 -0
- package/claude/agents/code-reviewer.md +174 -0
- package/claude/agents/security-investigator.md +112 -0
- package/claude/agents/security-target-selector.md +90 -0
- package/claude/agents/security-validator.md +97 -0
- package/claude/agents/wiki-ingester.md +108 -0
- package/claude/agents/wiki-lint-auditor.md +94 -0
- package/claude/agents/wiki-query-analyst.md +84 -0
- package/claude/commands/context-explore.md +40 -0
- package/claude/commands/graphify.md +150 -0
- package/claude/commands/memory-review.md +85 -0
- package/claude/commands/memory-sync.md +71 -0
- package/claude/commands/recall.md +32 -0
- package/claude/commands/remember.md +43 -0
- package/claude/commands/repo-review.md +191 -0
- package/claude/commands/security-audit.md +174 -0
- package/claude/commands/wiki-ingest.md +112 -0
- package/claude/commands/wiki-lint.md +86 -0
- package/claude/commands/wiki-query.md +92 -0
- package/claude/hooks/context-explore-pretask.sh +93 -0
- package/claude/hooks/memory-capture.sh +59 -0
- package/claude/hooks/memory-recall.sh +84 -0
- package/claude/hooks/memory-wakeup.sh +45 -0
- package/docs/building-an-overlay.md +117 -0
- package/docs/domain-knowledge.md +86 -0
- package/docs/git-providers.md +36 -0
- package/docs/operating.md +366 -0
- package/mcp-memory-server/dist/embeddings.js +122 -0
- package/mcp-memory-server/dist/explore-cache.js +97 -0
- package/mcp-memory-server/dist/index.js +1256 -0
- package/mcp-memory-server/package.json +36 -0
- package/opencode/agents/code-reviewer.md +173 -0
- package/opencode/agents/security-investigator.md +111 -0
- package/opencode/agents/security-target-selector.md +89 -0
- package/opencode/agents/security-validator.md +96 -0
- package/opencode/agents/wiki-ingester.md +107 -0
- package/opencode/agents/wiki-lint-auditor.md +93 -0
- package/opencode/agents/wiki-query-analyst.md +83 -0
- package/opencode/command/code-review.md +199 -0
- package/opencode/command/context-explore.md +42 -0
- package/opencode/command/graphify.md +153 -0
- package/opencode/command/memory-review.md +44 -0
- package/opencode/command/memory-sync.md +94 -0
- package/opencode/command/recall.md +38 -0
- package/opencode/command/remember.md +46 -0
- package/opencode/command/security-audit.md +80 -0
- package/opencode/command/wiki-ingest.md +55 -0
- package/opencode/command/wiki-lint.md +51 -0
- package/opencode/command/wiki-query.md +50 -0
- package/opencode/plugins/memory-capture.ts +188 -0
- package/opencode/plugins/memory-recall.ts +132 -0
- package/opencode/plugins/memory-wakeup.ts +102 -0
- package/opencode/templates/security-finding-register.yaml.template +51 -0
- package/opencode/templates/security-issue.md.template +43 -0
- package/opencode/templates/security-policy.md.template +29 -0
- package/opencode/templates/security-report.md.template +43 -0
- package/opencode/templates/wiki-contradictions.md.template +31 -0
- package/opencode/templates/wiki-index.md.template +40 -0
- package/opencode/templates/wiki-lint-report.md.template +38 -0
- package/opencode/templates/wiki-log.md.template +11 -0
- package/opencode/templates/wiki-policy.md.template +47 -0
- package/opencode/templates/wiki-query-answer.md.template +26 -0
- package/opencode/templates/wiki-source-summary.md.template +33 -0
- package/opencode/workflows/memory-review-workflow.md +66 -0
- package/opencode/workflows/security-audit-workflow.md +197 -0
- package/opencode/workflows/wiki-ingest-workflow.md +149 -0
- package/opencode/workflows/wiki-lint-workflow.md +128 -0
- package/opencode/workflows/wiki-query-workflow.md +122 -0
- package/package.json +56 -0
- package/scripts/bootstrap.sh +99 -0
- package/scripts/doctor.sh +91 -0
- package/scripts/install-audit-timer.sh +68 -0
- package/scripts/lib/assert-tool-event.mjs +50 -0
- package/scripts/memory-store.sh +71 -0
- package/scripts/memory-wiki-audit.sh +156 -0
- package/scripts/sync-claude-assets.sh +182 -0
- package/scripts/sync-opencode-explore-assets.sh +187 -0
- package/scripts/sync-opencode-graphify-assets.sh +152 -0
- package/scripts/sync-opencode-memory-assets.sh +160 -0
- package/scripts/sync-opencode-plugin-assets.sh +163 -0
- package/scripts/sync-opencode-security-assets.sh +195 -0
- package/scripts/sync-opencode-wiki-assets.sh +250 -0
- package/scripts/test-audit-timer.sh +29 -0
- package/scripts/test-bootstrap-untracked.sh +41 -0
- package/scripts/test-cli-dispatch.sh +21 -0
- package/scripts/test-doctor.sh +32 -0
- package/scripts/test-launcher-hooks.sh +66 -0
- package/scripts/test-memory-store.sh +44 -0
- package/scripts/test-remember-recall-assertions.sh +70 -0
- package/scripts/transcript-to-text.mjs +53 -0
- package/scripts/verify-docs-parity.sh +112 -0
- package/scripts/verify-explore-maturation.sh +288 -0
- package/scripts/verify-fastcontext-reliability.sh +624 -0
- package/scripts/verify-no-private-references.sh +145 -0
- package/scripts/verify-opencode-live-parity.sh +864 -0
- package/scripts/verify-routing-seam.sh +169 -0
- package/scripts/verify-token-savings-ab.sh +557 -0
- package/templates/PROJECT-INSTRUCTIONS.md.template +42 -0
- package/templates/alignment-gap-register.yaml.template +56 -0
- package/templates/alignment-policy.md.template +28 -0
- package/templates/alignment-pr-template.md.template +18 -0
- package/templates/alignment-report.md.template +56 -0
- package/templates/env.example.template +25 -0
- package/templates/graph-policy.md.template +37 -0
- package/templates/graphs-gitignore.template +3 -0
- package/templates/memory-wiki-audit.service.template +6 -0
- package/templates/memory-wiki-audit.timer.template +9 -0
- package/templates/memory.json.template +4 -0
- package/templates/planning-config.json.template +6 -0
- package/templates/project-brief.md.template +40 -0
- package/templates/security-finding-register.yaml.template +51 -0
- package/templates/security-issue.md.template +43 -0
- package/templates/security-policy.md.template +29 -0
- package/templates/security-report.md.template +43 -0
- package/templates/start-claude.sh.template +46 -0
- package/templates/start-opencode.sh.template +41 -0
- package/templates/structured-change-canvas.md.template +63 -0
- package/templates/wiki-contradictions.md.template +31 -0
- package/templates/wiki-index.md.template +40 -0
- package/templates/wiki-lint-report.md.template +38 -0
- package/templates/wiki-log.md.template +11 -0
- package/templates/wiki-policy.md.template +47 -0
- package/templates/wiki-query-answer.md.template +26 -0
- package/templates/wiki-source-summary.md.template +33 -0
|
@@ -0,0 +1,145 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
set -euo pipefail
|
|
3
|
+
|
|
4
|
+
# No-private-references guard (SC-03; DEC-no-private-references,
|
|
5
|
+
# DEC-no-ai-authorship, DEC-commit-scanning -- PROJECT.md Constraints).
|
|
6
|
+
#
|
|
7
|
+
# Three stages, every one fail-loud (non-zero exit on ANY hit, never a
|
|
8
|
+
# silent pass):
|
|
9
|
+
# 1. Generic denylist (committed, always runs) -- git grep the tracked
|
|
10
|
+
# tree for AI-authorship attribution markers (D-06).
|
|
11
|
+
# 2. Specific denylist (env-gated, fail-closed per D-06) -- literal
|
|
12
|
+
# private terms (employer name, private repo names) from an
|
|
13
|
+
# uncommitted, operator-maintained file referenced by
|
|
14
|
+
# CAIRN_GUARD_DENYLIST. Fixed-string match (git grep -F), per Open
|
|
15
|
+
# Question #2 in 11-RESEARCH.md.
|
|
16
|
+
# 3. Commit-message scan (D-07) -- `git log --format=%B` never passes
|
|
17
|
+
# through `git grep` (which only sees tracked file content), so commit
|
|
18
|
+
# bodies are scanned separately against Stage 1's generic pattern.
|
|
19
|
+
#
|
|
20
|
+
# Stage 1's generic pattern deliberately targets AI-authorship ATTRIBUTION
|
|
21
|
+
# (commit trailers, "generated with/by" boilerplate, the anthropic.com
|
|
22
|
+
# email domain) rather than a bare "claude code"/"anthropic" substring --
|
|
23
|
+
# this project legitimately names "Claude Code" throughout as a supported
|
|
24
|
+
# harness (PROJECT.md, docs/operating.md), so a bare-substring match would
|
|
25
|
+
# flag the project's own identity, not a real violation.
|
|
26
|
+
#
|
|
27
|
+
# Self-excludes this script and the phase-11 detector-documentation files
|
|
28
|
+
# that quote the patterns (11-RESEARCH.md, 11-PATTERNS.md) from Stage 1
|
|
29
|
+
# ONLY -- they document the detector, they are not violations. Stage 2's
|
|
30
|
+
# specific-literal scan still covers those files (they contain no employer/
|
|
31
|
+
# private-repo literals).
|
|
32
|
+
|
|
33
|
+
usage() {
|
|
34
|
+
cat <<'EOF'
|
|
35
|
+
Usage: verify-no-private-references.sh
|
|
36
|
+
verify-no-private-references.sh -h|--help
|
|
37
|
+
|
|
38
|
+
Scans the tracked tree + full commit-message log for AI-authorship
|
|
39
|
+
attribution markers (Stage 1 + Stage 3), and, if CAIRN_GUARD_DENYLIST is
|
|
40
|
+
set, a specific private-term list (Stage 2). Exits non-zero on ANY hit, or
|
|
41
|
+
on a fail-closed misconfiguration (D-06). Runs all three stages and reports
|
|
42
|
+
every hit before exiting, so a single run surfaces the full finding set.
|
|
43
|
+
|
|
44
|
+
Environment:
|
|
45
|
+
CAIRN_GUARD_DENYLIST Path to an uncommitted, operator-maintained file:
|
|
46
|
+
one literal private/vendor term per line
|
|
47
|
+
(fixed-string match, not regex). Never committed
|
|
48
|
+
-- kept outside the repo or gitignored. If set,
|
|
49
|
+
the file must be readable or the script fails
|
|
50
|
+
closed. Unset -> generic-only scan (Stages 1+3).
|
|
51
|
+
Only presence ("set: yes/no") is ever logged --
|
|
52
|
+
never the path or the file's contents (D-06).
|
|
53
|
+
EOF
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
SELF_PATH="scripts/verify-no-private-references.sh"
|
|
57
|
+
DETECTOR_DOCS=(
|
|
58
|
+
".planning/milestones/v1.3-phases/11-self-consistency-public-positioning/11-RESEARCH.md"
|
|
59
|
+
".planning/milestones/v1.3-phases/11-self-consistency-public-positioning/11-PATTERNS.md"
|
|
60
|
+
".planning/milestones/v1.3-phases/11-self-consistency-public-positioning/11-01-SUMMARY.md"
|
|
61
|
+
)
|
|
62
|
+
|
|
63
|
+
# Generic, committed AI-authorship pattern (D-06 Stage 1 + Stage 3).
|
|
64
|
+
GENERIC_PATTERN='(co-authored-by:[[:space:]]*claude|noreply@anthropic\.com|generated (with|by) claude|written by (an|a)? ?ai\b)'
|
|
65
|
+
|
|
66
|
+
log_denylist_presence() {
|
|
67
|
+
local is_set="no"
|
|
68
|
+
[[ -n "${CAIRN_GUARD_DENYLIST:-}" ]] && is_set="yes"
|
|
69
|
+
echo "[env] CAIRN_GUARD_DENYLIST set: $is_set" >&2
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
# stage1_generic_tree_scan(): git grep (tracked tree only, includes
|
|
73
|
+
# .planning/) for the generic pattern, excluding this script and the
|
|
74
|
+
# phase-11 detector docs that quote it.
|
|
75
|
+
stage1_generic_tree_scan() {
|
|
76
|
+
local pathspecs=(. ":!${SELF_PATH}")
|
|
77
|
+
local doc
|
|
78
|
+
for doc in "${DETECTOR_DOCS[@]}"; do
|
|
79
|
+
pathspecs+=(":!${doc}")
|
|
80
|
+
done
|
|
81
|
+
|
|
82
|
+
if git grep -niE "$GENERIC_PATTERN" -- "${pathspecs[@]}"; then
|
|
83
|
+
echo "FATAL: Stage 1 -- generic AI-authorship pattern found in tracked tree" >&2
|
|
84
|
+
return 1
|
|
85
|
+
fi
|
|
86
|
+
return 0
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
# stage2_specific_denylist_scan(): fail-closed env-gated specific-term scan
|
|
90
|
+
# (D-06). Unset -> no-op success. Set-but-unreadable -> fail closed.
|
|
91
|
+
stage2_specific_denylist_scan() {
|
|
92
|
+
if [[ -z "${CAIRN_GUARD_DENYLIST:-}" ]]; then
|
|
93
|
+
return 0
|
|
94
|
+
fi
|
|
95
|
+
if [[ ! -r "$CAIRN_GUARD_DENYLIST" ]]; then
|
|
96
|
+
echo "FATAL: Stage 2 -- CAIRN_GUARD_DENYLIST is set but not readable (fail-closed, D-06)" >&2
|
|
97
|
+
return 1
|
|
98
|
+
fi
|
|
99
|
+
if git grep -niF -f "$CAIRN_GUARD_DENYLIST" -- .; then
|
|
100
|
+
echo "FATAL: Stage 2 -- a term from CAIRN_GUARD_DENYLIST was found in the tracked tree" >&2
|
|
101
|
+
return 1
|
|
102
|
+
fi
|
|
103
|
+
return 0
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
# stage3_commit_message_scan(): git grep never sees commit bodies -- scan
|
|
107
|
+
# the full `git log --format=%B` history separately (D-07).
|
|
108
|
+
stage3_commit_message_scan() {
|
|
109
|
+
if git log --format=%B | grep -niE "$GENERIC_PATTERN"; then
|
|
110
|
+
echo "FATAL: Stage 3 -- generic AI-authorship pattern found in commit-message history" >&2
|
|
111
|
+
return 1
|
|
112
|
+
fi
|
|
113
|
+
return 0
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
main() {
|
|
117
|
+
while [[ $# -gt 0 ]]; do
|
|
118
|
+
case "$1" in
|
|
119
|
+
-h|--help)
|
|
120
|
+
usage
|
|
121
|
+
exit 0
|
|
122
|
+
;;
|
|
123
|
+
*)
|
|
124
|
+
usage >&2
|
|
125
|
+
exit 2
|
|
126
|
+
;;
|
|
127
|
+
esac
|
|
128
|
+
done
|
|
129
|
+
|
|
130
|
+
log_denylist_presence
|
|
131
|
+
|
|
132
|
+
local failed=0
|
|
133
|
+
stage1_generic_tree_scan || failed=1
|
|
134
|
+
stage2_specific_denylist_scan || failed=1
|
|
135
|
+
stage3_commit_message_scan || failed=1
|
|
136
|
+
|
|
137
|
+
if [[ "$failed" -ne 0 ]]; then
|
|
138
|
+
echo "FATAL: no-private-references guard found one or more violations (see above)" >&2
|
|
139
|
+
exit 1
|
|
140
|
+
fi
|
|
141
|
+
|
|
142
|
+
echo "[guard] OK: no private/vendor/AI-authorship references found in tracked tree or commit-message history"
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
main "$@"
|