wiki/decisions/2026-05-20-workdir-and-env-local.md
ADR: Scout Working Directory And .env.local
Date: 2026-05-20
Status
Accepted.
Context
Scout now runs as a CLI, HTTP app, and skill-backed tool. Runs produce multiple
artifacts: records, source evidence, blocked pages, validation, reports, and
future interim status/config files. Writing those artifacts to /tmp makes runs
hard to find, hard to audit, and hard to reuse for PRISM, job monitoring, and
research workflows.
Scout also needs a clear answer for local secrets and machine-specific settings
such as SCOUT_API_KEY, LLM_API_KEY, and default run storage.
Decision
Scout will use a two-level storage model:
output_diris the exact run artifact directory. If provided, Scout writes exactly there.workdiris the base working directory used to create timestamped run folders whenoutput_diris not provided.
Resolution order:
- Explicit
--output-diror JSONoutput_dir. - Explicit CLI
--workdir. SCOUT_WORKDIRfrom environment or.env.local.- Default
./scout-runs.
CLI high-level workflows and scout products prompt for the working directory
when run interactively without --output-dir. HTTP, Docker, scheduled jobs, and
skill-driven runs do not prompt; they must pass output_dir, pass --workdir
through the CLI, or rely on SCOUT_WORKDIR.
Local secrets and machine-specific defaults belong in .env.local, which is
ignored by git. Public docs and examples use .env.example.
Consequences
- Run outputs are discoverable and stable across CLI, HTTP, skill, and future scheduled automation.
- Interactive CLI use remains friendly without forcing users to remember a flag.
- Non-interactive modes remain deterministic and automation-safe.
- Secrets stay out of the public repo.
- Future deep research status, config, saved evidence, and replay inputs can live under the same workdir contract.
Verification
Initial RED/GREEN tests added:
- CLI derives
scout-work/company-adobe-*from--workdir. - HTTP derives an output directory from
SCOUT_WORKDIRwhenoutput_diris omitted. - settings load
.env.localafter.env, so local overrides win.