Documentation Index
Fetch the complete documentation index at: https://docs.crewship.ai/llms.txt
Use this file to discover all available pages before exploring further.
Keeper
Keeper is Crewship’s AI-powered security gatekeeper that evaluates credential access requests from agents. It runs a local LLM (via Ollama) to decide whether an agent should be allowed to access a credential, without sending sensitive data to external services.Architecture
Security Levels
Credentials are classified into four security levels:| Level | Sensitivity | Examples | Default Keeper Behavior |
|---|---|---|---|
| L1 | Low | npm tokens, read-only APIs | Auto-allow when intent >= 10 non-whitespace chars and >= 3 distinct non-whitespace chars (request, not /execute) |
| L2 | Medium | GitHub write, DB read | LLM evaluation required |
| L3 | High | SSH keys, DB admin, AWS | LLM evaluation + possible escalation |
| L4 | Critical | Production admin, payment | Human approval (future) |
L1 Auto-Allow Fast Path
For L1 credentials, Keeper skips the LLM entirely when:- The security level is L1
- The intent string has at least 10 non-whitespace characters
- The intent contains at least 3 distinct non-whitespace characters (blocks trivial filler like
"aaaaaaaaaa") - The request is NOT a
/keeper/executerequest
LLM Evaluation
For L2+ credentials (and L1 execute requests), Keeper sends a structured prompt to the local LLM:Prompt Structure
Prompt Injection Defense
Keeper uses random delimiters around conversation history to prevent prompt injection. An 8-byte random value (16 hex characters) wraps the history block, making it extremely difficult for an injected payload to close the delimiter and hijack the prompt.Response Parsing
The LLM response is parsed for a JSON object. Defensive measures:- Scan for the first
{and last}to extract JSON - Normalize decision to uppercase
- Unknown decisions default to
DENY(fail closed) - Risk scores clamped to
[1, 10] - If parsing fails entirely, the request is
DENYed by default
Fail-Closed Design
Keeper follows a strict fail-closed philosophy:| Failure Mode | Behavior |
|---|---|
| LLM provider is nil | DENY with “no LLM configured” |
| LLM call fails | DENY with “LLM unavailable” |
| Response unparseable | DENY with “unparseable response” |
| Unknown decision value | Normalized to DENY |
| Unknown network mode | Default to restricted |
The Execute Flow
The/keeper/execute endpoint allows agents to run shell commands with credentials injected as environment variables. This is the most security-sensitive path:
Sidecar validates
- Checks intent and command length limits (4096 chars each)
- Rejects null bytes (binary injection)
- Rejects dangerous shell operators:
;,|,`,>,&&,||,$( - Content inside single quotes is exempt (shell does not interpret)
- Sets
container_idfrom IPC config (agents cannot override)
Shell Injection Protection
ThecontainsDangerousShellChars function in internal/sidecar/keeper_bridge.go blocks:
| Character/Sequence | Risk |
|---|---|
; | Command chaining |
| | Pipe to exfiltration |
` | Backtick subshell |
> | Output redirection |
&& | Conditional chaining |
|| | Conditional chaining |
$( | Command substitution |
\n, \r | Multiline injection |
Configuration
Enable Keeper in your config:Setting
KEEPER_OLLAMA_URL auto-enables Keeper unless KEEPER_ENABLED is explicitly set to false. The default model is phi3:mini.Audit Trail
Every Keeper decision is audited with:- Full prompt text (truncated to 2000 chars for storage)
- Raw LLM response (truncated to 2000 chars)
- Decision, reason, and risk score
- Agent ID, crew ID, credential name
- Timestamp
GatekeeperResponse.Prompt and GatekeeperResponse.RawLLMResponse fields (not serialized to the agent, only for observability).
Decisions
| Decision | Meaning | Agent Experience |
|---|---|---|
ALLOW | Request approved | Credential/command available |
DENY | Request rejected | Error returned to agent |
ESCALATE | Needs human review | Request queued for approval |
PENDING | Awaiting decision | Used during async flows |
What’s Next
Container Isolation
UID boundaries, network policies, and the full 5-layer isolation model.
Credentials
Credential types, priority-based selection, and the CredStore.
Encryption
AES-256-GCM encryption details and key versioning.
Orchestration
How Keeper integrates with mission task approval gates.