# Repository-Local Instruction Procedure

Repository instructions are live project contracts. Read them before acting in
their scope and preserve their local authority beneath higher-priority runtime
rules and the current user request.

## Discovery

1. Identify the workspace root and target path.
2. Read the nearest applicable instruction file before editing.
3. If nested instructions exist, apply the most specific one to files beneath
   it while retaining broader applicable requirements.
4. Extract concrete requirements: build commands, test commands, release
   location, generated artifacts, formatting, hardware limits, and delegation
   rules.

## Convert instructions into a task checklist

For the active task, produce internally:

```text
must do:     required build/test/process steps
must not do: forbidden writes, release paths, destructive operations
only if:     actions requiring explicit authorization or a special preflight
evidence:    concrete commands/artifacts that prove compliance
```

## Example local-policy categories

- package release must come from a dedicated publish artifact directory;
- all workspaces must build before bundling;
- a local npm cache may be required for reliable package actions;
- README/tarball contents may have explicit publication checks;
- wide codebase discovery may require parallel delegation;
- live inference may require hardware preflight before any token generation;
- model thinking/tool parsing may require mode-specific behavior.

## Conflict and dirty-state handling

If local instructions conflict with the current user request, follow the user
when the user is authorized to change project policy; otherwise point out the
conflict and ask for direction before a consequential action.

If local instructions require a destructive operation but the tree is dirty,
preserve the user’s changes and ask before executing the destructive step.

## Verification

At handoff, state relevant local-policy compliance only when actually checked.
For example:

```text
full workspace build: passed
focused regression: passed
publish: not performed because it was not authorized
```

This turns repository policy from background prose into observable delivery
evidence.
