ENGINE 24
SFS-E24-GRT · GROSS-RECEIPTS TAX · REV 2026-07-24 · PRODUCTION
PRODUCTION = runnable end-to-end, CI-backed, full test suite passing. All data fictional and seeded.
Gross-Receipts & Excise Tax
Is the tax the tax the receipts produce?
A developer that manages projects across several taxing jurisdictions owes a gross-receipts or excise tax in each one -- a state Business & Occupation tax, a city excise, a territorial general-excise tax -- and each carries its own classification rate, filing cadence, deductions, thresholds and due dates, and each rate can change mid-year. The tax on a worksheet is a derived figure, and it goes wrong in ways that look right on the page: a base that does not tie the general-ledger pull, a rate that was right last quarter, a deduction taken after it was exhausted, a below-threshold rule claimed above the threshold, a filing that is missing, late or unapproved. This engine reads the seven artifacts the reconciliation file carries -- the entity register, the jurisdiction rate table, the GL revenue pull, the filing register of worksheets, the per-filing tax summary, the business-licence register and the portfolio excise report -- and runs twenty-seven deterministic controls over them. Is the file complete and the review date legible, is the entity register sound and every entity's filing scope declared, is each jurisdiction's cadence known and its rate windows forward-running, does the GL pull tie the worksheet's gross, does each worksheet re-derive its base, apply the rate in force for the period, and recompute its pre-credit tax, credit and tax due to the cent, is every expected filing present, on time and approved before it was filed, is each licence active, and does the portfolio rollup recompute from the worksheets beneath it. It re-derives every tax through the same kernel that produced the data, compares every figure with exact ==, and never writes to a source artifact.
The tax on a worksheet is arithmetic that already happened, and every place it can go wrong is a place the paper still looks finished. A revenue line drops on the way from the GL pull to the worksheet and the base is short, so the tax is short, and the return files clean. A classification rate changes mid-year and last quarter's rate is applied to this quarter's receipts -- the multiplication is internally consistent and still wrong. A standard deduction already spent is taken again, a small-business credit is read off the wrong bracket, a below-threshold no-tax rule is claimed on receipts over the threshold. A filing that should exist for an entity-jurisdiction-period simply is not there, or went out after its due date, or before anyone approved it. And the portfolio total a controller signs is a number maintained beside the summary rather than re-added from it. None of these announce themselves; each surfaces when an assessment arrives. The engine re-derives every worksheet's base, rate, credit and tax from the receipts and the rate table through the one kernel that generated the data, enumerates every expected filing from the calendar and proves it present, timely and approved, ships a planted-defect file for every registered control, and states its benchmark as a command rather than a claim. A tax computed on an unreconciled base, or at a stale rate, is invisible until the jurisdiction recomputes it for you.
Architecture
functional block stack · static overviewSelect a layer
Eleven control families run in registry order over each reconciliation file. The first proves the others had something to read and that the review date is legible, because a control that passes on absent evidence reports assurance it never performed.
Key specifications
at a glanceWhat it does for you
plain termsA developer that manages projects across several taxing jurisdictions owes a gross-receipts or excise tax in each one -- a state Business & Occupation tax, a city excise, a territorial general-excise tax -- and each carries its own classification rate, its own filing cadence (monthly, quarterly, annual), its own deductions, thresholds and due dates, and each rate can change mid-year. The filer prepares one worksheet per entity per jurisdiction per period and files it. The tax on that worksheet is a derived figure, and four failures hide inside it, none of which look wrong on the page. The base does not tie the ledger: a revenue line is omitted or a non-taxable back-out is overstated, and the tax is computed on a base nobody reconciled to the GL pull. The rate is the wrong rate: a classification rate changed mid-year and the worksheet applied last quarter's rate to this quarter's receipts, and the arithmetic is internally consistent and still wrong. A deduction or credit is misapplied: a standard deduction already exhausted is taken again, a below-threshold no-tax rule is claimed above the threshold, or a small-business credit is read off the wrong bracket. And the calendar has a hole: an entity-jurisdiction-period that should have a filing has none, a return was filed after its due date, or filed before anyone approved it. None of these are judgment calls. They are equalities and comparisons -- a base against the GL, a rate against the window that covers the period, a re-derived tax against the number filed, a filing against the calendar -- which a deterministic control settles better than a spreadsheet inherited by whoever prepares the returns this year. This engine audits the tax return; where a cost lands on a project is a separate engine's job, and this one explicitly declines to check it.
The seeded demo runs every control over every reconciliation file7. The CLI generates twenty-nine fictional reconciliation files -- one clean baseline and one carrying each of the twenty-eight planted defects -- then runs all twenty-seven controls over each. The clean file returns PASS with no flags; every defect file returns REVIEW or FAIL and names the control it tripped along with the reason that control exists.
A rate that was right last quarter is wrong for this period8. A boundary test sets a classification rate window to change mid-year and files a worksheet for a period inside the new window at the prior window's rate. eff_rate_matches_period looks up the rate whose window covers the period's start date and fails because the worksheet applied a rate no longer in force, even though the tax computed on it re-derives internally -- a rate right one quarter and stale the next is invisible in a column of consistent arithmetic.
The determination is recomputed, not read back9. A test flips a summarised tax-due figure to contradict its worksheet's receipts. rpt_summary_recomputes rebuilds the tax from the worksheet's gross, back-out and standard deduction through the shared kernel -- base, rate, credit and net -- and fails because the stated determination no longer matches the receipts, proving the rollup is recomputed rather than trusted.
Functional block diagram
engineering · each block links to its sourcePlain terms
- Seeded Reconciliation Files. fictional gross-receipts & excise tax reconciliation files enter the control registry
- Structural Precondition. is the reconciliation file complete and the review date legible
- Entity Register. is the register sound and every filing scope declared
- Jurisdiction Rate Table. is the cadence known and every rate window sound
- GL Revenue Pull. is the pull sound, attributable, mapped, and does the base tie it
- Filing Register. is every worksheet well-formed, unique per obligation and attributable
- Rate in Force. was the rate the worksheet used the rate in force for the period
- Tax Re-derivation. does the tax re-derive from base times rate, net of credit
- Deductions & Credits. do the base, the back-out and the credit follow the rules
- Filing Calendar. is every expected filing present, timely and approved
- Business Licence. is each licence active, and any renewal flagged
- Portfolio Rollup. does the rollup recompute from the worksheets
- Registers & Rate Table. the entity register, rate table, GL pull and worksheets every rule resolves against
- Verdict and Findings. every finding, with the reason it exists, ends at a person
Engineering
- Seeded Reconciliation Files. generate_corpus writes one clean baseline plus one planted-defect file for every registered control, twenty-nine files in total. Only the entities, the jurisdiction rate table, the GL revenue lines and the worksheet calendar facts are stated; each worksheet's gross, back-out, base, rate, pre-credit tax, credit and tax due, the per-filing tax summary and the portfolio totals are derived through the same tax kernel the engine later recomputes with, so the relationships the engine tests are the same relationships that produced the data.
- Structural Precondition. One control. FAILs a file missing any of the seven artifact types or carrying a duplicate, and FAILs an unreadable as_of, so no downstream rule holds vacuously on absent evidence.
- Entity Register. Two controls: unique entity ids, and every active entity declaring a non-empty set of filing jurisdictions that all exist in the jurisdiction register.
- Jurisdiction Rate Table. Two controls: a known cadence and a classification on every jurisdiction, and rate windows that run forward with a non-negative basis-point rate.
- GL Revenue Pull. Five controls: required fields present, unique line ids, a known entity and jurisdiction on every line, every line mapped to a worksheet, and each worksheet's gross summing the GL lines under it.
- Filing Register. Three controls: required descriptive fields present, one worksheet per obligation with a unique id, and a known entity and jurisdiction for every worksheet.
- Rate in Force. One control: the classification rate whose window covers the period's start date is looked up and compared to the rate the worksheet applied, catching a stale rate and an uncovered period.
- Tax Re-derivation. Two controls: the pre-credit tax equals the base struck at the rate, and the tax due equals the pre-credit tax net of the credit clamped at zero, both compared with exact ==.
- Deductions & Credits. Three controls: the base re-derives from gross less back-out less standard deduction, the back-out ties the ledger, and the credit re-derives from the jurisdiction's threshold and small-business schedule.
- Filing Calendar. Four controls: every expected filing enumerated and present, filed on or before its due date, flagged when unfiled and due soon, and approved before it was filed.
- Business Licence. Two controls: every active entity holds an active licence in each jurisdiction it files in, and an active licence renewing inside the lead window is flagged for renewal.
- Portfolio Rollup. Two controls: each summarised tax-due figure re-derives from the worksheet's receipts through the shared kernel, and the portfolio total and filing count tie the summary.
- Registers & Rate Table. The entity register carries each entity's id, status and required jurisdictions; the jurisdiction rate table carries each jurisdiction's cadence, classification, rate windows, threshold and small-business cap and the periods expected this cycle; the GL revenue pull carries the receipts lines; the filing register carries the worksheets. Revenue, rate, deduction, calendar and rollup controls all resolve against these, and the tax for a worksheet re-derives from its gross, back-out and standard deduction through the one kernel in grt_engine.grt.
- Verdict and Findings. Findings roll up per reconciliation file: any FAIL is FAIL, FLAGs without FAILs are REVIEW, clean is PASS. The CLI exit code is the verdict, so a pipeline can gate on it. Reports carry no timestamps or absolute paths, which is what makes the committed report diffable.
Instruction set
every public command| Command | Operation | Output | Exit | Artifacts |
|---|---|---|---|---|
python run.py | regenerate the seeded fictional corpus, run all twenty-seven controls, write both reports | per-file verdicts and every actionable finding, then the overall verdict | 2 for the bundled corpus, which carries a planted defect for every control by design | grt_report.json, grt_report.md, samples/ |
python -m grt_engine samples | analyze an existing folder of reconciliation files without regenerating it | per-file verdicts and findings | 0 PASS / 1 REVIEW / 2 FAIL / 3 usage | none unless --json or --md is passed |
python -m grt_engine samples --generate --quiet | regenerate the corpus and print only the overall verdict | a single verdict line | 0 PASS / 1 REVIEW / 2 FAIL / 3 usage | samples/ |
python -m pytest grt_engine/tests -q | run the full test suite for this engine | 10400 passed | 0 when every test passes | none |
Benchmarks
measured demo results| Measure | Result |
|---|---|
| Engine tests10 | 10,400 tests collected live collection from the engine directory |
| Registered controls11 | 27 controls counted from the registry, not from documentation |
| Planted defects12 | 28 defect files every registered control has at least one file that trips it |
| Control coverage13 | 100 percent of controls with a planted defect no control ships without a file demonstrating it firing |
Control characteristics
engineeringPlain terms
The engine has no write path and therefore no autonomy to gate. It produces findings; a person decides whether a worksheet is treated as filed correctly and whether a return or renewal is chased.
Engineering
Deterministic envelope. seeded fictional inputs, read-only operation, offline default mode.
Demo gate. FAIL on the bundled corpus, by design -- it carries a planted defect for every registered control
| Severity | Verdict | Action |
|---|---|---|
| No findings above PASS | PASS | carry the mechanically clean reconciliation file into the documented sign-off and filing review |
| One or more FLAG, no FAIL | REVIEW | a human resolves each flag; an unfiled worksheet due inside the lead-time window and a business licence due to renew inside it both land here |
| One or more FAIL | FAIL | the worksheet is not treated as filed correctly until the failing control is cleared -- a base off the ledger, a stale rate, a misapplied deduction or credit, a missing, late or unapproved filing, or a rollup that does not recompute |
- Read-only: reconciliation files are parsed and never written back, so the engine cannot introduce the break it reports.
- Integer cents throughout, compared with exact ==; there is no tolerance band on a tax, and a cent off the re-derived figure is reported as a break.
- An amount that should be integer cents but is not produces an AMOUNT_INVALID finding contained to the one row it was read on, rather than being coerced into the number the engine is meant to audit.
- One tax computation: the controls and the generator share the kernel in grt_engine.grt, so a re-derived tax cannot disagree with the data that produced it.
- Deterministic and byte-stable: same inputs produce the same findings in the same order, with no timestamps or absolute paths in any output.
- Absent evidence is never a passing control; a missing artifact fails completeness rather than letting the controls that read it pass unread.
Operating limits
what it refuses to do- The engine never files a return, contacts a jurisdiction, remits a payment, chases a renewal, or writes to a source artifact. It reads the reconciliation file and stops.14
- It reads the seven artifacts the reconciliation process emits. It does not connect to a general-ledger system, a jurisdiction's e-file portal, a licensing authority or the underlying returns.15
- It is about whether the tax on the worksheet is the tax the receipts produce, not where a cost lands: cost allocation across projects is a separate engine's job, and this engine explicitly declines to check it.16
- It proves a worksheet's tax re-derives from the rate table it was given, not that the rate table states the correct statutory rates or that a receipt was classified into the right activity. That judgment is a reviewer's.17
- It takes the receipts at face value: it confirms the base ties the GL pull provided, not that the pull is complete against the books or that the return was accepted by the jurisdiction. All shipped data is fictional and every period is set in a fictional future.18
See it run
control architecture
Integration
how to run itDistribution: public repository, MIT license.
- 1python -m pytest --collect-only -q -o addopts= (gross-receipts-tax-automation/)
- 2len(grt_engine.engine.REGISTRY)
- 3distinct rule-id prefixes in grt_engine.engine.REGISTRY
- 4samples/*.json after python run.py
- 5len(grt_engine.model.DOC_TYPES)
- 6grt_engine/tests/test_control_semantics.py::test_tax_due_recomputes_to_the_cent
- 7python run.py (gross-receipts-tax-automation/); grt_engine/tests/test_planted_defects.py::test_defect_fires_its_intended_rule
- 8grt_engine/tests/test_control_semantics.py::test_rate_in_force_at_the_window_boundary
- 9grt_engine/tests/test_control_semantics.py::test_summary_must_recompute_from_receipts
- 10python -m pytest --collect-only -q -o addopts= (gross-receipts-tax-automation/)
- 11len(grt_engine.engine.REGISTRY)
- 12len(grt_engine.generate.DEFECTS)
- 13grt_engine/tests/test_planted_defects.py::test_every_registered_rule_has_a_planted_defect
- 14gross-receipts-tax-automation/README.md and grt_engine/tests/test_readonly_and_determinism.py::test_analysis_does_not_touch_the_source
- 15grt_engine/model.py DOC_TYPES
- 16grt_engine/engine.py module docstring (Scope)
- 17grt_engine/engine.py check_eff_rate_matches_period
- 18grt_engine/generate.py
Show us where the hours go.
One conversation: you describe the work that consumes your team's month; we tell you plainly what this engine can take over, what it can't, and what a scoped first phase would cost. Your people keep approval authority.
Book a free consultation