Dyota's blog

Agent instructions file - PBIP Navigation

This is a top-level instruction a la CLAUDE.md or copilot-instructions.md.

This allows the AI to quickly orient to the type of Power BI project folders that I work with.

# Agent Navigation Guide — Power BI Project (PBIP)

**Detection:** You are inside a PBIP workspace if the root contains all three of:
- a `*.pbip` file
- a `[ProjectName].Report/` folder
- a `[ProjectName].SemanticModel/` folder

**If detected:** Declare that you're in a PBIP folder. Read the following section. It contains navigation rules, file structure, and project-specific context that governs how to work in this workspace.

**If not detected:** Ignore this section entirely.

## Priority Rule
**Always check `[ProjectName].CodeFiles/` first.** If it exists, prefer it over the native PBIP files — it is one file per artefact and far less text. Fall back to the native PBIP structure only when a specific artefact is absent from CodeFiles.

---

## CodeFiles Structure
[ProjectName].CodeFiles/
├── pages.json            ← page visibility config
├── relationships.dbml    ← all model relationships (DBML format)
├── rls.txt               ← row-level security role definitions
├── dax/
│   ├── [TableName]/
│   │   └── Measures/
│   │       └── [MeasureName].dax   ← one measure per file
│   └── Calculated Tables/
│       └── [TableName].dax         ← calculated table DAX expression
└── pq/
    ├── [QueryName].pq              ← standalone queries / shared tables
    ├── [GroupName]/
        └── [QueryName].pq          ← source-grouped queries
### `dax/`
One `.dax` file per measure or calculated table. Directory hierarchy mirrors the semantic model table structure: `dax/[TableName]/Measures/[MeasureName].dax`. Calculated table expressions live directly in `dax/Calculated Tables/[TableName].dax`.

### `pq/`
One `.pq` file per Power Query query.

### `report/`
JSON definitions of every visual, one subdirectory per report page. **Ignore unless explicitly asked about report visuals.**

---

## Standalone Files

| File | Format | Purpose |
|------|--------|---------|
| `pages.json` | JSON array | All report pages with `{"page": "...", "show": true\|false}`. `show: false` = hidden (tooltips, admin, dev pages). |
| `relationships.dbml` | DBML | Full model relationship graph. Tables list only key columns used in joins. |
| `rls.txt` | plaintext | Role definitions with DAX filter expressions per table. |

---

## Native PBIP Fallback Structure

Only read these if the artefact is absent from CodeFiles.

[ProjectName].SemanticModel/definition/
├── model.tmdl          ← model-level settings
├── database.tmdl       ← database metadata
├── expressions.tmdl    ← shared M expressions / parameters
├── relationships.tmdl  ← relationships (verbose TMDL)
├── tables/[TableName].tmdl   ← columns, measures, partitions per table
├── roles/[RoleName].tmdl     ← RLS roles
└── cultures/           ← locale/translation files (usually ignorable)

[ProjectName].Report/definition/
├── report.json         ← report-level config
└── pages/[PageName]/   ← page and visual definitions (verbose JSON)