How kkelly-offical/kkcode works
KK Code is a terminal-first AI coding workspace, with Web, Android, and remote-device clients. The main workflow is a user prompt entering the CLI/session engine, proceeding through a turn loop to a configured model, and returning a response; modes, permissions, and tools shape that work. Other product branches include durable/background tasks, strict runs and artifacts, browser and MCP integrations, and shared remote sessions. The README documents major capabilities not fully visible in the sampled source; their paths below are supported by the tree, while uncertain internal call links are omitted.
Main entry points: engine.mjs Session Engine · executor.mjs Tool Executor · server.mjs Device API · MainActivity.kt Android Client
Components 24
User Interfaces
- CLI Entry
src/index.mjs - Terminal REPL
src/repl.mjs - Web Client
apps/web/src/main.tsx - Android Client
android/app/src/main/java/cn/kkcode/remote/MainActivity.kt
Session Runtime
- Session Engine
src/kernel/session/engine.mjs - Turn Loop
src/kernel/session/loop.mjs - Session Store
src/kernel/session/store.mjs - Background Tasks
src/kernel/orchestration/background-manager.mjs
Governed Work
- Permission Engine
src/kernel/permission/engine.mjs - Strict Runs
src/kernel/orchestration/run-coordinator.mjs - Artifacts
src/storage/artifact-store.mjs - Audit Trail
src/storage/audit-store.mjs
Tools And Models
- Model Providers
src/kernel/provider/router.mjs - Tool Executor
src/kernel/tool/executor.mjs - Browser Tools
src/kernel/browser/controller.mjs - MCP Clients
src/kernel/mcp/registry.mjs - Plugins And Skills
src/kernel/plugin/manager.mjs
Remote Access
- Device API
src/device/server.mjs - Remote Gateway
apps/gateway/main.mjs - Android SSH
src/remote/ssh-host.mjs - Web SDK Client
src/sdk/client.mjs
Other components
- User
- Model Service
- Remote User
Connections 23
- User → CLI Entry: starts
- CLI Entry → Terminal REPL: opens
- Terminal REPL → Session Engine: submits prompt
- Session Engine → Turn Loop: runs turn
- Turn Loop → Model Providers: requests completion
- Model Providers → Model Service: sends request
- Session Engine → Session Store: reads and updates
- User → Web Client: uses
- Web Client → Web SDK Client: calls
- Web SDK Client → Device API: sends RPC
- Android Client → Device API: connects
- Android Client → Android SSH: connects directly
- Remote User → Remote Gateway: authenticates
- Remote Gateway → Device API: relays access
- Device API → Session Store: shares sessions
- Tool Executor → Permission Engine: checks authorization
- Tool Executor → Browser Tools: dispatches browser work
- Tool Executor → MCP Clients: dispatches MCP tools
- Session Engine → Background Tasks: supports long work
- Session Engine → Strict Runs: coordinates strict runs
- Strict Runs → Artifacts: records evidence
- Permission Engine → Audit Trail: writes decisions
- Plugins And Skills → Tool Executor: extends tools