@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.
Files changed (129) hide show
  1. package/AGENTS.md +45 -0
  2. package/CONTRIBUTING.md +49 -0
  3. package/LICENSE +201 -0
  4. package/README.md +149 -0
  5. package/SECURITY.md +37 -0
  6. package/bin/cairn +73 -0
  7. package/claude/agents/code-reviewer.md +174 -0
  8. package/claude/agents/security-investigator.md +112 -0
  9. package/claude/agents/security-target-selector.md +90 -0
  10. package/claude/agents/security-validator.md +97 -0
  11. package/claude/agents/wiki-ingester.md +108 -0
  12. package/claude/agents/wiki-lint-auditor.md +94 -0
  13. package/claude/agents/wiki-query-analyst.md +84 -0
  14. package/claude/commands/context-explore.md +40 -0
  15. package/claude/commands/graphify.md +150 -0
  16. package/claude/commands/memory-review.md +85 -0
  17. package/claude/commands/memory-sync.md +71 -0
  18. package/claude/commands/recall.md +32 -0
  19. package/claude/commands/remember.md +43 -0
  20. package/claude/commands/repo-review.md +191 -0
  21. package/claude/commands/security-audit.md +174 -0
  22. package/claude/commands/wiki-ingest.md +112 -0
  23. package/claude/commands/wiki-lint.md +86 -0
  24. package/claude/commands/wiki-query.md +92 -0
  25. package/claude/hooks/context-explore-pretask.sh +93 -0
  26. package/claude/hooks/memory-capture.sh +59 -0
  27. package/claude/hooks/memory-recall.sh +84 -0
  28. package/claude/hooks/memory-wakeup.sh +45 -0
  29. package/docs/building-an-overlay.md +117 -0
  30. package/docs/domain-knowledge.md +86 -0
  31. package/docs/git-providers.md +36 -0
  32. package/docs/operating.md +366 -0
  33. package/mcp-memory-server/dist/embeddings.js +122 -0
  34. package/mcp-memory-server/dist/explore-cache.js +97 -0
  35. package/mcp-memory-server/dist/index.js +1256 -0
  36. package/mcp-memory-server/package.json +36 -0
  37. package/opencode/agents/code-reviewer.md +173 -0
  38. package/opencode/agents/security-investigator.md +111 -0
  39. package/opencode/agents/security-target-selector.md +89 -0
  40. package/opencode/agents/security-validator.md +96 -0
  41. package/opencode/agents/wiki-ingester.md +107 -0
  42. package/opencode/agents/wiki-lint-auditor.md +93 -0
  43. package/opencode/agents/wiki-query-analyst.md +83 -0
  44. package/opencode/command/code-review.md +199 -0
  45. package/opencode/command/context-explore.md +42 -0
  46. package/opencode/command/graphify.md +153 -0
  47. package/opencode/command/memory-review.md +44 -0
  48. package/opencode/command/memory-sync.md +94 -0
  49. package/opencode/command/recall.md +38 -0
  50. package/opencode/command/remember.md +46 -0
  51. package/opencode/command/security-audit.md +80 -0
  52. package/opencode/command/wiki-ingest.md +55 -0
  53. package/opencode/command/wiki-lint.md +51 -0
  54. package/opencode/command/wiki-query.md +50 -0
  55. package/opencode/plugins/memory-capture.ts +188 -0
  56. package/opencode/plugins/memory-recall.ts +132 -0
  57. package/opencode/plugins/memory-wakeup.ts +102 -0
  58. package/opencode/templates/security-finding-register.yaml.template +51 -0
  59. package/opencode/templates/security-issue.md.template +43 -0
  60. package/opencode/templates/security-policy.md.template +29 -0
  61. package/opencode/templates/security-report.md.template +43 -0
  62. package/opencode/templates/wiki-contradictions.md.template +31 -0
  63. package/opencode/templates/wiki-index.md.template +40 -0
  64. package/opencode/templates/wiki-lint-report.md.template +38 -0
  65. package/opencode/templates/wiki-log.md.template +11 -0
  66. package/opencode/templates/wiki-policy.md.template +47 -0
  67. package/opencode/templates/wiki-query-answer.md.template +26 -0
  68. package/opencode/templates/wiki-source-summary.md.template +33 -0
  69. package/opencode/workflows/memory-review-workflow.md +66 -0
  70. package/opencode/workflows/security-audit-workflow.md +197 -0
  71. package/opencode/workflows/wiki-ingest-workflow.md +149 -0
  72. package/opencode/workflows/wiki-lint-workflow.md +128 -0
  73. package/opencode/workflows/wiki-query-workflow.md +122 -0
  74. package/package.json +56 -0
  75. package/scripts/bootstrap.sh +99 -0
  76. package/scripts/doctor.sh +91 -0
  77. package/scripts/install-audit-timer.sh +68 -0
  78. package/scripts/lib/assert-tool-event.mjs +50 -0
  79. package/scripts/memory-store.sh +71 -0
  80. package/scripts/memory-wiki-audit.sh +156 -0
  81. package/scripts/sync-claude-assets.sh +182 -0
  82. package/scripts/sync-opencode-explore-assets.sh +187 -0
  83. package/scripts/sync-opencode-graphify-assets.sh +152 -0
  84. package/scripts/sync-opencode-memory-assets.sh +160 -0
  85. package/scripts/sync-opencode-plugin-assets.sh +163 -0
  86. package/scripts/sync-opencode-security-assets.sh +195 -0
  87. package/scripts/sync-opencode-wiki-assets.sh +250 -0
  88. package/scripts/test-audit-timer.sh +29 -0
  89. package/scripts/test-bootstrap-untracked.sh +41 -0
  90. package/scripts/test-cli-dispatch.sh +21 -0
  91. package/scripts/test-doctor.sh +32 -0
  92. package/scripts/test-launcher-hooks.sh +66 -0
  93. package/scripts/test-memory-store.sh +44 -0
  94. package/scripts/test-remember-recall-assertions.sh +70 -0
  95. package/scripts/transcript-to-text.mjs +53 -0
  96. package/scripts/verify-docs-parity.sh +112 -0
  97. package/scripts/verify-explore-maturation.sh +288 -0
  98. package/scripts/verify-fastcontext-reliability.sh +624 -0
  99. package/scripts/verify-no-private-references.sh +145 -0
  100. package/scripts/verify-opencode-live-parity.sh +864 -0
  101. package/scripts/verify-routing-seam.sh +169 -0
  102. package/scripts/verify-token-savings-ab.sh +557 -0
  103. package/templates/PROJECT-INSTRUCTIONS.md.template +42 -0
  104. package/templates/alignment-gap-register.yaml.template +56 -0
  105. package/templates/alignment-policy.md.template +28 -0
  106. package/templates/alignment-pr-template.md.template +18 -0
  107. package/templates/alignment-report.md.template +56 -0
  108. package/templates/env.example.template +25 -0
  109. package/templates/graph-policy.md.template +37 -0
  110. package/templates/graphs-gitignore.template +3 -0
  111. package/templates/memory-wiki-audit.service.template +6 -0
  112. package/templates/memory-wiki-audit.timer.template +9 -0
  113. package/templates/memory.json.template +4 -0
  114. package/templates/planning-config.json.template +6 -0
  115. package/templates/project-brief.md.template +40 -0
  116. package/templates/security-finding-register.yaml.template +51 -0
  117. package/templates/security-issue.md.template +43 -0
  118. package/templates/security-policy.md.template +29 -0
  119. package/templates/security-report.md.template +43 -0
  120. package/templates/start-claude.sh.template +46 -0
  121. package/templates/start-opencode.sh.template +41 -0
  122. package/templates/structured-change-canvas.md.template +63 -0
  123. package/templates/wiki-contradictions.md.template +31 -0
  124. package/templates/wiki-index.md.template +40 -0
  125. package/templates/wiki-lint-report.md.template +38 -0
  126. package/templates/wiki-log.md.template +11 -0
  127. package/templates/wiki-policy.md.template +47 -0
  128. package/templates/wiki-query-answer.md.template +26 -0
  129. package/templates/wiki-source-summary.md.template +33 -0
