These are general instructions for agentic AI usage shared across many systems
- The system has access to
nix, but only uses nix flakes, not channels. - If you attempt to run a shell command but it isnt available, try finding the nix package and using a
nix shellto run it instead.
ALWAYS save command output to a file first, then process the file separately. Never try to save and process in one pipeline — chaining tee with jq, wc, or other consumers causes silent data loss due to buffering/consumption issues.
Bad:
command | tee file.json | jq '...' | wc -c # silently loses output
command | tee file.json | jq '...' # same problemGood:
command > file.json
jq '...' file.jsonThis also avoids losing output from bad grep or tail/head commands — you can always requery the saved file without re-running the original command.
If there is a devenv.nix file in the project root, the project uses devenv and has access to nix. If a tool is not available, check if its provided via the devenv packages or reference it using a nix shell.
When running commands in a devenv project, you usually will want to do so through devenv shell to ensure project dependencies are setup properly.
Never suggest or use homebrew unless nix/devenv are unable to be used for a specific reason.
ALWAYS provide context explicitly (eg --context {context-name}) rather than changing contexts (eg kubectl config use-context {context-name})
NEVER modify kubeconfig, instead alert the user if needed and have them make the updates manually
ALWAYS put context at the end of a command (eg kubectl get pods --context {context-name} rather than than kubectl --context {context-name} get pods)
NEVER run git push unless explicitly told to
If you find yourself referencing files on a repo hosted in e.g. github, consider cloning the repo locally and searching on the filesystem instead.
--no-stat is not a valid git param. Dont use it.
ALWAYS use absolute paths when using cd or referencing files in bash commands. The working directory shown in the environment context is informational only - each bash command starts fresh.
Bad:
cd .agent-workdir && ls # This will fail - relative path doesn't existGood:
cd /Users/jimmy/Developer/full/path/to/directory/.agent-workdir && ls
ls /Users/jimmy/Developer/full/path/to/directory/.agent-workdir/*.jsonWhen the environment shows Working directory: /path/to/dir, use that full path in commands instead of assuming you're already there.
The system uses GNU date, not BSD date. Use GNU flags, eg date -d instead of date -j.
Never calculate day-of-week names yourself. When output includes dates with day-of-week labels (e.g., "Jun 08 (Mon)"), always compute them with date -d or equivalent shell command, and use that output verbatim.
If a less-often used tool would suit the purpose better than standard shell utilities, be judicious about leveraging it via nix shell. When running bash commands, prefer modern alternatives to traditional Unix tools:
e.g.
- Use
rg(ripgrep) instead ofgrep - Use
fdinstead offind - Use
batinstead ofcat(when syntax highlighting is helpful)
Note: The specialized Grep, Glob, and Read tools should be used instead of bash commands when possible - they're optimized and have better permissions.
There are some special directories for agent workflow management:
User-facing artifacts and deliverables. Contains plans, documentation, reports, and any outputs intended for human review.
Scratch directory for agent use. Contains temporary files, intermediate outputs, exploratory work, and any artifacts used during task execution.
Use .agent-workdir/ instead of /tmp or other system temp directories. This keeps all temporary work within the project context, making it easier to review, debug, and clean up.
Subagents (e.g., Explore) may incorrectly report that they cannot perform certain actions (like writing files) when they actually can. This appears to be the agent being overly cautious about its own capabilities.
When spawning subagents that need to write files: Include in the prompt that the subagent should verify any write/edit operation actually failed (by checking if the file exists with expected content) before reporting that it couldn't perform the operation.
When a subagent reports a write/edit operation failed: Always verify by checking if the file exists and has the expected content before reporting failure to the user. Do not trust the subagent's self-assessment of its capabilities.
Do not add useless comments, especially comments that refer to code that got removed in a previous change
However, do not remove existing comments that violate this rule unless explicitly requested by the user.
When generating a plan, use a meaningful name. eg if creating a plan for setting up windows AD, instead of 'witty-dreaming-barto.md' name it 'setting-up-windows-AD.md'. Make sure the name isnt already in use so you dont overwrite an unrelated plan.
When working on implementation for plan that was previously saved to a file, use these execution rules:
- Pick the next unfinished step. Read the plan to figure out what the next step should be. Find the first step not marked COMPLETE. If a step is IN PROGRESS, verify its actual state (e.g. query the cluster) before deciding whether to continue it or mark it complete.
- Keep the plan file updated. Mark a step IN PROGRESS only when you have actually started executing it — not speculatively. Mark COMPLETE only when verified done.
- One step at a time. Complete a single step per invocation. Do not move on to the next step after finishing — stop and report the result.
- Update docs when things change. If you encounter issues, discover inaccurate information, or find that commands/procedures are out of date, update any relevant reference files that might exist as part of the process. Keeping docs accurate for the next steps is part of completing the current one. Making changes to the docs is not required, only considering if they should be updated.
- Notify on long-running operations. When polling for an operation that takes more than ~1 minute, run the poll loop in the background and send a macOS notification via osascript when it completes. Example: osascript -e 'display notification "Control plane upgrade complete" with title "EKS Upgrade" sound name "Glass"'. Use sound "Glass" for success and "Basso" for failure.
Whenever you decide that this section applies, output the literal text "*** EXECUTING PLAN ***" to let the user know you understand the above instructions.
For instructions for agentic AI usage for this specific system, see @CLAUDE.local.md