fix/feat: address open issues #14, #12, #11, #16#17
fix/feat: address open issues #14, #12, #11, #16#17KHAEntertainment merged 16 commits intomasterfrom
Conversation
- _safe_dest() now rebases absolute paths (e.g. /home/user/.sandbox/foo.py) to just the filename under the output directory instead of raising an error, printing a warning so the user knows the rebase occurred - When --write-files produces zero written files, the full response is saved to <output-dir>/grok-response.txt and the process exits with code 1 so callers can detect the failure rather than silently succeeding Closes #14 https://claude.ai/code/session_01No9S6TZbfTgocHwHYWwxRN
Prepends a grounding identity prompt to every mode-specific system prompt so Grok always operates as a focused coding assistant. - DEFAULT_GROUNDING_PROMPT constant establishes role/expectations - load_grounding_prompt() reads ~/.config/grok-swarm/system-prompt.txt for user customisation, falling back to the default - call_grok() now prepends the grounding prompt before mode content - orchestrate mode is unaffected: system_override keeps full control Closes #12 https://claude.ai/code/session_01No9S6TZbfTgocHwHYWwxRN
- New src/bridge/usage_tracker.py: records every API call to ~/.config/grok-swarm/usage.json (newline-delimited JSON) using stdlib only; aggregates calls, tokens, cost, and time; formats a human-readable table - grok_bridge.py: imports usage_tracker and calls record_usage() after each successful API call (failures are silently swallowed so tracking never aborts the main flow) - cli.py: new `grok-swarm stats [--days N]` subcommand prints the aggregated stats table Pricing based on OpenRouter's published rates for x-ai/grok-4.20-multi-agent-beta ($5/M prompt, $15/M completion). Closes #11 https://claude.ai/code/session_01No9S6TZbfTgocHwHYWwxRN
Brings in the grok-swarm-agent feature from the open PR on feature/grok-swarm-agent, fixing three regressions before landing: Bug fixes vs. the open PR: - Created src/shared/patterns.py (get_filename_pattern_string()) which was imported but never committed, causing ImportError at startup - Fixed lang_path_pattern in grok_agent.py to match relative paths (python:cli.py) in addition to absolute paths — the PR's narrowed pattern ^(\w+):(/...) silently dropped relative-path annotations - src/bridge/grok_bridge.py now imports shared patterns gracefully (try/except) so the bridge still works without the shared module New files: - src/shared/__init__.py + patterns.py — shared regex utilities - src/agent/__init__.py + grok_agent.py — autonomous iterative agent loop (file discovery → Grok call → parse/apply → verify → iterate up to 5x) - src/plugin/grok_agent_plugin.ts — OpenClaw/Claude Code tool registration - platforms/claude/skills/grok-swarm-agent/SKILL.md — skill documentation - platforms/claude/commands/grok-swarm-agent.sh — slash command Updated: - src/plugin/index.ts — imports and registers the agent tool Closes #16 https://claude.ai/code/session_01No9S6TZbfTgocHwHYWwxRN
Applies all issue fixes (#14, #12, #11, #16) to the duplicate skills/grok-refactor/bridge/ files so both installation paths stay in parity: - grok_bridge.py: absolute path rebasing, fallback response save, grounding prompt, usage tracking, shared patterns Pattern 3 - usage_tracker.py: new (copied from src/bridge/) - shared/patterns.py: new (provides get_filename_pattern_string()) - SKILL.md: documents grounding prompt config and stats subcommand https://claude.ai/code/session_01No9S6TZbfTgocHwHYWwxRN
|
Warning Rate limit exceeded
⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (8)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Pull request overview
Addresses multiple open issues by improving file-write robustness, adding configurable system grounding, introducing persistent usage/cost tracking with a stats command, and adding an autonomous “grok-swarm-agent” workflow (plus mirrored updates in the skills/grok-refactor/ tree).
Changes:
- Improve Grok response file parsing/writing: rebase absolute paths, add fallback response persistence + nonzero exit on zero writes, and support additional filename annotation format.
- Add configurable grounding system prompt and persistent token/cost usage tracking with a
grok-swarm stats [--days N]subcommand. - Introduce an autonomous Grok agent loop and OpenClaw/Claude integration (plugin tool registration + Claude command/skill docs).
Reviewed changes
Copilot reviewed 15 out of 15 changed files in this pull request and generated 13 comments.
Show a summary per file
| File | Description |
|---|---|
| src/shared/patterns.py | Adds shared regex helper for filename-style annotations in code blocks. |
| src/shared/init.py | Defines shared package marker. |
| src/plugin/index.ts | Registers the new autonomous agent tool from the OpenClaw plugin entrypoint. |
| src/plugin/grok_agent_plugin.ts | Implements the OpenClaw tool that spawns the Python autonomous agent. |
| src/bridge/usage_tracker.py | Adds persistent newline-delimited JSON usage logging and aggregation/report formatting. |
| src/bridge/grok_bridge.py | Adds grounding prompt support, usage logging hook, improved file parsing/writing behavior and safer absolute-path handling. |
| src/bridge/cli.py | Adds stats subcommand that prints formatted usage report. |
| src/agent/grok_agent.py | Adds the autonomous iterative agent loop with parsing/apply/verify capabilities. |
| src/agent/init.py | Defines agent package marker. |
| skills/grok-refactor/shared/patterns.py | Mirrors shared filename regex helper into skills bundle. |
| skills/grok-refactor/bridge/usage_tracker.py | Mirrors usage tracking into skills bundle. |
| skills/grok-refactor/bridge/grok_bridge.py | Mirrors bridge improvements into skills bundle (grounding, parsing, fallback write, thinking mode). |
| skills/grok-refactor/SKILL.md | Documents grounding prompt configuration and usage stats command. |
| platforms/claude/skills/grok-swarm-agent/SKILL.md | Adds Claude skill documentation for the autonomous agent. |
| platforms/claude/commands/grok-swarm-agent.sh | Adds Claude command wrapper to invoke the autonomous agent script. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
@copilot open a new pull request to apply changes based on the comments in this thread |
|
@KHAEntertainment I've opened a new pull request, #18, to work on those changes. Once the pull request is ready, I'll request review from you. |
Co-authored-by: KHAEntertainment <43256680+KHAEntertainment@users.noreply.github.com> Agent-Logs-Url: https://github.com/KHAEntertainment/grok-multiagent-plugin/sessions/2dc54b6f-c039-4e6b-8100-e7a374c6c952
fix: address PR review comments — agent plugin correctness, shell injection, datetime safety, Pattern 3 parsing
Resolve conflicts by keeping master (PR #16) canonical versions for all overlapping files, preserving the PR branch's non-conflicting ESM fix in src/plugin/index.ts. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
|
@KHAEntertainment I've opened a new pull request, #20, to work on those changes. Once the pull request is ready, I'll request review from you. |
|
@KHAEntertainment I've opened a new pull request, #21, to work on those changes. Once the pull request is ready, I'll request review from you. |
|
@KHAEntertainment I've opened a new pull request, #22, to work on those changes. Once the pull request is ready, I'll request review from you. |
…rdcoded python3 Co-authored-by: KHAEntertainment <43256680+KHAEntertainment@users.noreply.github.com> Agent-Logs-Url: https://github.com/KHAEntertainment/grok-multiagent-plugin/sessions/aa43e519-f955-4eac-ab29-27a12839c43c
No-op: SKILL.md Options table already uses correct single-pipe format
…r-one Use `api.config?.pythonPath` in `grok_agent_plugin.ts` instead of hardcoded `python3`
fix: make plugin entry-point async to permit await import()
Summary
Addresses all four non-enhancement open issues. Enhancement-labeled issues #9 (Interactive TUI) and #13 (Secure Credentials) are deferred as requested.
All Traycee AI implementation plans were validated before implementation.
fix(#14) — File Write Flow: Absolute Path Rejection + Silent Failures
_safe_dest()now rebases absolute paths (e.g./home/user/.sandbox/task.py) to just the filename under the output directory with a warning, instead of raising and silently skipping--write-filesproduces zero written files, the full response is saved to<output-dir>/grok-response.txtand the process exits with code 1 so callers can detect the failurefeat(#12) — Configurable Grounding System Prompt
DEFAULT_GROUNDING_PROMPTconstant establishing Grok's role as a coding assistantload_grounding_prompt()reads~/.config/grok-swarm/system-prompt.txtfor user customisation, falling back to the defaultcall_grok()prepends the grounding prompt before any mode-specific content;orchestratemode is unaffected (user owns the full system prompt)feat(#11) — Token/Cost Usage Dashboard
src/bridge/usage_tracker.py: logs every API call to~/.config/grok-swarm/usage.json(newline-delimited JSON, stdlib only); aggregates calls, tokens, and estimated cost (OpenRouter pricing forx-ai/grok-4.20-multi-agent-beta: $5/M prompt, $15/M completion)grok_bridge.py: callsrecord_usage()after each successful API call (failures silently ignored so tracking never aborts main flow)cli.py: newgrok-swarm stats [--days N]subcommand prints a formatted reportfeat(#16) — Autonomous grok-swarm-agent (fixing the open PR)
The existing PR on
feature/grok-swarm-agenthad three bugs preventing it from running:grok_bridge.pyandgrok_agent.pyimportedget_filename_pattern_stringfromsrc/shared/patterns— that module was never committed, causingImportErrorat startuplang_path_patternin the PR was narrowed to only match absolute paths (/...) — silently dropping relative-path annotations likepython:cli.pycall_grok()in the PR lost itsthinkingparameter — breaking high-thinking/16-agent modeFixes applied:
src/shared/__init__.py+patterns.pywithget_filename_pattern_string()lang_path_patterningrok_agent.pyto match relative OR absolute pathsgrok_bridge.pyimports shared patterns with graceful try/except fallbacksrc/agent/grok_agent.py,src/plugin/grok_agent_plugin.ts,platforms/claude/skills/grok-swarm-agent/SKILL.md,platforms/claude/commands/grok-swarm-agent.shchore — skills/grok-refactor/bridge/ sync
All changes above applied identically to the duplicate
skills/grok-refactor/bridge/tree. UpdatedSKILL.mdto document grounding prompt config and the newstatssubcommand.Test plan
python3 src/bridge/grok_bridge.py --help— no ImportErrorpython3 src/bridge/cli.py stats— prints "No usage data recorded yet"python3 src/agent/grok_agent.py --help— no ImportError# FILE: /abs/path/file.pytoparse_and_write_files()→ writesfile.pywith warning, not silent skipgrok-swarm statsshows the recorded entryhttps://claude.ai/code/session_01No9S6TZbfTgocHwHYWwxRN