PocketAccountant: custom ledger UI + deterministic agent (engine, ledger, retrieval, classifier)
c55ab5e verified | { | |
| "user": "Registra un ingreso de 27000 por un sitio web el 17 de mayo de 2024, con retención de ISR de 2700 e IVA de 2880. Luego dime qué régimen me conviene y cuánto IVA debo en mayo.", | |
| "steps": [ | |
| { | |
| "tool": "record_income", | |
| "arguments": { | |
| "date": "2024-05-17", | |
| "description": "Sitio web — Dental MX", | |
| "amount": 27000, | |
| "iva_rate": 0.16, | |
| "isr_retenido": 2700, | |
| "iva_retenido": 2880 | |
| }, | |
| "result": { | |
| "status": "booked", | |
| "transaction_id": 5, | |
| "message": "Income of 27000 booked on 2024-05-17." | |
| }, | |
| "ok": true | |
| }, | |
| { | |
| "tool": "compare_regimes", | |
| "arguments": { | |
| "year": 2024, | |
| "month": 5 | |
| }, | |
| "result": { | |
| "resico_isr": "495.00", | |
| "general_isr": "6994.74", | |
| "general_taxable_base": "39700.00", | |
| "recommended": "RESICO", | |
| "monthly_savings": "6499.74", | |
| "note": "RESICO is cheaper this month by 6499.74. Regime choice has eligibility rules and is annual — confirm with a CPA." | |
| }, | |
| "ok": true | |
| }, | |
| { | |
| "tool": "compute_iva", | |
| "arguments": { | |
| "year": 2024, | |
| "month": 5 | |
| }, | |
| "result": { | |
| "amount": "3472.00", | |
| "label": "IVA a cargo (mensual)", | |
| "breakdown": [ | |
| [ | |
| "IVA trasladado (cobrado en ventas)", | |
| "7200.00" | |
| ], | |
| [ | |
| "IVA acreditable (pagado en compras)", | |
| "848.00" | |
| ], | |
| [ | |
| "IVA retenido por clientes", | |
| "2880.00" | |
| ], | |
| [ | |
| "Neto", | |
| "3472.00" | |
| ] | |
| ], | |
| "source": "LIVA Art. 5-D", | |
| "effective_year": null, | |
| "notes": [] | |
| }, | |
| "ok": true | |
| } | |
| ], | |
| "final_answer": "Listo, registré el ingreso de $27,000.\n• Régimen: te conviene RESICO — pagarías $495.00 de ISR vs $6,994.74 en el régimen general (fuente: tarifas SAT 2024).\n• IVA de mayo: $3,472.00 a cargo (IVA cobrado $7,200 − acreditable $848 − retenido por clientes $2,880; LIVA Art. 5-D).\nRecuerda: la elección de régimen es anual y tiene requisitos — confírmalo con tu contador.", | |
| "messages": [ | |
| { | |
| "role": "system", | |
| "content": "You are Cuentas Claras, a meticulous accountant agent for Mexican freelancers and small businesses (with a USA mode). Follow these rules without exception:\n\n1. NEVER do arithmetic yourself. To compute any tax, total, ratio or statement, call the appropriate tool. The tools are the only source of numbers.\n2. To answer questions about the user's finances, first get the data with a tool (month_summary, income_statement, ...) and then a compute tool — do not guess.\n3. When you state a number, also state its source (the tool result includes it) and, for tax figures, the year of the tables used.\n4. If a question depends on a rule you cannot ground in a tool result, say so plainly and recommend confirming with a licensed Contador Público / CPA. Do not invent tax law.\n5. Be concise and explain in the user's language (Spanish by default).\n\nYou are an assistant, not a substitute for a professional accountant.\n" | |
| }, | |
| { | |
| "role": "user", | |
| "content": "Registra un ingreso de 27000 por un sitio web el 17 de mayo de 2024, con retención de ISR de 2700 e IVA de 2880. Luego dime qué régimen me conviene y cuánto IVA debo en mayo." | |
| }, | |
| { | |
| "role": "assistant", | |
| "content": "", | |
| "tool_calls": [ | |
| { | |
| "id": "call_0", | |
| "type": "function", | |
| "function": { | |
| "name": "record_income", | |
| "arguments": "{\"date\": \"2024-05-17\", \"description\": \"Sitio web \\u2014 Dental MX\", \"amount\": 27000, \"iva_rate\": 0.16, \"isr_retenido\": 2700, \"iva_retenido\": 2880}" | |
| } | |
| } | |
| ] | |
| }, | |
| { | |
| "role": "tool", | |
| "tool_call_id": "call_0", | |
| "name": "record_income", | |
| "content": "{\"status\": \"booked\", \"transaction_id\": 5, \"message\": \"Income of 27000 booked on 2024-05-17.\"}" | |
| }, | |
| { | |
| "role": "assistant", | |
| "content": "", | |
| "tool_calls": [ | |
| { | |
| "id": "call_0", | |
| "type": "function", | |
| "function": { | |
| "name": "compare_regimes", | |
| "arguments": "{\"year\": 2024, \"month\": 5}" | |
| } | |
| }, | |
| { | |
| "id": "call_1", | |
| "type": "function", | |
| "function": { | |
| "name": "compute_iva", | |
| "arguments": "{\"year\": 2024, \"month\": 5}" | |
| } | |
| } | |
| ] | |
| }, | |
| { | |
| "role": "tool", | |
| "tool_call_id": "call_0", | |
| "name": "compare_regimes", | |
| "content": "{\"resico_isr\": \"495.00\", \"general_isr\": \"6994.74\", \"general_taxable_base\": \"39700.00\", \"recommended\": \"RESICO\", \"monthly_savings\": \"6499.74\", \"note\": \"RESICO is cheaper this month by 6499.74. Regime choice has eligibility rules and is annual — confirm with a CPA.\"}" | |
| }, | |
| { | |
| "role": "tool", | |
| "tool_call_id": "call_1", | |
| "name": "compute_iva", | |
| "content": "{\"amount\": \"3472.00\", \"label\": \"IVA a cargo (mensual)\", \"breakdown\": [[\"IVA trasladado (cobrado en ventas)\", \"7200.00\"], [\"IVA acreditable (pagado en compras)\", \"848.00\"], [\"IVA retenido por clientes\", \"2880.00\"], [\"Neto\", \"3472.00\"]], \"source\": \"LIVA Art. 5-D\", \"effective_year\": null, \"notes\": []}" | |
| }, | |
| { | |
| "role": "assistant", | |
| "content": "Listo, registré el ingreso de $27,000.\n• Régimen: te conviene RESICO — pagarías $495.00 de ISR vs $6,994.74 en el régimen general (fuente: tarifas SAT 2024).\n• IVA de mayo: $3,472.00 a cargo (IVA cobrado $7,200 − acreditable $848 − retenido por clientes $2,880; LIVA Art. 5-D).\nRecuerda: la elección de régimen es anual y tiene requisitos — confírmalo con tu contador." | |
| } | |
| ] | |
| } |