# Agent Collaboration Guide This guide is for Codex or other coding agents working in this repository. ## Project Summary DEMO-AGENT V2 is a Django application for IVD registration document review. The main app is `review_agent`, with workflow modules for file summaries, regulatory review, application form filling, regulatory information package generation, knowledge-base management, and Feishu notification/question handling. The current `master` branch is intended to match `V2`. ## Important Paths | Path | Purpose | | --- | --- | | `config/settings.py` | Django settings and environment loading | | `config/urls.py` | Page routes and included API routes | | `review_agent/models.py` | Shared Django models | | `review_agent/urls.py` | Review-agent API routes | | `review_agent/file_summary/` | Attachment handling, file inventory, page count, exports | | `review_agent/regulatory_review/` | NMPA review workflow, rules, RAG, risk and issue review | | `review_agent/application_form_fill/` | Application form field extraction and Word filling | | `review_agent/regulatory_info_package/` | Chapter 1 regulatory information package generation | | `review_agent/notifications/` | Notification dispatch and Feishu adapters | | `templates/` | Django templates | | `static/` | Frontend CSS and JavaScript | | `docs/` | Requirements, designs, plans, source materials | | `tests/` | pytest suite | ## Development Rules - Prefer the existing Django patterns in `review_agent` before introducing new abstractions. - Keep workflow modules independent. Do not fold regulatory package, application form fill, or regulatory review logic into unrelated modules. - Preserve user data and generated artifacts. Do not delete `media/`, `.tmp/`, `db.sqlite3`, or `.env` unless explicitly asked. - Treat `.env` as environment-specific configuration. It is currently tracked because this project needs a complete V2 state, but do not print secret values in logs or docs. - For Word/PDF/Excel handling, use structured libraries already in the project instead of ad hoc text parsing when possible. - For frontend work, keep the current workbench style: restrained, task-focused, evidence-first, and consistent with existing templates and CSS. ## Common Commands ```bash python manage.py check python manage.py migrate python manage.py runserver pytest pytest tests -k regulatory_info_package pytest tests/test_feishu_*.py ``` ## Verification Notes Before claiming a code change is complete, run at least the narrow test set for the touched workflow. For broad changes, run `python manage.py check` and `pytest`. Known current state: - `python manage.py check` passes. - `pytest tests -k regulatory_info_package` passes. - Full `pytest` may still include a few historical failures unrelated to the latest regulatory-info-package merge; report exact failures if they remain. ## Git Notes - Check `git status --short --branch` before editing. - Do not reset or revert user changes unless explicitly asked. - Keep commits grouped by logical concern: docs, feature behavior, tests, cleanup. - When merging `V2` and `master`, remember these histories were unrelated before the merge. Prefer preserving the V2 tree when the goal is to keep `master` as the complete V2 state.