Call4Agents v0.1 threat model

What a bug or an attacker can and cannot do to the record and the approvals.

This covers the two v0.1 guarantees: once-only side effects and approvals bound to exact arguments. Everything here runs inside your agent's own process, on your machine.

What "once-only" means

At most once, with "in doubt" flagged. It does not mean exactly once.

Before a decorated effect runs, an intent row is written to the run record (SQLite, synchronous=FULL). A done row with the result is written right after it returns.

A crash happens... What happens on the next attempt
before the intent row The effect runs once. It never ran before.
after the done row The recorded result is returned. The effect does not run again.
during the effect (intent written, done not written) We cannot know whether the email left. We raise EffectInDoubt and do not repeat it. If you pass reconcile=, your check asks the outside system: if it finds the effect, we record it; if it reports the effect missing, we run it once more. We ask only when the caller that started it is provably gone (since Fix 17; see lease=): a call that is just slow is not a crash.

Parallel callers: many callers on the same effect at the same moment are serialised by a unique index on the intent. Exactly one runs it; the others wait for its result (up to wait seconds) or get EffectInDoubt. Measured in tests/stress_c4a_ledger.py: 14 callers, 1 email.

The default key is (run id, tool name, canonical arguments). A deliberate second identical action needs c4a_key="...".

Where the approval secret lives

  1. The C4A_SECRET environment variable, if it is set.
  2. Otherwise a 32-byte random file, .c4a/secret, created next to the run record. We set its mode to 0600; on Windows that mode is not enforced, so rely on the folder's access rights.
  3. Or c4a.init(secret=...) in code.

The secret never enters the model's context, the run record, or any log.

What the signed approval protects against

An approval is stored as HMAC-SHA256(secret, tool + canonical arguments). At execution time the MAC is recomputed from the arguments about to run, and the call is refused unless the two match.

What it cannot protect against

How each claim is checked (offline)

Check What it shows
tests/test_c4a_kit.py K1–K19 Each check is mutation-proven (python -m tests.mutations.run_kit_mutations)
tests/stress_c4a_ledger.py Parallel writers, kills mid-write, simultaneous callers
python -m call4agents demo The demo

All are synthetic: fake tools, fake crashes (os._exit), no real email or payment system.

Source: docs/THREAT_MODEL.md in the repository.