@kansei-link/bantou 0.2.0 → 0.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -21
- package/README.md +110 -110
- package/data/exclusion-rules/README.md +104 -104
- package/data/exclusion-rules/jp-tax-baseline-v1.json +185 -185
- package/data/exclusion-rules-schema.json +109 -109
- package/data/keyword-dict/README.md +91 -91
- package/data/keyword-dict/jp-tax-baseline-v1.json +398 -398
- package/data/keyword-dict-schema.json +117 -117
- package/data/tax-rules/jp-tax-rules-v1.json +170 -170
- package/dist/classifier/claude-classifier.js +35 -35
- package/dist/classifier/keyword-classifier.js +5 -2
- package/dist/exclusion/exclusion-checker.js +5 -0
- package/dist/tax-rules/tax-rule-engine.js +5 -0
- package/package.json +74 -74
|
@@ -1,185 +1,185 @@
|
|
|
1
|
-
{
|
|
2
|
-
"$schema": "../exclusion-rules-schema.json",
|
|
3
|
-
"version": "1.0.0",
|
|
4
|
-
"locale": "ja-JP",
|
|
5
|
-
"tax_jurisdiction": "JP",
|
|
6
|
-
"last_updated": "2026-05-09",
|
|
7
|
-
"maintainer": "Synapse Arrows PTE. LTD.",
|
|
8
|
-
"license": "MIT",
|
|
9
|
-
"description": "Cockpit MCP の Stage 0 exclusion filter。 自動仕訳すべきでない transaction を弾いて 人間 review に escalate する。 実務ベースの 7 種除外ルール。",
|
|
10
|
-
"notes": [
|
|
11
|
-
"execution: classify_transaction の前に check_exclusion を必ず call",
|
|
12
|
-
"match → return { excluded: true, rule_id, reason, action: 'human_review' }",
|
|
13
|
-
"no match → classify_transaction (Stage 1+2) へ進む",
|
|
14
|
-
"rule priority: 上から順 (= 同 transaction が複数 rule match なら 上のが採用)",
|
|
15
|
-
"extension: 各事務所が override / 追加可能 (= per-firm exclusion overrides 機構)"
|
|
16
|
-
],
|
|
17
|
-
"rules": [
|
|
18
|
-
{
|
|
19
|
-
"id": "unknown_debit",
|
|
20
|
-
"name_ja": "内容不明デビット",
|
|
21
|
-
"name_en": "Unknown debit (no merchant name)",
|
|
22
|
-
"description": "「デビット+数字」だけで店名がない transaction。 詳細不明のため自動仕訳せず人間 review。",
|
|
23
|
-
"priority": 1,
|
|
24
|
-
"match": {
|
|
25
|
-
"type": "regex",
|
|
26
|
-
"field": "memo",
|
|
27
|
-
"pattern": "^デビット[\\s\\d\\-]*$",
|
|
28
|
-
"flags": "i"
|
|
29
|
-
},
|
|
30
|
-
"alternative_patterns": [
|
|
31
|
-
"デビット利用",
|
|
32
|
-
"DEBIT",
|
|
33
|
-
"VISA DEBIT 振替"
|
|
34
|
-
],
|
|
35
|
-
"action": {
|
|
36
|
-
"type": "human_review",
|
|
37
|
-
"reason_template": "店名不明のデビット取引。 通帳 or 利用明細から店名特定後 人間判断 required。",
|
|
38
|
-
"suggested_next_step": "freee 上で取引詳細を開き、 利用明細から merchant 確定 → 適切な category へ分類"
|
|
39
|
-
}
|
|
40
|
-
},
|
|
41
|
-
{
|
|
42
|
-
"id": "loan_repayment",
|
|
43
|
-
"name_ja": "借入金返済",
|
|
44
|
-
"name_en": "Loan repayment",
|
|
45
|
-
"description": "公庫・銀行借入 / ローン返済。 元本+利息 内訳 が必要なため自動仕訳せず。",
|
|
46
|
-
"priority": 2,
|
|
47
|
-
"match": {
|
|
48
|
-
"type": "any_keyword",
|
|
49
|
-
"field": "memo",
|
|
50
|
-
"keywords": [
|
|
51
|
-
"公庫", "日本政策金融公庫", "JFC",
|
|
52
|
-
"融資", "借入", "借入金返済", "返済",
|
|
53
|
-
"ローン", "Loan", "LOAN",
|
|
54
|
-
"信金", "信用金庫",
|
|
55
|
-
"商工中金",
|
|
56
|
-
"プロパー融資"
|
|
57
|
-
]
|
|
58
|
-
},
|
|
59
|
-
"action": {
|
|
60
|
-
"type": "human_review",
|
|
61
|
-
"reason_template": "借入金返済または融資関連取引。 元本 / 利息 内訳必要、 freee の 借入金返済 wizard 推奨。",
|
|
62
|
-
"suggested_next_step": "freee → 取引 → 借入金返済 wizard で元本・利息分離"
|
|
63
|
-
}
|
|
64
|
-
},
|
|
65
|
-
{
|
|
66
|
-
"id": "social_insurance_tax",
|
|
67
|
-
"name_ja": "社会保険料・税金",
|
|
68
|
-
"name_en": "Social insurance & taxes",
|
|
69
|
-
"description": "年金 / 健保 / 源泉所得税 / 住民税 / 法人税 等の納付。 仕訳科目が複雑なため自動 NG。",
|
|
70
|
-
"priority": 3,
|
|
71
|
-
"match": {
|
|
72
|
-
"type": "any_keyword",
|
|
73
|
-
"field": "memo",
|
|
74
|
-
"keywords": [
|
|
75
|
-
"年金", "厚生年金", "国民年金",
|
|
76
|
-
"健保", "健康保険", "協会けんぽ", "けんぽ",
|
|
77
|
-
"源泉", "源泉税", "源泉所得税",
|
|
78
|
-
"住民税", "市民税", "県民税", "都民税",
|
|
79
|
-
"法人税", "事業税", "消費税納付",
|
|
80
|
-
"労災", "雇用保険",
|
|
81
|
-
"国税", "地方税",
|
|
82
|
-
"印紙税"
|
|
83
|
-
]
|
|
84
|
-
},
|
|
85
|
-
"action": {
|
|
86
|
-
"type": "human_review",
|
|
87
|
-
"reason_template": "社保・税金納付。 法定福利費 / 預り金 / 租税公課 等の科目選択判断必要。",
|
|
88
|
-
"suggested_next_step": "freee → 取引 → 社会保険料 / 税金 wizard で適切科目選択"
|
|
89
|
-
}
|
|
90
|
-
},
|
|
91
|
-
{
|
|
92
|
-
"id": "salary_payment",
|
|
93
|
-
"name_ja": "給与支払い",
|
|
94
|
-
"name_en": "Salary payment",
|
|
95
|
-
"description": "従業員への給与振込。 freee 人事労務 API から従業員名 list を取得して match。 自動仕訳禁止 (= 給与計算と連動の必要)。",
|
|
96
|
-
"priority": 4,
|
|
97
|
-
"match": {
|
|
98
|
-
"type": "any_keyword_or_pattern",
|
|
99
|
-
"field": "memo",
|
|
100
|
-
"keywords": [
|
|
101
|
-
"給与", "給料", "ボーナス", "賞与"
|
|
102
|
-
],
|
|
103
|
-
"patterns": [
|
|
104
|
-
{
|
|
105
|
-
"type": "transfer_to_employee",
|
|
106
|
-
"description": "振込 + freee 人事労務 API の従業員 list 内の名前 match",
|
|
107
|
-
"requires_external_data": "freee_hr_employee_list"
|
|
108
|
-
}
|
|
109
|
-
]
|
|
110
|
-
},
|
|
111
|
-
"action": {
|
|
112
|
-
"type": "human_review",
|
|
113
|
-
"reason_template": "給与振込検出。 給与計算結果と整合確認後、 freee 給与仕訳 wizard で起票。",
|
|
114
|
-
"suggested_next_step": "freee 人事労務 → 給与計算 → 仕訳作成 で自動連動"
|
|
115
|
-
}
|
|
116
|
-
},
|
|
117
|
-
{
|
|
118
|
-
"id": "investment",
|
|
119
|
-
"name_ja": "投資・資産運用",
|
|
120
|
-
"name_en": "Investment / securities",
|
|
121
|
-
"description": "証券口座への入出金、 投資信託 等。 投資勘定 / 雑所得 / 譲渡益 等の判断必要。",
|
|
122
|
-
"priority": 5,
|
|
123
|
-
"match": {
|
|
124
|
-
"type": "any_keyword",
|
|
125
|
-
"field": "memo",
|
|
126
|
-
"keywords": [
|
|
127
|
-
"証券", "野村", "大和", "SMBC日興", "みずほ証券", "三菱UFJモルガン",
|
|
128
|
-
"SBI証券", "楽天証券", "マネックス", "auカブコム", "松井証券",
|
|
129
|
-
"投資信託", "ファンド", "FUND",
|
|
130
|
-
"株式", "株",
|
|
131
|
-
"FX", "暗号資産", "Bitflyer", "Coincheck", "GMOコイン",
|
|
132
|
-
"REIT", "ETF",
|
|
133
|
-
"NISA", "iDeCo", "つみたて"
|
|
134
|
-
]
|
|
135
|
-
},
|
|
136
|
-
"action": {
|
|
137
|
-
"type": "human_review",
|
|
138
|
-
"reason_template": "投資・資産運用関連取引。 仕訳科目 (= 投資有価証券 / 雑所得 / 譲渡益等) は税理士判断。",
|
|
139
|
-
"suggested_next_step": "個別 review、 必要なら年度末まで仮勘定で保持"
|
|
140
|
-
}
|
|
141
|
-
},
|
|
142
|
-
{
|
|
143
|
-
"id": "atm_withdrawal",
|
|
144
|
-
"name_ja": "ATM出金・残高調整",
|
|
145
|
-
"name_en": "ATM withdrawal / balance adjustment",
|
|
146
|
-
"description": "ATM 出金は口座振替で別処理。 仕訳起票せず、 別途 balance adjustment workflow へ。",
|
|
147
|
-
"priority": 6,
|
|
148
|
-
"match": {
|
|
149
|
-
"type": "any_keyword",
|
|
150
|
-
"field": "memo",
|
|
151
|
-
"keywords": [
|
|
152
|
-
"ATM", "ATM出金", "現金引出", "引出", "引き出し",
|
|
153
|
-
"ゆうちょATM", "コンビニATM",
|
|
154
|
-
"セブン銀行ATM", "イオン銀行ATM"
|
|
155
|
-
]
|
|
156
|
-
},
|
|
157
|
-
"action": {
|
|
158
|
-
"type": "alternative_workflow",
|
|
159
|
-
"alternative_workflow_id": "cash_balance_adjustment",
|
|
160
|
-
"reason_template": "ATM 出金 / 現金引出。 口座振替として別処理、 現金勘定残高調整に流す。",
|
|
161
|
-
"suggested_next_step": "freee → 振替伝票 → 普通預金 → 現金"
|
|
162
|
-
}
|
|
163
|
-
},
|
|
164
|
-
{
|
|
165
|
-
"id": "utilities",
|
|
166
|
-
"name_ja": "公共料金",
|
|
167
|
-
"name_en": "Public utilities (no matching account category)",
|
|
168
|
-
"description": "個人宅の電気・ガス・水道。 事業所契約と区別困難なため、 自動 NG。 (事業所契約の utilities は keyword-dict utilities category で別途処理)",
|
|
169
|
-
"priority": 7,
|
|
170
|
-
"match": {
|
|
171
|
-
"type": "any_keyword",
|
|
172
|
-
"field": "memo",
|
|
173
|
-
"keywords": [
|
|
174
|
-
"東京水道局", "東京都水道", "水道局", "上下水道",
|
|
175
|
-
"NHK受信料", "NHK"
|
|
176
|
-
]
|
|
177
|
-
},
|
|
178
|
-
"action": {
|
|
179
|
-
"type": "human_review",
|
|
180
|
-
"reason_template": "公共料金検出。 事業利用 vs 個人利用の按分判断必要。",
|
|
181
|
-
"suggested_next_step": "事業利用比率 (= 例: 自宅事務所なら 30%) を手動設定後仕訳"
|
|
182
|
-
}
|
|
183
|
-
}
|
|
184
|
-
]
|
|
185
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"$schema": "../exclusion-rules-schema.json",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"locale": "ja-JP",
|
|
5
|
+
"tax_jurisdiction": "JP",
|
|
6
|
+
"last_updated": "2026-05-09",
|
|
7
|
+
"maintainer": "Synapse Arrows PTE. LTD.",
|
|
8
|
+
"license": "MIT",
|
|
9
|
+
"description": "Cockpit MCP の Stage 0 exclusion filter。 自動仕訳すべきでない transaction を弾いて 人間 review に escalate する。 実務ベースの 7 種除外ルール。",
|
|
10
|
+
"notes": [
|
|
11
|
+
"execution: classify_transaction の前に check_exclusion を必ず call",
|
|
12
|
+
"match → return { excluded: true, rule_id, reason, action: 'human_review' }",
|
|
13
|
+
"no match → classify_transaction (Stage 1+2) へ進む",
|
|
14
|
+
"rule priority: 上から順 (= 同 transaction が複数 rule match なら 上のが採用)",
|
|
15
|
+
"extension: 各事務所が override / 追加可能 (= per-firm exclusion overrides 機構)"
|
|
16
|
+
],
|
|
17
|
+
"rules": [
|
|
18
|
+
{
|
|
19
|
+
"id": "unknown_debit",
|
|
20
|
+
"name_ja": "内容不明デビット",
|
|
21
|
+
"name_en": "Unknown debit (no merchant name)",
|
|
22
|
+
"description": "「デビット+数字」だけで店名がない transaction。 詳細不明のため自動仕訳せず人間 review。",
|
|
23
|
+
"priority": 1,
|
|
24
|
+
"match": {
|
|
25
|
+
"type": "regex",
|
|
26
|
+
"field": "memo",
|
|
27
|
+
"pattern": "^デビット[\\s\\d\\-]*$",
|
|
28
|
+
"flags": "i"
|
|
29
|
+
},
|
|
30
|
+
"alternative_patterns": [
|
|
31
|
+
"デビット利用",
|
|
32
|
+
"DEBIT",
|
|
33
|
+
"VISA DEBIT 振替"
|
|
34
|
+
],
|
|
35
|
+
"action": {
|
|
36
|
+
"type": "human_review",
|
|
37
|
+
"reason_template": "店名不明のデビット取引。 通帳 or 利用明細から店名特定後 人間判断 required。",
|
|
38
|
+
"suggested_next_step": "freee 上で取引詳細を開き、 利用明細から merchant 確定 → 適切な category へ分類"
|
|
39
|
+
}
|
|
40
|
+
},
|
|
41
|
+
{
|
|
42
|
+
"id": "loan_repayment",
|
|
43
|
+
"name_ja": "借入金返済",
|
|
44
|
+
"name_en": "Loan repayment",
|
|
45
|
+
"description": "公庫・銀行借入 / ローン返済。 元本+利息 内訳 が必要なため自動仕訳せず。",
|
|
46
|
+
"priority": 2,
|
|
47
|
+
"match": {
|
|
48
|
+
"type": "any_keyword",
|
|
49
|
+
"field": "memo",
|
|
50
|
+
"keywords": [
|
|
51
|
+
"公庫", "日本政策金融公庫", "JFC",
|
|
52
|
+
"融資", "借入", "借入金返済", "返済",
|
|
53
|
+
"ローン", "Loan", "LOAN",
|
|
54
|
+
"信金", "信用金庫",
|
|
55
|
+
"商工中金",
|
|
56
|
+
"プロパー融資"
|
|
57
|
+
]
|
|
58
|
+
},
|
|
59
|
+
"action": {
|
|
60
|
+
"type": "human_review",
|
|
61
|
+
"reason_template": "借入金返済または融資関連取引。 元本 / 利息 内訳必要、 freee の 借入金返済 wizard 推奨。",
|
|
62
|
+
"suggested_next_step": "freee → 取引 → 借入金返済 wizard で元本・利息分離"
|
|
63
|
+
}
|
|
64
|
+
},
|
|
65
|
+
{
|
|
66
|
+
"id": "social_insurance_tax",
|
|
67
|
+
"name_ja": "社会保険料・税金",
|
|
68
|
+
"name_en": "Social insurance & taxes",
|
|
69
|
+
"description": "年金 / 健保 / 源泉所得税 / 住民税 / 法人税 等の納付。 仕訳科目が複雑なため自動 NG。",
|
|
70
|
+
"priority": 3,
|
|
71
|
+
"match": {
|
|
72
|
+
"type": "any_keyword",
|
|
73
|
+
"field": "memo",
|
|
74
|
+
"keywords": [
|
|
75
|
+
"年金", "厚生年金", "国民年金",
|
|
76
|
+
"健保", "健康保険", "協会けんぽ", "けんぽ",
|
|
77
|
+
"源泉", "源泉税", "源泉所得税",
|
|
78
|
+
"住民税", "市民税", "県民税", "都民税",
|
|
79
|
+
"法人税", "事業税", "消費税納付",
|
|
80
|
+
"労災", "雇用保険",
|
|
81
|
+
"国税", "地方税",
|
|
82
|
+
"印紙税"
|
|
83
|
+
]
|
|
84
|
+
},
|
|
85
|
+
"action": {
|
|
86
|
+
"type": "human_review",
|
|
87
|
+
"reason_template": "社保・税金納付。 法定福利費 / 預り金 / 租税公課 等の科目選択判断必要。",
|
|
88
|
+
"suggested_next_step": "freee → 取引 → 社会保険料 / 税金 wizard で適切科目選択"
|
|
89
|
+
}
|
|
90
|
+
},
|
|
91
|
+
{
|
|
92
|
+
"id": "salary_payment",
|
|
93
|
+
"name_ja": "給与支払い",
|
|
94
|
+
"name_en": "Salary payment",
|
|
95
|
+
"description": "従業員への給与振込。 freee 人事労務 API から従業員名 list を取得して match。 自動仕訳禁止 (= 給与計算と連動の必要)。",
|
|
96
|
+
"priority": 4,
|
|
97
|
+
"match": {
|
|
98
|
+
"type": "any_keyword_or_pattern",
|
|
99
|
+
"field": "memo",
|
|
100
|
+
"keywords": [
|
|
101
|
+
"給与", "給料", "ボーナス", "賞与"
|
|
102
|
+
],
|
|
103
|
+
"patterns": [
|
|
104
|
+
{
|
|
105
|
+
"type": "transfer_to_employee",
|
|
106
|
+
"description": "振込 + freee 人事労務 API の従業員 list 内の名前 match",
|
|
107
|
+
"requires_external_data": "freee_hr_employee_list"
|
|
108
|
+
}
|
|
109
|
+
]
|
|
110
|
+
},
|
|
111
|
+
"action": {
|
|
112
|
+
"type": "human_review",
|
|
113
|
+
"reason_template": "給与振込検出。 給与計算結果と整合確認後、 freee 給与仕訳 wizard で起票。",
|
|
114
|
+
"suggested_next_step": "freee 人事労務 → 給与計算 → 仕訳作成 で自動連動"
|
|
115
|
+
}
|
|
116
|
+
},
|
|
117
|
+
{
|
|
118
|
+
"id": "investment",
|
|
119
|
+
"name_ja": "投資・資産運用",
|
|
120
|
+
"name_en": "Investment / securities",
|
|
121
|
+
"description": "証券口座への入出金、 投資信託 等。 投資勘定 / 雑所得 / 譲渡益 等の判断必要。",
|
|
122
|
+
"priority": 5,
|
|
123
|
+
"match": {
|
|
124
|
+
"type": "any_keyword",
|
|
125
|
+
"field": "memo",
|
|
126
|
+
"keywords": [
|
|
127
|
+
"証券", "野村", "大和", "SMBC日興", "みずほ証券", "三菱UFJモルガン",
|
|
128
|
+
"SBI証券", "楽天証券", "マネックス", "auカブコム", "松井証券",
|
|
129
|
+
"投資信託", "ファンド", "FUND",
|
|
130
|
+
"株式", "株",
|
|
131
|
+
"FX", "暗号資産", "Bitflyer", "Coincheck", "GMOコイン",
|
|
132
|
+
"REIT", "ETF",
|
|
133
|
+
"NISA", "iDeCo", "つみたて"
|
|
134
|
+
]
|
|
135
|
+
},
|
|
136
|
+
"action": {
|
|
137
|
+
"type": "human_review",
|
|
138
|
+
"reason_template": "投資・資産運用関連取引。 仕訳科目 (= 投資有価証券 / 雑所得 / 譲渡益等) は税理士判断。",
|
|
139
|
+
"suggested_next_step": "個別 review、 必要なら年度末まで仮勘定で保持"
|
|
140
|
+
}
|
|
141
|
+
},
|
|
142
|
+
{
|
|
143
|
+
"id": "atm_withdrawal",
|
|
144
|
+
"name_ja": "ATM出金・残高調整",
|
|
145
|
+
"name_en": "ATM withdrawal / balance adjustment",
|
|
146
|
+
"description": "ATM 出金は口座振替で別処理。 仕訳起票せず、 別途 balance adjustment workflow へ。",
|
|
147
|
+
"priority": 6,
|
|
148
|
+
"match": {
|
|
149
|
+
"type": "any_keyword",
|
|
150
|
+
"field": "memo",
|
|
151
|
+
"keywords": [
|
|
152
|
+
"ATM", "ATM出金", "現金引出", "引出", "引き出し",
|
|
153
|
+
"ゆうちょATM", "コンビニATM",
|
|
154
|
+
"セブン銀行ATM", "イオン銀行ATM"
|
|
155
|
+
]
|
|
156
|
+
},
|
|
157
|
+
"action": {
|
|
158
|
+
"type": "alternative_workflow",
|
|
159
|
+
"alternative_workflow_id": "cash_balance_adjustment",
|
|
160
|
+
"reason_template": "ATM 出金 / 現金引出。 口座振替として別処理、 現金勘定残高調整に流す。",
|
|
161
|
+
"suggested_next_step": "freee → 振替伝票 → 普通預金 → 現金"
|
|
162
|
+
}
|
|
163
|
+
},
|
|
164
|
+
{
|
|
165
|
+
"id": "utilities",
|
|
166
|
+
"name_ja": "公共料金",
|
|
167
|
+
"name_en": "Public utilities (no matching account category)",
|
|
168
|
+
"description": "個人宅の電気・ガス・水道。 事業所契約と区別困難なため、 自動 NG。 (事業所契約の utilities は keyword-dict utilities category で別途処理)",
|
|
169
|
+
"priority": 7,
|
|
170
|
+
"match": {
|
|
171
|
+
"type": "any_keyword",
|
|
172
|
+
"field": "memo",
|
|
173
|
+
"keywords": [
|
|
174
|
+
"東京水道局", "東京都水道", "水道局", "上下水道",
|
|
175
|
+
"NHK受信料", "NHK"
|
|
176
|
+
]
|
|
177
|
+
},
|
|
178
|
+
"action": {
|
|
179
|
+
"type": "human_review",
|
|
180
|
+
"reason_template": "公共料金検出。 事業利用 vs 個人利用の按分判断必要。",
|
|
181
|
+
"suggested_next_step": "事業利用比率 (= 例: 自宅事務所なら 30%) を手動設定後仕訳"
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
]
|
|
185
|
+
}
|
|
@@ -1,109 +1,109 @@
|
|
|
1
|
-
{
|
|
2
|
-
"$schema": "http://json-schema.org/draft-07/schema#",
|
|
3
|
-
"$id": "https://github.com/michielinksee/kansei-link-cockpit/blob/main/data/exclusion-rules-schema.json",
|
|
4
|
-
"title": "Cockpit MCP Exclusion Rules",
|
|
5
|
-
"description": "Schema for Stage 0 exclusion filters used by Cockpit MCP. These run BEFORE classify_transaction. Matching transactions are escalated to human review (= NOT auto-journalized).",
|
|
6
|
-
"type": "object",
|
|
7
|
-
"required": ["version", "locale", "tax_jurisdiction", "rules"],
|
|
8
|
-
"properties": {
|
|
9
|
-
"version": { "type": "string", "pattern": "^\\d+\\.\\d+\\.\\d+$" },
|
|
10
|
-
"locale": { "type": "string", "pattern": "^[a-z]{2}-[A-Z]{2}$" },
|
|
11
|
-
"tax_jurisdiction": { "type": "string", "pattern": "^[A-Z]{2}$" },
|
|
12
|
-
"last_updated": { "type": "string", "format": "date" },
|
|
13
|
-
"maintainer": { "type": "string" },
|
|
14
|
-
"license": { "type": "string" },
|
|
15
|
-
"description": { "type": "string" },
|
|
16
|
-
"notes": {
|
|
17
|
-
"type": "array",
|
|
18
|
-
"items": { "type": "string" }
|
|
19
|
-
},
|
|
20
|
-
"rules": {
|
|
21
|
-
"type": "array",
|
|
22
|
-
"minItems": 1,
|
|
23
|
-
"items": {
|
|
24
|
-
"type": "object",
|
|
25
|
-
"required": ["id", "name_ja", "description", "priority", "match", "action"],
|
|
26
|
-
"properties": {
|
|
27
|
-
"id": {
|
|
28
|
-
"type": "string",
|
|
29
|
-
"pattern": "^[a-z_]+$"
|
|
30
|
-
},
|
|
31
|
-
"name_ja": { "type": "string" },
|
|
32
|
-
"name_en": { "type": "string" },
|
|
33
|
-
"description": { "type": "string" },
|
|
34
|
-
"priority": {
|
|
35
|
-
"type": "integer",
|
|
36
|
-
"description": "Lower = higher priority. Rules evaluated top to bottom; first match wins."
|
|
37
|
-
},
|
|
38
|
-
"match": {
|
|
39
|
-
"type": "object",
|
|
40
|
-
"required": ["type", "field"],
|
|
41
|
-
"properties": {
|
|
42
|
-
"type": {
|
|
43
|
-
"type": "string",
|
|
44
|
-
"enum": ["regex", "any_keyword", "any_keyword_or_pattern", "exact"]
|
|
45
|
-
},
|
|
46
|
-
"field": {
|
|
47
|
-
"type": "string",
|
|
48
|
-
"enum": ["memo", "amount", "partner_name", "date"],
|
|
49
|
-
"description": "Which transaction field to match against (after normalization)"
|
|
50
|
-
},
|
|
51
|
-
"pattern": {
|
|
52
|
-
"type": "string",
|
|
53
|
-
"description": "Regex pattern (when type=regex)"
|
|
54
|
-
},
|
|
55
|
-
"flags": {
|
|
56
|
-
"type": "string",
|
|
57
|
-
"description": "Regex flags like 'i', 'g' (when type=regex)"
|
|
58
|
-
},
|
|
59
|
-
"keywords": {
|
|
60
|
-
"type": "array",
|
|
61
|
-
"items": { "type": "string" },
|
|
62
|
-
"description": "Substring list (when type=any_keyword or any_keyword_or_pattern)"
|
|
63
|
-
},
|
|
64
|
-
"patterns": {
|
|
65
|
-
"type": "array",
|
|
66
|
-
"items": {
|
|
67
|
-
"type": "object",
|
|
68
|
-
"properties": {
|
|
69
|
-
"type": { "type": "string" },
|
|
70
|
-
"description": { "type": "string" },
|
|
71
|
-
"requires_external_data": { "type": "string" }
|
|
72
|
-
}
|
|
73
|
-
},
|
|
74
|
-
"description": "Custom pattern detectors (e.g., transfer_to_employee requires freee_hr_employee_list)"
|
|
75
|
-
}
|
|
76
|
-
}
|
|
77
|
-
},
|
|
78
|
-
"alternative_patterns": {
|
|
79
|
-
"type": "array",
|
|
80
|
-
"items": { "type": "string" },
|
|
81
|
-
"description": "Additional substring fallbacks beyond the primary match"
|
|
82
|
-
},
|
|
83
|
-
"action": {
|
|
84
|
-
"type": "object",
|
|
85
|
-
"required": ["type", "reason_template"],
|
|
86
|
-
"properties": {
|
|
87
|
-
"type": {
|
|
88
|
-
"type": "string",
|
|
89
|
-
"enum": ["human_review", "alternative_workflow", "skip_silently"]
|
|
90
|
-
},
|
|
91
|
-
"reason_template": {
|
|
92
|
-
"type": "string",
|
|
93
|
-
"description": "Human-readable reason shown to the tax accountant"
|
|
94
|
-
},
|
|
95
|
-
"suggested_next_step": {
|
|
96
|
-
"type": "string",
|
|
97
|
-
"description": "Concrete recommendation for the human reviewer"
|
|
98
|
-
},
|
|
99
|
-
"alternative_workflow_id": {
|
|
100
|
-
"type": "string",
|
|
101
|
-
"description": "If type=alternative_workflow, ID of the workflow to invoke (e.g., cash_balance_adjustment)"
|
|
102
|
-
}
|
|
103
|
-
}
|
|
104
|
-
}
|
|
105
|
-
}
|
|
106
|
-
}
|
|
107
|
-
}
|
|
108
|
-
}
|
|
109
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"$schema": "http://json-schema.org/draft-07/schema#",
|
|
3
|
+
"$id": "https://github.com/michielinksee/kansei-link-cockpit/blob/main/data/exclusion-rules-schema.json",
|
|
4
|
+
"title": "Cockpit MCP Exclusion Rules",
|
|
5
|
+
"description": "Schema for Stage 0 exclusion filters used by Cockpit MCP. These run BEFORE classify_transaction. Matching transactions are escalated to human review (= NOT auto-journalized).",
|
|
6
|
+
"type": "object",
|
|
7
|
+
"required": ["version", "locale", "tax_jurisdiction", "rules"],
|
|
8
|
+
"properties": {
|
|
9
|
+
"version": { "type": "string", "pattern": "^\\d+\\.\\d+\\.\\d+$" },
|
|
10
|
+
"locale": { "type": "string", "pattern": "^[a-z]{2}-[A-Z]{2}$" },
|
|
11
|
+
"tax_jurisdiction": { "type": "string", "pattern": "^[A-Z]{2}$" },
|
|
12
|
+
"last_updated": { "type": "string", "format": "date" },
|
|
13
|
+
"maintainer": { "type": "string" },
|
|
14
|
+
"license": { "type": "string" },
|
|
15
|
+
"description": { "type": "string" },
|
|
16
|
+
"notes": {
|
|
17
|
+
"type": "array",
|
|
18
|
+
"items": { "type": "string" }
|
|
19
|
+
},
|
|
20
|
+
"rules": {
|
|
21
|
+
"type": "array",
|
|
22
|
+
"minItems": 1,
|
|
23
|
+
"items": {
|
|
24
|
+
"type": "object",
|
|
25
|
+
"required": ["id", "name_ja", "description", "priority", "match", "action"],
|
|
26
|
+
"properties": {
|
|
27
|
+
"id": {
|
|
28
|
+
"type": "string",
|
|
29
|
+
"pattern": "^[a-z_]+$"
|
|
30
|
+
},
|
|
31
|
+
"name_ja": { "type": "string" },
|
|
32
|
+
"name_en": { "type": "string" },
|
|
33
|
+
"description": { "type": "string" },
|
|
34
|
+
"priority": {
|
|
35
|
+
"type": "integer",
|
|
36
|
+
"description": "Lower = higher priority. Rules evaluated top to bottom; first match wins."
|
|
37
|
+
},
|
|
38
|
+
"match": {
|
|
39
|
+
"type": "object",
|
|
40
|
+
"required": ["type", "field"],
|
|
41
|
+
"properties": {
|
|
42
|
+
"type": {
|
|
43
|
+
"type": "string",
|
|
44
|
+
"enum": ["regex", "any_keyword", "any_keyword_or_pattern", "exact"]
|
|
45
|
+
},
|
|
46
|
+
"field": {
|
|
47
|
+
"type": "string",
|
|
48
|
+
"enum": ["memo", "amount", "partner_name", "date"],
|
|
49
|
+
"description": "Which transaction field to match against (after normalization)"
|
|
50
|
+
},
|
|
51
|
+
"pattern": {
|
|
52
|
+
"type": "string",
|
|
53
|
+
"description": "Regex pattern (when type=regex)"
|
|
54
|
+
},
|
|
55
|
+
"flags": {
|
|
56
|
+
"type": "string",
|
|
57
|
+
"description": "Regex flags like 'i', 'g' (when type=regex)"
|
|
58
|
+
},
|
|
59
|
+
"keywords": {
|
|
60
|
+
"type": "array",
|
|
61
|
+
"items": { "type": "string" },
|
|
62
|
+
"description": "Substring list (when type=any_keyword or any_keyword_or_pattern)"
|
|
63
|
+
},
|
|
64
|
+
"patterns": {
|
|
65
|
+
"type": "array",
|
|
66
|
+
"items": {
|
|
67
|
+
"type": "object",
|
|
68
|
+
"properties": {
|
|
69
|
+
"type": { "type": "string" },
|
|
70
|
+
"description": { "type": "string" },
|
|
71
|
+
"requires_external_data": { "type": "string" }
|
|
72
|
+
}
|
|
73
|
+
},
|
|
74
|
+
"description": "Custom pattern detectors (e.g., transfer_to_employee requires freee_hr_employee_list)"
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
},
|
|
78
|
+
"alternative_patterns": {
|
|
79
|
+
"type": "array",
|
|
80
|
+
"items": { "type": "string" },
|
|
81
|
+
"description": "Additional substring fallbacks beyond the primary match"
|
|
82
|
+
},
|
|
83
|
+
"action": {
|
|
84
|
+
"type": "object",
|
|
85
|
+
"required": ["type", "reason_template"],
|
|
86
|
+
"properties": {
|
|
87
|
+
"type": {
|
|
88
|
+
"type": "string",
|
|
89
|
+
"enum": ["human_review", "alternative_workflow", "skip_silently"]
|
|
90
|
+
},
|
|
91
|
+
"reason_template": {
|
|
92
|
+
"type": "string",
|
|
93
|
+
"description": "Human-readable reason shown to the tax accountant"
|
|
94
|
+
},
|
|
95
|
+
"suggested_next_step": {
|
|
96
|
+
"type": "string",
|
|
97
|
+
"description": "Concrete recommendation for the human reviewer"
|
|
98
|
+
},
|
|
99
|
+
"alternative_workflow_id": {
|
|
100
|
+
"type": "string",
|
|
101
|
+
"description": "If type=alternative_workflow, ID of the workflow to invoke (e.g., cash_balance_adjustment)"
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
}
|