메뉴
HN
Hacker News 15일 전

자카드: AI가 작성하고 사람이 검토하는 코드를 위한 프로그래밍 언어

IMP
7/10
핵심 요약

자카드(Jacquard)는 AI가 작성하고 사람이 검토하는 코드를 안전하게 실행, 검토, 시뮬레이션하기 위해 개발된 연구용 프로그래밍 언어입니다. 이 언어는 코드의 부작용(Effect)과 불확실성을 언어 수준에서 명시하여, 개발자가 전체 코드를 읽지 않고도 AI 에이전트의 행동 양상과 안정성을 파악할 수 있게 돕는 것이 핵심입니다. 향후 코드 생성을 AI가 주도하는 환경에서 인간 검토자가 직면할 신뢰 문제를 해결하기 위한 혁신적인 접근법으로 평가받습니다.

번역된 본문

자카드(Jacquard)는 FriendMachine의 연구 프로젝트로, AI 모델이 작성하고 사람이 검토하는 프로그램을 실행, 검토, 시뮬레이션 및 신뢰하기 위해 만들어졌습니다. 자카드에 대한 인간 친화적인 소개글로 시작해 보세요.

구체적으로, 이 프로젝트는 간결한 .jac 표면 구문, OCaml 기반 검사기 및 CPS(Continuation-Passing Style) 인터프리터, 현재 커널 .jqd 캐리어를 컴파일하는 C 코드 생성 네이티브 AOT(Ahead-Of-Time) 백엔드, 명령줄 도구, 자카드로 작성된 표준 라이브러리, 그리고 Warp라는 테스트 프레임워크를 갖춘 작은 프로그래밍 언어입니다. 버전 0.1은 엔드투엔드로 작동하지만 프로덕션용 언어가 아닌 연구 프로토타입이며, docs/release/0.1/LIMITS.md 파일에 그 한계가 솔직하게 명시되어 있습니다.

OCaml이나 opam 없이 0.1 릴리스 후보를 설치하려면 다음 명령어를 실행하세요: curl -fsSL https://raw.githubusercontent.com/jbwinters/jacquard-lang/jacquard-core-0.1-rc3/scripts/install.sh | sh ~ /.local/bin/jac run ~ /.local/share/jacquard/demos/basics/m1-fact.jac 예상되는 출력 결과는 120입니다. Linux x86-64, macOS Intel 및 macOS Apple Silicon 바이너리가 게시되어 있으며, 소스에서 빌드하는 방법은 아래에 문서화되어 있습니다. 그런 다음 구체적인 환경과 확률적 원격 측정 환경에서 하나의 정책을 실행하고, 이어서 샘플링 및 전수 Warp 검사를 실행합니다: sh ~ /.local/share/jacquard/demos/case-studies/release-risk/run.sh

사람(개발자)을 위한 기능 대부분의 언어는 프로그램이 '무엇을 계산하는지'를 알려줍니다. 자카드는 여기에 더해 프로그램이 수행할 수 있는 부작용(Effect), 유한 이산 불확실성, 그리고 정규화된 프로그램 식별자까지 노출합니다. 이 세 가지 정보는 단순한 주석이나 로그, 코드베이스에 대한 개발자의 기억이 아닌 언어 자체에 내장되어 있기 때문에 도구가 이를 모두 검사할 수 있습니다.

대부분의 다른 언어에서는 제공할 수 없지만 자카드에서 할 수 있는 작업들은 다음과 같습니다:

  • 한 줄만 읽고 함수가 수행할 수 있는 부작용을 파악하세요. 예를 들어 (text) ->{net} text라는 시그니처는 해당 함수가 네트워크(net) 부작용을 수행할 수 있음을 의미합니다. 자카드 런타임은 --allow를 통해 명시적으로 권한이 부여되지 않는 한, 동적 코드에 의해 수행되는 부작용을 포함하여 처리되지 않은 세계(world) 효과를 거부합니다. 이는 연구용 런타임에서의 언어 수준 강제 적용이며, 운영 체제 샌드박스를 대체하는 것은 아닙니다.
  • 하나의 프로그램을 여러 '세계(worlds)'에 대해 실행하세요. 동일한 코드를 실제 네트워크, 스크립트된 가짜 환경, 지난주 트래픽의 녹화본 또는 서버가 일반적으로 동작하는 방식에 대한 확률 모델에 대해 실행할 수 있습니다. 핸들러는 외부 세계에 대한 프로그램의 요청에 응답하는 부분입니다. 코드를 전혀 변경하지 않고 핸들러만 교체하면 됩니다. 이를 통해 부작용 경계에서 기존에 사용하던 대부분의 전통적인 모킹(Mocking)을 대체할 수 있으며, "API가 다운되면 내 에이전트는 어떻게 할까?"라는 질문을 일반적인 테스트로 만들 수 있습니다.
  • 유한 이산 모델에 대한 정확한 확률을 열거하세요. 프로그램은 가중치가 적용된 선택지를 샘플링하고 증거를 기록할 수 있으며, 열거를 통해 도달 가능한 모든 결과와 해당 정확한 확률을 나열합니다. 아래의 복구 데모는 실패한 테스트를 증거로 취급하여 어떤 패치가 남아있고 각각의 패치가 적용될 확률이 얼마나 되는지 계산합니다.
  • 정규화된 식별자를 변경하지 않고 이름을 바꾸거나 코드를 재포맷팅하세요. 자카드는 소스 코드의 바이트가 아닌 정규화된 해결된 구조(resolved structure)를 해싱합니다. 주석, 서식, 출처, 그리고 일반적인 지역 변수명이나 용어의 이름 변경은 무시됩니다. 순수 테스트는 정규화된 코드나 종속성 콘텐츠가 변경될 때만 다시 실행됩니다. 이는 구조적 식별자이며, 임의의 프로그램이 동등하게 동작한다는 것을 증명하는 것은 아닙니다.

이 모든 것의 기저에 있는 베팅은 이것입니다: 미래에는 대부분의 코드를 기계가 작성하게 될 것이므로, 이를 검토하는 사람들은 코드 한 줄 한 줄을 모두 읽지 않고도 "이 코드가 무엇에 영향을 미칠 수 있는가? 그리고 우리는 이것에 대해 얼마나 확신하는가?"라는 질문에 답할 수 있도록 언어 자체의 도움이 필요합니다.

AI 에이전트를 위한 기능 docs/SKILL.md를 먼저 읽어보세요. 이 파일은 커널, CLI, 프렐루드(prelude), Warp 테스트 및 알려진 함정(gotchas)들을 하나의 파일로 압축하여 담고 있으며, docs/SKILL.md에서 프로젝트 스킬로 로드할 수 있습니다. 운영 규칙은 AGENTS.md에 있습니다.

당신의 시간을 절약해 줄 정보:

  • 동작은 증거에 의해 고정됩니다. test/cli/ 아래의 대화 내역, 말뭉치 골든 데이터, 데모 스크립트, 그리고 docs/release/0.1/CLAIMS.md를 활용하세요. 고정(pinning)이 실패하면 이를 변경의 결과에 대한 정보로 취급하고, 절대로 diff를 통과시키기 위해 핀(제약 조건)을 약화시키지 마세요.
  • 커널은 27개의 폼(forms)으로 이루어져 있으며(docs/ast.md 참고), .jac는 이러한 폼에 대한 투영(projection)이고, 부트스트랩인 .jqd는 영구적으로 지원됩니다.
  • 출시된 표면 경계(surface boundary)와 보류된 후속 작업(parked follo...
원문 보기
원문 보기 (영어)
Jacquard Jacquard is a FriendMachine research project for running, reviewing, simulating, and trusting programs written by models and reviewed by people. Start with the human-friendly introduction to Jacquard . Concretely, it is a small programming language with a compact .jac surface syntax, an OCaml checker and CPS interpreter, a C-emitting native AOT backend that currently compiles the kernel .jqd carrier, a command-line tool, a Jacquard-written standard library, and a test framework called Warp. Version 0.1 works end to end but is a research prototype, not a production language; docs/release/0.1/LIMITS.md is the honest boundary. Install the 0.1 release candidate without OCaml or opam: curl -fsSL https://raw.githubusercontent.com/jbwinters/jacquard-lang/jacquard-core-0.1-rc3/scripts/install.sh | sh ~ /.local/bin/jac run ~ /.local/share/jacquard/demos/basics/m1-fact.jac The expected output is 120 . Linux x86-64, macOS Intel, and macOS Apple Silicon binaries are published; development from source is documented below. Then run one policy under concrete and probabilistic telemetry worlds, followed by sampled and exhaustive Warp checks: sh ~ /.local/share/jacquard/demos/case-studies/release-risk/run.sh For Humans Most languages tell you what a program computes. Jacquard also exposes which effects it may perform, finite discrete uncertainty, and canonical program identity. Tools can inspect all three because they live in the language rather than only in comments, logs, or your memory of the codebase. Things you can do here that most languages cannot offer: Read one line and see the effects a function may perform. A signature like (text) ->{net} text says the function may perform the net effect. The Jacquard runtime rejects unhandled world effects unless their authority is explicitly granted with --allow , including effects performed by dynamic code. This is language-level enforcement in a research runtime, not a substitute for an operating-system sandbox. Run one program against many worlds. The same code can run against the real network, a scripted fake, a recording of last week's traffic, or a probability model of how servers usually behave. A handler is the piece that answers a program's requests to the outside world; you swap the handler, and the code never changes. This can replace much conventional mocking at effect boundaries and makes "what would my agent do if the API went down?" an ordinary test. Enumerate exact probabilities for finite discrete models. A program can sample weighted choices and record evidence, and enumeration lists every reachable outcome with its exact probability. The repair demo below treats a failing test as evidence and computes which patches remain possible and how likely each is. Rename and reformat without changing canonical identity. Jacquard hashes canonical resolved structure rather than source bytes. Comments, formatting, provenance, and ordinary local or term renames are erased; pure tests rerun only when canonical code or dependency content changes. This is structural identity, not a proof that arbitrary programs are behaviorally equivalent. 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. For Agents Read docs/SKILL.md first. It compresses the kernel, the CLI, the prelude, Warp testing, and the known gotchas into one file, and it loads as a project skill from docs/SKILL.md . Operating rules are in AGENTS.md . What will save you time: Behavior is pinned by evidence: cram transcripts under test/cli/ , corpus goldens, demo scripts, and docs/release/0.1/CLAIMS.md . If a pin fails, treat it as information about your change, and never weaken a pin to make a diff pass. The kernel is 27 forms ( docs/ast.md ); .jac is a projection onto those forms, and bootstrap .jqd remains permanently supported. Treat the shipped surface boundary and its parked follow-ups as release evidence, not as a frozen grammar; do not add out-of-scope features ( AGENTS.md lists them). The development gate is dune build @all && dune runtest && dune fmt followed by a clean git diff --exit-code . Core Ingredients For readers who speak programming languages: One uniform representation: every form is a (head, meta, args) triple, and the kernel grammar has 27 forms. Quoted code is ordinary data. Algebraic effects with deep, multi-shot handlers. A handler can resume a computation zero, one, or many times, which is what makes exhaustive search and exact inference ordinary library code. Explicit capability grants. The runtime installs handlers for the outside world only for effects you pass with --allow ; there is no ambient authority. Type-and-effect rows. Every arrow carries the set of effects the function may perform, so a program's inferred row is its authority manifest. Discrete probabilistic programming as a library: sample and observe are effect operations, and each inference algorithm is a handler. Content-addressed definitions. Identity is a hash of canonical resolved structure with non-identity metadata erased, so formatting, comments, and ordinary local or term renames change nothing downstream. Tooling that leans on the above: formatter, structure-aware differ, Warp tests with a content-addressed cache, record/replay, and a reproducible release evidence pack. A native AOT path that emits C, specializes and caches units by content hash, and is differential-tested against the interpreter under clang and gcc. The prototype is complete against its original core plan and has since added the public surface syntax, ringed standard library, Warp properties and cache, native compilation, packaged binaries, and product-scale case studies. The RC1 semantic boundary is pinned by 554 Alcotest/QCheck cases, 32 cram transcripts, 21 documentation examples, native sanitizer/leak/fuzz lanes, and a fresh-clone evidence workflow. RC2 repaired binary-demo packaging; RC3 adds an explicit runtime/output license exception and packages the native runtime. The current successor distribution relicenses Jacquard under Apache License 2.0 and keeps that runtime/output permission as an explicit clarification. These licensing and packaging changes do not change the language semantics pinned at RC1. What It Looks Like Here is one handler resuming one continuation twice. The block is copied byte-for-byte to test/docs-doctest/fixtures/readme-multishot.jac and run by the documentation test lane: effect Choice where { choose : () -> Bool } handle { match choose() { | True -> 1 | False -> 2 } } { | return x -> x | choose() resume continue -> add(continue(True), continue(False)) } $ jac run test/docs-doctest/fixtures/readme-multishot.jac 3 The handler ran the rest of the program once with true and once with false , then collected both results. That ability to resume more than once is why exact Bayesian inference is a library handler here rather than a runtime feature. The repair demo builds on it: mutate a buggy program's quoted AST into candidate patches, treat a failing test as an observation, and read off the updated probabilities. Running candidate code is an authority, so the pure step still runs (it counts eight candidate patches) and then the demo refuses until you grant the rest: $ jac run demos/tooling/repair.jac 8 error[E0814]: this program requires the `eval` effect, which is not granted (performed via `posterior-over-patches`) hint: grant it with --allow eval, or handle the effect in the program $ jac run demos/tooling/repair.jac --allow eval Under the grant, one failing test leaves two surviving patches: the intended fix at 0.75 and a patch that games the suite at 0.25. Adding one regression test prunes the impostor, and the surviving fix prints as a one-line canonical diff: - sub + add . See sh demos/tooling/repair.sh for the full transcript. Install A Release Binary Most users do not need OCaml or opam. Install the revi