Skip to content

πŸ‘‘ Your resident AI operator β€” 7-layer persistent memory, Claude Code native execution, browser automation, multi-model speed. Not a bot. An operator.

License

Notifications You must be signed in to change notification settings

SamDev1303/claudeking.cloud

Repository files navigation

ClaudeKing 3D crown logo

Claudeking πŸ‘‘

Your Claude Code resident assistant β€” running 24/7 on your Mac via remote computer use.
No bot middleman. No subprocess overhead. Claude works directly in your workspace and sends you Telegram notifications when it's done.

Independent project. Not affiliated with or endorsed by Anthropic.

Website Β· Repository

TypeScript Claude Code Visual Generation Telegram

Why AI Assistants Forget β€” And How Koda's Brain Is Built Differently

Most AI tools start fresh every session. No memory of who you are, what rules you've set, what worked last time. You repeat yourself. They make the same mistakes.

That's not an AI problem. It's a brain structure problem.

Koda brain architecture β€” 7-layer memory system vs typical AI bot

Koda runs a 7-layer persistent memory architecture:

Layer What it stores How long
1. Identity Profile Your name, rules, tone, operator config Permanent β€” injected every session
2. Short-Term Memory Recent conversation context Last 3 days, last 12 entries
3. Long-Term Memory Rules, strategies, client info, patterns 30 days, auto-promoted
4. Monthly Rollup Compound summary of long-term entries Forever β€” never deleted
5. Semantic Embeddings Every conversation as a 3072-dim vector Up to 20,000 entries, semantic search
6. Workspace Files Brand, operator config, daily logs, projects Survives crashes and restarts
7. Background Pulse Auto-prune, compact, detect patterns Every 12 hours, 6am–11pm only

On top of memory, every message is routed intelligently before execution β€” direct chat, read-only lookup, exploration, or full worker mode β€” so the right model handles the right task every time.

The longer you work with it, the smarter it gets about you specifically. Rules set once stay set. Clients mentioned get remembered. Patterns from months ago surface when relevant.


What Claudeking Actually Does

  • Runs Claude Code as a resident assistant on your Mac, always available via Claude.ai remote computer use.
  • You open the Claude.ai app and watch the work happen live β€” no command routing, no subprocess spawning.
  • Handles coding tasks, browser automation, research, content generation, social posting, and repeatable operations directly.
  • Sends Telegram notifications when tasks complete, errors occur, or something needs your attention.
  • Keeps durable memory (short-term, long-term, monthly summaries) so context carries across sessions.
  • Calls fast/cheap LLMs (Gemini, Groq, Cerebras, OpenRouter) for aux tasks β€” embeddings, drafts, classification β€” while keeping final quality on Claude Opus 4.6.
  • Generates visual artifacts (infographics, video, slides, images) via browser-first workflows using Comet.
  • Logs all meaningful work to Notion (Execution Log, Memory Bank, Learning Ledger).

Why Remote Over Bot

Most AI bots are wrappers: you type a command, a subprocess spawns, output streams back to chat. That is slow by design.

Claudeking flips it:

  • Claude Code runs natively β€” no spawn overhead, no subprocess latency.
  • You watch it work β€” open the Claude.ai app, see every tool call and edit live.
  • Telegram is a notification rail β€” it pings you when done, not a command interface.
  • Mac is always on β€” 24/7 availability. Pick up any task anytime.
  • Multi-model speed β€” Claude Haiku/Sonnet for fast tasks, Gemini Flash for cheap aux, Groq for ultra-low latency, Opus for quality.

Best Fit

  • Founders and operators who want a Claude Code setup that works while they sleep
  • Builders who need browser automation + code execution in one runtime
  • Anyone tired of babysitting a bot and waiting for subprocess round-trips
  • Operators who care about proof, logging, and recoverable workflows

Core Capabilities

  • Resident Claude Code β€” native tool execution, no subprocess overhead
  • Remote computer use β€” Claude.ai app connects to your Mac and works directly
  • Multi-model speed layer β€” Haiku, Gemini Flash, Groq, Cerebras for fast/cheap aux tasks
  • Gemini embeddings β€” gemini-embedding-001 (3072-dim) for semantic memory recall
  • Telegram notifications β€” task complete pings, error alerts, scheduled reminders
  • Notion-backed operational memory:
    • Execution Log
    • Memory Bank
    • Learning Ledger
    • optional Cron Jobs
  • Rotating memory:
    • short-term 3 days
    • long-term 7 to 30 days
    • monthly summary rollups
  • Visual artifact generation β€” infographic, video, slides, image via browser-first workflows (Comet)
  • Social posting β€” X + LinkedIn via API (tweepy + LinkedIn REST v2)
  • Live Command Center β€” /dashboard for real-time runtime state

Quick Start

git clone https://github.com/SamDev1303/claudeking.cloud.git
cd claudeking.cloud
npm install
cp .env.example .env
# Fill in your keys, then:
npm run dev

The Telegram bot handles outbound notifications. The main interface is Claude.ai (remote computer use) pointed at this workspace.

Type-check:

npm run typecheck

Build:

npm run build

Run (production):

npm run start:resilient

Environment

Key env vars (see .env.example for the full list):

# Core
TELEGRAM_BOT_TOKEN=          # Outbound notifications
ALLOWED_USER_IDS=            # Your Telegram user ID
BRAIN_MODEL=claude-opus-4-6
WORKER_MODEL=claude-sonnet-4-6

# Speed helpers (aux tasks)
GOOGLE_AI_KEY=               # Gemini Flash + gemini-embedding-001
GROQ_API_KEY=                # Llama 4, ultra-low latency
CEREBRAS_API_KEY=            # Fastest inference

# Memory
NOTION_API_KEY=
NOTION_DAILY_LOG_DB_ID=
NOTION_MEMORY_BANK_DB_ID=
NOTION_LEARNING_LEDGER_DB_ID=

# Social
X_API_KEY=
X_ACCESS_TOKEN=
LINKEDIN_ACCESS_TOKEN=
LINKEDIN_PERSON_URN=

Runtime Notes

  • Claude Code runs natively on the operator Mac β€” no subprocess spawning.
  • Anthropic subscription powers the resident assistant (Claude Opus 4.6 for quality, Sonnet 4.6 for speed).
  • Aux tasks (embeddings, drafts, classification, formatting) delegate to Gemini, Groq, Cerebras, or OpenRouter.
  • Telegram is outbound-only. It does not accept commands. Use the Claude.ai app for that.
  • Browser work uses Comet (Perplexity Chromium) at http://localhost:9222 via CDP.
  • Visual artifact generation has no non-visual fallback. If browser/CDP is unavailable, the run stops and reports the blocker.
  • Memory is profile-first: user identity, core rules, stable preferences. Task/build churn is not promoted.
  • Pulse is the memory/logging cadence (default: 12-hour intervals).
  • Notion logging is mandatory for meaningful tasks.
  • scripts/notion_logger.py is the lightweight timestamped logger.

Codex CLI as a Worker

One of Claudeking's capabilities is Claude calling Codex CLI as a worker subprocess β€” a CLI chaining pattern where Claude orchestrates and Codex executes.

# Claude can dispatch execution tasks to Codex directly
node scripts/codex-worker.mjs --task "Refactor the auth module to use JWT"
node scripts/codex-worker.mjs --task "Write tests for src/utils/parser.ts" --model spark

What makes this powerful:

  • Codex reads CLAUDE.md automatically β€” no context repetition needed
  • Claude stays clean for orchestration while Codex handles file-heavy execution
  • Output streams in real time; Telegram notification fires on completion
  • Runs gpt-5.3-codex (ChatGPT Plus OAuth) or gpt-5.3-codex-spark for lighter tasks
  • Full file system access with workspace-write sandbox policy

This is not a subprocess hack β€” it is deliberate AI-to-AI delegation. One model handles strategy, another handles execution. The right tool for the right layer.

# Direct invocation (no wrapper needed)
~/.nvm/versions/node/v22.16.0/bin/codex exec \
  --model gpt-5.3-codex \
  --skip-git-repo-check \
  -s workspace-write \
  "Index all skills and write a summary to claudeking/brain/SKILLS.md"

