cartotree 0.1.0 β 0.2.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/.claude-plugin/marketplace.json +11 -0
- package/.claude-plugin/plugin.json +12 -0
- package/LICENSE +20 -20
- package/README.md +246 -200
- package/bin/cartotree.js +162 -55
- package/hooks/hooks.json +14 -0
- package/package.json +45 -15
- package/skills/cartotree/SKILL.md +32 -0
- package/src/ai.js +112 -112
- package/src/atlas/cache.js +46 -0
- package/src/atlas/files.js +56 -0
- package/src/atlas/git.js +65 -0
- package/src/atlas/init.js +114 -0
- package/src/atlas/links.js +87 -0
- package/src/atlas/locate.js +218 -0
- package/src/atlas/mcp.js +106 -0
- package/src/atlas/peek.js +24 -0
- package/src/atlas/symbols.js +41 -0
- package/src/clipboard.js +10 -10
- package/src/config.js +25 -25
- package/src/exports.js +74 -65
- package/src/ignore.js +30 -30
- package/src/sync.js +29 -29
- package/src/tree.js +96 -96
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "cartotree",
|
|
3
|
+
"version": "0.2.0",
|
|
4
|
+
"description": "Find the right files with few tokens: local index for locate / peek / links, as MCP tools + a skill.",
|
|
5
|
+
"author": { "name": "kingluminance" },
|
|
6
|
+
"repository": "https://github.com/kingluminance/cartotree",
|
|
7
|
+
"license": "MIT",
|
|
8
|
+
"keywords": ["navigation", "search", "tokens", "codebase", "mcp"],
|
|
9
|
+
"mcpServers": {
|
|
10
|
+
"cartotree": { "command": "npx", "args": ["-y", "cartotree@latest", "mcp"] }
|
|
11
|
+
}
|
|
12
|
+
}
|
package/LICENSE
CHANGED
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
MIT License
|
|
2
|
-
|
|
3
|
-
Copyright (c) 2026 Lumina
|
|
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
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Lumina
|
|
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
21
|
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,200 +1,246 @@
|
|
|
1
|
-
# π² cartotree
|
|
2
|
-
|
|
3
|
-
> AI-friendly codebase mapping CLI β annotated directory trees that save tokens, not just space.
|
|
4
|
-
|
|
5
|
-
[](https://www.npmjs.com/package/cartotree)
|
|
6
|
-
[](./LICENSE)
|
|
7
|
-
|
|
8
|
-
---
|
|
9
|
-
|
|
10
|
-
## The Problem
|
|
11
|
-
|
|
12
|
-
When you paste your project structure into an AI assistant, two things happen:
|
|
13
|
-
|
|
14
|
-
1. **Token waste** β Raw `tree` output burns hundreds of tokens on ASCII box characters with zero semantic value.
|
|
15
|
-
2. **Hallucination** β AI has no idea what each folder *does*, so it guesses wrong.
|
|
16
|
-
|
|
17
|
-
## The Solution
|
|
18
|
-
|
|
19
|
-
cartotree generates a compact, annotated map of your codebase β folder descriptions, exported functions, and an AI-optimized serialization format that fits your architecture into a fraction of the tokens.
|
|
20
|
-
|
|
21
|
-
---
|
|
22
|
-
|
|
23
|
-
## Quick Start
|
|
24
|
-
|
|
25
|
-
```bash
|
|
26
|
-
npx cartotree
|
|
27
|
-
```
|
|
28
|
-
|
|
29
|
-
No install required.
|
|
30
|
-
|
|
31
|
-
---
|
|
32
|
-
|
|
33
|
-
## Output Formats
|
|
34
|
-
|
|
35
|
-
### Default β Annotated ASCII Tree
|
|
36
|
-
```
|
|
37
|
-
my-app/
|
|
38
|
-
βββ src/ # Core application source
|
|
39
|
-
β βββ components/ # Reusable UI components
|
|
40
|
-
β β βββ Button.tsx <Button, ButtonProps>
|
|
41
|
-
β β βββ Modal.tsx <Modal, useModal>
|
|
42
|
-
β βββ hooks/
|
|
43
|
-
β β βββ useAuth.ts <useAuth, useUser>
|
|
44
|
-
β βββ services/
|
|
45
|
-
β βββ api.ts <fetchUser, postData>
|
|
46
|
-
βββ package.json
|
|
47
|
-
```
|
|
48
|
-
|
|
49
|
-
### `--ai` β Token-Optimized Serialization
|
|
50
|
-
```
|
|
51
|
-
# cartotree fmt: name{desc}[children]<exports>
|
|
52
|
-
my-app{Core application source}[src{Core application source}[components{Reusable UI components}[Button.tsx<Button,ButtonProps>,Modal.tsx<Modal,useModal>],hooks[useAuth.ts<useAuth,useUser>],services[api.ts<fetchUser,postData>]],package.json]
|
|
53
|
-
```
|
|
54
|
-
|
|
55
|
-
### `--json` β JSON Format
|
|
56
|
-
```json
|
|
57
|
-
{
|
|
58
|
-
"my-app": {
|
|
59
|
-
"src": {
|
|
60
|
-
"_desc": "Core application source",
|
|
61
|
-
"components": {
|
|
62
|
-
"Button.tsx": ["Button", "ButtonProps"],
|
|
63
|
-
"Modal.tsx": ["Modal", "useModal"]
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
```
|
|
69
|
-
|
|
70
|
-
---
|
|
71
|
-
|
|
72
|
-
## Usage
|
|
73
|
-
|
|
74
|
-
```bash
|
|
75
|
-
# Default annotated ASCII tree
|
|
76
|
-
npx cartotree
|
|
77
|
-
|
|
78
|
-
# AI-optimized single-line serialization
|
|
79
|
-
npx cartotree --ai
|
|
80
|
-
|
|
81
|
-
# JSON format
|
|
82
|
-
npx cartotree --json
|
|
83
|
-
|
|
84
|
-
# Copy to clipboard (paste directly into AI)
|
|
85
|
-
npx cartotree --ai --copy
|
|
86
|
-
|
|
87
|
-
# Sync into CLAUDE.md / AGENTS.md
|
|
88
|
-
npx cartotree --ai --sync
|
|
89
|
-
|
|
90
|
-
# Sync into custom file
|
|
91
|
-
npx cartotree --sync .cursorrules
|
|
92
|
-
|
|
93
|
-
# Limit depth
|
|
94
|
-
npx cartotree --depth 2
|
|
95
|
-
|
|
96
|
-
# No depth limit
|
|
97
|
-
npx cartotree --full
|
|
98
|
-
|
|
99
|
-
# Exclude patterns
|
|
100
|
-
npx cartotree --exclude "tests,*.log"
|
|
101
|
-
|
|
102
|
-
# Disable export parsing
|
|
103
|
-
npx cartotree --no-exports
|
|
104
|
-
```
|
|
105
|
-
|
|
106
|
-
---
|
|
107
|
-
|
|
108
|
-
## Options
|
|
109
|
-
|
|
110
|
-
| Option | Default | Description |
|
|
111
|
-
|--------|---------|-------------|
|
|
112
|
-
| `--ai` | false | AI-optimized compact serialization |
|
|
113
|
-
| `--json` | false | JSON format |
|
|
114
|
-
| `--copy` | false | Copy output to clipboard |
|
|
115
|
-
| `--sync [file]` | CLAUDE.md | Inject into AI config file |
|
|
116
|
-
| `--depth <n>` | 3 | Max traversal depth |
|
|
117
|
-
| `--full` | false | No depth limit |
|
|
118
|
-
| `--exclude <patterns>` | β | Comma-separated exclude patterns |
|
|
119
|
-
| `--no-exports` | false | Disable export parsing |
|
|
120
|
-
|
|
121
|
-
---
|
|
122
|
-
|
|
123
|
-
## Configuration
|
|
124
|
-
|
|
125
|
-
Create `.cartotreerc` in your project root to set persistent defaults:
|
|
126
|
-
|
|
127
|
-
```json
|
|
128
|
-
{
|
|
129
|
-
"default": {
|
|
130
|
-
"ai": true,
|
|
131
|
-
"exports": false,
|
|
132
|
-
"depth": 3
|
|
133
|
-
}
|
|
134
|
-
}
|
|
135
|
-
```
|
|
136
|
-
|
|
137
|
-
Now `npx cartotree` automatically runs with `--ai --no-exports`.
|
|
138
|
-
|
|
139
|
-
---
|
|
140
|
-
|
|
141
|
-
## Folder Annotations
|
|
142
|
-
|
|
143
|
-
Add a `.folder.md` to any directory β the first line becomes the annotation:
|
|
144
|
-
|
|
145
|
-
```
|
|
146
|
-
# Reusable UI components
|
|
147
|
-
Atomic design system built with Radix UI primitives.
|
|
148
|
-
```
|
|
149
|
-
|
|
150
|
-
cartotree also falls back to the first line of `README.md` if no `.folder.md` exists.
|
|
151
|
-
|
|
152
|
-
---
|
|
153
|
-
|
|
154
|
-
## Ignoring Files
|
|
155
|
-
|
|
156
|
-
Create `.cartotreeignore` in your project root:
|
|
157
|
-
|
|
158
|
-
```
|
|
159
|
-
# .cartotreeignore
|
|
160
|
-
*.log
|
|
161
|
-
temp
|
|
162
|
-
coverage
|
|
163
|
-
.env*
|
|
164
|
-
```
|
|
165
|
-
|
|
166
|
-
`node_modules`, `.git`, `dist`, `build` are excluded by default.
|
|
167
|
-
|
|
168
|
-
---
|
|
169
|
-
|
|
170
|
-
## `--sync` Integration
|
|
171
|
-
|
|
172
|
-
Running `cartotree --sync` injects the tree between marker tags:
|
|
173
|
-
|
|
174
|
-
```html
|
|
175
|
-
<!-- CARTOTREE-START -->
|
|
176
|
-
(auto-updated on every sync)
|
|
177
|
-
<!-- CARTOTREE-END -->
|
|
178
|
-
```
|
|
179
|
-
|
|
180
|
-
Works with `CLAUDE.md`, `AGENTS.md`, `.cursorrules`, or any file.
|
|
181
|
-
|
|
182
|
-
---
|
|
183
|
-
|
|
184
|
-
## Export Parsing
|
|
185
|
-
|
|
186
|
-
cartotree reads your source files and surfaces exported symbols directly in the tree:
|
|
187
|
-
|
|
188
|
-
```
|
|
189
|
-
hooks/
|
|
190
|
-
βββ useAuth.ts <useAuth, useUser, AuthProvider>
|
|
191
|
-
```
|
|
192
|
-
|
|
193
|
-
Supports `.js`, `.ts`, `.jsx`, `.tsx`, `.mjs`, `.cjs`.
|
|
194
|
-
|
|
195
|
-
---
|
|
196
|
-
|
|
197
|
-
## License
|
|
198
|
-
MIT
|
|
199
|
-
|
|
200
|
-
---
|
|
1
|
+
# π² cartotree
|
|
2
|
+
|
|
3
|
+
> AI-friendly codebase mapping CLI β annotated directory trees that save tokens, not just space.
|
|
4
|
+
|
|
5
|
+
[](https://www.npmjs.com/package/cartotree)
|
|
6
|
+
[](./LICENSE)
|
|
7
|
+
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
## The Problem
|
|
11
|
+
|
|
12
|
+
When you paste your project structure into an AI assistant, two things happen:
|
|
13
|
+
|
|
14
|
+
1. **Token waste** β Raw `tree` output burns hundreds of tokens on ASCII box characters with zero semantic value.
|
|
15
|
+
2. **Hallucination** β AI has no idea what each folder *does*, so it guesses wrong.
|
|
16
|
+
|
|
17
|
+
## The Solution
|
|
18
|
+
|
|
19
|
+
cartotree generates a compact, annotated map of your codebase β folder descriptions, exported functions, and an AI-optimized serialization format that fits your architecture into a fraction of the tokens.
|
|
20
|
+
|
|
21
|
+
---
|
|
22
|
+
|
|
23
|
+
## Quick Start
|
|
24
|
+
|
|
25
|
+
```bash
|
|
26
|
+
npx cartotree
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
No install required.
|
|
30
|
+
|
|
31
|
+
---
|
|
32
|
+
|
|
33
|
+
## Output Formats
|
|
34
|
+
|
|
35
|
+
### Default β Annotated ASCII Tree
|
|
36
|
+
```
|
|
37
|
+
my-app/
|
|
38
|
+
βββ src/ # Core application source
|
|
39
|
+
β βββ components/ # Reusable UI components
|
|
40
|
+
β β βββ Button.tsx <Button, ButtonProps>
|
|
41
|
+
β β βββ Modal.tsx <Modal, useModal>
|
|
42
|
+
β βββ hooks/
|
|
43
|
+
β β βββ useAuth.ts <useAuth, useUser>
|
|
44
|
+
β βββ services/
|
|
45
|
+
β βββ api.ts <fetchUser, postData>
|
|
46
|
+
βββ package.json
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
### `--ai` β Token-Optimized Serialization
|
|
50
|
+
```
|
|
51
|
+
# cartotree fmt: name{desc}[children]<exports>
|
|
52
|
+
my-app{Core application source}[src{Core application source}[components{Reusable UI components}[Button.tsx<Button,ButtonProps>,Modal.tsx<Modal,useModal>],hooks[useAuth.ts<useAuth,useUser>],services[api.ts<fetchUser,postData>]],package.json]
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
### `--json` β JSON Format
|
|
56
|
+
```json
|
|
57
|
+
{
|
|
58
|
+
"my-app": {
|
|
59
|
+
"src": {
|
|
60
|
+
"_desc": "Core application source",
|
|
61
|
+
"components": {
|
|
62
|
+
"Button.tsx": ["Button", "ButtonProps"],
|
|
63
|
+
"Modal.tsx": ["Modal", "useModal"]
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
---
|
|
71
|
+
|
|
72
|
+
## Usage
|
|
73
|
+
|
|
74
|
+
```bash
|
|
75
|
+
# Default annotated ASCII tree
|
|
76
|
+
npx cartotree
|
|
77
|
+
|
|
78
|
+
# AI-optimized single-line serialization
|
|
79
|
+
npx cartotree --ai
|
|
80
|
+
|
|
81
|
+
# JSON format
|
|
82
|
+
npx cartotree --json
|
|
83
|
+
|
|
84
|
+
# Copy to clipboard (paste directly into AI)
|
|
85
|
+
npx cartotree --ai --copy
|
|
86
|
+
|
|
87
|
+
# Sync into CLAUDE.md / AGENTS.md
|
|
88
|
+
npx cartotree --ai --sync
|
|
89
|
+
|
|
90
|
+
# Sync into custom file
|
|
91
|
+
npx cartotree --sync .cursorrules
|
|
92
|
+
|
|
93
|
+
# Limit depth
|
|
94
|
+
npx cartotree --depth 2
|
|
95
|
+
|
|
96
|
+
# No depth limit
|
|
97
|
+
npx cartotree --full
|
|
98
|
+
|
|
99
|
+
# Exclude patterns
|
|
100
|
+
npx cartotree --exclude "tests,*.log"
|
|
101
|
+
|
|
102
|
+
# Disable export parsing
|
|
103
|
+
npx cartotree --no-exports
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
---
|
|
107
|
+
|
|
108
|
+
## Options
|
|
109
|
+
|
|
110
|
+
| Option | Default | Description |
|
|
111
|
+
|--------|---------|-------------|
|
|
112
|
+
| `--ai` | false | AI-optimized compact serialization |
|
|
113
|
+
| `--json` | false | JSON format |
|
|
114
|
+
| `--copy` | false | Copy output to clipboard |
|
|
115
|
+
| `--sync [file]` | CLAUDE.md | Inject into AI config file |
|
|
116
|
+
| `--depth <n>` | 3 | Max traversal depth |
|
|
117
|
+
| `--full` | false | No depth limit |
|
|
118
|
+
| `--exclude <patterns>` | β | Comma-separated exclude patterns |
|
|
119
|
+
| `--no-exports` | false | Disable export parsing |
|
|
120
|
+
|
|
121
|
+
---
|
|
122
|
+
|
|
123
|
+
## Configuration
|
|
124
|
+
|
|
125
|
+
Create `.cartotreerc` in your project root to set persistent defaults:
|
|
126
|
+
|
|
127
|
+
```json
|
|
128
|
+
{
|
|
129
|
+
"default": {
|
|
130
|
+
"ai": true,
|
|
131
|
+
"exports": false,
|
|
132
|
+
"depth": 3
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
```
|
|
136
|
+
|
|
137
|
+
Now `npx cartotree` automatically runs with `--ai --no-exports`.
|
|
138
|
+
|
|
139
|
+
---
|
|
140
|
+
|
|
141
|
+
## Folder Annotations
|
|
142
|
+
|
|
143
|
+
Add a `.folder.md` to any directory β the first line becomes the annotation:
|
|
144
|
+
|
|
145
|
+
```
|
|
146
|
+
# Reusable UI components
|
|
147
|
+
Atomic design system built with Radix UI primitives.
|
|
148
|
+
```
|
|
149
|
+
|
|
150
|
+
cartotree also falls back to the first line of `README.md` if no `.folder.md` exists.
|
|
151
|
+
|
|
152
|
+
---
|
|
153
|
+
|
|
154
|
+
## Ignoring Files
|
|
155
|
+
|
|
156
|
+
Create `.cartotreeignore` in your project root:
|
|
157
|
+
|
|
158
|
+
```
|
|
159
|
+
# .cartotreeignore
|
|
160
|
+
*.log
|
|
161
|
+
temp
|
|
162
|
+
coverage
|
|
163
|
+
.env*
|
|
164
|
+
```
|
|
165
|
+
|
|
166
|
+
`node_modules`, `.git`, `dist`, `build` are excluded by default.
|
|
167
|
+
|
|
168
|
+
---
|
|
169
|
+
|
|
170
|
+
## `--sync` Integration
|
|
171
|
+
|
|
172
|
+
Running `cartotree --sync` injects the tree between marker tags:
|
|
173
|
+
|
|
174
|
+
```html
|
|
175
|
+
<!-- CARTOTREE-START -->
|
|
176
|
+
(auto-updated on every sync)
|
|
177
|
+
<!-- CARTOTREE-END -->
|
|
178
|
+
```
|
|
179
|
+
|
|
180
|
+
Works with `CLAUDE.md`, `AGENTS.md`, `.cursorrules`, or any file.
|
|
181
|
+
|
|
182
|
+
---
|
|
183
|
+
|
|
184
|
+
## Export Parsing
|
|
185
|
+
|
|
186
|
+
cartotree reads your source files and surfaces exported symbols directly in the tree:
|
|
187
|
+
|
|
188
|
+
```
|
|
189
|
+
hooks/
|
|
190
|
+
βββ useAuth.ts <useAuth, useUser, AuthProvider>
|
|
191
|
+
```
|
|
192
|
+
|
|
193
|
+
Supports `.js`, `.ts`, `.jsx`, `.tsx`, `.mjs`, `.cjs`.
|
|
194
|
+
|
|
195
|
+
---
|
|
196
|
+
|
|
197
|
+
## License
|
|
198
|
+
MIT
|
|
199
|
+
|
|
200
|
+
---
|
|
201
|
+
|
|
202
|
+
## For AI agents: locate Β· peek Β· links
|
|
203
|
+
|
|
204
|
+
cartotree also works as a navigation layer for coding agents (Claude Code, Cursor, Codexβ¦):
|
|
205
|
+
it keeps a local index so the agent finds the right files **without dumping grep output or whole files** into context.
|
|
206
|
+
|
|
207
|
+
```bash
|
|
208
|
+
npx cartotree locate "abort JSONL stream on httpBatchStreamLink unsubscribe" # which files to open first
|
|
209
|
+
npx cartotree peek packages/client/src/links/httpBatchStreamLink.ts abort unsubscribe # only the matching lines
|
|
210
|
+
npx cartotree links httpBatchStreamLink # where a symbol is defined and called
|
|
211
|
+
npx cartotree links src/foo.ts # imports, importers, files usually changed with it (git)
|
|
212
|
+
```
|
|
213
|
+
|
|
214
|
+
### Set it up so your agent uses it automatically
|
|
215
|
+
|
|
216
|
+
```bash
|
|
217
|
+
npx cartotree init # skill + MCP server + SessionStart reminder (shows every change)
|
|
218
|
+
npx cartotree init --dry-run # preview only
|
|
219
|
+
```
|
|
220
|
+
|
|
221
|
+
Or as a Claude Code plugin:
|
|
222
|
+
|
|
223
|
+
```bash
|
|
224
|
+
claude plugin marketplace add kingluminance/cartotree
|
|
225
|
+
claude plugin install cartotree@cartotree
|
|
226
|
+
```
|
|
227
|
+
|
|
228
|
+
The MCP server (`npx cartotree mcp`) exposes `cartotree_locate`, `cartotree_peek` and `cartotree_links`.
|
|
229
|
+
After the first call the index stays in memory (~10 ms per lookup). An on-disk cache in `.cartotree/` is keyed by git HEAD and your uncommitted changes.
|
|
230
|
+
|
|
231
|
+
### How locate ranks files
|
|
232
|
+
|
|
233
|
+
BM25F over four fields of every source file: path words, exported names, code identifiers (scored per function so one matching function is not diluted by a long file) and **past commit messages that touched the file**. Plus light stemming, an import-neighbor boost, 1β2 evidence lines per result, a warning when the top results are close, and "usually changes with" from git co-change history. No LLM, no network.
|
|
234
|
+
|
|
235
|
+
### Benchmark
|
|
236
|
+
|
|
237
|
+
[deepseek-harness](https://github.com/deepseek-ai/deepseek-harness) (21,632 files), 30 real commit messages β "which files were changed?", Claude Haiku agent, compared with the same agent using only ls/find/grep:
|
|
238
|
+
|
|
239
|
+
| | grep only | cartotree (fast mode) |
|
|
240
|
+
|---|---|---|
|
|
241
|
+
| right file in top 3 | 13.5 / 15 | 14 / 15 |
|
|
242
|
+
| tool-output tokens | ~37k | ~7.5k (**β80%**) |
|
|
243
|
+
| total agent tokens | ~153k | ~100k (**β35%**) |
|
|
244
|
+
| time | ~130 s | ~45 s (**β66%**) |
|
|
245
|
+
|
|
246
|
+
Accuracy is on par with grep (Β±1 question across runs); the gain is cost and speed. Git history was cut off before the test commits to avoid leakage.
|