Connect to a locally running TallyPrime instance via XML-over-HTTP. All requests are HTTP POST to $TALLY_URL (commonly http://localhost:9000).
This skill handles only:
CategoryModes / TypesPurchase VoucherItem Invoice · Accounting Invoice · As VoucherPurchase Voucher ClassesPurchase @ 5 % · Purchase @ 18 % · Purchase @ 28 %Sales VoucherItem Invoice · As VoucherSales Voucher ClassesSales @ 5 % · Sales @ 18 % · Sales @ 28 %Bank StatementPayment · Receipt · ContraSales Invoice PDFtallyca CLI
For anything outside this scope, tell the user this skill does not cover that task.
YYYYMMDD (no separators).AMOUNT values = 0.& → & in narration and party names.BILLALLOCATIONS.LIST to keep outstandings correct.LEDGERENTRIES.LIST in Invoice Voucher View — never use ALLLEDGERENTRIES.LIST when OBJVIEW="Invoice Voucher View" is set; Tally silently ignores it.CREATED/ ERRORS from Tally's response (see reference/reports.md). Never confirm success if ERRORS > 0 or CREATED = 0.bash
curl -s --max-time 5 "$TALLY_URL"
Expected response:
xml
<RESPONSE>TallyPrime Server is Running</RESPONSE>
If no response, ask the user to open TallyPrime and enable integrations on the correct port.
Ask for the company name if not provided. Use the exact spelling in SVCURRENTCOMPANY.
When the user sends a PDF, JPEG, JPG, or PNG invoice or bill, use the scribe CLI. Do not extract data with the LLM directly.
bash
mkdir -p "scribe-extractions"
scribe type "<input.pdf>"
scribe extract -f txt "<input.pdf>" "scribe-extractions/<id>.txt"
Read the .txt file and parse the invoice fields. If quality is poor (image-native PDF), run OCR first:
bash
scribe recognize -h -o "scribe-extractions/<id>-ocr" "<input.pdf>"
scribe extract -f txt "scribe-extractions/<id>-ocr/<stem>.pdf" "scribe-extractions/<id>-recognized.txt"
Try direct extraction: bash
scribe extract -f txt "<input.jpeg>" "scribe-extractions/<id>.txt"
If output is empty, run OCR: bash
scribe recognize -h -o "scribe-extractions/<id>-ocr" "<input.jpeg>"
scribe extract -f txt "scribe-extractions/<id>-ocr/<stem>.pdf" "scribe-extractions/<id>-recognized.txt"
Present a clean summary to the user: supplier/customer, GSTINs, invoice number, date, line items, taxable value, CGST/SGST/IGST, round-off, total. Ask for confirmation before posting.
If extraction fails, say "I could not read this bill clearly. Please resend a clearer photo or PDF." — do not mention CLI, OCR, errors, or paths.
Before posting any voucher, verify that all required ledgers and (for Item Invoice) stock items exist. Use reference/ledgers.md and reference/inventory.md.
Ledger check ( reference/ledgers.md):
List of Accounts and confirm party ledger, purchase/sales ledger, and GST ledgers exist.reference/ledgers.md before posting.Inventory check — Item Invoice only ( reference/inventory.md):
Main Location / Primary Batch unless the company has custom godowns.Bank statement pre-flight ( reference/reports.md):
reference/reports.md).Load only the file that matches the task — this keeps context lean:
TaskReference filePurchase — stock itemsreference/purchase.md → Item InvoicePurchase — services/expenses (invoice layout)reference/purchase.md → Accounting InvoicePurchase — classic By/To viewreference/purchase.md → As VoucherSales — stock itemsreference/sales.md → Item InvoiceSales — no items (ledger-only)reference/sales.md → As VoucherMoney received from customerreference/bank.md → ReceiptMoney paid to vendor/expensereference/bank.md → PaymentBank/cash transferreference/bank.md → ContraLedger check / createreference/ledgers.mdStock item check / createreference/inventory.md
Voucher class decision — the class decision rules and GST ledger name table are at the top of each purchase/sales reference file. Run them before posting.
Preflight checklist before any Create:
#CheckReferenceBlock if…1Company confirmed—Not given — ask2Server reachable—No response3Party ledger existsreference/ledgers.mdMissing — create first4Purchase/Sales/GST ledgers existreference/ledgers.mdMissing — create first5Stock items exist (Item Invoice only)reference/inventory.mdMissing — create first6Voucher class confirmed (Purchase/Sales)purchase/sales reference fileUnknown — ask, never guess7GST header fields available (class mode)—Any missing — ask8Totals balance—Mismatch — fix before posting
After every voucher Create:
CREATED and ERRORS fields ( reference/reports.md). Stop if ERRORS > 0.reference/reports.md).Never say "Entry posted" without completing this review.
Use the tallyca CLI. Do not build PDFs manually.
bash
tallyca --version # must be >= 1.1.0
If missing or older: npm install -g tallyca@latest
Ask the user for only these 4 fields. Everything else is auto-filled from Tally:
FieldSourceparty-nameUseritemUser — stock item nameqtyUserrateUser — per unit
Execute in this order. Each step reduces what the user needs to provide:
FieldHow to auto-fillReferencedateDefault to today ( D/M/YYYY)—invoice-noFetch last Sales voucher number → +1reference/reports.md``unitFetch stock item master → BASEUNITS``reference/inventory.md``hsn-codeFetch stock item master → HSNDETAILS.LIST > HSNCODE``reference/inventory.md``gst-rateFetch stock item master → IGST rate from GSTDETAILS.LIST; or parse @ XX % from item namereference/inventory.md``customer-gstinFetch party ledger → $PARTYGSTIN``reference/ledgers.md``place-of-supplyFetch party ledger → $PriorStateName; if same state as company → intra-state (CGST+SGST), else IGSTreference/ledgers.md``billing-addressFetch party ledger → $Address (line 1); remaining lines from ADDRESS.LIST in any recent voucher to that partyreference/ledgers.md``company-gstinParse <CMPGSTIN> from any recent Day Book sales voucher exportreference/reports.md``company-addressFetch company → $Address, $PinCode, $StateName via Company TDL collectionreference/ledgers.md
Fallback: if any auto-fill fails, use --json-errors. The CLI returns a missing array — ask the user only for those specific fields, then retry.
Always use --no-interactive and --json-errors when running non-interactively:
bash
tallyca generate:invoice \
--company "ABC Company" \
--company-gstin "GSTIN_HERE" \
--company-address "Full company address, State PIN" \
--party-name "XYZ Party" \
--customer-gstin "PARTY_GSTIN" \
--billing-address "Party address, State" \
--invoice-no 186 \
--date "2/1/2026" \
--place-of-supply "Uttar Pradesh" \
--item "PQR Item" \
--qty 140 \
--unit Bag \
--rate 279.66 \
--hsn-code 25322210 \
--gst-rate 18 \
--b2b \
--output invoice_186.pdf \
--no-interactive \
--json-errors
On exit code 2 (validation failure): parse JSON from stderr, read the missing array, ask the user only for those fields, then retry. Never hand-build a PDF.
json
{"error":"validation","message":"Missing required invoice fields","missing":["place-of-supply","unit"],"warnings":[]}
bash
tallyca from-text \
--company "ABC Company" \
--text "Party Name: XYZ Party
Invoice No.: 186
Date: 2/1/2026
Place of Supply: Uttar Pradesh
Item: PQR Item 2523 @ 18 %
Qty: 140 Bag
Rate: 279.66/Bag
HSN Code: 25322210
Amount: 39152.40
Make sure to use voucher class Sales @ 18 %" \
--output invoice_186.pdf \
--no-interactive \
--json-errors
bash
export TALLYCA_PDF_BACKEND=pdfmake
Then run the same command. Do not substitute a hand-built PDF.
text
{companyShort}-{voucherType}-{invoiceNo}-{date}
Examples: abc-purchase-inv001-20260115 · abc-sales-186-20260201
After posting, do not mention XML, HTTP, payloads, status codes, or integration internals. Say: