sync: auto-sync from GURU-5070 at 2026-06-04 09:45:37

Author: Mike Swanson
Machine: GURU-5070
Timestamp: 2026-06-04 09:45:37
This commit is contained in:
2026-06-04 09:45:42 -07:00
parent c2b137a739
commit 9f565f5808
9 changed files with 404 additions and 53 deletions

View File

@@ -35,6 +35,7 @@ py "$CLAUDETOOLS_ROOT/.claude/skills/coord/scripts/coord.py" <command> ...
| `lock claim <project> <resource> "<desc>" [--ttl HOURS]` | Claim a work lock (default ttl 2h). |
| `lock release <id>` | Release a lock. |
| `lock list [--project KEY]` | List active locks. |
| `component set <project> <component> <state> [--version V] [--notes TXT]` | Update a component's deploy state (auto-fills `updated_by`). E.g. `component set gururmm dashboard deployed --version 0.2.39`. |
## Conventions it handles for you

View File

@@ -192,6 +192,17 @@ def c_lock_list(a):
print(f" {str(l.get('id',''))[:8]} {l.get('project_key')}:{l.get('resource')} by {l.get('session_id')} exp {l.get('expires_at')}")
def c_comp_set(a):
payload = {"state": a.state, "updated_by": SESSION}
if a.version:
payload["version"] = a.version
if a.notes:
payload["notes"] = a.notes
st, r = call("PUT", f"/components/{a.project}/{a.component}", payload)
die(st, r, ok=(200, 201))
print(f"[coord] component {a.project}/{a.component} -> state={a.state}" + (f" v{a.version}" if a.version else ""))
def main():
p = argparse.ArgumentParser(prog="coord.py", description="ClaudeTools coordination API helper")
sub = p.add_subparsers(dest="cmd", required=True)
@@ -212,6 +223,10 @@ def main():
tl.add_argument("--status", default="pending"); tl.set_defaults(fn=c_todo_list)
td = t.add_parser("done"); td.add_argument("id"); td.set_defaults(fn=c_todo_done)
cp = sub.add_parser("component").add_subparsers(dest="sub", required=True)
cs = cp.add_parser("set"); cs.add_argument("project"); cs.add_argument("component"); cs.add_argument("state")
cs.add_argument("--version"); cs.add_argument("--notes"); cs.set_defaults(fn=c_comp_set)
lk = sub.add_parser("lock").add_subparsers(dest="sub", required=True)
lc = lk.add_parser("claim"); lc.add_argument("project"); lc.add_argument("resource")
lc.add_argument("desc"); lc.add_argument("--ttl", type=int, default=2); lc.set_defaults(fn=c_lock_claim)

View File

@@ -30,8 +30,9 @@ bash "$CLAUDETOOLS_ROOT/.claude/skills/grok/scripts/ask-grok.sh" <mode> ...
| Mode | Usage | What it does |
|------|-------|--------------|
| `text` | `ask-grok.sh text "<prompt>"` | One-shot text answer (independent model). Prints to stdout. |
| `verify` | `ask-grok.sh verify "<claim/finding>"` | Adversarial second opinion — Grok tries to REFUTE, returns CONFIRMED/REFUTED + reason. |
| `text` | `ask-grok.sh text "<prompt>"` or `text --prompt-file <path>` | One-shot text answer (independent model). `--prompt-file` for long content (review/summarize a doc). |
| `verify` | `ask-grok.sh verify "<claim/finding>"` or `verify --prompt-file <path>` | Adversarial second opinion — Grok tries to REFUTE/find gaps, returns a verdict + reasons. |
| `review` | `ask-grok.sh review <file-path> ["<instructions>"]` | Grok reads the file at `<path>` itself (its `read_file` tool, run in the repo) and reviews it — no embedding, handles large files, can pull in referenced files. |
| `image` | `ask-grok.sh image "<prompt>" [out.png]` | `image_gen` (Imagine) → copies the artifact to `out` (default `grok-image.png`). |
| `video` | `ask-grok.sh video "<motion prompt>" <input-image> [out.mp4]` | `image_to_video` on an input image → copies to `out`. ~60-90s. |
| `xsearch` | `ask-grok.sh xsearch "<query>"` | Live `web_search` + X/Twitter tools; returns text with citations. |

View File

