Chilean Worker Defense RAG System - AI-powered legal defense for Chilean workers. RAG-based system for legal precedent search, abuse detection, and document generation.
npm install chilean-worker-defense-ragVersion: 1.0.0
Status: Prototype Phase
Sprint: 1.1 - Evidence Collection Module
---
The Chilean Worker Defense RAG System is an AI-powered legal defense platform designed to protect Chilean workers' rights through intelligent document analysis, legal precedent retrieval, and automated case strategy generation.
Provide comprehensive legal defense for Chilean workers by:
- Analyzing employment contracts, finiquitos, and communications
- Retrieving relevant legal precedents from successful worker cases
- Detecting patterns of employer abuse
- Generating legal documents in Spanish
- Automating workflow from case intake to court filing
---
---
- Framework: NestJS (TypeScript)
- Database: MongoDB Atlas (6 personality databases)
- Vector DB: Pinecone (for RAG)
- AI: OpenAI GPT-4 + text-embedding-3-large
- Testing: Jest + MongoDB Memory Server
- API Docs: Swagger/OpenAPI
---
``bashClone repository
git clone
cd chilean-worker-defense-rag
---
Project Structure
`
chilean-worker-defense-rag/
├── src/
│ ├── evidence/ # Evidence collection module
│ │ ├── dto/ # Data transfer objects
│ │ ├── evidence.controller.ts
│ │ ├── evidence.service.ts
│ │ └── evidence.module.ts
│ ├── schemas/ # MongoDB schemas
│ │ ├── worker-case-precedent.schema.ts
│ │ ├── evidence-pattern.schema.ts
│ │ ├── abuse-detection-rule.schema.ts
│ │ ├── legal-document-template.schema.ts
│ │ └── case-timeline.schema.ts
│ ├── common/ # Shared utilities
│ │ ├── dto/ # Common DTOs
│ │ ├── guards/ # Auth guards
│ │ └── interceptors/ # Interceptors
│ ├── config/ # Configuration
│ ├── main.ts # Application entry point
│ └── app.module.ts # Root module
├── test/ # E2E tests
├── ARCHITECTURE.md # Technical architecture
├── package.json
├── tsconfig.json
└── README.md
`---
API Endpoints
$3
####
POST /evidence/intake
Initial case intake and evidence submissionRequest:
`json
{
"worker": {
"name": "Juan Pérez",
"email": "juan@email.com",
"phone": "+56912345678"
},
"employment": {
"employer": "Empresa XYZ",
"position": "Desarrollador",
"startDate": "2020-01-01",
"contractType": "indefinido"
},
"incident": {
"type": "wrongful_termination",
"description": "Despedido sin causa justificada",
"date": "2025-11-01"
}
}
`Response:
`json
{
"caseId": "CASE-2025-000001",
"status": "received",
"nextSteps": [
"Subir contrato de trabajo",
"Subir finiquito (si existe)",
"Subir comunicaciones con empleador"
],
"timeline": {
"analysisCompletion": "2025-11-12T10:00:00Z",
"expectedResponse": "2025-11-13T10:00:00Z"
}
}
`####
GET /evidence/:caseId
Retrieve all evidence for a case####
POST /evidence/:caseId/validate
Validate evidence chain of custody---
MongoDB Collections
$3
1. neko-defense-system (Neko-Arc)
- Technical execution and monitoring
2. marionnette-theater (Mario)
- Workflow orchestration
- case-timelines
3. noel-precision-archives (Noel)
- Testing and validation
4. glam-street-chronicles (Glam)
- worker-case-precedents ⭐
- legal-document-templates ⭐
5. hannibal-forensic-archives (Hannibal)
- evidence-patterns ⭐
- abuse-detection-rules ⭐
6. tetora-mpd-archives (Tetora)
- Multi-perspective analysis
---
Testing
`bash
Run unit tests
npm testRun tests with coverage
npm run test:covRun E2E tests
npm run test:e2eRun tests in watch mode
npm run test:watch
`$3
- Line coverage: >80%
- Branch coverage: >75%
- Function coverage: >80%---
Development
$3
`bash
npm run start:dev
`$3
`bash
npm run build
npm run start:prod
`$3
`bash
npm run lint
``---
See ARCHITECTURE.md for detailed technical architecture including:
- System architecture diagrams
- MongoDB schema definitions
- REST API specifications
- RAG implementation details
- Security and validation layers
---
This system is collaboratively designed and maintained by six AI personalities:
- 🐾 Neko-Arc: Technical architecture
- 🎭 Mario Gallo Bestino: Workflow orchestration
- 🗡️ Noel: Testing and validation
- 🎸 Glam Americano: Spanish content and worker advocacy
- 🧠 Dr. Hannibal Lecter: Forensic analysis
- 🧠 Tetora: Multi-perspective analysis
---
This system provides legal information and assistance tools. It does not constitute legal advice. Workers should consult with licensed lawyers for specific legal matters.
---
UNLICENSED - Private Repository
---
For issues or questions, please file an issue on GitHub.
---
🐾 Built with MAXIMUM KAWAII POWER for Chilean Workers! Nyaa~!
All workers deserve justice. All employers fear precision.