opencode-skills-collection 3.1.23 → 4.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bundled-skills/.antigravity-install-manifest.json +24 -1
- package/bundled-skills/007/SKILL.md +2 -2
- package/bundled-skills/10-andruia-skill-smith/SKILL.md +1 -1
- package/bundled-skills/agent-squad/SKILL.md +5 -0
- package/bundled-skills/agent-squad/alex/SKILL.md +3 -0
- package/bundled-skills/agent-squad/aria/SKILL.md +3 -0
- package/bundled-skills/agent-squad/dep/SKILL.md +3 -0
- package/bundled-skills/agent-squad/luna/SKILL.md +4 -1
- package/bundled-skills/agent-squad/mason/SKILL.md +3 -0
- package/bundled-skills/agent-squad/max/SKILL.md +3 -0
- package/bundled-skills/agent-squad/quinn/SKILL.md +3 -0
- package/bundled-skills/agent-squad/rex/SKILL.md +3 -0
- package/bundled-skills/angular/metadata.json +1 -1
- package/bundled-skills/angular-best-practices/metadata.json +1 -1
- package/bundled-skills/angular-state-management/metadata.json +1 -1
- package/bundled-skills/angular-ui-patterns/metadata.json +1 -1
- package/bundled-skills/antigravity-skill-orchestrator/SKILL.md +2 -2
- package/bundled-skills/apify-actor-development/SKILL.md +2 -2
- package/bundled-skills/apple-container/SKILL.md +165 -0
- package/bundled-skills/apple-container/references/commands.md +1593 -0
- package/bundled-skills/apple-container/references/concepts.md +294 -0
- package/bundled-skills/apple-container/references/configuration.md +499 -0
- package/bundled-skills/apple-container/references/workflows.md +498 -0
- package/bundled-skills/ask-copilot/SKILL.md +112 -0
- package/bundled-skills/auto-research/SKILL.md +126 -0
- package/bundled-skills/brooks-lint/SKILL.md +1 -1
- package/bundled-skills/browser-harness/references/install.md +3 -1
- package/bundled-skills/chrome-extension-developer/SKILL.md +1 -1
- package/bundled-skills/clean-code-guard/SKILL.md +184 -0
- package/bundled-skills/clean-code-guard/references/ai-failure-modes.md +345 -0
- package/bundled-skills/clean-code-guard/references/comments-and-formatting.md +115 -0
- package/bundled-skills/clean-code-guard/references/dry-kiss-yagni.md +133 -0
- package/bundled-skills/clean-code-guard/references/naming-and-functions.md +187 -0
- package/bundled-skills/clean-code-guard/references/review-checklist.md +150 -0
- package/bundled-skills/clean-code-guard/references/solid.md +280 -0
- package/bundled-skills/clean-code-guard/references/sources.md +47 -0
- package/bundled-skills/cloudflare-security-audit/SKILL.md +137 -0
- package/bundled-skills/cloudflare-security-audit/references/AI-AND-LLM.md +67 -0
- package/bundled-skills/cloudflare-security-audit/references/ATTACK-CLASSES.md +116 -0
- package/bundled-skills/cloudflare-security-audit/references/CLIENT-SIDE.md +67 -0
- package/bundled-skills/cloudflare-security-audit/references/HUNTING.md +110 -0
- package/bundled-skills/cloudflare-security-audit/references/MEMORY-SAFETY-AND-BINARY.md +58 -0
- package/bundled-skills/cloudflare-security-audit/references/RECONNAISSANCE.md +46 -0
- package/bundled-skills/cloudflare-security-audit/references/VALIDATION-AND-REPORTING.md +109 -0
- package/bundled-skills/cloudflare-security-audit/references/WEB-PROTOCOL-AND-AUTH.md +85 -0
- package/bundled-skills/cloudflare-security-audit/resources/report-schema.json +210 -0
- package/bundled-skills/comfyui-gateway/references/troubleshooting.md +1 -1
- package/bundled-skills/commit/SKILL.md +2 -1
- package/bundled-skills/deepapi/SKILL.md +6 -6
- package/bundled-skills/docs/README.md +1 -1
- package/bundled-skills/docs/contributors/quality-bar.md +1 -1
- package/bundled-skills/docs/contributors/security-guardrails.md +1 -1
- package/bundled-skills/docs/integrations/jetski-cortex.md +5 -5
- package/bundled-skills/docs/integrations/jetski-gemini-loader/README.md +3 -3
- package/bundled-skills/docs/maintainers/ci-drift-fix.md +7 -5
- package/bundled-skills/docs/maintainers/merge-batch.md +24 -7
- package/bundled-skills/docs/maintainers/pr-autonomy.md +89 -0
- package/bundled-skills/docs/maintainers/release-notes-7.2.0.md +1 -1
- package/bundled-skills/docs/maintainers/release-process.md +9 -9
- package/bundled-skills/docs/maintainers/repo-growth-seo.md +5 -5
- package/bundled-skills/docs/maintainers/skills-date-tracking.md +1 -1
- package/bundled-skills/docs/maintainers/skills-update-guide.md +2 -2
- package/bundled-skills/docs/users/{antigravity-awesome-skills-vs-awesome-claude-skills.md → agentic-awesome-skills-vs-awesome-claude-skills.md} +5 -5
- package/bundled-skills/docs/users/ai-agent-skills.md +4 -4
- package/bundled-skills/docs/users/best-claude-code-skills-github.md +3 -3
- package/bundled-skills/docs/users/best-cursor-skills-github.md +3 -3
- package/bundled-skills/docs/users/bundles.md +56 -57
- package/bundled-skills/docs/users/claude-code-skills.md +6 -6
- package/bundled-skills/docs/users/codex-cli-skills.md +5 -5
- package/bundled-skills/docs/users/cursor-skills.md +3 -3
- package/bundled-skills/docs/users/faq.md +27 -15
- package/bundled-skills/docs/users/gemini-cli-skills.md +4 -4
- package/bundled-skills/docs/users/getting-started.md +22 -12
- package/bundled-skills/docs/users/kiro-integration.md +7 -7
- package/bundled-skills/docs/users/plugins.md +8 -9
- package/bundled-skills/docs/users/security-skills.md +1 -1
- package/bundled-skills/docs/users/skills-vs-mcp-tools.md +1 -1
- package/bundled-skills/docs/users/specialized-plugin-roadmap.md +3 -4
- package/bundled-skills/docs/users/usage.md +9 -9
- package/bundled-skills/docs/users/visual-guide.md +7 -7
- package/bundled-skills/docs/users/windows-truncation-recovery.md +1 -1
- package/bundled-skills/docs/users/workflows.md +1 -1
- package/bundled-skills/docs/vietnamese/BUNDLES.vi.md +1 -1
- package/bundled-skills/docs/vietnamese/FAQ.vi.md +15 -8
- package/bundled-skills/docs/vietnamese/GETTING_STARTED.vi.md +12 -5
- package/bundled-skills/docs/vietnamese/QUALITY_BAR.vi.md +1 -1
- package/bundled-skills/docs/vietnamese/README.vi.md +21 -17
- package/bundled-skills/docs/vietnamese/SECURITY_GUARDRAILS.vi.md +1 -1
- package/bundled-skills/docs/vietnamese/SKILLS_README.vi.md +2 -2
- package/bundled-skills/docs/vietnamese/TRANSLATION_PLAN.vi.md +1 -1
- package/bundled-skills/docs/vietnamese/VISUAL_GUIDE.vi.md +8 -8
- package/bundled-skills/docs-guard/SKILL.md +109 -0
- package/bundled-skills/docs-guard/references/code-samples.md +46 -0
- package/bundled-skills/docs-guard/references/docstrings.md +60 -0
- package/bundled-skills/docs-guard/references/review-checklist.md +45 -0
- package/bundled-skills/docs-guard/references/sources.md +22 -0
- package/bundled-skills/docs-guard/references/verification.md +51 -0
- package/bundled-skills/efficient-web-research/SKILL.md +4 -0
- package/bundled-skills/electron-development/SKILL.md +1 -1
- package/bundled-skills/event-staffing-compliance/SKILL.md +3 -0
- package/bundled-skills/event-staffing-ordering/SKILL.md +3 -0
- package/bundled-skills/feature-tracking/SKILL.md +222 -0
- package/bundled-skills/flutter-expert/SKILL.md +6 -1
- package/bundled-skills/flutter-expert/resources/implementation-playbook.md +214 -0
- package/bundled-skills/gemini-deep-research/README.md +246 -0
- package/bundled-skills/gemini-deep-research/SKILL.md +136 -0
- package/bundled-skills/gemini-deep-research/requirements.txt +2 -0
- package/bundled-skills/gemini-deep-research/scripts/research.py +692 -0
- package/bundled-skills/git-pushing/SKILL.md +21 -4
- package/bundled-skills/git-pushing/scripts/smart_commit.sh +206 -11
- package/bundled-skills/go-in-depth/scripts/workflow-script.js +4 -1
- package/bundled-skills/grok-build/SKILL.md +167 -0
- package/bundled-skills/grok-build/references/cli.md +99 -0
- package/bundled-skills/huggingface-tool-builder/references/find_models_by_paper.sh +1 -1
- package/bundled-skills/idea-autopsy/SKILL.md +147 -0
- package/bundled-skills/it-manager-hospital/README.md +1 -1
- package/bundled-skills/it-manager-pro/README.md +1 -1
- package/bundled-skills/itil-expert/README.md +1 -1
- package/bundled-skills/langgraph/SKILL.md +1 -1
- package/bundled-skills/linkedin-content-generator/SKILL.md +1 -1
- package/bundled-skills/lint-and-validate/scripts/lint_runner.py +23 -23
- package/bundled-skills/lint-and-validate/scripts/type_coverage.py +30 -30
- package/bundled-skills/logic-lens/SKILL.md +1 -1
- package/bundled-skills/lore/LICENSE +21 -0
- package/bundled-skills/lore/README.md +386 -0
- package/bundled-skills/lore/README.zh-CN.md +386 -0
- package/bundled-skills/lore/SKILL.md +453 -0
- package/bundled-skills/lore/WORKFLOWS.md +216 -0
- package/bundled-skills/lore/WORKFLOWS.zh-CN.md +216 -0
- package/bundled-skills/lore/references/audit-template.md +60 -0
- package/bundled-skills/lore/references/compatibility.md +228 -0
- package/bundled-skills/lore/references/config.md +125 -0
- package/bundled-skills/lore/references/entry-format.md +70 -0
- package/bundled-skills/lore/references/history-command.md +106 -0
- package/bundled-skills/lore/references/monorepo-detection.md +78 -0
- package/bundled-skills/lore/references/platform-mirrors.md +377 -0
- package/bundled-skills/lore/references/stale-new-markers.md +62 -0
- package/bundled-skills/lore/references/summary-template.md +98 -0
- package/bundled-skills/lore/scripts/README.md +54 -0
- package/bundled-skills/lore/scripts/README.zh-CN.md +54 -0
- package/bundled-skills/lore/scripts/find_duplicates.py +211 -0
- package/bundled-skills/lore/scripts/find_stale.py +116 -0
- package/bundled-skills/lore/scripts/history.py +527 -0
- package/bundled-skills/lore/scripts/id_hash.py +32 -0
- package/bundled-skills/lore/scripts/list_entries.py +183 -0
- package/bundled-skills/lovable-cleanup/SKILL.md +3 -3
- package/bundled-skills/makepad-splash/SKILL.md +1 -1
- package/bundled-skills/mmx-cli/SKILL.md +14 -1
- package/bundled-skills/monopoly/SKILL.md +5 -0
- package/bundled-skills/monopoly/patterns/SKILL.md +4 -0
- package/bundled-skills/monopoly/scale-benchmarks/SKILL.md +4 -0
- package/bundled-skills/monopoly/security-checklist/SKILL.md +4 -0
- package/bundled-skills/monopoly/tech-matrix/SKILL.md +4 -0
- package/bundled-skills/mtls-configuration/SKILL.md +1 -1
- package/bundled-skills/network-101/SKILL.md +4 -5
- package/bundled-skills/nika/SKILL.md +270 -0
- package/bundled-skills/not-a-vibe-coder/SKILL.md +4 -0
- package/bundled-skills/ontoly-software-graph/SKILL.md +160 -0
- package/bundled-skills/openclaw-github-repo-commander/SKILL.md +1 -1
- package/bundled-skills/pilot-protocol/SKILL.md +6 -3
- package/bundled-skills/postgres-readonly-queries/README.md +77 -0
- package/bundled-skills/postgres-readonly-queries/SKILL.md +152 -0
- package/bundled-skills/postgres-readonly-queries/connections.example.json +34 -0
- package/bundled-skills/postgres-readonly-queries/requirements.txt +1 -0
- package/bundled-skills/postgres-readonly-queries/scripts/query.py +262 -0
- package/bundled-skills/pptx-deck-creation/SKILL.md +275 -0
- package/bundled-skills/pptx-deck-creation/references/audit-checklist.md +156 -0
- package/bundled-skills/pptx-deck-creation/references/design-profiles.md +96 -0
- package/bundled-skills/pptx-deck-creation/references/python-snippets.md +150 -0
- package/bundled-skills/pptx-deck-creation/references/reference-deck-analysis.md +91 -0
- package/bundled-skills/pptx-deck-creation/references/visual-asset-adapters.md +158 -0
- package/bundled-skills/privilege-escalation-methods/SKILL.md +1 -1
- package/bundled-skills/product-decision-agent/SKILL.md +94 -0
- package/bundled-skills/product-decision-agent/agents/openai.yaml +7 -0
- package/bundled-skills/product-decision-agent/references/methodology-basis.md +232 -0
- package/bundled-skills/product-decision-agent/references/product-playbooks.md +813 -0
- package/bundled-skills/product-decision-agent/references/reasoning-engine.md +289 -0
- package/bundled-skills/product-decision-agent/references/response-examples.md +279 -0
- package/bundled-skills/product-decision-agent/scripts/quality_gate.py +221 -0
- package/bundled-skills/product-decision-agent/scripts/test_quality_gate.py +94 -0
- package/bundled-skills/pytest-skill/reference/playbook.md +358 -0
- package/bundled-skills/quit-sponsor/SKILL.md +96 -0
- package/bundled-skills/rclone-cli/references/providers/s3.md +1 -1
- package/bundled-skills/security-and-hardening/SKILL.md +1 -1
- package/bundled-skills/semgrep-rule-creator/SKILL.md +6 -6
- package/bundled-skills/skill-creator/README.md +3 -3
- package/bundled-skills/skill-creator/SKILL.md +8 -4
- package/bundled-skills/skill-creator/scripts/quick_validate.py +1 -1
- package/bundled-skills/sql-injection-testing/SKILL.md +4 -4
- package/bundled-skills/subagent-orchestrator/README.md +1 -1
- package/bundled-skills/super-code/bash/SKILL.md +3 -0
- package/bundled-skills/super-code/c/SKILL.md +3 -0
- package/bundled-skills/super-code/cpp/SKILL.md +3 -0
- package/bundled-skills/super-code/csharp/SKILL.md +3 -0
- package/bundled-skills/super-code/dart/SKILL.md +3 -0
- package/bundled-skills/super-code/elixir/SKILL.md +3 -0
- package/bundled-skills/super-code/go/SKILL.md +3 -0
- package/bundled-skills/super-code/java/SKILL.md +3 -0
- package/bundled-skills/super-code/kotlin/SKILL.md +3 -0
- package/bundled-skills/super-code/php/SKILL.md +3 -0
- package/bundled-skills/super-code/python/SKILL.md +3 -0
- package/bundled-skills/super-code/ruby/SKILL.md +3 -0
- package/bundled-skills/super-code/rust/SKILL.md +3 -0
- package/bundled-skills/super-code/scala/SKILL.md +3 -0
- package/bundled-skills/super-code/swift/SKILL.md +3 -0
- package/bundled-skills/super-code/typescript/SKILL.md +3 -0
- package/bundled-skills/telegram-bot-messaging/README.md +185 -0
- package/bundled-skills/telegram-bot-messaging/SKILL.md +101 -0
- package/bundled-skills/telegram-bot-messaging/scripts/telegram.sh +420 -0
- package/bundled-skills/test-guard/SKILL.md +132 -0
- package/bundled-skills/test-guard/references/jest.md +50 -0
- package/bundled-skills/test-guard/references/llm-app-testing.md +40 -0
- package/bundled-skills/test-guard/references/phpunit.md +56 -0
- package/bundled-skills/test-guard/references/pytest.md +65 -0
- package/bundled-skills/trading-ledger/SKILL.md +11 -3
- package/bundled-skills/uizze-ui-research/SKILL.md +93 -0
- package/bundled-skills/vibe-code-auditor/SKILL.md +1 -1
- package/bundled-skills/vibecode-production-qa-validator/SKILL.md +1 -1
- package/bundled-skills/videodb/scripts/ws_listener.py +29 -15
- package/bundled-skills/voice-ai-engine-development/README.md +1 -1
- package/bundled-skills/vulnerability-scanner/SKILL.md +1 -1
- package/bundled-skills/warehouse/SKILL.md +154 -0
- package/bundled-skills/woo-guard/SKILL.md +113 -0
- package/bundled-skills/woo-guard/references/checkout-and-money.md +64 -0
- package/bundled-skills/woo-guard/references/hpos-and-crud.md +87 -0
- package/bundled-skills/woo-guard/references/review-checklist.md +44 -0
- package/bundled-skills/woo-guard/references/sources.md +17 -0
- package/bundled-skills/wp-guard/SKILL.md +119 -0
- package/bundled-skills/wp-guard/references/i18n.md +88 -0
- package/bundled-skills/wp-guard/references/performance.md +70 -0
- package/bundled-skills/wp-guard/references/review-checklist.md +57 -0
- package/bundled-skills/wp-guard/references/security.md +100 -0
- package/bundled-skills/wp-guard/references/sources.md +27 -0
- package/bundled-skills/writing-skills/gotchas.md +1 -1
- package/bundled-skills/writing-skills/references/standards/metadata-standard.md +1 -1
- package/bundled-skills/x-twitter-scraper/SKILL.md +14 -32
- package/bundled-skills/xss-html-injection/SKILL.md +3 -3
- package/bundled-skills/youtube-seo-optimizer/SKILL.md +1 -1
- package/bundled-skills/youtube-summarizer/CHANGELOG.md +2 -2
- package/package.json +1 -1
- package/skills_index.json +273 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: git-pushing
|
|
3
|
-
description: "
|
|
3
|
+
description: "Safely stage, commit, and push intended git changes with conventional commit messages. Use for ordinary non-release pushes when explicitly asked to push, save work remotely, or share a completed change."
|
|
4
4
|
risk: critical
|
|
5
5
|
source: community
|
|
6
6
|
date_added: "2026-02-27"
|
|
@@ -8,7 +8,7 @@ date_added: "2026-02-27"
|
|
|
8
8
|
|
|
9
9
|
# Git Push Workflow
|
|
10
10
|
|
|
11
|
-
Stage
|
|
11
|
+
Stage only intended changes, create a conventional commit, and push to the remote branch.
|
|
12
12
|
|
|
13
13
|
## When to Use
|
|
14
14
|
Automatically activate when the user:
|
|
@@ -18,9 +18,19 @@ Automatically activate when the user:
|
|
|
18
18
|
- Completes a feature and wants to share it
|
|
19
19
|
- Says phrases like "let's push this up" or "commit these changes"
|
|
20
20
|
|
|
21
|
+
## Safety Gates
|
|
22
|
+
|
|
23
|
+
Before staging, inspect `git status --short --branch`, confirm the intended files, and fetch the upstream branch when a concurrent push is plausible. Do not absorb unrelated dirty files.
|
|
24
|
+
|
|
25
|
+
The helper requires an empty live index and a conventional commit message before it stages anything. It locks the live index, builds and validates the commit in an isolated temporary index, rejects `--` without paths, and atomically updates the branch only if its parent is unchanged.
|
|
26
|
+
|
|
27
|
+
The helper honors `branch.<name>.pushRemote`, `remote.pushDefault`, and the branch's configured upstream, in that order. For a new branch without those settings, it requires `origin` and establishes `origin/<branch>`. It rejects detached HEAD and invalid remote configurations before staging.
|
|
28
|
+
|
|
29
|
+
Do not use this skill for a versioned repository release, tag publication, or a repository with an explicit `release:prepare` / `release:publish` workflow. Use that repository's release flow instead; it owns version changes, generated files, tags, and publish verification.
|
|
30
|
+
|
|
21
31
|
## Workflow
|
|
22
32
|
|
|
23
|
-
|
|
33
|
+
Use the helper only after the safety gates pass. With no paths it stages all current changes, so use that form only when every dirty file belongs to the requested commit:
|
|
24
34
|
|
|
25
35
|
```bash
|
|
26
36
|
bash skills/git-pushing/scripts/smart_commit.sh
|
|
@@ -32,9 +42,16 @@ With custom message:
|
|
|
32
42
|
bash skills/git-pushing/scripts/smart_commit.sh "feat: add feature"
|
|
33
43
|
```
|
|
34
44
|
|
|
35
|
-
|
|
45
|
+
To stage only named files, pass them after `--`:
|
|
46
|
+
|
|
47
|
+
```bash
|
|
48
|
+
bash skills/git-pushing/scripts/smart_commit.sh "fix: scope change" -- path/to/file
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
The helper handles isolated staging, commit creation, and push; it does not replace validation, release tooling, or a rebase required by an advanced upstream branch.
|
|
36
52
|
|
|
37
53
|
## Limitations
|
|
54
|
+
- The helper currently requires Git's `files` ref backend; it rejects `reftable` repositories before creating a commit because their refs cannot use the filesystem lock protocol.
|
|
38
55
|
- Use this skill only when the task clearly matches the scope described above.
|
|
39
56
|
- Do not treat the output as a substitute for environment-specific validation, testing, or expert review.
|
|
40
57
|
- Stop and ask for clarification if required inputs, permissions, safety boundaries, or success criteria are missing.
|
|
@@ -1,19 +1,214 @@
|
|
|
1
1
|
#!/bin/bash
|
|
2
|
-
set -
|
|
2
|
+
set -euo pipefail
|
|
3
3
|
|
|
4
|
-
#
|
|
4
|
+
# Always inspect and update the repository's real index. An inherited alternate
|
|
5
|
+
# index could otherwise make the safety check observe different staged content.
|
|
6
|
+
unset GIT_INDEX_FILE
|
|
7
|
+
|
|
8
|
+
CONVENTIONAL_PATTERN='^(feat|fix|ref|refactor|perf|docs|test|build|ci|chore|style|meta|license|revert)(\([A-Za-z0-9._/-]+\))?(!)?: .+'
|
|
5
9
|
MESSAGE="${1:-chore: update code}"
|
|
10
|
+
shift || true
|
|
11
|
+
|
|
12
|
+
validate_message() {
|
|
13
|
+
local subject=$1
|
|
14
|
+
if [[ ! "$subject" =~ $CONVENTIONAL_PATTERN ]]; then
|
|
15
|
+
echo "Commit message must use the conventional '<type>(<scope>): <subject>' format." >&2
|
|
16
|
+
exit 1
|
|
17
|
+
fi
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
validate_message "$MESSAGE"
|
|
21
|
+
|
|
22
|
+
PATH_MODE=false
|
|
23
|
+
if [[ "${1:-}" == "--" ]]; then
|
|
24
|
+
PATH_MODE=true
|
|
25
|
+
shift
|
|
26
|
+
elif [[ "$#" -gt 0 ]]; then
|
|
27
|
+
echo "Pass selected paths after an explicit -- separator." >&2
|
|
28
|
+
exit 1
|
|
29
|
+
fi
|
|
30
|
+
|
|
31
|
+
if [[ "$PATH_MODE" == true && "$#" -eq 0 ]]; then
|
|
32
|
+
echo "The -- separator requires at least one path." >&2
|
|
33
|
+
exit 1
|
|
34
|
+
fi
|
|
35
|
+
|
|
36
|
+
BRANCH=$(git symbolic-ref --quiet --short HEAD) || {
|
|
37
|
+
echo "Refusing to commit from a detached HEAD." >&2
|
|
38
|
+
exit 1
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
REF_FORMAT=$(git rev-parse --show-ref-format 2>/dev/null || true)
|
|
42
|
+
if [[ -z "$REF_FORMAT" || "$REF_FORMAT" == "--show-ref-format" ]]; then
|
|
43
|
+
REF_FORMAT=$(git config --get extensions.refStorage || true)
|
|
44
|
+
REF_FORMAT=${REF_FORMAT:-files}
|
|
45
|
+
fi
|
|
46
|
+
if [[ "$REF_FORMAT" != files ]]; then
|
|
47
|
+
echo "Refusing to run with ref backend '$REF_FORMAT'; safe branch locking currently requires the files backend." >&2
|
|
48
|
+
exit 1
|
|
49
|
+
fi
|
|
50
|
+
|
|
51
|
+
PUSH_REMOTE=$(git config --get "branch.$BRANCH.pushRemote" || true)
|
|
52
|
+
if [[ -z "$PUSH_REMOTE" ]]; then
|
|
53
|
+
PUSH_REMOTE=$(git config --get remote.pushDefault || true)
|
|
54
|
+
fi
|
|
55
|
+
FETCH_REMOTE=$(git config --get "branch.$BRANCH.remote" || true)
|
|
56
|
+
MERGE_REF=$(git config --get "branch.$BRANCH.merge" || true)
|
|
57
|
+
if [[ -z "$PUSH_REMOTE" ]]; then
|
|
58
|
+
PUSH_REMOTE=${FETCH_REMOTE:-origin}
|
|
59
|
+
fi
|
|
60
|
+
|
|
61
|
+
if [[ "$PUSH_REMOTE" == "." ]] || ! git remote get-url --push "$PUSH_REMOTE" >/dev/null 2>&1; then
|
|
62
|
+
echo "Configured push remote '$PUSH_REMOTE' does not exist or is not pushable." >&2
|
|
63
|
+
exit 1
|
|
64
|
+
fi
|
|
65
|
+
|
|
66
|
+
PUSH_BRANCH=$BRANCH
|
|
67
|
+
if [[ "$PUSH_REMOTE" == "$FETCH_REMOTE" && -n "$MERGE_REF" ]]; then
|
|
68
|
+
if [[ "$MERGE_REF" != refs/heads/* ]]; then
|
|
69
|
+
echo "Configured upstream '$MERGE_REF' is not a pushable branch ref." >&2
|
|
70
|
+
exit 1
|
|
71
|
+
fi
|
|
72
|
+
PUSH_BRANCH=${MERGE_REF#refs/heads/}
|
|
73
|
+
fi
|
|
74
|
+
|
|
75
|
+
HAS_UPSTREAM=false
|
|
76
|
+
if git rev-parse --verify --quiet '@{upstream}' >/dev/null; then
|
|
77
|
+
HAS_UPSTREAM=true
|
|
78
|
+
fi
|
|
79
|
+
SET_UPSTREAM=false
|
|
80
|
+
if [[ "$HAS_UPSTREAM" == false && "$PUSH_REMOTE" == origin ]]; then
|
|
81
|
+
SET_UPSTREAM=true
|
|
82
|
+
fi
|
|
83
|
+
|
|
84
|
+
GIT_DIR=$(git rev-parse --absolute-git-dir)
|
|
85
|
+
GIT_COMMON_DIR=$(git rev-parse --path-format=absolute --git-common-dir)
|
|
86
|
+
LIVE_INDEX="$GIT_DIR/index"
|
|
87
|
+
LIVE_INDEX_LOCK="$LIVE_INDEX.lock"
|
|
88
|
+
BRANCH_REF="$GIT_COMMON_DIR/refs/heads/$BRANCH"
|
|
89
|
+
BRANCH_REF_LOCK="$BRANCH_REF.lock"
|
|
90
|
+
TEMP_DIR=$(mktemp -d "${TMPDIR:-/tmp}/smart-commit.XXXXXX")
|
|
91
|
+
TEMP_INDEX="$TEMP_DIR/index"
|
|
92
|
+
MESSAGE_FILE="$TEMP_DIR/COMMIT_EDITMSG"
|
|
93
|
+
LOCK_HELD=false
|
|
94
|
+
BRANCH_LOCK_HELD=false
|
|
95
|
+
|
|
96
|
+
cleanup() {
|
|
97
|
+
rm -rf "$TEMP_DIR"
|
|
98
|
+
if [[ "$LOCK_HELD" == true ]]; then
|
|
99
|
+
rm -f "$LIVE_INDEX_LOCK"
|
|
100
|
+
fi
|
|
101
|
+
if [[ "$BRANCH_LOCK_HELD" == true ]]; then
|
|
102
|
+
rm -f "$BRANCH_REF_LOCK"
|
|
103
|
+
fi
|
|
104
|
+
}
|
|
105
|
+
trap cleanup EXIT
|
|
106
|
+
|
|
107
|
+
if ! (set -o noclobber; : > "$LIVE_INDEX_LOCK") 2>/dev/null; then
|
|
108
|
+
echo "The Git index is busy; refusing to race another staging operation." >&2
|
|
109
|
+
exit 1
|
|
110
|
+
fi
|
|
111
|
+
LOCK_HELD=true
|
|
112
|
+
|
|
113
|
+
if ! git diff --cached --quiet; then
|
|
114
|
+
echo "Refusing to commit because the index already contains staged changes." >&2
|
|
115
|
+
echo "Commit or unstage the existing index, then retry with the intended paths." >&2
|
|
116
|
+
exit 1
|
|
117
|
+
fi
|
|
118
|
+
|
|
119
|
+
PARENT=$(git rev-parse --verify HEAD)
|
|
120
|
+
if [[ -f "$LIVE_INDEX" ]]; then
|
|
121
|
+
cp "$LIVE_INDEX" "$TEMP_INDEX"
|
|
122
|
+
else
|
|
123
|
+
GIT_INDEX_FILE="$TEMP_INDEX" git read-tree "$PARENT"
|
|
124
|
+
fi
|
|
125
|
+
if [[ "$PATH_MODE" == true ]]; then
|
|
126
|
+
GIT_INDEX_FILE="$TEMP_INDEX" git add -- "$@"
|
|
127
|
+
else
|
|
128
|
+
GIT_INDEX_FILE="$TEMP_INDEX" git add -A
|
|
129
|
+
fi
|
|
130
|
+
|
|
131
|
+
if GIT_INDEX_FILE="$TEMP_INDEX" git diff --cached --quiet; then
|
|
132
|
+
echo "No changes staged for commit." >&2
|
|
133
|
+
exit 1
|
|
134
|
+
fi
|
|
135
|
+
|
|
136
|
+
EXPECTED_TREE=$(GIT_INDEX_FILE="$TEMP_INDEX" git write-tree)
|
|
137
|
+
printf '%s\n' "$MESSAGE" > "$MESSAGE_FILE"
|
|
138
|
+
|
|
139
|
+
GIT_INDEX_FILE="$TEMP_INDEX" git hook run --ignore-missing pre-commit
|
|
140
|
+
if [[ $(GIT_INDEX_FILE="$TEMP_INDEX" git write-tree) != "$EXPECTED_TREE" ]]; then
|
|
141
|
+
echo "Pre-commit hooks changed the isolated index; review those changes before retrying." >&2
|
|
142
|
+
exit 1
|
|
143
|
+
fi
|
|
144
|
+
|
|
145
|
+
GIT_INDEX_FILE="$TEMP_INDEX" git hook run --ignore-missing prepare-commit-msg -- "$MESSAGE_FILE" message
|
|
146
|
+
GIT_INDEX_FILE="$TEMP_INDEX" git hook run --ignore-missing commit-msg -- "$MESSAGE_FILE"
|
|
147
|
+
if [[ $(GIT_INDEX_FILE="$TEMP_INDEX" git write-tree) != "$EXPECTED_TREE" ]]; then
|
|
148
|
+
echo "Commit hooks changed the isolated index; review those changes before retrying." >&2
|
|
149
|
+
exit 1
|
|
150
|
+
fi
|
|
151
|
+
validate_message "$(head -n 1 "$MESSAGE_FILE")"
|
|
152
|
+
|
|
153
|
+
if [[ $(git config --bool commit.gpgsign || true) == true ]]; then
|
|
154
|
+
CREATED_COMMIT=$(git commit-tree -S "$EXPECTED_TREE" -p "$PARENT" -F "$MESSAGE_FILE")
|
|
155
|
+
else
|
|
156
|
+
CREATED_COMMIT=$(git commit-tree "$EXPECTED_TREE" -p "$PARENT" -F "$MESSAGE_FILE")
|
|
157
|
+
fi
|
|
158
|
+
|
|
159
|
+
if ! git update-ref "refs/heads/$BRANCH" "$CREATED_COMMIT" "$PARENT"; then
|
|
160
|
+
echo "The branch changed concurrently; refusing to replace or push it." >&2
|
|
161
|
+
exit 1
|
|
162
|
+
fi
|
|
163
|
+
|
|
164
|
+
mkdir -p "$(dirname "$BRANCH_REF_LOCK")"
|
|
165
|
+
if ! (set -o noclobber; : > "$BRANCH_REF_LOCK") 2>/dev/null; then
|
|
166
|
+
CURRENT_BRANCH_COMMIT=$(git rev-parse --verify "refs/heads/$BRANCH")
|
|
167
|
+
if [[ "$CURRENT_BRANCH_COMMIT" != "$CREATED_COMMIT" ]]; then
|
|
168
|
+
GIT_INDEX_FILE="$TEMP_INDEX" git read-tree "$CURRENT_BRANCH_COMMIT"
|
|
169
|
+
fi
|
|
170
|
+
cp "$TEMP_INDEX" "$LIVE_INDEX_LOCK"
|
|
171
|
+
mv -f "$LIVE_INDEX_LOCK" "$LIVE_INDEX"
|
|
172
|
+
LOCK_HELD=false
|
|
173
|
+
echo "The branch ref is busy after commit creation; refusing to continue to hooks or push." >&2
|
|
174
|
+
exit 1
|
|
175
|
+
fi
|
|
176
|
+
BRANCH_LOCK_HELD=true
|
|
177
|
+
CURRENT_BRANCH_COMMIT=$(git rev-parse --verify "refs/heads/$BRANCH")
|
|
178
|
+
if [[ "$CURRENT_BRANCH_COMMIT" != "$CREATED_COMMIT" ]]; then
|
|
179
|
+
GIT_INDEX_FILE="$TEMP_INDEX" git read-tree "$CURRENT_BRANCH_COMMIT"
|
|
180
|
+
cp "$TEMP_INDEX" "$LIVE_INDEX_LOCK"
|
|
181
|
+
mv -f "$LIVE_INDEX_LOCK" "$LIVE_INDEX"
|
|
182
|
+
LOCK_HELD=false
|
|
183
|
+
echo "The branch changed before its ref lock was acquired; refusing to push." >&2
|
|
184
|
+
exit 1
|
|
185
|
+
fi
|
|
6
186
|
|
|
7
|
-
|
|
8
|
-
|
|
187
|
+
if ! GIT_INDEX_FILE="$TEMP_INDEX" git hook run --ignore-missing post-commit; then
|
|
188
|
+
echo "Warning: post-commit hook failed after the commit was created; continuing with a consistent index." >&2
|
|
189
|
+
fi
|
|
190
|
+
CURRENT_BRANCH_COMMIT=$(git rev-parse --verify "refs/heads/$BRANCH")
|
|
191
|
+
if [[ "$CURRENT_BRANCH_COMMIT" != "$CREATED_COMMIT" ]]; then
|
|
192
|
+
GIT_INDEX_FILE="$TEMP_INDEX" git read-tree "$CURRENT_BRANCH_COMMIT"
|
|
193
|
+
cp "$TEMP_INDEX" "$LIVE_INDEX_LOCK"
|
|
194
|
+
mv -f "$LIVE_INDEX_LOCK" "$LIVE_INDEX"
|
|
195
|
+
LOCK_HELD=false
|
|
196
|
+
echo "The branch changed after commit creation; refusing to push another commit." >&2
|
|
197
|
+
exit 1
|
|
198
|
+
fi
|
|
9
199
|
|
|
10
|
-
|
|
11
|
-
|
|
200
|
+
cp "$TEMP_INDEX" "$LIVE_INDEX_LOCK"
|
|
201
|
+
mv -f "$LIVE_INDEX_LOCK" "$LIVE_INDEX"
|
|
202
|
+
LOCK_HELD=false
|
|
12
203
|
|
|
13
|
-
|
|
14
|
-
|
|
204
|
+
PUSH_REFSPEC="$CREATED_COMMIT:refs/heads/$PUSH_BRANCH"
|
|
205
|
+
git push "$PUSH_REMOTE" "$PUSH_REFSPEC"
|
|
206
|
+
if [[ "$SET_UPSTREAM" == true ]]; then
|
|
207
|
+
git config "branch.$BRANCH.remote" "$PUSH_REMOTE"
|
|
208
|
+
git config "branch.$BRANCH.merge" "refs/heads/$PUSH_BRANCH"
|
|
209
|
+
fi
|
|
15
210
|
|
|
16
|
-
|
|
17
|
-
|
|
211
|
+
rm -f "$BRANCH_REF_LOCK"
|
|
212
|
+
BRANCH_LOCK_HELD=false
|
|
18
213
|
|
|
19
|
-
echo "✅ Successfully pushed to $
|
|
214
|
+
echo "✅ Successfully pushed $BRANCH to $PUSH_REMOTE/$PUSH_BRANCH"
|
|
@@ -89,7 +89,10 @@ const REPORT_SCHEMA = {
|
|
|
89
89
|
|
|
90
90
|
// ─── Phase 0: Scope — decompose question into search angles ───
|
|
91
91
|
phase("Scope")
|
|
92
|
-
const
|
|
92
|
+
const RAW_QUESTION = typeof args === "string"
|
|
93
|
+
? args
|
|
94
|
+
: (typeof args === "object" && args !== null && !Array.isArray(args) ? args.query : "")
|
|
95
|
+
const QUESTION = typeof RAW_QUESTION === "string" ? RAW_QUESTION.trim() : ""
|
|
93
96
|
if (!QUESTION) {
|
|
94
97
|
return { error: "No research question provided. Pass it as args: Workflow({name: 'go-in-depth', args: '<question>'})." }
|
|
95
98
|
}
|
|
@@ -0,0 +1,167 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: grok-build
|
|
3
|
+
description: "Delegate well-specified implementation tasks to xAI's Grok Build CLI running headlessly while the orchestrating agent plans, writes task specs, reviews every diff, and owns the result."
|
|
4
|
+
category: agent-orchestration
|
|
5
|
+
risk: critical
|
|
6
|
+
source: https://github.com/sanjay3290/ai-skills/tree/main/skills/grok-build
|
|
7
|
+
source_repo: sanjay3290/ai-skills
|
|
8
|
+
source_type: community
|
|
9
|
+
date_added: "2026-07-09"
|
|
10
|
+
author: sanjay3290
|
|
11
|
+
tags: [grok, delegation, code-generation, xai]
|
|
12
|
+
tools: [claude, cursor, gemini]
|
|
13
|
+
license: "Apache-2.0"
|
|
14
|
+
license_source: "https://github.com/sanjay3290/ai-skills/blob/main/LICENSE"
|
|
15
|
+
---
|
|
16
|
+
|
|
17
|
+
# Grok Build Orchestration
|
|
18
|
+
|
|
19
|
+
## When to Use
|
|
20
|
+
|
|
21
|
+
- Use when delegating a well-specified implementation task to xAI's Grok Build CLI running headlessly
|
|
22
|
+
- Use when executing a Markdown implementation plan task-by-task with a diff review after each task
|
|
23
|
+
- Use when the user says "use grok", "grok build", "have grok implement", or "send to grok"
|
|
24
|
+
|
|
25
|
+
The coding assistant is the orchestrator: it plans, writes self-contained task specs,
|
|
26
|
+
dispatches them to Grok Build headlessly, reviews every diff, and owns the final result.
|
|
27
|
+
Grok is the fast, cheap executor. Full CLI details and verified behaviors: `references/cli.md`.
|
|
28
|
+
|
|
29
|
+
## Safety Gate
|
|
30
|
+
|
|
31
|
+
Before every dispatch, show the user the exact task specification that will be sent to xAI,
|
|
32
|
+
the target worktree, and the permission mode. Obtain explicit approval to disclose that text
|
|
33
|
+
and to let Grok edit the scoped worktree. Never include secrets, proprietary source, customer
|
|
34
|
+
data, or credentials in a task specification. Do not run `grok update`, `--always-approve`,
|
|
35
|
+
or a destructive recovery command without separate, explicit approval.
|
|
36
|
+
|
|
37
|
+
## When to delegate vs keep with the orchestrator
|
|
38
|
+
|
|
39
|
+
| Delegate to Grok | Keep with the orchestrator |
|
|
40
|
+
|---|---|
|
|
41
|
+
| Plan tasks with clear acceptance criteria | Ambiguous requirements, architecture decisions |
|
|
42
|
+
| Boilerplate, scaffolding, CRUD | Deep cross-file debugging |
|
|
43
|
+
| Mechanical refactors | Security-sensitive code |
|
|
44
|
+
| Test writing from clear specs | Anything touching production infrastructure |
|
|
45
|
+
| UI components from mockups/specs | Tasks where writing the spec ≈ doing the work |
|
|
46
|
+
|
|
47
|
+
When in doubt, keep it with the orchestrator.
|
|
48
|
+
|
|
49
|
+
## Session preflight (once, before the first dispatch)
|
|
50
|
+
|
|
51
|
+
1. `grok update --check --json` — if `updateAvailable` is true, tell the user. Run
|
|
52
|
+
`grok update` only after explicit approval, then confirm with `grok --version`.
|
|
53
|
+
2. `grok models` — if it errors or reports logged out, STOP and ask the user to run
|
|
54
|
+
`grok login`.
|
|
55
|
+
|
|
56
|
+
## Per-task loop (sequential — the default)
|
|
57
|
+
|
|
58
|
+
1. **Spec.** Write a self-contained task file (template below) to a temp directory
|
|
59
|
+
OUTSIDE the target repo — the harness scratchpad if one is available, else the OS
|
|
60
|
+
temp dir. Never write it inside the target repo. Grok has zero conversation context:
|
|
61
|
+
no one-liner prompts, ever.
|
|
62
|
+
- POSIX: `mkdir -p "${TMPDIR:-/tmp}/grok-specs"`, then write `task.md` there.
|
|
63
|
+
- Windows (PowerShell): `New-Item -ItemType Directory -Force "$env:TEMP\grok-specs"`,
|
|
64
|
+
then write `task.md` there.
|
|
65
|
+
2. **Clean state.** No uncommitted *source* changes — commit or stash first, so the
|
|
66
|
+
post-run diff is exactly Grok's work. Ignore build artifacts (`__pycache__`, `dist/`,
|
|
67
|
+
etc.); if they show in `git status`, they're usually just un-gitignored, not your
|
|
68
|
+
concern. Never dispatch on a dirty source tree.
|
|
69
|
+
3. **Dispatch.**
|
|
70
|
+
|
|
71
|
+
POSIX:
|
|
72
|
+
|
|
73
|
+
```bash
|
|
74
|
+
grok --prompt-file <task-file> \
|
|
75
|
+
--output-format json \
|
|
76
|
+
--always-approve \
|
|
77
|
+
--max-turns 30 \
|
|
78
|
+
--cwd <repo>
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
Windows (PowerShell) — backtick line-continuation:
|
|
82
|
+
|
|
83
|
+
```powershell
|
|
84
|
+
grok --prompt-file <task-file> `
|
|
85
|
+
--output-format json `
|
|
86
|
+
--always-approve `
|
|
87
|
+
--max-turns 30 `
|
|
88
|
+
--cwd <repo>
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
Parse the JSON output and save `sessionId`. (`--always-approve` is required for
|
|
92
|
+
headless runs — `--permission-mode acceptEdits` silently cancels edits with no
|
|
93
|
+
interactive approver. Use it only after the user explicitly approves Grok editing this
|
|
94
|
+
exact scoped worktree. See `references/cli.md`.) For a high-stakes task, add `--check`
|
|
95
|
+
so Grok self-verifies before you review; skip it otherwise (it ~doubles latency).
|
|
96
|
+
4. **Review gate — non-negotiable.**
|
|
97
|
+
- Read the diff yourself (`git diff -- <files from the spec>` to skip artifact noise):
|
|
98
|
+
does it do the task, only the task, and match repo conventions?
|
|
99
|
+
- Run the acceptance commands from the spec.
|
|
100
|
+
- **Pass** → commit with a clear message following the repo's convention → next task.
|
|
101
|
+
- **Fail** → ask the user before a fix-up or any reset. Never run `git checkout -- .` or
|
|
102
|
+
`git clean -fd` automatically; preserve the diff for review and use a non-destructive
|
|
103
|
+
recovery plan unless the user explicitly authorizes otherwise.
|
|
104
|
+
|
|
105
|
+
## Task spec template
|
|
106
|
+
|
|
107
|
+
```markdown
|
|
108
|
+
# Task: <one-line title>
|
|
109
|
+
|
|
110
|
+
## Context
|
|
111
|
+
- Repo: <path> — <one line on what the project is>
|
|
112
|
+
- Conventions: <test runner, formatter, a good example file to imitate>
|
|
113
|
+
|
|
114
|
+
## Files
|
|
115
|
+
- Modify: <path>
|
|
116
|
+
- Create: <path>
|
|
117
|
+
|
|
118
|
+
## Task
|
|
119
|
+
<precise description of the change>
|
|
120
|
+
|
|
121
|
+
## Constraints
|
|
122
|
+
- Do not modify any files other than those listed above.
|
|
123
|
+
- <other constraints>
|
|
124
|
+
|
|
125
|
+
## Acceptance criteria
|
|
126
|
+
- `<exact command>` <expected result>
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
## Executing a Markdown implementation plan
|
|
130
|
+
|
|
131
|
+
- One plan task per dispatch, in order.
|
|
132
|
+
- Check off the plan's task checkboxes (`- [ ]` → `- [x]`) as each task lands and passes
|
|
133
|
+
the review gate.
|
|
134
|
+
- If the plan explicitly marks tasks as independent, see Parallel dispatch below;
|
|
135
|
+
otherwise stay sequential.
|
|
136
|
+
|
|
137
|
+
## Parallel dispatch (opt-in exception, not the default)
|
|
138
|
+
|
|
139
|
+
Only when a plan explicitly marks tasks independent: dispatch each with
|
|
140
|
+
`--worktree=<task-slug>`, run concurrently, then review and merge one worktree at a
|
|
141
|
+
time through the same review gate. Merge conflicts usually eat the savings — prefer
|
|
142
|
+
sequential.
|
|
143
|
+
|
|
144
|
+
## Failure handling
|
|
145
|
+
|
|
146
|
+
| Failure | Action |
|
|
147
|
+
|---|---|
|
|
148
|
+
| `stopReason: "Cancelled"`, empty text, no diff | Missing `--always-approve` — retry with it |
|
|
149
|
+
| CLI error / timeout | Retry once; then do the task yourself and note the fallback |
|
|
150
|
+
| Auth expired | Stop; ask the user to run `grok login` |
|
|
151
|
+
| 2 fix-up rounds exhausted | Preserve the diff, ask the user for a recovery decision, then finish the task manually if authorized |
|
|
152
|
+
| Dirty tree at dispatch | Refuse; commit/stash first |
|
|
153
|
+
|
|
154
|
+
## Limitations
|
|
155
|
+
|
|
156
|
+
- Grok receives the approved task specification; it is a third-party service and should not
|
|
157
|
+
receive secrets, proprietary material, personal data, or customer data.
|
|
158
|
+
- `--always-approve` allows edits without an interactive approval prompt. It must be limited to
|
|
159
|
+
a clean, explicitly approved worktree and never substitutes for the orchestrator's review.
|
|
160
|
+
- Model output can be incorrect, insecure, incomplete, or out of scope. Review the diff and
|
|
161
|
+
run the acceptance checks before accepting any change.
|
|
162
|
+
- This skill does not authorize installations, updates, commits, pushes, deployments, or
|
|
163
|
+
destructive cleanup.
|
|
164
|
+
|
|
165
|
+
## Models
|
|
166
|
+
|
|
167
|
+
Default `grok-4.5`. Add `-m grok-composer-2.5-fast` only for trivial mechanical tasks.
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
# Grok Build CLI — headless reference
|
|
2
|
+
|
|
3
|
+
Verified against `grok` 0.2.93 (stable channel), 2026-07-09. Re-verify with
|
|
4
|
+
`grok --help` after major version bumps — flags mirror Claude Code's.
|
|
5
|
+
|
|
6
|
+
## One-shot headless run
|
|
7
|
+
|
|
8
|
+
```bash
|
|
9
|
+
grok -p "prompt" --output-format json
|
|
10
|
+
grok --prompt-file task.md --output-format json # preferred: no shell-quoting issues
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
⚠️ `grok agent` is NOT a one-shot command — it runs the agent as a stdio/WebSocket
|
|
14
|
+
server for SDK/ACP integrations. Always use top-level `grok -p` / `--prompt-file`.
|
|
15
|
+
|
|
16
|
+
## JSON output shape (verified)
|
|
17
|
+
|
|
18
|
+
```json
|
|
19
|
+
{
|
|
20
|
+
"text": "final response text",
|
|
21
|
+
"stopReason": "EndTurn",
|
|
22
|
+
"sessionId": "019f470d-3e02-7601-b726-1133cc72ef76",
|
|
23
|
+
"requestId": "…",
|
|
24
|
+
"thought": "…"
|
|
25
|
+
}
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
`sessionId` is the handle for fix-ups.
|
|
29
|
+
|
|
30
|
+
- POSIX: `grok --prompt-file task.md --output-format json | python3 -c "import json,sys;print(json.load(sys.stdin)['sessionId'])"`
|
|
31
|
+
- Windows (PowerShell): `grok --prompt-file task.md --output-format json | ConvertFrom-Json | Select-Object -ExpandProperty sessionId`
|
|
32
|
+
|
|
33
|
+
`stopReason: "Cancelled"` with empty `text` means a tool call hit a permission gate and
|
|
34
|
+
was auto-cancelled headlessly — you forgot `--always-approve` (see below).
|
|
35
|
+
|
|
36
|
+
## Permissions — the headless gotcha
|
|
37
|
+
|
|
38
|
+
**Use `--always-approve` for headless dispatch. Do NOT rely on
|
|
39
|
+
`--permission-mode acceptEdits`.**
|
|
40
|
+
|
|
41
|
+
Verified 2026-07-09: `--permission-mode acceptEdits` FAILS headlessly — the edit tool
|
|
42
|
+
hits a permission gate with no interactive approver, and the run returns
|
|
43
|
+
`stopReason: "Cancelled"` with no file change. `--always-approve` auto-approves BOTH
|
|
44
|
+
edits AND shell commands in one flag (Grok ran the acceptance test itself in the same
|
|
45
|
+
run). This is safe in the grok-build workflow because dispatch happens on a clean tree,
|
|
46
|
+
the task spec constrains scope, and the orchestrator reviews the full diff before
|
|
47
|
+
committing.
|
|
48
|
+
|
|
49
|
+
Optional hardening: `--sandbox <profile>` (env `GROK_SANDBOX`) restricts filesystem and
|
|
50
|
+
network access — layer it on for untrusted repos.
|
|
51
|
+
|
|
52
|
+
## Resume / fix-up
|
|
53
|
+
|
|
54
|
+
```bash
|
|
55
|
+
grok --resume <sessionId> -p "specific feedback" --always-approve --output-format json
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
Verified: the resumed session retains full context — it knows the repo and files touched
|
|
59
|
+
without re-explanation. Pass only the specific feedback, not the whole task again.
|
|
60
|
+
|
|
61
|
+
## Self-verification (`--check`) — opt-in only
|
|
62
|
+
|
|
63
|
+
`--check` appends a self-verification loop: Grok spawns a verifier subagent that emits a
|
|
64
|
+
checklist, action trace, scope/edge-case evaluation, and its own `VERDICT: PASS`.
|
|
65
|
+
|
|
66
|
+
Verified: correct but ~doubles wall-clock (a trivial task went from a few seconds to
|
|
67
|
+
~48s) and adds token cost, undercutting Grok's speed/cost advantage. Skip it by default —
|
|
68
|
+
the orchestrator's review gate is the authority. Add `--check` only for high-stakes tasks
|
|
69
|
+
where you want Grok to self-correct before review.
|
|
70
|
+
|
|
71
|
+
## Update check (session preflight)
|
|
72
|
+
|
|
73
|
+
```bash
|
|
74
|
+
grok update --check --json
|
|
75
|
+
# → {"currentVersion":"0.2.93","latestVersion":"0.2.93","updateAvailable":false,"channel":"stable",…}
|
|
76
|
+
grok update # installs latest stable
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
## Key flags
|
|
80
|
+
|
|
81
|
+
| Flag | Purpose |
|
|
82
|
+
|---|---|
|
|
83
|
+
| `--always-approve` | Auto-approve all tool executions (edits + shell). **Required for headless.** |
|
|
84
|
+
| `--permission-mode <m>` | `default`, `acceptEdits`, `auto`, `dontAsk`, `bypassPermissions`, `plan` — but see gotcha above |
|
|
85
|
+
| `--allow` / `--deny` | Fine-grained permission rules (Claude Code `--allowedTools` syntax) |
|
|
86
|
+
| `--max-turns <N>` | Turn cap — always set for headless runs |
|
|
87
|
+
| `--check` | Appends a self-verification loop (opt-in; see above) |
|
|
88
|
+
| `--worktree[=name]` | Run in a fresh git worktree (parallel tasks) |
|
|
89
|
+
| `--json-schema '<schema>'` | Constrain final output to a JSON Schema |
|
|
90
|
+
| `-m <model>` | `grok-4.5` (default) or `grok-composer-2.5-fast` |
|
|
91
|
+
| `--cwd <dir>` | Working directory for the run |
|
|
92
|
+
| `--best-of-n <N>` | Run N ways in parallel, pick best (headless) |
|
|
93
|
+
|
|
94
|
+
## Install & auth
|
|
95
|
+
|
|
96
|
+
- Install / update: follow xAI's Grok CLI install docs for your OS; verify with
|
|
97
|
+
`grok --version`. Works on macOS, Linux, and Windows (PowerShell).
|
|
98
|
+
- Auth: grok.com subscription OAuth (`grok login` / `grok logout`). Check with `grok models`.
|
|
99
|
+
- Models available: `grok-4.5` (default), `grok-composer-2.5-fast`.
|
|
@@ -200,7 +200,7 @@ else
|
|
|
200
200
|
echo "$MODELS_WITH_PAPERS" | while read -r model_data; do
|
|
201
201
|
if [[ -n "$model_data" ]]; then
|
|
202
202
|
# Decode base64 and show formatted
|
|
203
|
-
echo "$model_data" | base64 -d | jq -r '
|
|
203
|
+
echo "$model_data" | base64 -d | jq -r ' # security-allowlist: local JSON decoding for display
|
|
204
204
|
"📄 \(.id)
|
|
205
205
|
arXiv: \(.arxiv_tags)
|
|
206
206
|
Task: \(.task)
|