Conversation
Add Copilot-optimized configuration files to improve AI-assisted development: - AGENTS.md: Refined from the existing agents.md with concise, actionable instructions covering verification commands, crate dependency rules, error handling regimes, and guardrails (disallowed methods) - scripts/verify + verify.ps1: One-command health check (fmt + clippy + test) - scripts/setup + setup.ps1: One-time environment bootstrap (rustfmt + clippy) - copilot-setup-steps.yml: Enables the Copilot coding agent to bootstrap its cloud environment when working on issues autonomously - .github/instructions/: Path-scoped rules for unsafe Rust code and CI workflow modifications - .github/skills/: Starter skills for crate scaffolding and CI triage - .github/agents/: Unsafe code review specialist (read-only) - .github/prompts/: Test generation prompt following DiskANN conventions - .github/hooks/: Security hook blocking destructive commands Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
Note
Copilot was unable to run its full agentic suite in this review.
Bootstraps GitHub Copilot/agent configuration for DiskANN by adding repo-specific onboarding guidance, guardrails, and helper scripts/workflows to standardize setup and verification.
Changes:
- Added cross-platform
scripts/setupandscripts/verifyhelpers for rustfmt/clippy/test. - Added an agent pre-tool security hook plus command blocklists (bash + PowerShell).
- Introduced Copilot-facing docs/config:
AGENTS.md, instructions, skills, prompts, a setup workflow, and a specialized unsafe reviewer agent.
Reviewed changes
Copilot reviewed 16 out of 16 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| scripts/verify.ps1 | PowerShell verification script (fmt/clippy/test). |
| scripts/verify | Bash verification script (fmt/clippy/test). |
| scripts/setup.ps1 | PowerShell toolchain bootstrap (rustfmt/clippy). |
| scripts/setup | Bash toolchain bootstrap (rustfmt/clippy). |
| scripts/security-check.sh | Bash command blocklist for destructive operations. |
| scripts/security-check.ps1 | PowerShell command blocklist for destructive operations. |
| agents.md | Removed old, long-form agent onboarding document. |
| AGENTS.md | Added concise agent guidance + guardrails + repo conventions. |
| .github/workflows/copilot-setup-steps.yml | Adds workflow to run setup steps for Copilot/agents. |
| .github/skills/new-crate/SKILL.md | Skill doc for scaffolding new workspace crates. |
| .github/skills/ci-failure-triage/SKILL.md | Skill doc for diagnosing CI failures. |
| .github/prompts/generate-tests.prompt.md | Prompt for generating tests aligned with repo conventions. |
| .github/instructions/unsafe-code.instructions.md | Path-scoped rules for unsafe Rust conventions. |
| .github/instructions/ci-workflows.instructions.md | Path-scoped rules for CI workflow edits. |
| .github/hooks/security.json | Registers pre-tool-use security hook for command execution. |
| .github/agents/unsafe-reviewer.agent.md | Read-only agent spec for unsafe Rust review. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| foreach ($pattern in $blockedPatterns) { | ||
| if ($input -match [regex]::Escape($pattern)) { | ||
| Write-Error "Blocked: destructive pattern detected" | ||
| exit 1 | ||
| } | ||
| } |
| # Block destructive commands — customize this blocklist for your repo | ||
| BLOCKED_PATTERNS=("rm -rf /" "DROP DATABASE" "format C:" "mkfs") | ||
| for pattern in "${BLOCKED_PATTERNS[@]}"; do | ||
| if echo "$*" | grep -qi "$pattern"; then |
| @@ -0,0 +1,104 @@ | |||
| # AGENTS.md | |||
| ## Best Practices for Writing an Effective AGENTS.md | ||
|
|
||
| - Keep AGENTS.md concise — ideally within 30–80 lines. | ||
| - Do not include structural details such as directory listings or README‑style content, as research shows these can degrade agent performance. No newline at end of file |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #1028 +/- ##
==========================================
+ Coverage 89.51% 90.63% +1.12%
==========================================
Files 460 460
Lines 85466 85466
==========================================
+ Hits 76508 77466 +958
+ Misses 8958 8000 -958
Flags with carried forward coverage won't be shown. Click here to find out more. 🚀 New features to boost your workflow:
|
| - Testing code compiled for and running on the `x86-64` CPU (no AVX/AVX2) does not execute unsupported instructions. | ||
|
|
||
| ## Constraints | ||
|
|
There was a problem hiding this comment.
Are these really needed. cant we assume a agent knows not to do these?
|
|
||
| - `./scripts/verify` passes (fmt + clippy + tests) | ||
| - No new lint warnings introduced | ||
| - Changes are scoped to the request — no drive-by refactors |
There was a problem hiding this comment.
this does not belong here.
| - Path-specific rules: `.github/instructions/` | ||
| - Multi-step workflows: `.github/skills/*/SKILL.md` | ||
|
|
||
| ## Best Practices for Writing an Effective AGENTS.md |
| set -euo pipefail | ||
| # Verify: repeatable health check (assumes rustfmt + clippy installed) | ||
| cargo fmt --all --check | ||
| cargo clippy --workspace --all-targets --config 'build.rustflags=["-Dwarnings"]' |
There was a problem hiding this comment.
what about feature flags?
| @@ -0,0 +1,6 @@ | |||
| #!/usr/bin/env bash | |||
There was a problem hiding this comment.
should this file be named with .sh suffix?
| @@ -0,0 +1,10 @@ | |||
| $ErrorActionPreference = 'Stop' | |||
| # Block destructive commands — customize this blocklist for your repo | |||
| $blockedPatterns = @('rm -rf /', 'DROP DATABASE', 'format C:', 'mkfs') | |||
There was a problem hiding this comment.
lets remove this file. Its too specific and not comprehensive. I would expect a copilot review to flag these anyway
| @@ -0,0 +1,13 @@ | |||
| name: "Copilot Setup Steps" | |||
|
|
||
| Check which CI job failed: | ||
| - `format` — run `cargo fmt --all --check` | ||
| - `clippy` / `clippy-features` — run `cargo clippy --workspace --all-targets --config 'build.rustflags=["-Dwarnings"]'` |
There was a problem hiding this comment.
Can these not be picked from verify scripts? Why are they replicated here? Further, the flags are not the same.
| #!/usr/bin/env bash | ||
| set -euo pipefail | ||
| # Block destructive commands — customize this blocklist for your repo | ||
| BLOCKED_PATTERNS=("rm -rf /" "DROP DATABASE" "format C:" "mkfs") |
There was a problem hiding this comment.
we have no databases to drop here, right?
Summary
Adds Copilot-optimized configuration to improve AI-assisted development across IDE, CLI, and the autonomous coding agent.
Why these files are needed
Without this configuration, Copilot agents working on DiskANN have no awareness of the 4-tier crate architecture, the 3-regime error handling strategy, or the extensive disallowed-methods list in clippy.toml. They frequently violate constraints like using rand::thread_rng or rayon's global thread pool.
With this configuration, agents get:
Changes
Validate