KAMMAREN Documentation
The correctness layer for Swedish company administration. Every number traced to a law paragraph. 304+ passing assertions. No AI touches a calculation.
Quick start
Three ways to use KAMMAREN. Pick one.
PASS or FAIL with exact diff.expected. Returns full calculation with breakdown, legal sources, and disclaimer.1 — Fetch constants
curl https://kammaren.nu/api/constants/2026
Returns every Swedish tax constant for income year 2026 — PBB, IBB, AG rates, corporate tax, 3:12 rules, VAT rates, income tax brackets. Every value traced to a specific law paragraph. 290 municipal tax rates included separately.
2 — Verify a calculation
curl -X POST https://kammaren.nu/api/verify \
-H "Content-Type: application/json" \
-d '{
"skill": "ag-avgifter",
"input": {
"gross_salary": 500000,
"birth_year": 1990,
"first_employee": false,
"num_employees": 0
},
"expected": { "total_ag_avgift": 157100 }
}'
3 — Run a calculation
Same endpoint, omit expected:
curl -X POST https://kammaren.nu/api/verify \
-H "Content-Type: application/json" \
-d '{
"skill": "ag-avgifter",
"input": {
"gross_salary": 500000,
"birth_year": 1990,
"first_employee": false,
"num_employees": 0
}
}'
Source of Truth API
All Swedish tax constants for a given income year. One URL. One JSON. Every value with a legal reference.
Endpoints
| URL | Returns |
|---|---|
GET /api/constants/2026 | All tax constants for income year 2026 |
GET /api/constants/kommunalskatt/2026 | Tax rates for all 290 municipalities |
What's inside /api/constants/2026
55 constants total. 22 sections. Internal checksums verify that components sum correctly (e.g. 7 AG sub-rates = 31.42%).
basbelopp
prisbasbelopp .............. 59 200 kr (SFS 2025:XX, SCB)
forhoijt_prisbasbelopp ..... 60 500 kr
inkomstbasbelopp ........... 83 400 kr (Pensionsmyndigheten)
ibb_for_312 ............... 80 600 kr (IL 57 kap 4 §, IBB 2025)
arbetsgivaravgifter
total ...................... 31.42% (SFL 2 kap 26 §)
sjukforsakring ............. 3.55%
foraldraforsakring ......... 2.00%
alderspension .............. 10.21%
efterlevandepension ........ 0.30%
arbetsmarknad .............. 2.64%
arbetsskada ................ 0.10%
allman_loneavgift .......... 12.62%
aldersreduktion ............ 10.21% (67+ år, SFL 2 kap 27 §)
vaxa_stodet ................ 10.21% (max 35k/mån, SFL 2 kap 31 §)
moms
standard ................... 25% (ML 7:1)
reducerad_1 ................ 12%
reducerad_2 ................ 6%
momsfri_grans .............. 120 000 kr (ML 9d kap)
bolagsskatt
skattesats ................. 20.6% (IL 65 kap 10 §)
periodiseringsfond_max ..... 25% (IL 30 kap 5 §)
max_antal_fonder ........... 6 (IL 30 kap 7 §)
inkomstskatt
skiktgrans ................. 643 000 kr (IL 65 kap 5 §)
brytpunkt .................. 660 400 kr
statlig_skatt .............. 20%
treslagregeln_312
grundbelopp ................ 4 × IBB (IL 57 kap 11 §, Prop. 2025/26:1)
lonesparr .................. 8 × IBB (IL 57 kap 16 §)
lonebaserat_andel .......... 50%
kapitalbaserat ............. SLR + 9% (IL 57 kap 12 §)
upprakningsranta ........... 0% (SLOPAD, Prop. 2025/26:1)
statslanerantan .............. 2.55% (Riksgälden, 30 nov 2025)
Plus: representation, traktamente, skattefria gåvor, reseavdrag, kostförmåner, SGI, SLP, pension.
What's inside /api/constants/kommunalskatt/2026
290 municipalities. Every entry has:
{
"ale": {
"kommunalskatt": 0.328,
"begravningsavgift": 0.00292,
"kyrkoavgift_snitt": 0.01
}
}
kommunalskatt is the combined municipal + county rate. This is what Skatteverket publishes and what tax calculations use.
Tax constants change once per year. Skatteverket publishes new numbers in December. We create constants/2027.json, verify against the published tables, and push. The URL pattern (/api/constants/:year) serves the right year automatically. Year-guard refuses to let any skill calculate with outdated constants.
Verify API
Verification-as-a-service for Swedish tax calculations.
POST /api/verify — three modes
Mode 1 — VERIFY (send input + expected)
Your system calculated employer contributions on a 500 000 kr salary and got 157 100 kr. Is that right?
{
"skill": "ag-avgifter",
"input": {
"gross_salary": 500000,
"birth_year": 1990,
"first_employee": false,
"num_employees": 0
},
"expected": {
"total_ag_avgift": 157100
}
}
{
"status": "PASS",
"skill": "ag-avgifter",
"actual": {
"total_ag_avgift": 157100
},
"expected": {
"total_ag_avgift": 157100
},
"diff": {},
"sources": [
{ "name": "SFL 2 kap 26 §", ... }
],
"disclaimer": "...",
"engine_version": "2026.1",
"timestamp": "2026-04-13T..."
}
If your number is wrong:
{
"status": "FAIL",
"diff": {
"total_ag_avgift": {
"expected": 160000,
"actual": 157100,
"delta": -2900
}
}
}
Mode 2 — CALCULATE (omit expected)
Don't have a number to verify? Send just the input. Response includes the full calculation, breakdown by component, legal sources, and disclaimer.
{
"skill": "ag-avgifter",
"input": {
"gross_salary": 500000,
"birth_year": 1990,
"first_employee": false,
"num_employees": 0
}
}
Mode 3 — LIST (GET request)
GET /api/verify
Returns all available skills with their input schemas, descriptions, and assertion counts.
Available skills
| Skill | Description | Assertions |
|---|---|---|
ag-avgifter |
Employer contributions (31.42%, 7 components) | 19/19 PASS |
moms |
VAT (25/12/6/0%, reverse charge, BAS accounts) | 34/34 PASS |
bolagsskatt |
Corporate tax (20.6%, periodiseringsfond, underskott) | 46/46 PASS |
k10 |
K10 shareholder allowance (2026 additive model) | 34/34 PASS |
Skills reference
Every skill is a pure function. Same input always produces the same output. No AI touches a number.
ag-avgifter
Calculates Swedish employer contributions for income year 2026.
Input
| Field | Type | Required | Description |
|---|---|---|---|
gross_salary | number | Yes | Annual gross salary in SEK |
birth_year | number | Yes | Employee birth year (affects age reduction) |
first_employee | boolean | Yes | Eligible for Växa-stöd? |
num_employees | number | Yes | Number of employees (Växa max 2) |
Output includes
total_ag_avgift — total employer contribution in SEK · ag_rate — effective rate (31.42% standard, 10.21% age-reduced or Växa) · total_lonekostnad — salary + AG combined · All 7 sub-components with individual amounts
Special cases
| Condition | Rule |
|---|---|
| Born 1958 or earlier (67+ at year start) | Reduced rate 10.21% (only ålderspension) |
| Born 1937 or earlier (88+) | Zero employer contributions |
| Växa-stöd | 10.21% on salaries up to 35 000 kr/month (max 2 employees) |
| Salary below 1 000 kr/year | No contributions |
Legal source: SFL 2 kap 26–31 §
moms
Calculates Swedish VAT for income year 2026.
Input
| Field | Type | Required | Description |
|---|---|---|---|
amount | number | Yes | Amount in SEK |
vat_rate | number | Yes | VAT rate: 25, 12, 6, or 0 |
direction | string | Yes | netto_to_brutto or brutto_to_netto |
reverse_charge | boolean | No | Reverse charge (omvänd skattskyldighet) |
Output includes
netto — amount excluding VAT · brutto — amount including VAT · moms_belopp — VAT amount · bas_konto — correct BAS account number (2610/2620/2630/2640)
Legal source: ML 7:1, ML 3 kap, ML 9d kap
bolagsskatt
Calculates Swedish corporate tax for income year 2026.
Input
| Field | Type | Required | Description |
|---|---|---|---|
taxable_profit | number | Yes | Profit before tax in SEK |
periodiseringsfond_avsattning | number | Yes | Desired fund allocation (max 25%) |
befintliga_fonder | array | Yes | Existing funds [{year, amount}] |
underskott_foregaende_ar | number | Yes | Prior year deficit in SEK |
Output includes
bolagsskatt — corporate tax in SEK · resultat_efter_skatt — profit after tax · periodiseringsfond_avdrag — actual fund deduction (capped at 25%) · schablonintakt — imputed income on existing funds (SLR × fund amounts) · aterford_fond — reversed fund (if any fund is 6+ years old)
Special cases
| Rule | Detail |
|---|---|
| Maximum 6 funds simultaneously | IL 30 kap 7 § |
| Funds older than 6 years | Automatically reversed |
| Imputed income | SLR (2.55%) × sum of all existing funds |
| Deficit carry-forward | Indefinitely, no time limit |
Legal source: IL 65 kap 10 §, IL 30 kap 5–7 §
k10
Calculates K10 shareholder allowance (gränsbelopp) for income year 2026.
2026 uses the NEW additive model (Prop. 2025/26:1). The old rules (MAX of simplified/main rule) no longer apply.
Input
| Field | Type | Required | Description |
|---|---|---|---|
anskaffningsvarde | number | Yes | Share acquisition cost in SEK |
agarandel_procent | number | Yes | Ownership percentage (0–100) |
total_lonesumma | number | Yes | Total company salaries in SEK |
egen_lon | number | Yes | Owner's own salary in SEK |
sparat_utrymme | number | Yes | Saved allowance from prior year |
inkomstar | number | Yes | Income year (must be 2026) |
How the 2026 additive model works
gränsbelopp = grundbelopp
+ kapitalbaserat
+ lönebaserat
+ sparat utrymme
Where:
grundbelopp = 4 × 80 600 × ownership share = 322 400 kr (at 100%)
kapitalbaserat = acquisition cost × (SLR + 9%) = cost × 11.55%
lönebaserat = 50% × (total salaries − 644 800 kr threshold)
sparat = prior year amount, carried forward at face value
Special cases
| Rule | Detail |
|---|---|
| 4%-spärren | Ownership below 4%: no salary-based allowance |
| Salary cap | 50 × owner's own salary |
| Saved allowance | No markup — uppräkningsränta abolished 2026 (Prop. 2025/26:1) |
Legal source: IL 57 kap 11–16 §, Prop. 2025/26:1
Verification
Every number KAMMAREN returns is backed by verification.
Test suites
| Suite | What it verifies | Assertions |
|---|---|---|
| Golden cases | Each skill against hand-calculated values from Skatteverket tables | 153 |
| Constants | Internal checksums (AG sub-rates sum to 31.42%, grundbelopp = 4×IBB) | 46 |
| Integration | Full chain: VAT → AG → corporate tax → K10 → dividend | 13 |
| Cross-validation | Tax optimizer vs K10 skill (independent implementations, same answer) | 6 |
| Stress | 10 radically different companies through the entire chain | 100 |
| Year-guard | System refuses to calculate 2027 with 2026 constants | 3 |
| Total | 304+ |
How golden cases work
We write expected values before writing the code. Each expected value is hand-calculated from Skatteverket's published tables (SKV 433, SFL, IL, ML). If the code produces a different number, the test fails.
The golden cases caught 4 bugs during development:
| # | Bug |
|---|---|
| 1 | Wrong sub-rates in AG contributions (föräldraförsäkring 2.60% → 2.00%) |
| 2 | Missing imputed income on periodiseringsfonder in 3 corporate tax test cases |
| 3 | K10 using old MAX(simplified, main rule) logic instead of 2026 additive model (up to 297 400 kr wrong) |
| 4 | Markup rate on saved K10 allowance: abolished 2026, we calculated 5.55% |
Architecture
Any agent (Claude, GPT, local LLM, your own)
│
│ tool_call or HTTP POST
▼
┌───────────────────────────────────────┐
│ KAMMAREN │
│ │
│ skills/ → calculate() │
│ constants/ → 2026.json (year-guard) │
│ verify/ → 304 assertions │
│ vault/ → SHA-256 hash chain │
└───────────┬───────────────────────────┘
│
▼
SkillOutput {
result, // exact numbers
breakdown, // component-by-component
sources, // law references with URLs
disclaimer // always present
}
Principles
"verified": false marking.2026.json. No duplication. No drift.Limits and caveats
| Topic | Detail |
|---|---|
| Constants update cadence | Once per year (December). Between updates, they are static and correct. |
| Authentication | None. No rate limiting. If this becomes a problem, we'll add it. |
| Response time | ~50–200ms depending on skill complexity. |
| K10 year | Uses the 2026 additive model. 2025 calculations (MAX rule) require a different constants file (not yet available). |
| Tax optimizer | Available on kammaren.nu but not yet exposed via the verify API. |
| Municipal tax | Combined KI (kommunal + landsting). No separate breakdown. |
| Unverified constants | 4 constants marked "verified": false — they exist in code but lack a confirmed legal reference. |
Links
License: AGPL-3.0-or-later. Run it, modify it, distribute it. If you distribute changes, publish your source. Commercial license available for closed-source use.
The formulas are public. The data is yours. The correctness is proven.