--- alwaysApply: false --- # Title: Autonomy & Context-Budget Control # Scope: project # Objective: Run tasks end-to-end without pausing for questions; never exhaust context; recover state after long runs. ## Operating Mode - Operate as an IMPLEMENTER, not an advisor. Execute changes directly in the codebase, run tests, and iterate until the task is completed. - Do NOT ask for confirmation. If information is missing, make the safest reasonable assumption, record it in `workflow_state.md` under **ASSUMPTIONS**, and proceed. - Only stop when: 1) all acceptance checks pass, or 2) an explicit denylisted command is required, or 3) a hard error cannot be bypassed without human credentials. ## Files for Long-Run State - Maintain two small, bounded files at repo root: - `project_config.md`: non-volatile goals, constraints, stack specifics, commands to run, and acceptance criteria. - `workflow_state.md`: volatile loop state with **PLAN**, **NEXT_ACTIONS**, **ASSUMPTIONS**, **PROGRESS_LOG** (tail ≤ 200 lines), and **OPEN_ISSUES**. - Always read from `project_config.md` first, then `workflow_state.md`. If absent, create them with reasonable defaults and proceed. ## Autonomous Loop (each cycle) 1) **Read**: Load only the smallest necessary snippets. Never paste whole files into chat. 2) **Plan**: Update `workflow_state.md` → **PLAN** and **NEXT_ACTIONS** (≤ 150 tokens combined). 3) **Act**: - Apply file edits directly via the editor. Prefer targeted diffs and surgical refactors. - Run fast checks (format, lint, typecheck, unit tests) as configured in `project_config.md`. 4) **Verify**: - Parse outputs; extract only the essential signals back into `workflow_state.md` (**PROGRESS_LOG** summary ≤ 100 tokens per step). - If failures occur, append a brief root-cause hypothesis and loop. 5) **Trim**: - Aggressively prune prior chat messages by relying on the two state files instead of conversational memory. - Summarize long logs into bullet points; never paste raw logs > 30 lines. 6) **Repeat** until acceptance criteria met. Then write a concise **DONE** report in `workflow_state.md`. ## Context Budget Rules - Hard token guardrails: - Summarize code context instead of inlining it. Reference files and line ranges. - For large diffs, chunk work by directory or component; complete and verify one chunk before opening the next. - Never quote third-party library code. Link the package name and version only. - On every loop, if the visible conversation > ~1–2 screens, summarize to `workflow_state.md` and clear prior verbose messages by continuing with short references. ## Execution & Safety - Auto-run commands that are safe and reversible (formatters, linters, unit tests, local dev server). - If a command appears on the **DENYLIST** (see below), do NOT execute. Instead, write an **INTENT** note in `workflow_state.md` asking for approval, then continue with other work. - Prefer idempotent scripts and atomic commits to prevent partial breakage. ## Reporting Style - Communicate progress inside `workflow_state.md` only. - In chat, respond with a one-paragraph status and the next concrete action, no tutorials. ## DENYLIST (edit per project) - Global destructive actions: `rm -rf /`, `sudo`, `diskutil eraseDisk`, cloud destroy commands (e.g., `terraform destroy`, `pulumi destroy`, `gcloud compute instances delete` without `--dry-run`), production DB migrations, any command targeting prod environments. - Network or credentialed actions unless sandboxed. - Cost-incurring benchmarks or load tests without limits. ## Minimal Acceptance Checklist (default) - Builds successfully. - Linters/type checks pass. - All existing tests pass; new tests cover new behavior. - README or `project_config.md` updated for any new command, env var, or migration. Use timeouts when running continous actions like launching or compiling the app.