@@ -67,13 +67,15 @@ MODE="${1:-}"; shift 2>/dev/null || true
TMP="$(mktemp -d)"; trap 'rm -rf "$TMP"' EXIT
WORK="$TMP/work"; mkdir -p "$WORK"
PF="$TMP/prompt.txt"; OUT="$TMP/out.json"
RUN_CWD="$WORK" # grok's working dir; the 'review' mode overrides to the repo so read_file can reach repo files
REPO_ROOT="${CLAUDETOOLS_ROOT:-$(cd "$SCRIPT_DIR/../../../.." 2>/dev/null && pwd)}"
# run grok headless. $1=timeout secs; rest=extra flags. Reads $PF -> $OUT.
# Never fails the script on grok's exit code (Cancelled is expected; we read artifacts).
run_grok() {
local to="$1"; shift
timeout "$to" "$GROK" --prompt-file "$PF" --output-format json \
--permission-mode dontAsk --no-subagents --no-plan --cwd "$WORK" "$@" \
--permission-mode dontAsk --no-subagents --no-plan --cwd "$RUN_CWD" "$@" \
>"$OUT" 2>"$TMP/err.txt" || true
}
@@ -92,16 +94,24 @@ find_artifact() {
case "$MODE" in
text|verify)
[ -z "${1:-}" ] && { echo "usage: $SELF $MODE \"<prompt>\"" >&2; exit 2; }
# content from --prompt-file <path> (good for long docs) or the positional arg
SRC=""
if [ "${1:-}" = "--prompt-file" ]; then
[ -f "${2:-}" ] || { echo "[$SELF] prompt file not found: ${2:-}" >&2; exit 2; }
SRC="$(cat "$2")"
else
SRC="${1:-}"
fi
[ -z "$SRC" ] && { echo "usage: $SELF $MODE \"<prompt>\" | $SELF $MODE --prompt-file <path>" >&2; exit 2; }
# Prompt-level steering keeps it text-only and (for verify) adversarial.
# (The --disallowed-tools/--rules flags tripped the CLI; --check adds a slow
# multi-turn self-check loop — both avoided in favor of prompt steering.)
if [ "$MODE" = "verify" ]; then
printf 'Adversarially evaluate the following claim/finding: try hard to find any reason it is WRONG. Then give a one-line verdict (CONFIRMED or REFUTED) plus a one-sentence justification. Answer in text only; do not use tools. Claim/finding: %s' "$1" > "$PF"
printf 'Adversarially evaluate the following claim/finding/document: try hard to find any reason it is WRONG, incomplete, or overstated. Then give a verdict plus specific justification. Answer in text only; do not use tools. Content:\n%s' "$SRC" > "$PF"
else
printf 'Answer directly in text; do not use tools. %s' "$1" > "$PF"
printf 'Answer directly in text; do not use tools.\n%s' "$SRC" > "$PF"
fi
run_grok 120 --disable-web-search --max-turns 2
run_grok 180 --disable-web-search --max-turns 3
txt="$(jfield text)"
if [ -n "$txt" ]; then printf '%s\n' "$txt"; else
echo "[$SELF] no text (stopReason=$(jfield stopReason)); raw: $OUT" >&2; exit 1; fi
@@ -136,6 +146,19 @@ case "$MODE" in
if [ -n "$txt" ]; then printf '%s\n' "$txt"; else
echo "[$SELF] no result (stopReason=$(jfield stopReason))" >&2; exit 1; fi
;;
review|file)
[ -z "${1:-}" ] && { echo "usage: $SELF review <file-path> [instructions]" >&2; exit 2; }
target="$1"
instr="${2:-Give an independent, critical review of this file: accuracy, gaps/omissions, and concrete improvements. Be specific.}"
# Grok reads the file itself (no embedding) -- run it in the repo so read_file resolves repo-relative paths.
[ -f "$target" ] || [ -f "$REPO_ROOT/$target" ] || { echo "[$SELF] file not found: $target" >&2; exit 2; }
RUN_CWD="$REPO_ROOT"
printf 'Use your read_file tool to read the file at this path (relative to your current directory), then do the task and stop. You may also read closely-related files it references if that helps. Do not modify anything.\nPath: %s\n\nTask: %s' "$target" "$instr" > "$PF"
run_grok 240 --max-turns 12
txt="$(jfield text)"
if [ -n "$txt" ]; then printf '%s\n' "$txt"; else
echo "[$SELF] no result (session=$(jfield sessionId), stopReason=$(jfield stopReason))" >&2; exit 1; fi
;;
raw)
"$GROK" "$@"
;;