1.3 KiB
1.3 KiB
CivicSwarm Agent Guide
Architecture
civicswarm/db.pydefines the SQLite schema and engine setup.civicswarm/analysis.pycontains TF-IDF clustering, extractive summarization, language detection, and lightweight sentiment heuristics.civicswarm/service.pyis the domain layer for proposals, comments, routing, privacy-preserving preference aggregation, the deliberation ledger, dashboard metrics, and civic brief export.civicswarm/api.pyexposes the service through FastAPI.
Tech Stack
- Python 3.11
- FastAPI for the HTTP surface
- SQLAlchemy Core with SQLite for persistence
- scikit-learn and numpy for topic clustering and routing similarity
- langdetect for best-effort multilingual handling
Working Rules
- Keep resident identity pseudonymous. Use
resident_keyvalues only; do not add raw identity storage. - Prefer the smallest correct change.
- Keep logic deterministic where possible so tests remain stable.
- Add or update tests for every behavior change.
- Do not remove or rewrite unrelated files.
Testing
- Install dependencies and run the suite:
bash test.sh test.shmust succeed withpytestandpython3 -m build.
Packaging
- Distribution name:
idea198-civicswarm-privacy-preserving - README must stay current because it is wired into package metadata.