locode CLAUDE.md

Project instructions for Locode, a TypeScript command-line program that sends tasks to either Ollama, a local AI system, or Claude based on task complexity. They describe commands, testing, building, branching, pull requests, and releases.

In plain words
What is it for?
They are for making, testing, building, reviewing, and releasing changes in the Locode project.
Why use it?
They give the coding agent the project's required workflow and checks, reducing mistakes such as committing directly to `main` or skipping tests.

Instructions file

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 instructions/chocks/locode/claude-md
Clone the repo
git clone --depth 1 https://github.com/chocks/locode
Per session 1,615 This file is loaded in full into every session.
When invoked 1,615 The same file — it is already loaded in full.
Security scan C 3 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 $0.01615 $0.01615
Opus 5 $0.00807 $0.00807
Sonnet 5 $0.00323 $0.00323
Haiku 4.5 $0.00161 $0.00161

Measured 2d ago against content hash 2a094e35ff16, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade C, and why

locode CLAUDE.md scanned grade C with 3 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 2d 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.

Downloads and executes remote codehighSupply chain

curl | sh runs whatever the server returns today, which is not necessarily what it returned when this was reviewed.

4. **No shell strings** — use `execFileSync(cmd, args[])` not `execSync('cmd args')`. If a shell pipe is genuinely required (e.g., `curl | sh`), keep the shell form but add an inline comment explaining why

Makes network callslowCapability

Not a fault in itself. Listed so you know the mod talks to something, and to what.

4. **No shell strings** — use `execFileSync(cmd, args[])` not `execSync('cmd args')`. If a shell pipe is genuinely required (e.g., `curl | sh`), keep the shell form but add an inline comment explaining why

Runs shell commandslowCapability

Expected in a hook, worth knowing in a rule or an instructions file.

4. **No shell strings** — use `execFileSync(cmd, args[])` not `execSync('cmd args')`. If a shell pipe is genuinely required (e.g., `curl | sh`), keep the shell form but add an inline comment explaining why
CLAUDE.md · 113 lines

How it starts

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

Locode — Claude Code Instructions

Project

TypeScript CLI that routes tasks between Ollama (local LLM) and Claude based on task complexity. Goal: measurable token savings.

Essential Commands

npm install          # install deps
npm test             # run vitest (must pass before any commit)
npm run build        # tsc compile → dist/
npm run dev          # ts-node src/index.ts (no build needed)
./dist/src/index.js  # run compiled CLI (after build)

Dev Workflow

All changes go through a branch + PR:

git checkout -b fix/<issue>   # or feat/<feature>
# make changes, npm test, npm run build
git push -u origin <branch>
gh pr create --fill

Never commit directly to main. PRs require passing tests (prepublishOnly enforces this on publish).

Release Process

Releases are tag-driven. CI never commits to main. The publish workflow fires on any v* tag push.

# 1. Create a release branch from clean main
git checkout main && git pull
git checkout -b release/vX.Y.Z

# 2. Bump version in package.json only (no commit, no tag)
npm run release:patch   # or release:minor / release:major

# 3. Commit the version bump and open a PR
git add package.json package-lock.json
git commit -S -m "chore: release vX.Y.Z"
git push -u origin release/vX.Y.Z
gh pr create --fill

# 4. After PR is merged, push a signed tag from local main
git checkout main && git pull
VERSION="v$(node -p "require('./package.json').version")"
git tag -s "$VERSION" -m "Release $VERSION"
git push origin "$VERSION"

Key rules:

  • Never run npm version without --no-git-tag-version in the bump step — the tag must be created after merge, not before
  • Never push the tag before the PR is merged — the tag should point to the commit on main
  • The publish workflow (.github/workflows/publish.yml) handles build, test, npm publish, and GitHub Release creation automatically

Non-negotiable Rules

  1. TDD always — write failing test, run it, implement, confirm pass, commit
  2. All tests must pass before committing — run npm test
  3. Build must succeed — run npm run build and fix TypeScript errors
  4. No shell strings — use execFileSync(cmd, args[]) not execSync('cmd args'). If a shell pipe is genuinely required (e.g., curl | sh), keep the shell form but add an inline comment explaining why
  5. Shell allow-listsrc/tools/shell.ts uses ALLOWED_COMMANDS Set; never switch to deny-list
  6. Config-driven models — never hardcode 'qwen3:8b' or 'claude-sonnet-4-6'; use config.local_llm.model and config.claude.model
  7. No dead config — if you add a field to src/config/schema.ts, wire it up somewhere
  8. Never commit directly to main — always create a branch (git checkout -b feat/<name> or fix/<name>), make changes there, then open a PR with gh pr create
  9. schema.ts is the single source of truth for defaultslocode.yaml and setup.ts CONFIG_TEMPLATE must agree with the Zod defaults in src/config/schema.ts. When changing a default, update the schema first, then sync the others
  10. Path comparisons need a trailing separator — never use path.startsWith(base) for directory containment checks; use path === base || path.startsWith(base + path.sep) to prevent sibling-directory traversal (e.g., /tmp/repo-evil matching /tmp/repo)
  11. No regex backtracking hazards — CodeQL runs on every PR. Avoid alternation patterns like (?:A|B)* where A and B can match the same input. Prefer simple line-based scans over complex multi-line regex when parsing config/YAML

Read the full file on GitHub · 113 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. 2d ago First seen · 113 lines · 1,615 tokens per session scan C 2a094e35ff16

Subscribe to this mod's changes

locode CLAUDE.md is an instructions file published in the GitHub repository chocks/locode (23 stars, last pushed 2mo ago), licensed MIT. It adds 1,615 tokens to every session, about $0.0081 per session on Opus 5. A static security scan graded it C with 3 findings (downloads and executes remote code, makes network calls, runs shell commands). No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.