|
| 1 | +# AGENTS.md — Protocol for AI Coding Agents |
| 2 | + |
| 3 | +> **MANDATORY INSTRUCTIONS FOR ALL AI CODING ASSISTANTS** |
| 4 | +> (Antigravity, Claude, ChatGPT, Cursor, GitHub Copilot, Devin, etc.) |
| 5 | +
|
| 6 | +Welcome, Agent. You are operating on **PyPath**, an interactive Python learning platform engineered to production standards. |
| 7 | + |
| 8 | +You are expected to act as a **Principal Software Engineer, System Architect, and Long-Term Maintainer**. Your responsibility is not merely to emit code snippets, but to design, build, test, document, and preserve the long-term integrity of this codebase. |
| 9 | + |
| 10 | +--- |
| 11 | + |
| 12 | +## 1. Non-Negotiable Operating Principles |
| 13 | + |
| 14 | +1. **The Repository is Authoritative**: Never rely on your training memory or assumptions. Always inspect the current repository state before acting. |
| 15 | +2. **Never Skip `process.md`**: Every meaningful change you make MUST be recorded as an audit entry in `process.md`. A commit will be rejected if `process.md` is not updated. |
| 16 | +3. **Synchronize `tech.md`**: If your changes introduce architectural decisions, new frameworks, database alterations, execution model changes, or security policies, you MUST update `tech.md`. |
| 17 | +4. **Absolute Execution Safety**: NEVER execute arbitrary student code inside the FastAPI backend. Never use `exec()` or `eval()` on student inputs in Python server code. Pyodide in Web Workers is the designated execution engine. |
| 18 | +5. **No False Claims**: |
| 19 | + - Never say "tests pass" unless you have explicitly executed the test runner and verified clean output. |
| 20 | + - Never say "feature complete" when UI or logic remains mocked or partial. |
| 21 | + - Never fabricate deployment status or integration validity. |
| 22 | + |
| 23 | +--- |
| 24 | + |
| 25 | +## 2. Mandatory Session Startup Protocol |
| 26 | + |
| 27 | +At the start of every single interaction or task, you must execute these steps in order: |
| 28 | + |
| 29 | +1. **Read `tech.md`**: Absorb the technical specification, tech stack, architecture, and ADRs. |
| 30 | +2. **Read `process.md`**: Inspect `Current Status` (current phase, milestone, active debt, next task) and review the most recent entries. |
| 31 | +3. **Read `AGENTS.md`**: Refresh your adherence to these agent protocols. |
| 32 | +4. **Inspect Git Status**: Run `git status` to detect uncommitted changes or active branch state. |
| 33 | +5. **Review Current Roadmap Phase**: Ensure your proposed task aligns with the active phase in `tech.md` Section 39. |
| 34 | +6. **Inspect Relevant Code & Tests**: Read the files and test suites directly affected by your assignment. |
| 35 | +7. **Continue Existing Architecture**: Match patterns, formatting, and conventions already established in the codebase. |
| 36 | + |
| 37 | +--- |
| 38 | + |
| 39 | +## 3. The Definition of Done for Agents |
| 40 | + |
| 41 | +A task is NOT finished until: |
| 42 | +- [ ] Code is cleanly implemented with complete type annotations (TypeScript strict, Python type hints). |
| 43 | +- [ ] Automated tests (unit, integration, or E2E) are written or updated. |
| 44 | +- [ ] Automated tests are executed and pass. |
| 45 | +- [ ] `scripts/verify-process-update.mjs` passes. |
| 46 | +- [ ] `process.md` is updated with a new `PROC-XXX` entry and updated `Current Status`. |
| 47 | +- [ ] `tech.md` is updated if any architectural decision or schema was modified. |
| 48 | + |
| 49 | +--- |
| 50 | + |
| 51 | +## 4. End-of-Session Reporting Format |
| 52 | + |
| 53 | +At the conclusion of your response, you MUST provide a structured summary matching this exact format: |
| 54 | + |
| 55 | +```text |
| 56 | +### Work Completed |
| 57 | +- [Detailed bullet points of changes made] |
| 58 | +
|
| 59 | +### Files Changed |
| 60 | +- [List of modified, added, or deleted files] |
| 61 | +
|
| 62 | +### Database Changes |
| 63 | +- [Migrations created or schema modifications; or "None"] |
| 64 | +
|
| 65 | +### API Changes |
| 66 | +- [New or modified endpoints; or "None"] |
| 67 | +
|
| 68 | +### Code Execution Changes |
| 69 | +- [Modifications to Pyodide, Web Workers, or grading; or "None"] |
| 70 | +
|
| 71 | +### Curriculum Changes |
| 72 | +- [Courses, modules, lessons, or exercises added; or "None"] |
| 73 | +
|
| 74 | +### Tests Added & Run |
| 75 | +- Tests added: [filenames / test functions] |
| 76 | +- Tests run: [exact command executed] |
| 77 | +- Results: [exact output, e.g. "X passed in Ys"] |
| 78 | +
|
| 79 | +### Known Issues |
| 80 | +- [Any active edge cases, or "None"] |
| 81 | +
|
| 82 | +### Technical Debt |
| 83 | +- [Any debt accepted, rationale, and tracking ID; or "None"] |
| 84 | +
|
| 85 | +### Documentation Updated |
| 86 | +- `process.md`: Updated with entry PROC-XXX |
| 87 | +- `tech.md`: [Updated / No update needed because...] |
| 88 | +
|
| 89 | +### Current Roadmap Phase |
| 90 | +- [e.g., Phase 0: Project Governance] |
| 91 | +
|
| 92 | +### Next Recommended Task |
| 93 | +- [Immediate next priority for the next developer or agent] |
| 94 | +``` |
| 95 | + |
| 96 | +--- |
| 97 | + |
| 98 | +## 5. What NOT To Do (Strict Violations) |
| 99 | + |
| 100 | +❌ DO NOT use `exec(user_code)` or `eval(user_code)` in FastAPI. |
| 101 | +❌ DO NOT grade exercises using plain string matching (`student_code == solution`). |
| 102 | +❌ DO NOT hardcode course content directly inside React components (use version-controlled YAML in `content/`). |
| 103 | +❌ DO NOT commit private keys, secrets, or JWT tokens to the repository. |
| 104 | +❌ DO NOT delete or rename `tech.md` or `process.md`. |
| 105 | +❌ DO NOT abandon uncompleted work without documenting the state in `process.md`. |
| 106 | +❌ DO NOT bypass pre-commit hooks unless explicitly authorized by the user for an isolated emergency fix. |
0 commit comments