Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

nyem69/jinn

Repository files navigation

🧞 Jinn

Lightweight AI gateway daemon orchestrating Claude Code, Codex, and Gemini CLI.

Jinn Web Dashboard

What is Jinn?

Jinn is an open-source AI gateway that wraps the Claude Code CLI, Codex SDK, and Gemini CLI behind a unified daemon process. It routes tasks to AI engines, manages connectors like Slack, and schedules background work via cron. Jinn is a bus, not a brain.

πŸ’‘ Why Jinn?

Most AI agent frameworks reinvent the wheel β€” custom tool-calling loops, brittle context management, hand-rolled retry logic. Then they charge you per API call on top.

Jinn takes a different approach. It wraps battle-tested professional CLI tools (Claude Code, Codex, Gemini CLI) and adds only what they're missing: routing, scheduling, connectors, and an org system.

πŸ”‘ Works with your Anthropic Max subscription

Because Jinn uses Claude Code CLI under the hood β€” Anthropic's own first-party tool β€” it works with the 200ドル/mo Max subscription. No per-token API billing. No surprise 500ドル invoices. Flat rate, unlimited usage.

Other frameworks can't do this. Anthropic banned third-party tools from using Max subscription OAuth tokens in January 2026. Since Jinn delegates to the official CLI, it's fully supported.

🧞 Jinn vs OpenClaw

Jinn OpenClaw
Architecture Wraps professional CLIs (Claude Code, Codex, Gemini) Custom agentic loop
Max subscription βœ… Works (uses official Claude Code CLI) ❌ Banned since Jan 2026
Typical cost 200ドル/mo flat (Max) or pay-per-use 300ドル–750/mo API bills (reported by users)
Security Inherits Claude Code's security model 512 vulnerabilities found by CrowdStrike
Memory & context Handled natively by Claude Code Custom implementation with known context-drop bugs
Cron scheduling βœ… Built-in, hot-reloadable ❌ Fires in wrong agent context
Slack integration βœ… Thread-aware, reaction workflow ❌ Drops agent-to-agent messages
Multi-agent org Departments, ranks, managers, boards Flat agent list
Self-modification Agents can edit their own config at runtime Limited

🧠 The "bus, not brain" philosophy

Jinn adds zero custom AI logic. No prompt engineering layer. No opinions on how agents should think. All intelligence comes from the engines themselves β€” Claude Code already handles tool use, file editing, multi-step reasoning, and memory. Jinn just connects it to the outside world.

When Claude Code gets better, Jinn gets better β€” automatically.

✨ Features

  • πŸ”Œ Triple engine support β€” Claude Code CLI + Codex SDK + Gemini CLI
  • πŸ’¬ Connectors β€” Slack (threads + reactions), WhatsApp (QR auth), Discord (bot)
  • πŸ“Ž File attachments β€” drag & drop files into web chat, passed through to engines
  • πŸ“± Mobile-responsive β€” collapsible sidebar and mobile-friendly dashboard
  • ⏰ Cron scheduling β€” hot-reloadable background jobs
  • πŸ‘₯ AI org system β€” departments, ranks, managers, employees, task boards
  • 🌐 Web dashboard β€” chat, org map, kanban, cost tracking, cron visualizer
  • πŸ”„ Hot-reload β€” change config, cron, or org files without restarting
  • πŸ› οΈ Self-modification β€” agents can edit their own config, skills, and org at runtime
  • πŸ“¦ Skills system β€” reusable markdown playbooks that engines follow natively
  • 🏒 Multi-instance β€” run multiple isolated Jinn instances side by side
  • πŸ”— MCP support β€” connect to any MCP server
  • ⏱️ Session timeouts β€” kill runaway sessions after configurable duration (global or per-employee)
  • 🀝 Synchronous employee invocation β€” invoke_employee MCP tool for inline sub-tasks
  • πŸ—œοΈ Session compaction β€” auto-summarize old messages when token count exceeds threshold
  • πŸͺ Hook pipeline β€” pre/post session and tool observation hooks (shell or JS modules)

πŸš€ Quick Start

npm install -g jinn-cli
jinn setup
jinn start

Or install via Homebrew:

brew tap hristo2612/jinn https://github.com/hristo2612/jinn
brew install jinn
jinn setup
jinn start

Then open http://localhost:7777.

πŸ—οΈ Architecture

 +----------------+
 | jinn CLI |
 +-------+--------+
 |
 +-------v--------+
 | Gateway |
 | Daemon |
 +--+--+--+--+---+
 | | | |
 +--------------+ | | +--------------+
 | | | |
 +-------v-------+ +------v------+ +-----------v---+
 | Engines | | Connectors | | Web UI |
 |Claude|Codex|Gem| | Slack|WA|DC | | localhost:7777|
 +----------------+ +-------------+ +---------------+
 | |
 +-------v-------+ +------v------+
 | Cron | | Org |
 | Scheduler | | System |
 +---------------+ +-------------+

The CLI sends commands to the gateway daemon. The daemon dispatches work to AI engines (Claude Code, Codex, Gemini CLI), manages connector integrations, runs scheduled cron jobs, and serves the web dashboard.

βš™οΈ Configuration

Jinn reads its configuration from ~/.jinn/config.yaml. An example:

gateway:
 port: 7777
engines:
 claude:
 enabled: true
 codex:
 enabled: false
sessions:
 maxDurationMinutes: 30 # kill sessions that run longer than this
connectors:
 slack:
 enabled: true
 app_token: xapp-...
 bot_token: xoxb-...
cron:
 jobs:
 - name: daily-review
 schedule: "0 9 * * *"
 task: "Review open PRs"
mcp:
 gateway:
 enabled: true # expose gateway tools to employees via MCP
org:
 agents:
 - name: reviewer
 role: code-review

Session Timeouts

Sessions can be time-limited at two levels. The global sessions.maxDurationMinutes in config.yaml applies to all sessions. Per-employee overrides take precedence:

# org/historian.yaml
maxDurationMinutes: 10 # override global limit for this employee

When a session exceeds its limit, the engine process is killed via SIGTERM. If the engine hasn't started yet (session queued), it is marked as interrupted directly.

Session Compaction

Long-running sessions accumulate messages that can overflow transcript syncs and bloat API responses. Compaction automatically summarizes older messages when the estimated token count exceeds a threshold:

sessions:
 compaction:
 enabled: true
 maxEstimatedTokens: 50000 # trigger compaction above this
 preserveRecentMessages: 6 # keep last N messages verbatim

Compacted messages are replaced with a single structured summary (role: "summary") containing scope, recent user requests, key topics, pending work, and a timeline. Re-compaction merges with existing summaries. The compacted_at field on sessions tracks when compaction last ran.

Hook Pipeline

Hooks provide observable middleware at session and tool-use boundaries. Define hooks in config.yaml:

hooks:
 preSession: # before engine.run() β€” can modify prompt or abort
 - type: shell
 command: ./hooks/inject-context.sh
 blocking: true
 timeoutMs: 5000
 postSession: # after engine.run() β€” fire-and-forget
 - type: module
 path: ./hooks/cost-logger.mjs
 onToolUse: # when engine starts a tool β€” fire-and-forget
 - type: module
 path: ./hooks/tool-usage-tracker.mjs
 onToolResult: # when a tool finishes β€” fire-and-forget
 - type: shell
 command: ./hooks/audit.sh

Hook types:

  • shell β€” spawns a subprocess, pipes JSON payload to stdin, reads stdout. Exit 0 = allow, exit 2 = deny/abort.
  • module β€” dynamically imports a JS/TS module with a default async function export. Cached after first load.

Hook events:

Event Blocking? Can modify?
preSession Optional prompt, systemPrompt; can abort
postSession No Read-only (cost, result, duration)
onToolUse No Read-only (toolName, toolId)
onToolResult No Read-only (toolName, toolId)

Fire-and-forget hooks are concurrency-limited (max 5 concurrent) and never crash the session on failure.

Synchronous Employee Invocation

The invoke_employee MCP tool lets employees call other employees inline and get the result back synchronously β€” useful for fact-checks, lookups, and data formatting without the complexity of async child sessions:

invoke_employee(employee: "historian", prompt: "When was GE14?")
β†’ { status: "idle", result: "GE14 was held on 9 May 2018...", durationMs: 16045 }

Timeout is clamped to 600s max. Orphaned child sessions are automatically interrupted on timeout.

πŸ“ Project Structure

jinn/
 packages/
 jimmy/ # Core gateway daemon + CLI
 web/ # Web dashboard (frontend)
 turbo.json # Turborepo build configuration
 pnpm-workspace.yaml
 tsconfig.base.json

πŸ§‘β€πŸ’» Development

