dev-machine-guard AGENTS.md

A set of coding rules for the Dev Machine Guard codebase, covering where code belongs and how it should interact with operating-system features.

In plain words
What is it for?
Use it before adding detectors, data fields, command-line options, schedulers, or platform-specific code.
Why use it?
It helps developers and coding agents follow the repository’s existing patterns instead of introducing inconsistent implementations.

Instructions file for CodexOpenCode

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add instructions/step-security/dev-machine-guard/agents-md
Clone the repo
git clone --depth 1 https://github.com/step-security/dev-machine-guard

Made for: Codex, OpenCode.

Per session 11,328 This file is loaded in full into every session.
When invoked 11,328 The same file — it is already loaded in full.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.11328 $0.11328
Opus 5 $0.05664 $0.05664
Sonnet 5 $0.02266 $0.02266
Haiku 4.5 $0.01133 $0.01133

Measured yesterday against content hash b279d5b29230, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

dev-machine-guard AGENTS.md scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured yesterday.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

AGENTS.md · 770 lines

How it starts

The opening of the file, as written. The whole thing — 770 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Dev Machine Guard — Coding Guidelines

These guidelines describe how this codebase is already written, distilled into rules so future work stays consistent. They are descriptive, not aspirational: every rule below is the dominant existing pattern, with a canonical file you can copy from.

Audience: humans and AI agents making changes in this repo.

How to use this doc. Before adding a detector, a model field, a CLI flag, a scheduler tweak, or any platform-specific code, find the matching section and follow the pattern. When in doubt, open the cited "canonical" file and mirror it. Prefer consistency with the surrounding code over personal preference.

Scope. This documents current conventions. It does not propose refactors. Genuinely additive improvement ideas surfaced during analysis are quarantined in §17 and are explicitly not things to apply as part of adopting this doc.

See also: CONTRIBUTING.md · adding-detections.md · SCAN_COVERAGE.md


0. Prime directives

The ten rules that matter most. The rest of the doc expands on these.

  1. All OS interaction goes through executor.Executor. Never call os/exec, and avoid raw os.* file/env access, in detector/scheduler/business logic. This is the seam that makes everything mockable and timeout-bounded. (§2.1, §7.1)
  2. A scan never aborts because one part failed. Inventory detectors return values, not errors, and skip on failure. Only the top-level orchestrator returns an error. (§6.1)
  3. Detection is data-driven. Add an entry to a spec table; don't add control flow. (§3.1)
  4. Cross-platform code splits by build tag, not by sprinkling runtime.GOOSwhen the code wouldn't compile on the other OS. Otherwise branch at runtime on model.Platform* constants. (§2)
  5. Every external command has an explicit timeout via RunWithTimeout/RunInDir. Build commands from fixed argv; never interpolate untrusted input into a shell string. (§7)
  6. Raw secret values never get serialized. Tag them json:"-"; emit a pre-redacted Display value plus a SHA256 fingerprint, and redact in the detector. (§10)
  7. model is the single source of truth for every wire/output shape. Explicit snake_case JSON tags; optional object → *T,omitempty; collection → bare slice (always []). (§9)
  8. Logs go to stderr via progress.Logger; results go to stdout. Pick the level by audience: Warn for "something expected was skipped", Debug for diagnostics. (§6.5)
  9. Concurrency is the exception. Default to sequential code. When you must parallelize, bound it (min(NumCPU, 8)) with stdlib sync only. (§8)
  10. It must pass the gates: gofmt, go vet, go mod tidy (no drift), golangci-lint, go test -race, make smoke, and gosec — on a CGO_ENABLED=0 cross-compile to linux/darwin/windows. (§16)

Read the full file on GitHub · 770 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. yesterday First seen · 770 lines · 11,328 tokens per session scan A b279d5b29230

Subscribe to this mod's changes

dev-machine-guard AGENTS.md is an instructions file published in the GitHub repository step-security/dev-machine-guard (175 stars, last pushed 7d ago), licensed Apache-2.0. It adds 11,328 tokens to every session, about $0.0566 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.