cairn-intel 0.24.0__py3-none-win_amd64.whl
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.
- cairn_intel-0.24.0.data/scripts/cairn.exe +4 -0
- cairn_intel-0.24.0.dist-info/METADATA +485 -0
- cairn_intel-0.24.0.dist-info/RECORD +7 -0
- cairn_intel-0.24.0.dist-info/WHEEL +4 -0
- cairn_intel-0.24.0.dist-info/licenses/LICENSE +21 -0
- cairn_intel-0.24.0.dist-info/licenses/NOTICE +96 -0
- cairn_intel-0.24.0.dist-info/sboms/cairn-cli.cyclonedx.json +7913 -0
|
@@ -0,0 +1,485 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: cairn-intel
|
|
3
|
+
Version: 0.24.0
|
|
4
|
+
Classifier: Development Status :: 4 - Beta
|
|
5
|
+
Classifier: Intended Audience :: Developers
|
|
6
|
+
Classifier: Programming Language :: Python :: 3
|
|
7
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
8
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
9
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
10
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
11
|
+
Classifier: Programming Language :: Python :: 3.14
|
|
12
|
+
Classifier: Topic :: Software Development
|
|
13
|
+
Classifier: Topic :: Software Development :: Libraries
|
|
14
|
+
Requires-Dist: pytest>=7.0 ; extra == 'dev'
|
|
15
|
+
Requires-Dist: pyyaml>=6.0 ; extra == 'dev'
|
|
16
|
+
Requires-Dist: build ; extra == 'dev'
|
|
17
|
+
Requires-Dist: ruff>=0.6 ; extra == 'dev'
|
|
18
|
+
Requires-Dist: bandit>=1.7 ; extra == 'dev'
|
|
19
|
+
Requires-Dist: pip-audit>=2.7 ; extra == 'dev'
|
|
20
|
+
Requires-Dist: pre-commit>=4.0 ; extra == 'dev'
|
|
21
|
+
Requires-Dist: commitizen>=4.0 ; extra == 'dev'
|
|
22
|
+
Requires-Dist: pytest>=7.0 ; extra == 'test'
|
|
23
|
+
Provides-Extra: dev
|
|
24
|
+
Provides-Extra: test
|
|
25
|
+
License-File: LICENSE
|
|
26
|
+
License-File: NOTICE
|
|
27
|
+
Summary: Local codebase intelligence system: structural graph + compass + wiki + agent memory
|
|
28
|
+
Keywords: code-intelligence,tree-sitter,mcp,knowledge-graph,code-graph
|
|
29
|
+
Author: Tan Le
|
|
30
|
+
License-Expression: MIT
|
|
31
|
+
Requires-Python: >=3.10
|
|
32
|
+
Description-Content-Type: text/markdown; charset=UTF-8; variant=GFM
|
|
33
|
+
Project-URL: Homepage, https://github.com/tanlnm512/cairn
|
|
34
|
+
|
|
35
|
+
<div align="center">
|
|
36
|
+
<img src="https://raw.githubusercontent.com/tanlnm512/cairn/main/docs/assets/logo/cairn-mark.svg" alt="cairn — five stones, five layers" width="180">
|
|
37
|
+
</div>
|
|
38
|
+
|
|
39
|
+
# cairn
|
|
40
|
+
|
|
41
|
+
> **Verifiable codebase memory for AI agents** — a structural graph + compass + wiki + tribal memory, all local, all traceable to source.
|
|
42
|
+
|
|
43
|
+
<div align="center">
|
|
44
|
+
|
|
45
|
+
The precise call graph, without the guesswork · every answer re-derivable from local data · 100% local SQLite, no network calls · LLM never in the query path
|
|
46
|
+
|
|
47
|
+
</div>
|
|
48
|
+
|
|
49
|
+
[](https://pypi.org/project/cairn-intel/)
|
|
50
|
+
[](LICENSE)
|
|
51
|
+
[](https://pypi.org/project/cairn-intel/)
|
|
52
|
+
[](https://github.com/tanlnm512/cairn/actions/workflows/ci.yml)
|
|
53
|
+
|
|
54
|
+
cairn parses your repos with tree-sitter into a **resolution-labeled structural
|
|
55
|
+
graph** (15 languages), fuses it with **code-grounded tribal memory**, compass,
|
|
56
|
+
and wiki, and serves all of it through one MCP server (26 tools) + a `cairn`
|
|
57
|
+
CLI — a single static Rust binary. The product is a **verification contract**:
|
|
58
|
+
every `exact` edge is actually resolved, every symbol in a synthesized doc is
|
|
59
|
+
graph-verified by a deterministic critic, and the LLM never sits in the query
|
|
60
|
+
path.
|
|
61
|
+
|
|
62
|
+
## Contents
|
|
63
|
+
|
|
64
|
+
- [Get Started](#get-started)
|
|
65
|
+
- [Language Support](#language-support)
|
|
66
|
+
- [Why cairn?](#why-cairn)
|
|
67
|
+
- [Key Features](#key-features)
|
|
68
|
+
- [How It Works](#how-it-works)
|
|
69
|
+
- [Self-demo](#self-demo)
|
|
70
|
+
- [CLI Reference](#cli-reference)
|
|
71
|
+
- [MCP Tools](#mcp-tools)
|
|
72
|
+
- [Configuration](#configuration)
|
|
73
|
+
- [Supported Platforms & Agents](#supported-platforms--agents)
|
|
74
|
+
- [Documentation](#documentation)
|
|
75
|
+
- [Troubleshooting](#troubleshooting)
|
|
76
|
+
- [Development](#development)
|
|
77
|
+
- [Dependency Licenses](#dependency-licenses)
|
|
78
|
+
- [Status](#status) · [License](#license)
|
|
79
|
+
|
|
80
|
+
## Get Started
|
|
81
|
+
|
|
82
|
+
**1. Install the CLI**
|
|
83
|
+
|
|
84
|
+
Every channel ships the same engine binary:
|
|
85
|
+
|
|
86
|
+
```bash
|
|
87
|
+
brew install tanlnm512/cairn/cairn # Homebrew tap
|
|
88
|
+
pip install cairn-intel # or: uv tool install / pipx install
|
|
89
|
+
cargo binstall --git https://github.com/tanlnm512/cairn cairn-cli
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
Release tarballs (aarch64 / x86_64 on macOS and Linux, musl-static on
|
|
93
|
+
Linux) are on the [releases page](https://github.com/tanlnm512/cairn/releases),
|
|
94
|
+
and `cargo install --path rust/crates/cairn-cli` builds from a clone. Release
|
|
95
|
+
tags populate the tarballs, the wheels, the Homebrew formula, and the
|
|
96
|
+
binstall metadata.
|
|
97
|
+
|
|
98
|
+
The PyPI package is the engine binary itself: maturin builds the wheel from
|
|
99
|
+
the cargo workspace, its only payload is the platform `cairn` executable, and
|
|
100
|
+
it declares no runtime dependencies and ships no Python. `docx` and PDF
|
|
101
|
+
conversion run natively in the engine; the optional
|
|
102
|
+
[`cairn-intel-ingest`](packaging/cairn-intel-ingest) package (`pip install
|
|
103
|
+
cairn-intel-ingest`) adds higher-fidelity PDF conversion when present.
|
|
104
|
+
`cairn upgrade` updates PyPI installs in place (detects `uv tool` / `pipx` /
|
|
105
|
+
`pip`; `--check` previews without changing anything); Homebrew and cargo
|
|
106
|
+
installs upgrade through their own channel.
|
|
107
|
+
|
|
108
|
+
**2. Wire up your agent(s)**
|
|
109
|
+
|
|
110
|
+
```bash
|
|
111
|
+
cairn install-agents
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
Detects which AI clients you have (Claude Code, Cursor, ZCode, Droid,
|
|
115
|
+
opencode, agy, kilo, omp), shows what's already wired, and prompts for scope:
|
|
116
|
+
`workspace` (per-project `./.claude/`, `./.cursor/` …) or `global`
|
|
117
|
+
(`~/.claude/` — every project inherits it). Every registration is a URL+key
|
|
118
|
+
entry dialing one shared daemon; Claude Desktop has no URL MCP surface and is
|
|
119
|
+
reported unsupported. Non-interactive: `cairn install-agents --yes --scope
|
|
120
|
+
global`. Manual wiring is one JSON block (`cairn connect` starts the daemon
|
|
121
|
+
if it isn't running; install-agents writes this with your generated key in
|
|
122
|
+
the header):
|
|
123
|
+
|
|
124
|
+
```json
|
|
125
|
+
{ "mcpServers": { "cairn": { "type": "http", "url": "http://127.0.0.1:9876/mcp", "headers": { "Authorization": "Bearer <key>" } } } }
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
**3. Build the graph**
|
|
129
|
+
|
|
130
|
+
```bash
|
|
131
|
+
cairn build # parse the workspace, resolve edges (first run; ~4s on cairn itself)
|
|
132
|
+
```
|
|
133
|
+
|
|
134
|
+
**4. No more syncing**
|
|
135
|
+
|
|
136
|
+
```bash
|
|
137
|
+
cairn update # incremental reindex — only what changed since the last build
|
|
138
|
+
```
|
|
139
|
+
|
|
140
|
+
The hooks keep this automatic: `cairn install-agents` wires a `post_edit`
|
|
141
|
+
agent hook that reindexes each edited file (`cairn hooks run post_edit`),
|
|
142
|
+
and `cairn hooks install` (or `install-agents --git-hooks`) adds post-commit
|
|
143
|
+
and post-checkout git hooks that run `cairn update --diff-ref` over the
|
|
144
|
+
committed or checked-out range in the background.
|
|
145
|
+
|
|
146
|
+
**Uninstall** — `cairn uninstall` removes agent wiring, hooks, and the graph
|
|
147
|
+
store; `--dry-run` previews the scope; `cairn uninstall-agents` only removes
|
|
148
|
+
client configs.
|
|
149
|
+
|
|
150
|
+
## Language Support
|
|
151
|
+
|
|
152
|
+
Fifteen languages, one uniform contract: definitions, call edges (labeled
|
|
153
|
+
`exact` / `ambiguous` / `unresolved`), references, and inheritance wherever the
|
|
154
|
+
grammar carries them. `.h` headers are sniffed to Objective-C / C++ / C.
|
|
155
|
+
|
|
156
|
+
| Language | Extensions | Status |
|
|
157
|
+
|----------|------------|--------|
|
|
158
|
+
| Kotlin | `.kt` | Full |
|
|
159
|
+
| Java | `.java` | Full |
|
|
160
|
+
| Swift | `.swift` | Full |
|
|
161
|
+
| TypeScript | `.ts` `.tsx` `.mts` `.cts` | Full · JSX component refs tracked |
|
|
162
|
+
| JavaScript | `.js` `.jsx` `.mjs` `.cjs` | Full · React `<Comp/>` JSX refs tracked as references edges |
|
|
163
|
+
| Python | `.py` | Full |
|
|
164
|
+
| Go | `.go` | Full |
|
|
165
|
+
| Dart | `.dart` | Full |
|
|
166
|
+
| Objective-C | `.m` `.mm` | Full · `.h` sniffed |
|
|
167
|
+
| PHP | `.php` `.phtml` `.php3`-`5` | Full (pure-PHP grammar, no HTML mixing) |
|
|
168
|
+
| Ruby | `.rb` `.rbw` | Full |
|
|
169
|
+
| C# | `.cs` `.csx` | Full |
|
|
170
|
+
| C | `.c` | Full · `.h` sniffed |
|
|
171
|
+
| C++ | `.cpp` `.cc` `.cxx` `.hpp` | Full · `.h` sniffed |
|
|
172
|
+
| Rust | `.rs` | Generic tier · pinned grammar; call edges stay `unresolved` |
|
|
173
|
+
|
|
174
|
+
Not indexed (yet): Vue / Svelte single-file components, CSS, HTML. Details:
|
|
175
|
+
[docs/indexing.md](docs/indexing.md).
|
|
176
|
+
|
|
177
|
+
## Why cairn?
|
|
178
|
+
|
|
179
|
+
A code graph alone is commoditized — several tools index symbols and call
|
|
180
|
+
edges. Generic agent memory is ungrounded — it lets an LLM silently rewrite
|
|
181
|
+
what it "remembers." cairn is the narrow intersection: a structural graph
|
|
182
|
+
**fused with code-grounded memory, where every output is traceable to source
|
|
183
|
+
and every synthesized doc is fact-checked before it lands.**
|
|
184
|
+
|
|
185
|
+
Three promises cairn can machine-check — and does, in CI, on cairn's own code:
|
|
186
|
+
|
|
187
|
+
1. **Every `exact` edge is actually resolved.** The resolver pins each edge to
|
|
188
|
+
one definition before labeling it `exact` (`target_id IS NOT NULL`); an
|
|
189
|
+
invariant test guards this on every build.
|
|
190
|
+
2. **Every symbol in a compass / wiki / memory doc exists in the graph.** A
|
|
191
|
+
deterministic critic fact-checks every LLM-synthesized doc against the graph
|
|
192
|
+
before it is written; hallucinated references are rejected or flagged.
|
|
193
|
+
3. **Every answer is re-derivable from local data.** cairn never calls an LLM
|
|
194
|
+
in the query path — the LLM stays on a task queue behind the critic gate, so
|
|
195
|
+
outputs are verifiable, not probabilistic.
|
|
196
|
+
|
|
197
|
+
**Resolution labels are the evidence for promise #1.** Every code graph can
|
|
198
|
+
tell you "who calls this." cairn tells you **whether to trust the answer**:
|
|
199
|
+
`exact` (pinned to one definition — trusted), `ambiguous` (multiple
|
|
200
|
+
candidates; the resolver declined to guess), `unresolved` (external / stdlib).
|
|
201
|
+
Graph tools default to precise mode — only `exact` edges — so blast radius is
|
|
202
|
+
never inflated by name collisions:
|
|
203
|
+
|
|
204
|
+
```bash
|
|
205
|
+
cairn impact invoke # precise (default): real callers only — ground truth
|
|
206
|
+
cairn impact invoke --fuzzy # candidate list (name matches), each labelled unverified
|
|
207
|
+
```
|
|
208
|
+
|
|
209
|
+
For common names, most of the fuzzy list is name-collision noise that precise
|
|
210
|
+
mode excludes. An empty precise result means "no *resolvable* callers," not
|
|
211
|
+
"unused" — retry with `--fuzzy` before concluding a symbol is dead. And
|
|
212
|
+
`explore` surfaces `ambiguous` dispatch hops — polymorphism that grep
|
|
213
|
+
fundamentally cannot see.
|
|
214
|
+
|
|
215
|
+
### Honest trade-offs
|
|
216
|
+
|
|
217
|
+
- **Semantic retrieval is mid-band and needs an embeddings server for real
|
|
218
|
+
vectors.** The binary ships no local inference: the default backend is a
|
|
219
|
+
dep-free hash embedder (token-overlap vectors; `cairn doctor` warns while
|
|
220
|
+
it is active), which is why the structural tools carry the precision story.
|
|
221
|
+
Point `CAIRN_EMBED_BACKEND` at a local OpenAI-compatible embeddings server
|
|
222
|
+
(`omlx`, `ollama`, or `server` + `CAIRN_EMBED_BASE_URL`) for bge-m3-class
|
|
223
|
+
vectors with no model download inside cairn. No cross-encoder reranker
|
|
224
|
+
ships in this build (`cairn download-reranker` says so).
|
|
225
|
+
- **Synthesized docs need an LLM pass.** Compass/wiki generation runs through
|
|
226
|
+
the task queue (`cairn task`) with the critic gate — deterministic, but it
|
|
227
|
+
won't happen purely locally without any model access.
|
|
228
|
+
|
|
229
|
+
## Key Features
|
|
230
|
+
|
|
231
|
+
- **Surgical context** — `explore(query)` returns matching symbols' verbatim
|
|
232
|
+
source, the call paths between them, and a blast-radius summary in one round
|
|
233
|
+
trip. The recommended first call for agents.
|
|
234
|
+
- **Trust-labeled blast radius** — precise mode follows only resolved edges;
|
|
235
|
+
`--fuzzy` gives an explicitly-labelled candidate list for auditing and
|
|
236
|
+
dead-code hunts.
|
|
237
|
+
- **Cross-repo reach** — `cross_repo_deps(repo)` maps who consumes your public
|
|
238
|
+
API across registered repos; `impact_analysis` reports consumer reach.
|
|
239
|
+
- **Code-grounded memory** — decisions / patterns / mistakes / workarounds,
|
|
240
|
+
symbol-keyed, recalled alongside graph results; promotion and decay
|
|
241
|
+
lifecycles keep it honest. Bi-temporal semantics: every memory carries a
|
|
242
|
+
validity interval, `--as-of <date>` recall answers point-in-time queries,
|
|
243
|
+
renamed/removed symbols auto-expire their memories (successor-linked, never
|
|
244
|
+
deleted), and `cairn memory timeline <symbol>` shows the history.
|
|
245
|
+
- **Multi-agent coordination** — `cairn memory share` publishes a learning to
|
|
246
|
+
other agents working the same store; `cairn memory check` warns before
|
|
247
|
+
editing symbols with another agent's recent activity. Unused sharing keeps
|
|
248
|
+
single-agent behavior byte-identical.
|
|
249
|
+
- **Security-aware blast radius** — configurable taint sources/sinks
|
|
250
|
+
(generic defaults, workspace overrides) propagate over precise call edges;
|
|
251
|
+
`cairn taint --from --to` traces source-to-sink paths and `explore` /
|
|
252
|
+
`cairn blast` warn when changes intersect one.
|
|
253
|
+
- **Closed review loop** — `cairn review` builds diff-scoped review packs
|
|
254
|
+
(blast radius + memories + compass + wiki), guards pre-submit against
|
|
255
|
+
recorded mistakes, and captures resolved review comments as new memories;
|
|
256
|
+
the bundled advisory GitHub Action posts findings on every PR.
|
|
257
|
+
- **One-shot context packs** — `cairn pack --task "<text>" --budget <tokens>`
|
|
258
|
+
emits a single token-budgeted context block (ranked sources, blast lines,
|
|
259
|
+
compass, memories); deterministic, offline, no LLM. Measured fit-rate 1.00
|
|
260
|
+
at 99.7% token reduction vs a grep baseline.
|
|
261
|
+
- **Cross-repo federation** — `federated_search` and `cairn federated-search`
|
|
262
|
+
merge results across every registered workspace store with per-repo
|
|
263
|
+
attribution; `cairn ask --all-repos` routes questions across the
|
|
264
|
+
federation; unavailable stores are named, never skipped.
|
|
265
|
+
- **Docs as first-class knowledge** — `cairn knowledge ingest` stages
|
|
266
|
+
markdown / PDF / DOCX (repo doc-trees or fed files) through a reviewable
|
|
267
|
+
dry-run manifest before anything lands in the store; classification,
|
|
268
|
+
redaction, and collision-safe identities included.
|
|
269
|
+
- **Always fresh** — incremental `cairn update` (git-diff-driven), driven
|
|
270
|
+
automatically by the agent and git hooks, and `cairn doctor`'s health
|
|
271
|
+
checks gating CI.
|
|
272
|
+
- **100% local** — one SQLite store under `~/.cairn`; no network calls, no
|
|
273
|
+
telemetry egress.
|
|
274
|
+
- **Agent-first surfaces** — the same store backs 26 MCP tools and the CLI;
|
|
275
|
+
`cairn install-agents` wires every detected client in one command. A VS
|
|
276
|
+
Code extension (hover blast radius, code-lens counts, compass/memory
|
|
277
|
+
panel, zero-config local server) installs from the `cairn-ext.vsix` on
|
|
278
|
+
each [release](https://github.com/tanlnm512/cairn/releases).
|
|
279
|
+
- **Local dashboard** — `cairn dashboard` opens a loopback web console at
|
|
280
|
+
`127.0.0.1:8765`: interactive graph with symbol search, recorded
|
|
281
|
+
tool-call history and token usage (MCP + CLI, mode-labeled estimates),
|
|
282
|
+
session chains, health/memory panels, a global workspace selector in the
|
|
283
|
+
topbar (every view follows the selection), a `Ctrl/Cmd+K` command palette
|
|
284
|
+
(views, workspaces, symbol search), repo-scoped wiki navigation (grouped
|
|
285
|
+
catalog with filters and search, breadcrumbs, in-page TOCs, prev/next,
|
|
286
|
+
graph cross-links), knowledge views over the ingested docs (`/knowledge`
|
|
287
|
+
catalog with family/status/tag filters, per-doc detail with supersede
|
|
288
|
+
chain, relationship panel, and linked code refs, and a `/knowledge/graph`
|
|
289
|
+
relationship canvas whose legend chips filter edges in place), a
|
|
290
|
+
collapsible grouped sidebar, a dark/light theme
|
|
291
|
+
whose flip re-colors the live graph canvas in place (no reload; canvas
|
|
292
|
+
physics respects `prefers-reduced-motion`), CSV/JSON export of any
|
|
293
|
+
filtered view, an Embeddings status view (probe
|
|
294
|
+
health, fallback state, per-knob config sources) with the degradation
|
|
295
|
+
banner, and a Settings page that persists embedding-backend configuration
|
|
296
|
+
to `~/.cairn/config.json`.
|
|
297
|
+
|
|
298
|
+
## How It Works
|
|
299
|
+
|
|
300
|
+
<picture>
|
|
301
|
+
<source media="(prefers-color-scheme: dark)" srcset="docs/diagrams/readme-architecture-dark.png">
|
|
302
|
+
<img src="docs/diagrams/readme-architecture.png" alt="cairn architecture: AI agents query the MCP server and CLI, which read one local SQLite store; an LLM task queue runs off-path, admitted only through a critic gate">
|
|
303
|
+
</picture>
|
|
304
|
+
|
|
305
|
+
The query path is deterministic: tree-sitter parsing → SQLite graph →
|
|
306
|
+
FTS5/BM25 fused with vectors (RRF, always on when embeddings exist) →
|
|
307
|
+
labeled results. The LLM only ever runs off-path, generating
|
|
308
|
+
compass/wiki/memory candidates that the deterministic critic verifies
|
|
309
|
+
symbol-by-symbol against the graph.
|
|
310
|
+
|
|
311
|
+
Deep dives: [architecture](docs/architecture.md) ·
|
|
312
|
+
[indexing](docs/indexing.md) · [MCP tools](docs/mcp-tools.md) ·
|
|
313
|
+
[deployment](docs/deployment.md).
|
|
314
|
+
|
|
315
|
+
## Self-demo
|
|
316
|
+
|
|
317
|
+
CI replays frozen parity goldens against the release binary — MCP fixtures,
|
|
318
|
+
canonical `.kg` dumps, and CLI captures over the pinned self corpus (a
|
|
319
|
+
captured snapshot of this repository), all under `rust/golden/` and driven by
|
|
320
|
+
`scripts/rust_migration/` — so engine output cannot silently drift. Try it on
|
|
321
|
+
a clone — the build takes seconds:
|
|
322
|
+
|
|
323
|
+
```bash
|
|
324
|
+
git clone https://github.com/tanlnm512/cairn && cd cairn
|
|
325
|
+
cairn build
|
|
326
|
+
cairn def load_pinned_store # -> scripts/rust_migration/parity.py
|
|
327
|
+
cairn impact load_pinned_store # -> real transitive callers (non-empty)
|
|
328
|
+
sqlite3 "$(cairn config --db)" \
|
|
329
|
+
"SELECT COUNT(*) FROM edges WHERE resolution='exact' AND target_id IS NULL" # -> 0
|
|
330
|
+
```
|
|
331
|
+
|
|
332
|
+
## CLI Reference
|
|
333
|
+
|
|
334
|
+
`cairn --help` (or `cairn <group> --help`) is authoritative; every install
|
|
335
|
+
channel runs the same binary. The essentials:
|
|
336
|
+
|
|
337
|
+
| Command | What it does |
|
|
338
|
+
|---------|--------------|
|
|
339
|
+
| `cairn serve` | Run the MCP daemon in the foreground (Streamable HTTP `:9876`, read-write by default; `--read-only` opts out) |
|
|
340
|
+
| `cairn connect` | Ensure the MCP daemon is running (starts it on first dial) and print its URL |
|
|
341
|
+
| `cairn dashboard` | Local web console, loopback :8765 (views + Settings) |
|
|
342
|
+
| `cairn build` / `cairn update` | Full build / incremental reindex (`--staging` builds to a temp DB and atomic-swaps) |
|
|
343
|
+
| `cairn def <symbol>` | Find a symbol's definition |
|
|
344
|
+
| `cairn impact <symbol>` | Within-repo blast radius (precise default; `--fuzzy` to audit) |
|
|
345
|
+
| `cairn blast` | Diff-based reverse-dependency radius (`--base <ref>`, text/markdown/mermaid/json, precise default with `--fuzzy` opt-in; empty radius exits 0, unknown base reports fetch-depth guidance) |
|
|
346
|
+
| `cairn map` | Deterministic repository orientation: directory clusters, counts, hubs, hotspots, and dropped counts (`--json`; capped with `--max-clusters` / `--max-hubs` / `--max-hotspots`) |
|
|
347
|
+
| `cairn grep <pattern>` | Regex or literal search across indexed files, grouped by enclosing symbol (`-i`, `--fixed`, `--in <prefix>`, `--max-hits`; reports dropped hits/groups) |
|
|
348
|
+
| `cairn ask "<question>"` | Natural-language query routed across all layers (`--all-repos` routes across every registered store with per-repo attribution) |
|
|
349
|
+
| `cairn federated-search "QUERY"` | Semantic search across every registered workspace store (per-repo attribution, named dropped stores, `--shared-embed` opt-in) |
|
|
350
|
+
| `cairn pack --task "<text>" --budget <N>` | One-shot token-budgeted context block: ranked sources, blast lines, compass excerpt, memories |
|
|
351
|
+
| `cairn taint --from <src> --to <sink>` | Trace inter-procedural taint paths over precise call edges (`--fuzzy` opt-in, depth-capped) |
|
|
352
|
+
| `cairn review` | Diff-scoped review pack (`--base`), pre-submit memory guard (`--pre-submit [--gate]`), comment capture (`--capture-event`) |
|
|
353
|
+
| `cairn context <file>` | Compass + memory + wiki context for a file |
|
|
354
|
+
| `cairn memory / compass / wiki / task / knowledge …` | The layered stores + LLM task queue (memory: `share`/`check` multi-agent verbs, `timeline <symbol>`, `search --as-of <date>`) |
|
|
355
|
+
| `cairn communities` | Louvain subsystem clusters over structural edges (seeded, deterministic; writes the `communities` tables) |
|
|
356
|
+
| `cairn install-agents` / `cairn uninstall` | Wire / remove agent integration |
|
|
357
|
+
| `cairn upgrade` | In-place update for PyPI installs (`--check` to preview) |
|
|
358
|
+
| `cairn doctor` | Health checks (PASS/WARN/FAIL; exit code gates CI) |
|
|
359
|
+
| `cairn report` | Redacted diagnostic bundle for bug reports (never uploads) |
|
|
360
|
+
|
|
361
|
+
Deep reference: [docs/cli-reference.md](docs/cli-reference.md).
|
|
362
|
+
|
|
363
|
+
## MCP Tools
|
|
364
|
+
|
|
365
|
+
26 tools across four layers — same store as the CLI:
|
|
366
|
+
|
|
367
|
+
| Layer | Tools |
|
|
368
|
+
|-------|-------|
|
|
369
|
+
| **graph** (13) | `find_definition`, `get_callers` / `get_callees`, `impact_analysis`, `cross_repo_deps`, `semantic_search`, `search_symbols`, `repo_map`, `file_api`, `explore` (the aggregator — recommended first call), `path` (shortest structural path between two symbols), `federated_search` (cross-store), `visualize_graph` |
|
|
370
|
+
| **compass + knowledge base** (5) | `get_compass`, `search_knowledge`, `ask_compass` (cross-layer router), `trace_flow`, `generate_flow` |
|
|
371
|
+
| **memory** (2) | tribal memory: `recall_memory`, `record_memory` (lifecycle verbs are CLI-only: `cairn memory digest|evolve|promote|demote|forget|decay`) |
|
|
372
|
+
| **knowledge** (6) | OKF business docs / workflows: add / search / status / delete / `trace_workflow` / `wiki_generate` |
|
|
373
|
+
|
|
374
|
+
Per-tool shapes and examples: [docs/mcp-tools.md](docs/mcp-tools.md).
|
|
375
|
+
|
|
376
|
+
## Configuration
|
|
377
|
+
|
|
378
|
+
Workspace `cairn.json` may set `"include_nested_repos": true` to index
|
|
379
|
+
initialized submodules and nested child repositories under prefixed repo ids;
|
|
380
|
+
the default is `false`. `"exclude"` globs drop paths from indexing (this
|
|
381
|
+
repository's own `cairn.json` excludes `rust/`).
|
|
382
|
+
|
|
383
|
+
The engine is dependency-light and network-free: every command runs from the
|
|
384
|
+
binary alone on every install channel. The one optional add-on is the
|
|
385
|
+
[`cairn-intel-ingest`](packaging/cairn-intel-ingest) package — a separately
|
|
386
|
+
installed high-fidelity PDF converter the engine uses automatically when
|
|
387
|
+
importable (`cairn knowledge ingest --file`; `cairn.json`'s `ingest` key
|
|
388
|
+
holds the classification rules). Without it the engine extracts PDF text
|
|
389
|
+
natively.
|
|
390
|
+
|
|
391
|
+
Key environment knobs (`cairn doctor`'s `config` check prints every
|
|
392
|
+
effective value and where it came from):
|
|
393
|
+
|
|
394
|
+
| Variable | Effect |
|
|
395
|
+
|----------|--------|
|
|
396
|
+
| `CAIRN_HOME` | store location (default `~/.cairn`) |
|
|
397
|
+
| `CAIRN_EMBED_BACKEND` | `local` (default; resolves to the dep-free hash embedder), or an OpenAI-compatible embeddings server: `omlx`, `ollama`, or `server` + `CAIRN_EMBED_BASE_URL` (`CAIRN_EMBED_SERVER_MODEL`, `CAIRN_EMBED_API_KEY` optional) |
|
|
398
|
+
| `CAIRN_ANN_BACKEND` | `sqlite-vec` (default, statically linked) or `off` for the brute-force scan |
|
|
399
|
+
| `CAIRN_FUSION` | RRF fusion of BM25 + vectors (default on; `0` disables) |
|
|
400
|
+
| `CAIRN_WORKERS` | parse-pool size (default: CPU count) |
|
|
401
|
+
| `CAIRN_READ_ONLY=1` | open the store read-only, skipping the pre-query freshness refresh (what `cairn serve --read-only` sets for the daemon) |
|
|
402
|
+
| `CAIRN_TELEMETRY=off` | master kill switch for the local telemetry tables |
|
|
403
|
+
| `CAIRN_RUST_BIN` | daemon start: exec this engine binary instead of the running one |
|
|
404
|
+
| `CAIRN_SIDECAR_PYTHON` | the optional converter package: run it with this interpreter |
|
|
405
|
+
|
|
406
|
+
## Supported Platforms & Agents
|
|
407
|
+
|
|
408
|
+
- **Platforms** — macOS aarch64 / x86_64, Linux aarch64 / x86_64 (static
|
|
409
|
+
musl) and Windows x86_64. The PyPI wheels cover macOS arm64 + x86_64,
|
|
410
|
+
manylinux / musllinux x86_64 + aarch64, and Windows `win_amd64`;
|
|
411
|
+
`make ci-local` replicates CI in a clean Linux container.
|
|
412
|
+
- **Agents** — Claude Code, Cursor, ZCode, Droid, opencode, agy, kilo, omp —
|
|
413
|
+
wired by `cairn install-agents`, or any MCP client via the
|
|
414
|
+
manual JSON block above.
|
|
415
|
+
|
|
416
|
+
## Documentation
|
|
417
|
+
|
|
418
|
+
| Read | For |
|
|
419
|
+
|---|---|
|
|
420
|
+
| [docs/architecture.md](docs/architecture.md) | system shape, storage layout, crate map |
|
|
421
|
+
| [docs/indexing.md](docs/indexing.md) | how `cairn build` / `update` work, resolver tiers |
|
|
422
|
+
| [docs/mcp-tools.md](docs/mcp-tools.md) · [docs/cli-reference.md](docs/cli-reference.md) | the two tool surfaces |
|
|
423
|
+
| [docs/deployment.md](docs/deployment.md) | HTTP serving: key policy, networked and container deployment |
|
|
424
|
+
| [docs/review-checklist.md](docs/review-checklist.md) · [docs/release-checklist.md](docs/release-checklist.md) | contribution and release procedures |
|
|
425
|
+
|
|
426
|
+
## Troubleshooting
|
|
427
|
+
|
|
428
|
+
- `cairn doctor` — health checks with PASS/WARN/FAIL each; non-zero exit
|
|
429
|
+
means an active degradation (agents can gate on it).
|
|
430
|
+
- `cairn report` — redacted diagnostic bundle for bug reports; it never
|
|
431
|
+
uploads anything.
|
|
432
|
+
- Empty `impact` / `get_callers` on a symbol you know is used → it's precise
|
|
433
|
+
mode: retry `--fuzzy` / `fuzzy=True`; the name-matches list is labelled.
|
|
434
|
+
- `cairn update` did nothing on a fresh clone → that's correct (clean tree,
|
|
435
|
+
no diff); run `cairn build` first.
|
|
436
|
+
- `semantic_search` hits look like token matches → the hash backend is
|
|
437
|
+
active; point `CAIRN_EMBED_BACKEND` at an embeddings server (see
|
|
438
|
+
[Configuration](#configuration)) and re-run `cairn embed`.
|
|
439
|
+
|
|
440
|
+
## Development
|
|
441
|
+
|
|
442
|
+
The engine is the Rust workspace under `rust/`:
|
|
443
|
+
|
|
444
|
+
```bash
|
|
445
|
+
cargo fmt --manifest-path Cargo.toml --all
|
|
446
|
+
cargo clippy --manifest-path Cargo.toml --workspace -- -D warnings
|
|
447
|
+
cargo test --manifest-path Cargo.toml --workspace
|
|
448
|
+
```
|
|
449
|
+
|
|
450
|
+
Python remains only for development: the frozen-oracle replay scripts
|
|
451
|
+
(`scripts/rust_migration/`), the repo gates under `scripts/`, the pytest
|
|
452
|
+
suite, and the optional converter package (`packaging/cairn-intel-ingest`):
|
|
453
|
+
|
|
454
|
+
```bash
|
|
455
|
+
uv sync --extra dev
|
|
456
|
+
uv run pytest -m "not infra" # default gate: packaging, release wiring, doc gates, dev scripts
|
|
457
|
+
uv run pytest -m infra # oracle replay against the release binary (main pushes)
|
|
458
|
+
make ci-local # clean-room CI replication in a Linux container
|
|
459
|
+
```
|
|
460
|
+
|
|
461
|
+
Releases are cut by tagging `vX.Y.Z`: the tag-triggered workflows build the
|
|
462
|
+
wheels, the platform binaries, the Homebrew formula, and the crates.io
|
|
463
|
+
publish (see [docs/release-checklist.md](docs/release-checklist.md)).
|
|
464
|
+
Contributions follow [docs/review-checklist.md](docs/review-checklist.md).
|
|
465
|
+
|
|
466
|
+
## Dependency Licenses
|
|
467
|
+
|
|
468
|
+
MIT-licensed. The binary links only permissive crates (MIT, Apache-2.0,
|
|
469
|
+
BSD, ISC, Zlib, Unicode-3.0, CC0-1.0); `Cargo.lock` is the
|
|
470
|
+
authoritative inventory and cargo-deny gates it against that allow-list on
|
|
471
|
+
every change — see [NOTICE](NOTICE). The optional `cairn-intel-ingest`
|
|
472
|
+
package carries the one copyleft dependency in the ecosystem (PyMuPDF,
|
|
473
|
+
AGPL-3.0) and never links into the engine. An embeddings server configured
|
|
474
|
+
through `CAIRN_EMBED_BACKEND` stays outside cairn's dependency tree entirely.
|
|
475
|
+
|
|
476
|
+
## Status
|
|
477
|
+
|
|
478
|
+
**Beta — pre-1.0.** Public surfaces (CLI flags, MCP tool shapes,
|
|
479
|
+
knowledge-file layout) may still shift before 1.0. Feedback welcome via
|
|
480
|
+
[GitHub issues](https://github.com/tanlnm512/cairn/issues).
|
|
481
|
+
|
|
482
|
+
## License
|
|
483
|
+
|
|
484
|
+
[MIT](LICENSE) — © 2025–2026 Tan Le
|
|
485
|
+
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
cairn_intel-0.24.0.data/scripts/cairn.exe,sha256=qSWvlsZKDmD3IyzD9o0d7cXUOJyU3fk770vjJs-6EVQ,63947264
|
|
2
|
+
cairn_intel-0.24.0.dist-info/METADATA,sha256=tOEokQ2Bfy1cIlPXHsKguNSKwWQD5MJrlUcI-XxbM9o,25574
|
|
3
|
+
cairn_intel-0.24.0.dist-info/WHEEL,sha256=8Aej0W0a6Cz6apA3IzJrTnxLRVLAt-w0Oh8SA3Con_c,94
|
|
4
|
+
cairn_intel-0.24.0.dist-info/licenses/LICENSE,sha256=q1IpjjhlI3bgCrbbbKE_kKic892IN96TplMbWaXyBEo,1070
|
|
5
|
+
cairn_intel-0.24.0.dist-info/licenses/NOTICE,sha256=mMBmTZm6uwqY-mnyH_YA-Q_LaOOS5VqYGhNXtmw0aVQ,5063
|
|
6
|
+
cairn_intel-0.24.0.dist-info/sboms/cairn-cli.cyclonedx.json,sha256=Yxvp418jxqovUN-GTtR5E6xy_iQZEYiLKbTL9ZgmlUM,254104
|
|
7
|
+
cairn_intel-0.24.0.dist-info/RECORD,,
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025–2026 Tan Le
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
cairn
|
|
2
|
+
Copyright (c) 2025–2026 Tan Le
|
|
3
|
+
|
|
4
|
+
Licensed under the MIT License; see LICENSE for full text.
|
|
5
|
+
|
|
6
|
+
This NOTICE file documents the third-party open-source software used by cairn.
|
|
7
|
+
Each package retains its own license; the summaries below are for convenience
|
|
8
|
+
and are not legal substitutes for the upstream license texts.
|
|
9
|
+
|
|
10
|
+
================================================================================
|
|
11
|
+
Engine binary dependencies
|
|
12
|
+
================================================================================
|
|
13
|
+
|
|
14
|
+
The cairn engine is a Rust binary. Every crate it links (including the
|
|
15
|
+
tree-sitter grammars and the bundled SQLite and sqlite-vec builds) is declared
|
|
16
|
+
in Cargo.lock; their licenses are checked on every change by cargo-deny
|
|
17
|
+
against the allow-list in rust/deny.toml (Apache-2.0, Apache-2.0 WITH
|
|
18
|
+
LLVM-exception, BSD-2-Clause, BSD-3-Clause, CC0-1.0, ISC, MIT, Unicode-3.0,
|
|
19
|
+
Zlib). The lockfile is the authoritative inventory; `cargo deny list` in
|
|
20
|
+
rust/ renders it.
|
|
21
|
+
|
|
22
|
+
================================================================================
|
|
23
|
+
PyPI package and optional converter
|
|
24
|
+
================================================================================
|
|
25
|
+
|
|
26
|
+
The `cairn-intel` wheel is the engine binary (a maturin bin wheel): it
|
|
27
|
+
contains no Python code and declares no runtime dependencies. The optional
|
|
28
|
+
`cairn-intel-ingest` package — a separately installed high-fidelity PDF
|
|
29
|
+
converter the engine invokes when present — resolves its dependencies from
|
|
30
|
+
PyPI at install time; cairn does not bundle or redistribute them. Declared
|
|
31
|
+
licenses:
|
|
32
|
+
|
|
33
|
+
cairn-intel-ingest pymupdf4llm / PyMuPDF (AGPL-3.0, commercial license
|
|
34
|
+
available from Artifex)
|
|
35
|
+
|
|
36
|
+
================================================================================
|
|
37
|
+
Vendored content (dashboard static assets)
|
|
38
|
+
================================================================================
|
|
39
|
+
|
|
40
|
+
The dashboard vendors the minified standalone browser builds of the
|
|
41
|
+
third-party libraries below as static assets. They are carried in-tree under
|
|
42
|
+
rust/crates/cairn-cli/dashboard-assets/static/, embedded into the cairn binary
|
|
43
|
+
(rust/crates/cairn-cli/src/dashboard/assets.rs) and served by its dashboard;
|
|
44
|
+
no bundler or CDN is used at runtime.
|
|
45
|
+
|
|
46
|
+
vis-network (https://github.com/visjs/vis-network), Copyright (c) 2011-2017
|
|
47
|
+
Almende B.V, http://almende.com and (c) 2017-2019 vis.js contributors,
|
|
48
|
+
https://github.com/visjs. The official standalone UMD minified build is
|
|
49
|
+
vendored at pinned version 9.1.13 (unpkg dist file, sha256
|
|
50
|
+
39b9a36f17b4ca2e27d1e4327216860b042077b3307402ae315402ac826f878b) at
|
|
51
|
+
rust/crates/cairn-cli/dashboard-assets/static/vis-network.min.js, and is dual
|
|
52
|
+
licensed under the Apache License 2.0 OR MIT License. The upstream copyright
|
|
53
|
+
and license notice are retained unmodified in the file's leading banner
|
|
54
|
+
comment.
|
|
55
|
+
|
|
56
|
+
htmx (https://htmx.org / https://github.com/bigskysoftware/htmx), by Big Sky
|
|
57
|
+
Software. The official minified browser build is vendored at pinned version
|
|
58
|
+
2.0.10 (jsDelivr npm dist file, sha256
|
|
59
|
+
71ea67185bfa8c98c39d31717c6fce5d852370fcdfd129db4543774d3145c0de) at
|
|
60
|
+
rust/crates/cairn-cli/dashboard-assets/static/htmx.min.js, licensed under
|
|
61
|
+
Zero-Clause BSD (0BSD) per the htmx project license.
|
|
62
|
+
|
|
63
|
+
Alpine.js (https://alpinejs.dev / https://github.com/alpinejs/alpine),
|
|
64
|
+
Copyright Caleb Porzio and Alpine.js contributors. The official CDN build is
|
|
65
|
+
vendored at pinned version 3.17.1 (jsDelivr npm dist file, sha256
|
|
66
|
+
b30997fc126d808b1a9b20ab3f504ded88df957818c02d6249bba3ec114eb0ec) at
|
|
67
|
+
rust/crates/cairn-cli/dashboard-assets/static/alpine.min.js, licensed under
|
|
68
|
+
the MIT License.
|
|
69
|
+
|
|
70
|
+
@alpinejs/morph (https://alpinejs.dev/plugins/morph), Copyright Caleb Porzio
|
|
71
|
+
and Alpine.js contributors. The official CDN build is vendored at pinned
|
|
72
|
+
version 3.17.1 (jsDelivr npm dist file, sha256
|
|
73
|
+
40741b6d946e9c7e01787d8fefead1c1537a20cf7203726be648cda9d2c9f375) at
|
|
74
|
+
rust/crates/cairn-cli/dashboard-assets/static/alpinejs-morph.min.js, licensed
|
|
75
|
+
under the MIT License.
|
|
76
|
+
|
|
77
|
+
htmx-ext-alpine-morph
|
|
78
|
+
(https://github.com/bigskysoftware/htmx-extensions), by Big Sky Software.
|
|
79
|
+
The extension source is vendored at pinned version 2.0.1 (jsDelivr npm dist
|
|
80
|
+
file, sha256
|
|
81
|
+
762a87ecc98f76558b7d6384c37400ab61e5ab1626196cb7d093fceb89c13b67) at
|
|
82
|
+
rust/crates/cairn-cli/dashboard-assets/static/alpine-morph.js. The extension
|
|
83
|
+
ships with the htmx project; its package manifest declares no separate
|
|
84
|
+
license, and the htmx project license (Zero-Clause BSD) governs upstream.
|
|
85
|
+
|
|
86
|
+
Mermaid (https://mermaid.js.org / https://github.com/mermaid-js/mermaid),
|
|
87
|
+
Copyright (c) 2014-2026 Knut Sveidqvist and mermaid contributors. The
|
|
88
|
+
official ESM browser distribution is vendored at pinned version 11.17.2
|
|
89
|
+
(jsDelivr npm dist files) at
|
|
90
|
+
rust/crates/cairn-cli/dashboard-assets/static/mermaid.min.js (the
|
|
91
|
+
mermaid.esm.min.mjs entry, sha256
|
|
92
|
+
462d6f73fc9833044bca6dc08e62e0ee83f5a2b09583f588f95d5fd91b1960ed) together
|
|
93
|
+
with its content-hash-named chunk files under
|
|
94
|
+
rust/crates/cairn-cli/dashboard-assets/static/chunks/mermaid.esm.min/ (the
|
|
95
|
+
entry's relative imports resolve there; the chunks are carried unmodified).
|
|
96
|
+
Licensed under the MIT License.
|