# AI agent guide

> How to work with this repository's architecture documentation.

## Start here

Before any autonomous task, read in this order:

1. [`project_context.md`](project_context.md) — what the system does and why.
2. [`architecture_overview.md`](architecture_overview.md) — high-level components and data flow.
3. [`architecture_components.md`](architecture_components.md) — responsibilities of each module.
4. [`architecture_data_flow.md`](architecture_data_flow.md) — step-by-step flows for inspection, retraining, and debug.
5. [`architecture_testing.md`](architecture_testing.md) — testing constraints and datasets.

## When implementing a component

1. Find the component name in [`architecture_components.md`](architecture_components.md).
2. Check [`architecture_data_flow.md`](architecture_data_flow.md) for inputs and outputs.
3. Check [`architecture_testing.md`](architecture_testing.md) for related test data / constraints.
4. Add or update tests before finishing.
5. Run verification if available; if not, state what should be added.

## When changing data schema

- Update the data-flow descriptions in [`architecture_data_flow.md`](architecture_data_flow.md).
- Update DB and event definitions if they exist.
- Ensure the WEB UI and Main Server agree on the new fields.

## When adding a new camera channel

- Each channel maps to one YOLO instance with its own config (model, threshold, preprocessing).
- Update JSON config, Main Server routing, and WEB UI tabs together.
- See [`architecture_components.md`](architecture_components.md) for per-channel pipeline details.

## When modifying models or training

- Keep model versions and metrics.
- Document camera / dataset changes in [`architecture_testing.md`](architecture_testing.md).
- Verify retraining flow end-to-end before declaring done.
