Skip to content
Kavachकवच

Tools for AI: context

● Intermediate2 min

kavach context gives a function, then what it uses, within a budget of tokens.

terminal
kavach context report src/main.kav --budget 300
// context for `report` in src/main.kav (~61 tokens)
fn report(orders: [Order]) -> String {
    "paid: {total_paid(orders)}"
}

// used by `report`:

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

/// The total of the paid orders.
fn total_paid(orders: [Order]) -> Decimal
    ensure result >= 0
{ … }

Everything needed to change report, and nothing else.