deepsecure
CLAUDE.md52 starsChanged 18 months agoApache-2.0View on GitHub
DeepSecure is a security platform that provides Identity-as-Code for AI agents, enabling them to fetch their own ephemeral credentials programmatically instead of using static API keys. The project consists of a Python CLI/SDK and backend services that implement a dual-service gateway architecture.
The file
We split this CLAUDE.md into the rules it gives an agent
6 rules. About 0 are common, 3 are distinctive, and 3 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈3
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
- could be automatic: a setting could enforce it
- Very specific: line 167
Always run make check-all before committing
- Distinctive: line 170
Start with tests (TDD approach preferred)
- Distinctive: line 173
Add CLI commands if applicable
- Very specific: line 174
Update examples in examples/ directory
- Distinctive: line 177
Never commit secrets or private keys
- Very specific: line 178
All crypto operations use ed25519 signatures
≈ “Common” is an estimate: at least 1 in 5 of the 29,248 CLAUDE.md 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.
Files
CLAUDE.md
This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
Project Overview
DeepSecure is a security platform that provides Identity-as-Code for AI agents, enabling them to fetch their own ephemeral credentials programmatically instead of using static API keys. The project consists of a Python CLI/SDK and backend services that implement a dual-service gateway architecture.
Development Commands
Environment Setup
# Install development dependencies
make install-dev
# or traditionally
make install-traditional
# Setup development environment
make setupTesting
# Run all tests
make test
pytest
# Run tests with coverage
make test-cov
pytest --cov=deepsecure --cov-report=html --cov-report=term
# Run specific test markers
pytest -m e2e # End-to-end tests (require live backend)
pytest -m integration # Integration testsCode Quality
# Run linting
make lint
ruff check .
mypy deepsecure/
# Format code
make format
black .
isort .
# Security scanning
make security
bandit -r deepsecure/
safety check
# Run all quality checks
make check-allBuild and Package
# Build package
make build
./scripts/build_package.sh
# Clean build artifacts
make cleanArchitecture Overview
Core Module Structure
deepsecure/_core/: Internal implementation modulesclient.py: High-level client services wrapping core functionalitiesbase_client.py: Base HTTP client with authenticationvault_client.py: Secret management operationsagent_client.py: Agent identity managementidentity_manager.py: Agent identity and key managementcrypto/key_manager.py: Cryptographic key operationsconfig.py: Configuration management
deepsecure/: Public API layerclient.py: Main SDK client (uses _core modules)commands/: CLI command implementationsintegrations/: Framework integrations (LangChain, CrewAI)resources/: Resource objects (Agent, Secret)
Backend Services
deeptrail-control/: Control plane (agent management, authentication, policies)deeptrail-gateway/: Data plane (API proxy with secret injection)
Key Patterns
- Dual Client Architecture:
deepsecure.Client(public SDK) wrapsdeepsecure._core.client(internal)- Core modules handle low-level operations, public client provides clean API
- Identity Provider Pattern:
- Multiple identity providers (Keyring, Kubernetes, AWS)
- Agents bootstrap identity from platform-native mechanisms
- Gateway Architecture:
- External API calls routed through gateway with automatic secret injection
- JWT-based authentication between services
Testing Strategy
Test Organization
tests/_core/: Core module unit tests (client, identity_manager, environment_detection)tests/commands/: CLI command tests (agent, auth, policy, vault)tests/sdk/: SDK-level tests (gateway requests, client properties, credentials)tests/test_examples.py: Example script validationtests/docs/: Documentation validation (README snippets)- End-to-end tests: Marked with
@pytest.mark.e2e, require live backend - Integration tests: Marked with
@pytest.mark.integration
Running Specific Tests
# Run single test file
pytest tests/test_sdk_client.py
# Run tests by marker
pytest -m e2e -v # End-to-end tests only
pytest -m integration -v # Integration tests only
# Run tests with specific patterns
pytest -k "test_agent" -v # All tests with 'agent' in nameBackend Dependencies
Many tests require the backend services running:
# Start backend services (includes PostgreSQL and Redis dependencies)
docker compose up deeptrail-control deeptrail-gateway -d
# Start with dependencies (full stack)
docker compose up db redis deeptrail-control deeptrail-gateway -d
# Verify services
curl http://localhost:8000/health # Control plane
curl http://localhost:8002/health # Gateway
# View service logs
docker compose logs deeptrail-control # Control plane logs
docker compose logs deeptrail-gateway # Gateway logsConfiguration
Environment Variables
export DEEPSECURE_DEEPTRAIL_CONTROL_URL=http://localhost:8000
export DEEPSECURE_GATEWAY_URL=http://localhost:8002
export DEEPSECURE_DEBUG=true # Enable verbose loggingCLI Configuration
deepsecure configure set-url http://127.0.0.1:8001
deepsecure configure set-gateway-url http://localhost:8002
deepsecure configure set-token # Prompts for tokenDevelopment Workflow
Making Changes
- Core functionality changes go in
deepsecure/_core/ - Public API changes go in
deepsecure/client.pyordeepsecure/ - CLI changes go in
deepsecure/commands/ - Always run
make check-allbefore committing
Adding New Features
- Start with tests (TDD approach preferred)
- Implement in appropriate core module
- Expose through public client if needed
- Add CLI commands if applicable
- Update examples in
examples/directory
Security Considerations
- Never commit secrets or private keys
- All crypto operations use
ed25519signatures - Agent private keys stored in OS keyring by default
- JWT tokens used for service-to-service authentication
- Split-key architecture: client holds partial key, gateway holds partial key
- Redis used for gateway-side key storage in development
Key File Locations
Configuration Files
pyproject.toml: Project metadata, dependencies, and tool configurationsdocker-compose.yml: Backend services orchestration (PostgreSQL, Redis, Control, Gateway)pytest.ini: Test configuration and markersMakefile: Development workflow automation
Core Implementation
deepsecure/client.py: Main public SDK clientdeepsecure/_core/client.py: Internal high-level client implementationdeepsecure/_core/base_client.py: Base HTTP client with authenticationdeepsecure/_core/identity_manager.py: Agent identity and cryptographic operationsdeepsecure/_core/crypto/key_manager.py: Ed25519 key operations
Service Ports (Development)
- Control Plane: http://localhost:8000 (mapped from container port 8001)
- Gateway: http://localhost:8002 (mapped from container port 8001)
- PostgreSQL: localhost:5434 (mapped from container port 5432)
- Redis: localhost:6380 (mapped from container port 6379)
Common Debugging
# Check service status
docker compose ps
# Restart services if needed
docker compose restart deeptrail-control deeptrail-gateway
# Clean restart (removes volumes)
docker compose down -v && docker compose up -d
# Database access for debugging
docker compose exec db psql -U deepsecure_user -d deeptrail_controldb
# Redis access for debugging
docker compose exec redis redis-cliDoes 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
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.

