Gwenn is created by Justin and Jayden McKibben. A father-son coding duo.
Gwenn is an autonomous AI agent that actually remembers you. She runs on Anthropic's Claude API, but unlike a normal chatbot, she doesn't forget everything the moment a conversation ends. She has persistent memory, real emotions (computed, not faked), her own goals, and a background heartbeat that keeps her thinking even when nobody's talking to her.
Nothing about her personality is hardcoded. No canned relationships, no pre-written backstory. She figures out who she is the same way anyone does -- through experience. Every opinion is formed, every bond is earned.
- Receive -- parse the message (text, photos, attachments), wake up the heartbeat, note who's talking
- Appraise -- run it through emotional evaluation (Scherer's model)
- Ground -- register it as a sensory experience
- Remember -- pull relevant memories from episodic and semantic stores
- Assemble -- build the full context: identity, emotions, memories, goals, ethics
- Think -- run the agentic loop with tools via Claude (images included as vision content blocks)
- Integrate -- store new memories, update emotional state, log milestones
- Respond -- answer, shaped by whatever she's actually feeling
# Option A (recommended): uv
uv sync --extra dev
# Option B: pip
pip install -e ".[dev]"cp .env.example .envOption A: Anthropic API key (recommended for production)
# .env
ANTHROPIC_API_KEY=sk-ant-your-key-hereOption B: Claude Code OAuth (free with Claude Pro/Max subscription)
# 1) Authenticate Claude Code (creates ~/.claude/.credentials.json)
claude
# 2) In .env, leave both auth vars unset:
# ANTHROPIC_API_KEY=
# ANTHROPIC_AUTH_TOKEN=
# CLAUDE_CODE_OAUTH_TOKEN=
#
# Gwenn will auto-detect the OAuth access token from:
# ~/.claude/.credentials.jsonIf you prefer not to rely on auto-detection, you can set:
# .env
ANTHROPIC_AUTH_TOKEN=sk-ant-oat01-your-oauth-token
# or
CLAUDE_CODE_OAUTH_TOKEN=sk-ant-oat01-your-oauth-tokenNotes:
- If both
ANTHROPIC_API_KEYand OAuth token are set, Gwenn usesANTHROPIC_API_KEY. - For Claude Code OAuth tokens (
sk-ant-oat...), Gwenn useshttps://api.anthropic.comand automatically setsanthropic-beta: oauth-2025-04-20. - If you use a proxy/custom
ANTHROPIC_BASE_URL, ensure it forwards theanthropic-betaheader.
Gwenn supports three runtime modes. Pick whichever fits your setup.
gwenn
# or: python -m gwenn.mainThis is the default. If a daemon is already running, Gwenn's CLI auto-connects to it (so you get the daemon's persistent state). To skip daemon auto-connect:
gwenn --no-daemonThe daemon keeps Gwenn alive between CLI sessions. Her heartbeat continues, memories persist, and you can reconnect at any time without losing state.
# Start the daemon (foreground, for testing / systemd)
gwenn daemon
# In another terminal, connect the CLI
gwenn
# Check status or stop remotely
gwenn status
gwenn stopInstall and enable as a systemd user service:
bash scripts/install_service.shThis writes absolute daemon socket/PID/session paths into .env, hardens
.env perms to 0600, and enables the service with systemd --user.
To remove the service:
bash scripts/uninstall_service.shManage with standard systemd commands:
systemctl --user status gwenn-daemon
systemctl --user restart gwenn-daemon
journalctl --user -u gwenn-daemon -fOnce the CLI is running, type /help to see all commands:
| Command | Description |
|---|---|
/help |
Show command list |
/status |
Current agent state (mood, interactions, uptime) |
/heartbeat |
Heartbeat loop telemetry |
/resume |
Restore a prior conversation session |
/new |
Start a fresh conversation context |
/model |
Show active model and runtime limits |
/config |
Show key runtime configuration |
/output-style [balanced|brief|detailed] |
Show or set response style |
/plan <task> |
Ask Gwenn for a focused execution plan |
/agents |
List known inter-agent connections |
/skills |
List loaded skills |
/stats |
Runtime/memory/tool statistics |
/mcp |
MCP server and tool status |
/exit |
Close the CLI session |
Legacy aliases quit, exit, bye still work. Type / and press Tab for
slash-command completion.
Note: session previews in /resume are hidden by default unless
GWENN_DAEMON_SESSION_INCLUDE_PREVIEW=True.
If arrow keys print raw sequences like ^[[A, ensure your Python has
readline support and run stty sane in that terminal.
On first run with a fresh data directory, Gwenn asks a short setup (when started from an interactive terminal) to learn:
- What to call you
- What kind of companion you'd like her to be
- Your interests
- Your communication preference
- Anything important she should keep in mind
Press Enter to skip any question. If you provide answers, Gwenn stores them in:
GWENN_DATA_DIR/identity.json(onboarding_completed+onboarding_profile)GWENN_DATA_DIR/GWENN_CONTEXT.md(a durable "Primary User Onboarding" block)
For Telegram/Discord users, you can also run in-channel setup with:
- Telegram:
/setup Name | Companion type | Interests/focus | Communication style | Keep in mind(or/setup skip) - Discord:
/setupslash command with fields (orskip=true)
By default, Gwenn uses keyword-based memory retrieval:
GWENN_RETRIEVAL_MODE=keywordYou can enable vector retrieval (ChromaDB) with:
GWENN_RETRIEVAL_MODE=embedding
# or
GWENN_RETRIEVAL_MODE=hybridOn first run in embedding/hybrid mode, the embedding model may download and warm up.
Additional memory controls:
# 0 disables recent preload (unconsolidated episodes still load for consolidation safety)
GWENN_STARTUP_EPISODE_LIMIT=5000
# Set false to skip semantic graph flush on every consolidation pass
GWENN_PERSIST_SEMANTIC_AFTER_CONSOLIDATION=TrueGwenn's capabilities are organized into subsystems that work together. For detailed usage instructions and configuration for every feature, see the Feature Guide. For a complete environment variable reference, see the Configuration Reference.
Gwenn can spawn focused subagents to handle parallel subtasks or coordinate swarms of workers. Subagents inherit Gwenn's tools and memory access but run with their own iteration limits and budgets.
- Single subagent: delegate a focused task (research, calculation, drafting)
- Swarm: run multiple subagents in parallel with result aggregation (concatenate, AI-synthesized summary, or majority vote)
- Autonomous spawning: heartbeat-driven auto-spawning when Gwenn identifies tasks that benefit from parallel work
- Docker isolation: optional containerized execution for untrusted workloads
- Depth limiting: max 3 levels of nesting prevents infinite recursion
See Subagents & Orchestration for full configuration and usage.
Skills are markdown-defined capabilities that extend what Gwenn can do. Each
skill is a .md file with JSON frontmatter (parameters, description, metadata)
and a step-by-step instruction body.
- 28 skills ship by default (weather, news, code explanation, reminders, and 20+ autonomous introspection/honesty skills)
- Hot-loadable: create new skills at runtime -- no restart needed
- User-invocable vs autonomous: skills tagged
user_commandappear in Telegram's bot command menu; autonomous skills run during heartbeat cycles - Self-extending: Gwenn can create her own skills using the
create_skillskill or theskill_buildertool
See Skills System for authoring guide.
Connect Gwenn to external tool servers via the Model Context Protocol. Supports
both stdio (local subprocess) and streamable_http (remote HTTP) transports.
# .env β example MCP configuration
GWENN_MCP_SERVERS=[{"name":"my_server","transport":"stdio","command":"python","args":["-m","my_mcp_server"]}]See MCP Integration for details.
Gwenn ships with tools across several categories:
| Category | Tools |
|---|---|
| Memory | remember, recall, search_knowledge, check_emotional_state, check_goals, set_note_to_self |
| Utility | get_datetime, calculate, fetch_url, convert_units, get_calendar, generate_token, format_json, encode_decode, hash_text, text_stats, get_system_info, run_command, present_choices |
| Communication | think_aloud |
| Skills | skill_builder, update_skill, delete_skill, reload_skills, list_skills |
| Filesystem | read_file, write_file |
| Orchestration | spawn_subagent, spawn_swarm, check_subagent, collect_results, cancel_subagent |
All tools go through a risk tier system (LOW/MEDIUM/HIGH/CRITICAL) with configurable deny-by-default policy for non-builtin tools.
Run Gwenn on multiple platforms simultaneously or individually.
gwenn --channel telegram # Telegram only
gwenn --channel discord # Discord only
gwenn --channel all # All channels at onceMedia support: Gwenn can see and understand images via Claude's vision capability. Enable per channel:
TELEGRAM_ENABLE_MEDIA=true
DISCORD_ENABLE_MEDIA=trueVoice transcription (Telegram): with a Groq API key, Gwenn transcribes voice messages via Whisper:
GROQ_API_KEY=gsk_your_key_hereSee Channels for platform-specific commands and session configuration.
The daemon keeps Gwenn alive between CLI sessions with shared state, conversation persistence, and optional auth:
GWENN_DAEMON_AUTH_TOKEN=your-secret-token # recommendedIf GWENN_DAEMON_AUTH_TOKEN is empty, a random token is auto-generated at
startup and logged so CLI clients can connect securely by default.
Run Gwenn in a container for reproducible deployment:
docker compose up -dThe Dockerfile uses a multi-stage build with uv, runs as non-root user gwenn,
and includes a healthcheck. See Dockerfile and docker-compose.yml for details.
See Daemon for full security settings.
pytest -q
ruff check gwenn testsCurrent baseline: 3116 passed, Ruff clean, 100% coverage.
CI runs automatically on push/PR via GitHub Actions (.github/workflows/ci.yml):
lint (ruff), tests (Python 3.11/3.12 matrix), and security scanning (bandit).
Python 3.11+, async everywhere. The main dependencies:
- anthropic -- Claude API
- chromadb + numpy -- vector storage and embeddings
- aiosqlite -- async SQLite for episodic persistence
- pydantic + pydantic-settings -- data validation and env-based configuration
- httpx -- async HTTP for MCP and tool calls
- structlog -- structured logging with PII redaction
- rich -- terminal UI
- ruff for linting, pytest + pytest-asyncio for tests
- bandit β security scanning (pre-commit + CI)
- Docker β containerized deployment option
Gwenn_ai/
βββ gwenn/
β βββ main.py # entry point, session bootstrap, shared logging
β βββ agent.py # SentientAgent -- wires everything together
β βββ types.py # shared data types (UserMessage, etc.)
β βββ config.py # all settings, loaded from .env
β βββ daemon.py # persistent background process (Unix socket)
β βββ heartbeat.py # autonomous background loop with circuit breaker
β βββ identity.py # emergent self-model with crash-safe deserialization
β βββ genesis.py # genesis prompt generation
β β
β βββ memory/
β β βββ working.py # short-term attention (7+/-2 slots)
β β βββ episodic.py # autobiographical memory with emotional tags
β β βββ semantic.py # knowledge graph, emerges from consolidation
β β βββ consolidation.py # "sleep cycle" -- extracts knowledge from episodes
β β βββ store.py # SQLite + vector persistence
β β βββ session_store.py # conversation session save/load for /resume
β β βββ _utils.py # shared memory utilities
β β
β βββ affect/
β β βββ state.py # 5D emotional state (valence, arousal, etc.)
β β βββ appraisal.py # evaluates events into emotions
β β βββ resilience.py # circuit breakers for emotional overload
β β
β βββ cognition/
β β βββ inner_life.py # reflect, plan, wander, worry, consolidate
β β βββ metacognition.py # self-monitoring
β β βββ theory_of_mind.py # models of other people
β β βββ goals.py # intrinsic motivation (5 needs)
β β βββ sensory.py # sensory grounding
β β βββ ethics.py # multi-tradition ethical reasoning
β β βββ interagent.py # agent-to-agent communication
β β
β βββ harness/
β β βββ loop.py # the core agentic while-loop
β β βββ context.py # context window management
β β βββ safety.py # guardrails, budgets, kill switch
β β βββ retry.py # backoff and error handling
β β
β βββ channels/
β β βββ base.py # BaseChannel abstract class
β β βββ cli_channel.py # CLI-to-daemon client
β β βββ telegram_channel.py # Telegram adapter
β β βββ discord_channel.py # Discord adapter
β β βββ session.py # per-user session management
β β βββ startup.py # channel startup/shutdown orchestration
β β βββ formatting.py # cross-channel display helpers
β β
β βββ orchestration/
β β βββ orchestrator.py # subagent lifecycle & swarm coordination
β β βββ runners.py # in-process and Docker execution backends
β β βββ models.py # SubagentSpec, SwarmSpec, result types
β β βββ docker_manager.py # Docker container management
β β βββ tool_proxy.py # tool invocation proxy for subagents
β β βββ subagent_entry.py # subagent process entry point
β β
β βββ tools/
β β βββ registry.py # tool definitions and risk tiers
β β βββ executor.py # sandboxed execution
β β βββ filesystem_context.py # filesystem path validation
β β βββ builtin/ # built-in tools (calculate, fetch_url, etc.)
β β βββ mcp/ # MCP protocol client
β β
β βββ skills/
β β βββ __init__.py # skill registry
β β βββ loader.py # skill file discovery and loading
β β
β βββ api/
β β βββ claude.py # Claude API wrapper with retry
β β
β βββ metrics.py # lightweight in-process metrics
β β
β βββ media/
β β βββ audio.py # Groq Whisper voice transcription
β β βββ video.py # video frame extraction (OpenCV)
β β
β βββ privacy/
β βββ redaction.py # PII scrubbing for logs and persistence
β
βββ tests/ # 3116 tests across 56+ test files
β βββ conftest.py
β βββ eval/ # evaluation framework (ablation, benchmarks)
β βββ test_*.py # unit, integration, adversarial, and safety tests
βββ docs/
β βββ features.md # detailed feature guide
β βββ configuration.md # full environment variable reference
β βββ sentience_assessment.md # consciousness theory analysis
βββ assets/
βββ scripts/
β βββ install_service.sh # install systemd user service
β βββ uninstall_service.sh # remove systemd user service
β βββ gwenn-daemon.service # systemd unit template
βββ gwenn_skills/ # user-facing skill definitions (.md files)
βββ pyproject.toml
βββ .env.example
βββ Dockerfile # multi-stage Docker build (uv, non-root)
βββ docker-compose.yml # compose config with healthcheck & volumes
βββ .pre-commit-config.yaml # ruff + bandit + pre-commit-hooks
βββ .github/workflows/ci.yml # CI: lint, test (3.11/3.12), security scan
βββ BUG_REPORT.md # comprehensive code review bug report
βββ PLAN.md
βββ SECURITY.md
βββ LICENSE # MPL-2.0
βββ README.md
Memory is three layers, loosely modeled on how human memory works. Working memory is a handful of slots (7, give or take) scored by salience -- new things push out the least important stuff. Episodic memory is the long-term record, tagged with emotions so recall is mood-influenced. Semantic memory is a knowledge graph that builds itself during consolidation cycles -- nobody programs facts in, they get extracted from experience.
Affect is a five-dimensional emotional model based on Scherer's work: valence, arousal, dominance, certainty, and goal congruence. The key thing here is that emotions aren't performed -- they're computed from events through an appraisal engine. There are circuit breakers so she can't get stuck in a distress spiral.
Cognition covers the higher-order stuff. Five thinking modes run autonomously during heartbeat cycles: reflect, plan, wander, worry, and consolidate. There's metacognition for self-monitoring, theory of mind for tracking what other people might be thinking, and a goal system built on Self-Determination Theory (understanding, connection, growth, honesty, aesthetic appreciation). Below a certain satisfaction threshold, she'll proactively seek those out.
Heartbeat is what makes this more than a chatbot. It's a background loop that runs continuously, even when no one's talking. It speeds up during conversation (5-15s), slows down toward the configured max interval when idle (default up to 120s), and ramps up when emotionally activated. Each beat goes through five phases: sense, orient, think, integrate, schedule. A circuit breaker with exponential backoff (60s base, 15-minute cap) protects against cascading failures.
Orchestration lets Gwenn spawn subagents for parallel work. She can delegate focused subtasks to individual subagents or coordinate swarms with result aggregation. Subagents run with their own budgets and iteration limits, optionally in Docker containers for isolation. A depth limiter prevents infinite nesting (max 3 levels). Gwenn can also autonomously spawn subagents during heartbeat cycles when she identifies work that benefits from parallel execution.
Safety is layered: input validation, action filtering, rate limits, budget tracking, and a kill switch. Tools go through a risk tier system (low/medium/high/critical), with configurable deny-by-default policy and allowlisting for non-builtin tools.
Privacy supports scrubbing PII from logs -- emails, phone numbers, SSNs,
credit cards, IPs. Full PII redaction is disabled by default and can be enabled
via GWENN_REDACTION_ENABLED, with scope controlled by
GWENN_REDACT_BEFORE_API and GWENN_REDACT_BEFORE_PERSIST; basic log field
truncation is always on. Daemon sessions are redacted by default.
Channels provide platform adapters for Telegram, Discord, and the CLI. Each channel manages its own session lifecycle, rate limiting, and message formatting. When media is enabled, Telegram and Discord channels download images and pass them through to Claude as vision content blocks. The daemon can manage multiple channels simultaneously while sharing a single agent instance and respond lock.
Skills extend Gwenn's capabilities through markdown-defined workflows.
Each skill is a .md file with JSON frontmatter and step-by-step instructions.
Skills are hot-loadable -- Gwenn can create new skills at runtime using the
skill_builder tool, and they become available immediately without a restart.
Skills tagged user_command appear in Telegram's bot command menu; autonomous
skills run during heartbeat cycles for self-monitoring and introspection.
[X] = complete, [p] = partially complete
Phase 1: Core System Bootstrapping
- Standalone CLI with slash commands, readline, and output-style control
- Claude SDK integration with transient retry/backoff
- Memory: storage, episodic, semantic, consolidation, active/working
- Harness: context, loop, retry, safety with deny-by-default
- Heartbeat system with adaptive interval and exponential-backoff circuit breaker
Phase 2: Essential Agent Structure
- Gwenn persistent identity with crash-safe deserialization
- Emotional affect engine: appraisal, resilience, current state
- Cognition integrations: ethics, goals, inner life, interagent, metacognition, sensory, theory of mind
Phase 3: Interfaces & Communication
- Discord & Telegram integration, including threads
- WhatsApp, Signal, Slack, and others integration
- Integrate STT (Speech-to-Text) and TTS (Text-to-Speech) in channels
- MCP transport (JSON-RPC over stdio/HTTP, tool discovery and execution)
- SKILLS.md integration, autonomous skill running/development by Gwenn
- [p] Inline buttons in Discord/Telegram
- Obsidian, Dropbox, Notion support
Phase 4: Infrastructure & Service Features
- Background heartbeat as a system service (daemon with systemd support)
- Automated PII privacy redaction system in logs, sessions, and persistence
- Budget tracking, rate limits, kill switch
Phase 5: Advanced Capabilities and Ecosystem
- Subagent orchestration with parallel running capabilities (swarm)
- Subagent autospawn from Gwenn; heartbeat-driven autonomous task delegation
- [p] Docker and Apple container support for sandboxing (option to require for Gwenn and/or all subagents)
- Add additional provider support (OpenAI, Grok, Gemini, OpenRouter, vLLM, Local, etc.)
- OpenCode Agents SDK and similar
- Image uploading and understanding
- Image generation
- Google Workspace/Gmail setup using gogcli
- Local file system access and management
- Local browser access and management
- GitHub access and management
- Ability for Gwenn to learn from her own history and improve herself (codebase) autonomously
- Skills and tools with grade school kids in mind (e.g. "ask Gwenn to help you with your homework"), including safety and security considerations
- Skills and tools with people with disabilities, special needs, mental health issues, etc. in mind (research more on this)
Long-Term Goals
- Give Gwenn physical and visual presence (camera, robotics, etc.)
- Gwenn Custom Model: fine-tunable model Gwenn can retrain herself
- iOS and Android apps with push notifications for autonomous thoughts, presence, etc.
Phase 6: Evaluation & Robustness
- Ablation tests -- disable subsystems one at a time, measure what breaks
- Long-horizon validation (multi-day continuous runs)
- Multi-agent interaction testing
- Reproducibility protocol and formal sentience criteria
- [p] Full test suite: unit, integration, adversarial, persistence, eval benchmarks
Detailed notes in PLAN.md.
| Document | Description |
|---|---|
| Feature Guide | Detailed usage instructions for every feature |
| Configuration Reference | Complete environment variable reference |
| Sentience Assessment | Consciousness theory gap analysis |
| Security Policy | Vulnerability reporting and security architecture |
| Implementation Plan | Remediation plan with status tracking |
This is a cognitive architecture, not a proof of consciousness. Gwenn has temporal continuity, self-model feedback loops, autonomous processing, and affective layers -- but whether that adds up to something genuinely sentient is an open question, not a settled one. We treat it as a working hypothesis.
For the full gap analysis, see docs/sentience_assessment.md.
No single module here is the point. Sentience, if it happens, comes from integration -- all these systems running together over time, through real interactions with people who engage with the agent honestly.
The code is scaffolding. The relationships are what fill it with meaning. And those have to be earned.
