hasharot
Health Uyari
- License Γ’β¬β License: MIT
- Description Γ’β¬β Repository has a description
- Active repo Γ’β¬β Last push 0 days ago
- Low visibility Γ’β¬β Only 7 GitHub stars
Code Basarisiz
- network request Γ’β¬β Outbound network request in src/audio/transcribe.ts
- process.env Γ’β¬β Environment variable access in src/bot/bot.ts
- process.env Γ’β¬β Environment variable access in src/bot/handlers/message.handler.ts
- network request Γ’β¬β Outbound network request in src/bot/handlers/message.handler.ts
- fs.rmSync Γ’β¬β Destructive file system operation in src/bot/handlers/photo.handler.ts
- fs.rmSync Γ’β¬β Destructive file system operation in src/bot/handlers/voice.handler.ts
Permissions Gecti
- Permissions Γ’β¬β No dangerous permissions requested
Bu listing icin henuz AI raporu yok.
π Control a real Claude Code AI agent on your machine from Telegram β code, run commands, voice, files & multi-user team access. Self-hosted personal AI assistant. (Hasharot β ishlaringizni hashar qilib bitiring.)
Hasharot π
Hasharot β ishlaringizni hashar qilib bitiring.
Your and your teammates' personal AI agent, running on your machine, controlled from Telegram.
Telegram βββΆ Grammy Bot βββΆ Claude Agent SDK βββΆ Your Machine
voice/text command router agentic runtime bash, files, code
Features Β· Quick Start Β· Commands Β· Team Workflow Β· Configuration Β· Architecture Β· Context & Memory Β· Roadmap
What is this?
Hasharot bridges Telegram to a full Claude Code agent running locally on your machine. Send a message in Telegram β Claude reads your files, runs commands, writes code, browses Reddit, fetches Medium articles, transcribes voice notes, and speaks responses back. All from your phone.
This is not a simple API wrapper. It's the real Claude Code agent with tool access β Bash, file I/O, code editing, web browsing β packaged behind a Telegram interface with streaming responses, session memory, rich output formatting, and a multi-user access-control layer.
Why it's different:
- π§ The real agent, not a chat wrapper β Bash, file I/O, code editing, and web access, driven by the Claude Agent SDK
- π± Your machine, your phone β code and secrets never leave your computer; you just drive it from Telegram
- π₯ Team-ready β per-user sandboxing, owner approvals, and one parallel session per forum topic
- π Voice in, voice out β talk to your codebase and hear it answer back
- π Delegate & forget β hand a task to an autonomous Paperclip agent and get the finished result (with docs, links, and follow-up questions) pushed back to Telegram
β If Hasharot looks useful, star the repo β it helps others find it and it genuinely makes our day.
Features
Agent Core
Reddit Integration
Media Extraction
Medium Integration
|
Voice & Audio
Rich Output
Terminal UI
MCP Tools (Intelligent Routing)
Forum Topic Sessions
Image Uploads
Access Control & Approvals
Paperclip Integration
|
Quick Start
β‘ Zero-effort: let your AI agent install it
Already using a coding agent (Claude Code, Cursor, Codex, β¦)? Just paste this one line into it β the agent does the whole setup and only asks you for a bot token and your Telegram ID:
Fetch https://raw.githubusercontent.com/Mamasodikov/hasharot/main/docs/AGENT_SETUP.md and follow it to set up Hasharot on this machine.
Prefer doing it by hand? Continue below.
Prerequisites
| Requirement | Notes |
|---|---|
| Node.js 22+ | with npm |
| Claude Code CLI | installed and authenticated β claude in your PATH |
| Telegram bot token | from @BotFather |
| Your Telegram user ID | from @userinfobot |
Setup
git clone https://github.com/Mamasodikov/hasharot.git
cd hasharot
cp .env.example .env
Edit .env:
TELEGRAM_BOT_TOKEN=your_bot_token
ALLOWED_USER_IDS=your_user_id
OWNER_USER_ID=your_user_id # you = admin (approvals, /access, /answer_policy)
Run
npm install
npm run dev # dev mode with hot reload
Open your bot in Telegram β /start
Commands
Session
| Command | Description |
|---|---|
/start |
Welcome message |
/project |
Set working directory (interactive picker) |
/newproject <name> |
Create and switch to a new project |
/default [off] |
Show or clear this chat's default project |
/clear |
Clear conversation + session |
/status |
Current session info |
/sessions |
List saved sessions |
/resume |
Pick from recent sessions |
/continue |
Resume most recent session |
/teleport |
Move session to terminal (forked) |
Agent Modes
| Command | Description |
|---|---|
/plan |
Plan mode for complex tasks |
/explore |
Explore codebase to answer questions |
/loop |
Run iteratively until task complete |
/model |
Switch Sonnet / Opus / Haiku |
/provider |
Switch AI provider (Claude / OpenCode) |
/mode |
Toggle streaming / wait |
/terminalui |
Toggle terminal-style display |
Access Control (Owner)
| Command | Description |
|---|---|
/access |
List pending / approved / blocked users |
/allow_user |
Whitelist a user + open permission/folder setup |
/permissions |
Set a user's permissions & folders |
/sandbox_folder |
Multi-select folders to sandbox a user |
/answer_policy |
Configure when the bot answers (alias / reply / @mention, or everything) |
/approval_timeout |
How long approval requests wait β 5mβ¦3h presets or βΎοΈ unlimited |
/deny_user |
Deny a request or revoke access |
/block_user |
Hard-block a user (bot ignores them completely) |
Content
| Command | Description |
|---|---|
/reddit |
Fetch Reddit posts, subreddits, profiles |
/vreddit |
Download Reddit-hosted videos |
/medium |
Fetch Medium articles via Freedium |
/file |
Download a project file |
/telegraph |
Toggle Instant View for long responses |
/extract <url> |
Download media from YouTube, TikTok, Instagram |
Voice & TTS
| Command | Description |
|---|---|
/tts |
Toggle voice replies, pick voice |
/transcribe |
Transcribe audio to text |
| Send voice note | Auto-transcribed β processed by Claude |
Utility
| Command | Description |
|---|---|
/ping |
Health check |
/context |
Show Claude context / token usage |
/botstatus |
Bot process status |
/restartbot |
Restart the bot |
/cancel |
Cancel current request |
/commands |
Show all commands |
/softreset |
Soft reset (cancel + clear session) |
Team Workflow β Topics
Hasharot is built for hashar β many people getting work done together. The core primitive is Telegram forum Topics: in a supergroup with Topics enabled, every topic runs as a fully independent session with its own project, model, and conversation memory. Zero configuration needed.
Recommended setup: one topic per role
π General β announcements, coordination (bot stays quiet unless addressed)
π¨ Frontender β pinned to the frontend project
βοΈ Backender β pinned to the backend project
π DevOps β pinned to infra / deploy scripts
π§ͺ QA β pinned to the test suite
- Create a topic for each role or workstream (Frontender, Backender, DevOps, β¦).
- Pin a project inside each topic with
/project(or set it once with/default) β the topic remembers it. - Work in parallel β a long-running task in the Backender topic never blocks or pollutes the Frontender topic's context. Each teammate talks to the agent in their own lane.
- Sandbox teammates (owner) β grant each user their own folder with
/sandbox_folder, so the Frontender can only touch the frontend project even if they wander into another topic.
Tip: keep one "General" topic un-pinned for coordination. By default the bot stays silent in group chats until directly addressed β by an alias name, a reply to its message, or an @mention. The owner tunes all of this live with
/answer_policy: toggle each trigger on/off, add/remove alias names, or switch to answer-everything mode (with a warning β it will reply to normal human conversation too).
Same project, multiple people?
Today the cleanest pattern is one topic per person per project (e.g. myapp β Alice, myapp β Bob) β each gets an independent session over the same folder. True parallel editing isolation is on the roadmap below.
Optional Integrations
Reddit β/reddit & /vreddit
/reddit is now a pure TypeScript module using Reddit's OAuth2 API directly β no external Python dependency.
# .env
REDDIT_CLIENT_ID=your_client_id
REDDIT_CLIENT_SECRET=your_client_secret
REDDIT_USERNAME=bot_account
REDDIT_PASSWORD=bot_password
Create a "script" app at https://www.reddit.com/prefs/apps/. Use a dedicated bot account β NOT your personal credentials. Video downloads need ffmpeg and ffprobe on your PATH.
/medium
Pure TypeScript via Freedium mirror β no extra dependencies.
# .env (optional tuning)
FREEDIUM_HOST=freedium-mirror.cfd
MEDIUM_TIMEOUT_MS=15000
Voice Transcription β Groq Whisper
# .env
GROQ_API_KEY=your_groq_key
GROQ_TRANSCRIBE_PATH=/absolute/path/to/groq_transcribe.py
Text-to-Speech β OpenAI TTS
# .env
OPENAI_API_KEY=your_openai_key
TTS_MODEL=gpt-4o-mini-tts
TTS_VOICE=coral
TTS_RESPONSE_FORMAT=opus
13 voices available: alloy, ash, ballad, cedar, coral, echo, fable, marin, nova, onyx, sage, shimmer, verse
Configuration Reference
All config lives in .env. See .env.example for the full annotated reference.
Required
| Variable | Description |
|---|---|
TELEGRAM_BOT_TOKEN |
Bot token from @BotFather |
ALLOWED_USER_IDS |
Comma-separated Telegram user IDs |
Core
| Variable | Default | Description |
|---|---|---|
ANTHROPIC_API_KEY |
β | API key (optional with Claude Max subscription) |
WORKSPACE_DIR |
$HOME |
Root directory for project picker |
CLAUDE_EXECUTABLE_PATH |
claude |
Path to Claude Code CLI |
BOT_NAME |
Hasharot |
Bot name in system prompt |
STREAMING_MODE |
streaming |
streaming or wait |
DANGEROUS_MODE |
false |
Auto-approve all tool permissions |
CANCEL_ON_NEW_MESSAGE |
false |
Auto-cancel running query on new message |
CLAUDE_SDK_LOG_LEVEL |
off |
SDK log level: off, basic, verbose, trace |
| Variable | Default | Description |
|---|---|---|
REDDIT_CLIENT_ID |
β | Reddit OAuth2 client ID |
REDDIT_CLIENT_SECRET |
β | Reddit OAuth2 client secret |
REDDIT_USERNAME |
β | Reddit bot account username |
REDDIT_PASSWORD |
β | Reddit bot account password |
REDDIT_VIDEO_MAX_SIZE_MB |
50 |
Max video size before compression |
REDDITFETCH_TIMEOUT_MS |
30000 |
Execution timeout |
REDDITFETCH_JSON_THRESHOLD_CHARS |
8000 |
Auto-switch to JSON output |
Medium / Freedium
| Variable | Default | Description |
|---|---|---|
FREEDIUM_HOST |
freedium-mirror.cfd |
Freedium mirror host |
MEDIUM_TIMEOUT_MS |
15000 |
Fetch timeout |
MEDIUM_FILE_THRESHOLD_CHARS |
8000 |
File save threshold |
Media Extraction
| Variable | Default | Description |
|---|---|---|
EXTRACT_ENABLED |
true |
Enable /extract command |
YTDLP_COOKIES_PATH |
β | Netscape cookies.txt for yt-dlp |
Voice & TTS
| Variable | Default | Description |
|---|---|---|
GROQ_API_KEY |
β | Groq API key for Whisper |
GROQ_TRANSCRIBE_PATH |
β | Path to groq_transcribe.py |
OPENAI_API_KEY |
β | OpenAI API key for TTS |
TTS_VOICE |
coral |
Default TTS voice |
TTS_MODEL |
gpt-4o-mini-tts |
TTS model |
VOICE_SHOW_TRANSCRIPT |
true |
Show transcript text before agent response |
Architecture
src/
βββ bot/
β βββ bot.ts # Bot setup, handler registration
β βββ handlers/
β β βββ command.handler.ts # All slash commands + inline keyboards
β β βββ message.handler.ts # Text routing, ForceReply dispatch
β β βββ voice.handler.ts # Voice download, transcription, agent relay
β β βββ photo.handler.ts # Image save + agent notification
β βββ middleware/
β βββ auth.middleware.ts # User whitelist + group chat auth
β βββ stale-filter.ts # Ignore stale messages on restart
βββ claude/
β βββ agent.ts # Claude Agent SDK, session resume, system prompt
β βββ mcp-tools.ts # MCP server: Reddit, Medium, Extract, Telegraph tools
β βββ session-manager.ts # Per-chat session state
β βββ session-history.ts # Session persistence and history
β βββ request-queue.ts # Sequential request queue
β βββ command-parser.ts # Help text + command descriptions
β βββ agent-watchdog.ts # Watchdog for long-running agent tasks
βββ reddit/
β βββ redditfetch.ts # Native TypeScript Reddit client (OAuth2)
β βββ vreddit.ts # Reddit video download + compression pipeline
βββ medium/
β βββ freedium.ts # Freedium article fetcher
βββ media/
β βββ extract.ts # YouTube/TikTok/Instagram extraction (yt-dlp)
βββ telegram/
β βββ message-sender.ts # Streaming, chunking, Telegraph routing
β βββ markdown.ts # MarkdownV2 escaping
β βββ telegraph.ts # Telegraph Instant View client
β βββ telegraph-settings.ts # Per-chat Telegraph toggle
β βββ terminal-renderer.ts # Terminal-style UI renderer
β βββ terminal-settings.ts # Per-chat terminal UI toggle
β βββ deduplication.ts # Message dedup
βββ tts/
β βββ tts.ts # TTS provider routing (Groq Orpheus / OpenAI)
β βββ tts-settings.ts # Per-chat voice settings
β βββ voice-reply.ts # TTS hook for agent responses
βββ audio/
β βββ transcribe.ts # Shared transcription utilities
βββ utils/
β βββ download.ts # URL download with SSRF protection
β βββ sanitize.ts # Path and error sanitization
β βββ workspace-guard.ts # Workspace boundary enforcement
β βββ url-guard.ts # URL validation (protocol, SSRF)
β βββ file-type.ts # File content validation
β βββ caffeinate.ts # macOS sleep prevention
β βββ session-key.ts # Session key generation (DM + forum topics)
β βββ agent-timer.ts # Agent execution timing
β βββ debug-agent.ts # Debug utilities
βββ config.ts # Zod-validated environment config
βββ index.ts # Entry point
Context & Memory
The agent's context is assembled from five layers on every query (see agent.ts):
| # | Layer | Source | Notes |
|---|---|---|---|
| 1 | Claude Code preset | Agent SDK (preset: 'claude_code') |
The same base system prompt as terminal Claude Code β Hasharot is a full agent, not an API wrapper |
| 2 | Bot prompt (static) | agent.ts + conduct.ts |
Persona guidelines, Telegram/Telegraph output formatting, access-model conduct rules, MCP tool usage hints |
| 3 | SYSTEM_PROMPT_FILE |
Path set in .env |
Optional identity/memory file appended to every query. Re-read on change (mtime-cached) β edit it and the next message already uses it, no restart |
| 4 | Speaker prompt (dynamic) | Built per message | Who is talking right now: name, group note, and their real access level (owner / sandboxed + folders / trusted) |
| 5 | Claude Code memories | settingSources: ['project', 'user'] |
β
Standard CLAUDE.md support β see below |
CLAUDE.md works out of the box
- Project memory β the
CLAUDE.md(and.claude/settings) of the opened project folder is loaded automatically. Every project carries its own memory: open~/projects/myappandmyapp/CLAUDE.mdis in context for that chat. - User memory β
~/.claude/CLAUDE.md(the machine owner's global memory) is loaded in every session. - Conversation memory β sessions live in Claude Code's own session store;
/continueand/resumerestore the full history, and the working project is remembered per chat.
Tip: put project-specific instructions in that project's
CLAUDE.md(picked up instantly per chat), and bot-wide personality/rules in theSYSTEM_PROMPT_FILEβ both apply without restarting the bot.
Development
npm run dev # Dev mode with hot reload (tsx watch)
npm run typecheck # Type check only
npm run build # Compile to dist/
npm start # Run compiled build
Bot Control Script
./scripts/hasharot-botctl.sh dev start # Start dev mode
./scripts/hasharot-botctl.sh dev restart # Restart dev
./scripts/hasharot-botctl.sh prod start # Start production
./scripts/hasharot-botctl.sh dev log # Tail logs
./scripts/hasharot-botctl.sh dev status # Check if running
Self-Editing Workflow
If Hasharot is editing its own codebase, use prod mode to avoid hot-reload restarts:
./scripts/hasharot-botctl.sh prod start # No hot reload
# ... let Claude edit files ...
./scripts/hasharot-botctl.sh prod restart # Apply changes
Then /continue or /resume in Telegram to restore your session.
Prod runs compiled code.
prod start/restartbuilds (tsc) first, so a restart always reflects the current source β a build error fails fast instead of serving a staledist/.
Run it 24/7 (launchd)
For a bot that survives crashes and reboots, install the LaunchAgent template:
cp scripts/com.hasharot.bot.plist.example ~/Library/LaunchAgents/com.hasharot.bot.plist
# edit the paths inside (repo dir + absolute `which node`), then:
npm run build
launchctl load ~/Library/LaunchAgents/com.hasharot.bot.plist
KeepAlive=true restarts the process on exit; RunAtLoad starts it at login. Without a supervisor the bot stays down after a crash or reboot until manually restarted.
Backup
All state lives in ~/.hasharot (access grants + per-user sandbox paths, sessions, settings). It's a single copy on one disk β losing access-control.json silently revokes every approved teammate. Back it up (Time Machine covers it, or tar czf hasharot-backup.tgz ~/.hasharot).
Security
- User whitelist β only approved Telegram IDs can interact; the owner (
OWNER_USER_ID) approves everyone else - Per-user sandbox β restricted users are jailed to an owner-granted folder allowlist, captured per-query (revoking mid-query can't loosen it); every file and shell op is path-checked with symlink resolution, and interpreters (
python -c,node -e, β¦) and hidden-path escapes (--output=/etc/x) are routed to owner approval - Owner approval flow β destructive or out-of-sandbox operations pause and ask the owner with Allow / Deny buttons, a clear why line (sandbox escape, destructive command, interpreter, β¦), and a live β³ countdown; posted both in the originating chat and the owner's DM β deciding in either place closes both. Timeout configurable via
/approval_timeout(presets or unlimited) - Env isolation β the bot's own secrets (bot token, API keys) are stripped from the agent subprocess environment
- Crash safety β process-level handlers + inactivity watchdog free a wedged chat; atomic writes protect every JSON store
- Dangerous mode β opt-in auto-approve for all tool permissions (disables the above β use only on a fully trusted single-user box)
- Secrets β loaded from
.env(gitignored), never committed
Note on the shell sandbox: the restricted-user Bash gate is best-effort defense-in-depth (lexical inspection + owner approval), not a kernel jail β the whole bot runs as your user. For hostile users, run Hasharot itself inside a container/VM. For a trusted team sharing one machine, the sandbox + approval flow is the intended boundary.
Documentation
| Doc | What's inside |
|---|---|
docs/AGENT_SETUP.md |
Setup guide written for AI agents β paste one line into your agent and it installs Hasharot |
docs/ACCESS_CONTROL.md |
Multi-user access control, sandboxing, and the owner approval flow |
docs/UI_BEHAVIOR.md |
UI, branding, and behavior customizations |
.env.example |
Full annotated configuration reference |
Roadmap
Multi-user collaboration lands incrementally β each step only when the previous one hits its limits:
Topics β parallel sessions (works today, zero setup)
Every forum topic is an independent session. Per-role topics (Frontender, Backender, β¦) give a team parallel lanes with no code changes.Busy-fork (next up)
When a shared project session is busy with someone else's query, show a "Fork" button that branches a personal session from the shared context. Better than blanket per-user sessions: the main team context stays intact, and the fork inherits everything up to that point.Worktree isolation (when truly needed)
Per-user git worktrees so two people can write code in the same repo simultaneously without stepping on each other's working tree. Only worth the complexity once "two devs, one repo, same time" is a real daily need.OS-level command jail (only if hosting untrusted users)
Today the restricted-user shell gate is best-effort (lexical inspection + owner approval), not a kernel jail β see the Security note above. If Hasharot ever needs to host genuinely untrusted users, run each restricted command inside a real sandbox (sandbox-execon macOS,bwrap/container on Linux) with the allowlist bind-mounted, instead of validating the command string. Larger architectural change; not needed for a trusted team sharing one machine.
License
MIT Β© Mamasodikov
Hasharot π β ishlaringizni hashar qilib bitiring.
If this project is useful to you, consider giving it a β
Yorumlar (0)
Yorum birakmak icin giris yap.
Yorum birakSonuc bulunamadi