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
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.
In this repository13 other files it gives its agents.
- CLAUDE.mdCLAUDE.md
- octocode-brainstormingSkill
- octocode-chrome-devtoolsSkill
- octocode-documentationSkill
- octocode-graph-evalSkill
- octocode-mannequinSkill
- octocode-prompt-optimizerSkill
- octocode-researchSkill
- octocode-rfc-generatorSkill
- octocode-roastSkill
- octocode-scrapingSkill
- octocode-skillsSkill
- octocode-subagentSkill
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
- Very specific: line 3
Default agent guide for this repo.
- Distinctive: line 20
If dogfooding hurts, fix or record it — do not silently bypass.
- Very specific: line 41
All workspace packages (7).
- Very specific: line 94
Prefer node packages/octocode/out/octocode.js over global octocode / npx when validating monorepo changes.
- Very specific: line 156
All env/config loading flows through @octocodeai/config.
≈ “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.
Files
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.
| Need | Use | Not |
| Local code search / structure / files / content / LSP | Octocode MCP or node packages/octocode/out/octocode.js tools … — all local tools below | bare find / grep / rg / cat / ls |
| GitHub code, repos, PRs/commits, clone | same — all GitHub tools below | ad-hoc gh / raw API (except when Octocode is unavailable) |
| npm lookup | npmSearch | ad-hoc registry curls |
| Unified research | raw tools <name> invocation (CLI or MCP) | hand-rolled multi-tool scripts |
| Research / review / change flows | octocode-research skill | inventing search loops |
| Measure “did this help?” / keep-discard | octocode-graph-eval skill | vibe acceptance / editing graders to pass |
| Offload low-risk bulk to local Ollama | octocode-subagent (references/local-ollama.md) | cloud-only token burn / inventing Ollama loops |
| After a package change | rebuild → real CLI / MCP / skill path | claim 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.
| Package | npm name | What it is | Dig deeper |
packages/octocode-config | @octocodeai/config | Zero-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-core | Brain. 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-engine | Only Rust package (napi-rs) + TS LSP/security wrappers. Minify, ripgrep, AST structural search, secret detection, LSP pool. | ARCHITECTURE · LSP lifecycle |
packages/octocode-mcp | octocode-mcp | Thin MCP stdio server: lifecycle → security → tool registration → sanitized output. No business logic. | ARCHITECTURE · docs/OCTOCODE_MCP.md |
packages/octocode | octocode | CLI — 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-vscode | octocode-mcp-vscode | VS Code / multi-editor management extension: GitHub OAuth, MCP install into Cursor/Windsurf/etc., token sync. | package README |
packages/octocode-benchmark | @octocodeai/octocode-benchmark | Internal 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:
| Family | Tools | Role |
| GitHub | ghSearchCode · ghGetFileContent · ghViewRepoStructure · ghSearchRepos · ghSearchPullRequests · ghSearchIssues · ghSearchCommits · ghListReleases (opt-in: ENABLE_RELEASES) · ghSearchDiscussions (opt-in: ENABLE_DISCUSSIONS) · ghCloneRepo | Remote code/path search, file read, tree, repo discovery, PR search, issue search, commit history/compare, releases, discussions, clone (ENABLE_CLONE for clone) |
| Package | npmSearch | npm package lookup + source repo |
| Local | localSearchCode · localViewStructure · localFindFiles · localGetFileContent | Text (text/regex/AST), tree, find-by-meta, file read (ENABLE_LOCAL=false disables the family) |
| LSP | lspGetSemantics | definition, 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:fixCoverage 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 --schemePrefer 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 resolutionsAdds 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:
| Package | Role |
@octocodeai/octocode-tools-core | Brain / all tool runners |
@octocodeai/config | Zero-dep env + config loader |
@octocodeai/octocode-core | External schemas + system prompt (sibling repo) |
@octocodeai/octocode-engine | Rust/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 writingThree checks:
- Resolutions — root
package.jsonmust not haveworkspace:*for managed packages. Yarn rewrites these during publish and can produce wrong pinned versions in tarballs. - Publish package versions — publishable Octocode package versions and engine platform package versions must match the root
package.jsonversion. - Dependency alignment — every workspace package that pins a managed package (non-
workspace:*) must match the package's currentversionin 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 syncDocs and references
| Area | Links |
| Global | docs/OCTOCODE_MCP.md · docs/CONFIGURATION.md · docs/OCTOCODE_TOOLS.md · docs/SECURITY.md · docs/OCTOCODE_RESEARCH_MANIFEST.md · docs/ROUTING_EVIDENCE_POSITION_PAPER.md |
| CLI | OCTOCODE_CLI.md |
| Engine | LSP_SERVER_LIFECYCLE.md · SUPPORTED_LANGUAGES_AND_FEATURES.md |
| Benchmarks | BENCHMARK.md · README.md · SCORING.md |
| Context | docs/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 defaultpropagateOctocodeEnv({ cwd, trusted, env })— global + project.env→process.envparseEnv(text)·loadOctocoderc(home?)·PROTECTED_KEYS
Skills: ./octocode-config.mjs (injected at build). Packages: import { … } from '@octocodeai/config'.
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.

