Agent Native Compiler Protocol, or ANCP, is a language-neutral protocol for making existing compiler, linter, formatter, test, and build toolchains usable by coding agents without forcing every ecosystem to invent a new programming language.
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.
This repository is the implementation-ready public contract for ANCP 1.0:
| Area | Status | Location |
|---|---|---|
| Normative protocol spec | Written | spec/ancp-1.0.md |
| JSON Schema contract | Written | schemas/ancp-1.0.schema.json |
| Core diagnostic taxonomy | Written | taxonomies/diagnostic-kinds.json |
| Core repair taxonomy | Written | taxonomies/repair-kinds.json |
| Core effect taxonomy | Written | taxonomies/effect-kinds.json |
| CLI contract | Written | docs/cli-contract.md |
| Adapter authoring guide | Written | docs/adapter-authoring.md |
| Conformance rules | Written | docs/conformance.md |
| Security model | Written | docs/security.md |
| Language mapping guide | Written | docs/language-mapping.md |
| Example protocol documents | Written | examples |
| Repository verifier | Written | tools/verify_repo.py |
There is intentionally no language adapter implementation in this repo yet. The point of this repository is to make the contract final enough that implementation becomes straightforward.
Most compiler and test outputs were designed for humans:
- prose error messages,
- unstable text formatting,
- file-line-column references without durable anchors,
- no typed repair intent,
- no machine-readable validation loop,
- no explicit distinction between safe edits and dangerous commands,
- documentation that may not match the installed tool version.
Coding agents can work around this, but every workaround is brittle. ANCP standardizes the missing layer.
ANCP does not replace compilers, language servers, static analyzers, package managers, or test runners. It wraps them with a stable protocol:
compiler / linter / test / LSP / build tool
|
v
language adapter
|
v
ANCP JSON documents
|
v
agents, IDEs, CI, repair bots
-
Language neutral, not language vague. ANCP uses broad canonical categories, but every diagnostic still keeps native tool codes and source metadata.
-
Stable IDs over prose parsing. Agents match
canonicalCode,nativeCode,repairId, anddocumentKind, not English error strings. -
Repair plans before mutation. ANCP repair is a plan with preconditions, edits, commands, safety level, and verification steps. Blind auto-editing is not the protocol default.
-
Positions must be relocatable. Line and column are not enough. ANCP locations carry ranges, file digests, expected text, and optional anchors such as symbols, AST paths, and context hashes.
-
Security is part of the contract. Plans declare capabilities, filesystem/network/process effects, risk, and whether review is required.
-
Adapters are honest about support. ANCP uses profiles and capability negotiation. A Python adapter can be useful without supporting Rust borrow diagnostics. A linter-only adapter can be conformant without build support.
-
Compatibility with existing standards matters. ANCP is designed to interoperate with JSON Schema, LSP, SARIF, SPDX, CycloneDX, JSON Patch, and JSON canonicalization rather than replacing them.
Every ANCP payload is a JSON document with:
ancpVersiondocumentKindproducercreatedAt- document-specific fields
The main document kinds are:
| Kind | Purpose |
|---|---|
manifest.adapter |
Describes an adapter implementation and its supported profiles. |
manifest.capabilities |
Describes discovered project capabilities, operations, tools, languages, and effects. |
result.check |
Reports diagnostics from compile/lint/type/test/build checks. |
result.explain |
Explains a diagnostic or repair in structured form. |
plan.repair |
Describes repair actions, edits, commands, preconditions, and verification. |
result.apply |
Reports the result of applying a repair plan. |
result.verify |
Reports post-repair validation. |
graph.code |
Reports symbols, dependencies, call edges, ownership edges, or module relationships. |
result.skills |
Returns version-matched agent guidance from the adapter. |
ANCP is split into profiles so most languages can implement it without lying about capabilities.
| Profile | Required | Purpose |
|---|---|---|
core |
Yes | Discovery, check results, diagnostics, locations, taxonomy, versioning. |
explain |
Recommended | Structured diagnostic explanations. |
repair-plan |
Recommended | Machine-readable repair plans. |
repair-apply |
Optional | Transactional repair application. |
verify |
Recommended | Post-repair validation and diagnostic delta reporting. |
graph |
Optional | Code graph, symbol graph, dependency graph. |
effects |
Optional | Capability and effect metadata. |
skills |
Optional | Version-matched agent instructions. |
export |
Optional | Export to SARIF, CycloneDX, SPDX, or project-native formats. |
A conformant core adapter can expose this loop:
ancp manifest
ancp capabilities --json
ancp check --json
ancp explain ancp.diag.symbol.unresolved --json
ancp repair --plan --json
ancp verify --jsonThe adapter may internally call tsc, pyright, ruff, pytest, rustc, cargo check, go test, mypy, clang, javac, an LSP server, or any other native tool.
{
"ancpVersion": "1.0.0",
"documentKind": "result.check",
"producer": {
"name": "ancp-typescript-adapter",
"version": "1.0.0"
},
"createdAt": "2026-05-21T00:00:00Z",
"status": "failed",
"workspace": {
"rootUri": "file:///repo",
"workspaceId": "sha256:8f9f0b7a"
},
"run": {
"runId": "run-ts-001",
"command": ["tsc", "--noEmit", "--pretty", "false"],
"startedAt": "2026-05-21T00:00:00Z",
"durationMs": 421
},
"toolchain": [
{
"name": "typescript",
"version": "5.8.3",
"role": "typechecker"
}
],
"diagnostics": [
{
"id": "diag-001",
"canonicalCode": "ancp.diag.symbol.unresolved",
"nativeCode": "TS2304",
"severity": "error",
"kind": "symbol",
"message": "Cannot find name 'renderUser'.",
"primaryLocation": {
"artifact": {
"uri": "file:///repo/src/app.ts",
"languageId": "typescript"
},
"range": {
"unit": "utf16",
"start": { "line": 12, "character": 9 },
"end": { "line": 12, "character": 19 }
}
},
"repairHints": [
{
"repairId": "ancp.repair.symbol.import_missing",
"title": "Import the missing symbol from an existing module",
"confidence": 0.82,
"safetyLevel": "review_required"
}
]
}
]
}Run:
python tools/verify_repo.pyThe verifier checks:
- every JSON file parses,
- the main ANCP schema parses,
- examples validate against the schema when
jsonschemais installed, - taxonomy entries have stable IDs,
- documentation links point to existing local files.
For full local validation:
python -m pip install -r requirements-dev.txt
python tools/verify_repo.pyThis repository treats the protocol contract as production-facing even before any adapter implementation exists.
For ANCP itself, production quality means:
- the normative spec, schema, taxonomies, examples, and adapter docs agree with each other,
- example protocol documents validate against the schema,
- every claimed document kind and profile is documented,
- repair plans include preconditions, effects, safety levels, and verification steps,
- local source snapshots exist for the standards and language/toolchain docs used to design the contract,
- verification can be rerun locally with deterministic scripts.
For an ANCP adapter, production quality means:
- it emits valid ANCP JSON on success and failure,
- it preserves native diagnostic codes and tool versions,
- it uses structured native APIs when available instead of parsing prose,
- it never mutates files in plan mode,
- it labels risky actions honestly,
- it does not claim verification unless verification actually ran.
ANCP intentionally borrows from existing standards:
- JSON Schema Draft 2020-12 for validation.
- LSP for locations, diagnostics, code actions, and language tooling shape.
- SARIF for static-analysis interchange and code-scanning export.
- RFC 6902 JSON Patch for metadata patch operations where JSON patching is appropriate.
- RFC 8785 JSON Canonicalization Scheme for deterministic signing and hashing.
- SPDX and CycloneDX for software identity, dependency, licensing, and bill-of-materials export.
ANCP adds the missing agent-facing contract: typed repair intent, repair plans, validation loops, adapter profiles, stable agent guidance, and cross-language diagnostic normalization.
This repository is licensed under Apache-2.0. The intent is permissive OSS use by language adapter authors, IDE authors, agent runtimes, CI systems, and research projects.