An AI copilot for bank and NBFC compliance teams.
Ask in plain English. Get proof rows from the database, the three rule clauses that fit, and a draft Suspicious Activity Report.
Nothing is saved until a listed compliance officer approves it.
CoCo CLI Hackathon · GCC Edition · Team Behelit · Arun Kumar (solo)
| Evidence, not guesses | Fixed, allow-listed SQL pulls the transaction rows. User text is sent as a bound value (separate from the SQL), never pasted into the query. |
| Law by meaning | AI_EMBED turns each rule clause into 768 numbers; cosine similarity picks the TOP-3 clauses for the question. Cortex Search (hybrid search) is optional. |
| A draft with receipts | AI_COMPLETE (claude-sonnet-5, fallback llama3.1-8b) writes the SAR with the Cortex Guard harm filter always on. Every draft is fingerprinted with SHA-256. |
| A human signs | Only users in APP_OFFICERS can approve. The check runs on the server at click time. Denied tries are logged under the real viewer's name. |
1 · In your browser (no install, no keys). Open the live demo.
- Pick analyst or officer and press a quick query.
- Demo mode uses fake sample data and a template draft (no AI call), and sends nothing to Snowflake.
- The first load takes 20–60 seconds while Python starts in the browser.
2 · On your machine.
git clone https://github.com/Arunkumar06-cmd/risk-intelligence-copilot.git && cd risk-intelligence-copilot
pip install -r requirements.txt -r requirements-dev.txt
DEMO_MODE=TRUE streamlit run streamlit_app.py # demo mode, no keys needed
# or, for the real Snowflake path:
cp .streamlit/secrets.toml.example .streamlit/secrets.toml # add your Snowflake keys + APP_PASSWORD
streamlit run streamlit_app.py3 · Inside Snowflake.
- In Snowsight (the Snowflake web UI), run
sql/01_setup.sql, thensql/03_rate_limit.sql, thensql/02_sis_deploy.sql. - Full steps and grants are in docs/ARCHITECTURE.md.
| AI & data | App | Quality gates | Delivery |
| • Snowflake Cortex AI • AI_COMPLETE + Cortex Guard• AI_EMBED (arctic-embed-m-v1.5)• Cortex Search (optional) |
• Streamlit 1.64 • Python 3.11 • Snowflake connector 4.7.5 • stlite (browser demo) |
• pytest (102 tests) • ruff + pre-commit (7 hooks) • CodeQL · Gitleaks · pip-audit • Dependabot |
• GitHub Actions (4 workflows) • GitHub Pages (live demo) • python-semantic-release • SBOM on every release |
flowchart LR
Q([English question]) --> G[Input guard<br/>+ rate limit]
G --> R[Intent router<br/>whole-word]
R --> E[(Evidence SQL<br/>bound values)]
R --> L[(Law search<br/>AI_EMBED TOP-3)]
E --> P[Prompt builder<br/>≤350 words]
L --> P
P --> C[AI_COMPLETE<br/>guardrails ON]
C --> D[Draft SAR<br/>+ SHA-256]
D --> O{{Officer gate<br/>APP_OFFICERS}}
O -->|approve| A[(AUDIT_LOGS<br/>APPROVED)]
O -->|blocked| X[(AUDIT_LOGS<br/>APPROVE_DENIED)]
The plain-words version, with the real SQL and numbers behind each box, is in the Feynman explainer.
| Metric | Value | Where it is enforced |
|---|---|---|
| Law clauses per question | 3 | config.TOP_K |
| Evidence rows per draft | 5 | config.EVIDENCE_TX_LIMIT |
| AI calls without the harm filter | 0 | AI_COMPLETE_SQL sets {'guardrails': TRUE}; no unguarded retry |
| Max question length · prompt size | 2000 chars · 350 words | MAX_INPUT_LEN, MAX_PROMPT_WORDS |
| Rate limits | 10 / min / session · 50 / hour / user | check_rate, RATE_LIMIT table (fails closed) |
| Automated tests | 102 (no Snowflake needed) | tests/ |
.
├── streamlit_app.py # UI: login, KPI strip, chat, evidence inspector, officer sign-off
├── backend/
│ ├── hybrid_agent.py # guard → router → evidence SQL → law search → AI draft → officer gate → audit
│ ├── runtime.py # where am I running? local · Snowflake (SiS) · viewer identity
│ ├── demo.py # demo mode: sample rows, sample clauses, template draft
│ └── config.py # settings, model allow-lists, limits (single source of truth)
├── sql/ # run in order: 01 setup · 02 SiS deploy · 03 rate limit · 04 optional Cortex Search
├── tests/ # 102 pytest checks, fake database only
├── site/index.html # GitHub Pages shell that runs the app in the browser (stlite)
├── docs/
│ ├── ARCHITECTURE.md # deep reference: pipeline, models, SiS deploy, security model, cost
│ ├── context.html # Feynman explainer (also live on Pages)
│ ├── deck/ # hackathon slides (.pptx)
│ └── assets/ # screenshots
├── .github/ # CI, security, release, Pages workflows · issue/PR templates · Dependabot
├── context.md # handoff notes for the next engineer or agent
├── CHANGELOG.md · CONTRIBUTING.md · SECURITY.md · LICENSE
└── pyproject.toml · requirements.txt · requirements-dev.txt · .pre-commit-config.yaml · .editorconfig
| Read this | When you want |
|---|---|
| Feynman explainer | The idea in plain words, then the real machinery |
| docs/ARCHITECTURE.md | Models, Cortex Search, the Snowflake deploy, security model, cost |
| context.md | Handoff notes and decisions that must not regress |
| CONTRIBUTING.md | Setup, checks to run, commit format |
| SECURITY.md | How to report a hole, the scans that run, the access model |
| CHANGELOG.md · Releases | What changed in each version |
- Inputs: a character allow-list, blocked SQL words, 2000-character cap, bound values only, and integer-only
LIMIT/OFFSET. - AI: Cortex Guard is always on,
temperature 0, and only allow-listed models can be called. - People:
- Inside Snowflake, approval is checked per viewer against
APP_OFFICERS. - RESTRICTED accounts are hidden from analysts, and customer names are masked.
- Inside Snowflake, approval is checked per viewer against
- Output: tags are stripped before display, and the export never contains SQL.
- Honest limit: not yet run on a live Snowflake account. Every path is covered by fake-database tests and checked against the Snowflake docs. See ARCHITECTURE.md.
Behelit: Arun Kumar (@Arunkumar06-cmd), solo build for the CoCo CLI Hackathon, GCC Edition.


