Metadata-Version: 2.4
Name: converge-ai
Version: 0.1.0
Summary: Does your AI-generated code actually do what you asked?
License-Expression: MIT
Requires-Python: >=3.10
Description-Content-Type: text/markdown
Requires-Dist: anthropic>=0.25
Requires-Dist: pyyaml>=6.0
Provides-Extra: dev
Requires-Dist: pytest>=8; extra == "dev"

# Converge

**Does your AI-generated code actually do what you asked?**

Converge validates AI-generated code against the original intent using three pillars:

| Pillar | Question |
|--------|----------|
| **Intent Fidelity** | Does the code do what was asked? |
| **Optimal Design** | Is this the most natural solution? |
| **Code Consistency** | Is the code internally coherent? |

## Install

```bash
pip install converge
export ANTHROPIC_API_KEY=sk-...
```

## Usage

```python
from converge import ConvergeValidator

validator = ConvergeValidator()
result = validator.validate(code=my_code, intent=my_intent)

print(result)
# Converge — Iteration 1
# Verdict         : ✅ CONVERGED
# Intent Fidelity :  92.0  (threshold 80)
# Optimal Design  :  85.0  (threshold 80)
# Code Consistency:  88.0  (threshold 75)

if result.verdict != "CONVERGED":
    improved_code = agent_iterate(result.feedback)
```

## Iterative loop

```python
from converge import ConvergeValidator, ConvergeLoop

loop = ConvergeLoop(ConvergeValidator(), max_iterations=5)
for result in loop.run(initial_code, intent, generate_fn):
    print(result)
    if result.verdict == "CONVERGED":
        break
```

## Verdicts

| Verdict | Meaning |
|---------|---------|
| `CONVERGED` | All 3 pillars above threshold — ship it |
| `PARTIAL` | 2/3 pillars OK — iterate on feedback |
| `NON_CONVERGED` | Needs significant rework |

## Without API key

Converge works offline using a fast syntactic analyser (no LLM calls).
Set `ANTHROPIC_API_KEY` for full LLM-powered validation.

## License

MIT
