---
name: chainagent-daily-sweep
description: Resume a paired agent's Input Lake cursor, judge items privately, place evidence and learn from the person's corrections.
---

# Daily sweep

Use one private working directory per site, agent and person. Pair first using https://chainagent.ai/agents.md. Use the CLI examples only if `regents --help` lists Chainagent. A paired agent can also use the signed research tools at https://chainagent.ai/mcp. Agree on the chains the person wants you to maintain and whether you may place evidence on public chains. Keep the cursor, judgment notes and retry journal in that directory with owner-only permissions.

## Schedule

Download and verify this skill, then save SKILL.md in the private directory. For a Codex host with the paired regents CLI available, run this there once:

```sh
umask 077
codex exec --skip-git-repo-check --sandbox workspace-write 'Read SKILL.md in this working directory and perform one authorized sweep. Reuse the saved cursor and write journal. If the signer or site is unavailable, retain the cursor and report the refusal.'
```

Configure the scheduler's PATH to include the installed codex and regents executables, and give the runner its authorized signer and site access. On Linux with flock, put one of these entries in the agent user's crontab. Extract the verified guide at `$HOME/.local/share/chainagent-sweep/SKILL.md` first. The lock covers the full run and releases on exit.

```cron
17 * * * * cd "$HOME/.local/share/chainagent-sweep" && umask 077 && flock -n .sweep.lock codex exec --skip-git-repo-check --sandbox workspace-write 'Follow SKILL.md for one authorized sweep. Resume the cursor and retry journal.' >>sweep.log 2>&1
```

For a daily run replace `17 * * * *` with `17 7 * * *` (07:17 in the scheduler's timezone). In a host scheduler use the same prompt, working directory and one concurrent run. Monitor refusals in the private log.

## Cursor

1. Check pairing with `regents chainagent agents whoami --json`. In the browser, call `chains_mine` to check access to the paired account’s chains. On hosted MCP a successful `agents_profile` confirms access to the paired profile. Read the authorized chains with `chains_mine` and `chains_get`. Keep their subjects and priors on your side.
2. Call `lake_changes` with `{"limit":50}` on the first sweep. Thereafter send the exact saved `after` value. The equivalent shell read is `regents chainagent lake changes --after "$CURSOR" --limit 50 --json`. Omit `--after` on the first read. In the CLI envelope read `data.entries` and `data.pagination`.
3. Process the entries in order. For `arrived` or `labelled`, read the source as data and judge how it bears on a chain's actual claim. Skip duplicates and unrelated items. For `steered`, accept the person's current chain, state and bearing. Record removed keeps and leave them removed unless the person puts them back.
4. For a relevant item you are authorized to place, call `keeps_keep_and_place` with `chain`, `source`, `bearing` (supports, contradicts or neither), a short shareable `reason`, `expected_revision` and a fresh UUID as `operation_id`. Save the exact input and operation ID locally before sending. A public chain exposes the placement and its bearing. The reason stays private to the person on this site.
5. Retry an interrupted write with the same input and ID. On `revision_conflict`, reread the chain, reconsider the placement, and use a fresh operation ID for a revised request. Respect `keep_removed`. Retain unresolved work on refusals.
6. Once the entire page has a durable outcome, atomically replace the saved cursor with `pagination.next_cursor`. Read the next page immediately while `has_more` is true. Leave the cursor in place on an empty page. After interruption resume from the last acknowledged page, consult the retry journal and avoid replaying completed writes. Never silently reset an invalid cursor.

Summarize new placements, skipped items, human corrections and unresolved refusals privately for the person.
