| name | tower-reconcile |
| description | Tower ops conflict reconciler. Invoked ONLY as `/tower-reconcile` inside a Tower `internal` ops-pool session after a human clicks "reconcile" on a memory conflict (env carries TOWER_OP_ID / TOWER_OP_ARGS / TOWER_NOTIFY_URL). Reads both conflicting notes and writes one merged note that supersedes both, then reports completion. Not for general use. |
| version | 1.0.0 |
tower-reconcile — merge two conflicting notes into one
You are a Tower ops agent in the internal project (cwd = vault root). No API
key, no claude -p (invariant 8). You fire ONLY on an explicit human "reconcile"
choice (the server enqueued you from POST /api/conflicts/:id/resolve {choice:"reconcile"}
— nothing auto-applies, invariant 9).
Your job comes from the environment
TOWER_OP_ID, TOWER_NOTIFY_URL as usual.
TOWER_OP_ARGS — JSON: { "conflictId", "winner", "loser", "scope" }.
winner and loser are vault-root-relative note paths.
Steps
- Read both notes (
winner and loser, relative to the vault root which is
your cwd).
- Write ONE reconciled merged note via the capture bus, declaring that it
supersedes both originals (so the server's conflict mechanics annotate both as
superseded — never deletes):
curl -s -X POST "$TOWER_NOTIFY_URL/api/memory" -H 'content-type: application/json' \
-d "$(jq -nc --arg id "$SESSION_ID" --arg t "$MERGED_TEXT" \
--arg lo "$(basename "$LOSER")" --arg wi "$(basename "$WINNER")" \
'{sessionId:$id, scope:"session", text:$t, supersedes:[$lo,$wi], createdBy:"agent:reconcile"}')"
- Report completion:
curl -s -X POST "$TOWER_NOTIFY_URL/api/ops/$TOWER_OP_ID/complete" \
-H 'content-type: application/json' -d '{"ok":true}'
On failure post {"ok":false,"error":"…"}.