Skip to content
Kavachकवच

Tools for AI

Also known as: ai assistant llm claude cursor copilot tokens mcp outline query context index

● Intermediate4 minBefore this: SignaturesSpec 13

AI assistants pay for every token they read. Kavach hands them the part of the code they need, instead of whole files.

Most of an assistant's tokens go on finding and reading code, not on writing the change. A Kavach signature already says what a function takes, gives, can fail with, can touch and promises, so the body is rarely needed.

CommandGives
kavach outline file.kava file's declarations, without the bodies
kavach query callers | uses | fails | type | findone exact answer per question, instead of a text search and many reads
kavach context name --budget Na function, plus the types and signatures it uses, within a token budget
kavach mcpall of these, served to AI assistants over MCP

The program they answer about:

type Order {
    id: Int
    amount: Decimal
    paid: Bool
}

/// The total of the paid orders.
fn total_paid(orders: [Order]) -> Decimal
    ensure result >= 0
{
    let total: Decimal = 0
    for o in orders {
        if o.paid {
            total += o.amount
        }
    }
    total
}

fn report(orders: [Order]) -> String {
    "paid: {total_paid(orders)}"
}

fn main() {
    const orders = [Order(id: 1, amount: 9.50, paid: true), Order(id: 2, amount: 4.00, paid: false)]
    print(report(orders))
}
src/main.kav: Kavach code

One page for each form