codeseek
CLAUDE.md770 starsChanged 6 months agoMITView on GitHub
The process binds to exactly one repository at startup via --repo-path. StorageManager.current_repo tracks this. try_bind_repo() rejects attempts to switch repos. The HTTP API no longer accepts repo_path/project_dir parameters — all endpoints use the bound repo.
The file
We split this CLAUDE.md into the rules it gives an agent
2 rules. About 0 are common, 0 are distinctive, and 2 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈0
Distinctive · estimate
This author's own choices. Worth a look.
2
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 88
All handlers use State<Arc<StorageManager>> for shared state.
- Very specific: line 114
Before any Grep/Glob/Bash for code search, try CodeSeek tools first.
≈ “Common” is an estimate: at least 1 in 5 of the 12,729 CLAUDE.md files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
CLAUDE.md
Build & Test
# Enter Rust project directory
cd rust-core
# Build
cargo build
# Run tests
cargo test
# Run specific test
cargo test test_build_graph_functionality
# Run with output
cargo test -- --nocapture
# Start server (single repo per process, required)
cargo run -- server --repo-path /path/to/repo
# Start server with custom address
cargo run -- server --repo-path /path/to/repo --address 0.0.0.0:8080
# CLI vectorize mode
cargo run -- vectorize --path /path/to/code --collection my-collection --db-uri data/lancedbArchitecture
src/
├── main.rs # CLI entry: server and vectorize subcommands
├── lib.rs # Top-level module re-exports
├── config.rs # Config loading from ~/.codeseek/config/config.toml
├── cli/ # CLI args (clap), runner, analyze, vectorize commands
├── codegraph/ # AST parsing + graph data structures
│ ├── graph.rs # Flat CodeGraph (HashMap-based)
│ ├── types.rs # PetCodeGraph, EntityGraph, FileIndex, SnippetIndex
│ ├── parser.rs # CodeParser: tree-sitter parsing with FileIndex/SnippetIndex
│ └── treesitter/ # Language parsers (Rust/Python/JS/TS/Java/C++/Go)
├── services/ # High-level analysis services
│ ├── analyzer.rs # CodeAnalyzer: call chains, cycles, complexity, reports
│ ├── embedding_service.rs # LanceDB vector embeddings + SQLite cache + semantic search
│ └── snippet_service.rs # Code snippet extraction + caching
├── storage/ # Graph persistence and file watching
│ ├── persistence.rs # Save/load graphs (JSON + binary), project registry
│ ├── petgraph_storage.rs # PetCodeGraph serde (JSON, bincode, GraphML, GEXF)
│ ├── incremental.rs # MD5-based incremental file change detection
│ └── mod.rs # StorageManager: central hub (graph, watchers, tasks, config, current_repo)
├── http/ # Axum HTTP server
│ ├── server.rs # CodeSeekServer: startup init + router
│ ├── handlers/ # Request handlers (query, search, investigate, embed)
│ └── models/ # Request/response types + ApiResponse<T>
└── config/ # Config file templateCore Design: Single Repo Per Process
The process binds to exactly one repository at startup via --repo-path. StorageManager.current_repo tracks this. try_bind_repo() rejects attempts to switch repos. The HTTP API no longer accepts repo_path/project_dir parameters — all endpoints use the bound repo.
Key Types
StorageManager— Central state: in-memory graph, persistence, file watchers, embedding tasks, config, current repo bindingPetCodeGraph— petgraphDiGraph<FunctionInfo, CallRelation>with query methods (get_callers,get_callees,find_functions_by_name,find_functions_by_file)CodeAnalyzer— WrapsCodeParser, runs full directory analysis, provides analysis methodsCodeSeekServer— Axum server;start()auto-inits (load/analyze graph + embed + watch) before binding portEmbeddingService— LanceDB-backed; per-repo tables named{last_dir}_{md5(repo_path)}; batch embedding with SQLite cache; incremental viaprojects.jsonfile hashesPersistenceManager— File-based graph persistence in.codegraph_db/{project_id}/
HTTP API
| Method | Path | Description |
| GET | /health | Health check |
| GET | /status | Current repo status (path, functions, files, embedding state) |
| POST | /query_call_graph | Query call graph by file/function name |
| POST | /query_code_snippet | Extract code snippet with line ranges |
| POST | /query_code_skeleton | Batch skeleton extraction from file paths |
| POST | /query_hierarchical_graph | Hierarchical call tree with depth limit |
| POST | /investigate_repo | Top-15 functions by out-degree, directory tree, file skeletons |
| POST | /semantic_search | Vector-based semantic code search (uses bound repo) |
| POST | /query_indexing_status | Embedding indexing status (uses bound repo) |
| GET | / and /draw_call_graph | ECharts call graph visualization |
All handlers use State<Arc<StorageManager>> for shared state. Response type is Json<ApiResponse<T>> where ApiResponse has success: bool and data: T.
Configuration
Config file at ~/.codeseek/config/config.toml. Key sections:
[http]—server_port,codebase_port(default 12800)[codebase]—enable_embedding,embedding_db_uri,graph_db_uri[codebase.embedding]—model,api_token,api_base_url,dimensions
File Watching
setup_watcher() uses notify crate with 20-second debounce. On file changes, re-runs perform_analysis and triggers embedding rebuild. Watchers tracked in StorageManager.watchers: HashMap<String, RecommendedWatcher> keyed by project_id (MD5 of repo path).
Important Notes
perform_analysisruns intokio::task::spawn_blocking(CPU-heavy tree-sitter parsing)- Embedding builds run in background
tokio::spawntasks;vector_tasks: HashSet<String>prevents duplicate builds - Project IDs are
format!("{:x}", md5::compute(repo_path)) - LanceDB collection names:
format!("{}_{:x}", last_dir_name, md5(repo_path)) - Tree-sitter is linked as a system library (see
build.rs) - Storage modes:
Json,Binary,Both— configured via--storage-modeCLI flag
<!-- CODESEEK_INJECTION -->Code exploration: use CodeSeek MCP tools first
Before any Grep/Glob/Bash for code search, try CodeSeek tools first. They give you AST-verified definitions with signatures and line numbers.
Tool priority (use in this order):
- codeseek_search("query") — FIRST for finding code by name or behavior
- codeseek_callers("fn") — REQUIRED before modifying any function
- codeseek_callees("fn") — to understand internal dependencies
- codeseek_callgraph("fn", 2) — to explore full calling context with depth
- Grep — ONLY for exact strings (error messages, UUIDs, log formats)
- Glob — ONLY when you already know the exact filename pattern
<!-- /CODESEEK_INJECTION -->Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

