AI Agent Operating Rules
Relevant source files
The following files were used as context for generating this wiki page:
AI Agent Operating Rules define the mandatory protocols, authority hierarchies, and execution models for all AI agents (including ChatGPT, Codex, Cursor, and others) contributing to the LGFC repository. These rules ensure repeatable work, maintain repository integrity, and enforce a strict Issue-first development workflow.
The core objective is to prevent scope expansion, preserve canonical designs, and ensure that every automated change is mapped to a verified requirement in the tracking system.
Sources: Agent.md:16-19, ops/ai/CROSS-AGENT-OPERATING-RULES.md:11-15
Authority Hierarchy
Agents must resolve conflicts by following a strict single-source authority hierarchy. If information in a lower-level document contradicts a higher-level one, the higher-level document takes precedence.
| Priority | Authority Level | Document Types / Sources |
|---|---|---|
| 1 | Highest | Locked design, platform, and governance documents |
| 2 | High | Source Issue scope and operational trackers |
| 3 | Medium | Agent.md (Core Rules) |
| 4 | Low | Agent-specific rules (e.g., CURSOR-RULES.md) |
| 5 | Lowest | Specific task prompt |
Sources: Agent.md:32-38, governance/ai/AGENT-GOVERNANCE.md:15-24
Execution and Routing Model
The repository utilizes a skill-based routing system. Agents are required to identify the nature of their task and utilize the corresponding repository skill file located under .agents/skills/.
Skill Routing Triggers
| Trigger Keywords | Skill Path |
|---|---|
| PR creation, Issue linkage, labels | .agents/skills/lgfc-pr-governance/SKILL.md |
| Homepage, navigation, visual layout | .agents/skills/lgfc-design-compliance/SKILL.md |
| Documentation moves, authority hierarchy | .agents/skills/lgfc-docs-authority/SKILL.md |
| API, D1, Cloudflare, static export | .agents/skills/lgfc-cloudflare-static-export/SKILL.md |
| PR handoff, verification evidence | .agents/skills/lgfc-verification-closeout/SKILL.md |
Sources: Agent.md:47-57, ops/ai/CROSS-AGENT-OPERATING-RULES.md:20-22
Process Flow
The following diagram illustrates the lifecycle of an agent-driven task from entry to completion.
The diagram shows the sequence of operations an agent must follow, starting with authority verification and ending with a standardized handoff.
Sources: Agent.md:41-44, ops/ai/CROSS-AGENT-OPERATING-RULES.md:19-27, PROMPTS/Codex-Rules.md:7-12
Issue-First Workflow Governance
Agents are strictly forbidden from creating "PR-first" work. Every code change must be derived from and linked to a primary source Issue. The repository uses automated scripts to enforce this "issue accounting."
Issue Reference Parsing
The system parses PR bodies and branch names to extract issue numbers using specific regex patterns:
- Semantic lines:
Issue: #123or `Related issue: https://github.com/.../issues/123%60 - Branch names:
issue-123or123-feature-name
Sources: scripts/ci/pr-issue-accounting-parser.js:52-57, scripts/ci/pr-issue-accounting-parser.js:115-123
Workflow Constraints
- One task per thread: Agents must not mix intents or expand scope.
- Drift Control: If out-of-scope work is identified, agents must recommend a new Issue rather than including it in the current PR.
- Persistence: Work must not end in a sandbox; it must be reflected in the final PR commits.
Sources: Agent.md:41-44, ops/ai/CROSS-AGENT-OPERATING-RULES.md:43-45, PROMPTS/Codex-Rules.md:21-23
Required Handoff Contract
Every agent completion or handoff must include a standardized block of information to facilitate human or automated review.
### Handoff Details
- **Source Issue:** [Link to Issue]
- **Changes:** [Brief summary of modifications]
- **Files Touched:** [List of paths]
- **Skill/Governance Path:** [Path to used SKILL.md]
- **Verification Performed:** [Commands run and results]
- **Risks/Limitations:** [Remaining items or guessed logic]
Sources: ops/ai/CROSS-AGENT-OPERATING-RULES.md:35-41, governance/ai/AGENT-GOVERNANCE.md:43-49
Operational Guardrails and Stop Conditions
Agents must immediately cease operations and request human intervention (Stop Conditions) under the following circumstances:
- Authority Conflict: Contradictions between design docs and task prompts.
- Ambiguity: Unclear requirements in the source Issue.
- Unverified State: The repository state does not match expected environment settings.
- Scope Expansion: Requests to modify unrelated files or introduce unapproved architecture.
Sources: Agent.md:61-66, governance/ai/AGENT-GOVERNANCE.md:32-41
Conclusion
The AI Agent Operating Rules establish a "fail-closed" environment where agents are constrained by governed skill sets and authority hierarchies. By enforcing strict Issue-to-PR mapping and standardized handoff contracts, the repository maintains high design compliance and operational repeatability across diverse AI platforms.