agentleFS
MuvonMuvon/octocode/AGENTS.md

octocode

AGENTS.md480 starsChanged 3 months agoApache-2.0View on GitHub

Rust CLI (v0.26.x) that indexes codebases into LanceDB vector stores, builds GraphRAG knowledge graphs, and serves AI assistants over MCP (stdin or HTTP). Stack: Rust + tokio + LanceDB + tree-sitter + octolib. All embedding/LLM/reranker providers live in octolib — never in this repo.

  • Reads credentials
  • Where files are headingNew AGENTS.md files have more rules about keeping secrets out of the code, and fewer about checking a change actually works.

    Of the AGENTS.md files we read, the 11,773 first seen in the last six months, against the older ones: the kind of rule that gained most share, and the kind that lost most. About files like this in general, not this one, and an estimate, since a kind is a pattern in the words.

The file

We split this AGENTS.md into the rules it gives an agent

6 rules. About 0 are common, 0 are distinctive, and 6 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.

  • 6

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  • could be automatic: a setting could enforce it
  1. Very specific:

    Run: cargo run -- index · RUST_LOG=debug cargo run -- search "query" · cargo run -- mcp --path .

    line 9
  2. Very specific:

    Every .rs file starts with the Apache 2.0 header (// Copyright <year> Muvon Un Limited + license block).

    line 38
  3. Very specific:

    Call octolib APIs directly from commands — go through src/embedding/mod.rs / src/llm/mod.rs

    line 69
  4. Very specific:

    Use --release during development

    line 72
  5. Very specific:

    Commit .rs files without the Apache header · commit .env or .mcpregistry_* token files

    line 73
  6. Very specific:

    Add a config field without a matching entry in config-templates/default.toml

    line 74

≈ “Common” is an estimate: at least 1 in 5 of the 16,595 AGENTS.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.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
AGENTS.md

Octocode — AGENTS.md

Rust CLI (v0.26.x) that indexes codebases into LanceDB vector stores, builds GraphRAG knowledge graphs, and serves AI assistants over MCP (stdin or HTTP). Stack: Rust + tokio + LanceDB + tree-sitter + octolib. All embedding/LLM/reranker providers live in octolib — never in this repo.

Commands

  • Setup: make setup (clippy, rustfmt, cross-targets) · pre-commit install (fmt/clippy/check hooks) · protoc required for full-feature builds
  • Fast dev build — skips local ONNX model compilation: cargo build --no-default-features · Full: cargo build
  • Run: cargo run -- index · RUST_LOG=debug cargo run -- search "query" · cargo run -- mcp --path . (add --bind 0.0.0.0:12345, --with-lsp rust-analyzer, or --multi/--auto for multi-repo)
  • Fast checks: cargo check --no-default-features --message-format=short · cargo clippy --no-default-features
  • Single test: cargo test --all-features indexer::graphrag::builder_tests::<name>
  • Full local gate: make ci-quick (fmt --check + clippy -D warnings + cargo test)

Where to look

TaskStart here
Add CLI commandsrc/commands/{cmd}.rs + mod/pub use in src/commands/mod.rs + variant in main.rs; dispatch lives in TWO places — early return before Store::new() if the command needs no store, else the final match (storeless arms there are unreachable!())
Add/change configconfig-templates/default.toml (single source of truth; embedded) + struct in src/config.rs + src/config/migrations.rs for versioned migrations
Add languagesrc/indexer/languages/{lang}.rs + sibling {lang}_test.rs + register in get_language() in languages/mod.rs + tree-sitter crate in Cargo.toml
Add MCP toolsrc/mcp/server.rs (router) — existing providers: semantic_code.rs, structural.rs, graphrag.rs, lsp/provider.rs, multi.rs
Search relevancesrc/indexer/search.rs pipeline → src/reranker.rs → src/reasoning.rs (LLM re-rank) → src/store/weighted_rrf.rs (fusion)
Structural searchengine: src/grep.rs (ast-grep) · CLI: src/commands/grep.rs
GraphRAGsrc/indexer/graphrag/ (builder.rs, symbols.rs, ai.rs, relationships.rs, runtime.rs) · storage: src/store/graphrag.rs · CLI: src/commands/graphrag.rs
Store internalssrc/store/mod.rs (block types: code/text/document/commit) · table_ops.rs · batch_converter.rs · auto index tuning: vector_optimizer.rs
Branch delta indexessrc/indexer/branch.rs + src/commands/branch.rs
Commit history indexingsrc/indexer/commits/ + src/indexer/git_utils.rs
Markdown/docs indexingsrc/indexer/markdown_processor.rs
AI commit/review/releasesrc/commands/{commit,review,release}.rs — git-heavy, shell out to git
EditorConfig formattersrc/commands/format/
Paths, locks, statesrc/storage.rs (per-project hash dir) · src/lock.rs (stale-lock detection) · src/state.rs
Embedding/LLM callsonly via wrappers src/embedding/mod.rs and src/llm/mod.rs

Conventions

  • Tests live in sibling files: foo_tests.rs (languages: foo_test.rs), declared #[cfg(test)] mod foo_tests; — coverage excludes them by (_tests?\.rs|/tests\.rs)$
  • rustfmt hard_tabs = true — tabs, never spaces, in .rs
  • Every .rs file starts with the Apache 2.0 header (// Copyright <year> Muvon Un Limited + license block); bump the year when modifying
  • Models are always "provider:model" (e.g. voyage:voyage-code-3, openrouter:openai/gpt-4o-mini)
  • Config::default() loads the embedded template — keep Default impls and config-templates/default.toml in sync; never introduce a third value elsewhere
  • MCP server code never uses println!/eprintln! — stdout is the protocol; log files-only via src/mcp/logging.rs
  • MCP tool failures return a CallToolResult with is_error = true, never Err (see src/mcp/server.rs)
  • Gate fastembed/huggingface code behind #[cfg(feature = "...")] with an Err(...) fallback for the off case
  • Async-first tokio; #[derive(Clone)] for structs shared across async contexts; no .unwrap() outside tests
  • One codebase for Linux/macOS/Windows — CI tests all three plus musl static builds; no platform-specific forks

Done

  • cargo fmt --all -- --check
  • cargo clippy --all-targets --all-features -- -D warnings
  • cargo check --all-targets --all-features
  • cargo test --all-features

Gotchas

  • --no-default-features is the fast dev loop; CI and the Done gate run --all-features (local ONNX models, needs protoc)
  • Linux full builds need ORT_LIB_LOCATION pointing at a static ONNX Runtime; Windows needs RUSTFLAGS=-C target-feature=-crt-static (see .github/workflows/ci.yml)
  • time is pinned =0.3.47 (E0119 vs tantivy-common) and esaxx-rs is a SHA-pinned [patch.crates-io] fork (MSVC /MT vs /MD) — both look like cruft but are load-bearing
  • Index data lives outside the repo (~/.local/share/octocode/<project-hash>/); changing embedding dimensions auto-drops tables and wipes the index
  • index.require_git = true by default — indexing non-git dirs fails; mcp --no-git opts out
  • File walking respects .gitignore AND .noindex
  • The MCP server serves the existing index read-only unless index.mcp_index = true
  • In TOML config files, scalars must precede nested table headers (e.g. [search.reranker]) or they are silently ignored
  • Remote AI features need provider API keys (OPENROUTER_API_KEY, VOYAGE_API_KEY, …); .env is auto-loaded

Never

  • Implement embedding/LLM/reranker providers here — they belong in octolib
  • Call octolib APIs directly from commands — go through src/embedding/mod.rs / src/llm/mod.rs
  • Open LanceDB tables or create vector indexes manually; hardcode dimensions, partitions, or nprobes — Store + vector_optimizer.rs own this
  • Print to stdout/stderr in MCP server code
  • Use --release during development
  • Commit .rs files without the Apache header · commit .env or .mcpregistry_* token files
  • Add a config field without a matching entry in config-templates/default.toml

References

  • doc/ARCHITECTURE.md — module boundaries; read before cross-cutting changes
  • doc/CONFIGURATION.md — every option · doc/COMMANDS.md — full CLI surface
  • doc/MCP_INTEGRATION.md / doc/MCP_CLIENTS.md / doc/LSP_INTEGRATION.md — server modes, clients, LSP tools
  • doc/RELEASE_MANAGEMENT.md — before touching src/commands/release.rs or publishing (make release, make git-tag)
  • doc/API_KEYS.md — provider keys · benchmark/ — retrieval benchmark (matrix runner, ground truth)

Download now (ZIP)

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
What did you use it for? e.g. Reviewing pull requests in a Rails app

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.