Please keep the code dead-simple and keep the src/loop/main.ts file under 150 lines of code.
- Format code:
bun run fix - Check lint/types/style:
bun run check - Run tests:
bun test - Build executable:
bun run build - Install global binary/aliases:
bun run install:global - Cut a patch release:
bun run release:patch
- Plain-text prompts auto-create
PLAN.mdfirst, then optionally run--review-plan; if you are changing planning behavior, keep that flow aligned. - Default CLI behavior is paired Claude/Codex execution with persisted run state under
~/.loop/runs; preserve--run-id/--sessionresume behavior when changing startup, planning, or loop flow. - Running
loopwith no args starts the paired interactive tmux workspace (--tmux);loop dashboardopens the live panel for active sessions, loop-owned paired runs, and tmux sessions. Keep panel-only changes separate from task-running changes when possible. --tmuxand--worktreeare first-class execution modes. In paired mode, tmux opens Claude/Codex side-by-side and resumed run ids should stay aligned with matching tmux/worktree names.--claude-onlyand--codex-onlyswitch out of the default paired flow; keep single-agent behavior working when changing shared CLI parsing or resume logic.loop update/loop upgradeare supported manual update commands for installed binaries; source runs should continue to rely ongit pull.- When options are provided without a prompt,
loopreusesPLAN.mdif it already exists; keep that fallback aligned with the plain-text prompt planning flow.
- Keep functions small and easy to read.
- Use explicit parameter/return types when they improve clarity.
- Prefer
unknownoveranyfor unknown values. - Use
constby default,letonly when reassignment is needed. - Prefer
for...of, optional chaining, nullish coalescing, and template literals. - Use early returns to reduce nesting.
- Use
async/awaitinstead of promise chains. - Throw
Errorobjects with clear messages. - Extract magic numbers/strings into named constants when reused.
console.log/console.errorare valid for user-facing CLI output.- Remove temporary debugging output before finalizing changes.
- Validate external input (CLI args, files, and subprocess output).
- Keep assertions inside
test()/it()blocks. - Prefer async/await over done callbacks.
- Do not commit
.onlyor.skip. - Prefer module-level mocks (for example
mock.module(...)) over adding DI-only test seams when possible. - Keep tests in the top-level
tests/directory (mirrorsrc/structure); do not co-locate*.test.tsinsidesrc/.
- Business logic correctness
- Edge cases and failure paths
- Clear naming and maintainable control flow