Implemented Systems

  • Resident Claude Code execution with native tool use
  • Codex CLI worker β€” Claude dispatches execution tasks to gpt-5.3-codex via scripts/codex-worker.mjs
  • Multi-model speed layer: Haiku, Gemini Flash, Groq, Cerebras, OpenRouter
  • Gemini semantic embeddings for memory recall (gemini-embedding-001, 3072-dim, 100 RPM free tier)
  • Telegram outbound notification layer
  • Structured memory profiles in data/memory/profiles/
  • Active memory compaction, long-term promotion filters, and monthly summaries
  • Notion Execution Log, Memory Bank, Learning Ledger, optional Cron Jobs
  • Pulse scheduler for memory compaction and safe cron pickup
  • Lightweight timestamped Notion logger at scripts/notion_logger.py
  • Live Command Center at /dashboard with SSE + hosted snapshot sync
  • Visual artifact generation via Comet browser (infographic, video, slides, image)
  • Social posting: X (OAuth 1.0a + media upload) + LinkedIn (REST v2)
  • Secret redaction before any output
  • Structured audit logging

Reference Files

When the runtime contract changes, update these together:

  • README.md
  • CLAUDE.md β€” single source of truth
  • AGENTS.md β€” bootstrap pointer only
  • docs/FIRST_TRIAL_RUN.md
  • relevant skills/*/SKILL.md
  • public/index.html β€” user-facing product copy

Commands (Telegram β€” outbound only)

These Telegram commands are available for status checks and manual triggers:

  • /setup β€” bootstrap user identity and memory
  • /model β€” show current model
  • /mode β€” show execution mode
  • /dashboard β€” expose live Command Center URL
  • /status β€” runtime status
  • /stop β€” cancel running task
  • /selfheal β€” attempt recovery
  • /restart β€” restart runtime
  • /help β€” command list

Project Layout

claudeking.cloud/
β”œβ”€β”€ src/                        TypeScript source (compiled to dist/)
β”‚   β”œβ”€β”€ index.ts                Entry: boot, auth check, Telegram polling
β”‚   β”œβ”€β”€ config/                 Config modules
β”‚   β”‚   β”œβ”€β”€ runtime.ts          Model defaults, Notion IDs, timeouts
β”‚   β”‚   β”œβ”€β”€ telegram.ts         Bot token, user whitelist, rate limits
β”‚   β”‚   β”œβ”€β”€ paths.ts            Workspace / memory / identity dir resolution
β”‚   β”‚   β”œβ”€β”€ defaults.ts         Constants (claude-opus-4-6, claude-sonnet-4-6)
β”‚   β”‚   └── helpers.ts          Env parsers, binary path finder
β”‚   β”œβ”€β”€ telegram/
β”‚   β”‚   β”œβ”€β”€ messages.ts         Message handler β†’ route β†’ Claude β†’ Telegram stream
β”‚   β”‚   β”œβ”€β”€ commands.ts         /setup /model /mode /status /cancel /recall /help …
β”‚   β”‚   β”œβ”€β”€ handler.ts          grammy operator, auth guard, rate limiter, error boundary
β”‚   β”‚   β”œβ”€β”€ middleware.ts       Output redaction, auth whitelist
β”‚   β”‚   β”œβ”€β”€ sender.ts           StreamingSender: one message, edit-in-place across phases
β”‚   β”‚   └── media.ts            Download/upload Telegram media
β”‚   β”œβ”€β”€ claude/
β”‚   β”‚   β”œβ”€β”€ client.ts           Spawn Claude CLI, NDJSON stream, stall escalation
β”‚   β”‚   β”œβ”€β”€ session.ts          SessionManager: resume, brain hot-session, disk persistence
β”‚   β”‚   β”œβ”€β”€ spawn-mode.ts       SpawnMode = "run" | "session" type
β”‚   β”‚   β”œβ”€β”€ sandbox.ts          SANDBOX_READONLY/FULL/BROWSER policies + applyPolicy()
β”‚   β”‚   β”œβ”€β”€ prompt.ts           System prompt builder (personality + memory injection)
β”‚   β”‚   β”œβ”€β”€ parser.ts           NDJSON event parser (thinking, text, tool_*, result, error)
β”‚   β”‚   └── types.ts            ClaudeEvent, ClaudeRequestOptions interfaces
β”‚   β”œβ”€β”€ memory/
β”‚   β”‚   β”œβ”€β”€ store.ts            CRUD: events (JSONL) + snapshots (Markdown)
β”‚   β”‚   β”œβ”€β”€ profile.ts          Per-user profiles (name, tier, prefs)
β”‚   β”‚   β”œβ”€β”€ embeddings.ts       Semantic recall: Gemini embeddings, cosine similarity, auto-prune
β”‚   β”‚   β”œβ”€β”€ journal.ts          Execution logs, learning events, manual notes
β”‚   β”‚   └── sessions.ts         Claude session resume state
β”‚   β”œβ”€β”€ models/
β”‚   β”‚   β”œβ”€β”€ router.ts           Classify: direct_chat | direct_readonly | worker_required | exploration
β”‚   β”‚   β”œβ”€β”€ providers.ts        External LLMs (Gemini, Groq, Cerebras, xAI, OpenRouter …)
β”‚   β”‚   └── aux-router.ts       Delegate aux tasks to fast/cheap models
β”‚   β”œβ”€β”€ runtime/
β”‚   β”‚   β”œβ”€β”€ types.ts            Core enums: RoutingClass, ExecutionMode, BackendId, MemoryKind
β”‚   β”‚   β”œβ”€β”€ backends.ts         Backend adapter factory
β”‚   β”‚   β”œβ”€β”€ dashboard-server.ts SSE server for live command center (127.0.0.1:8787)
β”‚   β”‚   β”œβ”€β”€ dashboard-store.ts  In-memory dashboard state
β”‚   β”‚   β”œβ”€β”€ pulse.ts            Cron scheduler (Notion-backed optional)
β”‚   β”‚   └── heartbeat-policy.ts Background maintenance schedule
β”‚   β”œβ”€β”€ integrations/
β”‚   β”‚   β”œβ”€β”€ notion-daily-log.ts Execution Log, Memory Bank, Learning Ledger writes
β”‚   β”‚   β”œβ”€β”€ hostinger-mail.ts   SMTP outbound (primary)
β”‚   β”‚   β”œβ”€β”€ resend-mail.ts      Transactional email via Resend API
β”‚   β”‚   β”œβ”€β”€ social-poster.ts    X/Twitter + LinkedIn via API
β”‚   β”‚   └── voice-actions.ts    Twilio calls/SMS + ElevenLabs TTS
β”‚   β”œβ”€β”€ utils/
β”‚   β”‚   β”œβ”€β”€ logger.ts           Structured logging (INFO/WARN/ERROR/DEBUG)
β”‚   β”‚   β”œβ”€β”€ guard.ts            Secret redaction before Telegram output
β”‚   β”‚   β”œβ”€β”€ env-secrets.ts      Load from ~/.claude/env/ (shared, personal, client)
β”‚   β”‚   β”œβ”€β”€ run-queue.ts        Sequential execution queue per chat
β”‚   β”‚   └── buffer.ts           Ring buffer for streaming chunks
β”‚   └── browser/cdp.ts          Chrome DevTools Protocol connector (Comet at :9222)
β”œβ”€β”€ skills/                     Agent skill playbooks (SKILL.md per skill)
β”‚   β”œβ”€β”€ 00-skill-creator/       Scaffold new skills
β”‚   β”œβ”€β”€ 01-strategy-check/      Pre-task strategy validation
β”‚   β”œβ”€β”€ 05-code-build/          Build + test execution
β”‚   β”œβ”€β”€ 08-notion-logger/       Structured Notion logging
β”‚   β”œβ”€β”€ 09-media-generator/     Image/video/audio generation workflows
β”‚   β”œβ”€β”€ 11-playwright-cdp-debug/ Browser automation debugging
β”‚   └── 12-self-learning/       Self-improvement + lesson promotion
β”œβ”€β”€ scripts/                    Standalone tools
β”‚   β”œβ”€β”€ notion_logger.py        Lightweight Notion logger
β”‚   β”œβ”€β”€ post-to-x.py            X/Twitter posting (tweepy, OAuth 1.0a)
β”‚   └── post-to-linkedin.py     LinkedIn posting (REST v2)
β”œβ”€β”€ public/                     Static landing page (Vercel)
β”‚   └── index.html
β”œβ”€β”€ claudeking/                 Generated output (gitignored)
β”œβ”€β”€ data/                       Runtime memory + embeddings (gitignored)
β”œβ”€β”€ CLAUDE.md                   Home base config β€” single source of truth
β”œβ”€β”€ AGENTS.md                   Bootstrap pointer only
└── .env                        Secrets (gitignored)

About

πŸ‘‘ Your resident AI operator β€” 7-layer persistent memory, Claude Code native execution, browser automation, multi-model speed. Not a bot. An operator.

Topics

Resources

License

Contributing

Security policy

Stars

Watchers

Forks

Packages

 
 
 

Contributors