Skip to content

feat(pi): add structured work continuity tools - #1617

Merged
Teingi merged 3 commits into
oceanbase:masterfrom
wutongyuonce:feat/pi-structured-work-continuity
Sep 15, 2026
Merged

Teingi merged 3 commits into
oceanbase:masterfrom
wutongyuonce:feat/pi-structured-work-continuity

Conversation

@wutongyuonce

@wutongyuonce wutongyuonce commented Sep 15, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Adds the missing structured work-continuity operations to the native Pi integration:

  • pc_work_contract -> create_work_contract
  • pc_handoff_current -> handoff_current_work
  • pc_handoff_acknowledge -> acknowledge_handoff
  • pc_task_outcome -> record_task_outcome

Refs #1338

Final design

The implementation follows the original plan while keeping the scope at the Recommended Pi profile:

  1. Create a Work Contract only for explicitly delegated work that has a stable inspected baseline. The contract records objective, grounded facts, scope, exclusions, completion criteria, authorization notes, and open questions; it grants no execution authority.
  2. Use pc_handoff_current at a current-work transfer boundary. It prepares a temporary Handoff from the current Scope; the returned Handoff carrier is passed unchanged to the receiving task or to an explicitly requested durable commit.
  3. The receiving task verifies the Handoff against live repository state, capabilities, and authorization, then acknowledges the prepared or exact target with the three receiver checks.
  4. Record a Task Outcome only at an actual completion or interruption boundary, preserving status, observations, checks, produced artifacts, and remaining work.

All four tools use the existing OpenAPI contracts, including nested citation/reference and generation metadata schemas. They are marked mutating and included in the write-operation set, so interactive confirmation, no-UI refusal, Scope injection, and secret filtering apply consistently. The project-context Skill documents when to use each operation and requires exact pass-through of Handoff and citation references.

This PR does not claim the Full profile and does not add External Skills, Experience/Skill generation, candidate decisioning, Stats/Memory Changes, or Workstream persistence.

Verification

  • Pi package tests: 91 passed
  • TypeScript typecheck: passed
  • Integration manifest tests: 26 passed
  • Generated manifest check: passed
  • ty check: passed
  • git diff --check: passed

Implementation and verification were performed with Codex (GPT-5.6 Sol). An independent read-only review was performed in a separate Codex session using GPT-5.6 Luna with medium reasoning; all actionable findings were resolved before submission.

Lore: Make the native Pi argument schema no stricter than the OpenAPI contract, and stop the project-context Skill from linking a prepared Handoff Receipt to a Task Outcome.

Constraint: TaskCheck.details stays nullable and optional; handoff_receipt_ref remains valid only for an accepted exact (committed) Handoff Receipt.

Tested: pnpm test (92 passed) and pnpm typecheck in integrations/pi/plugins/powercontext; the new regression test fails against the previous declarations.

Not-tested: No live Server run; the Receipt rule is asserted from the server-side validator and the documented interfaces.
Lore: Keep the Pi project-context Skill complete for the structured work loop it now advertises, so callers do not discover the Server's claim rules only through a 422.

Constraint: Skill guidance only; no tool schema, payload, or Server contract change.

Tested: pnpm test (92 passed) and pnpm typecheck in integrations/pi/plugins/powercontext; Skill line lengths match their section.

Not-tested: No live Server run; the claim rules mirror the WorkClaim and TaskCheck validators.
@wutongyuonce

Copy link
Copy Markdown
Contributor Author

Follow-up commit 0e93f1fe after a full self-review of this PR (schema parity, payload routing, write gating, capability manifest, Skill against the Server validators).

Skill fixes found in that pass:

  • Restored the receiver-side resolution step. The restructure introduced by this PR dropped the instruction that the receiving task resolves the transferred value with pc_handoff_continue (selection: "prepared" with that exact value, or selection: "exact" with the committed revision) before verifying and acknowledging it. tests/package.spec.ts was changed to assert pc_handoff_current in place of pc_handoff_continue, so the removal was invisible to the test surface.
  • Stated the Server's claim rules. WorkClaim and TaskCheck reject both verified without exact evidence and declared with evidence (HTTP 422). The Skill never said so, while the claude-code and codex Skills do ("Use declared for claims without an exact same-scope citation; never invent verified evidence"). The Skill now states the rule once for Work Contracts, Handoffs, and Task Outcomes.

Everything else I re-checked is consistent and needed no change:

  • All twelve new TypeBox structures match the OpenAPI required/nullable/enum/minItems/maxItems/pattern constraints (WorkClaim.evidence 31, TaskCheck.evidence 32, HandoffStatement.citations 1..32, generation metadata digests, MemoryCitation reference patterns); TaskCheck.details was the only mismatch and is fixed in 7a7240d3.
  • The four payloads match CreateWorkContractRequest, HandoffCurrentWorkRequest, AcknowledgeHandoffRequest, and RecordTaskOutcomeRequest; handoff_current_work returns a PreparedWorkHandoff whose handoff member is a PreparedHandoff, so the documented pass-through to acknowledge_handoff and commit_handoff is schema-compatible.
  • Write gating: all four are mutates: true and join WRITE_OPERATIONS in invoke.ts, which is the plugin's only global operation list.
  • capabilities.toml: the added capabilities make the derived profiles minimal + recommended, matching the declared profiles list; generate_integration_manifest_docs.py --check and tests/test_integration_manifest.py (26 passed) are green.

Local verification: pnpm test 92 passed, pnpm typecheck clean, git diff --check clean.

@Teingi
Teingi merged commit 5ea7126 into oceanbase:master Sep 15, 2026
18 checks passed
@wutongyuonce
wutongyuonce deleted the feat/pi-structured-work-continuity branch September 15, 2026 13:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant