agentleFS
bgauryybgauryy/octocode/AGENTS.md

octocode

AGENTS.md947 starsChanged 3 months agoMITView on GitHub

Default agent guide for this repo. Internals: each package’s ARCHITECTURE.md when present. This monorepo is the platform. Use what we ship — do not reinvent with host defaults. If dogfooding hurts, fix or record it — do not silently bypass. Method: Plan → TDD → yarn workspace <pkg> test → yarn lint → verify. No backward compat by default — refactor freely; add shims only when asked. Access: packages/*/src/, tests/, docs/ ✅ · *.json, *.config.*, Cargo.toml, scripts/ ⚠️ ask ·…

  • Reads credentials

The file

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

5 rules. About 0 are common, 1 is distinctive, and 4 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈1

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 4

    Very specific

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

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    Default agent guide for this repo.

    line 3
  2. Distinctive:

    If dogfooding hurts, fix or record it — do not silently bypass.

    line 20
  3. Very specific:

    All workspace packages (7).

    line 41
  4. Very specific:

    Prefer node packages/octocode/out/octocode.js over global octocode / npx when validating monorepo changes.

    line 94
  5. Very specific:

    All env/config loading flows through @octocodeai/config.

    line 156

≈ “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

AGENTS.md — Octocode Monorepo

Default agent guide for this repo. Internals: each package’s ARCHITECTURE.md when present.

Dogfood

This monorepo is the platform. Use what we ship — do not reinvent with host defaults.

NeedUseNot
Local code search / structure / files / content / LSPOctocode MCP or node packages/octocode/out/octocode.js tools … — all local tools belowbare find / grep / rg / cat / ls
GitHub code, repos, PRs/commits, clonesame — all GitHub tools belowad-hoc gh / raw API (except when Octocode is unavailable)
npm lookupnpmSearchad-hoc registry curls
Unified researchraw tools <name> invocation (CLI or MCP)hand-rolled multi-tool scripts
Research / review / change flowsoctocode-research skillinventing search loops
Measure “did this help?” / keep-discardoctocode-graph-eval skillvibe acceptance / editing graders to pass
Offload low-risk bulk to local Ollamaoctocode-subagent (references/local-ollama.md)cloud-only token burn / inventing Ollama loops
After a package changerebuild → real CLI / MCP / skill pathclaim done from compile alone

If dogfooding hurts, fix or record it — do not silently bypass.

Method: Plan → TDD → yarn workspace <pkg> test → yarn lint → verify. No backward compat by default — refactor freely; add shims only when asked.

Access: packages/*/src/, tests/, docs/ ✅ · *.json, *.config.*, Cargo.toml, scripts/ ⚠️ ask · .env*, node_modules/, dist/, out/, target/ ❌

Architecture

 INTERFACES   octocode-mcp (stdio MCP)   octocode (CLI)   octocode-vscode (VS Code)
                    └─────────────────────┴── depend on ──┐
 BRAIN         @octocodeai/octocode-tools-core  (all tool execution logic)
                    ├── metadata ──▶  @octocodeai/octocode-core  (external: schemas, descriptions, system prompt)
                    ├── native   ──▶  @octocodeai/octocode-engine  (Rust/napi: search, minify, LSP, secrets)
                    └── config   ──▶  @octocodeai/config           (env/config loader — zero-dep, single source)

Logic lives in tools-core / octocode-core / engine. Interface packages only register, render, configure. Never duplicate getOctocodeHome or .env parsing — use @octocodeai/config.

Packages

All workspace packages (7). Prefer package ARCHITECTURE.md / AGENTS.md / docs/ over guessing.

Packagenpm nameWhat it isDig deeper
packages/octocode-config@octocodeai/configZero-dep env + config loader — single source for getOctocodeHome, parseEnv, loadOctocodeEnv, propagateOctocodeEnv, loadOctocoderc, PROTECTED_KEYS. Used by every package (workspace:*) and injected into skill scripts as octocode-config.mjs. CLI: npx @octocodeai/config [--keys|--check KEY].package src/
packages/octocode-tools-core@octocodeai/octocode-tools-coreBrain. All tool runners, GitHub/Octokit client, security, providers, credentials, session, config. Registry: src/tools/toolConfig.ts. Delegates home/env to @octocodeai/config; native work to engine.ARCHITECTURE
packages/octocode-engine@octocodeai/octocode-engineOnly Rust package (napi-rs) + TS LSP/security wrappers. Minify, ripgrep, AST structural search, secret detection, LSP pool.ARCHITECTURE · LSP lifecycle
packages/octocode-mcpoctocode-mcpThin MCP stdio server: lifecycle → security → tool registration → sanitized output. No business logic.ARCHITECTURE · docs/OCTOCODE_MCP.md
packages/octocodeoctocodeCLI — same tool runners as MCP via raw tools <name>, plus install/auth/MCP-marketplace, skill, context, lsp-server. Prefer node packages/octocode/out/octocode.js in this monorepo.ARCHITECTURE · CLI
packages/octocode-vscodeoctocode-mcp-vscodeVS Code / multi-editor management extension: GitHub OAuth, MCP install into Cursor/Windsurf/etc., token sync.package README
packages/octocode-benchmark@octocodeai/octocode-benchmarkInternal benchmarks/evals — head-to-head tool comparisons (octocode vs gh / gh+rtk / ast-grep), VRPT scoring.BENCHMARK

External (not in this workspace): @octocodeai/octocode-core (sibling octocode-mcp-host) — single source for tool descriptions, schemas, and system prompt text. Never hand-write tool guidance in interface packages.

Tools

