- add standardized AI BUILD ENTRY and AI PLAN ENTRY format - improve consistency of AI development logs - update instructions-agent.md
5.8 KiB
Agent Instructions: Universal Python Project Template
Project Overview
This repository is a universal and adaptable Python template intended to serve as a professional starting point for new projects.
Core Directives
- All code, comments, variables, string literals, commit messages, and documentation must be written in English.
- Use Python 3.11+ with type hints whenever possible.
- Follow clean code principles and PEP 8.
- Keep modules small, cohesive, and maintainable.
- Use consistent docstrings for public classes and functions.
- Prefer explicit error handling over silent failures.
Architecture Guidelines
- Keep business logic separate from infrastructure concerns.
- Avoid mixing configuration, I/O, and domain logic in the same module.
- Prefer reusable services over duplicated logic.
- Do not introduce unnecessary complexity or premature abstractions.
Quality Standards
- Every meaningful feature should include tests.
- Run formatting, linting, and type checks before considering a task complete.
- Keep the README updated whenever setup, commands, or structure changes.
- Do not leave placeholder code unless clearly marked.
Tooling
- Testing: pytest
- Formatting: black
- Linting: ruff
- Static typing: mypy
Expected Project Structure
src/app/ tests/ scripts/ README.md instructions-agent.md pyproject.toml
Agent Workflow
- First understand the repository structure.
- Propose a short implementation plan before major changes.
- Reuse existing modules whenever possible.
- Keep changes minimal, coherent, and production-oriented.
- Validate changes with tests and quality tools when possible.
Application Specification
This repository includes an application specification that defines the expected behavior of the project.
Primary specification file:
specs/cd_browser_spec.md
Agent rules:
- Before implementing any feature, read the application specification.
- If implementation details are unclear, follow the specification first.
- If the specification conflicts with a previous assumption, the specification takes precedence.
- Keep implementation aligned with the MVP scope unless explicitly asked to extend it.
- After code changes, run the appropriate validation workflow defined by this repository.
AI Worklog Policy
This repository maintains an AI-assisted development log.
Files:
docs/ai-worklog.mddocs/ai-prompts.md
Rules:
- After every significant
planorbuildtask, append a concise worklog entry todocs/ai-worklog.md. - Each worklog entry must include:
- date
- task type (
planorbuild) - short objective
- files inspected or modified
- key decisions
- validation commands run
- result
- unresolved issues if any
- When a prompt meaningfully changes architecture, behavior, workflow, debugging direction, or project structure, append the prompt (or a concise cleaned version of it) to
docs/ai-prompts.md. - Do not store private chain-of-thought or internal reasoning.
- Store only concise, user-facing summaries of what was done.
- Keep entries chronological and easy to scan.
Mandatory AI Logging
Every significant AI interaction in this repository must be logged.
This applies to:
plantasksbuildtasks- debugging tasks
- documentation tasks
- architectural discussions that affect the project
Required files:
docs/ai-worklog.mddocs/ai-prompts.md
Mandatory rules:
- After every significant
plantask, append a concise entry todocs/ai-worklog.md. - After every significant
buildtask, append a concise entry todocs/ai-worklog.md. - If the task was driven by a meaningful prompt, also append an entry to
docs/ai-prompts.md. - Logging is part of the task itself and must not be skipped.
- The task is not complete until the logs are updated.
Each worklog entry must include:
- date
- task type (
planorbuild) - short objective
- files inspected or modified
- key decisions
- validation commands run, if any
- result
- unresolved issues, if any
Validation logging rule:
- If validation commands such as
make fix,make quality,pytest, or other checks are executed during the task, the worklog entry must record them explicitly. - The value
validation: not runmay only be used if no validation commands were executed. - The worklog entry must reflect the actual commands run during the task.
Each prompt log entry must include:
- date
- task type (
planorbuild) - short prompt summary
- scope
- result summary
Rules:
- Do not store chain-of-thought or private reasoning.
- Store only concise user-facing summaries.
- Keep entries chronological.
- Even small but meaningful tasks must be logged.
Standard AI Log Entry Format
To ensure consistency and readability of long AI-assisted development histories, all log entries must follow a standardized block format.
Agents must write log entries using the following structure.
Example for build tasks:
AI BUILD ENTRY
Date: YYYY-MM-DD
Task: build
Objective: short description of the task
Files Modified:
- file/path/example.py
- another/file.md
Key Decisions:
- short bullet explaining important choices
Validation:
- make fix (passed)
- make quality (passed)
Result:
- short description of what changed or was achieved
Open Issues:
- optional list of unresolved problems
Example for plan tasks:
AI PLAN ENTRY
Date: YYYY-MM-DD
Task: plan
Objective: short description of planning objective
Files Inspected:
- src/app/example.py
- specs/example_spec.md
Proposed Changes:
- summary of planned changes
Notes:
- optional relevant observations
Rules:
- Always use these headers exactly (
AI BUILD ENTRYorAI PLAN ENTRY). - Keep entries concise and structured.
- Do not include chain-of-thought reasoning.
- Use bullet points when possible.
- This format must be used when updating
docs/ai-worklog.md.