Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 26 additions & 0 deletions .github/clawpatch/factory-zc.config.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# Isolated ZeroClaw config for the clawpatch CI "brain" (the agent that reviews PRs).
# __ZC_TOKEN__ is replaced at CI time from the ANTHROPIC_OAUTH_TOKEN repo secret.
# The Anthropic provider auto-detects the sk-ant-oat01- prefix and uses the OAuth path.
schema_version = 3

[providers.models.anthropic.factory]
model = "claude-sonnet-4-6"
api_key = "__ZC_TOKEN__"

[agents.factory]
model_provider = "anthropic.factory"
enabled = true
risk_profile = "default"
runtime_profile = "default"

# Review is read-only; a default (supervised) risk profile is sufficient for CI.
[risk_profiles.default]

[runtime_profiles.default]
agentic = true
max_tool_iterations = 50

[acp]
default_agent = "factory"
max_sessions = 5
session_timeout_secs = 3600
85 changes: 85 additions & 0 deletions .github/workflows/clawpatch-review.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
name: clawpatch (zeroclaw self-review)

# Reviews the code changed in each PR using ZeroClaw's OWN coding agent as the brain:
# clawpatch (provider=acpx) -> acpx -> `zeroclaw acp` (stdio JSON-RPC) -> ZeroClaw agent -> Claude
#
# Requirements:
# - Repo secret ANTHROPIC_OAUTH_TOKEN: a Claude subscription OAuth token (sk-ant-oat01-...,
# minted with `claude setup-token`). ZeroClaw's Anthropic provider auto-detects the prefix.
#
# Behavior: non-blocking. Findings are posted to the job summary and uploaded as an artifact.
# This is a best-effort first cut — validate on a real PR run and tune timeouts/model as needed.

on:
pull_request:
branches: [master]

permissions:
contents: read

concurrency:
group: clawpatch-${{ github.event.pull_request.number }}
cancel-in-progress: true

jobs:
review:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0

- uses: actions/setup-node@v4
with:
node-version: '22'

- name: Install zeroclaw (prebuilt) + acpx + clawpatch
run: |
set -euo pipefail
ZC_VERSION="v0.8.0"
curl -fsSL "https://github.com/zeroclaw-labs/zeroclaw/releases/download/${ZC_VERSION}/zeroclaw-x86_64-unknown-linux-gnu.tar.gz" | tar -xz
sudo install -m 0755 zeroclaw /usr/local/bin/zeroclaw
zeroclaw --version
# acpx pinned to clawpatch's tested range; clawpatch from npm (swap for your fork if desired)
npm install -g 'acpx@^0.8.0' clawpatch
acpx --version
clawpatch --version

- name: Configure the zeroclaw ACP brain
env:
ZC_TOKEN: ${{ secrets.ANTHROPIC_OAUTH_TOKEN }}
run: |
set -euo pipefail
if [ -z "${ZC_TOKEN:-}" ]; then
echo "::warning::ANTHROPIC_OAUTH_TOKEN secret is not set — the review step will be skipped."
fi
ZC_DIR="$RUNNER_TEMP/factory-zc"
mkdir -p "$ZC_DIR"
umask 077
sed "s|__ZC_TOKEN__|${ZC_TOKEN:-}|" .github/clawpatch/factory-zc.config.toml > "$ZC_DIR/config.toml"
mkdir -p "$HOME/.acpx"
printf '{"defaultAgent":"zeroclaw","agents":{"zeroclaw":{"command":"zeroclaw","args":["acp","--config-dir","%s"]}}}\n' "$ZC_DIR" > "$HOME/.acpx/config.json"
echo "ZC_DIR=$ZC_DIR" >> "$GITHUB_ENV"

- name: Review changed code via zeroclaw
continue-on-error: true
env:
CLAWPATCH_PROVIDER: acpx
CLAWPATCH_MODEL: zeroclaw
CLAWPATCH_ACPX_TIMEOUT_MS: '600000'
run: |
set -uo pipefail
clawpatch init || true
clawpatch ci --since "origin/${{ github.base_ref }}" --output clawpatch-report.md || true
if [ -s clawpatch-report.md ]; then
{ echo '## 🦞 clawpatch — zeroclaw self-review'; echo; cat clawpatch-report.md; } >> "$GITHUB_STEP_SUMMARY"
else
echo 'clawpatch produced no report (no changed features, or the brain was unavailable).' >> "$GITHUB_STEP_SUMMARY"
fi

- uses: actions/upload-artifact@v4
if: always()
with:
name: clawpatch-report
path: clawpatch-report.md
if-no-files-found: ignore
35 changes: 35 additions & 0 deletions .github/workflows/sync-upstream.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: sync fork with upstream

# Keeps this fork's `master` current with zeroclaw-labs/zeroclaw by merging upstream
# in daily. Fork-only files (the clawpatch CI) have no upstream counterpart, so the
# merge is clean; if a real conflict ever appears the run fails so you can resolve it.
on:
schedule:
- cron: "17 7 * * *"
workflow_dispatch: {}

permissions:
contents: write

jobs:
sync:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Merge upstream/master into master
run: |
set -euo pipefail
git config user.name "github-actions[bot]"
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
git remote add upstream https://github.com/zeroclaw-labs/zeroclaw.git
git fetch upstream master
BEFORE=$(git rev-parse HEAD)
git merge --no-edit upstream/master
if [ "$(git rev-parse HEAD)" != "$BEFORE" ]; then
git push origin HEAD:master
echo "synced: merged upstream/master into master"
else
echo "already up to date with upstream/master"
fi
3 changes: 3 additions & 0 deletions apps/zerocode/locales/en/zerocode.ftl
Original file line number Diff line number Diff line change
Expand Up @@ -346,6 +346,8 @@ zc-chat-error-fetch-agents = Failed to fetch agents: { $error }
zc-chat-error-create-session = Failed to create session: { $error }
zc-chat-session-restarted = New session started.
zc-chat-session-restart-error = Failed to start a new session: { $error }
zc-chat-agent-switched = Switched to agent { $alias }.
zc-chat-agent-switched-cleared = Switched to agent { $alias }. Your draft and queued messages were discarded.

zc-chat-thinking-visible = Thinking output: visible
zc-chat-thinking-hidden = Thinking output: hidden
Expand Down Expand Up @@ -376,6 +378,7 @@ zc-chat-help-navigate = Navigate
zc-chat-help-select-agent = Select agent
zc-chat-help-quit = Quit
zc-chat-help-switch-session = Switch session
zc-chat-help-switch-agent = Switch agent
zc-chat-help-close = Close
zc-chat-help-cancel = Cancel
zc-chat-help-approve = Approve
Expand Down
Loading
Loading