SLOPSHOPPER

ailang-check-on-edit

After Claude edits or writes a .ail file, runs `ailang check` from the project root and adds any errors to what the model reads after the tool result, so it…

newguardprocess
★ 34v0.1.0Apache-2.0updated 2026-10-02sunholo-data/ailang/tools/claude-mods/ailang-check-on-edit
A shopper browsing a rack in a slop shop
README

<img src="docs/static/img/ailang-logo.svg" alt="AILANG Logo" width="128" height="128">

AILANG: The Deterministic Language for AI Coders

<!-- EXAMPLES_STATUS_START --> Examples License

Example status <!-- EXAMPLES_STATUS_END -->

Reliability Security Maintainability CodeQL OpenSSF Scorecard OpenSSF Best Practices

Third-party verification. AILANG is written autonomously by AI agents via its own coordinator. The badges above are independent static-analysis and supply-chain scores — not self-reported. The benchmark dashboard publishes the live correctness signal across current benchmark and model cohorts.

AILANG is a purely functional, effect-typed language designed as a deterministic execution substrate for AI-generated code. Every construct has deterministic semantics that can be reflected, verified, and serialized.

Documentation | Examples | Live Demos | Vision | Benchmarks


Quick Start

AILANG is designed to be used by AI coding agents. The AILANG Bootstrap packages the current language guidance, reusable skills, and local MCP tools for Claude Code and OpenAI Codex.

Install the AILANG CLI first:

curl -fsSL https://ailang.sunholo.com/install.sh | bash
ailang --version

The agent integrations call the local ailang executable, so it must be available on PATH.

With Claude Code

/plugin marketplace add sunholo-data/ailang_bootstrap
/plugin install ailang@sunholo-data/ailang_bootstrap

With OpenAI Codex

AILANG Bootstrap also ships a Codex plugin manifest. Add its stable marketplace:

# Required by the plugin's local MCP server on first launch
node --version
npm --version

codex plugin marketplace add sunholo-data/ailang_bootstrap --ref stable
codex plugin add ailang@ailang-marketplace
codex plugin list

Start a new Codex session after installation. Alternatively, after adding the marketplace, launch codex, enter /plugins, and install ailang from the AILANG marketplace. The plugin can also be installed from the Plugins directory in the Codex desktop app. Codex plugins are not currently available in the IDE extension.

Codex reads this repository's AGENTS.md automatically, whether or not the plugin is installed. The plugin adds the reusable AILANG skills and MCP tools; AGENTS.md supplies repository-specific workflows and guardrails.

What the Agent Package Provides

  • CLI integration - Skills and tools use the separately installed ailang executable
  • MCP tools - ailang_prompt, ailang_check, ailang_run, ailang_builtins, ailang_eval
  • Agent skills - AILANG authoring, debugging, messaging, design-doc, and sprint workflows
  • Teaching guidance - Current syntax rules via repository guidance, skills, and ailang prompt

The packaging is intentionally native to each host:

CapabilityClaude CodeCodex
Persistent guidanceCLAUDE.mdAGENTS.md
Reusable workflowsPlugin skillsPlugin skills
Local AILANG MCP toolsYesYes
Host-native commandsClaude slash commandsSkills and MCP tools
AILANG Bootstrap hooksClaude hooksNot currently packaged

Once installed, ask the agent to write AILANG code. All agents should run ailang prompt before authoring .ail files; it is the installed CLI's source for current syntax and idioms.

See ailang_bootstrap for details.

The installer detects your OS and architecture automatically. To pin a release:

curl -fsSL https://ailang.sunholo.com/install.sh | VERSION=v0.33.1 bash
# macOS (Apple Silicon)
curl -L https://github.com/sunholo-data/ailang/releases/latest/download/darwin.arm64.ailang.tar.gz | tar -xz
sudo mv ailang /usr/local/bin/

# macOS (Intel)
curl -L https://github.com/sunholo-data/ailang/releases/latest/download/darwin.x64.ailang.tar.gz | tar -xz
sudo mv ailang /usr/local/bin/

# Linux
curl -L https://github.com/sunholo-data/ailang/releases/latest/download/linux.x64.ailang.tar.gz | tar -xz
sudo mv ailang /usr/local/bin/

# From source
git clone https://github.com/sunholo-data/ailang.git
cd ailang && make install

# Verify
ailang --version

For complete setup instructions, see the Getting Started Guide.

Hello World

module examples/hello_world

import std/io (println)

export func main() -> () ! {IO} {
  println("Hello, World!")
}
ailang run --caps IO examples/hello_world.ail
# Output: Hello, World!

Interactive REPL

ailang repl

λ> 1 + 2
3 :: Int

λ> let double = \x. x * 2 in double(21)
42 :: Int

λ> :type \x. x + x
\x. x + x :: ∀α. Num α ⇒ α → α

λ> :quit

Key Features

  • Pure functional - Lambda calculus, closures, pattern matching, ADTs
  • Type inference - Hindley-Milner with row polymorphism
  • Effect system - Capability-based security (IO, FS, Net, Clock, AI)
  • Deterministic - Replayable execution, structured traces
  • AI-first - Designed for machine reasoning, not human convenience
  • LSP - ailang lsp --stdio ships in the binary: diagnostics, hover types, go-to-def, references, document symbols. One-command VS Code install: ailang editor install vscode (guide)

