Skip to content

Proof output retention Phase 2: upstream prompt policy and budget preflight #201

@tonyketcham

Description

@tonyketcham

Summary

Implement honest prompt-budget controls for full/summarized upstream transcript use.

Source Context

Why This Exists

  • Phase 1 splits execution-authoritative transcripts from bounded canvas display, but it intentionally leaves prompt-budget controls narrow.
  • The proposal says Phases 1 and 2 together carry the full 'remove the silent truncation' promise: Phase 2 makes expanded upstream context safe by validating prompt size before dispatch.
  • The review notes the Phase 1 parser only accepts 'full' | 'summarize'; this issue should finish the planned { maxChars: N } object form and CLI/DAG precedence model instead of leaving authors with a vague rejection.

Acceptance Criteria

  • Extend DAG.outputPolicy validation to support upstream: 'full' | 'summarize' | { maxChars: number } plus maxPromptChars.
  • Add preflight prompt-length accounting before agent.send(stitched); overflow marks the task BUDGET-EXCEEDED and names parent contribution sizes.
  • Add CLI overrides --output-policy-upstream <full|summarize|maxChars:N> and --max-prompt-chars <N> with documented DAG-vs-CLI precedence.
  • Reuse the existing EXIT_BUDGET_EXCEEDED = 4 path and preserve downstream skip behavior for budget-exceeded parents.
  • Cover default behavior, full late-marker pass-through, overflow messaging, and CLI/DAG precedence with focused tests.

Verification

  • pnpm -F @flatbread/proof test
  • pnpm -F @flatbread/proof typecheck
  • pnpm verify

Related Phase Issues

Artifact Linkage

This issue is linked back from docs/proposals/proof-output-retention-plan.md and, where relevant, docs/proposals/proof-output-retention-review.md so the repo artifacts and GitHub issues remain navigable in both directions.

Metadata

Metadata

Assignees

No one assigned

    Labels

    CLIcommand line interfaceenhancementNew feature or requesttestinge2e, unit, and integration testing

    Type

    No type
    No fields configured for issues without a type.

    Projects

    Status

    Todo

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions