tocmo0nlord 941da091b8 Step 6: Claude client + ai.task ledger + drafting agent + citation ledger (Tier 3)
TIER 3 scaffolding — structure built, legal CONTENT born unapproved/unverified and
NOT authoritative until attorney validation. External calls mocked in all tests.

familylaw.ai.client (AbstractModel service):
- _route_model() pluggable provider seam (Ollama = future config flip)
- BLOCKED_TASK_TYPES (trust_billing/reconciliation/iota) RAISE before any call —
  trust/billing never reaches a model (Bar Rule 5-1.1, IOTA)
- per-task token ceiling caps max_tokens; config via ir.config_parameter
- _call_provider isolates the real HTTPS call (the single mock point)
- generate() routes, calls, and logs an ai.task; returns (result, task)

familylaw.ai.task — the audit/economics ledger: model_used, prompt/completion/total
tokens, estimated cost_usd (per-model price table, flagged estimate), latency_ms,
request/response summaries, error, links to case/proceeding/document.

familylaw.citation — born 'unverified' (Gate 2 verification + filing block come in
Step 7); is_verified computed; linked to document + source ai.task.

familylaw.document.ai_assemble(): single-shot drafting agent — doc born ai_draft
(source ai), proposed citations born unverified, task linked. NOT auto-approved.
Plus familylaw.ai.draft.wizard for the UI walkthrough; Citations tab on document;
AI Draft button on proceeding; AI Tasks + Citations menus.

Tests (familylaw_step6, mocked _call_provider): doc born ai_draft, ai.task logged
with model+tokens+cost+latency, citations born unverified, token ceiling caps
max_tokens, trust/billing blocked before any provider call, provider error marks
task failed, deterministic cost estimate, missing-key raises, AI draft cannot be
filed even by an attorney (Gate 1 intact).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-02 04:10:01 +00:00
Description
No description provided
3.2 MiB
Languages
Python 100%