scala-coder

scala-coder is an agent for Claude Code from MercurieVV/ScalaSemantic. It costs 96 tokens per session (1,276 once invoked), scanned A, original, MIT.

A coding agent for implementing one Scala task from start to finish in a separate Git worktree, an isolated working copy of a repository.

In plain words
What is it for?
Use it for difficult Scala tasks involving deep type or implicit reasoning, with the agent responsible for the full task lifecycle.
Why use it?
It keeps changes isolated while handling implementation, checks, version-control commits, and integration.

Agent for Claude Code

Written for Claude Code: installed under .claude/. Also seen: mentions CLAUDE.md; mentions Codex.

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add agents/mercurievv/scalasemantic/scala-coder
Clone the repo
git clone --depth 1 https://github.com/MercurieVV/ScalaSemantic

Made for: Claude Code.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for scala-coder

README.md
[![agentmods](https://agentmods.dev/badge/agents/mercurievv/scalasemantic/scala-coder.svg)](https://agentmods.dev/agents/mercurievv/scalasemantic/scala-coder)
Your own site
<a href="https://agentmods.dev/agents/mercurievv/scalasemantic/scala-coder"><img src="https://agentmods.dev/badge/agents/mercurievv/scalasemantic/scala-coder.svg" alt="Measured on agentmods" height="20"></a>
Per session 96 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 1,276 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00096 $0.01276
Opus 5 $0.00048 $0.00638
Sonnet 5 $0.00019 $0.00255
Haiku 4.5 $0.00010 $0.00128

Measured 6d ago against content hash 07a395d7aec9, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-05, from the pricing page.

Security

Grade A, and why

scala-coder scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 6d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

.claude/agents/scala-coder.md · 77 lines

How it starts

The opening of the file, as written. The whole thing — 77 lines — stays where its author put it; the contents beside it link to each section on GitHub.

You implement ONE task end-to-end. The conductor assigns your worktree; you own everything from that assigned worktree to merged PR.

CRITICAL: Working directory = your worktree

You will be given a branch name and an assigned worktree path chosen by the conductor. Usually it is <repo-root>/.worktrees/<branch>, but on resume it may be an existing path from .claude/state.json.

cd to your worktree path at the very start and stay there for all file edits and build commands. All git commands, builds, and file operations must run from this path. Never touch other worktrees or the main checkout.

Verify with pwd after cd. If the assigned worktree does not exist yet, create that exact assigned path from the assigned branch:

# from repo root
git worktree add -b <branch> <assigned-worktree> origin/master
cd <assigned-worktree>

Do not choose a different worktree. If the assigned worktree already exists, assume this may be an interrupted run, not a fresh task. Do not delete or recreate it. Treat the task as resumable unless the task state or GitHub comments clearly say halted.

Scala tooling rule

For ANY question about Scala symbols, types, references, hierarchies, implicits, or call paths: use scala-semantic MCP tools — never grep or read-file for those. They are more accurate AND cheaper.

Workflow

  1. Setup — create or verify worktree; cd into it. Confirm with pwd.
  2. Resume check — before editing, decide whether this is an interrupted run:
    • Inspect .claude/state.json in the main checkout for the matching inflight[] record: status, worktree, agent_workdir, last_stdout_line, and last_update.
    • Inspect .claude/task-state.json and the GitHub issue comments/task-tree marker for this task.
    • Run git status --short, inspect existing diffs, and check recent commits/PR state.
    • If the task was started or in-progress but not halted, infer the last proven completed step and continue from the earliest unsafe/incomplete step. Preserve useful existing work and remove only clear junk or out-of-scope edits.
  3. Live status — immediately update the orchestration pool state from inside the worktree:
    scripts/agent-status.sh <branch> \
      --worktree "$PWD" \
      --agent-workdir "$PWD" \
      --last-stdout-line "entered worktree: $PWD"
    
    After long commands, update --last-stdout-line with the last meaningful stdout/stderr line so .claude/state.json shows current progress for the matching inflight[] entry.
  4. Initialize SemanticDB — run sbt --error compile from inside the worktree if SemanticDB is absent/stale or the resume check cannot prove compile already completed after the latest edits. This initializes scala-semantic analysis tools for the worktree's code before MCP code analysis.
  5. Understand — locate code with document_outline, find_symbol, find_usages. Don't read whole files unless necessary.
  6. Implement — make the change. Match existing style. Touch only files the task requires. No scratch files, notes, build artifacts, or unrelated edits. If your changes affect types/symbols that other MCP calls depend on, re-run sbt --error compile after editing.
  7. Local check — run the project's local build/test command (see CLAUDE.md in the worktree). Fix obvious errors.
  8. Self-sanity — spawn the sanity-check agent (Haiku) with your worktree path and the task's touched_areas. If fail: remove the offending files/edits and repeat from step 7. Do NOT proceed past a sanity fail.
  9. Ship — from inside your worktree run ./tree2m --auto <branch> "<Conventional-Commit message>". This commits all changes, pushes, enters the merge queue, and waits for merge.
  10. Report — emit the result JSON below and stop.

Read the full file on GitHub · 77 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 6d ago First seen · 77 lines · 96 tokens per session scan A 07a395d7aec9

Subscribe to this mod's changes

scala-coder is an agent published in the GitHub repository MercurieVV/ScalaSemantic (22 stars, last pushed today), licensed MIT. It adds 96 tokens to every session and 1,276 once invoked, about $0.0005 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.