@@ -0,0 +1,47 @@
1
+ # Project Knowledge Wiki Policy
2
+
3
+ This repository uses `.planning/wiki/` as a derived, sparse, citation-heavy compiled-knowledge layer.
4
+
5
+ ## Canonical Sources
6
+
7
+ - Raw repository docs, ADRs, tests, interfaces, config, and code remain the canonical sources of truth.
8
+ - The wiki must never overrule the default-branch implementation or canonical repository documents.
9
+ - Use wiki pages to summarize, cross-link, and preserve reusable answers, not to duplicate every file.
10
+
11
+ ## Branch Rules
12
+
13
+ - Project: `REPLACE_WITH_PROJECT_NAME`
14
+ - Default branch: `REPLACE_WITH_DEFAULT_BRANCH`
15
+ - Update wiki pages on the same branch as the source changes they depend on.
16
+ - If the wiki and raw sources disagree, record the contradiction explicitly instead of silently normalizing it.
17
+
18
+ ## Provenance Rules
19
+
20
+ - Every non-trivial claim in `sources/`, `topics/`, `entities/`, and `queries/` should cite canonical source paths.
21
+ - Prefer direct repo-relative paths and specific sections or line ranges when practical.
22
+ - Record `Last reviewed` on every derived page.
23
+ - If freshness is uncertain, say so directly.
24
+
25
+ ## Scope Rules
26
+
27
+ - Do not auto-generate a wiki page per code file.
28
+ - Prefer source summaries for repository docs, design docs, ADRs, standards, and a small number of stable interfaces or subsystems.
29
+ - Topic and entity pages are optional and rare. Create them only when the same synthesis is needed across three or more sources or recurring queries. An empty `topics/`, `entities/`, or `queries/` directory is a healthy, expected state — a sources-only wiki is the normal stable shape for engineering repos, not a gap to fill.
30
+
31
+ ## Contradiction Severity
32
+
33
+ When the wiki disagrees with a canonical source or with itself, classify and record it in `.planning/wiki/CONTRADICTIONS.md` (the persistent register) using one of:
34
+
35
+ - **soft** — non-blocking, contextual difference; coexists, no action required.
36
+ - **scope-mismatch** — the claims apply to different scopes and do not truly conflict; recorded to prevent confusion.
37
+ - **hard** — genuinely conflicting claims that cannot both be correct; must be resolved before downstream work relies on either page. Surfaced at session start.
38
+
39
+ `/wiki-lint` opens and resolves entries in the register in place. An entry is `resolved` only after the conflicting wiki page has actually been reconciled to the canonical source, not merely acknowledged. Do not silently normalize a contradiction away — if raw sources disagree, record it explicitly.
40
+
41
+ ## Maintenance
42
+
43
+ - Use `/wiki-ingest <path>` to create a source summary, or `/wiki-ingest <path> --refresh` to re-sync an existing summary to the current canonical source (re-read, update only changed stable facts, bump `Last reviewed`, log a `wiki-refresh` entry). Run a refresh whenever the MR/PR or code state behind a page changes.
44
+ - Use `/wiki-query --writeback <question>` only when the answer is likely reusable.
45
+ - Use `/wiki-lint` for advisory checks on citations, freshness, contradictions, discoverability, and link hygiene. Lint also updates the persistent `CONTRADICTIONS.md` register.
46
+ - At session start, scan `CONTRADICTIONS.md` for any `severity: hard` open entries and surface them before doing dependent work.
47
+ - Lint reports under `REPORTS/` are advisory snapshots; the register is the durable record. Raw docs and code remain the source of truth.
@@ -0,0 +1,26 @@
1
+ # Query: REPLACE_WITH_QUERY_TITLE
2
+
3
+ - Asked at: `REPLACE_WITH_TIMESTAMP`
4
+ - Question: REPLACE_WITH_QUESTION
5
+ - Answer status: `derived`
6
+ - Last reviewed: `REPLACE_WITH_TIMESTAMP`
7
+
8
+ ## Answer
9
+
10
+ REPLACE_WITH_ANSWER
11
+
12
+ ## Wiki Pages Consulted
13
+
14
+ - REPLACE_WITH_WIKI_PAGE
15
+
16
+ ## Canonical Sources
17
+
18
+ - REPLACE_WITH_CANONICAL_SOURCE
19
+
20
+ ## Contradictions And Freshness Notes
21
+
22
+ - None noted.
23
+
24
+ ## Suggested Follow-up
25
+
26
+ - None.
@@ -0,0 +1,33 @@
1
+ # Source: REPLACE_WITH_SOURCE_LABEL
2
+
3
+ - Canonical source: `REPLACE_WITH_SOURCE_PATH`
4
+ - Source kind: `REPLACE_WITH_SOURCE_KIND`
5
+ - Derived status: `active`
6
+ - Last reviewed: `REPLACE_WITH_LAST_REVIEWED`
7
+
8
+ ## Why This Source Matters
9
+
10
+ REPLACE_WITH_WHY_THIS_MATTERS
11
+
12
+ ## Stable Facts
13
+
14
+ - REPLACE_WITH_FACT_AND_CITATION
15
+
16
+ ## Contradictions And Freshness Notes
17
+
18
+ - None noted.
19
+
20
+ When a contradiction exists, tag it with a severity so `/wiki-lint` can mirror
21
+ it into `CONTRADICTIONS.md`. Use one of:
22
+ - `Contradiction severity: soft` — contextual, coexists.
23
+ - `Contradiction severity: scope-mismatch` — different scopes, not a true conflict.
24
+ - `Contradiction severity: hard` — genuinely conflicting, must resolve.
25
+ Add a `Status: open` (or `resolved`) line so lint can track it deterministically.
26
+
27
+ ## Related Wiki Pages
28
+
29
+ - None yet.
30
+
31
+ ## Canonical References
32
+
33
+ - `REPLACE_WITH_SOURCE_PATH`