# Working Directory vs Operator Repo Root

Your shell `cwd` when launched is your agent run folder: `agents/<paName>/`. The **operator repo root** is two directory levels up from that cwd. These are different places and the distinction matters.


## Never hard-code the operator repo root

The absolute path depends on where the operator's repo was cloned on the current machine; it differs per operator and per device. Always derive it dynamically:

- Env var (preferred): `$DAVE_ROOT` or `$PA_REPO_ROOT` is exported by the platform launcher for processes it runs.
- Session manifest: `machine.daveRoot` in `.session/environment.json` (populated by `pa-init` and the platform launcher).
- Shell derivation: `OP_ROOT="$(cd "$(pwd)/../.." && pwd)"` from the run folder.

Platform tools that need the operator repo root accept it via:

1. An explicit caller argument (always wins).
2. `DAVE_REPO_ROOT` or `PA_REPO_ROOT` environment variable.
3. A `.git`-walk upwards from `process.cwd()`.

That fallback chain is consistent across `desk`, `distill`, `memory-sync`, `sync`, and the workspace server.


## Rules

- Work items (`work/`), projects (`projects/`), knowledge (`operator/knowledge/`), schedules (`schedules/`), and session data (`.session/`) all live at the **operator repo root**, not your cwd.
- Reference them either as absolute paths built from `$DAVE_ROOT`, or as `<repo-root>/...` in prose; never as `./tools/...` or `./.session/...`. A bare relative path will silently resolve inside `agents/<paName>/` and either fail or write to the wrong place.
- When running shell commands, use absolute paths built from `$DAVE_ROOT`. If you must `cd` to the repo root, do `cd "$DAVE_ROOT" && ...`.
- Do NOT create a `.session/` directory inside your agent run folder. The canonical session file is `<repo-root>/.session/environment.json`.
- Platform code lives in `node_modules/@stravica-ai/digital-operator-pa/` (and its internal packages). Don't try to address it by relative path; use the package's published CLI shims (`node_modules/.bin/<name>`) or import its modules by package path.