Full field-level reference: docs/OCTOCODE_TOOLS.md. Live catalog: $OCTO tools --json (schemas: $OCTO tools <name> --scheme).

Always-on (12) — dogfood these via MCP or local CLI:

FamilyToolsRole
GitHubghSearchCode · ghGetFileContent · ghViewRepoStructure · ghSearchRepos · ghSearchPullRequests · ghSearchIssues · ghSearchCommits · ghListReleases (opt-in: ENABLE_RELEASES) · ghSearchDiscussions (opt-in: ENABLE_DISCUSSIONS) · ghCloneRepoRemote code/path search, file read, tree, repo discovery, PR search, issue search, commit history/compare, releases, discussions, clone (ENABLE_CLONE for clone)
PackagenpmSearchnpm package lookup + source repo
LocallocalSearchCode · localViewStructure · localFindFiles · localGetFileContentText (text/regex/AST), tree, find-by-meta, file read (ENABLE_LOCAL=false disables the family)
LSPlspGetSemanticsdefinition, references, callers/callees, symbols, types, diagnostics, …

Evidence: a text/code search hit is a candidate, not proof — confirm reachability with lspGetSemantics (references/callers) before a delete claim. Do not treat search relevance ranking as proof.

Build and local run

yarn build · yarn test · yarn lint · yarn typecheck · yarn verify
yarn workspace <pkg-name> <script>
yarn build:native:all · yarn platforms:check
yarn deps:dedupe · yarn deps:dedupe:fix

Coverage target 90% (Vitest + v8). Rust: yarn workspace @octocodeai/octocode-engine test:rust.

Local end-to-end (when changing engine, tools-core, or CLI):

yarn workspace @octocodeai/octocode-engine build:dev
yarn workspace @octocodeai/octocode-tools-core build
yarn workspace octocode build:dev            # also: yarn workspace octocode-mcp build:dev
OCTO='node packages/octocode/out/octocode.js'
$OCTO --help
$OCTO context --compact
$OCTO tools --json
$OCTO tools localSearchCode lspGetSemantics --scheme

Prefer node packages/octocode/out/octocode.js over global octocode / npx when validating monorepo changes. After engine or tools-core edits: rebuild the package, then yarn workspace octocode build:dev. build:dev skips clean + lint; engine uses debug (not --release).

Dev setup and publish guard

See scripts/README.md for the script catalog. Use the root scripts as the source of truth; do not re-add package-local version sync helpers.

yarn devScript — local dev: resolve internal packages from workspace

yarn devScript                         # adds workspace:* to root resolutions
yarn install                           # apply resolutions

Adds the internal packages and octocode-engine platform packages to the resolutions field in the root package.json so Yarn uses the local build for every consumer, including transitive ones:

PackageRole
@octocodeai/octocode-tools-coreBrain / all tool runners
@octocodeai/configZero-dep env + config loader
@octocodeai/octocode-coreExternal schemas + system prompt (sibling repo)
@octocodeai/octocode-engineRust/napi engine
@octocodeai/octocode-engine-*Platform-native engine packages from packages/octocode-engine/npm/*

Script: scripts/dev-setup.mjs. Idempotent — safe to re-run.

scripts/prepublish.mjs — publish prep: remove resolutions + align versions

Runs automatically as part of yarn prepublish, followed by the shared final guard at packages/octocode/scripts/check-no-workspace-protocol.mjs and readme:sync. Also callable directly:

node ./scripts/prepublish.mjs             # check only — exit 1 if issues found
node ./scripts/prepublish.mjs --fix       # remove workspace:* resolutions + align package/dependency versions
node ./scripts/prepublish.mjs --dry-run   # preview fixes without writing

Three checks:

  1. Resolutions — root package.json must not have workspace:* for managed packages. Yarn rewrites these during publish and can produce wrong pinned versions in tarballs.
  2. Publish package versions — publishable Octocode package versions and engine platform package versions must match the root package.json version.
  3. Dependency alignment — every workspace package that pins a managed package (non-workspace:*) must match the package's current version in the repo (written as ^<version> or exact). Packages not in this workspace (e.g. @octocodeai/octocode-core) are skipped.

Typical flow before publishing any package:

node ./scripts/prepublish.mjs --fix   # remove dev resolutions + align versions
yarn install                          # update lockfile
yarn prepublish                       # runs prepublish + shared final guard + readme sync

Docs and references

AreaLinks
Globaldocs/OCTOCODE_MCP.md · docs/CONFIGURATION.md · docs/OCTOCODE_TOOLS.md · docs/SECURITY.md · docs/OCTOCODE_RESEARCH_MANIFEST.md · docs/ROUTING_EVIDENCE_POSITION_PAPER.md
CLIOCTOCODE_CLI.md
EngineLSP_SERVER_LIFECYCLE.md · SUPPORTED_LANGUAGES_AND_FEATURES.md
BenchmarksBENCHMARK.md · README.md · SCORING.md
Contextdocs/context/ — SEARCH_GUIDE · LSP_GUIDE · AGENT_RESEARCH_WORKFLOWS · RUST_BEST_PRACTICES
Skills (repo)skills/ — linked into .agents/skills/; all octocode-* skills dogfood from here

Config / env — single source

All env/config loading flows through @octocodeai/config. Never reimplement:

  • getOctocodeHome(env?) — OCTOCODE_HOME → platform default
  • propagateOctocodeEnv({ cwd, trusted, env }) — global + project .env → process.env
  • parseEnv(text) · loadOctocoderc(home?) · PROTECTED_KEYS

Skills: ./octocode-config.mjs (injected at build). Packages: import { … } from '@octocodeai/config'.

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.