Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# Generated verification and downloaded source snapshots
verification-report.json
/.ancp/
**/.ancp/
/research/source-docs/snapshots/
/research/source-docs/fetch-report.json
/research/source-docs/index.md
Expand Down
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ Initial public release.
- Python reference package with `ancp` CLI.
- Compiler-facing proxy entry points such as `ancp-cargo`, `ancp-tsc`, `ancp-python`, `ancp-kotlinc`, and `ancp-julia`.
- Native-name shim installer via `ancp install-shims`.
- Native-tool adapters for Python, TypeScript, JavaScript, Rust, Go, C/C++, Java, Kotlin, C#/.NET, Swift, Zig, Ruby, PHP, Dart, Scala, and Julia.
- Native-tool adapters for Python, TypeScript, JavaScript, Rust, Go, C/C++, Java, Kotlin, C#/.NET, Swift, Zig, Ruby, PHP, Dart, Scala, Julia, Shell, PowerShell, Lua, Perl, R, Haskell, OCaml, Erlang, Elixir, Clojure, Nix, Terraform, Dockerfile, SQL, JSON, TOML, and YAML.
- Markdown renderer for compact agent-facing diagnostic summaries.
- Multilingual intentionally broken bug corpus.
- Repository validation, contract audit, source fetch, and bug corpus scripts.
Expand Down
2 changes: 2 additions & 0 deletions MANIFEST.in
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,10 @@ recursive-include schemas *.json
recursive-include taxonomies *.json
recursive-include examples *.json
recursive-include examples/buggy *
recursive-exclude examples/buggy .ancp/* native-output*.txt
recursive-include docs *.md
recursive-include spec *.md
recursive-include tools *.py
include research/README.md
include research/tooling-matrix.md
include research/source-docs/sources.json
Expand Down
7 changes: 6 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ The core idea is simple:

> Existing tools may keep their native internals. ANCP defines the stable machine contract that adapters expose to agents.

ANCP turns tool output into structured diagnostics, repair hints, repair plans, verification steps, code graph facts, effect/capability metadata, and version-matched agent guidance. It is designed to sit above current languages such as TypeScript, Python, Rust, Go, Java, C, C++, C#, Swift, Kotlin, Zig, Ruby, PHP, and others.
ANCP turns tool output into structured diagnostics, repair hints, repair plans, verification steps, code graph facts, effect/capability metadata, and version-matched agent guidance. It is designed to sit above current languages such as TypeScript, Python, Rust, Go, Java, C, C++, C#, Swift, Kotlin, Julia, Zig, Ruby, PHP, Lua, Perl, R, Haskell, OCaml, Erlang, Elixir, Clojure, Nix, Terraform, Dockerfile, SQL, JSON, TOML, YAML, and others.

## What This Repository Contains

Expand All @@ -30,6 +30,7 @@ This repository is the public ANCP 1.0 contract and Python reference implementat
| Native-tool adapters | Implemented | [src/ancp/adapters](src/ancp/adapters) |
| Bug corpus | Implemented | [examples/buggy](examples/buggy) |
| Repository verifier | Implemented | [tools/verify_repo.py](tools/verify_repo.py) |
| Toolchain availability checker | Implemented | [tools/check_toolchains.py](tools/check_toolchains.py) |

## Why ANCP Exists

Expand Down Expand Up @@ -165,6 +166,9 @@ julia app.jl
kotlinc Main.kt
gcc -fsyntax-only main.c
clang++ -fsyntax-only main.cpp
bash -n script.sh
pwsh -NoProfile -File script.ps1
terraform validate
```

The native compiler output and exit code are preserved. ANCP writes a structured sidecar:
Expand Down Expand Up @@ -247,6 +251,7 @@ python tools/audit_contracts.py
python tools/verify_repo.py
pytest
python tools/run_bug_corpus.py
python tools/check_toolchains.py
python -m build
python -m twine check dist/*
```
Expand Down
3 changes: 2 additions & 1 deletion RELEASE_NOTES.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@ ANCP 1.0.0 ships the Agent Native Compiler Protocol contract and Python referenc
- Diagnostic, repair, and effect taxonomies.
- Reference CLI: `ancp`.
- Compiler-name shims for invisible compiler-layer usage.
- Native-tool adapters for Python, TypeScript, JavaScript, Rust, Go, C/C++, Java, Kotlin, C#/.NET, Swift, Zig, Ruby, PHP, Dart, Scala, and Julia.
- Native-tool adapters for Python, TypeScript, JavaScript, Rust, Go, C/C++, Java, Kotlin, C#/.NET, Swift, Zig, Ruby, PHP, Dart, Scala, Julia, Shell, PowerShell, Lua, Perl, R, Haskell, OCaml, Erlang, Elixir, Clojure, Nix, Terraform, Dockerfile, and SQL.
- Built-in parser adapters for JSON, TOML, and YAML.
- Compact Markdown rendering for agent context.
- Multilingual broken-code corpus for adapter smoke testing.
- CI, packaging, verification scripts, and OSS release checklist.
Expand Down
12 changes: 6 additions & 6 deletions docs/final-readiness-report.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@ ANCP now contains:
- diagnostic, repair, and effect taxonomies,
- a Python package named `ancp`,
- the `ancp` CLI,
- prefixed compiler proxies such as `ancp-cargo`, `ancp-tsc`, `ancp-python`, `ancp-kotlinc`, and `ancp-julia`,
- prefixed compiler proxies such as `ancp-cargo`, `ancp-tsc`, `ancp-python`, `ancp-kotlinc`, `ancp-julia`, `ancp-pwsh`, `ancp-terraform`, and `ancp-sqlfluff`,
- native-name compiler shims installed with `ancp install-shims`,
- adapters for Python, TypeScript, JavaScript, Rust, Go, C/C++, Java, Kotlin, C#/.NET, Swift, Zig, Ruby, PHP, Dart, Scala, and Julia,
- adapters for Python, TypeScript, JavaScript, Rust, Go, C/C++, Java, Kotlin, C#/.NET, Swift, Zig, Ruby, PHP, Dart, Scala, Julia, Shell, PowerShell, Lua, Perl, R, Haskell, OCaml, Erlang, Elixir, Clojure, Nix, Terraform, Dockerfile, SQL, JSON, TOML, and YAML,
- compact Markdown rendering for agents,
- a multilingual intentionally broken bug corpus,
- research notes and source document fetch tooling,
Expand All @@ -29,23 +29,23 @@ The local release was checked with these passes.
| --- | --- | --- |
| Syntax | `python -m compileall -q src tests tools` | passed |
| Unit tests | `pytest` | 14 passed |
| Source corpus | `python tools/fetch_sources.py` | fetched 59/59 source documents |
| Source corpus | `python tools/fetch_sources.py` | fetched 77/77 source documents |
| Contract audit | `python tools/audit_contracts.py` | passed |
| Repo validator | `python tools/verify_repo.py` | passed, wrote `verification-report.json` |
| CLI JSON | `ancp manifest \| python -m json.tool` | passed |
| CLI JSON | `ancp capabilities \| python -m json.tool` | passed |
| CLI JSON | `ancp schema \| python -m json.tool` | passed |
| Shim install | `ancp install-shims --dir .ancp/bin --force` | passed |
| Shim smoke | normal `python -m py_compile bad.py` through shim | exit 1, ANCP sidecar status `failed`, 1 diagnostic |
| Bug corpus | `python tools/run_bug_corpus.py` | emitted ANCP JSON/Markdown for all 16 cases |
| Bug corpus | `python tools/run_bug_corpus.py` | emitted ANCP JSON/Markdown for all 33 cases |
| Bug corpus validation | `ancp validate .ancp/bug-corpus` | passed |
| Package build | `python -m build` | built wheel and sdist |
| Package metadata | `python -m twine check dist/*` | both artifacts passed |

Local tool availability during verification:

- Installed and producing diagnostics: Python, Go, Julia.
- Not installed or not available in this environment: TypeScript compiler, Rust/Cargo, GCC/Clang, Java, Kotlin, .NET, Swift, Zig, Ruby, PHP, Dart, Scala.
- Installed and producing diagnostics: Python, Go, Julia, JSON, TOML, YAML, PowerShell.
- Not installed or not available in this environment: TypeScript compiler, Rust/Cargo, GCC/Clang, Java, Kotlin, .NET, Swift, Zig, Ruby, PHP, Dart, Scala, ShellCheck/Bash, Lua, Perl, R, GHC, OCaml, Erlang, Elixir, clj-kondo, Nix, Terraform, hadolint, SQLFluff.
- Missing native tools correctly report `tool_failed`; they do not pretend to pass.

## Scope Boundary
Expand Down
2 changes: 1 addition & 1 deletion docs/github-release-plan.md
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ Highlights:
- diagnostic, repair, and effect taxonomies
- reference CLI
- compiler-name shim installation
- native-tool adapters for Python, TypeScript, JavaScript, Rust, Go, C/C++, Java, Kotlin, .NET, Swift, Zig, Ruby, PHP, Dart, Scala, and Julia
- native-tool adapters for Python, TypeScript, JavaScript, Rust, Go, C/C++, Java, Kotlin, .NET, Swift, Zig, Ruby, PHP, Dart, Scala, Julia, Shell, PowerShell, Lua, Perl, R, Haskell, OCaml, Erlang, Elixir, Clojure, Nix, Terraform, Dockerfile, SQL, JSON, TOML, and YAML
- validation and conformance tooling
- GitHub Actions CI
- research-backed language/tooling matrix
Expand Down
18 changes: 17 additions & 1 deletion docs/invisible-compiler-layer.md
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,23 @@ The reference implementation can create shims for:
- `scala-cli`
- `scalac`
- `julia`
- `shellcheck`
- `bash`
- `pwsh`
- `powershell`
- `luac`
- `lua`
- `perl`
- `Rscript`
- `ghc`
- `ocamlc`
- `erlc`
- `elixirc`
- `clj-kondo`
- `nix-instantiate`
- `terraform`
- `hadolint`
- `sqlfluff`

These shims do not replace compilers. They find the real compiler later in PATH, execute it, preserve its output and exit code, then emit ANCP JSON.

Expand Down Expand Up @@ -125,4 +142,3 @@ A shim is production-acceptable when it obeys these rules:
- it validates emitted ANCP documents.

That gives agents a stable protocol without forcing every language compiler project to accept upstream patches first.

2 changes: 1 addition & 1 deletion docs/repository-structure.md
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@
- `ancp`: the reference CLI for manifest, capability, check, explain, repair-plan, verify, graph, skills, validate, render, schema, and shim installation.
- `ancp.proxy`: prefixed compiler proxies such as `ancp-cargo`, `ancp-tsc`, `ancp-python`, `ancp-kotlinc`, and `ancp-julia`.
- `ancp.shim`: native-name wrappers installed by `ancp install-shims`, so normal commands such as `cargo check` and `python -m py_compile app.py` can emit ANCP sidecars.
- `ancp.adapters`: native-tool adapters for Python, TypeScript, JavaScript, Rust, Go, C/C++, Java, Kotlin, C#/.NET, Swift, Zig, Ruby, PHP, Dart, Scala, and Julia.
- `ancp.adapters`: native-tool adapters for Python, TypeScript, JavaScript, Rust, Go, C/C++, Java, Kotlin, C#/.NET, Swift, Zig, Ruby, PHP, Dart, Scala, Julia, Shell, PowerShell, Lua, Perl, R, Haskell, OCaml, Erlang, Elixir, Clojure, Nix, Terraform, Dockerfile, SQL, JSON, TOML, and YAML.
- `ancp.resources`: packaged copies of the ANCP schema and taxonomies for installed environments.

## Contract Artifacts
Expand Down
115 changes: 115 additions & 0 deletions docs/toolchains.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,115 @@
# Toolchain Coverage

ANCP adapters are split into two layers:

1. built-in protocol and parser support that ships with the Python package,
2. native compiler/checker integrations that require the relevant ecosystem tool to be installed.

The reference package is useful even when some compilers are missing. Missing tools are reported as ANCP `tool_failed` results instead of invalid JSON or fake success.

## Check Local Availability

Run:

```bash
python tools/check_toolchains.py
```

For machine-readable output:

```bash
python tools/check_toolchains.py --json
```

By default the checker returns exit code `0` so it can be used as a report in local verification. Add `--strict` when a CI job expects every tool in that job to be installed:

```bash
python tools/check_toolchains.py --language rust --language go --strict
```

## Built In

These adapters do not require an external compiler for syntax validation:

- JSON
- TOML
- YAML

Python and PowerShell usually exist on Windows machines already, but they are still external runtime/toolchain integrations.

## Recommended Native Tools

| Language family | Tool |
| --- | --- |
| Python | `python` |
| TypeScript | `tsc` |
| JavaScript | `eslint` |
| Rust | `cargo`, `rustc` |
| Go | `go` |
| C | `gcc` or `clang` |
| C++ | `g++` or `clang++` |
| Java | `javac` |
| Kotlin | `kotlinc` |
| C#/.NET | `dotnet` |
| Swift | `swift` |
| Zig | `zig` |
| Ruby | `ruby` |
| PHP | `php` |
| Dart | `dart` |
| Scala | `scala-cli` or `scalac` |
| Julia | `julia` |
| Shell | `shellcheck` preferred, `bash` fallback |
| PowerShell | `pwsh` or Windows PowerShell |
| Lua | `luac` preferred, `lua` fallback |
| Perl | `perl` |
| R | `Rscript` |
| Haskell | `ghc` |
| OCaml | `ocamlc` |
| Erlang | `erlc` |
| Elixir | `elixirc` |
| Clojure | `clj-kondo` |
| Nix | `nix-instantiate` |
| Terraform | `terraform` |
| Dockerfile | `hadolint` |
| SQL | `sqlfluff` |

## Windows User-Level Install Examples

Use these only for tools you want to exercise locally. CI should install toolchains in dedicated jobs rather than relying on one giant image.

```powershell
scoop install shellcheck lua perl terraform hadolint
npm install -g typescript eslint
python -m pip install sqlfluff
```

Heavier ecosystems are better installed with their official installers or CI setup:

- Rust: `rustup`
- Java/Kotlin/Scala: JDK plus Kotlin/Scala tooling
- Haskell: GHCup
- OCaml: opam
- Erlang/Elixir: official installers or package manager images
- R: CRAN R installer
- Swift, Zig, Dart, Ruby, PHP, Nix: ecosystem-specific installers

## CI Strategy

Do not require every compiler in one job. Use a matrix:

- core job: schema validation, unit tests, package build, JSON/TOML/YAML/Python checks,
- systems job: Rust, Go, C/C++, Zig,
- JVM/.NET job: Java, Kotlin, Scala, C#,
- dynamic job: JavaScript, TypeScript, Ruby, PHP, Dart, Julia, Lua, Perl, R,
- functional job: Haskell, OCaml, Erlang, Elixir, Clojure,
- infrastructure job: Shell, PowerShell, Nix, Terraform, Dockerfile, SQL.

Each job should run:

```bash
python tools/check_toolchains.py --json --strict --language rust --language go
python tools/run_bug_corpus.py
ancp validate .ancp/bug-corpus
```

The matrix should fail when an expected installed compiler returns `tool_failed`, but the local all-language corpus may still pass schema validation when a developer has partial tooling.
3 changes: 3 additions & 0 deletions docs/verification.md
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ ancp capabilities | python -m json.tool
ancp schema | python -m json.tool
python -m build
python -m twine check dist/*
python tools/check_toolchains.py
```

Purpose:
Expand All @@ -87,6 +88,7 @@ Purpose:
- confirms top-level CLI commands emit parseable JSON,
- confirms wheel and source distributions can be built,
- confirms package metadata is acceptable to Python packaging tools.
- reports which native language toolchains are available for real compiler-backed smoke coverage.

Expected result:

Expand All @@ -95,6 +97,7 @@ Expected result:
- CLI JSON commands parse,
- build succeeds,
- `twine check` reports `PASSED` for every built artifact.
- installed native toolchains appear in the availability report; missing optional toolchains are expected on partial developer machines.

## Pass 5: Invisible Compiler Layer And Bug Corpus

Expand Down
3 changes: 1 addition & 2 deletions docs/vision-doctrine.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ The developer should not need to learn a new workflow just to make code agent-re
If a compiler/tool is not installed or a language lacks stable structured output, ANCP must report that honestly as valid ANCP JSON. It must not fabricate successful checks.

6. **Multi-language from the start.**
The important targets include Rust, Kotlin, Python, Julia, TypeScript, C, C++, Go, Java, C#/.NET, Swift, Zig, Ruby, PHP, Dart, Scala, and JavaScript.
The important targets include Rust, Kotlin, Python, Julia, TypeScript, C, C++, Go, Java, C#/.NET, Swift, Zig, Ruby, PHP, Dart, Scala, JavaScript, Shell, PowerShell, Lua, Perl, R, Haskell, OCaml, Erlang, Elixir, Clojure, Nix, Terraform, Dockerfile, SQL, JSON, TOML, and YAML.

7. **Security is part of the protocol.**
Build/test/repair commands can execute arbitrary code. ANCP must label effects, safety levels, and risky operations instead of hiding them.
Expand Down Expand Up @@ -271,4 +271,3 @@ The first public release succeeds if someone can:
9. get a compact, useful diagnosis instead of a noisy compiler dump.

That is the revolution: compilers become agent-readable without developers changing how they code.

4 changes: 4 additions & 0 deletions examples/buggy/clojure/broken.clj
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
(ns broken.core)

(defn run []
(println "hello clojure")
4 changes: 4 additions & 0 deletions examples/buggy/dockerfile/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
FROM ubuntu:latest
RUN apt-get update && apt-get install -y curl
COPY missing-file /app/
CMD ["bash"]
5 changes: 5 additions & 0 deletions examples/buggy/elixir/broken.ex
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
defmodule Broken do
def run(name) do
IO.puts("hello #{name}"
end
end
5 changes: 5 additions & 0 deletions examples/buggy/erlang/broken.erl
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
-module(broken).
-export([main/0]).

main() ->
io:format("broken erlang~n"
7 changes: 7 additions & 0 deletions examples/buggy/haskell/Main.hs
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
module Main where

main :: IO ()
main = do
putStrLn "broken haskell"
let x =
print x
5 changes: 5 additions & 0 deletions examples/buggy/json/broken.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"name": "broken-json",
"enabled": true,
"items": [1, 2,]
}
4 changes: 4 additions & 0 deletions examples/buggy/lua/broken.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
local function broken(name)
print("hello " .. name)
if true then
broken("lua")
7 changes: 7 additions & 0 deletions examples/buggy/nix/broken.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{ pkgs }:

pkgs.mkShell {
packages = [
pkgs.git
;
}
4 changes: 4 additions & 0 deletions examples/buggy/ocaml/main.ml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
let greet name =
print_endline ("hello " ^ name

let () = greet "ocaml"
7 changes: 7 additions & 0 deletions examples/buggy/perl/broken.pl
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
use strict;
use warnings;

my $name = "perl";
if ($name eq "perl" {
print "broken\n";
}
5 changes: 5 additions & 0 deletions examples/buggy/powershell/broken.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
function Invoke-Broken {
param(
[string]$Name
Write-Output "Hello $Name"
}
7 changes: 7 additions & 0 deletions examples/buggy/r/broken.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
broken <- function(x) {
if (x > 0) {
print("positive")
else {
print("negative")
}
}
5 changes: 5 additions & 0 deletions examples/buggy/shell/broken.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/usr/bin/env bash
if [ "$1" = "run" ]; then
echo "running"
else
echo "missing fi"
Loading
Loading