Use this document as the durable source of truth for source formatting, naming, documentation style, and commenting standards in Monitor.
These rules apply to runtime scripts, tests, helper scripts, and code-bearing configuration files that support comments. Markdown documents use their headings and opening prose as their file-level explanation.
Monitor is currently a Bash-first prototype. If the project later adopts another runtime, update this file, README.md, and AGENTS.md in the same change.
- Keep runtime code in
src/and mirror tests intests/. - Prefer Bash for the first CLI. Use Python only for focused standard-library helpers when Bash would make JSON, path, or text processing fragile.
- Use 2 spaces for Markdown, YAML, JSON, TOML, and similar structured files. Use the dominant ecosystem style for future languages.
- Use
snake_casefor Bash function names and variables. - Use uppercase names only for exported environment variables such as
MONITOR_INTERVAL_SECONDS. - Use
kebab-casefor ordinary Markdown filenames outside root control documents. - Name ExecPlans under
plans/with the orderedNN-kebab-case-name.mdpattern described inPLANS.md. - Keep root control documents in uppercase names such as
README.md,PRODUCT.md, andARCHITECTURE.md.
Shell scripts must start with:
#!/usr/bin/env bashUse strict mode for runtime and test scripts unless a specific command requires narrower handling:
set -euo pipefailQuote variable expansions unless intentional word splitting is required. Prefer arrays for command arguments. Avoid eval.
Validate required external commands before doing work. For Monitor v1 that means checking bash, date, mkdir, mktemp, sleep, powershell.exe, wslpath, codex, and scripts/win-screenshot as applicable.
Handle paths with spaces. Use mkdir -p before writing nested output paths.
Do not print secrets. Monitor v1 should not need OpenAI API keys, but the same rule applies to any future token-like setting.
Comments should help a technically competent reader understand purpose, assumptions, side effects, and failure behavior. Avoid comments that restate syntax.
Every source file that supports comments must start with a header comment explaining:
- what the file does
- the main functions or entry points it owns
- how it fits into Monitor
- important external commands, filesystem writes, or privacy assumptions
Every non-trivial Bash function must have a short comment immediately above it. The comment should explain what the function expects, what it writes or returns, and which failures callers should expect.
Inside multi-step functions, add short comments before meaningful phases such as loading config, validating commands, capturing screenshots, invoking Codex, writing summaries, or handling failures.
Keep documentation in the file that owns the relevant truth:
PRODUCT.mddescribes current capabilities, workflows, constraints, and user-visible limits.ROADMAP.mddescribes durable future direction and non-priorities.DESIGN.mddescribes terminal UX and future interface language.ARCHITECTURE.mddescribes structure, ownership, boundaries, and invariants.README.mddescribes setup, commands, dependencies, and contributor onboarding.PLANS.mddescribes how ExecPlans must be written and maintained.AGENTS.mddescribes repository-specific instructions for coding agents.
Do not leave generic template placeholders in root control documents. If a decision is deferred, name the specific open question.
Run:
bash -n scripts/win-screenshot src/monitor.sh tests/monitor_cli_test.sh
tests/monitor_cli_test.sh
rg --files --hidden -g '!.git/**'
git diff --check
git status --short