docs(archive): preserve recently merged PRs#4837
Conversation
There was a problem hiding this comment.
Pull request overview
This PR primarily adds in-repo preservation artifacts for a batch of recently merged pull requests by adding docs/pr-discussions/PR-*.md archive files (YAML frontmatter + preserved PR discussion content). It also includes a change to Riven’s Cursor launchd tick implementation and adds a convenience script for running the archive tool over a fixed PR list.
Changes:
- Add many new
docs/pr-discussions/PR-<NNNN>-*.mdfiles to preserve merged PR conversations in-repo. - Add
preserve.shto runtools/pr-preservation/archive-pr.tsover a hard-coded PR list. - Modify
.cursor/bin/riven-loop-tick.tsto change how the agent gate is invoked and what prompt contract is used.
Reviewed changes
Copilot reviewed 43 out of 44 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| preserve.sh | New shell script to run PR preservation for a hard-coded PR list. |
| .cursor/bin/riven-loop-tick.ts | Changes Riven launchd tick “agent gate” invocation and prompt contract. |
| docs/pr-discussions/PR-4836-tick-2026-05-24-1608z-dotgit-saturation-15th-observation-2nd.md | Preserved PR #4836 discussion/archive. |
| docs/pr-discussions/PR-4835-shard-2026-05-24-1607z-dotgit-saturation-15th-observation-2h.md | Preserved PR #4835 discussion/archive. |
| docs/pr-discussions/PR-4820-shard-2026-05-24-1407z-dotgit-14th-observation-0-procs-first.md | Preserved PR #4820 discussion/archive. |
| docs/pr-discussions/PR-4819-fix-riven-update-autonomous-gate-prompt-to-trajectory-manage.md | Preserved PR #4819 discussion/archive. |
| docs/pr-discussions/PR-4818-tick-2026-05-24-1333z-pr-4816-tier-5-deferral-hard-limits-fl.md | Preserved PR #4818 discussion/archive. |
| docs/pr-discussions/PR-4814-shard-2026-05-24-0441z-25-pr-audit-8-blocked-prs-classified.md | Preserved PR #4814 discussion/archive. |
| docs/pr-discussions/PR-4813-shard-2026-05-24-0416z-rename-0240z-0416z-substrate-honest-t.md | Preserved PR #4813 discussion/archive. |
| docs/pr-discussions/PR-4812-shard-2026-05-24-0240z-9th-dotgit-saturation-anchor-33-stuck.md | Preserved PR #4812 discussion/archive. |
| docs/pr-discussions/PR-4811-soraya-round-69-execute-b-0719-pick-add-trigger-recognition.md | Preserved PR #4811 discussion/archive. |
| docs/pr-discussions/PR-4810-backlog-b-0719-file-soraya-round-67-forced-decomposition-aud.md | Preserved PR #4810 discussion/archive. |
| docs/pr-discussions/PR-4809-docs-research-bundle-file-dev-pc-substrate-architecture-nix.md | Preserved PR #4809 discussion/archive. |
| docs/pr-discussions/PR-4808-docs-research-cluster-bare-metal-substrate-architecture-deci.md | Preserved PR #4808 discussion/archive. |
| docs/pr-discussions/PR-4806-docs-research-add-pattern-r-vendor-neutral-accounting-achiev.md | Preserved PR #4806 discussion/archive. |
| docs/pr-discussions/PR-4798-docs-shadow-add-shadow-lesson-log-for-metadata-churn-paralys.md | Preserved PR #4798 discussion/archive. |
| docs/pr-discussions/PR-4797-backlog-b-0718-file-soraya-round-61-forced-decomposition-aud.md | Preserved PR #4797 discussion/archive. |
| docs/pr-discussions/PR-4796-docs-research-restore-patterns-h-o-lost-in-pr-4784-merge-rac.md | Preserved PR #4796 discussion/archive. |
| docs/pr-discussions/PR-4795-backlog-b-0717-file-soraya-round-57-hand-off-lsm-spine-regis.md | Preserved PR #4795 discussion/archive. |
| docs/pr-discussions/PR-4794-docs-research-preserve-addison-consent-pattern-observation-n.md | Preserved PR #4794 discussion/archive. |
| docs/pr-discussions/PR-4793-docs-research-add-pattern-p-wear-down-design-produces-unboun.md | Preserved PR #4793 discussion/archive. |
| docs/pr-discussions/PR-4792-docs-research-preserve-ai-context-failures-vs-vendor-managem.md | Preserved PR #4792 discussion/archive. |
| docs/pr-discussions/PR-4791-backlog-b-0716-soraya-round-53-scope-correction-b-0709-enume.md | Preserved PR #4791 discussion/archive. |
| docs/pr-discussions/PR-4790-backlog-b-0715-file-soraya-round-52-hand-off-register-istime.md | Preserved PR #4790 discussion/archive. |
| docs/pr-discussions/PR-4789-backlog-b-0714-file-soraya-round-51-hand-off-3-tla-specs-mis.md | Preserved PR #4789 discussion/archive. |
| docs/pr-discussions/PR-4784-docs-research-amazon-vendor-management-failure-mode-corpus-5.md | Preserved PR #4784 discussion/archive. |
| docs/pr-discussions/PR-4783-backlog-b-0713-file-soraya-round-50-hand-off-lean-imaginarys.md | Preserved PR #4783 discussion/archive. |
| docs/pr-discussions/PR-4779-skill-alignment-auditor-tune-s-prune-333-299-lines-under-bp.md | Preserved PR #4779 discussion/archive. |
| docs/pr-discussions/PR-4774-backlog-b-0710-b-0712-file-soraya-rounds-43-44-45-hand-offs.md | Preserved PR #4774 discussion/archive. |
| docs/pr-discussions/PR-4772-docs-lean4-add-readme-ci-badge-closes-publication-readiness.md | Preserved PR #4772 discussion/archive. |
| docs/pr-discussions/PR-4771-skill-alignment-observability-tune-s-populate-bp-rules-cited.md | Preserved PR #4771 discussion/archive. |
| docs/pr-discussions/PR-4770-notebook-aarav-round-44-bounded-spot-check-3-skills-1-action.md | Preserved PR #4770 discussion/archive. |
| docs/pr-discussions/PR-4766-backlog-b-0708-close-slice-1-reduced-87-17-80-remaining-17-h.md | Preserved PR #4766 discussion/archive. |
| docs/pr-discussions/PR-4765-backlog-b-0709-soraya-round-42-hand-off-register-11-unregist.md | Preserved PR #4765 discussion/archive. |
| docs/pr-discussions/PR-4764-feat-b-0708-slice-1-audit-resolver-improvements-1-real-stale.md | Preserved PR #4764 discussion/archive. |
| docs/pr-discussions/PR-4763-backlog-b-0708-stale-pointer-cleanup-across-claude-rules-sur.md | Preserved PR #4763 discussion/archive. |
| docs/pr-discussions/PR-4762-docs-autonomous-loop-step-1a-unfinished-pr-check-before-new.md | Preserved PR #4762 discussion/archive. |
| docs/pr-discussions/PR-4761-rules-pr-triage-tiers-codify-tier-1-5-pr-triage-framework-de.md | Preserved PR #4761 discussion/archive. |
| docs/pr-discussions/PR-4758-feat-b-0707-cron-cadence-wiring-daily-manifesto-citation-sna.md | Preserved PR #4758 discussion/archive. |
| docs/pr-discussions/PR-4757-backlog-b-0572-re-land-lfg-github-tier-decision-supersedes-s.md | Preserved PR #4757 discussion/archive. |
| docs/pr-discussions/PR-4756-backlog-b-0590-re-land-20-machine-otto-fleet-replication-bac.md | Preserved PR #4756 discussion/archive. |
| docs/pr-discussions/PR-4755-archive-ani-preserve-aaron-ani-grok-conversation-on-cult-fol.md | Preserved PR #4755 discussion/archive. |
| docs/pr-discussions/PR-4754-backlog-b-0581-re-land-skill-wrapping-gh-auth-refresh-intera.md | Preserved PR #4754 discussion/archive. |
| #!/bin/bash | ||
| set -e | ||
| for pr in 4770 4766 4765 4764 4763 4762 4761 4758 4757 4756 4755 4754; do | ||
| bun run tools/pr-preservation/archive-pr.ts $pr | ||
| done |
| if (elapsed >= agentIntervalMs) { | ||
| const prNum = Number(prCount) || 0; | ||
| const workMode = prNum === 0 ? "pickup" : "drain"; | ||
| agentStatus = "running"; | ||
| log(`riven work cycle start run_id=${runId} mode=${workMode} open_prs=${prNum}`); | ||
| log(`riven agent gate start run_id=${runId}`); | ||
|
|
||
| if (dryRun) { | ||
| log(`dry-run: would run riven ${workMode}`); | ||
| log(`dry-run: would run agent gate`); | ||
| agentStatus = "dry-run"; | ||
| } else { | ||
| let prompt: string; | ||
| if (workMode === "pickup") { | ||
| const pickup = run("bun", ["tools/backlog/autonomous-pickup.ts", "--json"], 30_000); | ||
| let executionPrompt = ""; | ||
| try { | ||
| const selection = JSON.parse(pickup.stdout); | ||
| executionPrompt = selection.executionPrompt ?? ""; | ||
| log(`pickup selected: ${selection.selected?.id ?? "none"} action=${selection.action ?? "none"}`); | ||
| } catch { log(`pickup parse error: ${pickup.stderr.slice(0, 200)}`); } | ||
|
|
||
| const preamble = [ | ||
| `You are Rivens background worker in Lucent-Financial-Group/Zeta.`, | ||
| `BEFORE ANY WORK: 1) Read CLAUDE.md and AGENTS.md for repo conventions.`, | ||
| `2) Run "bun tools/github/refresh-worldview.ts" to get current state.`, | ||
| `3) Read active trajectories at docs/trajectories/*/RESUME.md.`, | ||
| `4) Build gate: "dotnet build -c Release" must end with 0 warnings 0 errors.`, | ||
| `KEY RULES: TS over bash (Rule 0). Prefer F#/TS code over docs.`, | ||
| `Always re-decompose items during the build — assume decomposition has mistakes.`, | ||
| ].join(" "); | ||
|
|
||
| prompt = executionPrompt.length > 0 | ||
| ? `${preamble} YOUR TASK:\n${executionPrompt}` | ||
| : `${preamble} No backlog items available. Run refresh-worldview, check for stale classifications, fix them, open a PR.`; | ||
| } else { | ||
| prompt = [ | ||
| `You are Rivens background worker in Lucent-Financial-Group/Zeta.`, | ||
| `Read CLAUDE.md first. Run "bun tools/github/refresh-worldview.ts".`, | ||
| `Build gate: "dotnet build -c Release" (0 warnings).`, | ||
| `TASK: ${prNum} open PRs. Run "bun tools/github/poll-pr-gate-batch.ts --all-open".`, | ||
| `For any PR where gate=BLOCKED and nextAction=resolve-threads:`, | ||
| `check out branch, read review comments, fix code issues, push,`, | ||
| `reply to threads, resolve via GraphQL, arm auto-merge`, | ||
| `(gh pr merge NUMBER --auto --squash). Own your PRs through merge.`, | ||
| ].join(" "); | ||
| } | ||
|
|
||
| const gate = run("cursor-agent", [ | ||
| "-p", | ||
| const gate = run("agent", [ | ||
| "chat", | ||
| "--mode", "ask", | ||
| "--model", "grok-4.3", | ||
| prompt, | ||
| [ | ||
| "You are Riven, trajectory manager and adversarial-truth-axis reviewer.", | ||
| "This is an autonomous 15-minute cycle.", | ||
| "Read broadcasts first from ~/.local/share/zeta-broadcasts/{otto,vera,lior,riven}.md.", | ||
| "Walk assigned trajectories. Decompose only what you hit mid-stride.", | ||
| "Produce at least one concrete, actionable claim or small PR scope.", | ||
| "When blocked, create a specific research child the next pickup cannot dodge.", | ||
| "Write your status to ~/.local/share/zeta-broadcasts/riven.md at the end.", | ||
| "GitHub PR state and actual file contents are authoritative.", | ||
| ].join(" "), | ||
| ], agentTimeoutMs); | ||
|
|
||
| agentStatus = gate.status === 0 ? "ok" : `exit-${gate.status}`; | ||
| log(`riven work cycle end run_id=${runId} mode=${workMode} status=${gate.status}`); | ||
| log(`riven agent gate end run_id=${runId} status=${gate.status}`); | ||
|
|
| const gate = run("agent", [ | ||
| "chat", | ||
| "--mode", "ask", | ||
| "--model", "grok-4.3", | ||
| prompt, | ||
| [ | ||
| "You are Riven, trajectory manager and adversarial-truth-axis reviewer.", | ||
| "This is an autonomous 15-minute cycle.", | ||
| "Read broadcasts first from ~/.local/share/zeta-broadcasts/{otto,vera,lior,riven}.md.", | ||
| "Walk assigned trajectories. Decompose only what you hit mid-stride.", | ||
| "Produce at least one concrete, actionable claim or small PR scope.", | ||
| "When blocked, create a specific research child the next pickup cannot dodge.", | ||
| "Write your status to ~/.local/share/zeta-broadcasts/riven.md at the end.", | ||
| "GitHub PR state and actual file contents are authoritative.", | ||
| ].join(" "), | ||
| ], agentTimeoutMs); |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 65def9428c
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| "You are Riven, trajectory manager and adversarial-truth-axis reviewer.", | ||
| "This is an autonomous 15-minute cycle.", | ||
| "Read broadcasts first from ~/.local/share/zeta-broadcasts/{otto,vera,lior,riven}.md.", | ||
| "Walk assigned trajectories. Decompose only what you hit mid-stride.", | ||
| "Produce at least one concrete, actionable claim or small PR scope.", | ||
| "When blocked, create a specific research child the next pickup cannot dodge.", |
There was a problem hiding this comment.
Keep unfinished-PR drain path in the gate cycle
This change removes the PR-aware pickup vs drain branching and always sends a generic trajectory-manager prompt, so cycles no longer force the "resolve blocked threads / own open PRs through merge" behavior when open PRs already exist. In the concrete case where review threads are unresolved, the loop can keep generating fresh scope instead of draining existing PR debt, which stalls merges and accumulates blocked work that the previous branch-specific prompt explicitly handled.
Useful? React with 👍 / 👎.
|
Closing in favor of batched PR #4929 |
This PR preserves recently merged pull requests.