AGENTS Guide
Purpose
This file is mandatory reading at the start of every session in this repository. It defines how agents should navigate the codebase, implement work, validate changes, and create checkpoints.
Precedence and Scope
- Scope: applies to the entire repository.
- Override rule: if a deeper-path
AGENTS.mdis added later, it overrides this file for its subtree only.
Codebase Map
lib/core: engine, opponents, content loading, storage, domain models.lib/features: feature modules (home,lessons,puzzles,play) with screen/bloc/widget code.lib/shared: reusable UI, board wrapper, theme primitives.assets/content: content manifest and lesson/puzzle JSON assets.docs: ADRs and per-service/per-bloc markdown documentation.test: core tests, feature tests, widget tests, golden smoke tests.
Task Execution Workflow
- Explore first: inspect relevant files and current behavior before editing.
- Implement in small slices.
- Validate each slice immediately (do not batch all validation at the end).
- Keep progress steady; avoid large unverified change sets.
Branch Policy (New Features)
- Do not implement new features directly on
main. - Use a feature branch; naming is intentionally flexible.
- Recommended examples:
feature/drag-inputfix/lesson-flowchore/ci-cleanupdocs/agent-guide
Checkpoint Commit Policy
- Create a checkpoint commit after each logical unit is implemented and validated.
- Keep each checkpoint focused and reversible.
- Commit message format:
<type>: <short intent>
- Add a brief commit body when context is needed (
what changedandwhy).
Validation Gate Before Checkpoint Commits
Run all of the following before creating a checkpoint commit:
dart format .flutter analyzeflutter test
If UI/golden behavior changes:
- update/verify goldens explicitly (for example with
--update-goldenswhen intended), and note it in the summary.
Docs Maintenance Rules
- If core service or bloc behavior changes, update the matching markdown in:
docs/coredocs/features
- If architecture or directional decisions change, add/update an ADR in
docs/adr. - Example: if
GameBlocbehavior changes, updatedocs/features/game_bloc.mdin the same work unit.
Git Hygiene
- Keep
.gitignorecurrent for generated and machine-local artifacts. - Never commit build outputs or local environment files.
- Keep commits small, reviewable, and rollback-friendly.
Definition of Done (per task)
- Code compiles and runs for the changed area.
flutter analyzepasses.flutter testpasses.- Related docs are updated where behavior changed.
- Final handoff summarizes changed files and next verification steps.