Files
Jyotisha/tools/agent-loop/prompts/loop-grok.md
T

45 lines
3.2 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# Grok 侧 `/loop` 提示词(Windows)
Grok 侧与 Claude 侧对称:在一个常开的 Grok Build 会话里跑 `/loop`。`grok-tick.ps1` / `install-grok.ps1` 降为备用。`/loop` 的具体写法(间隔参数格式)以 Grok 自己的说明为准。
## 启动会话前(PowerShell,每次开会话都要)
推送钩子只在这个窗口的进程里生效,不写进共用的 `.git`。钩子先复制到工作树外的固定目录(工作树每单都会切分支,目录不能跟着变)。
首次(以及钩子更新后)复制一次:
```powershell
$src = "G:\Ferti\Jyotisha\.worktrees\agent-loop\tools\agent-loop"
New-Item -ItemType Directory -Force "$HOME\.jyotisha-agent\hooks\grok", "$HOME\.jyotisha-agent\bin" | Out-Null
Copy-Item -Force "$src\hooks\grok\pre-push" "$HOME\.jyotisha-agent\hooks\grok\pre-push"
Copy-Item -Force "$src\gitea.ps1" "$HOME\.jyotisha-agent\bin\gitea.ps1"
```
每次开会话:
```powershell
cd G:\Ferti\Jyotisha\.worktrees\agent-loop
$env:PATH = "D:\Program Files\Git\bin;" + $env:PATH
$env:GIT_CONFIG_COUNT = "1"
$env:GIT_CONFIG_KEY_0 = "core.hooksPath"
$env:GIT_CONFIG_VALUE_0 = "$HOME\.jyotisha-agent\hooks\grok"
$perm = Get-Content -Raw -Encoding UTF8 tools\agent-loop\grok-permissions.json | ConvertFrom-Json
$grokArgs = @('--permission-mode', $perm.mode)
foreach ($r in $perm.allow) { $grokArgs += @('--allow', $r) }
foreach ($r in $perm.deny) { $grokArgs += @('--deny', $r) }
grok @grokArgs
```
验证钩子生效(应被拒):`git push --dry-run origin HEAD:refs/heads/main`(目标与 HEAD 相同时 git 不调钩子,所以用 main)。
## 粘贴的提示词(每 15 分钟)
```
/loop 15m 盯一下 Gitea 上同时带 agent/待执行 和 agent/试点 标签的 issue(Gitea 一律只用 `powershell -NoProfile -ExecutionPolicy Bypass -File C:\Users\74082\.jyotisha-agent\bin\gitea.ps1 <命令>`:issues、issue、labels、add-label、remove-label、comments、comment,用法见脚本开头;评论先写成 UTF-8 文件再用 comment 发)。(gitea.ps1 只返回 jesse 账号写的正文和评论。)有活就取最老的一单:先加 agent/执行中 锁标签;从最新一条首行是 <!-- agent:claude plan ... --> 或 <!-- agent:claude review ... verdict=fail ... --> 的评论里读出 brief= 和 branch=;在当前工作树 git fetch 后检出这个分支(远端已有就基于远端,没有就基于 origin/staging);然后严格按 tools/agent-loop/prompts/grok-execute.md 实现、自测、只推这个 codex 分支。做完发一条评论,首行是 <!-- agent:grok report branch=<分支> sha=<推送后远端 40 位 SHA> -->,下面写中文回报;把状态标签换成 agent/待验收,去掉锁标签。需要产品决定的,首行写 <!-- agent:grok decision -->,标签换成 agent/需拍板 并 @jesse。永远不推 staging 和 main,不删分支,不加 --no-verify。评论写给不懂代码的人看,不写任何用户个人资料。没有可处理的 issue 就什么都不做。
```
## 注意
- 会话里的 `/loop` 7 天后过期,每周重开一次会话并重新粘贴(Claude 侧同理)。
- 白名单不放行任意 `powershell -Command`:那样藏在里面的推送或读令牌会绕过所有规则。Gitea 只能经 `gitea.ps1`。