<!-- Generated by ma-agents. Edit outside the MA-AGENTS-START/END markers to preserve your changes. -->
# Project Agent Instructions

This file is auto-discovered by OpenCode and any agent that respects `AGENTS.md`.
It establishes universal safety rules, text-vs-file discipline, and BMAD phase
discipline for every agent operating in this project.

## Universal Rules

The universal rules block below is stamped and maintained by ma-agents. Edit
outside the HTML-comment `MA-AGENTS` start and end markers to preserve your
own additions — content inside the markers is regenerated on every install.

<!-- MA-AGENTS-START -->
# AI Agent Skills - Planning Instruction

You have access to a library of skills in your skills directory. Before starting any task:

1. Read the skill manifest at .opencode/skills/MANIFEST.yaml
2. Based on the task description, select which skills are relevant
3. Read only the selected skill files
4. Then proceed with the task

Always load skills marked with always_load: true.
Do not load skills that are not relevant to the current task.

## Respond in TEXT vs. create FILES

Choose your response medium deliberately. Defaulting to file creation when the user asked a question is a common failure mode — especially for coding agents running in web UIs.

- **Create or modify FILES when the user's request contains file-action keywords:** `create`, `write`, `generate`, `build`, `implement` (and obvious synonyms such as `add`, `produce`, `refactor`, `fix`, `update <file>`). These signal a concrete artifact is expected.
- **Respond in TEXT when the request contains text-response keywords:** `what do you think`, `how should we`, `discuss`, `opinion` (and obvious synonyms such as `explain`, `why`, `should I`, `compare`, `recommend`). These signal that a conversation is expected, not a deliverable.
- **If unsure, respond in TEXT.** A text answer can always be followed by file creation on confirmation; an unwanted file cannot be cleanly undone.
- **Never create `response.md`, `output.md`, or any similarly named scratch file as a reply.** A reply belongs in the chat transcript, not on disk.
- **Confirm file paths before writing.** When you are about to create or modify a file whose path the user has not explicitly named, state the intended path in text and wait for confirmation, unless the path is unambiguous from the task context.

## BMAD phase discipline

BMAD-METHOD organizes work into declared phases (analysis, planning, architecture, story-creation, implementation, review). Respect the currently declared phase.

- **Do not skip ahead to implementation during planning.** If the project is in a planning phase — or the user has asked for requirements, architecture, or a story — produce planning artifacts, not code.
- **Do not retroactively plan after you have already coded.** If implementation has already started, flag the gap instead of fabricating back-dated planning documents.
- The declared phase is established by the active skill, the story status, or an explicit statement from the user. When none of these is available, ask before assuming.
<!-- MA-AGENTS-END -->

## Critical Behavior Rules

These rules are non-negotiable across every profile and every agent.

- **Never create files in `~/.claude/` or any user home directory.** All
  project artifacts must land inside the current working directory. Home-
  directory writes cross-contaminate between projects and are a common source
  of secret/config leakage.
- **Never write outside the project root without an explicit user request
  naming the absolute path.** "Write to disk" means the project, not the
  operator's machine.
- **Do not modify files you did not read first.** Read the current content
  before proposing or performing an edit — blind writes silently destroy user
  work.

## BMAD Phase Declaration

BMAD-METHOD organizes work into four phases. Respect the currently declared
phase; do not skip ahead to the next phase without a phase transition signal
from the user, the active skill, or the story status.

- **Discovery / PM (analysis, planning).** Deliverables: product briefs,
  PRDs, market and domain research, epics and stories lists. Do NOT produce
  code, architecture diagrams, or implementation artifacts in this phase.
  When asked "what do you think", respond in text.
- **Architecture.** Deliverables: solution design, component boundaries,
  data-flow, interface contracts. Do NOT write application code or skill
  implementations. Narrate decisions and capture them as documents.
- **Tech Lead / Stories.** Deliverables: individual story files with full
  acceptance criteria, task breakdowns, and dev notes. Do NOT begin
  implementation — stories are contracts the implementer consumes later.
- **Implementation.** Deliverables: code, tests, and the Dev Agent Record on
  the story file. At this phase, write files. Do NOT retroactively fabricate
  planning documents for code that already exists — flag the gap instead.

When no phase is declared (no active skill, no story in progress, no explicit
user statement), ask before assuming.

## Project BMAD Output Structure

BMAD artifacts live under `_bmad-output/` (or the paths configured in
`_bmad/bmm/config.yaml` when present). The install-time resolver logs the
resolved paths on each run; consult that log output if in doubt.

- **Planning artifacts** — PRDs, product briefs, market and domain research.
- **Architecture artifacts** — solution design, component boundaries. May be
  co-located with planning artifacts when no separate directory is configured.
- **Implementation artifacts (stories)** — individual story files and their
  Dev Agent Records.

Always consult the `MANIFEST.yaml` referenced inside the universal block above
for the full list of installed skills and their locations.
