apiVersion: devrunbook.io/v1alpha1 kind: Playbook metadata: id: repository-understanding.agents-instructions slug: agents-instructions version: 1.0.0 title: Generate Repository AGENTS.md Guidance summary: Create reviewed persistent Codex instructions from real repository commands, protected paths and engineering policies. category: repository-understanding tags: - codex - agents.md - governance lifecycle: reviewed riskTier: moderate authors: - name: DevRunbook Core Team license: MIT package: files: - path: prompt.md role: template digest: true exportByDefault: false - path: README.md role: documentation digest: true exportByDefault: false - path: CHANGELOG.md role: changelog digest: true exportByDefault: false - path: examples/minimal.yaml role: example digest: true exportByDefault: false - path: evaluations/static-structure.yaml role: evaluation digest: true exportByDefault: false spec: type: guided intent: problem: Development work around generate repository agents.md guidance is often underspecified, inconsistently executed or reported without enough evidence. outcome: Create reviewed persistent Codex instructions from real repository commands, protected paths and engineering policies. whenToUse: - Use this playbook when the repository needs a bounded generate repository agents.md guidance task with explicit evidence and completion criteria. - Use it when Codex should follow a repeatable workflow rather than improvise from a one-line request. whenNotToUse: - Do not use it when the desired outcome or authority boundaries are still materially undecided. - Do not use it to access unavailable production credentials, bypass safeguards or claim validation that cannot be performed. modes: - plan defaultMode: plan autonomy: min: diagnose max: plan default: plan inputs: - key: instructionScope label: Instruction scope description: Choose where durable Codex instructions should apply. type: enum required: true sensitive: false includeInOutput: true default: layered options: - global - repository - directory-specific - layered - key: directoryOverrides label: Directory overrides description: List directories that need stricter or different instructions and explain why. type: key-value-list required: false sensitive: false includeInOutput: true default: [] compatibility: repositoryRequired: true languages: [] frameworks: [] packageManagers: [] databases: [] deploymentTypes: [] requiredProfileCapabilities: [] incompatibleConditions: [] guardrails: - id: guardrail-1 severity: blocking text: Keep durable repository rules separate from the current one-time task. - id: guardrail-2 severity: blocking text: Never place secrets, private tokens or machine-specific absolute paths in AGENTS.md. - id: guardrail-3 severity: blocking text: Do not claim a command is mandatory unless repository evidence or an explicit policy supports it. workflow: - id: inventory-existing title: Inventory existing instructions instruction: Read all applicable AGENTS.md and override files and determine their effective hierarchy. required: true - id: collect-rules title: Collect durable rules instruction: Extract verified commands, protected paths, architecture boundaries, testing expectations and Git policies. required: true - id: separate-scopes title: Separate scopes instruction: Assign global, repository and directory-specific rules to the narrowest correct location. required: true - id: draft-files title: Draft instruction files instruction: Produce complete suggested files without overwriting existing instructions. required: true - id: check-conflicts title: Check conflicts instruction: Identify contradictory rules, duplicate guidance and unsafe instructions before finalizing. required: true - id: handoff-review title: Prepare review notes instruction: Explain every material rule, its evidence and where human confirmation is still required. required: true validation: commandRoles: [] checks: - id: check-1 type: assertion description: Suggested instructions contain only durable, evidenced rules. blocking: true evidence: Referenced files, command results or explicit review notes. - id: check-2 type: assertion description: The hierarchy and all conflicts or overrides are explicit. blocking: true evidence: Referenced files, command results or explicit review notes. completion: criteria: - Durable rules are separated from one-time task instructions. - Suggested hierarchy and review notes are included. - Validation evidence and unresolved limitations are reported honestly. failurePolicy: onValidationFailure: Investigate failures caused by the current work, repair them when they remain within scope, rerun affected validation and report any genuine blocker without claiming success. onAmbiguity: Use repository evidence and existing conventions for minor reversible choices. Preserve current behavior and stop before any material irreversible decision that the specification does not resolve. onMissingContext: Inspect the repository for missing non-sensitive context. Never invent commands, credentials, production behavior or validation results; report what remains unavailable. onOutOfScopeCause: Explain the evidenced out-of-scope cause, avoid unrelated changes and provide the smallest safe follow-up recommendation. onExternalDependencyUnavailable: Use an approved local substitute or fixture only when it preserves the behavior under test. Otherwise record the blocked validation and do not claim the external path succeeded. onUnableToReproduce: Record attempted reproduction, environment and observed evidence. Do not apply speculative production changes; provide the narrowest next diagnostic action. reporting: sections: - id: outcome title: Outcome required: true description: State the delivered result or audit conclusion without overstating evidence. - id: evidence title: Evidence and scope required: true description: List inspected or changed areas and the evidence supporting the result. - id: validation title: Validation required: true description: Report commands, manual checks and their actual outcomes. - id: risks title: Risks and limitations required: true description: State residual risk, inaccessible evidence and untested conditions. - id: follow-up title: Recommended follow-up required: true description: List the smallest useful next actions or state None. template: main: prompt.md partials: [] exports: prompt: true markdown: true runPack: false agentsSuggestion: true quality: reviewStatus: editorial-reviewed testedStacks: [] knownLimitations: - Repository-specific effectiveness depends on the accuracy of the selected profile and the evidence available to Codex. evaluationCaseIds: - agents-instructions.static-structure