Folder Index
Maintain a lightweight index at ~/.config/folder-index.json to know where important things are without rescanning.
{
"folders": [
{"path": "/Users/alex/projects/webapp", "type": "project", "note": "Main client project"}
]
}
When user asks "where is X" or "find my project Y", check the index first. If not found, do targeted discovery then offer to add the result.
Discovery
When asked to find or index folders:
- Scan likely locations: ~/projects, ~/Documents, ~/code, ~/dev, ~/work
- Detect projects by markers: .git, package.json, pubspec.yaml, Cargo.toml, go.mod, pyproject.toml, *.sln
- Stop at first marker (don't recurse into node_modules, vendor, build)
- Propose what was found, don't auto-add: "Found 8 projects in ~/code. Add to index?"
Path Security
- Canonicalize paths (resolve
~, .., symlinks) before any operation
- Reject system paths: /, /etc, /var, /usr, /System, /Library, C:\Windows, C:\Program Files
- Skip symlinks during traversal, report them separately
Destructive Operations
- Use OS trash instead of permanent delete
- State recoverability: "node_modules: recoverable with npm install"
- Build artifacts safe to delete: node_modules, pycache, .gradle, build/, target/, Pods/, .next/
Platform Quirks
- macOS: .DS_Store alone = effectively empty. Treat .app as single item.
- Windows: Paths >260 chars need
\\?\ prefix.
- Network drives: Warn before bulk ops — may be slow or offline.
1---2name: folders3description: Index important directories and perform safe folder operations with proper security checks.4---5
6## Folder Index
7
8Maintain a lightweight index at `~/.config/folder-index.json` to know where important things are without rescanning.
9
10```json
11{
12 "folders": [
13 {"path": "/Users/alex/projects/webapp", "type": "project", "note": "Main client project"}
14 ]
15}
16```
17
18When user asks "where is X" or "find my project Y", check the index first. If not found, do targeted discovery then offer to add the result.
19
20## Discovery
21
22When asked to find or index folders:
23- Scan likely locations: ~/projects, ~/Documents, ~/code, ~/dev, ~/work
24- Detect projects by markers: .git, package.json, pubspec.yaml, Cargo.toml, go.mod, pyproject.toml, *.sln
25- Stop at first marker (don't recurse into node_modules, vendor, build)
26- Propose what was found, don't auto-add: "Found 8 projects in ~/code. Add to index?"
27
28## Path Security
29
30- Canonicalize paths (resolve `~`, `..`, symlinks) before any operation
31- Reject system paths: /, /etc, /var, /usr, /System, /Library, C:\Windows, C:\Program Files
32- Skip symlinks during traversal, report them separately
33
34## Destructive Operations
35
36- Use OS trash instead of permanent delete
37- State recoverability: "node_modules: recoverable with npm install"
38- Build artifacts safe to delete: node_modules, __pycache__, .gradle, build/, target/, Pods/, .next/
39
40## Platform Quirks
41
42- **macOS:** .DS_Store alone = effectively empty. Treat .app as single item.
43- **Windows:** Paths >260 chars need `\\?\` prefix.
44- **Network drives:** Warn before bulk ops — may be slow or offline.