# WatchMode

**Kind:** Class

**Source:** [`atloria-monorepo/libs/agent-core/src/tools/watch-mode.ts`](https://github.com/sherkety/atloria/blob/main/atloria-monorepo/libs/agent-core/src/tools/watch-mode.ts#L28)

## Methods

| Method | Signature | Returns |
|---|---|---|
| `start` | `start()` | `MarkerResult[]` |
| `stop` | `stop()` | `void` |
| `scanFile` | `scanFile(filePath: string)` | `MarkerResult[]` |
| `scanDirectory` | `scanDirectory(dirPath: string)` | `MarkerResult[]` |

## Where it refuses work

- `WatchMode` stops the work with an early return when `!filename`.
- `WatchMode` stops the work with an early return when `parts.some((p) => this.excludeDirs.includes(p))`.
- `WatchMode` stops the work with an early return when `!this.matchesIncludePatterns(filename)`.
- `WatchMode` stops the work with an early return when `!ext`.

## When something fails

- `WatchMode` handles failure in 3 places: it turns it into a return value in 2, and discards it silently in 1. A failure discarded silently leaves no trace for whoever debugs this later.
