Skip to main content

koko πŸ¦πŸ’»: The Secure & Privacy-First Coding Assistant

·569 words·3 mins

koko πŸ¦πŸ’»: The Secure & Privacy-First Coding Assistant
#

koko the gorilla

koko is a sandboxed, privacy-first coding assistant for the terminal that connects to LLM providers like Claude, Mistral, or Ollama while ensuring no sensitive data leaves your machine. Built with security and privacy at its core, koko provides least-privilege access to files and shell commands, automatic redaction of secrets/PII, and audit logging for transparency.

Perfect for developers who need agentic coding assistance without compromising security.


πŸ” Security & Privacy Features
#

Sandboxed Environment
#

  • Directory allowlist: Restricts file operations to explicitly allowed directories.
  • Symlink-safe path resolution: Prevents TOCTOU (Time-of-Check to Time-of-Use) attacks.
  • Denied file patterns: Blocks sensitive files like .env, *.pem, and credentials.json.
  • File size limits: Caps reads/writes to prevent abuse (default: 1 MB).

Command Policy
#

  • Default deny list: Blocks privilege escalation (sudo, su), remote network commands (ssh, scp), and shell evaluation (eval, source).
  • User confirmation: Requires explicit approval for every shell command.
  • Exec hardening: Enforces ulimit caps on CPU, memory, and output size.

Automatic Redaction
#

  • Secrets: Redacts AWS keys, GitHub PATs, Google API keys, Slack tokens, Stripe keys, JWTs, and PEM private keys.
  • PII: Masks emails, US SSNs, phone numbers, credit cards, and public IPv4 addresses.
  • Scrubbing: Applies to outbound LLM messages and session logs.

Audit Logging
#

  • Logs every tool invocation to ~/.koko/audit.jsonl with timestamps, arguments, and SHA-256 hashes.
  • Chain verification ensures log integrity.

πŸ€– Multi-Provider LLM Support
#

Connect to your preferred LLM backend:

ProviderModelsAPI Key RequiredDefault Endpoint
ClaudeAnthropic modelsβœ… (CLAUDE_API_KEY)Anthropic API
MistralMistral modelsβœ… (MISTRAL_API_KEY)Mistral API
OllamaLocal models❌http://localhost:11434

Switch models at runtime with :model <name> or configure defaults in ~/.koko/config.toml.


πŸ› οΈ Agent Tools
#

File Operations
#

ToolDescription
read_fileRead file contents with offset/limit.
write_fileCreate new files (refuses overwrites unless overwrite=true).
replace_in_fileFind-and-replace with unique match requirement.
rename_fileMove/rename files.
delete_fileDelete files (supports /undo).
list_dirList directory contents (recursive option).
search_filesSearch files by pattern with context lines.

Shell & Memory
#

ToolDescription
exec_commandRun shell commands (policy-gated, requires approval).
save_memorySave persistent memories across sessions.
delete_memoryRemove stored memories.
list_memoriesList all memories with bodies.

Planning
#

ToolDescription
exit_plan_modePropose a plan for user approval (plan mode only).

πŸ“‚ Project Detection & Memory
#

Project Detection
#

Scans for marker files (go.mod, package.json, Cargo.toml, etc.) to orient the assistant.

Persistent Memory
#

Store cross-session memories in ~/.koko/memory/ with types:

  • User: Preferences and role.
  • Feedback: Corrections and validated approaches.
  • Project: Ongoing work context.
  • Reference: Pointers to external systems.

⚑ Interactive REPL Commands
#

CommandDescription
:helpShow available commands.
:kokoPrint the koko mascot.
:clearReset conversation history.
:historyShow message count.
:tokensShow token usage stats.
:undoRevert the last file change.
:run <cmd>Run a shell command directly.
:planToggle plan mode (read-only investigation).
:playsList installed playbooks.

🎯 Use Cases
#

  • Secure Coding Assistance: Get help with code without exposing sensitive files.
  • Privacy-First AI: Use LLMs without leaking secrets or PII.
  • Auditability: Track all actions with tamper-proof logs.
  • Custom Workflows: Extend with playbooks for repetitive tasks.

πŸ“Œ Why Choose koko?
#

  • Security-First: Sandboxed environment with least-privilege access.
  • Privacy-Focused: Automatic redaction of secrets and PII.
  • Multi-Provider: Supports Claude, Mistral, and Ollama.
  • Transparent: Audit logs for all actions.
  • Extensible: Custom playbooks and persistent memory.

πŸ“’ Get Involved
#


πŸ“„ License
#

MIT