Spaces:
Sleeping
refactor: KI-047 — bucket reorg (Option A safe subset)
Browse filesUser picked numbered-bucket layout. Executing the SAFE subset that does
NOT touch Python imports or string path refs:
• docs/ → 70-docs/
• audit_results/ → 80-audit/
Kept as-is (renaming would need ~25 Python files of string-path updates
— deferred to follow-up):
• data/ — code-referenced (backend/{premium_calculator,
session_state, profile_store, scorecard, admin,
llm_health, main}, rag/build_kb, tools/{check_link_rot,
info_source_map, curate_*, refresh_premiums,
generate_policy_facts}).
• backend/, frontend/, rag/, tools/, eval/, tests/, kb/ — Python
directly forbids leading-digit / hyphen package names.
All references to the moved folders updated in one sed pass across
*.md, *.py, *.sh, *.ts, *.tsx, *.json, Dockerfile.
Verified by:
• tests/test_routing_regression.py — 15/15 still pass.
• No residual (docs/ or [docs/ or /docs/ or ^docs/ refs.
• Same for audit_results/.
Dockerfile: COPY docs ./docs → COPY 70-docs ./70-docs. Container path
mirrors host; nothing in the running app reads from these dirs (purely
reference documentation).
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
- {docs → 70-docs}/00-overview/problem-statement.md +0 -0
- {docs → 70-docs}/00-overview/roadmap.md +1 -1
- {docs → 70-docs}/10-architecture/safety-architecture.md +0 -0
- {docs → 70-docs}/10-architecture/scoring-knowledge-graph.md +0 -0
- {docs → 70-docs}/10-architecture/scoring-methodology.md +0 -0
- {docs → 70-docs}/10-architecture/scoring-tie-breaker-rubric.md +0 -0
- {docs → 70-docs}/10-architecture/stack-rationale.md +0 -0
- {docs → 70-docs}/10-architecture/system-overview.md +1 -1
- {docs → 70-docs}/20-data-pipeline/information-source-map.md +0 -0
- {docs → 70-docs}/20-data-pipeline/ingestion-policy.md +0 -0
- {docs → 70-docs}/30-engineering/discovery-script.md +1 -1
- {docs → 70-docs}/30-engineering/needs-analysis-flow.md +0 -0
- {docs → 70-docs}/40-evaluation/eval-methodology.md +0 -0
- {docs → 70-docs}/40-evaluation/known-issues.md +1 -1
- {docs → 70-docs}/40-evaluation/quality-sprint-2026-05-14.md +1 -1
- {docs → 70-docs}/60-decisions/ADR-001-vertical-slice-scope.md +2 -2
- {docs → 70-docs}/60-decisions/ADR-002-health-category-vertical.md +0 -0
- {docs → 70-docs}/60-decisions/ADR-003-curated-corpus.md +0 -0
- {docs → 70-docs}/60-decisions/ADR-004-hybrid-structured-vector.md +0 -0
- {docs → 70-docs}/60-decisions/ADR-005-nextjs-fastapi-frontend.md +0 -0
- {docs → 70-docs}/60-decisions/ADR-006-sarvam-first-stack.md +0 -0
- {docs → 70-docs}/60-decisions/ADR-007-illustrative-pricing.md +1 -1
- {docs → 70-docs}/60-decisions/ADR-008-consultative-advisor-persona.md +0 -0
- {docs → 70-docs}/60-decisions/ADR-009-19-insurer-comprehensive-schema.md +0 -0
- {docs → 70-docs}/60-decisions/ADR-010-secret-handling.md +0 -0
- {docs → 70-docs}/60-decisions/ADR-011-bge-local-embeddings.md +0 -0
- {docs → 70-docs}/60-decisions/ADR-012-render-then-hf-space-deploy.md +0 -0
- {docs → 70-docs}/60-decisions/ADR-013-tailwind-shadcn-ui.md +0 -0
- {docs → 70-docs}/60-decisions/ADR-014-groq-llama-grader.md +0 -0
- {docs → 70-docs}/60-decisions/ADR-015-openapi-typescript-codegen.md +0 -0
- {docs → 70-docs}/60-decisions/ADR-016-hybrid-brain-router.md +0 -0
- {docs → 70-docs}/60-decisions/ADR-017-irdai-corpus-playwright-rescue.md +0 -0
- {docs → 70-docs}/60-decisions/ADR-018-chunk-size-sweep-deferred.md +0 -0
- {docs → 70-docs}/60-decisions/ADR-019-nim-single-provider-consolidation.md +0 -0
- {docs → 70-docs}/60-decisions/ADR-020-code-data-split-hf-dataset.md +0 -0
- {docs → 70-docs}/60-decisions/ADR-021-view-aware-system-prompt.md +0 -0
- {docs → 70-docs}/60-decisions/ADR-022-conversational-profile-updates.md +0 -0
- {docs → 70-docs}/60-decisions/ADR-023-admin-panel-ip-gated.md +0 -0
- {docs → 70-docs}/60-decisions/ADR-024-triple-mirror-code-and-data.md +0 -0
- {docs → 70-docs}/60-decisions/ADR-025-single-chroma-collection-with-metadata-partitioning.md +0 -0
- {docs → 70-docs}/60-decisions/ADR-026-provider-load-balancing.md +0 -0
- {docs → 70-docs}/60-decisions/ADR-027-fact-find-llm-paraphraser.md +0 -0
- {docs → 70-docs}/60-decisions/ADR-028-voice-ux-single-default-mode.md +0 -0
- {docs → 70-docs}/60-decisions/ADR-029-hnsw-bloat-tripwire.md +2 -2
- {docs → 70-docs}/60-decisions/README.md +1 -1
- {docs → 70-docs}/60-decisions/legacy-decisions-monolith.md +0 -0
- {docs → 70-docs}/ci-templates/eval-workflow.yml.template +0 -0
- {audit_results → 80-audit}/ENTERPRISE_AUDIT.md +0 -0
- {audit_results → 80-audit}/README.md +3 -3
- CLAUDE.md +3 -3
|
File without changes
|
|
@@ -121,7 +121,7 @@ The point of disciplined v1 architecture is that these things are **stable** acr
|
|
| 121 |
2. **Provider abstraction** (`backend/providers/base.py`) — swap STT/TTS/LLM via config
|
| 122 |
3. **Faithfulness verifier** (`backend/faithfulness.py`) — same 4 gates, possibly more
|
| 123 |
4. **Persona prompt + citation grammar** — same, refined
|
| 124 |
-
5. **Eval methodology** (`docs/03-eval-plan.md`) — same harness, more gold data
|
| 125 |
|
| 126 |
The "c-readiness commitments" in Doc 02 §7 are the contract. Every v2 feature is a commitment honored.
|
| 127 |
|
|
|
|
| 121 |
2. **Provider abstraction** (`backend/providers/base.py`) — swap STT/TTS/LLM via config
|
| 122 |
3. **Faithfulness verifier** (`backend/faithfulness.py`) — same 4 gates, possibly more
|
| 123 |
4. **Persona prompt + citation grammar** — same, refined
|
| 124 |
+
5. **Eval methodology** (`70-docs/03-eval-plan.md`) — same harness, more gold data
|
| 125 |
|
| 126 |
The "c-readiness commitments" in Doc 02 §7 are the contract. Every v2 feature is a commitment honored.
|
| 127 |
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
@@ -281,7 +281,7 @@ insurance-sales-bot/
|
|
| 281 |
├── data/
|
| 282 |
│ ├── insurers.json # 10 insurers metadata
|
| 283 |
│ └── corpus_urls.md # output of corpus-discovery sub-agent
|
| 284 |
-
├── docs/
|
| 285 |
│ ├── 01-requirements.md
|
| 286 |
│ ├── 02-architecture.md # THIS FILE
|
| 287 |
│ ├── 03-eval-plan.md
|
|
|
|
| 281 |
├── data/
|
| 282 |
│ ├── insurers.json # 10 insurers metadata
|
| 283 |
│ └── corpus_urls.md # output of corpus-discovery sub-agent
|
| 284 |
+
├── 70-docs/
|
| 285 |
│ ├── 01-requirements.md
|
| 286 |
│ ├── 02-architecture.md # THIS FILE
|
| 287 |
│ ├── 03-eval-plan.md
|
|
File without changes
|
|
File without changes
|
|
@@ -132,7 +132,7 @@ This is the customer-protection framing. It tells the user honesty is **self-pro
|
|
| 132 |
The questions live in `backend/needs_finder.py::GRAPH`. To add a new question:
|
| 133 |
|
| 134 |
1. Add a `Question(...)` entry with `id`, `prompt_en` (plain language + WHY), `prompt_hi` (Hindi rendering), `field` (which Profile attribute it sets), `is_core` (boolean — counts toward completeness), optional `condition` callable, optional `parser`.
|
| 135 |
-
2. Add a row in `docs/scorecard-knowledge-graph.md` Part B showing how the new input shifts weights.
|
| 136 |
3. Wire the shift into `_profile_tuned_weights()` in `backend/scorecard.py`.
|
| 137 |
|
| 138 |
Drift between these three places breaks the transparency promise. Keep them in sync.
|
|
|
|
| 132 |
The questions live in `backend/needs_finder.py::GRAPH`. To add a new question:
|
| 133 |
|
| 134 |
1. Add a `Question(...)` entry with `id`, `prompt_en` (plain language + WHY), `prompt_hi` (Hindi rendering), `field` (which Profile attribute it sets), `is_core` (boolean — counts toward completeness), optional `condition` callable, optional `parser`.
|
| 135 |
+
2. Add a row in `70-docs/scorecard-knowledge-graph.md` Part B showing how the new input shifts weights.
|
| 136 |
3. Wire the shift into `_profile_tuned_weights()` in `backend/scorecard.py`.
|
| 137 |
|
| 138 |
Drift between these three places breaks the transparency promise. Keep them in sync.
|
|
File without changes
|
|
File without changes
|
|
@@ -203,7 +203,7 @@ progress prints. Document for future tooling.
|
|
| 203 |
## Quality-sprint cadence
|
| 204 |
|
| 205 |
Every batch of fixes ships as one commit referencing the KI numbers it
|
| 206 |
-
closes. The audit run (`
|
| 207 |
empirical signal for whether a fix is actually working in production.
|
| 208 |
|
| 209 |
The standing ratio target: **for every 1 user-facing bug a reviewer
|
|
|
|
| 203 |
## Quality-sprint cadence
|
| 204 |
|
| 205 |
Every batch of fixes ships as one commit referencing the KI numbers it
|
| 206 |
+
closes. The audit run (`80-audit/<run_id>/report.md`) is the
|
| 207 |
empirical signal for whether a fix is actually working in production.
|
| 208 |
|
| 209 |
The standing ratio target: **for every 1 user-facing bug a reviewer
|
|
@@ -66,7 +66,7 @@ Plus the system-prompt reinforcement for KI-013 (rules 8 + 9 in `ADVISOR_SYSTEM_
|
|
| 66 |
- **Sample:** 100 personas × 30 turns = 3000 chat calls against live HF Space
|
| 67 |
- **Concurrency:** 4 async workers with 2.0s/dispatch global rate limit (under NIM's 40 req/min cap)
|
| 68 |
- **Expected wall time:** ~2 hours
|
| 69 |
-
- **Output:** `
|
| 70 |
- **Resumable:** completed personas' JSONs persist; re-running the script skips them.
|
| 71 |
|
| 72 |
The audit is the empirical truth-source for the quality sprint. Pre-sprint we expected: high refusal rate, infinite re-ask loops, demographic-mismatched recommendations. Post-sprint we expect: 0 infinite loops (KI-011 + KI-012 fixed), fact-find always asked before recommendations (KI-013), and verbose/casual/Hinglish styles handled gracefully (keyword fast-path in KI-011 fix).
|
|
|
|
| 66 |
- **Sample:** 100 personas × 30 turns = 3000 chat calls against live HF Space
|
| 67 |
- **Concurrency:** 4 async workers with 2.0s/dispatch global rate limit (under NIM's 40 req/min cap)
|
| 68 |
- **Expected wall time:** ~2 hours
|
| 69 |
+
- **Output:** `80-audit/full_20260514_145243/transcripts/<persona_id>.json` + `report.md` after analyzer pass
|
| 70 |
- **Resumable:** completed personas' JSONs persist; re-running the script skips them.
|
| 71 |
|
| 72 |
The audit is the empirical truth-source for the quality sprint. Pre-sprint we expected: high refusal rate, infinite re-ask loops, demographic-mismatched recommendations. Post-sprint we expect: 0 infinite loops (KI-011 + KI-012 fixed), fact-find always asked before recommendations (KI-013), and verbose/casual/Hinglish styles handled gracefully (keyword fast-path in KI-011 fix).
|
|
@@ -26,8 +26,8 @@ Build the vertical slice. One category (Health) — but every architectural surf
|
|
| 26 |
|
| 27 |
**Positive:** Demonstrates senior-engineer scoping discipline. Every part of the bot a BFSI buyer would audit (provenance, refusal, eval rigor) is real, not stubbed.
|
| 28 |
|
| 29 |
-
**Negative:** Life, Motor, and other categories are not covered. The seven "c-readiness commitments" in `docs/10-architecture/system-overview.md` §7 become real v2 work.
|
| 30 |
|
| 31 |
## Revisit at scale (v2)
|
| 32 |
|
| 33 |
-
Category expansion plan in `docs/00-overview/roadmap.md`. Each new category requires: (1) corpus acquisition, (2) per-category schema extension, (3) eval gold set, (4) scorecard sub-score weights. No core code changes.
|
|
|
|
| 26 |
|
| 27 |
**Positive:** Demonstrates senior-engineer scoping discipline. Every part of the bot a BFSI buyer would audit (provenance, refusal, eval rigor) is real, not stubbed.
|
| 28 |
|
| 29 |
+
**Negative:** Life, Motor, and other categories are not covered. The seven "c-readiness commitments" in `70-docs/10-architecture/system-overview.md` §7 become real v2 work.
|
| 30 |
|
| 31 |
## Revisit at scale (v2)
|
| 32 |
|
| 33 |
+
Category expansion plan in `70-docs/00-overview/roadmap.md`. Each new category requires: (1) corpus acquisition, (2) per-category schema extension, (3) eval gold set, (4) scorecard sub-score weights. No core code changes.
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
@@ -45,4 +45,4 @@ Buyers expect to see premium estimates. Indian insurers hide real pricing behind
|
|
| 45 |
|
| 46 |
## Revisit at scale
|
| 47 |
|
| 48 |
-
v2 path: B2B partnership with an aggregator (PolicyBazaar, Ditto, InsuranceDekho) or direct insurer APIs to get real quotes. See `docs/00-overview/roadmap.md` §v2.2.
|
|
|
|
| 45 |
|
| 46 |
## Revisit at scale
|
| 47 |
|
| 48 |
+
v2 path: B2B partnership with an aggregator (PolicyBazaar, Ditto, InsuranceDekho) or direct insurer APIs to get real quotes. See `70-docs/00-overview/roadmap.md` §v2.2.
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
@@ -2,7 +2,7 @@
|
|
| 2 |
|
| 3 |
**Status:** Accepted — 2026-05-14
|
| 4 |
**Owner:** Rohit Saraf
|
| 5 |
-
**Trigger incident:** D-001 in [`
|
| 6 |
|
| 7 |
## Context
|
| 8 |
|
|
@@ -57,7 +57,7 @@ All three layer-2 + layer-3 scripts live under `~/Library/Scripts/` (NOT `~/Docu
|
|
| 57 |
|
| 58 |
## Related
|
| 59 |
|
| 60 |
-
- D-001 in [`
|
| 61 |
- [`rag/ingest.py::_abort_if_hnsw_bloated`](../../rag/ingest.py)
|
| 62 |
- `~/Library/Scripts/insurance-bot/check-vector-bloat.sh`
|
| 63 |
- `~/Library/Scripts/cache-prevention/disk-free-tripwire.sh`
|
|
|
|
| 2 |
|
| 3 |
**Status:** Accepted — 2026-05-14
|
| 4 |
**Owner:** Rohit Saraf
|
| 5 |
+
**Trigger incident:** D-001 in [`80-audit/ENTERPRISE_AUDIT.md`](../../80-audit/ENTERPRISE_AUDIT.md)
|
| 6 |
|
| 7 |
## Context
|
| 8 |
|
|
|
|
| 57 |
|
| 58 |
## Related
|
| 59 |
|
| 60 |
+
- D-001 in [`80-audit/ENTERPRISE_AUDIT.md`](../../80-audit/ENTERPRISE_AUDIT.md)
|
| 61 |
- [`rag/ingest.py::_abort_if_hnsw_bloated`](../../rag/ingest.py)
|
| 62 |
- `~/Library/Scripts/insurance-bot/check-vector-bloat.sh`
|
| 63 |
- `~/Library/Scripts/cache-prevention/disk-free-tripwire.sh`
|
|
@@ -2,7 +2,7 @@
|
|
| 2 |
|
| 3 |
Each major technical or product decision is captured as a single ADR using a lightly adapted Michael Nygard template: **Status · Context · Decision · Alternatives · Consequences · Revisit-at-scale**.
|
| 4 |
|
| 5 |
-
ADR numbers map 1:1 to the original `D-NNN` entries that lived in the legacy `docs/decisions.md` (now split into individual files for easier review, citation, and supersession tracking).
|
| 6 |
|
| 7 |
## Index
|
| 8 |
|
|
|
|
| 2 |
|
| 3 |
Each major technical or product decision is captured as a single ADR using a lightly adapted Michael Nygard template: **Status · Context · Decision · Alternatives · Consequences · Revisit-at-scale**.
|
| 4 |
|
| 5 |
+
ADR numbers map 1:1 to the original `D-NNN` entries that lived in the legacy `70-docs/decisions.md` (now split into individual files for easier review, citation, and supersession tracking).
|
| 6 |
|
| 7 |
## Index
|
| 8 |
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
@@ -1,4 +1,4 @@
|
|
| 1 |
-
# `
|
| 2 |
|
| 3 |
Two artefact classes coexist here:
|
| 4 |
|
|
@@ -19,7 +19,7 @@ Status emoji: ✅ fixed · ⚠️ partial · 🟡 improving · 🔴 open.
|
|
| 19 |
## Run-directory layout
|
| 20 |
|
| 21 |
```
|
| 22 |
-
|
| 23 |
├── ENTERPRISE_AUDIT.md
|
| 24 |
└── <run_id>/
|
| 25 |
├── transcripts/
|
|
@@ -55,7 +55,7 @@ audit_results/
|
|
| 55 |
## How runs flow into the register
|
| 56 |
|
| 57 |
1. `python tools/audit/run_audit.py` writes per-persona transcripts.
|
| 58 |
-
2. `python tools/audit/analyze.py
|
| 59 |
3. New defects → new `D-NNN` row in `ENTERPRISE_AUDIT.md`.
|
| 60 |
4. Fixes → status flipped, run re-executed as `postfix_…`, evidence linked.
|
| 61 |
|
|
|
|
| 1 |
+
# `80-audit/` — Audit output + production-readiness register
|
| 2 |
|
| 3 |
Two artefact classes coexist here:
|
| 4 |
|
|
|
|
| 19 |
## Run-directory layout
|
| 20 |
|
| 21 |
```
|
| 22 |
+
80-audit/
|
| 23 |
├── ENTERPRISE_AUDIT.md
|
| 24 |
└── <run_id>/
|
| 25 |
├── transcripts/
|
|
|
|
| 55 |
## How runs flow into the register
|
| 56 |
|
| 57 |
1. `python tools/audit/run_audit.py` writes per-persona transcripts.
|
| 58 |
+
2. `python tools/audit/analyze.py 80-audit/<run_id>/` rolls up `report.md` + `summary.json`.
|
| 59 |
3. New defects → new `D-NNN` row in `ENTERPRISE_AUDIT.md`.
|
| 60 |
4. Fixes → status flipped, run re-executed as `postfix_…`, evidence linked.
|
| 61 |
|
|
@@ -1,6 +1,6 @@
|
|
| 1 |
# CLAUDE.md — project memory for AI assistants
|
| 2 |
|
| 3 |
-
This file is read by Claude Code (and any compatible AI tool) at the start of a session in this repo. Keep it under ~200 lines and focused on **stable, non-obvious facts a new contributor would need**. For change history, look at git log, `
|
| 4 |
|
| 5 |
## Project at a glance
|
| 6 |
|
|
@@ -63,8 +63,8 @@ Three independent safety layers against ChromaDB HNSW bloat:
|
|
| 63 |
## What to read for what
|
| 64 |
|
| 65 |
- **System tour:** `README.md` (the master entry).
|
| 66 |
-
- **Decisions with alternatives:** `docs/60-decisions/ADR-*.md` (28 ADRs as of 2026-05-14).
|
| 67 |
-
- **Production-readiness defect register:** `
|
| 68 |
- **Data lineage:** `kb/AUDIT_TRAIL.md`.
|
| 69 |
- **Tests:** `tests/test_routing_regression.py` (15 tests pinning routing + load-balance invariants).
|
| 70 |
|
|
|
|
| 1 |
# CLAUDE.md — project memory for AI assistants
|
| 2 |
|
| 3 |
+
This file is read by Claude Code (and any compatible AI tool) at the start of a session in this repo. Keep it under ~200 lines and focused on **stable, non-obvious facts a new contributor would need**. For change history, look at git log, `80-audit/ENTERPRISE_AUDIT.md`, and `70-docs/60-decisions/`.
|
| 4 |
|
| 5 |
## Project at a glance
|
| 6 |
|
|
|
|
| 63 |
## What to read for what
|
| 64 |
|
| 65 |
- **System tour:** `README.md` (the master entry).
|
| 66 |
+
- **Decisions with alternatives:** `70-docs/60-decisions/ADR-*.md` (28 ADRs as of 2026-05-14).
|
| 67 |
+
- **Production-readiness defect register:** `80-audit/ENTERPRISE_AUDIT.md`.
|
| 68 |
- **Data lineage:** `kb/AUDIT_TRAIL.md`.
|
| 69 |
- **Tests:** `tests/test_routing_regression.py` (15 tests pinning routing + load-balance invariants).
|
| 70 |
|