git clone https://github.com/hristo2612/jinn.git
cd jinn
pnpm install
pnpm setup # one-time: builds all packages and creates ~/.jinn
pnpm dev # starts gateway + Next.js dev server with hot reload

Open http://localhost:3000 to use the web dashboard.

pnpm dev starts two servers behind the scenes: the gateway daemon on :7777 (API, WebSocket, connectors) and the Next.js dev server on :3000 (web dashboard with hot reload). Next.js rewrites proxy /api/* and /ws requests from :3000 to the gateway, so you only need to visit :3000. The gateway auto-restarts when you edit backend source files via Node's built-in --watch mode. To use a non-default gateway port, set GATEWAY_PORT=<port> before running pnpm dev.

Prerequisites: Node.js 22+, pnpm 10+, and the Claude Code CLI (npm install -g @anthropic-ai/claude-code).

Available Scripts

Command Description
pnpm setup Build all packages and initialize ~/.jinn (one-time)
pnpm dev Start gateway (:7777) + Next.js dev server (:3000) with hot reload
pnpm start Production-style clean build + start gateway on :7777
pnpm stop Stop the running gateway daemon
pnpm status Check if the gateway daemon is running
pnpm build Build all packages
pnpm typecheck Run TypeScript type checking
pnpm lint Lint all packages
pnpm clean Clean build artifacts

πŸ—ΊοΈ Roadmap

Jinn is under active development. Here's what's coming:

πŸ”Œ Connectors

  • Discord β€” bot integration via discord.js
  • WhatsApp β€” Baileys-based connector with QR auth and media support
  • Telegram β€” bot API connector with polling and user allowlist
  • iMessage β€” macOS-native via AppleScript bridge
  • Email β€” IMAP/SMTP connector for inbox monitoring and replies
  • Webhooks β€” generic inbound/outbound HTTP webhooks

🧠 Engines

  • Gemini CLI β€” Google's Gemini as a third engine option
  • Local models β€” Ollama / llama.cpp integration for offline use
  • Engine fallback chains β€” auto-failover to Codex when Claude is rate-limited

πŸ‘₯ Org System

  • Agent-to-agent messaging β€” direct communication without board intermediary
  • Shared memory β€” cross-session knowledge that persists across employees
  • Performance tracking β€” employee performance archive with task success rates and quality scoring
  • Auto-promotion β€” promote employees to manager based on track record

🌐 Web Dashboard

  • Mobile-responsive UI β€” collapsible sidebar, mobile-friendly chat
  • Live streaming β€” watch agent responses stream in real-time
  • File attachments β€” drag & drop files into chat with engine passthrough
  • Approval workflows β€” approve/reject agent actions from the dashboard
  • Cost analytics β€” per-employee cost tracking via hook pipeline (costs.jsonl)

πŸ› οΈ Platform

  • Plugin system β€” installable plugins for common integrations (Stripe, Linear, GitHub)
  • Session timeouts β€” configurable maxDurationMinutes per-employee or global
  • Session compaction β€” auto-summarize old messages to bound context growth
  • Hook pipeline β€” pre/post session and tool observation middleware
  • REST API auth β€” API keys for secure remote access
  • Multi-user support β€” team access with roles and permissions
  • Docker image β€” one-command deployment with docker run

πŸ“¦ Skills

  • Skills marketplace β€” browse and install community skills from skills.sh
  • Skill versioning β€” pin skill versions, auto-update with changelogs
  • Skill templates β€” scaffolding for common patterns (blog pipeline, support inbox, etc.)

Want to suggest a feature? Open an issue.

πŸ™ Acknowledgments

The web dashboard UI is built on components from ClawPort UI by John Rice, adapted for Jinn's architecture. ClawPort provides the foundation for the theme system, shadcn components, org map, kanban board, cost dashboard, and activity console.

πŸ“„ License

MIT

🀝 Contributing

See CONTRIBUTING.md for guidelines on setting up your development environment and submitting pull requests.

About

Lightweight AI gateway daemon orchestrating Claude Code, Codex, and Gemini CLI.

Resources

License

Contributing

Stars

Watchers

Forks

Packages

Contributors

Languages

  • TypeScript 97.4%
  • JavaScript 1.3%
  • CSS 1.2%
  • Ruby 0.1%

AltStyle γ«γ‚ˆγ£γ¦ε€‰ζ›γ•γ‚ŒγŸγƒšγƒΌγ‚Έ (->γ‚ͺγƒͺγ‚ΈγƒŠγƒ«) /