AFAdocs

AFA Documentation

Autonomous Function Amplifier -- autonomous code evolution with quantitative rigor.

AFA -- Autonomous Function Amplifier

AFA is an autonomous code evolution engine. It analyzes every function in your codebase, generates improvement candidates using AI, validates each candidate through nine quantitative gates, and commits only when the math proves the change is worthwhile.

Why AFA

  • Quantitative gate validation -- nine gates with formal thresholds, not heuristic scores. Every enhancement must pass all nine before it touches your code.
  • Autonomous enhancement loop -- analyze, generate, validate, commit. No human in the loop for routine improvements.
  • Model-agnostic -- works with Anthropic, OpenAI, or Google Gemini. Swap providers without changing anything else.
  • Cryptographic audit trail -- SHA-256 hash chain per decision. Every gate evaluation is recorded and verifiable.

How it works

1. ANALYZE    Parse functions via tree-sitter + LLM semantic analysis
2. GENERATE   Create enhancement candidates via model-agnostic agents
3. VALIDATE   Run every candidate through 9 quantitative gates
4. COMMIT     Auto-commit if all gates pass and utility ratio > 1.0
5. LEARN      Track acceptance/rejection to improve over time

AFA uses a tri-plane architecture: the control plane (governance) never generates code; the data plane (execution) never makes governance decisions; the auth plane (identity, billing, access control) resolves tier and enforces rate limits but never evaluates gates or generates code.

Four ways to use AFA

SurfaceUse case
CLIDeveloper workflow: afa analyze ., afa enhance src/
REST APICI/CD integration, webhook-driven pipelines
GitHub AppAutomated PR review with gate-check status
MCP ServerIDE agents (Claude Code, Cursor) invoke AFA as a tool

Get started

Install AFA and run your first analysis in under three minutes.

Quickstart

On this page