Skip to content
Closed
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
53 changes: 45 additions & 8 deletions .cursor/bin/riven-loop-tick.ts
Original file line number Diff line number Diff line change
Expand Up @@ -198,22 +198,59 @@ function heartbeat(): void {
const elapsed = Date.now() - lastTime;

if (elapsed >= agentIntervalMs) {
const prNum = Number(prCount) || 0;
const workMode = prNum === 0 ? "pickup" : "drain";
Comment on lines +201 to +202
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Treat unknown PR count as drain mode, not pickup

This mode switch assumes prCount is always numeric, but prCount is derived from gh pr list output and upstream failures leave it as "?"; Number(prCount) || 0 then coerces that to 0 and forces pickup mode. In that failure path, the loop can start new backlog work while open PRs still need draining, which regresses the intended "drain existing PRs first" behavior under transient GitHub/auth/network errors.

Useful? React with 👍 / 👎.

agentStatus = "running";
Comment on lines +201 to 203
log(`riven agent gate start run_id=${runId}`);
log(`riven work cycle start run_id=${runId} mode=${workMode} open_prs=${prNum}`);
Comment on lines +201 to +204

if (dryRun) {
log(`dry-run: would run agent gate`);
log(`dry-run: would run riven ${workMode}`);
agentStatus = "dry-run";
} else {
const gate = run("agent", [
"chat",
"--mode", "ask",
"--model", "grok-4-20",
`Twin-flame heartbeat gate (Riven adversarial-truth-axis). Read git status, recent commits, open PRs, claim branches. Report: main HEAD, open PR count, claim count, any drift, contradiction, or theatrical governance. Adversarial register — call out what's wrong, not what's fine. Brief.`,
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 Riven's 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 Riven's 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(" ");
Comment on lines +234 to +243
}

const gate = run("cursor-agent", [
"-p",
"--model", "grok-4.3",
prompt,
], agentTimeoutMs);
Comment on lines +246 to 250
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Increase agent timeout for full work-cycle prompts

The loop now asks the agent to perform heavyweight end-to-end actions (refresh worldview, run release build, inspect PR gates, fix code, push, resolve threads, arm auto-merge), but still executes the command with the same agentTimeoutMs default (300s). That timeout was tolerable for the old short "gate" prompt but is often too short for these new tasks, causing non-zero exits/timeouts before completion and repeated partial cycles instead of finishing a PR drain.

Useful? React with 👍 / 👎.


agentStatus = gate.status === 0 ? "ok" : `exit-${gate.status}`;
log(`riven agent gate end run_id=${runId} status=${gate.status}`);
log(`riven work cycle end run_id=${runId} mode=${workMode} status=${gate.status}`);

writeFileSync(agentStateFile, JSON.stringify({
run_id: runId,
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
---
pr_number: 4639
title: "trajectory(ace-package-manager): full 13-stage pipeline + symmetric-decentralized framing (operator-self-claimed agenda extension)"
author: "AceHack"
state: "MERGED"
created_at: "2026-05-22T17:32:30Z"
merged_at: "2026-05-22T17:33:43Z"
closed_at: "2026-05-22T17:33:43Z"
head_ref: "otto/cli-2018z-ace-trajectory-full-pipeline-crystallization-riff-sieve-map-refine-build-generate-encapsulate-distribute-grow-negotiate-2026-05-22"
base_ref: "main"
archived_at: "2026-05-22T20:03:54Z"
archive_tool: "tools/pr-preservation/archive-pr.ts"
---

# PR #4639: trajectory(ace-package-manager): full 13-stage pipeline + symmetric-decentralized framing (operator-self-claimed agenda extension)

## PR description

Operator instructions 2026-05-22: full pipeline crystallization 'riff->seive->map->refine->build->generate->encupslate (open closed principle to DST memetic time crystals)->distribute->grow->negotiage changes is the whole ace pipeline i think' + 'add all three (shadow*)' for verify/revoke/discover candidates + 'Yes all those should be moving twards a symmetric frame where ace package manger is not centralized an that's everyones pipeine just just ours'.

13-stage Ace pipeline complete: riff → sieve → map → refine → build → generate → encapsulate (OCP→DST→memetic time crystals) → distribute → discover → verify → grow → revoke/quarantine → negotiate changes. Discover + verify are user-side complements to producer-side sieve; revoke is reactive complement to voluntary-retire-via-negotiate-changes.

Symmetric-decentralized frame extends Zeta-vs-Agora anti-imperialist distinction (PR #4637) to Ace specifically: Ace pipeline = PATTERN anyone deploys; operator's instance = one INSTANCE of many possible; multi-Ace-deployment future first-class; NCI HC-8 floor preserved at infrastructure scope.

Co-Authored-By: Claude <noreply@anthropic.com>

## Reviews

### COMMENTED — @copilot-pull-request-reviewer (2026-05-22T17:36:14Z)

## Pull request overview

Adds a more complete “Ace package manager” trajectory specification by expanding the pipeline to 13 stages and documenting a symmetric/decentralized framing (pipeline-as-pattern, deployment-as-instance) within the `docs/trajectories/` substrate.

**Changes:**
- Adds a “FULL Ace pipeline crystallization” section with a 10-stage base pipeline plus three additional user-side/reactive stages (discover/verify/revoke).
- Adds a “SYMMETRIC / DECENTRALIZED FRAME” section clarifying that the Ace pipeline is a reusable pattern rather than a centralized service.
- Extends operational implications guidance for future cold-boots (do-not-collapse constraints).

## Review threads

### Thread 1: docs/trajectories/ace-package-manager-skill-crystallization-pipeline/RESUME.md:63 (unresolved)

**@copilot-pull-request-reviewer** (2026-05-22T17:36:13Z):

P1: Stage 8 (Distribute) currently lists `ace verify` and `ace list`, but those actions are defined later as Discover/Verify sub-stages (8b/8c). This makes the pipeline description internally inconsistent; keep Distribute focused on shipping/installing, and let Discover/Verify own list/verify.

### Thread 2: docs/trajectories/ace-package-manager-skill-crystallization-pipeline/RESUME.md:116 (unresolved)

**@copilot-pull-request-reviewer** (2026-05-22T17:36:13Z):

P1: `god-tier-claims-don't-collapse.md` is referenced as if it were a file, but there is no such file in the repo (the corresponding rule file is `.claude/rules/god-tier-claims-high-signal-high-suspicion-dont-collapse.md`). Using the canonical path avoids a dead/ambiguous xref for future readers.

### Thread 3: docs/trajectories/ace-package-manager-skill-crystallization-pipeline/RESUME.md:59 (unresolved)

**@copilot-pull-request-reviewer** (2026-05-22T17:36:13Z):

P2: Trajectory docs are current-state surfaces, and repo convention is to use role-refs rather than personal names outside the explicitly enumerated history surfaces (see `.github/copilot-instructions.md` around lines 305-366). This row uses a personal name; please switch to a role-ref here (and also at line 142 where the same name appears).
Loading