Learn more: Why AILANG? | No Loops Design | Go Interop | Stability Promise (1.x)


Development

make install    # Build and install
make test       # Run all tests
make repl       # Start REPL
make lint       # Run linter

Guides:


Project Structure

ailang/
├── cmd/ailang/     # CLI
├── internal/       # Compiler (lexer, parser, types, eval, effects)
├── std/            # Standard library (std/io, std/fs, std/json, std/zip, std/xml, etc.)
├── examples/       # Example and reference programs
├── docs/           # Documentation website source
└── design_docs/    # Design documents

License

Apache 2.0 - See LICENSE

AILANG draws inspiration from Haskell, OCaml, Rust, and Idris/Agda.


For AI agents: Deterministic functional language with Hindley-Milner type inference, algebraic effects, and explicit effect tracking. Read AGENTS.md, then use ailang prompt for current language guidance.

Source 1 files
hooks/register.ts 86 lines
1import type { EngineInterface, Register } from 'claude-code'
2
3// The model's side of the lens: errors go into the tool result's `context`,
4// which the model reads after the result and the person never sees. A passing
5// check adds nothing. Advisory only (M-CLAUDE-CODE-MODS C1/C2).
6
7const MAX_ERRORS = 5
8
9/** Pure: "type error in m (decl 0): ... at [... at m.ail:3:8]: cannot unify ..." → "3:8 cannot unify ..." */
10export function shortError(message: string): string {
11  const where = message.match(/\.ail:(\d+:\d+)/)?.[1]
12  const tail = message.includes(']: ')
13    ? message.slice(message.lastIndexOf(']: ') + 3)
14    : message.replace(/^type error in \S+ \(decl \d+\):\s*/, '')
15  return (where ? `${where} ${tail}` : message).split('\n')[0]!.trim()
16}
17
18/** Pure: the context line for a check report, or undefined when it passed. */
19export function contextFor(rel: string, stdout: string, exitCode: number): string | undefined {
20  const at = stdout.indexOf('{')
21  let report: { passed?: boolean; errors?: { message?: string }[] } | undefined
22  try {
23    report = at < 0 ? undefined : JSON.parse(stdout.slice(at))
24  } catch {
25    report = undefined
26  }
27  if (exitCode === 0 && report?.passed !== false) return undefined
28
29  const errors = (report?.errors ?? []).map(err => shortError(err.message ?? 'error'))
30  if (errors.length === 0) return `ailang check ${rel}: ✗ failed (exit ${exitCode}), no structured errors`
31  const shown = errors.slice(0, MAX_ERRORS).map(err => `  ${err}`)
32  const more = errors.length > MAX_ERRORS ? [`  … ${errors.length - MAX_ERRORS} more`] : []
33  return [`ailang check ${rel}: ✗ ${errors.length} error${errors.length === 1 ? '' : 's'}`, ...shown, ...more].join('\n')
34}
35
36async function exists($: EngineInterface, path: string): Promise<boolean> {
37  try {
38    await $.fs.stat(path)
39    return true
40  } catch {
41    return false
42  }
43}
44
45// ailang names a module by its path from the working directory (MOD010), so
46// run it from the project root: the nearest ailang.toml, else .git, else the
47// file's own folder.
48async function projectRoot($: EngineInterface, file: string): Promise<string> {
49  const dirs: string[] = []
50  for (let dir = file.slice(0, file.lastIndexOf('/')); dir; dir = dir.slice(0, dir.lastIndexOf('/'))) {
51    dirs.push(dir)
52  }
53  for (const marker of ['ailang.toml', '.git']) {
54    for (const dir of dirs) {
55      if (await exists($, `${dir}/${marker}`)) return dir
56    }
57  }
58  return dirs[0] ?? '.'
59}
60
61async function check($: EngineInterface, path: string, isFormatting: boolean): Promise<string | undefined> {
62  const file = path.startsWith('/') ? path : `${await $.session.cwd()}/${path}`
63  const cwd = await projectRoot($, file)
64  const rel = file.slice(cwd.length + 1)
65  try {
66    if (isFormatting) await $.process.run(['ailang', 'fmt', '--write', rel], { cwd, timeoutMs: 20_000 })
67    const run = await $.process.run(['ailang', 'check', '--json', '--quiet', rel], { cwd, timeoutMs: 60_000 })
68    return contextFor(rel, run.stdout, run.exitCode)
69  } catch (err) {
70    return `ailang check ${rel}: did not finish (${String(err).slice(0, 80)})`
71  }
72}
73
74export const register: Register = (on, options) => {
75  const isFormatting = options.formatOnEdit === true
76
77  on('tool.call', async ($, e, next) => {
78    const ran = await next(e)
79    const path = e.tool === 'Edit' || e.tool === 'Write' ? e.file_path : undefined
80    if (!path?.endsWith('.ail') || ran.deny !== undefined || ran.isError) return ran
81
82    const line = await check($, path, isFormatting)
83    return line ? { ...ran, context: [...(ran.context ?? []), line] } : ran
84  })
85}
86