rein-aharness/docs/task-intake.md
tegwick 8cb004a558 Define repository grant contract
Assistant: codex
Assistant-Model: gpt-5.6-sol
Assistant-Session: 01a02b6f-7db1-7222-918b-e813a6bda38d
2026-08-23 13:23:50 +02:00

110 lines
3.4 KiB
Markdown

# Task intake
**Architecture:** ACT-ADR-005 · ACTIVITY-WP-0026 · REIN-A-0002
## Primary: activity-core `ops_run` (scheduled automation)
Internal fleet automation (FI daily brief, Binky rhythm, mail intake, …)
emits a claimable **`ops_run`** in activity-core. rein-aharness claims that
row — **not** issue-core and **not** Forgejo.
```
activity-core (Temporal + rules)
→ INSERT ops_run (open) + dual-write activity_task_spawn (state-hub)
→ rein-aharness claim-loop
POST /ops-runs/claim → approach registry → execute → complete/fail
→ domain completion events (fi_daily_brief, binky_daily_brief, …)
```
Full guide: **`docs/ops-run-claim-loop.md`**.
### CLI
```bash
export ACTIVITY_CORE_URL=http://127.0.0.1:8010
export ACTIVITY_CORE_WORKER_TOKEN=
export AGENT_HARNESS_REPO_MAP='{"freedom-intelligence":"~/freedom-intelligence","binky-control":"~/binky-control"}'
rein-aharness poll --source=ops-run --no-claim
rein-aharness run --from-ops-run
rein-aharness claim-loop
```
`TaskExecutorWorkflow` in activity-core stays a stub; execution lives here.
Activity Core does not yet emit the versioned `repository_grant` required by
the lease-bound transaction path. The harness must not infer one from labels,
task prose, `execution_refs`, or target-repo lookup. See
**`docs/repository-grant.md`** for the parsed-but-not-enabled v1 contract.
---
## Legacy / external: issue-core poll
issue-core remains for **external tracker tickets** and intentional
`ISSUE_SINK_TYPE=rest` projections to **Forgejo** (self-hosted forge only —
no Gitea product path).
```
activity-core (optional rest sink)
→ issue-core POST /issues/
→ rein-aharness poll --source=issue-core
→ run_task / close
```
Do **not** use this path as the claim queue for FI/Binky ops under WP-0022.
### issue-core worker API
| Method | Path | Role |
|--------|------|------|
| POST | `/issues/` | Ingest (activity-core rest sink) |
| GET | `/issues/?state=open&label=automated` | Poll queue |
| GET | `/issues/{id}` | Fetch one |
| PATCH | `/issues/{id}` | Claim (`in_progress` + assignee) or `closed` |
Auth: `Authorization: Bearer $ISSUE_CORE_API_KEY` or `X-API-Key`.
```bash
export ISSUE_CORE_URL=http://127.0.0.1:8765
export ISSUE_CORE_API_KEY=
rein-aharness poll --source=issue-core
rein-aharness run --from-issue-core
```
Default label filter: **`automated`** (`AGENT_HARNESS_INTAKE_LABELS`).
---
## Mail path (server / Railiance)
```
rein-aharness mail-scan # deterministic IMAP (AppRole)
rein-aharness mail-triage # llm-connect HTTP → JSON → apply mail-log + commit
# or via claim-loop when ops_run labels include mail-intake
```
Requires `LLM_CONNECT_URL`. **No Claude CLI** required for mail/brief approaches.
---
## Agent + completion event mapping (issue-core / agent-session)
From `activity_definition_id` or labels:
| Hint | Instance agent | completion_event_type |
|------|----------------|------------------------|
| `binky-daily-rhythm` / `rhythm` | `coach` | `binky_daily_brief` |
| `binky-weekly-mail-intake` / `mail-intake` | `mail-triage` | `binky_mail_intake` |
| `binky-weekly-review-prep` / `weekly-review` | `review-prep` | `binky_weekly_review` |
| else | `coach` | `executor_run` |
Approach registry for ops_run (preferred): see `docs/ops-run-claim-loop.md`.
---
## Repo path resolution
1. Absolute/expanded path if it is already a git repo
2. `AGENT_HARNESS_REPO_MAP` JSON
3. Search `AGENT_HARNESS_REPO_ROOTS` (default `~:~/work`) for the slug