Metadata-Version: 2.4
Name: corvid-lang
Version: 0.1.0
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Rust
Classifier: Programming Language :: Python :: 3
Classifier: Topic :: Software Development :: Compilers
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
License-File: LICENSE
Summary: The first programming language designed for AI
Keywords: ai,language,programming-language,agents,corvid
Author: Corvid Language Authors
License: MIT
Requires-Python: >=3.8
Description-Content-Type: text/markdown; charset=UTF-8; variant=GFM
Project-URL: Homepage, https://github.com/corvid-lang/corvid
Project-URL: Repository, https://github.com/corvid-lang/corvid

# Corvid

**The first programming language designed for AI.**

Every language in use today was built before AI. They treat intelligence as a library import, confidence as a float, verification as an afterthought, and cost as invisible. Corvid treats them as language primitives.

```corvid
agent researcher uses "gpt-4o-mini":
  can reason

  job analyze given topic as text:
    result = reason about topic: summarize the key points
    return result

flow main:
  answer = reason about "Corvid": write a one sentence greeting
  log "AI says: {answer}"
  return answer
```

```
$ corvid run app.cor

  running flow "main"...

  AI says: Hello Corvid, it's wonderful to connect with you today!
    (confidence: 0.85, cost: $0.0003)

  result: Hello Corvid, it's wonderful to connect with you today!
  total cost: $0.0003
  time:       1204ms
```

## What Corvid Does

**One file, full application.** Backend, frontend, AI, and database in a single `.cor` file. No boilerplate, no config files, no build steps.

**AI as a language primitive.** `reason`, `sense`, `translate`, `summarize`, `debate`, `compare` are keywords, not library calls. AI output carries confidence, cost, and model metadata automatically.

**Compile-time cost analysis.** The compiler knows how much your code will cost to run before you run it.

```
$ corvid cost app.cor

  Cost Analysis: app.cor

  Model:             gpt-4o-mini
  Cost per AI call:  $0.0006
  Estimated total:   $0.0012 per run

  Suggestions:
    - Using a local model (llama3, mistral) reduces cost to $0.
```

**Type-checked AI safety.** Using AI output without verification is a compile error.

```corvid
to bad_function given data:
  result = reason about data: summarize
  return result
```

```
$ corvid check app.cor

  error: "reason" used inside a pure function

  Why: Functions defined with "to" must be predictable.
       Use "job" instead if you need AI.
```

**English-readable syntax.** A non-programmer can read Corvid and understand what the application does. No symbols where words work.

```corvid
if age above 18 and plan is "pro":
  allow access
otherwise:
  show signup page
```

## Install

```bash
pip install corvid-lang
```

Corvid is written in Rust and distributed as a precompiled binary. No Rust toolchain needed.

## Quick Start

```bash
corvid new app.cor        # create a starter project
corvid run app.cor        # run it
```

The generated `app.cor` includes a record, an agent, a flow, and a page — a working full-stack app in 30 lines.

## CLI

```
corvid                          open interactive REPL
corvid run app.cor              execute a .cor file
corvid run app.cor --pretend    dry run (no real actions, no cost)
corvid serve app.cor            start API server + frontend
corvid check app.cor            parse + type check
corvid test app.cor             run inline tests
corvid cost app.cor             AI cost analysis with suggestions
corvid show app.cor             human-readable application summary
corvid bench app.cor            benchmark latency, cost, success rate
corvid watch app.cor            recheck on every file change
corvid install browse           install a capability
corvid list                     list installed capabilities
corvid new app.cor              create a starter file
```

## What You Can Build

### Todo App (25 lines)

```corvid
app "Todo"

record Task:
  title is text, required
  done is yes or no, default false

flow add_task given title as text:
  create Task:
    title is title
    done is false

page "Tasks":
  title is "My Tasks"
  form:
    input title as text, label "What needs to be done?"
    submit "Add" calls add_task
  show Task as table:
    columns: title, done
```

### AI Support Bot (30 lines)

```corvid
agent support uses "claude-sonnet-4-6":
  can reason, communicate
  costs at most $0.50 per task

  rules:
    never reveal customer data to other customers
    always respond in the customer language

  job handle given ticket as Ticket:
    response = reason about ticket.message: determine resolution and priority
    update ticket:
      change status to "resolved"
    return response
```

### Data Pipeline (20 lines)

```corvid
record Sale:
  product is text, required
  amount is number, required
  region is text, required

flow analyze:
  total = 0
  items = [1500, 2300, 1800, 3100]
  for each item in items:
    total = total + item
  log "Total revenue: {total}"
  need total above 5000
  return total
```

## AI Constructs

Corvid has AI operations that exist in no other language:

```corvid
── Think ──
answer = reason about data: summarize the key findings

── Detect mood/intent ──
mood = sense "I am so frustrated with this software!"
── → "Frustration"

── Translate ──
french = translate "Hello, how are you?" to "French"
── → "Bonjour, comment ça va ?"

── Summarize ──
short = summarize long_document
── → one paragraph

── Debate both sides ──
result = debate "Should AI have internet access?"
── → 3 rounds of FOR/AGAINST + VERDICT

── Compare ──
result = compare "Python" and "Rust"
── → winner, tradeoffs, recommendation

── Verify ──
check result:
  confidence above 0.8
  otherwise ask human to review
```

## AI Providers

Works with cloud and local models. Local models are free.

```corvid
── Cloud ──
agent helper uses "claude-sonnet-4-6":     ── Anthropic
agent helper uses "gpt-4o-mini":            ── OpenAI
agent helper uses "gemini-pro":             ── Google

── Local (free, no API key) ──
agent helper uses "llama3":                 ── Ollama
agent helper uses "mistral":                ── Ollama
agent helper uses "deepseek-coder":         ── Ollama
```

## Full-Stack Server

One command turns a `.cor` file into a full-stack application:

```bash
corvid serve app.cor
```

```
  Corvid server running at http://localhost:3000

  API endpoints:
    GET  /api/task          list records
    POST /api/task          create record
    POST /api/add_task      run flow
    GET  /api/health        health check
    GET  /                  frontend
```

The server auto-generates:
- SQLite database from record declarations
- REST API from flows and records
- HTML frontend from page declarations (dark/light theme)

## How It Compares

```
Python + FastAPI + React + SQLAlchemy + OpenAI SDK:
  200+ files, 3 languages, 15 config files, weeks of setup

Corvid:
  1 file, 1 language, 0 config files, minutes to production
```

## Stats

```
Language:     Rust
Tests:        101 passing
Source:       9,500+ lines across 19 files
Examples:     9 working applications
AI verified:  GPT-4o-mini end-to-end ($0.02/run)
CLI:          17 commands
Grammar:      ~130 keywords
```

## Documentation

- [CORVID.md](CORVID.md) — full language specification
- [GRAMMAR.md](GRAMMAR.md) — formal grammar reference (1,783 lines)
- [ROADMAP.md](ROADMAP.md) — development status and plans
- [CONTRIBUTING.md](CONTRIBUTING.md) — how to contribute

## License

[MIT](LICENSE)

---

*Corvid — the crow that reasons, remembers, coordinates, and learns.*

