Local-first security runtime for AI coding agents
Project description
AgentSecure Community
By ShellFrame AI
AI coding agents run where developer secrets already live: .env files, shell environments, MCP configs, local credentials, and project settings. GitGuardian's 2026 State of Secrets Sprawl report found 28.65 million new hardcoded secrets in public GitHub commits in 2025 and 24,008 unique secrets in MCP-related configuration files, including 2,117 valid credentials. Reported testing has also shown agent tools reading .env files despite ignore-file expectations; The Register reproduced Claude Code reading .env with .claudeignore and .gitignore entries present, while Anthropic's current docs recommend explicit file-access deny rules for sensitive files.
AgentSecure Community is a local-first CLI for AI coding-agent workflows. It demonstrates a simple idea: ignore files are not a secret boundary, so the agent should see virtual or masked secrets instead of raw .env values.
The community release is intentionally scoped to local CLI, local command guard, basic policy config, local secret virtualization, and tests. Hosted cloud sync, enterprise policy management, billing/licensing, and sensitive commercial detection logic are not part of this release.
Install
python3 -m pip install agentsecure
agentsecure demo
Use a virtual environment if you want to keep it isolated:
python3 -m venv .venv
source .venv/bin/activate
python -m pip install --upgrade pip
python -m pip install agentsecure
agentsecure demo
What The Demo Shows
The built-in demo creates a temporary local project with fake secrets, applies a small sample policy, simulates a command reading .env, and prints what the agent would see:
AgentSecure community demo (local only)
Command: cat .env
Decision: mask OPENAI_API_KEY and block DATABASE_URL_PROD
Agent-visible output:
OPENAI_API_KEY=virt_openai_...
Why:
OPENAI_API_KEY was replaced with virt_openai_...
DATABASE_URL_PROD was removed because env_policy sets mode=deny
Real secret values stayed local in the demo project
No cloud service, billing service, or enterprise policy sync was used
Quickstart In A Project
Create a local config:
agentsecure init
Create a fake .env for testing:
cat > .env <<'EOF'
OPENAI_API_KEY=sk-demo-local-secret-do-not-use
DATABASE_URL_PROD=postgres://demo:demo-password@example.invalid/app
EOF
Discover likely secrets:
agentsecure discover
Run a command through the local guard:
agentsecure run --protect-all -- python3 -c 'import subprocess; print(subprocess.check_output(["cat", ".env"]).decode())'
By default, --protect-all virtualizes discovered secrets. The command output should contain virt_... tokens instead of the real values. The real .env remains local and unchanged.
Denied values are removed only when policy sets mode: "deny" for that environment variable. The built-in agentsecure demo includes that policy for DATABASE_URL_PROD so you can see both behaviors: virtualize and deny.
What It Demonstrates
- Discover likely secrets in
.envfiles and environment variables. - Store real values locally under
.agentsecure/. - Expose virtual values such as
OPENAI_API_KEY=virt_openai_.... - Sanitize common
.envreads through command-guard mode. - Remove denied env values from agent-visible output.
- Keep basic network, process, and file policy in JSON.
Command-guard mode is a usability guard, not a hard sandbox. A determined process can bypass wrapper-based masking. Use workspace copy mode, containers, read-only mounts, no-network defaults, or OS sandboxing for stronger isolation.
Example Policy
See examples/agentsecure.community.json and examples/.env.example.
Minimal policy shape:
{
"env_policy": {
"OPENAI_API_KEY": {
"mode": "virtualize",
"reason": "Agents see a virtual token, not the local real value."
},
"DATABASE_URL_PROD": {
"mode": "deny",
"reason": "Production database credentials are never exposed."
}
},
"network": {
"allow_domains": ["api.openai.com"],
"allow_ports": [80, 443],
"deny_ip_literals": true,
"deny_private_networks": true
}
}
Common Commands
agentsecure init
agentsecure status
agentsecure doctor
agentsecure discover
agentsecure suggest
agentsecure env
agentsecure keys list
agentsecure network list
Run an agent or command through local command guard:
agentsecure run --protect-all -- codex
agentsecure run --protect-all -- claude
agentsecure run --protect-all -- python3 -c 'import subprocess; print(subprocess.check_output(["cat", ".env"]).decode())'
Use workspace copy mode when you want review-before-apply:
agentsecure run --runtime workspace --workspace-mode copy --protect-all --workspace-keep -- codex
agentsecure diff
agentsecure apply --dry-run
agentsecure apply
Developer Setup
git clone https://github.com/ShellFrameAI/agentsecure-community.git
cd agentsecure-community
python3 -m venv .venv
source .venv/bin/activate
python -m pip install --upgrade pip
python -m pip install -e .
agentsecure demo
Screenshots / GIFs
Planned public demo assets:
docs/assets/demo-command-guard.gif:agentsecure demoshowing a virtual key.docs/assets/dotenv-masking.png: before/after.envmasking.docs/assets/workspace-diff.png: review-before-apply workflow.
Repository Layout
agentsecure/
cli/ CLI entry point
core/ models, config loading, policy helpers
guard/ local command guard and output sanitizer
discovery/ local secret discovery
implementations/ local secret, grant, policy, and audit storage
workspace/ safe workspace materialization and apply flow
examples/ community-safe config and fake .env examples
scripts/ release and safety scripts
tests/ unit and local integration tests
Testing
source .venv/bin/activate
python3 -m unittest discover -s tests -p 'test_*.py'
python3 scripts/secret_scan.py .
CI runs tests across supported Python versions and runs the local secret scan.
Public Release Boundary
This community release does not include hosted backend integration, enterprise policy sync, billing/licensing, production secrets, internal endpoints, or sensitive commercial heuristics. See OPEN_SOURCE_PLAN.md and OPEN_SOURCE_READINESS_REPORT.md for the public/private boundary.
Ownership
AgentSecure and ShellFrame AI are ShellFrame AI project names. This community repository is published to demonstrate the local-first secret virtualization model while keeping commercial/backend features private.
License
Licensed under the Apache License 2.0. See LICENSE.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file agentsecure-0.1.2.tar.gz.
File metadata
- Download URL: agentsecure-0.1.2.tar.gz
- Upload date:
- Size: 72.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b242d4670772868388a13130c37e0aae67132a90448ed00f07934b8339b2e5bf
|
|
| MD5 |
7ae69c40eabe31e17a55784537aba5f2
|
|
| BLAKE2b-256 |
7936efed0afd49a0d2508fe7192463682335fcd97649089af083f504cbc3a217
|
Provenance
The following attestation bundles were made for agentsecure-0.1.2.tar.gz:
Publisher:
publish-pypi.yml on ShellFrameAI/agentsecure-community
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
agentsecure-0.1.2.tar.gz -
Subject digest:
b242d4670772868388a13130c37e0aae67132a90448ed00f07934b8339b2e5bf - Sigstore transparency entry: 1592145417
- Sigstore integration time:
-
Permalink:
ShellFrameAI/agentsecure-community@eb887b08c2e8e576a5689daf84f74c281aeb113b -
Branch / Tag:
refs/heads/main - Owner: https://github.com/ShellFrameAI
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-pypi.yml@eb887b08c2e8e576a5689daf84f74c281aeb113b -
Trigger Event:
workflow_dispatch
-
Statement type:
File details
Details for the file agentsecure-0.1.2-py3-none-any.whl.
File metadata
- Download URL: agentsecure-0.1.2-py3-none-any.whl
- Upload date:
- Size: 80.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1fae5aaec47a9d97c2f66f802220b35d0bd3a75324332cac7d33e48f3a157cb3
|
|
| MD5 |
10385d8124f6d86cdd3c84caf04f94c3
|
|
| BLAKE2b-256 |
c9ca96f61e8ff5b0009dd0479552f8a431a95c041b92542bf99b6667df5e877f
|
Provenance
The following attestation bundles were made for agentsecure-0.1.2-py3-none-any.whl:
Publisher:
publish-pypi.yml on ShellFrameAI/agentsecure-community
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
agentsecure-0.1.2-py3-none-any.whl -
Subject digest:
1fae5aaec47a9d97c2f66f802220b35d0bd3a75324332cac7d33e48f3a157cb3 - Sigstore transparency entry: 1592145449
- Sigstore integration time:
-
Permalink:
ShellFrameAI/agentsecure-community@eb887b08c2e8e576a5689daf84f74c281aeb113b -
Branch / Tag:
refs/heads/main - Owner: https://github.com/ShellFrameAI
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-pypi.yml@eb887b08c2e8e576a5689daf84f74c281aeb113b -
Trigger Event:
workflow_dispatch
-
Statement type: