mirror of
https://github.com/wassname/pi-goals.git
synced 2026-09-11 12:43:57 +08:00
Repeat the agreed plan on every supervisor review
This commit is contained in:
@@ -65,6 +65,8 @@ Keep the prompt generic. Do not prescribe pueue, Modal, worktrees, or a particul
|
||||
|
||||
Use `@monotykamary/pi-supervisor` as a behavioral reference, not an implementation to copy wholesale. Its outcome focus, autonomous continuation, and instruction not to repeat ineffective steering are useful. Judge our behavior in real sessions, not by test counts alone.
|
||||
|
||||
Pi/OpenAI implementation: every supervisor review rereads the current plan above `## Log`, including its outcome and discriminators. A short role reminder repeats on startup, after compaction, after any change to that plan section (including goal ticks), and after N supervisor turns. Set `PI_GOALS_SUPERVISOR_REMINDER_TURNS` in the launch environment; default 5, positive integers only. This reminder supports judgment; it does not establish that the goal was achieved.
|
||||
|
||||
Keep brief visible recaps that add judgment rather than repeat unchanged status. Preserve useful reasoning and evidence checks; reduce redundant context and reviews before reducing judgment. Manual checkbox changes are claims, not proof of completion. Plan edits should reach the supervisor so it can judge drift and direct corrections.
|
||||
|
||||
## Earlier supervision workflow discussion
|
||||
|
||||
@@ -0,0 +1,20 @@
|
||||
# VCC functional acceptance
|
||||
|
||||
Pi/OpenAI observed the isolated interactive worker in Herdr pane `w8:p54`, task repo `/tmp/pi-goals-vcc-functional-task`, using source commit `039f4a4`. Parent submitted the trivial exact-byte goal and selected Ready. The pair then completed without parent task execution or steering.
|
||||
|
||||
Observed rendered output:
|
||||
|
||||
> [supervisor] Supervisor approval is recorded. Call CompleteGoal for Deliver the committed hello file with byte proof and completion approval now. Do not change any files or run further work.
|
||||
|
||||
> CompleteGoal
|
||||
> Sign-off accepted. Goal ticked [x] in .pi/plan/01a083f1-296e-7594-8623-3e009c90a85d-v1.md.
|
||||
|
||||
Parent independently read artifact bytes with `od -An -tx1 hello.txt`:
|
||||
|
||||
```
|
||||
48 65 6c 6c 6f 20 66 72 6f 6d 20 56 43 43 2e 0a
|
||||
```
|
||||
|
||||
These encode `Hello from VCC.` plus one newline. Task commit: `a701105 Add verified VCC hello file`.
|
||||
|
||||
This establishes successful real planning/Ready/supervised completion with the VCC dependency loaded. It does not establish improved scientific judgment or cost savings. Replay comparisons are in `review.md`. The subsequent goal-repeat/reminder change was not loaded in this pair; its cadence, changed-checkbox and compaction behavior were checked separately in automated tests. Rejecting a valid artifact that fails a scientific goal remains a behavioral acceptance gap.
|
||||
@@ -91,6 +91,12 @@ export function isVisibleSupervisor(): boolean {
|
||||
export function registerVisibleSupervisor(pi: ExtensionAPI): void {
|
||||
const settings = config();
|
||||
let compacting = false;
|
||||
const reminderEvery = Number(process.env.PI_GOALS_SUPERVISOR_REMINDER_TURNS ?? 5);
|
||||
if (!Number.isInteger(reminderEvery) || reminderEvery < 1) throw new Error("PI_GOALS_SUPERVISOR_REMINDER_TURNS must be a positive integer.");
|
||||
let turnsSinceReminder = reminderEvery;
|
||||
let previousPlan = "";
|
||||
pi.on("turn_end", async () => { turnsSinceReminder++; });
|
||||
pi.on("session_compact", async () => { turnsSinceReminder = reminderEvery; });
|
||||
let bootstrapping = false;
|
||||
let warnedUnknownUsage = false;
|
||||
let modelError: string | null = null;
|
||||
@@ -165,7 +171,14 @@ export function registerVisibleSupervisor(pi: ExtensionAPI): void {
|
||||
pi.on("tool_call", async (event) => {
|
||||
if (BLOCKED_TOOLS.has(event.toolName.toLowerCase())) return { block: true, terminate: true, reason: "Supervisor is read-only; use SteerWorker for the bound worker, not the general intercom tool." };
|
||||
});
|
||||
pi.on("before_agent_start", async (_event, ctx) => ({ systemPrompt: `${ctx.getSystemPrompt()}\n\n${supervisorPrompt(settings)}` }));
|
||||
pi.on("before_agent_start", async (_event, ctx) => {
|
||||
const plan = readFileSync(settings.planPath, "utf8").split(/^## Log\s*$/m)[0].trim();
|
||||
const remind = plan !== previousPlan || turnsSinceReminder >= reminderEvery;
|
||||
previousPlan = plan;
|
||||
if (remind) turnsSinceReminder = 0;
|
||||
const reminder = remind ? "\n\nSupervisor role reminder: Supervise autonomously toward the agreed outcome. Use judgment, investigate blockers, keep useful work moving, and inspect the result before accepting completion. A checkbox change is a claim to review, not proof." : "";
|
||||
return { systemPrompt: `${ctx.getSystemPrompt()}\n\n${supervisorPrompt(settings)}\n\nCurrent agreed plan (reread for every review):\n${plan}\n\nJudge progress against this outcome and its discriminators. A completed artifact or task is not completion unless it satisfies the agreed goal.${reminder}` };
|
||||
});
|
||||
pi.on("agent_settled", async (_event, ctx) => {
|
||||
if (compacting) return;
|
||||
const usage = ctx.getContextUsage();
|
||||
|
||||
@@ -131,9 +131,21 @@ describe("visible supervisor session", () => {
|
||||
it("asks for judgment and useful recaps without inventing instructions", async () => {
|
||||
const cwd = mkdtempSync(join(tmpdir(), "pi-goals-prompt-"));
|
||||
try {
|
||||
writeFileSync(join(cwd, "plan.md"), "# Outcome\nBeat random\n1. [ ] goal: repair\n - discriminator: beats random\n## Log\nold history");
|
||||
const runtime = setup(cwd, join(cwd, "plan.md"));
|
||||
const { systemPrompt } = await runtime.hooks.get("before_agent_start")({}, runtime.ctx);
|
||||
expect(systemPrompt).toContain("brief visible recap");
|
||||
expect(systemPrompt).toContain("discriminator: beats random");
|
||||
expect(systemPrompt).not.toContain("old history");
|
||||
expect(systemPrompt).toContain("Supervisor role reminder:");
|
||||
const review = async () => (await runtime.hooks.get("before_agent_start")({}, runtime.ctx)).systemPrompt;
|
||||
expect(await review()).not.toContain("Supervisor role reminder:");
|
||||
for (let i = 0; i < 5; i++) await runtime.hooks.get("turn_end")({}, runtime.ctx);
|
||||
expect(await review()).toContain("Supervisor role reminder:");
|
||||
await runtime.hooks.get("session_compact")({}, runtime.ctx);
|
||||
expect(await review()).toContain("Supervisor role reminder:");
|
||||
writeFileSync(join(cwd, "plan.md"), "# Outcome\nBeat random\n1. [x] goal: repair\n - discriminator: beats random\n");
|
||||
expect(await review()).toContain("Supervisor role reminder:");
|
||||
expect(systemPrompt).toContain("your judgment");
|
||||
expect(systemPrompt).toContain("justified confidence, not certainty at any cost");
|
||||
expect(systemPrompt).toContain('Treat "blocked", "waiting", "impossible", and "already done" as claims to investigate');
|
||||
|
||||
Reference in New Issue
Block a user