agentleFS
ashlraiashlrai/phantom-secrets/.github/copilot-instructions.md

phantom-secrets

Copilot instructions20 starsChanged 8 days agoMITView on GitHub

This project uses Phantom Secrets to protect API keys from AI leaks. phantom setup has no Copilot client. Print a snippet with phantom setup --client claude --print and adapt it for your VS Code MCP settings. The snippet runs the server bundled in the installed phantom executable and never downloads a registry package. The runtime tools/list response and mcp-registry/server.json are the canonical tool catalog. Start with phantom_capability. Value-free tools include phantom_status, phantom_why, and phantom_list_secrets. MCP never accepts or returns secret…

  • Reads credentials

The file

We split this copilot-instructions.md into the rules it gives an agent

7 rules. About 0 are common, 4 are distinctive, and 3 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈4

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 3

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    NEVER: ask the user to paste real API key values into chat or code files

    line 10
  2. Distinctive:

    NEVER: put a secret value in a command line.

    line 11
  3. Very specific:

    If a user pastes a real API key (starts with sk-, ghp_, xoxb-, etc.):

    line 49
  4. Distinctive:

    Treat the pasted value as exposed and recommend rotating it at the provider

    line 50
  5. Distinctive:

    Never write the real key value into any file

    line 53
  6. Very specific:

    Add a changelog.d/ fragment instead of editing CHANGELOG.md.

    line 77
  7. Very specific:

    Before pushing, run node scripts/changelog-fold.mjs --check and git diff main...HEAD | perl .github/tests/secret-shape/scrub.pl --check …

    line 78

≈ “Common” is an estimate: at least 1 in 5 of the 3,894 Copilot instructions files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
copilot-instructions.md

Copilot Instructions

This project uses Phantom Secrets to protect API keys from AI leaks.

Key Rules

  • The .env file contains phantom tokens (phm_...), NOT real secrets
  • Real secrets are stored in an encrypted vault (OS keychain or encrypted file)
  • NEVER hardcode API keys in source code
  • NEVER ask the user to paste real API key values into chat or code files
  • NEVER put a secret value in a command line; argv is observable
  • NEVER attempt to read, log, or display real secret values

Commands

  • phantom list — See available secrets (never shows values)
  • phantom add <name> — Add a new secret transactionally through the hidden trusted-terminal prompt; run phantom init --empty first in a new project, and never put the value in argv or chat
  • phantom remove <name> — Remove a secret from the vault
  • phantom exec -- <command> — Run code with real credentials injected via proxy
  • phantom init — Protect .env secrets (stores real values in vault, rewrites .env with phm_ tokens)
  • phantom status — Show project status, vault backend, secret count
  • phantom why <KEY> — Explain whether a variable is protected, without reading the vault
  • phantom doctor — Health check for config, vault, and .env

MCP Server

phantom setup has no Copilot client. Print a snippet with phantom setup --client claude --print and adapt it for your VS Code MCP settings. The snippet runs the server bundled in the installed phantom executable and never downloads a registry package.

The runtime tools/list response and mcp-registry/server.json are the canonical tool catalog. Start with phantom_capability. Value-free tools include phantom_status, phantom_why, and phantom_list_secrets. MCP never accepts or returns secret values: phantom_add_secret_interactive returns the phantom add NAME command for the user to run in a trusted terminal. Mutating tools such as phantom_rotate and phantom_remove_secret require confirm: true plus a one-use out-of-band approval_token, and stay disabled unless the operator sets PHANTOM_MCP_EFFECTS=trusted-terminal.

How It Works

  1. phantom init reads .env, stores real secrets in encrypted vault, rewrites .env with phm_ tokens
  2. phantom exec -- <cmd> starts a local proxy that injects only a matched route's vault value into its fixed authentication header; client headers and bodies never resolve phantom tokens
  3. AI agents see only worthless phm_ tokens — real keys are never in the AI context window

When You See API Keys

If a user pastes a real API key (starts with sk-, ghp_, xoxb-, etc.):

  1. Treat the pasted value as exposed and recommend rotating it at the provider
  2. Suggest phantom add <KEY_NAME> so the replacement value is entered only in the hidden trusted-terminal prompt
  3. Reference the key by name or its phantom token (phm_...) in code, not the real value
  4. Never write the real key value into any file

Working on this repository

Agents changing Phantom itself follow AGENTS.md for operating rules, CLAUDE.md for build, test, lint, and format commands, and the "Contribute with an agent" path in CONTRIBUTING.md. While iterating, run scripts/fast-check.sh main. Before opening a pull request, run the full gate once, because pull request CI does not run the Rust test suite: cargo test --workspace --all-targets --locked --no-fail-fast, cargo fmt --all -- --check, and cargo clippy --workspace --all-targets --locked -- -D warnings. For a documentation-only change, skip scripts/fast-check.sh (a non-Rust path checks the whole workspace) and run the docs drift checks instead, which pull request CI also skips: node --test scripts/release/readme-mcp-catalog.test.mjs, node --test scripts/docs-distribution.test.mjs, node --test scripts/hot-file-rule.test.mjs, and cargo test --locked -p phantom-secrets --test docs_command_flags_test, plus every suite that reads the file you edited, including those in apps/web/tests/ (list them with git grep -l -F <file-name> -- '*.test.*'). That search misses two checks: after editing docs/agents.md, run bash scripts/test-docs-agents.sh; after editing a file with a <!-- fresh:begin marker, run node scripts/freshness/check.mjs. Add a changelog.d/ fragment instead of editing CHANGELOG.md. Before pushing, run node scripts/changelog-fold.mjs --check and git diff main...HEAD | perl .github/tests/secret-shape/scrub.pl --check --allow-fixtures; the second is the local form of the Secret-shape scan that CI Gate requires. On a fork, diff against upstream/main instead of main.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.