# CJK & HKEX Financial Filing Prep Toolkit

> Zero-dependency Python toolkit to repair broken CJK/HKEX tables and CMap month glitches, rewrite bilingual finance/legal RAG queries into Elasticsearch/OpenSearch DSL, and audit corpus licenses offline.

CJK & HKEX Financial Filing Prep Toolkit is a paid AI agent skill on Agensi by Wasabi hu, in LLM Ops. It loads into your AI agent through the Agensi MCP server, always in its latest approved version.

- Price: $5 (one-time purchase)
- Creator: [Wasabi hu](https://www.agensi.io/creators/wasabi-hu)
- Category: [LLM Ops](https://www.agensi.io/skills/llm-ops)
- Version: 1.0
- Last updated: 2026-12-01
- Security: scan passed (2026-11-30); every new listing is also reviewed by a person
- Listing: https://www.agensi.io/skills/cjk-hkex-financial-filing-prep-toolkit
- Tags: llm-ops, finance, research, rag, cjk, search, python

## About this skill

Financial and regulatory RAG pipelines frequently break when PDF-to-Markdown extraction splits decimals across lines, fragments accounting parentheses, or triggers HKEX font CMap glitches where "月" (month) extracts as "尸". Even after cleaning, single-language search misses cross-border disclosures written in Mainland Simplified Chinese, Hong Kong Traditional Chinese, and English GAAP/IFRS terminology.

This skill ships three standalone, zero-dependency Python 3.11+ scripts that fix all three bottlenecks deterministically and completely offline.

### What it does

- **Repairs extracted CJK & HKEX financial Markdown (`scripts/fix_cjk_tables.py`)**: Merges hard-wrapped decimals (`1,280.\n45 -> 1,280.45`), thousand separators, split accounting negatives (`(\n45.20\n) -> (45.20)`), detached percent signs, and continuation pipe-table rows without altering figures or column counts.
- **Fixes HKEX ToUnicode CMap month glitches with forensic guards**: Strict context-aware whitelist rules restore corrupted date phrases (`2025年12尸31日 -> 2025年12月31日`, `十二個尸 -> 十二個月`, `每尸活躍 -> 每月活躍`) while preserving non-date terms (`法医尸检报告`, `尸体`) with zero false positives.
- **Rewrites bilingual financial & legal queries (`scripts/rewrite_bilingual_query.py`)**: Applies phrase-aware Simplified-to-Traditional disambiguation (`注册制 -> 註冊制`, `制造业 -> 製造業`, `附注 -> 附註`), expands cross-standard accounting terms (`归母净利润` / `股東應佔溢利` / `net income attributable`), converts Arabic and Chinese statute clauses & fiscal years (`第128条` ↔ `第一百二十八條`, `2025年` ↔ `二零二五年`), and generates ready-to-run Elasticsearch / OpenSearch Bool DSL (including multi-ticker `bool.should` comparisons).
- **Audits RAG corpus manifests before ingestion (`scripts/audit_corpus_license.py`)**: Enforces commercial-safe license allowlists (`pack` vs `recipe`), blocks `NOASSERTION`, `-NC`, `-ND`, `GPL`/`AGPL`/`SSPL`, synthetic override flags, short Git hashes (requires full 40-char lowercase SHA), path traversal, unsafe or private/loopback URLs, and `do-not-contact.json` opt-out lists.

### Runtime & security design

- **Pure Python 3.11+ standard library**: Zero third-party packages, zero network imports, zero environment-variable reads, zero subprocess calls.
- **Standalone execution**: Every script embeds its own lookup tables and outputs structured UTF-8 JSON to `stdout`.
- **Read-only by default**: Source files are never modified unless `--output` is explicitly provided.

### Included references

- `references/accounting-aliases.md` — Mainland CAS, Hong Kong HKFRS/HKEX, and English GAAP/IFRS term alignment plus legal clause rules.
- `references/license-policy.md` — Commercial-safe allowlist matrix, manifest schema, and security invariants.
- `references/examples.md` — End-to-end synthetic before/after examples.

### Known limitations

- Does not run image OCR on scanned PDFs; extract text/Markdown first, then run Stage 1.
- Offline deterministic tooling only; does not fetch live market data or provide legal/investment advice.

## Requires

- Python

## How to use this skill

1. Connect your AI agent to Agensi once: add the MCP server https://mcp.agensi.io/mcp/auth and sign in with your Agensi account (OAuth, no API key). Steps for Claude, ChatGPT, Claude Code, Codex, Cursor, VS Code and other agents: https://www.agensi.io/docs/mcp-setup
2. Ask your agent: "Use the CJK & HKEX Financial Filing Prep Toolkit skill from Agensi" and describe your task.
3. Buy it on the listing or let your agent ask you first; your agent then loads it from Agensi when it needs it. Every paid skill has a money-back guarantee: https://www.agensi.io/docs/money-back-guarantee

## Frequently asked questions

### What specific financial data issues does this toolkit solve?

This skill provides specialized Python scripts to repair broken tables in CJK/HKEX financial documents, expand bilingual accounting queries, and audit document manifests for license and security compliance. It specifically solves the problem of "broken" text extraction where numeric decimals or specific Hong Kong stock exchange characters are corrupted during PDF-to-Markdown conversion.

### Are there any external dependencies or specific AI frameworks required to run this?

The toolkit is built for Python 3.11+ using only the standard library, meaning it has zero third-party dependencies. This makes it compatible with virtually any AI agent or RAG pipeline that can execute Python scripts, including local environments, Docker containers, and cloud-based LLM orchestrators.

### What exactly is included in the purchase?

You receive the full suite of Python utility scripts (including table repair, query expansion, and license auditing tools) along with documentation on integrating them into your existing RAG ingestion and retrieval workflows. No API keys or network calls are required for use.

### Why should I use these scripts instead of just asking an LLM to fix the data?

Unlike LLMs, which may hallucinate synonyms or inconsistently fix character corruption, this skill uses deterministic, rule-based logic. This ensures that sensitive financial data—like numeric decimals and accounting terms—is repaired with 100% consistency without the high token costs or latency of a model call.

### Does this skill handle scanned PDF documents or image-based tables?

The toolkit focuses on text-based financial filings and reports; it does not include an OCR engine for image-based PDFs. You should first process your documents through an extraction tool (like Marker or Nougat), then use this skill to sanitize and repair the resulting Markdown before it reaches your vector database.

### Can I use this to search for English financial terms within Chinese-language reports?

Yes, the query expansion tool is designed to map terminology across Mainland A-share (Simplified Chinese), Hong Kong HKEX (Traditional Chinese), and US GAAP/IFRS (English) standards, allowing a single search query to find relevant results across all three regions.

---

Source: [Agensi](https://www.agensi.io), the marketplace of skills for AI agents. Any MCP-compatible agent (Claude, ChatGPT, Claude Code, Codex, Cursor, VS Code and more) connects at https://mcp.agensi.io/mcp/auth and signs in with an Agensi account; setup for every agent: https://www.agensi.io/docs/mcp-setup. Append .md to any skill, guide or docs address on agensi.io for its markdown version.
