Skip to content
nguyenyouPublic

About

Scala code intelligence for coding agents. Zero Build Server. Zero Compilation. Just answers.

Topics

Resources

Stars

112 stars

Watchers

3 watching

Forks

Repository files navigation

Scalex — Scala code intelligence for coding agents
Grep knows text. Scalex knows Scala.
Think grep, but it understands Scala's AST — so it finds symbols, not just strings.

Scalex helps coding agents find definitions, explore types, and locate reference candidates in Git-tracked Scala 2, Scala 3, and Java source. It parses code directly, so you can explore a repository without compiling it or starting a build server.

Install the plugin, open a project, and ask:

Use Scalex to explain how requests move through this codebase. Show me the main types and the files to read next.

Install · Upgrade · Try it · Command reference · Contribute

Why Scalex?

  • Start with source. Explore unfamiliar repositories even when their builds aren't set up.
  • Get useful context in one query. explain brings together a type's definition, documentation, members, and implementations.
  • Follow the structure. Navigate packages, inheritance, annotations, and method bodies with names and locations attached.
  • Keep agent output manageable. Use JSON, result limits, and batch queries to fit the task.
  • Leave no process running. A native executable and a per-repository cache; no daemon to manage.

See it in action:

scalex-demo.mp4

Install

You need Git and a supported platform: macOS Apple Silicon, macOS Intel, or Linux x64. The plugin includes an agent skill and a bootstrap script that downloads the native binary on first use and verifies its SHA-256 checksum. No JVM is needed to run that binary.

Codex CLI and desktop

Run in your terminal:

codex plugin marketplace add nguyenyou/scalex
codex plugin add scalex@scalex-marketplace

Start a new Codex CLI session or desktop task, then ask Codex to use Scalex.

Use a Codex CLI that supports codex plugin commands. Scalex is distributed through this repository's marketplace. For plugin setup details, see the Codex plugin documentation.

Claude Code

Run in your terminal:

claude plugin marketplace add nguyenyou/scalex
claude plugin install scalex@scalex-marketplace

Start a new Claude Code session, or run /reload-plugins in an open one, then ask Claude to use Scalex.

Other coding agents

Copy the shared skill into your agent's skill directory:

git clone --depth 1 https://github.com/nguyenyou/scalex.git
cp -R scalex/plugins/scalex/skills/scalex /path/to/your/agent/skills/

The folder includes the skill, command reference, and binary bootstrap. Follow your agent's instructions for loading new skills.

Upgrade

Updating the plugin gives your agent the new skill and bootstrap. On the next use, the bootstrap downloads the pinned Scalex release, checks its SHA-256, and caches it alongside older versions. Publishing a GitHub release alone does not update an already-installed bootstrap.

Codex

For the Git marketplace installed above, run in your terminal:

codex plugin marketplace upgrade scalex-marketplace
codex plugin add scalex@scalex-marketplace

The first command refreshes the Git marketplace snapshot; the second installs the plugin from that refreshed source. Start a new CLI session or desktop task afterward. If the desktop app still shows the old skill, restart it.

For a marketplace pointing to a local directory, update that checkout instead and restart the desktop app. marketplace upgrade refreshes configured Git marketplaces. Use codex plugin marketplace list to inspect your configured sources.

Claude Code

Run in your terminal:

claude plugin marketplace update scalex-marketplace
claude plugin update scalex@scalex-marketplace

Start a new Claude Code session, or run /reload-plugins in an open one, to apply the update. If you installed at project or local scope, add --scope project or --scope local to the second command to match that installation.

Copied skills

Pull the latest source and copy the skill folder into your agent's skill directory again. Reload the agent's skills or start a new session.

Try it

Ask your agent questions like:

  • “Where is UserService defined, and what implements it?”
  • “Show me the body of findUser and the tests that mention it.”
  • “What declarations changed since main?”

Or try exploring an open-source project:

Scala 3 compiler

git clone --depth 1 https://github.com/scala/scala3.git

Use Scalex to explore how the Scala 3 compiler turns source code into bytecode. Start with a short overview, then show me the entry points.

Scala.js

git clone --depth 1 https://github.com/scala-js/scala-js.git

Use Scalex to explore how Scala.js turns Scala code into JavaScript. Start with a short overview, then show me the entry points.

CLI examples

The plugin invokes its bundled scripts/scalex-cli; it does not add a scalex command to your PATH. The examples below use scalex as shorthand for that script or a separately installed binary. Run them from the repository you want to explore, or add -w /path/to/repo.

# Find a starting point
scalex overview --concise
scalex search Service --kind trait --limit 10

# Understand a type and read its implementation
scalex explain UserService --brief
scalex members UserService
scalex body findUser --in UserServiceLive

# Explore relationships and changes
scalex impl UserService
scalex refs UserService --count
scalex diff main

# Find test declarations and test-file mentions
scalex tests
scalex coverage UserService

For example, invoke the bundled script directly with:

bash /absolute/path/to/scalex/scripts/scalex-cli def UserService -w /path/to/repo

More to explore

Task Commands
Find symbols and files search, def, file, symbols, annotated
Read and understand code explain, members, body, doc, context
Explore relationships impl, hierarchy, overrides, refs, imports, deps
Explore packages overview, packages, package, summary, api, entrypoints
Inspect changes and tests diff, tests, coverage
Search source patterns grep, ast-pattern
Inspect the index or share it across queries index, batch
Render or parse ASCII diagrams graph

See the full command reference for syntax and supported options, or the agent skill for choosing and interpreting queries.

How it works

Scalex discovers tracked Scala and Java files through Git, parses them with Scalameta and JavaParser, and stores symbols and search filters in .scalex/index.bin. Subsequent invocations reuse unchanged records. Batch queries share one index load.

The binary bootstrap caches each release under ${XDG_CACHE_HOME:-~/.cache}/scalex/. After the first download, it runs that cached executable.

Know the boundaries

Scalex describes source syntax. It does not perform compiler type resolution.

  • References are candidates. Text matches and import-based confidence help narrow the search, but can include comments or unrelated symbols with the same name.
  • Test mentions are not test coverage. coverage finds mentions in test files, not executed lines or verified assertions.
  • Untracked files are absent. Use ordinary file or text tools for new files that Git does not track.
  • Unstaged edits can leave the index stale. Cache detection uses Git index OIDs. Verify fresh edits directly; the index command does not force a clean rebuild. diff reads current source directly.

Use Scalex for source navigation, rg for literal text and unsupported files, and a compiler or Metals for type-checked answers and rename refactoring. They work well together.

Build and contribute

To build a native binary, clone the repository and run:

git clone --depth 1 https://github.com/nguyenyou/scalex.git
cd scalex
./build-native.sh
./scalex --version

The checked-in Mill launcher downloads the pinned GraalVM toolchain and dependencies. For development, you can also run directly through Mill:

./mill run search /path/to/project MyClass

Read the development guide for architecture, tests, formatting, performance measurements, and releases. See the roadmap for planned work and the changelog for release history.

Credits

Scalex draws on source-indexing ideas from Metals, including Git-based caching and bloom-filter search. It uses Scalameta for Scala parsing, JavaParser for Java parsing, and Guava for bloom filters.

The graph command is ported from ascii-graphs by Matt Russell.

Scalex combines Scala with explore, extract, and index. Its mascot is a kestrel: small, lightweight, and sharp-eyed. Meet it in the mascot design brief.

License

MIT

About

Scala code intelligence for coding agents. Zero Build Server. Zero Compilation. Just answers.

Topics

Resources

Stars

112 stars

Watchers

3 watching

Forks

Releases

Packages

Contributors

Languages