Skip to content

Bootstrap GitHub Copilot configuration#1028

Draft
arrayka wants to merge 1 commit intomainfrom
copilot-bootstrap
Draft

Bootstrap GitHub Copilot configuration#1028
arrayka wants to merge 1 commit intomainfrom
copilot-bootstrap

Conversation

@arrayka
Copy link
Copy Markdown
Contributor

@arrayka arrayka commented May 6, 2026

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:

  • AGENTS.md: Concise root instructions (verify command, dependency rules, error regimes, guardrails)
  • scripts/verify + .ps1: One-command health check (fmt + clippy + test)
  • scripts/setup + .ps1: Installs required toolchain components
  • copilot-setup-steps.yml: Enables autonomous coding agent to work on issues
  • .github/instructions/: Path-scoped rules for unsafe code and CI workflows
  • .github/skills/: On-demand workflows for crate scaffolding and CI triage
  • unsafe-reviewer agent: Read-only review specialist for unsafe Rust soundness
  • generate-tests prompt: Test generation following DiskANN conventions
  • Security hook: Blocks destructive commands before execution

Changes

  • Renamed agents.md to AGENTS.md (conventional) and refined from 233 to 65 lines
  • Added 15 new files across scripts/, .github/workflows/, instructions/, skills/, agents/, prompts/, hooks/
  • Skills contain TODO placeholders for team-specific details

Validate

./scripts/verify

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>
@arrayka arrayka requested review from a team and Copilot May 6, 2026 22:33
@arrayka arrayka changed the title feat: Bootstrap GitHub Copilot configuration Bootstrap GitHub Copilot configuration May 6, 2026
@arrayka arrayka marked this pull request as draft May 6, 2026 22:35
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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/setup and scripts/verify helpers 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.

Comment on lines +5 to +10
foreach ($pattern in $blockedPatterns) {
if ($input -match [regex]::Escape($pattern)) {
Write-Error "Blocked: destructive pattern detected"
exit 1
}
}
Comment thread scripts/security-check.sh
# 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
Comment thread AGENTS.md
@@ -0,0 +1,104 @@
# AGENTS.md
Comment thread AGENTS.md
Comment on lines +101 to +104
## 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-commenter
Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 90.63%. Comparing base (e137362) to head (cb3a4a5).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files

Impacted file tree graph

@@            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     
Flag Coverage Δ
miri 90.63% <ø> (+1.12%) ⬆️
unittests 90.60% <ø> (+1.23%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.
see 40 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Comment thread AGENTS.md
- Testing code compiled for and running on the `x86-64` CPU (no AVX/AVX2) does not execute unsupported instructions.

## Constraints

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are these really needed. cant we assume a agent knows not to do these?

Comment thread AGENTS.md

- `./scripts/verify` passes (fmt + clippy + tests)
- No new lint warnings introduced
- Changes are scoped to the request — no drive-by refactors
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this does not belong here.

Comment thread AGENTS.md
- Path-specific rules: `.github/instructions/`
- Multi-step workflows: `.github/skills/*/SKILL.md`

## Best Practices for Writing an Effective AGENTS.md
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove

Comment thread scripts/verify
set -euo pipefail
# Verify: repeatable health check (assumes rustfmt + clippy installed)
cargo fmt --all --check
cargo clippy --workspace --all-targets --config 'build.rustflags=["-Dwarnings"]'
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what about feature flags?

Comment thread scripts/verify
@@ -0,0 +1,6 @@
#!/usr/bin/env bash
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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')
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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"
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what does this do?


Check which CI job failed:
- `format` — run `cargo fmt --all --check`
- `clippy` / `clippy-features` — run `cargo clippy --workspace --all-targets --config 'build.rustflags=["-Dwarnings"]'`
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can these not be picked from verify scripts? Why are they replicated here? Further, the flags are not the same.

Comment thread scripts/security-check.sh
#!/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")
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we have no databases to drop here, right?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants