Jacquard 0.1: A Programming Language for AI-Written, Human-Reviewed Code

Jacquard 0.1: A Programming Language for AI-Written, Human-Reviewed Code

Jacquard 0.1 is a research programming language designed for a development regime where the majority of code is written by machine-learning models and reviewed by humans. It shifts the burden of verification from reading every line of code to inspecting language-level manifests that explicitly state what a program can touch and how it behaves under uncertainty.

Explicit Effect Tracking for Human Review

Jacquard uses type-and-effect rows to make a function's side effects visible in its signature, allowing reviewers to identify potential security or stability risks without auditing the entire implementation. For example, a signature like (text) ->{net} text explicitly indicates that the function may perform network operations.

Key security and review features include:

  • Language-Level Enforcement: The Jacquard runtime rejects unhandled world effects unless authority is explicitly granted via the --allow flag (e.g., --allow net or --allow fs).
  • No Ambient Authority: The runtime only installs handlers for the outside world if they are explicitly passed, preventing programs from accessing system resources by default.
  • Authority Manifests: A program's inferred row of effects serves as its authority manifest, providing a clear summary of the program's capabilities.

Multi-World Simulation and Testing

Jacquard allows the same code to be executed against different "worlds" by swapping the handler that manages external requests. This enables developers to test agent behavior against various scenarios without modifying the core logic.

Supported world types include:

  • Concrete Worlds: The real network or filesystem.
  • Scripted Worlds: Fake, scripted responses for deterministic testing.
  • Recording Worlds: Replays of historical traffic.
  • Probabilistic Worlds: Models of how servers or environments usually behave.

This architecture replaces conventional mocking at effect boundaries and allows developers to ask "what would my agent do if the API went down?" as a standard test case.

Structural Identity and Content Addressing

To facilitate AI-driven iteration, Jacquard uses content-addressed definitions. It hashes the canonical resolved structure of the code rather than the raw source bytes.

This approach ensures that:

  • Formatting Independence: Changes to comments, whitespace, and formatting do not change the program's canonical identity.
  • Rename Resilience: Local or term renames that do not alter the structural logic are ignored by the hashing mechanism.
  • Efficient Testing: Pure tests only rerun when the canonical code or its dependencies actually change, reducing redundant computation during AI-led refactoring.

Probabilistic Programming and Inference

Jacquard implements discrete probabilistic programming as a library using algebraic effects with deep, multi-shot handlers. Because a handler can resume a computation zero, one, or many times, complex inference algorithms become ordinary library code rather than built-in runtime features.

  • Exact Enumeration: The language can list every reachable outcome of a finite discrete model with its exact probability.
  • Bayesian Inference: The sample and observe operations are treated as effects, allowing different inference handlers (like likelihood weighting) to be swapped in for the same model hash.
  • Program Repair: A demo in the project treats a failing test as an "observation" and uses Bayesian inference to compute which candidate patches are most likely to fix the bug.

Technical Implementation and Tooling

Jacquard 0.1 is implemented as a research prototype with the following technical stack:

  • Core: A small kernel consisting of 27 forms, with an OCaml checker and CPS interpreter.
  • Native Backend: A C-emitting AOT (Ahead-of-Time) backend that compiles kernel .jqd carriers into standalone binaries. It uses musttail on clang and GCC 15+ for O(1) stack tail calls.
  • Testing Framework: A framework called Warp that supports content-addressed caching and property-based checks.
  • CLI Tooling: A suite of commands including jac run for execution, jac check for signature printing, jac hash for identity verification, and jac diff for structural comparison.

Community Insights and Critiques

Discussion among developers highlights both the potential and the challenges of an AI-centric language:

  • The "Cold Start" Problem: Some critics argue that LLMs will struggle with a new language because they lack the massive training corpora available for established languages like Java or C++.
  • Comparison to Existing Patterns: Some users questioned if the "world" model is fundamentally different from standard dependency injection, while others noted similarities to the Jai programming language's approach to declaring resource access.
  • Verification Needs: There is interest in extending such languages with rudimentary pre- and post-condition checks to ensure that AI-generated code meets strict safety levels before compilation.

"The bet behind all of this: when most code is written by machines, the humans reviewing it need the language itself to answer 'what can this touch, and how sure are we' without reading every line."

Current Limitations

As a research prototype, Jacquard 0.1 has several explicit boundaries:

  • Missing Features: It currently lacks a VM/JIT, concurrency support, continuous distributions, and formal soundness proofs.
  • Coarse Grants: World authority grants are currently coarse-grained rather than fine-grained.
  • Staging: Typed staging and language package management are not yet implemented.

Sources