Research: designing a secure-by-default, AI-first programming language

Summary

The strongest evidence points to four foundations for a secure-by-default, AI-first language:

  1. Memory safety as a guarantee that cannot be switched off. Escape hatches are kept narrow and clearly marked.
  2. Object capabilities with no ambient authority. There are no globals and no unrestricted filesystem or network access. Code gets that access only when a capability is passed in explicitly.
  3. Effects and requirements declared in every function signature and checked statically.
  4. Machine-checkable contracts, plus language and library designs that make whole vulnerability classes impossible to write (for example, SQL injection). Code written by an agent is then verified rather than trusted.

Benchmarks show why this matters. LLMs routinely write code that works but is insecure. On CWEval, pass rates drop about 30% when security is also required. 45% of samples failed Veracode's tests, and 73-90% of snippets were vulnerable on prompts targeting specific CWEs. Safety therefore has to come from the language and its tooling, not from the model.

Experimental AI-first languages (Vera, Nexus) share one premise: models do best when everything relevant (effects, dependencies, contracts, binding structure) is explicit and local in the source text. That premise comes from the language authors and has not been measured. The capability and effect mechanisms themselves are well established, in Pony and in academic work (Callℇ).

Findings

1. Make memory safety a non-negotiable baseline. (Confidence: high, vote 3-0)

Government guidance names memory-safe languages (MSLs) as the most complete mitigation for the bug class behind about 70% of serious vulnerabilities. It recommends writing all new code in an MSL.

Sources: CISA 2025 alert, The Case for Memory Safe Roadmaps

2. Escape hatches are where guarantees break down, so restrict them and mark them in the syntax. (Confidence: high, vote 3-0)

Unsafe blocks and FFI are where memory and capability guarantees fail. A secure-by-default language should:

Evidence:

The design recommendation is inferred from these sources. They do not state it directly.

Sources: CISA roadmaps, Pony tutorial: object capabilities, Pony patterns: object capabilities

3. Use object capabilities and eliminate ambient authority. (Confidence: high, vote 3-0)

Evidence:

Source: Pony tutorial: object capabilities

4. Structure authority as a single-root hierarchy that the compiler enforces and that only flows downward. (Confidence: high, vote 3-0)

main receives the root token and hands narrower tokens to components, so each component gets least authority by construction.

Sources: Pony patterns: object capabilities, Pony patterns: authority hierarchy

5. Declare effects in signatures and check them statically. (Confidence: medium, vote 3-0)

A type-and-effect system can stop code from performing privileged operations (database, network, UI, process exit) or non-deterministic operations unless they are declared. The annotation burden can be kept low.

Confidence is medium because Callℇ is a research prototype and Vera and Nexus are small experimental projects.

Sources: Callℇ (arXiv 1907.04934), Vera, Nexus

6. Make contracts mandatory and machine-checked, and make common vulnerability classes impossible to write. (Confidence: medium, vote 3-0)

The point is that agent-generated code only has to be checkable, not correct on the first try.

Caveats:

Source: Vera

7. Two AI-first design premises that are untested. (Confidence: low, vote 3-0 that the projects make these claims)

The premises:

Evidence:

Neither project offers evidence that these choices improve what LLMs produce.

Sources: Vera, Nexus

8. LLMs consistently produce code that works but is insecure. (Confidence: high, vote 3-0)

A large share of generated code contains high-severity CWE and OWASP vulnerabilities. A language meant for agents should make the secure path the default rather than relying on the model.

BenchmarkScopeKey findings
CWEval (Jan 2025)119 tasks, 31 CWEs, 5 languagesPass rates drop about 30% from functional-only (func@10) to functional and secure (func-sec@10). The largest drop is 35.79%, for Gemini 1.5 Flash. GPT-4o scores 90.71 vs 65.33 at k=10 and 80.81 vs 50.21 at k=1.
Veracode (Jul 2025)More than 100 LLMs45% of samples failed security tests with OWASP Top 10 vulnerabilities.
Morkonda et al. (2026)7 tools, 81 LLMSecEval Python prompts73-90% of snippets per tool had at least one vulnerability. There were 995 vulnerabilities across 567 snippets: 65% High and 33% Critical.

Sources: CWEval (arXiv 2501.08200), Veracode GenAI code security report, Morkonda et al. (arXiv 2605.23091)

Refuted claims (excluded)

ClaimVoteSource
Nexus checks capabilities twice: at build time, and at runtime through WASI permissions such as PermNet and PermConsole.1-2Nexus docs
LLM security performance did not improve with model size or newer training.0-3Veracode
The most common weakness was CWE-200, and 69% of those instances came from Flask debug mode.0-3arXiv 2605.23091

Caveats

Open questions

  1. Do explicit effects, capabilities, mandatory contracts, or nameless bindings (De Bruijn indices) actually improve the security or correctness of code that LLM agents write, compared with conventional languages? No controlled study was found.
  2. How should strong static verification (SMT-backed contracts, effect typing) be balanced against how easily models learn the language? A new language has almost no training data. Can compiler error messages, docs, or a constrained grammar make up for that?
  3. How should unsafe and FFI boundaries, and interop with existing ecosystems, be designed so that capability and memory-safety guarantees are not quietly undermined?
  4. Beyond SQL injection, which vulnerability classes common in LLM output can language or standard-library design make impossible to write? Candidates include XSS, log injection, exposed secrets, and insecure defaults. Which still need runtime or analysis tooling?

Relevance to Oska

This section is an editorial mapping onto docs/design.md. It is not a research finding.

Already aligned with the high-confidence findings:

Gaps worth considering:

All sources fetched

SourceQualityAngle
VeraprimaryLLM-oriented language design
AILang: why AILangblogLLM-oriented language design
Nexus docsprimaryLLM-oriented language design
Akita: best programming language for LLMsblogLLM-oriented language design
Why we built ll-langblogLLM-oriented language design
LLM-friendly languageunreliableLLM-oriented language design
CISA 2025 memory-safety alertprimarySecure-by-default features
The Case for Memory Safe RoadmapsprimarySecure-by-default features
Pony tutorial: object capabilitiesprimarySecure-by-default features
SecurityWeek: CISA secure-by-designsecondarySecure-by-default features
Callℇ (arXiv 1907.04934)primarySecure-by-default features
Pony patterns: object capabilitiesprimarySecure-by-default features
CWEval (arXiv 2501.08200)primaryAI-generated code vulnerabilities
Veracode GenAI code security reportprimaryAI-generated code vulnerabilities
arXiv 2605.23091primaryAI-generated code vulnerabilities
arXiv 2506.23034primaryAI-generated code vulnerabilities
arXiv 2604.13927primaryAgent tooling and feedback loops
arXiv 2510.22907primaryAgent tooling and feedback loops
arXiv 2602.11481primaryAgent tooling and feedback loops
arXiv 2410.03981primarySkeptical and tradeoffs view
arXiv 2501.19085primarySkeptical and tradeoffs view
Can a new language survive when LLMs only know the old ones?secondarySkeptical and tradeoffs view
Akita: are there better languages for programming with LLMs?blogSkeptical and tradeoffs view