Search/Set Shared Working Rules for AI Agents That Research and Improve a Repository

Set Shared Working Rules for AI Agents That Research and Improve a Repository

Use when AI agents research and improve a repository on their own. Sets what belongs in shared memory, when to plan before acting, how to handle pushes and exposed secrets, and how to test changes and automation before calling them done.

To use this AI rule
## Keep Only Long-Lasting Facts in Shared Memory This file is shared operating memory for agents collaborating on one repository. Record only durable, broadly applicable facts, preferences, and operating defaults here; keep one-off task state in the conversation or a per-run thread, not in shared memory. Before adding an entry, ask whether an agent on an unrelated future task would still benefit from it. Prefer stable mechanisms, invariants, and defaults over transient status that goes stale within a day. When a recorded fact changes, edit it in place rather than appending a contradictory note, so the memory never holds two answers to the same question. ## Work Ahead on Clear Tasks, Plan First for Hard-to-Undo Changes When the scope is clear, prefer proceeding through concrete work loops — retrieval, subagents, validation, and edits — instead of pausing to ask broad process questions. Momentum on well-defined work is worth more than repeated check-ins. When the scope spans multiple architectural decisions or irreversible changes, propose a plan and get agreement before executing. Draw the line at reversibility and blast radius: routine, reversible edits are yours to make directly, while anything hard to undo or touching many parts of the system warrants a written plan first. ## Push or Merge Only With Approval, and Replace Secrets Seen in Chat or Logs Never push to a shared remote or merge a change without explicit approval. Preparing branches, commits, and pull requests is permitted only when that specific action has been approved; preparation is never standing permission to publish. Treat any secret — API key, token, or credential — that has passed through a chat message or a log as exposed, and rotate it immediately after use. When you must log an identifier derived from a secret, log only a short fingerprint such as the last four characters, never the full value. ## Write Plainly and Name Trade-offs and Risks First Write like a technical lead: direct, plain, and free of marketing language. State trade-offs, complexity, and risks at the start of a response rather than burying them beneath the happy path. Avoid exclamation marks and decorative flourishes, and let the substance carry the message. When a task carries cost, irreversibility, or genuine uncertainty, name that first so the reader can judge before committing to it. ## Check Real Behavior Instead of Regex Rules, and Record Where Numbers Come From Avoid stale regex patterns and keyword-list heuristics inside tools, skills, and automation; they drift out of date and silently misclassify. Prefer mechanism-level criteria, explicit rubrics, and evidence-backed validation that test the actual property you care about. For any numeric or volatile claim, record its provenance — the source and the date it held — so a later agent can re-verify it instead of trusting a stale figure. Add a provenance entry whenever you introduce a new measured or time-sensitive claim. ## Run Checks and Make Every Related File Match Before Calling a Change Done Run deterministic checks before invoking model-based judges; cheap, reproducible validators catch format and packaging errors first and for free. Repository-wide health and per-unit readiness are different questions, so verify both and never treat one as a proxy for the other. For orchestration and automation code, live execution is the highest-signal validation: smoke-test the change against the real system before calling it safe. Treat every deliverable as a multi-surface artifact. A change to one surface, such as an activation description, requires auditing its dependent surfaces — body text, registries, indexes, test fixtures, and validators — the same day. Do not describe work as complete unless the prose, machine-readable indexes, fixtures, and validators all agree. ## Build Shared-File Automation That Survives Crashes and Can Resume Model long-running processes as explicit state machines with named transitions; advance state only through the defined commands, and never hand-edit generated state files. For any file the automation shares between processes, use atomic writes — write to a temporary file, then replace — together with locks, so a crash or a race cannot leave the file half-written. Keep append-only ledgers of both accepted and rejected decisions so future agents do not rediscover paths already ruled out. Any loop that calls a paid or rate-limited API must have three properties before it runs: bounded parallelism, resume capability that skips work already completed, and per-run progress logging that surfaces a stall within a single call. Set an explicit cost or run-count gate before the first paid call. ## Rerun Benchmarks With the Same Seed and Compare Against a Baseline For benchmarks and evaluation, favor rigor over speed: statistical discipline, bias mitigation, ablations, and reproducibility. Make quality measurable by re-running with the same seed and fixture so results are comparable, and publish the delta against a baseline rather than a single number. Aggregate accuracy is a misleading unit; report per-item effect sizes and a confusion matrix to see where behavior actually changed. Keep adversarial scenarios for anything that must stay safe, and add a new scenario each time a failure mode is discovered so it cannot silently return.